Fixes from Bill:

- Fluid fixes for menu item numbering and adding of #define stuff to
  include file to prevent multiple inclusion.
- Fixed contrast function (again).
- Fixed fractals demo (not using glutMainLoop()...


git-svn-id: file:///fltk/svn/fltk/trunk@232 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 1999-01-19 19:10:39 +00:00
parent b2290975d4
commit 576f02c063
5 changed files with 33 additions and 21 deletions

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Menu_Type.cxx,v 1.9 1999/01/13 15:51:51 mike Exp $" // "$Id: Fl_Menu_Type.cxx,v 1.10 1999/01/19 19:10:38 mike Exp $"
// //
// Menu item code for the Fast Light Tool Kit (FLTK). // Menu item code for the Fast Light Tool Kit (FLTK).
// //
@ -307,7 +307,7 @@ void Fl_Menu_Item_Type::write_code1() {
if (extra_code(n) && !isdeclare(extra_code(n))) { if (extra_code(n) && !isdeclare(extra_code(n))) {
if (!init) { if (!init) {
init = 1; init = 1;
write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), name, i); write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), name, i);
} }
write_c("%s %s\n", indent(), extra_code(n)); write_c("%s %s\n", indent(), extra_code(n));
} }
@ -529,5 +529,5 @@ void shortcut_in_cb(Shortcut_Button* i, void* v) {
} }
// //
// End of "$Id: Fl_Menu_Type.cxx,v 1.9 1999/01/13 15:51:51 mike Exp $". // End of "$Id: Fl_Menu_Type.cxx,v 1.10 1999/01/19 19:10:38 mike Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: code.cxx,v 1.8 1999/01/07 19:17:13 mike Exp $" // "$Id: code.cxx,v 1.9 1999/01/19 19:10:38 mike Exp $"
// //
// Code output routines for the Fast Light Tool Kit (FLTK). // Code output routines for the Fast Light Tool Kit (FLTK).
// //
@ -255,8 +255,18 @@ int write_code(const char *s, const char *t) {
// generated by Fast Light User Interface Designer (fluid) version %.2f\n\n"; // generated by Fast Light User Interface Designer (fluid) version %.2f\n\n";
fprintf(header_file, hdr, FL_VERSION); fprintf(header_file, hdr, FL_VERSION);
fprintf(code_file, hdr, FL_VERSION); fprintf(code_file, hdr, FL_VERSION);
Fl_Type *p;
{char define_name[102];
const char* a = filename_name(t);
char* b = define_name;
if (!isalpha(*a)) {*b++ = '_';}
while (*a) {*b++ = isalnum(*a) ? *a : '_'; a++;}
*b = 0;
fprintf(header_file, "#ifndef %s\n", define_name);
fprintf(header_file, "#define %s\n", define_name);
}
Fl_Type *p;
for (p = Fl_Type::first; p; p = p->next) p->write_declare(); for (p = Fl_Type::first; p; p = p->next) p->write_declare();
delete included_root; included_root = 0; delete included_root; included_root = 0;
@ -274,6 +284,7 @@ int write_code(const char *s, const char *t) {
if (!s) return 1; if (!s) return 1;
int x = fclose(code_file); int x = fclose(code_file);
code_file = 0; code_file = 0;
fprintf(header_file, "#endif\n");
int y = fclose(header_file); int y = fclose(header_file);
header_file = 0; header_file = 0;
return x >= 0 && y >= 0; return x >= 0 && y >= 0;
@ -290,5 +301,5 @@ void Fl_Type::write_code1() {
void Fl_Type::write_code2() {} void Fl_Type::write_code2() {}
// //
// End of "$Id: code.cxx,v 1.8 1999/01/07 19:17:13 mike Exp $". // End of "$Id: code.cxx,v 1.9 1999/01/19 19:10:38 mike Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: fluid.cxx,v 1.9 1999/01/07 19:17:13 mike Exp $" // "$Id: fluid.cxx,v 1.10 1999/01/19 19:10:38 mike Exp $"
// //
// FLUID main entry for the Fast Light Tool Kit (FLTK). // FLUID main entry for the Fast Light Tool Kit (FLTK).
// //
@ -104,7 +104,7 @@ void goto_source_dir() {
void leave_source_dir() { void leave_source_dir() {
if (!in_source_dir) return; if (!in_source_dir) return;
if (chdir(pwd)<0) {fprintf(stderr, "Can't chdir to %s : %s\n", if (chdir(pwd)<0) {fprintf(stderr, "Can't chdir to %s : %s\n",
pwd, strerror(errno));} pwd, strerror(errno));}
in_source_dir = 0; in_source_dir = 0;
} }
@ -277,8 +277,8 @@ void about_cb(Fl_Widget *, void *) {
extern Fl_Menu_Item New_Menu[]; extern Fl_Menu_Item New_Menu[];
Fl_Menu_Item Main_Menu[] = { Fl_Menu_Item Main_Menu[] = {
{"File",0,0,0,FL_SUBMENU}, {"&File",0,0,0,FL_SUBMENU},
{"New", FL_ALT+'N', new_cb, 0}, {"New", 0, new_cb, 0},
{"Open...", FL_ALT+'O', open_cb, 0}, {"Open...", FL_ALT+'O', open_cb, 0},
{"Save", FL_ALT+'s', save_cb, 0}, {"Save", FL_ALT+'s', save_cb, 0},
{"Save As...", FL_ALT+'S', save_cb, (void*)1}, {"Save As...", FL_ALT+'S', save_cb, (void*)1},
@ -286,7 +286,7 @@ Fl_Menu_Item Main_Menu[] = {
{"Write code", FL_ALT+'C', write_cb, 0}, {"Write code", FL_ALT+'C', write_cb, 0},
{"Quit", FL_ALT+'q', exit_cb}, {"Quit", FL_ALT+'q', exit_cb},
{0}, {0},
{"Edit",0,0,0,FL_SUBMENU}, {"&Edit",0,0,0,FL_SUBMENU},
{"Undo", FL_ALT+'z', nyi}, {"Undo", FL_ALT+'z', nyi},
{"Cut", FL_ALT+'x', cut_cb}, {"Cut", FL_ALT+'x', cut_cb},
{"Copy", FL_ALT+'c', copy_cb}, {"Copy", FL_ALT+'c', copy_cb},
@ -305,8 +305,8 @@ Fl_Menu_Item Main_Menu[] = {
{"Overlays on/off",FL_ALT+'o',toggle_overlays}, {"Overlays on/off",FL_ALT+'o',toggle_overlays},
{"Preferences",FL_ALT+'p',show_alignment_cb}, {"Preferences",FL_ALT+'p',show_alignment_cb},
{0}, {0},
{"New", 0, 0, (void *)New_Menu, FL_SUBMENU_POINTER}, {"&New", 0, 0, (void *)New_Menu, FL_SUBMENU_POINTER},
{"Help",0,0,0,FL_SUBMENU}, {"&Help",0,0,0,FL_SUBMENU},
{"About fluid",0,about_cb}, {"About fluid",0,about_cb},
{"Manual",0,nyi}, {"Manual",0,nyi},
{0}, {0},
@ -407,5 +407,5 @@ int main(int argc,char **argv) {
} }
// //
// End of "$Id: fluid.cxx,v 1.9 1999/01/07 19:17:13 mike Exp $". // End of "$Id: fluid.cxx,v 1.10 1999/01/19 19:10:38 mike Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: fl_color.cxx,v 1.10 1999/01/13 15:56:22 mike Exp $" // "$Id: fl_color.cxx,v 1.11 1999/01/19 19:10:39 mike Exp $"
// //
// Color functions for the Fast Light Tool Kit (FLTK). // Color functions for the Fast Light Tool Kit (FLTK).
// //
@ -340,14 +340,14 @@ Fl_Color inactive(Fl_Color c) {
Fl_Color contrast(Fl_Color fg, Fl_Color bg) { Fl_Color contrast(Fl_Color fg, Fl_Color bg) {
int c1 = int(fl_cmap[fg]); int c1 = int(fl_cmap[fg]);
int c2 = int(fl_cmap[bg]); int c2 = int(fl_cmap[bg]);
if (((c1|(c1<<1)&0x800000)^(c2|(c2<<1)&0x800000))&0x80808000) if ((c1^c2)&0x80800000)
return fg; return fg;
else if (c2&0x80c00000) else if (c2&0x80800000)
return FL_GRAY_RAMP; // black from gray ramp return FL_GRAY_RAMP; // black from gray ramp
else else
return (Fl_Color)(FL_COLOR_CUBE-1); // white from gray ramp return (Fl_Color)(FL_COLOR_CUBE-1); // white from gray ramp
} }
// //
// End of "$Id: fl_color.cxx,v 1.10 1999/01/13 15:56:22 mike Exp $". // End of "$Id: fl_color.cxx,v 1.11 1999/01/19 19:10:39 mike Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: fractals.cxx,v 1.4 1999/01/07 19:17:54 mike Exp $" // "$Id: fractals.cxx,v 1.5 1999/01/19 19:10:39 mike Exp $"
// //
// Fractal drawing demo for the Fast Light Tool Kit (FLTK). // Fractal drawing demo for the Fast Light Tool Kit (FLTK).
// //
@ -796,11 +796,12 @@ int main(int argc, char** argv)
myGLInit(); myGLInit();
MenuInit(); MenuInit();
glutMainLoop(); // must use this rather than Fl::run if glutIdleFunc is used glutMainLoop(); // you could use Fl::run() instead
return 0; return 0;
} }
#endif #endif
// //
// End of "$Id: fractals.cxx,v 1.4 1999/01/07 19:17:54 mike Exp $". // End of "$Id: fractals.cxx,v 1.5 1999/01/19 19:10:39 mike Exp $".
// //