Skip to content

Commit

Permalink
Added control of the Fl::OPTION_FNFC_USES_GTK option in the "Edit/Glo…
Browse files Browse the repository at this point in the history
…bal FLTK Settings" menu item of fluid.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10345 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Sep 30, 2014
1 parent 529aaf0 commit 77b160e
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
58 changes: 54 additions & 4 deletions fluid/alignment_panel.cxx
Expand Up @@ -510,6 +510,7 @@ static void refreshUI() {
wArrowFocus->value(opt[Fl::OPTION_ARROW_FOCUS][mode]);
wShowTooltips->value(opt[Fl::OPTION_SHOW_TOOLTIPS][mode]);
wDNDText->value(opt[Fl::OPTION_DND_TEXT][mode]);
wGTKText->value(opt[Fl::OPTION_FNFC_USES_GTK][mode]);
}

/**
Expand All @@ -524,6 +525,7 @@ static void readPrefs() {
opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][1], 2);
opt_prefs.get("DNDText", opt[Fl::OPTION_DND_TEXT][1], 2);
opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1], 2);
opt_prefs.get("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][1], 2);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
Expand All @@ -532,6 +534,7 @@ static void readPrefs() {
opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][0], 2);
opt_prefs.get("DNDText", opt[Fl::OPTION_DND_TEXT][0], 2);
opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0], 2);
opt_prefs.get("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][0], 2);
}
refreshUI();
}
Expand All @@ -552,6 +555,8 @@ static void writePrefs() {
else opt_prefs.set("DNDText", opt[Fl::OPTION_DND_TEXT][1]);
if (opt[Fl::OPTION_SHOW_TOOLTIPS][1]==2) opt_prefs.deleteEntry("ShowTooltips");
else opt_prefs.set("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1]);
if (opt[Fl::OPTION_FNFC_USES_GTK][1]==2) opt_prefs.deleteEntry("FNFCUsesGTK");
else opt_prefs.set("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][1]);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
Expand All @@ -564,6 +569,8 @@ static void writePrefs() {
else opt_prefs.set("DNDText", opt[Fl::OPTION_DND_TEXT][0]);
if (opt[Fl::OPTION_SHOW_TOOLTIPS][0]==2) opt_prefs.deleteEntry("ShowTooltips");
else opt_prefs.set("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0]);
if (opt[Fl::OPTION_FNFC_USES_GTK][0]==2) opt_prefs.deleteEntry("FNFCUsesGTK");
else opt_prefs.set("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][0]);
}
}

Expand Down Expand Up @@ -640,6 +647,22 @@ Fl_Menu_Item menu_wDNDText[] = {
{0,0,0,0,0,0,0,0,0}
};


Fl_Choice *wGTKText=(Fl_Choice *)0;

static void cb_wGTKText(Fl_Choice*, void*) {
int mode = wUserOrSystem->value();
opt[Fl::OPTION_FNFC_USES_GTK][mode] = wGTKText->value();
}

Fl_Menu_Item menu_wGTKText[] = {
{"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL, 0, 14, 0},
{"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL, 0, 14, 0},
{"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};


Fl_Choice *wUserOrSystem=(Fl_Choice *)0;

static void cb_wUserOrSystem(Fl_Choice*, void*) {
Expand All @@ -662,7 +685,14 @@ global_settings_window->hide();
}

Fl_Double_Window* make_global_settings_window() {
{ global_settings_window = new Fl_Double_Window(403, 317, "FLTK Preferences");
#if !(defined(WIN32) || defined(__APPLE__))
bool show_gtk = true;
#else
bool show_gtk = false;
#endif
{ int h = 317;
if (show_gtk) h += 75;
global_settings_window = new Fl_Double_Window(403, h, "FLTK Preferences");
global_settings_window->color(FL_LIGHT1);
{ Fl_Group* o = new Fl_Group(10, 10, 380, 100, "Keyboard Focus Options");
o->box(FL_GTK_DOWN_BOX);
Expand Down Expand Up @@ -717,18 +747,38 @@ dropping text from other applications still works.\n\nDefault is on.");
} // Fl_Choice* wDNDText
o->end();
} // Fl_Group* o
{ wUserOrSystem = new Fl_Choice(14, 275, 141, 25);

int bottom_pos = 275;
{ Fl_Group* o = new Fl_Group(10, 268, 380, 66, "Native File Chooser Options");
o->box(FL_GTK_DOWN_BOX);
o->labelfont(2);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ wGTKText = new Fl_Choice(245, 300, 100, 25, "Native File Chooser uses GTK:");
wGTKText->tooltip("OPTION_FNFC_USES_GTK\n\nIf 'Native File Chooser uses GTK' is enabled, the Fl_Native_File_Chooser class \
calls the GTK open/save file dialogs when they are available on the platfom. If disabled, the Fl_Native_File_Chooser class \
always uses FLTK's own file dialog (i.e., Fl_File_Chooser) even if GTK is available.\n\nDefault is on.");
wGTKText->down_box(FL_BORDER_BOX);
wGTKText->callback((Fl_Callback*)cb_wGTKText);
wGTKText->menu(menu_wGTKText);
} // Fl_Choice* wGTKText
o->end();
if (show_gtk) bottom_pos += 75;
else o->hide();
}

{ wUserOrSystem = new Fl_Choice(14, bottom_pos, 141, 25);
wUserOrSystem->tooltip("Change settings for the current user, or default values for all users of this\
computer. Individual users can override system options, if they set their opt\
ions to specific values (not \'default\').");
wUserOrSystem->down_box(FL_BORDER_BOX);
wUserOrSystem->callback((Fl_Callback*)cb_wUserOrSystem);
wUserOrSystem->menu(menu_wUserOrSystem);
} // Fl_Choice* wUserOrSystem
{ Fl_Button* o = new Fl_Button(230, 275, 75, 25, "Cancel");
{ Fl_Button* o = new Fl_Button(230, bottom_pos, 75, 25, "Cancel");
o->callback((Fl_Callback*)cb_Cancel1);
o->take_focus();
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(315, 275, 75, 25, "OK");
{ Fl_Button* o = new Fl_Button(315, bottom_pos, 75, 25, "OK");
o->callback((Fl_Callback*)cb_OK);
} // Fl_Button* o
global_settings_window->end();
Expand Down
1 change: 1 addition & 0 deletions fluid/alignment_panel.h
Expand Up @@ -104,6 +104,7 @@ extern Fl_Choice *wVisibleFocus;
extern Fl_Choice *wArrowFocus;
extern Fl_Choice *wShowTooltips;
extern Fl_Choice *wDNDText;
extern Fl_Choice *wGTKText;
extern Fl_Choice *wUserOrSystem;
Fl_Double_Window* make_global_settings_window();
extern Fl_Menu_Item menu_wVisibleFocus[];
Expand Down

0 comments on commit 77b160e

Please sign in to comment.