summaryrefslogtreecommitdiff
path: root/test/forms.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2015-04-03 12:18:31 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2015-04-03 12:18:31 +0000
commite27102b0e97385ca08c2e6e406db208c79dc952f (patch)
treed7ce9c6be8a1b18b5c6dbe8f4e3302f440e1fd0a /test/forms.cxx
parent762df8420786b6901a372bd80d2ebb0d2f84db03 (diff)
Fix compiler warnings in test/forms.cxx and more (inspired by STR #2813).
This update ought to fix the compiler warnings (tested only under Linux) mentioned in STR #2813. The patch is very different though (more radical). Also removed unused code, fixed copyright and trailing white space. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10666 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/forms.cxx')
-rw-r--r--test/forms.cxx60
1 files changed, 11 insertions, 49 deletions
diff --git a/test/forms.cxx b/test/forms.cxx
index a558bc300..d4f9ee0e2 100644
--- a/test/forms.cxx
+++ b/test/forms.cxx
@@ -3,13 +3,12 @@
//
// Another forms demo for the Fast Light Tool Kit (FLTK).
//
-// This is an XForms program with very few changes.
-// Search for "fltk" to find all changes necessary to port to fltk.
+// This is an XForms program with some changes for FLTK.
//
// This demo show the different boxtypes. Note that some
// boxtypes are not appropriate for some objects
//
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2015 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -27,14 +26,7 @@
static int border = 1; // changed from FL_TRANSIENT for fltk
// (this is so the close box and Esc work to close the window)
-typedef struct { int val; const char *name; } VN_struct;
-#define VN(a) {a,#a}
-
-// static VN_struct gmode[] =
-// {
-// VN(StaticGray), VN(GrayScale), VN(StaticColor),
-// VN(PseudoColor), VN(TrueColor), VN(DirectColor),
-// };
+typedef struct { Fl_Boxtype val; const char *name; } VN_struct;
static VN_struct btypes[]=
{
@@ -60,7 +52,7 @@ static VN_struct btypes[]=
{FL_GTK_ROUND_UP_BOX,"GTK round up box"},
{FL_GLEAM_UP_BOX,"Gleam up box"},
/* sentinel */
- {-1}
+ {(Fl_Boxtype)(-1)}
};
#include "pixmaps/srs.xbm"
@@ -70,7 +62,7 @@ static VN_struct btypes[]=
FL_FORM *form;
Fl_Widget *tobj[18], *exitob, *btypeob, *modeob;
-void
+void
boxtype_cb (Fl_Widget * ob, long)
{
int i, req_bt = fl_get_choice(ob) - 1;
@@ -81,39 +73,21 @@ boxtype_cb (Fl_Widget * ob, long)
fl_freeze_form (form);
fl_redraw_form (form);
for (i = 0; i < 18; i++)
- fl_set_object_boxtype (tobj[i], (Fl_Boxtype)btypes[req_bt].val);
+ fl_set_object_boxtype (tobj[i], btypes[req_bt].val);
fl_unfreeze_form (form);
lastbt = req_bt;
fl_redraw_form(form); // added for fltk
}
}
-void
-mode_cb (Fl_Widget *, long)
-{
-// static int lval = -1;
-// int val = fl_get_choice (ob) -1;
-// int db = 0;
-
-// if (val == lval || val < 0)
-// return;
-
-// fl_hide_form (form);
-// if (!fl_mode_capable (gmode[val].val, 0))
-// {
-// fl_set_choice(ob, lval);
-// val = lval;
-// }
-
-// fl_set_graphics_mode (gmode[val].val, db);
-// fl_show_form (form, FL_PLACE_GEOMETRY, border, "Box types");
-
-// lval = val;
+void
+mode_cb (Fl_Widget *, long) {
+ // empty
}
/*************** Creation Routines *********************/
-void
+void
create_form_form (void)
{
Fl_Widget *obj;
@@ -155,7 +129,7 @@ create_form_form (void)
}
/*---------------------------------------*/
-void
+void
create_the_forms (void)
{
create_form_form ();
@@ -206,18 +180,6 @@ main (int argc, char *argv[])
for ( vn = btypes; vn->val >= 0; vn++)
fl_addto_choice(btypeob, vn->name);
-// {
-// int i;
-// VN_struct *g = gmode, *gs = g + sizeof (gmode) / sizeof (gmode[0]);
-// for (i = 1; g < gs; g++, i++)
-// {
-// fl_addto_choice (modeob, g->name);
-// if(!fl_mode_capable(g->val, 0))
-// fl_set_choice_item_mode(modeob, i, FL_PUP_GRAY);
-// }
-// }
-// fl_set_choice (modeob, fl_vmode+1);
-
fl_show_form (form, FL_PLACE_MOUSE, border, "Box types");
while (fl_do_forms () != exitob)