mirror of
https://github.com/fltk/fltk.git
synced 2026-05-23 07:46:09 +08:00
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:
@@ -2,6 +2,9 @@ CHANGES IN FLTK 1.1.7
|
||||
|
||||
- Documentation fixes (STR #648, STR #692, STR #730, STR
|
||||
#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
|
||||
size by default, and menu bars are positioned to use
|
||||
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
|
||||
current selection.
|
||||
- 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)
|
||||
- Fl_Clock_Output::value() did not return the previously
|
||||
set value (STR #748)
|
||||
|
||||
@@ -157,6 +157,10 @@ a shortcut for No.
|
||||
|
||||
<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 -->
|
||||
<H2><A name="fl_beep">fl_beep</A></H2>
|
||||
|
||||
@@ -169,7 +169,7 @@ Fl_Type *Fl_Widget_Type::make() {
|
||||
#include "Fluid_Image.h"
|
||||
|
||||
void Fl_Widget_Type::setimage(Fluid_Image *i) {
|
||||
if (i == image) return;
|
||||
if (i == image || is_window()) return;
|
||||
if (image) image->decrement();
|
||||
if (i) i->increment();
|
||||
image = i;
|
||||
@@ -179,7 +179,7 @@ void Fl_Widget_Type::setimage(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 (i) i->increment();
|
||||
inactive = i;
|
||||
|
||||
@@ -332,6 +332,7 @@ void Fl_Window_Type::open() {
|
||||
w->resizable(p);
|
||||
}
|
||||
|
||||
w->image(Fl::scheme_bg_);
|
||||
w->size_range(gridx, gridy, Fl::w(), Fl::h(), gridx, gridy, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,11 +37,11 @@ extern void goto_source_dir(); // in fluid.C
|
||||
extern void leave_source_dir(); // in fluid.C
|
||||
|
||||
void Fluid_Image::image(Fl_Widget *o) {
|
||||
o->image(img);
|
||||
if (o->window() != o) o->image(img);
|
||||
}
|
||||
|
||||
void Fluid_Image::deimage(Fl_Widget *o) {
|
||||
o->deimage(img);
|
||||
if (o->window() != o) o->deimage(img);
|
||||
}
|
||||
|
||||
static int pixmap_header_written = 0;
|
||||
|
||||
+54
-29
@@ -164,9 +164,19 @@ Fl_Double_Window* make_project_window() {
|
||||
return w;
|
||||
}
|
||||
Fl_Text_Buffer *shell_run_buffer;
|
||||
void scheme_cb(Fl_Choice *, void *);
|
||||
|
||||
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;
|
||||
|
||||
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* 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;
|
||||
{ Fl_Check_Button* o = tooltips_button = new Fl_Check_Button(10, 10, 113, 25, "Show Tooltips");
|
||||
o->down_box(FL_DOWN_BOX);
|
||||
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_Choice* o = scheme_choice = new Fl_Choice(75, 10, 115, 25, "Scheme:");
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
o->labelfont(1);
|
||||
o->callback((Fl_Callback*)scheme_cb);
|
||||
o->menu(menu_scheme_choice);
|
||||
int s;
|
||||
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");
|
||||
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_Group* o = new Fl_Group(75, 45, 215, 100, "Options:\n\n\n\n\n");
|
||||
o->labelfont(1);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
{ Fl_Check_Button* o = tooltips_button = new Fl_Check_Button(75, 45, 113, 25, "Show Tooltips");
|
||||
o->down_box(FL_DOWN_BOX);
|
||||
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");
|
||||
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");
|
||||
{ Fl_Button* o = new Fl_Button(226, 155, 64, 25, "Close");
|
||||
o->tooltip("Close this dialog.");
|
||||
o->callback((Fl_Callback*)cb_Close1);
|
||||
}
|
||||
|
||||
+75
-40
@@ -40,7 +40,7 @@ decl {\#include <FL/Fl_Text_Display.H>} {public
|
||||
Function {make_project_window()} {open
|
||||
} {
|
||||
Fl_Window project_window {
|
||||
label {Project Settings} open
|
||||
label {Project Settings}
|
||||
xywh {312 395 345 185} type Double hide
|
||||
code0 {\#include <FL/Fl_Preferences.H>}
|
||||
code1 {\#include <FL/Fl_Tooltip.H>} modal
|
||||
@@ -88,15 +88,15 @@ Function {make_project_window()} {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
|
||||
} {
|
||||
Menu_Item {} {
|
||||
MenuItem {} {
|
||||
label None
|
||||
xywh {0 0 100 20} labelsize 11
|
||||
}
|
||||
Menu_Item {} {
|
||||
MenuItem {} {
|
||||
label {GNU gettext}
|
||||
xywh {0 0 100 20} labelsize 11
|
||||
}
|
||||
Menu_Item {} {
|
||||
MenuItem {} {
|
||||
label {POSIX catgets}
|
||||
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 {void scheme_cb(Fl_Choice *, void *);} {selected public
|
||||
}
|
||||
|
||||
Function {make_settings_window()} {open
|
||||
} {
|
||||
Fl_Window settings_window {
|
||||
label {GUI Settings}
|
||||
xywh {321 150 235 185} type Double hide
|
||||
label {GUI Settings} open
|
||||
xywh {326 155 300 190} type Double visible
|
||||
} {
|
||||
Fl_Check_Button tooltips_button {
|
||||
label {Show Tooltips}
|
||||
callback {Fl_Tooltip::enable(tooltips_button->value());
|
||||
fluid_prefs.set("show_tooltips", tooltips_button->value());} selected
|
||||
xywh {10 10 113 25} down_box DOWN_BOX
|
||||
code0 {int b;}
|
||||
code1 {fluid_prefs.get("show_tooltips", b, 1);}
|
||||
code2 {tooltips_button->value(b);}
|
||||
code3 {Fl_Tooltip::enable(b);}
|
||||
Fl_Choice scheme_choice {
|
||||
label {Scheme:}
|
||||
callback scheme_cb
|
||||
xywh {75 10 115 25} down_box BORDER_BOX labelfont 1
|
||||
code0 {int s;}
|
||||
code1 {fluid_prefs.get("scheme", s, 0);}
|
||||
code2 {scheme_choice->value(s);}
|
||||
code3 {scheme_cb(0, 0);}
|
||||
} {
|
||||
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 {
|
||||
label {Show Completion Dialogs}
|
||||
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);}
|
||||
}
|
||||
Fl_Check_Button openlast_button {
|
||||
label {Open Previous File on Startup}
|
||||
callback {fluid_prefs.set("open_previous_file", openlast_button->value());} selected
|
||||
xywh {10 80 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());} selected
|
||||
xywh {10 115 210 25} down_box DOWN_BOX
|
||||
code0 {int b;}
|
||||
code1 {fluid_prefs.get("prev_window_pos", b, 1);}
|
||||
code2 {prevpos_button->value(b);}
|
||||
Fl_Group {} {
|
||||
label {Options:
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
xywh {75 45 215 100} labelfont 1 align 4
|
||||
} {
|
||||
Fl_Check_Button tooltips_button {
|
||||
label {Show Tooltips}
|
||||
callback {Fl_Tooltip::enable(tooltips_button->value());
|
||||
fluid_prefs.set("show_tooltips", tooltips_button->value());}
|
||||
xywh {75 45 113 25} down_box DOWN_BOX
|
||||
code0 {int b;}
|
||||
code1 {fluid_prefs.get("show_tooltips", b, 1);}
|
||||
code2 {tooltips_button->value(b);}
|
||||
code3 {Fl_Tooltip::enable(b);}
|
||||
}
|
||||
Fl_Check_Button completion_button {
|
||||
label {Show Completion Dialogs}
|
||||
callback {fluid_prefs.set("show_completion_dialogs", completion_button->value());}
|
||||
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 {} {
|
||||
label Close
|
||||
callback {settings_window->hide();} selected
|
||||
tooltip {Close this dialog.} xywh {161 150 64 25}
|
||||
callback {settings_window->hide();}
|
||||
tooltip {Close this dialog.} xywh {226 155 64 25}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,13 +61,17 @@ extern Fl_Menu_Item menu_i18n_type_chooser[];
|
||||
extern void i18n_cb(Fl_Choice *,void *);
|
||||
extern Fl_Preferences fluid_prefs;
|
||||
extern Fl_Text_Buffer *shell_run_buffer;
|
||||
extern void scheme_cb(Fl_Choice *, void *);
|
||||
extern Fl_Double_Window *settings_window;
|
||||
extern void scheme_cb(Fl_Choice*, void*);
|
||||
extern Fl_Choice *scheme_choice;
|
||||
#include <FL/Fl_Check_Button.H>
|
||||
extern Fl_Check_Button *tooltips_button;
|
||||
extern Fl_Check_Button *completion_button;
|
||||
extern Fl_Check_Button *openlast_button;
|
||||
extern Fl_Check_Button *prevpos_button;
|
||||
Fl_Double_Window* make_settings_window();
|
||||
extern Fl_Menu_Item menu_scheme_choice[];
|
||||
extern Fl_Double_Window *shell_window;
|
||||
extern Fl_Input *shell_command_input;
|
||||
extern Fl_Check_Button *shell_writecode_button;
|
||||
|
||||
+16
-2
@@ -661,6 +661,22 @@ Fl_Menu_Item Main_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 *) {
|
||||
if (!widgetbin_panel) {
|
||||
make_widgetbin();
|
||||
@@ -982,8 +998,6 @@ int main(int argc,char **argv) {
|
||||
|
||||
fl_register_images();
|
||||
|
||||
if (!compile_only) Fl::scheme(NULL);
|
||||
|
||||
make_main_window();
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
Reference in New Issue
Block a user