summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-09-15 15:57:29 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-09-15 15:57:29 +0200
commitc549b7acbd65674019b731c6648a9e8eb22f70dd (patch)
tree7e6b8745573d2b8c1f9a61a7393b1e7c2b0d8f69 /fluid
parent000807cc1d1a1c2f00274763f3e8e24145f1af00 (diff)
X11 platform: use Gnome printer dialog when the GTK library is available at run-time
The code to determine whether the GTK library is available is now in Fl_X11_System_Driver::probe_for_GTK() called both by Fl_Printer::begin_job() and Fl_Native_File_Chooser. New Fl::option OPTION_PRINTER_USES_GTK allows to deactivate use of the Gnome print dialog. Minor change in Fl_Native_File_Chooser: GTK version 3 is searched before version 2, whereas the search order was the opposite before.
Diffstat (limited to 'fluid')
-rw-r--r--fluid/alignment_panel.cxx44
-rw-r--r--fluid/alignment_panel.fl50
-rw-r--r--fluid/alignment_panel.h2
3 files changed, 87 insertions, 9 deletions
diff --git a/fluid/alignment_panel.cxx b/fluid/alignment_panel.cxx
index 6444ce462..5b2335443 100644
--- a/fluid/alignment_panel.cxx
+++ b/fluid/alignment_panel.cxx
@@ -555,6 +555,7 @@ static void refreshUI() {
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]);
}
/**
@@ -570,6 +571,7 @@ static void readPrefs() {
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);
+ opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][1], 2);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
@@ -579,6 +581,7 @@ static void readPrefs() {
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);
+ opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][0], 2);
}
refreshUI();
}
@@ -601,6 +604,8 @@ static void writePrefs() {
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]);
+ 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]);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
@@ -615,6 +620,8 @@ static void writePrefs() {
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]);
+ 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]);
}
}
@@ -705,6 +712,20 @@ Fl_Menu_Item menu_wGTKText[] = {
{0,0,0,0,0,0,0,0,0}
};
+Fl_Choice *wPrintGTKText=(Fl_Choice *)0;
+
+static void cb_wPrintGTKText(Fl_Choice*, void*) {
+ int mode = wUserOrSystem->value();
+opt[Fl::OPTION_PRINTER_USES_GTK ][mode] = wPrintGTKText->value();
+}
+
+Fl_Menu_Item menu_wPrintGTKText[] = {
+ {"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*) {
@@ -727,7 +748,7 @@ global_settings_window->hide();
}
Fl_Double_Window* make_global_settings_window() {
- { global_settings_window = new Fl_Double_Window(400, 378, "FLTK Preferences");
+ { global_settings_window = new Fl_Double_Window(400, 455, "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);
@@ -798,7 +819,22 @@ s available.\n\nDefault is on.");
} // Fl_Choice* wGTKText
o->end();
} // Fl_Group* o
- { wUserOrSystem = new Fl_Choice(10, 345, 141, 25);
+ { Fl_Group* o = new Fl_Group(10, 345, 380, 66, "Print dialog Options");
+ o->box(FL_GTK_DOWN_BOX);
+ o->labelfont(2);
+ o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
+ { wPrintGTKText = new Fl_Choice(245, 366, 100, 25, "Print dialog uses GTK:");
+ wPrintGTKText->tooltip("OPTION_PRINTER_USES_GTK\n\nIf \'Print dialog uses GTK\' is enabled, the Fl_Pr\
+inter class\ncalls the GTK print dialog when it\'s available on the platfom. I\
+f disabled, the Fl_Printer class\nalways uses FLTK\'s own print dialog even if\
+ GTK is available.\n\nDefault is on.");
+ wPrintGTKText->down_box(FL_BORDER_BOX);
+ wPrintGTKText->callback((Fl_Callback*)cb_wPrintGTKText);
+ wPrintGTKText->menu(menu_wPrintGTKText);
+ } // Fl_Choice* wPrintGTKText
+ o->end();
+ } // Fl_Group* o
+ { wUserOrSystem = new Fl_Choice(10, 420, 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\').");
@@ -806,10 +842,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, 345, 75, 25, "Cancel");
+ { Fl_Button* o = new Fl_Button(230, 420, 75, 25, "Cancel");
o->callback((Fl_Callback*)cb_Cancel1);
} // Fl_Button* o
- { Fl_Button* o = new Fl_Button(315, 345, 75, 25, "OK");
+ { Fl_Button* o = new Fl_Button(315, 420, 75, 25, "OK");
o->callback((Fl_Callback*)cb_OK);
} // Fl_Button* o
global_settings_window->end();
diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl
index e2445970a..c3e1c049a 100644
--- a/fluid/alignment_panel.fl
+++ b/fluid/alignment_panel.fl
@@ -484,7 +484,8 @@ wVisibleFocus->value(opt[Fl::OPTION_VISIBLE_FOCUS][mode]);
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]);} {}
+wGTKText->value(opt[Fl::OPTION_FNFC_USES_GTK][mode]);
+wPrintGTKText->value(opt[Fl::OPTION_PRINTER_USES_GTK][mode]);} {}
}
Function {readPrefs()} {
@@ -499,6 +500,7 @@ Function {readPrefs()} {
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);
+ opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][1], 2);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
@@ -508,6 +510,7 @@ Function {readPrefs()} {
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);
+ opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][0], 2);
}
refreshUI();} {}
}
@@ -529,6 +532,8 @@ Function {writePrefs()} {
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]);
+ 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]);
}
{
Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
@@ -543,6 +548,8 @@ Function {writePrefs()} {
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]);
+ 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]);
}} {}
}
@@ -565,7 +572,7 @@ global_settings_window->show();} {}
Function {make_global_settings_window()} {} {
Fl_Window global_settings_window {
label {FLTK Preferences} open
- xywh {1147 190 400 378} type Double color 50 hide
+ xywh {715 96 400 455} type Double color 50 hide
} {
Fl_Group {} {
label {Keyboard Focus Options} open
@@ -719,9 +726,42 @@ Default is on.} xywh {245 300 100 25} down_box BORDER_BOX
}
}
}
+ Fl_Group {} {
+ label {Print dialog Options} open
+ xywh {10 345 380 66} box GTK_DOWN_BOX labelfont 2 align 21
+ } {
+ Fl_Choice wPrintGTKText {
+ label {Print dialog uses GTK:}
+ callback {int mode = wUserOrSystem->value();
+opt[Fl::OPTION_PRINTER_USES_GTK ][mode] = wPrintGTKText->value();} open
+ tooltip {OPTION_PRINTER_USES_GTK
+
+If 'Print dialog uses GTK' is enabled, the Fl_Printer class
+calls the GTK print dialog when it's available on the platfom. If disabled, the Fl_Printer class
+always uses FLTK's own print dialog even if GTK is available.
+
+Default is on.} xywh {245 366 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 345 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 420 141 25} down_box BORDER_BOX
} {
MenuItem {} {
label {User Settings}
@@ -737,13 +777,13 @@ Default is on.} xywh {245 300 100 25} down_box BORDER_BOX
Fl_Button {} {
label Cancel
callback {global_settings_window->hide();}
- xywh {230 345 75 25}
+ xywh {230 420 75 25}
}
Fl_Button {} {
label OK
callback {writePrefs();
global_settings_window->hide();}
- xywh {315 345 75 25}
+ xywh {315 420 75 25}
}
}
code {readPrefs();
diff --git a/fluid/alignment_panel.h b/fluid/alignment_panel.h
index 1e02a5c37..5e8035bf4 100644
--- a/fluid/alignment_panel.h
+++ b/fluid/alignment_panel.h
@@ -108,6 +108,7 @@ extern Fl_Choice *wArrowFocus;
extern Fl_Choice *wShowTooltips;
extern Fl_Choice *wDNDText;
extern Fl_Choice *wGTKText;
+extern Fl_Choice *wPrintGTKText;
extern Fl_Choice *wUserOrSystem;
Fl_Double_Window* make_global_settings_window();
extern Fl_Menu_Item menu_wVisibleFocus[];
@@ -115,6 +116,7 @@ extern Fl_Menu_Item menu_wArrowFocus[];
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_wUserOrSystem[];
#endif