Add Fl_Option::OPTION_SHOW_SCALING to fluid's "Global FLTK Settings".

This commit is contained in:
ManoloFLTK
2020-09-27 10:02:28 +02:00
parent d20c68a495
commit 06504e1840
3 changed files with 88 additions and 9 deletions
+40 -4
View File
@@ -554,6 +554,7 @@ static void refreshUI() {
wDNDText->value(opt[Fl::OPTION_DND_TEXT][mode]);
wGTKText->value(opt[Fl::OPTION_FNFC_USES_GTK][mode]);
wPrintGTKText->value(opt[Fl::OPTION_PRINTER_USES_GTK][mode]);
wShowZoomFactor->value(opt[Fl::OPTION_SHOW_SCALING][mode]);
}
/**
@@ -570,6 +571,7 @@ static void readPrefs() {
opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1], 2);
opt_prefs.get("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK ][1], 2);
opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][1], 2);
opt_prefs.get("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING ][1], 2);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
@@ -580,6 +582,7 @@ static void readPrefs() {
opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0], 2);
opt_prefs.get("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK ][0], 2);
opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][0], 2);
opt_prefs.get("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING ][0], 2);
}
refreshUI();
}
@@ -604,6 +607,8 @@ static void writePrefs() {
else opt_prefs.set("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][1]);
if (opt[Fl::OPTION_PRINTER_USES_GTK][1]==2) opt_prefs.deleteEntry("PrintUsesGTK");
else opt_prefs.set("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK][1]);
if (opt[Fl::OPTION_SHOW_SCALING][1]==2) opt_prefs.deleteEntry("ShowZoomFactor");
else opt_prefs.set("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING][1]);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
@@ -620,6 +625,8 @@ static void writePrefs() {
else opt_prefs.set("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][0]);
if (opt[Fl::OPTION_PRINTER_USES_GTK][0]==2) opt_prefs.deleteEntry("PrintUsesGTK");
else opt_prefs.set("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK][0]);
if (opt[Fl::OPTION_SHOW_SCALING][0]==2) opt_prefs.deleteEntry("ShowZoomFactor");
else opt_prefs.set("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING][0]);
}
}
@@ -724,6 +731,20 @@ Fl_Menu_Item menu_wPrintGTKText[] = {
{0,0,0,0,0,0,0,0,0}
};
Fl_Choice *wShowZoomFactor=(Fl_Choice *)0;
static void cb_wShowZoomFactor(Fl_Choice*, void*) {
int mode = wUserOrSystem->value();
opt[Fl::OPTION_SHOW_SCALING ][mode] = wShowZoomFactor->value();
}
Fl_Menu_Item menu_wShowZoomFactor[] = {
{"off", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"on", 0, 0, (void*)(1), 128, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"default", 0, 0, (void*)(2), 0, (uchar)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*) {
@@ -746,7 +767,7 @@ global_settings_window->hide();
}
Fl_Double_Window* make_global_settings_window() {
{ global_settings_window = new Fl_Double_Window(400, 455, "FLTK Preferences");
{ global_settings_window = new Fl_Double_Window(400, 531, "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);
@@ -832,7 +853,22 @@ f disabled, the Fl_Printer class\nalways uses FLTK\'s own print dialog even if\
} // Fl_Choice* wPrintGTKText
o->end();
} // Fl_Group* o
{ wUserOrSystem = new Fl_Choice(10, 420, 141, 25);
{ Fl_Group* o = new Fl_Group(10, 421, 380, 66, "Scaling Factor Options");
o->box(FL_GTK_DOWN_BOX);
o->labelfont(2);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ wShowZoomFactor = new Fl_Choice(245, 442, 100, 25, "Transiently show scaling factor:");
wShowZoomFactor->tooltip("OPTION_SHOW_SCALING\n\nIf \'Transiently show scaling factor\' is enabled, the\
library shows in a transient yellow window the display\nscaling factor value \
when it is changed. If disabled, no such transient window is used.\n\nDefault \
is on.");
wShowZoomFactor->down_box(FL_BORDER_BOX);
wShowZoomFactor->callback((Fl_Callback*)cb_wShowZoomFactor);
wShowZoomFactor->menu(menu_wShowZoomFactor);
} // Fl_Choice* wShowZoomFactor
o->end();
} // Fl_Group* o
{ wUserOrSystem = new Fl_Choice(10, 496, 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\').");
@@ -840,10 +876,10 @@ ions to specific values (not \'default\').");
wUserOrSystem->callback((Fl_Callback*)cb_wUserOrSystem);
wUserOrSystem->menu(menu_wUserOrSystem);
} // Fl_Choice* wUserOrSystem
{ Fl_Button* o = new Fl_Button(230, 420, 75, 25, "Cancel");
{ Fl_Button* o = new Fl_Button(230, 496, 75, 25, "Cancel");
o->callback((Fl_Callback*)cb_Cancel1);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(315, 420, 75, 25, "OK");
{ Fl_Button* o = new Fl_Button(315, 496, 75, 25, "OK");
o->callback((Fl_Callback*)cb_OK);
} // Fl_Button* o
global_settings_window->end();
+46 -5
View File
@@ -483,7 +483,8 @@ 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]);
wPrintGTKText->value(opt[Fl::OPTION_PRINTER_USES_GTK][mode]);} {}
wPrintGTKText->value(opt[Fl::OPTION_PRINTER_USES_GTK][mode]);
wShowZoomFactor->value(opt[Fl::OPTION_SHOW_SCALING][mode]);} {}
}
Function {readPrefs()} {
@@ -499,6 +500,7 @@ Function {readPrefs()} {
opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1], 2);
opt_prefs.get("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK ][1], 2);
opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][1], 2);
opt_prefs.get("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING ][1], 2);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
@@ -509,6 +511,7 @@ Function {readPrefs()} {
opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0], 2);
opt_prefs.get("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK ][0], 2);
opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][0], 2);
opt_prefs.get("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING ][0], 2);
}
refreshUI();} {}
}
@@ -532,6 +535,8 @@ Function {writePrefs()} {
else opt_prefs.set("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][1]);
if (opt[Fl::OPTION_PRINTER_USES_GTK][1]==2) opt_prefs.deleteEntry("PrintUsesGTK");
else opt_prefs.set("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK][1]);
if (opt[Fl::OPTION_SHOW_SCALING][1]==2) opt_prefs.deleteEntry("ShowZoomFactor");
else opt_prefs.set("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING][1]);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
@@ -548,6 +553,8 @@ Function {writePrefs()} {
else opt_prefs.set("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][0]);
if (opt[Fl::OPTION_PRINTER_USES_GTK][0]==2) opt_prefs.deleteEntry("PrintUsesGTK");
else opt_prefs.set("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK][0]);
if (opt[Fl::OPTION_SHOW_SCALING][0]==2) opt_prefs.deleteEntry("ShowZoomFactor");
else opt_prefs.set("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING][0]);
}} {}
}
@@ -570,7 +577,7 @@ global_settings_window->show();} {}
Function {make_global_settings_window()} {} {
Fl_Window global_settings_window {
label {FLTK Preferences} open
xywh {715 96 400 455} type Double color 50 hide
xywh {715 96 400 531} type Double color 50 hide
} {
Fl_Group {} {
label {Keyboard Focus Options} open
@@ -757,9 +764,43 @@ Default is on.} xywh {245 366 100 25} down_box BORDER_BOX
}
}
}
Fl_Group {} {
label {Scaling Factor Options} open
xywh {10 421 380 66} box GTK_DOWN_BOX labelfont 2 align 21
} {
Fl_Choice wShowZoomFactor {
label {Transiently show scaling factor:}
callback {int mode = wUserOrSystem->value();
opt[Fl::OPTION_SHOW_SCALING ][mode] = wShowZoomFactor->value();} open
tooltip {OPTION_SHOW_SCALING
If 'Transiently show scaling factor' is enabled, the library shows in a transient yellow window the display
scaling factor value when it is changed. If disabled, no such transient window is used.
Default is on.} xywh {245 442 100 25} down_box BORDER_BOX
} {
MenuItem {} {
label off
user_data 0 user_data_type long selected
xywh {30 30 31 20}
}
MenuItem {} {
label on
user_data 1 user_data_type long
xywh {30 30 31 20} divider
}
MenuItem {} {
label default
user_data 2 user_data_type long
xywh {30 30 31 20}
}
}
}
Fl_Choice wUserOrSystem {
callback {refreshUI();} open
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 options to specific values (not 'default').} xywh {10 420 141 25} down_box BORDER_BOX
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 options to specific values (not 'default').} xywh {10 496 141 25} down_box BORDER_BOX
} {
MenuItem {} {
label {User Settings}
@@ -775,13 +816,13 @@ Default is on.} xywh {245 366 100 25} down_box BORDER_BOX
Fl_Button {} {
label Cancel
callback {global_settings_window->hide();}
xywh {230 420 75 25}
xywh {230 496 75 25}
}
Fl_Button {} {
label OK
callback {writePrefs();
global_settings_window->hide();}
xywh {315 420 75 25}
xywh {315 496 75 25}
}
}
code {readPrefs();
+2
View File
@@ -107,6 +107,7 @@ extern Fl_Choice *wShowTooltips;
extern Fl_Choice *wDNDText;
extern Fl_Choice *wGTKText;
extern Fl_Choice *wPrintGTKText;
extern Fl_Choice *wShowZoomFactor;
extern Fl_Choice *wUserOrSystem;
Fl_Double_Window* make_global_settings_window();
extern Fl_Menu_Item menu_wVisibleFocus[];
@@ -115,5 +116,6 @@ extern Fl_Menu_Item menu_wShowTooltips[];
extern Fl_Menu_Item menu_wDNDText[];
extern Fl_Menu_Item menu_wGTKText[];
extern Fl_Menu_Item menu_wPrintGTKText[];
extern Fl_Menu_Item menu_wShowZoomFactor[];
extern Fl_Menu_Item menu_wUserOrSystem[];
#endif