Add "scheme" chooser in GUI settings dialog.

Set window image to scheme_bg image when the window is shown.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4140 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet
2005-03-20 00:51:02 +00:00
parent 2cef7d91d3
commit 921dabf5b8
9 changed files with 162 additions and 76 deletions
+4 -1
View File
@@ -2,6 +2,9 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #648, STR #692, STR #730, STR - Documentation fixes (STR #648, STR #692, STR #730, STR
#744, STR #745) #744, STR #745)
- FLUID now provides an option to choose which scheme
(default, none, plastic) to display.
- Fixed scheme background issue with windows in FLUID.
- In FLUID, new widgets are now created with the ideal - In FLUID, new widgets are now created with the ideal
size by default, and menu bars are positioned to use size by default, and menu bars are positioned to use
the entire width of the window. the entire width of the window.
@@ -10,7 +13,7 @@ CHANGES IN FLTK 1.1.7
- Added Edit/Duplicate command to FLUID to duplicate the - Added Edit/Duplicate command to FLUID to duplicate the
current selection. current selection.
- FLUID now tracks the current state of the widget bin - FLUID now tracks the current state of the widget bin
and overlay using menu item checks. and overlays.
- Fixed frame drawing of Fl_Text_Display (STR #762) - Fixed frame drawing of Fl_Text_Display (STR #762)
- Fl_Clock_Output::value() did not return the previously - Fl_Clock_Output::value() did not return the previously
set value (STR #748) set value (STR #748)
+4
View File
@@ -157,6 +157,10 @@ a shortcut for No.
<P ALIGN="CENTER"><IMG SRC="fl_ask.gif" ALT="The fl_ask window."> <P ALIGN="CENTER"><IMG SRC="fl_ask.gif" ALT="The fl_ask window.">
<p><b>Note:</b> Use of this function is <i>strongly</i>
discouraged. Instead, use <a
href='#fl_choice'><tt>fl_choice()</tt></a> instead and provide
unambiguous verbs in place of "Yes" and "No".</p>
<!-- NEED 4in --> <!-- NEED 4in -->
<H2><A name="fl_beep">fl_beep</A></H2> <H2><A name="fl_beep">fl_beep</A></H2>
+2 -2
View File
@@ -169,7 +169,7 @@ Fl_Type *Fl_Widget_Type::make() {
#include "Fluid_Image.h" #include "Fluid_Image.h"
void Fl_Widget_Type::setimage(Fluid_Image *i) { void Fl_Widget_Type::setimage(Fluid_Image *i) {
if (i == image) return; if (i == image || is_window()) return;
if (image) image->decrement(); if (image) image->decrement();
if (i) i->increment(); if (i) i->increment();
image = i; image = i;
@@ -179,7 +179,7 @@ void Fl_Widget_Type::setimage(Fluid_Image *i) {
} }
void Fl_Widget_Type::setinactive(Fluid_Image *i) { void Fl_Widget_Type::setinactive(Fluid_Image *i) {
if (i == inactive) return; if (i == inactive || is_window()) return;
if (inactive) inactive->decrement(); if (inactive) inactive->decrement();
if (i) i->increment(); if (i) i->increment();
inactive = i; inactive = i;
+1
View File
@@ -332,6 +332,7 @@ void Fl_Window_Type::open() {
w->resizable(p); w->resizable(p);
} }
w->image(Fl::scheme_bg_);
w->size_range(gridx, gridy, Fl::w(), Fl::h(), gridx, gridy, 0); w->size_range(gridx, gridy, Fl::w(), Fl::h(), gridx, gridy, 0);
} }
+2 -2
View File
@@ -37,11 +37,11 @@ extern void goto_source_dir(); // in fluid.C
extern void leave_source_dir(); // in fluid.C extern void leave_source_dir(); // in fluid.C
void Fluid_Image::image(Fl_Widget *o) { void Fluid_Image::image(Fl_Widget *o) {
o->image(img); if (o->window() != o) o->image(img);
} }
void Fluid_Image::deimage(Fl_Widget *o) { void Fluid_Image::deimage(Fl_Widget *o) {
o->deimage(img); if (o->window() != o) o->deimage(img);
} }
static int pixmap_header_written = 0; static int pixmap_header_written = 0;
+54 -29
View File
@@ -164,9 +164,19 @@ Fl_Double_Window* make_project_window() {
return w; return w;
} }
Fl_Text_Buffer *shell_run_buffer; Fl_Text_Buffer *shell_run_buffer;
void scheme_cb(Fl_Choice *, void *);
Fl_Double_Window *settings_window=(Fl_Double_Window *)0; Fl_Double_Window *settings_window=(Fl_Double_Window *)0;
Fl_Choice *scheme_choice=(Fl_Choice *)0;
Fl_Menu_Item menu_scheme_choice[] = {
{"Default", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 56},
{"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 56},
{"Plastic", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 56},
{0,0,0,0,0,0,0,0,0}
};
Fl_Check_Button *tooltips_button=(Fl_Check_Button *)0; Fl_Check_Button *tooltips_button=(Fl_Check_Button *)0;
static void cb_tooltips_button(Fl_Check_Button*, void*) { static void cb_tooltips_button(Fl_Check_Button*, void*) {
@@ -198,38 +208,53 @@ static void cb_Close1(Fl_Button*, void*) {
Fl_Double_Window* make_settings_window() { Fl_Double_Window* make_settings_window() {
Fl_Double_Window* w; Fl_Double_Window* w;
{ Fl_Double_Window* o = settings_window = new Fl_Double_Window(235, 185, "GUI Settings"); { Fl_Double_Window* o = settings_window = new Fl_Double_Window(300, 190, "GUI Settings");
w = o; w = o;
{ Fl_Check_Button* o = tooltips_button = new Fl_Check_Button(10, 10, 113, 25, "Show Tooltips"); { Fl_Choice* o = scheme_choice = new Fl_Choice(75, 10, 115, 25, "Scheme:");
o->down_box(FL_DOWN_BOX); o->down_box(FL_BORDER_BOX);
o->callback((Fl_Callback*)cb_tooltips_button); o->labelfont(1);
int b; o->callback((Fl_Callback*)scheme_cb);
fluid_prefs.get("show_tooltips", b, 1); o->menu(menu_scheme_choice);
tooltips_button->value(b); int s;
Fl_Tooltip::enable(b); fluid_prefs.get("scheme", s, 0);
scheme_choice->value(s);
scheme_cb(0, 0);
} }
{ Fl_Check_Button* o = completion_button = new Fl_Check_Button(10, 45, 186, 25, "Show Completion Dialogs"); { Fl_Group* o = new Fl_Group(75, 45, 215, 100, "Options:\n\n\n\n\n");
o->down_box(FL_DOWN_BOX); o->labelfont(1);
o->callback((Fl_Callback*)cb_completion_button); o->align(FL_ALIGN_LEFT);
int b; { Fl_Check_Button* o = tooltips_button = new Fl_Check_Button(75, 45, 113, 25, "Show Tooltips");
fluid_prefs.get("show_completion_dialogs", b, 1); o->down_box(FL_DOWN_BOX);
completion_button->value(b); o->callback((Fl_Callback*)cb_tooltips_button);
int b;
fluid_prefs.get("show_tooltips", b, 1);
tooltips_button->value(b);
Fl_Tooltip::enable(b);
}
{ Fl_Check_Button* o = completion_button = new Fl_Check_Button(75, 70, 186, 25, "Show Completion Dialogs");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cb_completion_button);
int b;
fluid_prefs.get("show_completion_dialogs", b, 1);
completion_button->value(b);
}
{ Fl_Check_Button* o = openlast_button = new Fl_Check_Button(75, 95, 215, 25, "Open Previous File on Startup");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cb_openlast_button);
int b;
fluid_prefs.get("open_previous_file", b, 0);
openlast_button->value(b);
}
{ Fl_Check_Button* o = prevpos_button = new Fl_Check_Button(75, 120, 210, 25, "Remember Window Positions");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cb_prevpos_button);
int b;
fluid_prefs.get("prev_window_pos", b, 1);
prevpos_button->value(b);
}
o->end();
} }
{ Fl_Check_Button* o = openlast_button = new Fl_Check_Button(10, 80, 215, 25, "Open Previous File on Startup"); { Fl_Button* o = new Fl_Button(226, 155, 64, 25, "Close");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cb_openlast_button);
int b;
fluid_prefs.get("open_previous_file", b, 0);
openlast_button->value(b);
}
{ Fl_Check_Button* o = prevpos_button = new Fl_Check_Button(10, 115, 210, 25, "Remember Window Positions");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cb_prevpos_button);
int b;
fluid_prefs.get("prev_window_pos", b, 1);
prevpos_button->value(b);
}
{ Fl_Button* o = new Fl_Button(161, 150, 64, 25, "Close");
o->tooltip("Close this dialog."); o->tooltip("Close this dialog.");
o->callback((Fl_Callback*)cb_Close1); o->callback((Fl_Callback*)cb_Close1);
} }
+75 -40
View File
@@ -40,7 +40,7 @@ decl {\#include <FL/Fl_Text_Display.H>} {public
Function {make_project_window()} {open Function {make_project_window()} {open
} { } {
Fl_Window project_window { Fl_Window project_window {
label {Project Settings} open label {Project Settings}
xywh {312 395 345 185} type Double hide xywh {312 395 345 185} type Double hide
code0 {\#include <FL/Fl_Preferences.H>} code0 {\#include <FL/Fl_Preferences.H>}
code1 {\#include <FL/Fl_Tooltip.H>} modal code1 {\#include <FL/Fl_Tooltip.H>} modal
@@ -88,15 +88,15 @@ Function {make_project_window()} {open
callback i18n_type_cb open callback i18n_type_cb open
tooltip {Type of internationalization to use.} xywh {80 42 100 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 tooltip {Type of internationalization to use.} xywh {80 42 100 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11
} { } {
Menu_Item {} { MenuItem {} {
label None label None
xywh {0 0 100 20} labelsize 11 xywh {0 0 100 20} labelsize 11
} }
Menu_Item {} { MenuItem {} {
label {GNU gettext} label {GNU gettext}
xywh {0 0 100 20} labelsize 11 xywh {0 0 100 20} labelsize 11
} }
Menu_Item {} { MenuItem {} {
label {POSIX catgets} label {POSIX catgets}
xywh {0 0 100 20} labelsize 11 xywh {0 0 100 20} labelsize 11
} }
@@ -135,50 +135,85 @@ decl {extern Fl_Preferences fluid_prefs;} {public
decl {Fl_Text_Buffer *shell_run_buffer;} {public decl {Fl_Text_Buffer *shell_run_buffer;} {public
} }
decl {void scheme_cb(Fl_Choice *, void *);} {selected public
}
Function {make_settings_window()} {open Function {make_settings_window()} {open
} { } {
Fl_Window settings_window { Fl_Window settings_window {
label {GUI Settings} label {GUI Settings} open
xywh {321 150 235 185} type Double hide xywh {326 155 300 190} type Double visible
} { } {
Fl_Check_Button tooltips_button { Fl_Choice scheme_choice {
label {Show Tooltips} label {Scheme:}
callback {Fl_Tooltip::enable(tooltips_button->value()); callback scheme_cb
fluid_prefs.set("show_tooltips", tooltips_button->value());} selected xywh {75 10 115 25} down_box BORDER_BOX labelfont 1
xywh {10 10 113 25} down_box DOWN_BOX code0 {int s;}
code0 {int b;} code1 {fluid_prefs.get("scheme", s, 0);}
code1 {fluid_prefs.get("show_tooltips", b, 1);} code2 {scheme_choice->value(s);}
code2 {tooltips_button->value(b);} code3 {scheme_cb(0, 0);}
code3 {Fl_Tooltip::enable(b);} } {
MenuItem {} {
label Default
xywh {0 0 35 25}
}
MenuItem {} {
label None
xywh {0 0 35 25}
}
MenuItem {} {
label Plastic
xywh {0 0 35 25}
}
} }
Fl_Check_Button completion_button { Fl_Group {} {
label {Show Completion Dialogs} label {Options:
callback {fluid_prefs.set("show_completion_dialogs", completion_button->value());} selected
xywh {10 45 186 25} down_box DOWN_BOX
code0 {int b;}
code1 {fluid_prefs.get("show_completion_dialogs", b, 1);}
code2 {completion_button->value(b);} }
} xywh {75 45 215 100} labelfont 1 align 4
Fl_Check_Button openlast_button { } {
label {Open Previous File on Startup} Fl_Check_Button tooltips_button {
callback {fluid_prefs.set("open_previous_file", openlast_button->value());} selected label {Show Tooltips}
xywh {10 80 215 25} down_box DOWN_BOX callback {Fl_Tooltip::enable(tooltips_button->value());
code0 {int b;} fluid_prefs.set("show_tooltips", tooltips_button->value());}
code1 {fluid_prefs.get("open_previous_file", b, 0);} xywh {75 45 113 25} down_box DOWN_BOX
code2 {openlast_button->value(b);} code0 {int b;}
} code1 {fluid_prefs.get("show_tooltips", b, 1);}
Fl_Check_Button prevpos_button { code2 {tooltips_button->value(b);}
label {Remember Window Positions} code3 {Fl_Tooltip::enable(b);}
callback {fluid_prefs.set("prev_window_pos", prevpos_button->value());} selected }
xywh {10 115 210 25} down_box DOWN_BOX Fl_Check_Button completion_button {
code0 {int b;} label {Show Completion Dialogs}
code1 {fluid_prefs.get("prev_window_pos", b, 1);} callback {fluid_prefs.set("show_completion_dialogs", completion_button->value());}
code2 {prevpos_button->value(b);} xywh {75 70 186 25} down_box DOWN_BOX
code0 {int b;}
code1 {fluid_prefs.get("show_completion_dialogs", b, 1);}
code2 {completion_button->value(b);}
}
Fl_Check_Button openlast_button {
label {Open Previous File on Startup}
callback {fluid_prefs.set("open_previous_file", openlast_button->value());}
xywh {75 95 215 25} down_box DOWN_BOX
code0 {int b;}
code1 {fluid_prefs.get("open_previous_file", b, 0);}
code2 {openlast_button->value(b);}
}
Fl_Check_Button prevpos_button {
label {Remember Window Positions}
callback {fluid_prefs.set("prev_window_pos", prevpos_button->value());}
xywh {75 120 210 25} down_box DOWN_BOX
code0 {int b;}
code1 {fluid_prefs.get("prev_window_pos", b, 1);}
code2 {prevpos_button->value(b);}
}
} }
Fl_Button {} { Fl_Button {} {
label Close label Close
callback {settings_window->hide();} selected callback {settings_window->hide();}
tooltip {Close this dialog.} xywh {161 150 64 25} tooltip {Close this dialog.} xywh {226 155 64 25}
} }
} }
} }
+4
View File
@@ -61,13 +61,17 @@ extern Fl_Menu_Item menu_i18n_type_chooser[];
extern void i18n_cb(Fl_Choice *,void *); extern void i18n_cb(Fl_Choice *,void *);
extern Fl_Preferences fluid_prefs; extern Fl_Preferences fluid_prefs;
extern Fl_Text_Buffer *shell_run_buffer; extern Fl_Text_Buffer *shell_run_buffer;
extern void scheme_cb(Fl_Choice *, void *);
extern Fl_Double_Window *settings_window; extern Fl_Double_Window *settings_window;
extern void scheme_cb(Fl_Choice*, void*);
extern Fl_Choice *scheme_choice;
#include <FL/Fl_Check_Button.H> #include <FL/Fl_Check_Button.H>
extern Fl_Check_Button *tooltips_button; extern Fl_Check_Button *tooltips_button;
extern Fl_Check_Button *completion_button; extern Fl_Check_Button *completion_button;
extern Fl_Check_Button *openlast_button; extern Fl_Check_Button *openlast_button;
extern Fl_Check_Button *prevpos_button; extern Fl_Check_Button *prevpos_button;
Fl_Double_Window* make_settings_window(); Fl_Double_Window* make_settings_window();
extern Fl_Menu_Item menu_scheme_choice[];
extern Fl_Double_Window *shell_window; extern Fl_Double_Window *shell_window;
extern Fl_Input *shell_command_input; extern Fl_Input *shell_command_input;
extern Fl_Check_Button *shell_writecode_button; extern Fl_Check_Button *shell_writecode_button;
+16 -2
View File
@@ -661,6 +661,22 @@ Fl_Menu_Item Main_Menu[] = {
extern void fill_in_New_Menu(); extern void fill_in_New_Menu();
void scheme_cb(Fl_Choice *, void *) {
switch (scheme_choice->value()) {
case 0 : // Default
Fl::scheme(NULL);
break;
case 1 : // None
Fl::scheme("none");
break;
case 2 : // Plastic
Fl::scheme("plastic");
break;
}
fluid_prefs.set("scheme", scheme_choice->value());
}
void toggle_widgetbin_cb(Fl_Widget *, void *) { void toggle_widgetbin_cb(Fl_Widget *, void *) {
if (!widgetbin_panel) { if (!widgetbin_panel) {
make_widgetbin(); make_widgetbin();
@@ -982,8 +998,6 @@ int main(int argc,char **argv) {
fl_register_images(); fl_register_images();
if (!compile_only) Fl::scheme(NULL);
make_main_window(); make_main_window();
#ifdef __APPLE__ #ifdef __APPLE__