Fix typos, formatting, and text alignment in test/forms.cxx

no real code changes
This commit is contained in:
Albrecht Schlosser
2023-12-19 19:21:39 +01:00
parent 96bacd3f9d
commit 05687d1cb4
+17 -28
View File
@@ -6,7 +6,7 @@
// This demo show the different boxtypes. Note that some // This demo show the different boxtypes. Note that some
// boxtypes are not appropriate for some objects // boxtypes are not appropriate for some objects
// //
// Copyright 1998-2015 by Bill Spitzak and others. // Copyright 1998-2023 by Bill Spitzak and others.
// //
// This library is free software. Distribution and use rights are outlined in // 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 // the file "COPYING" which should have been included with this file. If this
@@ -19,15 +19,14 @@
// https://www.fltk.org/bugs.php // https://www.fltk.org/bugs.php
// //
#include <FL/forms.H> // changed for fltk #include <FL/forms.H> // changed for FLTK
static int border = 1; // changed from FL_TRANSIENT for fltk static int border = 1; // changed from FL_TRANSIENT for FLTK
// (this is so the close box and Esc work to close the window) // (this is so the close box and Esc work to close the window)
typedef struct { Fl_Boxtype val; const char *name; } VN_struct; typedef struct { Fl_Boxtype val; const char *name; } VN_struct;
static VN_struct btypes[]= static VN_struct btypes[] = {
{
{FL_NO_BOX, "no box"}, {FL_NO_BOX, "no box"},
{FL_UP_BOX, "up box"}, {FL_UP_BOX, "up box"},
{FL_DOWN_BOX, "down box"}, {FL_DOWN_BOX, "down box"},
@@ -38,7 +37,7 @@ static VN_struct btypes[]=
{FL_EMBOSSED_BOX, "embossed box"}, {FL_EMBOSSED_BOX, "embossed box"},
{FL_ROUNDED_BOX, "rounded box"}, {FL_ROUNDED_BOX, "rounded box"},
{FL_RFLAT_BOX, "rflat box"}, {FL_RFLAT_BOX, "rflat box"},
{FL_RSHADOW_BOX,"rshadow box"}, // renamed for fltk {FL_RSHADOW_BOX, "rshadow box"}, // renamed for FLTK
{FL_OVAL_BOX, "oval box"}, {FL_OVAL_BOX, "oval box"},
{FL_ROUNDED3D_UPBOX, "rounded3d upbox"}, {FL_ROUNDED3D_UPBOX, "rounded3d upbox"},
{FL_ROUNDED3D_DOWNBOX, "rounded3d downbox"}, {FL_ROUNDED3D_DOWNBOX, "rounded3d downbox"},
@@ -60,34 +59,28 @@ static VN_struct btypes[]=
FL_FORM *form; FL_FORM *form;
Fl_Widget *tobj[18], *exitob, *btypeob, *modeob; Fl_Widget *tobj[18], *exitob, *btypeob, *modeob;
void void boxtype_cb(Fl_Widget *ob, long) {
boxtype_cb (Fl_Widget * ob, long)
{
int i, req_bt = fl_get_choice(ob) - 1; int i, req_bt = fl_get_choice(ob) - 1;
static int lastbt = -1; static int lastbt = -1;
if(lastbt != req_bt) if (lastbt != req_bt) {
{
fl_freeze_form(form); fl_freeze_form(form);
fl_redraw_form(form); fl_redraw_form(form);
for (i = 0; i < 18; i++) for (i = 0; i < 18; i++)
fl_set_object_boxtype(tobj[i], btypes[req_bt].val); fl_set_object_boxtype(tobj[i], btypes[req_bt].val);
fl_unfreeze_form(form); fl_unfreeze_form(form);
lastbt = req_bt; lastbt = req_bt;
fl_redraw_form(form); // added for fltk fl_redraw_form(form); // added for FLTK
} }
} }
void void mode_cb(Fl_Widget *, long) {
mode_cb (Fl_Widget *, long) {
// empty // empty
} }
/*************** Creation Routines *********************/ /*************** Creation Routines *********************/
void void create_form_form(void) {
create_form_form (void)
{
Fl_Widget *obj; Fl_Widget *obj;
form = fl_bgn_form(FL_NO_BOX, 720, 520); form = fl_bgn_form(FL_NO_BOX, 720, 520);
@@ -103,7 +96,7 @@ create_form_form (void)
fl_set_object_lcol(obj, FL_BLUE); fl_set_object_lcol(obj, FL_BLUE);
tobj[3] = obj = fl_add_chart(FL_BAR_CHART, 160, 110, 160, 110, "Chart"); tobj[3] = obj = fl_add_chart(FL_BAR_CHART, 160, 110, 160, 110, "Chart");
tobj[4] = obj = fl_add_clock(FL_ANALOG_CLOCK, 40, 390, 90, 90, "Clock"); tobj[4] = obj = fl_add_clock(FL_ANALOG_CLOCK, 40, 390, 90, 90, "Clock");
//fl_set_object_dblbuffer(tobj[4],1); // removed for fltk // fl_set_object_dblbuffer(tobj[4],1); // removed for FLTK
tobj[5] = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 110, 120, 30, "Button"); tobj[5] = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 110, 120, 30, "Button");
tobj[6] = obj = fl_add_lightbutton(FL_PUSH_BUTTON, 340, 150, 120, 30, "Lightbutton"); tobj[6] = obj = fl_add_lightbutton(FL_PUSH_BUTTON, 340, 150, 120, 30, "Lightbutton");
tobj[7] = obj = fl_add_roundbutton(FL_PUSH_BUTTON, 340, 190, 120, 30, "Roundbutton"); tobj[7] = obj = fl_add_roundbutton(FL_PUSH_BUTTON, 340, 190, 120, 30, "Roundbutton");
@@ -116,7 +109,7 @@ create_form_form (void)
tobj[14] = obj = fl_add_menu(FL_PUSH_MENU, 400, 240, 100, 30, "Menu"); tobj[14] = obj = fl_add_menu(FL_PUSH_MENU, 400, 240, 100, 30, "Menu");
tobj[15] = obj = fl_add_choice(FL_NORMAL_CHOICE, 580, 250, 110, 30, "Choice"); tobj[15] = obj = fl_add_choice(FL_NORMAL_CHOICE, 580, 250, 110, 30, "Choice");
tobj[16] = obj = fl_add_timer(FL_VALUE_TIMER, 580, 210, 110, 30, "Timer"); tobj[16] = obj = fl_add_timer(FL_VALUE_TIMER, 580, 210, 110, 30, "Timer");
//fl_set_object_dblbuffer(tobj[16], 1); // removed for fltk // fl_set_object_dblbuffer(tobj[16], 1); // removed for FLTK
tobj[17] = obj = fl_add_browser(FL_NORMAL_BROWSER, 450, 300, 240, 180, "Browser"); tobj[17] = obj = fl_add_browser(FL_NORMAL_BROWSER, 450, 300, 240, 180, "Browser");
exitob = obj = fl_add_button(FL_NORMAL_BUTTON, 590, 30, 100, 30, "Exit"); exitob = obj = fl_add_button(FL_NORMAL_BUTTON, 590, 30, 100, 30, "Exit");
btypeob = obj = fl_add_choice(FL_NORMAL_CHOICE, 110, 30, 130, 30, "Boxtype"); btypeob = obj = fl_add_choice(FL_NORMAL_CHOICE, 110, 30, 130, 30, "Boxtype");
@@ -127,9 +120,7 @@ create_form_form (void)
} }
/*---------------------------------------*/ /*---------------------------------------*/
void void create_the_forms(void) {
create_the_forms (void)
{
create_form_form(); create_form_form();
} }
@@ -140,19 +131,17 @@ const char *browserlines[] = {
"This demo shows you all", "objects that currently", "This demo shows you all", "objects that currently",
"exist in the Forms Library.", " ", "exist in the Forms Library.", " ",
"You can change the boxtype", "of the different objects", "You can change the boxtype", "of the different objects",
"using the buttons at the", "top of the form. Note that", "using the buttons at the top", "of the form. Note that some",
"some combinations might not", "look too good. Also realize", "combinations might not", "look too good. Also realize",
"that for all object classes", "many different types are", "that for all object classes", "many different types are",
"available with different", "behaviour.", " ", "available with different", "behaviour.", " ",
"With this demo you can also", "see the effect of the drawing", "With this demo you can also", "see the effect of the drawing",
"mode on the appearance of the","objects.", "mode on the appearance of", "the objects.",
0 0
}; };
int int main(int argc, char *argv[]) {
main (int argc, char *argv[])
{
FL_COLOR c = FL_BLACK; FL_COLOR c = FL_BLACK;
const char **p; const char **p;
VN_struct *vn; VN_struct *vn;