summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/checkers.cxx5
-rw-r--r--test/demo.cxx125
-rw-r--r--test/demo.menu20
-rw-r--r--test/mandelbrot_ui.fl17
4 files changed, 32 insertions, 135 deletions
diff --git a/test/checkers.cxx b/test/checkers.cxx
index 1bfc9ccde..4c7a21524 100644
--- a/test/checkers.cxx
+++ b/test/checkers.cxx
@@ -962,13 +962,16 @@ int squarey(int i) {return (usermoves(i,2)-'1')*BOXSIZE+BMOFFSET;}
void Board::draw() {
make_bitmaps();
+ // -- draw the board itself
fl_draw_box(box(),0,0,w(),h(),color());
+ // -- draw all dark tiles
fl_color((Fl_Color)10 /*107*/);
int x; for (x=0; x<8; x++) for (int y=0; y<8; y++) {
if (!((x^y)&1)) fl_rectf(BORDER+x*BOXSIZE, BORDER+y*BOXSIZE,
BOXSIZE-BORDER, BOXSIZE-BORDER);
}
- fl_color(FL_DARK3 /*FL_GRAY_RAMP+4*/);
+ // -- draw outlines around the fileds
+ fl_color(FL_DARK3);
for (x=0; x<9; x++) {
fl_rectf(x*BOXSIZE,0,BORDER,h());
fl_rectf(0,x*BOXSIZE,w(),BORDER);
diff --git a/test/demo.cxx b/test/demo.cxx
index f52951b2b..66e34ba0c 100644
--- a/test/demo.cxx
+++ b/test/demo.cxx
@@ -25,106 +25,6 @@
// http://www.fltk.org/str.php
//
-const char *default_menu[] = {
- "# Menu description file for the generic demo program\n",
- "#\n",
- "# Each line consists of three fields, separated by :\n",
- "#\n",
- "# - menu name : To which the item belongs (starts with @)\n",
- "# - item name : Placed on button. (use \\n for newline)\n",
- "# - command name: To be executed. Use a menu name to define a submenu.\n",
- "#\n",
- "# @main indicates the main menu.\n",
- "#\n",
- "\n",
- "@main:Widget\\nTests:@x\n",
- "@x:Fl_Browser:browser browser.cxx\n",
- "@x:Fl_Input:input\n",
- "@x:Fl_Output:output\n",
- "@x:Fl_Button:radio\n",
- "@x:Fl_Tabs:tabs\n",
- "@x:Fl_Tile:tile\n",
- "@x:Fl_Scroll:scroll\n",
- "@x:Fl_Pack:pack\n",
- "@x:more...:@xm\n",
- "@xm:Fl_Menu:menubar\n",
- "@xm:Fl_Table:table\n",
- "@xm:Fl_Tree:tree\n",
- "\n",
- "@main:Window\\nTests:@w\n",
- "@w:overlay:overlay\n",
- "@w:subwindow:subwindow\n",
- "@w:double\\nbuffer:doublebuffer\n",
- "@w:GL window:cube\n",
- "@w:GL overlay:gl_overlay\n",
- "@w:iconize:iconize\n",
- "@w:fullscreen:fullscreen\n",
- "@w:resizable:resizebox\n",
- "@w:resize:resize\n",
- "\n",
- "@main:Drawing\\nTests:@d\n",
- "@d:Images:@di\n",
- "@di:Fl_Bitmap:bitmap\n",
- "@di:Fl_Pixmap:pixmap\n",
- "@di:Fl_RGB\\n_Image:image\n",
- "@di:Fl_Shared\\n_Image:pixmap_browser\n",
- "@di:Fl_Tiled\\n_Image:tiled_image\n",
- "@d:cursor:cursor\n",
- "@d:labels:label\n",
- "@d:rotated text:rotated_text\n",
- "@d:fl_arc:arc\n",
- "@d:fl_curve:curve\n",
- "@d:fl_line_style:line_style\n",
- "\n",
- "@main:Events:@u\n",
- "@u:navigation:navigation\n",
- "@u:minimum update:minimum\n",
- "@u:keyboard:keyboard\n",
- "@u:fast && slow widgets:fast_slow\n",
- "@u:inactive:inactive\n",
- "\n",
- "@main:Fluid\\n(UI design tool):../fluid/fluid valuators.fl\n",
- "\n",
- "@main:Cool\\nDemos:@e\n",
- "@e:X Color\\nBrowser:colbrowser\n",
- "@e:Mandelbrot:mandelbrot\n",
- "@e:Fractals:fractals\n",
- "@e:Puzzle:glpuzzle\n",
- "@e:Block\\nAttack!:blocks\n",
- "@e:Checkers:checkers\n",
- "@e:Sudoku:sudoku\n",
- "@e:Print\\nsupport:device\n",
- "\n",
- "@main:Other\\nTests:@o\n",
- "@o:Color Choosers:color_chooser\n",
- "@o:File Chooser:file_chooser\n",
- "@o:Native File Chooser:native-filechooser\n",
- "@o:Font Tests:@of\n",
- "@of:Fonts:fonts\n",
- "@of:UTF-8:utf8\n",
- "@o:HelpDialog:help\n",
- "@o:Input Choice:input_choice\n",
- "@o:Preferences:preferences\n",
- "@o:Threading:threads\n",
- "@o:XForms Emulation:forms\n",
- "\n",
- "@main:Tutorial\\nfrom\\nManual:@j\n",
- "@j:ask\\n(modified):ask\n",
- "@j:button:button\n",
- "@j:CubeView:CubeView\n",
- "@j:editor:editor editor.cxx\n",
- "@j:hello:hello\n",
- "@j:shape:shape\n",
- "\n",
- "@main:Images\\nfor\\nManual:@i\n",
- "@i:valuators:valuators\n",
- "@i:symbols:symbols\n",
- "@i:buttons:buttons\n",
- "@i:clock:clock\n",
- "@i:popups:message\n",
- "@i:boxtypes:boxtype\n",
- 0 };
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -383,7 +283,7 @@ void dobut(Fl_Widget *, long arg)
char command[2048], path[2048], app_path[2048];
- // this neat litle block of cose ensures that the current directory is set
+ // this neat litle block of code ensures that the current directory is set
// to the location of the Demo application.
CFBundleRef app = CFBundleGetMainBundle();
CFURLRef url = CFBundleCopyBundleURL(app);
@@ -435,11 +335,10 @@ int load_the_menu(const char* fname)
{
FILE *fin = 0;
char line[256], mname[64],iname[64],cname[64];
- int i,j, mi = 0;
+ int i, j;
fin = fl_fopen(fname,"r");
- if (fin == NULL)
- {
-#if defined ( __APPLE__ )
+#if defined ( USING_XCODE )
+ if (fin == NULL) {
// mac os bundle menu detection:
char* pos = strrchr(fname,'/');
if (!pos) return 0;
@@ -448,18 +347,13 @@ int load_the_menu(const char* fname)
if (!pos) return 0;
strcpy(pos,"/Resources/demo.menu");
fin = fl_fopen(fname,"r");
+ }
#endif
+ if (fin == NULL) {
+ return 0;
}
- // if "fin" is still NULL, we will read the menu from the string array in the
- // beginning of the file.
for (;;) {
- if (fin) {
- if (fgets(line,256,fin) == NULL) break;
- } else {
- const char *m = default_menu[mi++];
- if (!m) break;
- strcpy(line, m);
- }
+ if (fgets(line,256,fin) == NULL) break;
// remove all carriage returns that Cygwin may have inserted
char *s = line, *d = line;
for (;;++d) {
@@ -493,8 +387,7 @@ int load_the_menu(const char* fname)
cname[j] = '\0';
addto_menu(mname,iname,cname);
}
- if (fin)
- fclose(fin);
+ fclose(fin);
return 1;
}
diff --git a/test/demo.menu b/test/demo.menu
index d1f82b1b8..03143c254 100644
--- a/test/demo.menu
+++ b/test/demo.menu
@@ -9,7 +9,7 @@
# @main indicates the main menu.
#
-@main:Widget\nTests:@x
+@main:Widget\nTests...:@x
@x:Fl_Browser:browser
@x:Fl_Input:input
@x:Fl_Output:output
@@ -23,7 +23,7 @@
@xm:Fl_Table:table
@xm:Fl_Tree:tree
-@main:Window\nTests:@w
+@main:Window\nTests...:@w
@w:overlay:overlay
@w:subwindow:subwindow
@w:double\nbuffer:doublebuffer
@@ -34,8 +34,8 @@
@w:resizable:resizebox
@w:resize:resize
-@main:Drawing\nTests:@d
- @d:Images:@di
+@main:Drawing\nTests...:@d
+ @d:Images...:@di
@di:Fl_Bitmap:bitmap
@di:Fl_Pixmap:pixmap
@di:Fl_RGB\n_Image:image
@@ -48,7 +48,7 @@
@d:fl_curve:curve
@d:fl_line_style:line_style
-@main:Events:@u
+@main:Events...:@u
@u:navigation:navigation
@u:minimum update:minimum
@u:keyboard:keyboard
@@ -57,7 +57,7 @@
@main:Fluid\n(UI design tool):../fluid/fluid valuators.fl
-@main:Cool\nDemos:@e
+@main:Cool\nDemos...:@e
@e:X Color\nBrowser:colbrowser
@e:Mandelbrot:mandelbrot
@e:Fractals:fractals
@@ -67,11 +67,11 @@
@e:Sudoku:sudoku
@e:Print\nsupport:device
-@main:Other\nTests:@o
+@main:Other\nTests...:@o
@o:Color Choosers:color_chooser
@o:File Chooser:file_chooser
@o:Native File Chooser:native-filechooser
- @o:Font Tests:@of
+ @o:Font Tests...:@of
@of:Fonts:fonts
@of:UTF-8:utf8
@o:HelpDialog:help
@@ -80,7 +80,7 @@
@o:Threading:threads
@o:XForms Emulation:forms
-@main:Tutorial\nfrom\nManual:@j
+@main:Tutorial\nfrom\nManual...:@j
@j:ask\n(modified):ask
@j:button:button
@j:CubeView:CubeView
@@ -88,7 +88,7 @@
@j:hello:hello
@j:shape:shape
-@main:Images\nfor\nManual:@i
+@main:Images\nfor\nManual...:@i
@i:valuators:valuators
@i:symbols:symbols
@i:buttons:buttons
diff --git a/test/mandelbrot_ui.fl b/test/mandelbrot_ui.fl
index f0ffe8545..6c6072e07 100644
--- a/test/mandelbrot_ui.fl
+++ b/test/mandelbrot_ui.fl
@@ -2,16 +2,17 @@
version 1.0300
header_name {.h}
code_name {.cxx}
-decl {\#include "mandelbrot.h"} {public
+decl {\#include "mandelbrot.h"} {public local
}
-decl {\#include <stdlib.h>} {}
+decl {\#include <stdlib.h>} {private local
+}
class Drawing_Window {open
} {
Function {make_window()} {open return_type void
} {
- Fl_Window window {open selected
+ Fl_Window window {open
xywh {178 479 450 520} type Single resizable
code0 {o->size_range(220,220);} visible
} {
@@ -24,21 +25,21 @@ class Drawing_Window {open
label {x:}
callback {d->X = atof(o->value());;
d->new_display();}
- xywh {30 15 125 30} type Float box THIN_DOWN_BOX color 8 selection_color 7 labelfont 11 labelsize 20 textfont 11 textsize 20
+ xywh {30 15 125 30} type Float box THIN_DOWN_BOX color 48 selection_color 7 labelfont 11 labelsize 20 textfont 11 textsize 20
code0 {o->when(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE);}
}
Fl_Input y_input {
label {y:}
callback {d->Y = atof(o->value());
d->new_display();}
- xywh {175 15 125 30} type Float box THIN_DOWN_BOX color 8 selection_color 7 labelfont 11 labelsize 20 textfont 11 textsize 20
+ xywh {175 15 125 30} type Float box THIN_DOWN_BOX color 48 selection_color 7 labelfont 11 labelsize 20 textfont 11 textsize 20
code0 {o->when(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE);}
}
Fl_Input w_input {
label {w:}
callback {d->scale = atof(o->value());
d->new_display();}
- xywh {325 15 105 30} type Float box THIN_DOWN_BOX color 8 selection_color 7 labelfont 11 labelsize 20 textfont 11 textsize 20
+ xywh {325 15 105 30} type Float box THIN_DOWN_BOX color 48 selection_color 7 labelfont 11 labelsize 20 textfont 11 textsize 20
code0 {o->when(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE);}
}
Fl_Slider {} {
@@ -52,7 +53,7 @@ d->new_display();}
}
Fl_Box {} {
label {left: click = zoom out, drag = zoom in
-right click: Julia set, ctrl-P: Print}
+right click: Julia set, ctrl-P: Print} selected
xywh {240 50 190 30} labelsize 10 align 24 deactivate
}
Fl_Slider {} {
@@ -66,6 +67,6 @@ d->new_display();}
}
}
}
- decl {void update_label();} {public
+ decl {void update_label();} {public local
}
}