Integrated menu into demo resource branch for OS X. Indicating items that open more choices with ...

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8167 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2011-01-02 03:50:54 +00:00
parent 5f2aa6ca9c
commit e203237eb3
5 changed files with 38 additions and 137 deletions

View File

@ -503,6 +503,7 @@
C962910E1274D1D7007D3CFE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9628FFD1274D0B3007D3CFE /* Cocoa.framework */; };
C96291151274D1FD007D3CFE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9628FFD1274D0B3007D3CFE /* Cocoa.framework */; };
C96291E712756D5E007D3CFE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9628FFB1274D0B3007D3CFE /* Carbon.framework */; };
C984AFA812D02A1800D66DAD /* demo.menu in Resources */ = {isa = PBXBuildFile; fileRef = C984AFA712D02A1800D66DAD /* demo.menu */; };
C9A374AB3AD29E141C659819 /* fltk.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = FEB0F8FE6383384180570D94 /* fltk.framework */; };
C9C4C91FDA73557BB6B69F3D /* jchuff.c in Sources */ = {isa = PBXBuildFile; fileRef = D9DB580DCA05DE487FACA272 /* jchuff.c */; };
C9D72F10B7A22DD0349ABC68 /* fltk_forms.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 097D0B476E396B9AAC6FA1E0 /* fltk_forms.framework */; };
@ -4476,6 +4477,7 @@
C9628FFD1274D0B3007D3CFE /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
C96290E11274D0EF007D3CFE /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = System/Library/Frameworks/AGL.framework; sourceTree = SDKROOT; };
C96290E51274D100007D3CFE /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
C984AFA712D02A1800D66DAD /* demo.menu */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = demo.menu; path = ../../test/demo.menu; sourceTree = SOURCE_ROOT; };
C9EDD143127338F600ADB21C /* README.OSX.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.OSX.txt; path = ../../README.OSX.txt; sourceTree = SOURCE_ROOT; };
C9EDD4DE1274BB6600ADB21C /* png.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = png.h; path = ../../png/png.h; sourceTree = SOURCE_ROOT; };
C9EDD4DF1274BB6600ADB21C /* pngconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pngconf.h; path = ../../png/pngconf.h; sourceTree = SOURCE_ROOT; };
@ -5599,6 +5601,7 @@
isa = PBXGroup;
children = (
8D4E2F8A10BA06E332B7EB03 /* demo.cxx */,
C984AFA712D02A1800D66DAD /* demo.menu */,
);
name = Demo;
sourceTree = "<group>";
@ -5649,7 +5652,6 @@
2000E0C1AD91ACA63811D339 = {
isa = PBXGroup;
children = (
C9F9C0DD12CFCDAC0067ADCC /* rgb.txt */,
C9EDD143127338F600ADB21C /* README.OSX.txt */,
5D444464FCF5714805936107 /* Applications */,
188555DBC553F66588792C6B /* Frameworks */,
@ -6634,6 +6636,7 @@
isa = PBXGroup;
children = (
EC5862E1FC79542DC55D8462 /* colbrowser.cxx */,
C9F9C0DD12CFCDAC0067ADCC /* rgb.txt */,
);
name = colbrowser;
sourceTree = "<group>";
@ -9034,6 +9037,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C984AFA812D02A1800D66DAD /* demo.menu in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -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);

View File

@ -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" is still NULL, we will read the menu from the string array in the
// beginning of the file.
#endif
if (fin == NULL) {
return 0;
}
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;
}

View File

@ -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

View File

@ -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
}
}