2 // "$Id: alignment_panel.cxx 8089 2010-12-20 22:19:24Z matt $"
4 // Setting and shell dialogs for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2010 by Bill Spitzak and others.
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
28 // generated by Fast Light User Interface Designer (fluid) version 1.0300
30 #include "alignment_panel.h"
31 #include <FL/Fl_Preferences.H>
32 #include <FL/fl_ask.H>
33 Fl_Text_Buffer
*shell_run_buffer
;
35 Fl_Double_Window
*project_window
=(Fl_Double_Window
*)0;
37 static void cb_Close(Fl_Button
*, void*) {
38 project_window
->hide();
41 Fl_Input
*header_file_input
=(Fl_Input
*)0;
43 Fl_Input
*code_file_input
=(Fl_Input
*)0;
45 Fl_Check_Button
*include_H_from_C_button
=(Fl_Check_Button
*)0;
47 Fl_Check_Button
*use_FL_COMMAND_button
=(Fl_Check_Button
*)0;
49 Fl_Choice
*i18n_type_chooser
=(Fl_Choice
*)0;
51 Fl_Menu_Item menu_i18n_type_chooser
[] = {
52 {"None", 0, 0, 0, 0, FL_NORMAL_LABEL
, 0, 14, 0},
53 {"GNU gettext", 0, 0, 0, 0, FL_NORMAL_LABEL
, 0, 14, 0},
54 {"POSIX catgets", 0, 0, 0, 0, FL_NORMAL_LABEL
, 0, 14, 0},
58 Fl_Input
*i18n_include_input
=(Fl_Input
*)0;
60 Fl_Input
*i18n_file_input
=(Fl_Input
*)0;
62 Fl_Int_Input
*i18n_set_input
=(Fl_Int_Input
*)0;
64 Fl_Input
*i18n_function_input
=(Fl_Input
*)0;
66 Fl_Double_Window
* make_project_window() {
67 { project_window
= new Fl_Double_Window(399, 252, "Project Settings");
68 { Fl_Button
* o
= new Fl_Button(328, 216, 60, 25, "Close");
69 o
->tooltip("Close this dialog.");
70 o
->callback((Fl_Callback
*)cb_Close
);
72 { Fl_Tabs
* o
= new Fl_Tabs(10, 10, 378, 195);
73 o
->selection_color((Fl_Color
)12);
74 { Fl_Group
* o
= new Fl_Group(10, 36, 378, 169, "Output");
76 { Fl_Box
* o
= new Fl_Box(100, 49, 236, 49, "Use \"name.ext\" to set a file name or just \".ext\" to set extension.");
77 o
->align(Fl_Align(FL_ALIGN_WRAP
|FL_ALIGN_INSIDE
));
79 { header_file_input
= new Fl_Input(99, 103, 272, 20, "Header File:");
80 header_file_input
->tooltip("The name of the generated header file.");
81 header_file_input
->box(FL_THIN_DOWN_BOX
);
82 header_file_input
->labelfont(1);
83 header_file_input
->textfont(4);
84 header_file_input
->callback((Fl_Callback
*)header_input_cb
, (void*)(1));
85 header_file_input
->when(FL_WHEN_CHANGED
);
86 } // Fl_Input* header_file_input
87 { code_file_input
= new Fl_Input(100, 128, 272, 20, "Code File:");
88 code_file_input
->tooltip("The name of the generated code file.");
89 code_file_input
->box(FL_THIN_DOWN_BOX
);
90 code_file_input
->labelfont(1);
91 code_file_input
->textfont(4);
92 code_file_input
->callback((Fl_Callback
*)code_input_cb
, (void*)(1));
93 code_file_input
->when(FL_WHEN_CHANGED
);
94 } // Fl_Input* code_file_input
95 { include_H_from_C_button
= new Fl_Check_Button(100, 153, 272, 20, "Include Header from Code");
96 include_H_from_C_button
->tooltip("Include the header file from the code file.");
97 include_H_from_C_button
->down_box(FL_DOWN_BOX
);
98 include_H_from_C_button
->callback((Fl_Callback
*)include_H_from_C_button_cb
);
99 } // Fl_Check_Button* include_H_from_C_button
100 { use_FL_COMMAND_button
= new Fl_Check_Button(100, 176, 272, 20, "Menu shortcuts use FL_COMMAND");
101 use_FL_COMMAND_button
->tooltip("Replace FL_CTRL with FL_COMMAND when generating menu shortcut code.");
102 use_FL_COMMAND_button
->down_box(FL_DOWN_BOX
);
103 use_FL_COMMAND_button
->callback((Fl_Callback
*)use_FL_COMMAND_button_cb
);
104 } // Fl_Check_Button* use_FL_COMMAND_button
107 { Fl_Group
* o
= new Fl_Group(10, 36, 378, 169, "Internationalization");
108 { i18n_type_chooser
= new Fl_Choice(100, 48, 136, 25, "Use:");
109 i18n_type_chooser
->tooltip("Type of internationalization to use.");
110 i18n_type_chooser
->box(FL_THIN_UP_BOX
);
111 i18n_type_chooser
->down_box(FL_BORDER_BOX
);
112 i18n_type_chooser
->labelfont(1);
113 i18n_type_chooser
->callback((Fl_Callback
*)i18n_type_cb
);
114 i18n_type_chooser
->menu(menu_i18n_type_chooser
);
115 } // Fl_Choice* i18n_type_chooser
116 { i18n_include_input
= new Fl_Input(100, 78, 272, 20, "#include:");
117 i18n_include_input
->tooltip("The include file for internationalization.");
118 i18n_include_input
->box(FL_THIN_DOWN_BOX
);
119 i18n_include_input
->labelfont(1);
120 i18n_include_input
->textfont(4);
121 i18n_include_input
->callback((Fl_Callback
*)i18n_text_cb
);
122 } // Fl_Input* i18n_include_input
123 { i18n_file_input
= new Fl_Input(100, 104, 272, 20, "File:");
124 i18n_file_input
->tooltip("The name of the message catalog.");
125 i18n_file_input
->box(FL_THIN_DOWN_BOX
);
126 i18n_file_input
->labelfont(1);
127 i18n_file_input
->textfont(4);
128 i18n_file_input
->callback((Fl_Callback
*)i18n_text_cb
);
129 } // Fl_Input* i18n_file_input
130 { i18n_set_input
= new Fl_Int_Input(100, 128, 272, 20, "Set:");
131 i18n_set_input
->tooltip("The message set number.");
132 i18n_set_input
->type(2);
133 i18n_set_input
->box(FL_THIN_DOWN_BOX
);
134 i18n_set_input
->labelfont(1);
135 i18n_set_input
->textfont(4);
136 i18n_set_input
->callback((Fl_Callback
*)i18n_int_cb
);
137 } // Fl_Int_Input* i18n_set_input
138 { i18n_function_input
= new Fl_Input(100, 103, 272, 20, "Function:");
139 i18n_function_input
->tooltip("The function to call to internationalize the labels and tooltips.");
140 i18n_function_input
->box(FL_THIN_DOWN_BOX
);
141 i18n_function_input
->labelfont(1);
142 i18n_function_input
->textfont(4);
143 i18n_function_input
->callback((Fl_Callback
*)i18n_text_cb
);
144 } // Fl_Input* i18n_function_input
149 project_window
->set_modal();
150 project_window
->end();
151 } // Fl_Double_Window* project_window
152 return project_window
;
154 void scheme_cb(Fl_Choice
*, void *);
156 Fl_Double_Window
*settings_window
=(Fl_Double_Window
*)0;
158 Fl_Choice
*scheme_choice
=(Fl_Choice
*)0;
160 Fl_Menu_Item menu_scheme_choice
[] = {
161 {"Default", 0, 0, 0, 0, FL_NORMAL_LABEL
, 0, 14, 0},
162 {"None", 0, 0, 0, 0, FL_NORMAL_LABEL
, 0, 14, 0},
163 {"Plastic", 0, 0, 0, 0, FL_NORMAL_LABEL
, 0, 14, 0},
164 {"GTK+", 0, 0, 0, 0, FL_NORMAL_LABEL
, 0, 14, 0},
168 Fl_Check_Button
*tooltips_button
=(Fl_Check_Button
*)0;
170 static void cb_tooltips_button(Fl_Check_Button
*, void*) {
171 Fl_Tooltip::enable(tooltips_button
->value());
172 fluid_prefs
.set("show_tooltips", tooltips_button
->value());
175 Fl_Check_Button
*completion_button
=(Fl_Check_Button
*)0;
177 static void cb_completion_button(Fl_Check_Button
*, void*) {
178 fluid_prefs
.set("show_completion_dialogs", completion_button
->value());
181 Fl_Check_Button
*openlast_button
=(Fl_Check_Button
*)0;
183 static void cb_openlast_button(Fl_Check_Button
*, void*) {
184 fluid_prefs
.set("open_previous_file", openlast_button
->value());
187 Fl_Check_Button
*prevpos_button
=(Fl_Check_Button
*)0;
189 static void cb_prevpos_button(Fl_Check_Button
*, void*) {
190 fluid_prefs
.set("prev_window_pos", prevpos_button
->value());
193 Fl_Check_Button
*show_comments_button
=(Fl_Check_Button
*)0;
195 static void cb_show_comments_button(Fl_Check_Button
*, void*) {
196 show_comments
= show_comments_button
->value();
197 fluid_prefs
.set("show_comments", show_comments
);
201 Fl_Spinner
*recent_spinner
=(Fl_Spinner
*)0;
203 static void cb_recent_spinner(Fl_Spinner
*, void*) {
204 fluid_prefs
.set("recent_files", recent_spinner
->value());
208 static void cb_Close1(Fl_Button
*, void*) {
209 settings_window
->hide();
212 Fl_Double_Window
* make_settings_window() {
213 { settings_window
= new Fl_Double_Window(339, 241, "GUI Settings");
214 { scheme_choice
= new Fl_Choice(116, 10, 115, 25, "Scheme: ");
215 scheme_choice
->down_box(FL_BORDER_BOX
);
216 scheme_choice
->labelfont(1);
217 scheme_choice
->callback((Fl_Callback
*)scheme_cb
);
218 scheme_choice
->menu(menu_scheme_choice
);
220 fluid_prefs
.get("scheme", s
, 0);
221 scheme_choice
->value(s
);
223 } // Fl_Choice* scheme_choice
224 { Fl_Group
* o
= new Fl_Group(116, 43, 220, 126);
226 o
->align(Fl_Align(FL_ALIGN_CENTER
));
227 { Fl_Box
* o
= new Fl_Box(116, 43, 1, 25, "Options: ");
229 o
->align(Fl_Align(FL_ALIGN_LEFT
));
231 { tooltips_button
= new Fl_Check_Button(116, 43, 113, 25, "Show Tooltips");
232 tooltips_button
->down_box(FL_DOWN_BOX
);
233 tooltips_button
->callback((Fl_Callback
*)cb_tooltips_button
);
235 fluid_prefs
.get("show_tooltips", b
, 1);
236 tooltips_button
->value(b
);
237 Fl_Tooltip::enable(b
);
238 } // Fl_Check_Button* tooltips_button
239 { completion_button
= new Fl_Check_Button(116, 68, 186, 25, "Show Completion Dialogs");
240 completion_button
->down_box(FL_DOWN_BOX
);
241 completion_button
->callback((Fl_Callback
*)cb_completion_button
);
243 fluid_prefs
.get("show_completion_dialogs", b
, 1);
244 completion_button
->value(b
);
245 } // Fl_Check_Button* completion_button
246 { openlast_button
= new Fl_Check_Button(116, 93, 214, 25, "Open Previous File on Startup");
247 openlast_button
->down_box(FL_DOWN_BOX
);
248 openlast_button
->callback((Fl_Callback
*)cb_openlast_button
);
250 fluid_prefs
.get("open_previous_file", b
, 0);
251 openlast_button
->value(b
);
252 } // Fl_Check_Button* openlast_button
253 { prevpos_button
= new Fl_Check_Button(116, 118, 209, 25, "Remember Window Positions");
254 prevpos_button
->down_box(FL_DOWN_BOX
);
255 prevpos_button
->callback((Fl_Callback
*)cb_prevpos_button
);
257 fluid_prefs
.get("prev_window_pos", b
, 1);
258 prevpos_button
->value(b
);
259 } // Fl_Check_Button* prevpos_button
260 { show_comments_button
= new Fl_Check_Button(116, 143, 209, 25, "Show Comments in Browser");
261 show_comments_button
->down_box(FL_DOWN_BOX
);
262 show_comments_button
->callback((Fl_Callback
*)cb_show_comments_button
);
263 fluid_prefs
.get("show_comments", show_comments
, 1);
264 show_comments_button
->value(show_comments
);
265 } // Fl_Check_Button* show_comments_button
268 { recent_spinner
= new Fl_Spinner(115, 173, 40, 25, "# Recent Files: ");
269 recent_spinner
->labelfont(1);
270 recent_spinner
->callback((Fl_Callback
*)cb_recent_spinner
);
271 recent_spinner
->when(FL_WHEN_CHANGED
);
273 fluid_prefs
.get("recent_files", c
, 5);
274 recent_spinner
->maximum(10);
275 recent_spinner
->value(c
);
276 } // Fl_Spinner* recent_spinner
277 { Fl_Button
* o
= new Fl_Button(266, 205, 64, 25, "Close");
278 o
->tooltip("Close this dialog.");
279 o
->callback((Fl_Callback
*)cb_Close1
);
281 settings_window
->set_non_modal();
282 settings_window
->end();
283 } // Fl_Double_Window* settings_window
284 return settings_window
;
287 Fl_Double_Window
*shell_window
=(Fl_Double_Window
*)0;
289 Fl_Input
*shell_command_input
=(Fl_Input
*)0;
291 static void cb_shell_command_input(Fl_Input
*, void*) {
292 fluid_prefs
.set("shell_command", shell_command_input
->value());
295 Fl_Check_Button
*shell_writecode_button
=(Fl_Check_Button
*)0;
297 static void cb_shell_writecode_button(Fl_Check_Button
*, void*) {
298 fluid_prefs
.set("shell_writecode", shell_writecode_button
->value());
301 Fl_Check_Button
*shell_writemsgs_button
=(Fl_Check_Button
*)0;
303 static void cb_shell_writemsgs_button(Fl_Check_Button
*, void*) {
304 fluid_prefs
.set("shell_writemsgs", shell_writemsgs_button
->value());
307 Fl_Check_Button
*shell_savefl_button
=(Fl_Check_Button
*)0;
309 static void cb_shell_savefl_button(Fl_Check_Button
*, void*) {
310 fluid_prefs
.set("shell_savefl", shell_savefl_button
->value());
313 static void cb_Cancel(Fl_Button
*, void*) {
314 shell_window
->hide();
317 Fl_Double_Window
*shell_run_window
=(Fl_Double_Window
*)0;
319 Fl_Text_Display
*shell_run_display
=(Fl_Text_Display
*)0;
321 Fl_Return_Button
*shell_run_button
=(Fl_Return_Button
*)0;
323 static void cb_shell_run_button(Fl_Return_Button
*, void*) {
324 shell_run_window
->hide();
327 Fl_Double_Window
* make_shell_window() {
328 { shell_window
= new Fl_Double_Window(365, 125, "Shell Command");
329 { shell_command_input
= new Fl_Input(10, 27, 347, 25, "Command:");
330 shell_command_input
->labelfont(1);
331 shell_command_input
->callback((Fl_Callback
*)cb_shell_command_input
);
332 shell_command_input
->align(Fl_Align(FL_ALIGN_TOP_LEFT
));
334 fluid_prefs
.get("shell_command", buf
, "", sizeof(buf
));
335 shell_command_input
->value(buf
);
336 } // Fl_Input* shell_command_input
337 { shell_writecode_button
= new Fl_Check_Button(128, 61, 93, 19, "Write Code");
338 shell_writecode_button
->down_box(FL_DOWN_BOX
);
339 shell_writecode_button
->callback((Fl_Callback
*)cb_shell_writecode_button
);
341 fluid_prefs
.get("shell_writecode", b
, 1);
342 shell_writecode_button
->value(b
);
343 } // Fl_Check_Button* shell_writecode_button
344 { shell_writemsgs_button
= new Fl_Check_Button(231, 61, 126, 19, "Write Messages");
345 shell_writemsgs_button
->down_box(FL_DOWN_BOX
);
346 shell_writemsgs_button
->callback((Fl_Callback
*)cb_shell_writemsgs_button
);
348 fluid_prefs
.get("shell_writemsgs", b
, 0);
349 shell_writemsgs_button
->value(b
);
350 } // Fl_Check_Button* shell_writemsgs_button
351 { shell_savefl_button
= new Fl_Check_Button(10, 62, 108, 19, "Save .FL File");
352 shell_savefl_button
->down_box(FL_DOWN_BOX
);
353 shell_savefl_button
->callback((Fl_Callback
*)cb_shell_savefl_button
);
355 fluid_prefs
.get("shell_savefl", b
, 1);
356 shell_savefl_button
->value(b
);
357 } // Fl_Check_Button* shell_savefl_button
358 { Fl_Return_Button
* o
= new Fl_Return_Button(132, 90, 143, 25, "Run Command");
359 o
->callback((Fl_Callback
*)do_shell_command
);
360 } // Fl_Return_Button* o
361 { Fl_Button
* o
= new Fl_Button(285, 90, 72, 25, "Cancel");
362 o
->callback((Fl_Callback
*)cb_Cancel
);
365 } // Fl_Double_Window* shell_window
366 { shell_run_window
= new Fl_Double_Window(555, 430, "Shell Command Output");
367 { shell_run_display
= new Fl_Text_Display(10, 10, 535, 375);
368 shell_run_display
->box(FL_DOWN_BOX
);
369 shell_run_display
->textfont(4);
370 Fl_Group::current()->resizable(shell_run_display
);
371 shell_run_buffer
= new Fl_Text_Buffer();
372 shell_run_display
->buffer(shell_run_buffer
);
373 } // Fl_Text_Display* shell_run_display
374 { shell_run_button
= new Fl_Return_Button(468, 395, 77, 25, "Close");
375 shell_run_button
->callback((Fl_Callback
*)cb_shell_run_button
);
376 } // Fl_Return_Button* shell_run_button
377 shell_run_window
->end();
378 } // Fl_Double_Window* shell_run_window
379 return shell_run_window
;
382 Fl_Double_Window
*grid_window
=(Fl_Double_Window
*)0;
384 Fl_Int_Input
*horizontal_input
=(Fl_Int_Input
*)0;
386 Fl_Int_Input
*vertical_input
=(Fl_Int_Input
*)0;
388 Fl_Int_Input
*snap_input
=(Fl_Int_Input
*)0;
390 Fl_Check_Button
*guides_toggle
=(Fl_Check_Button
*)0;
392 static void cb_Close2(Fl_Button
*, void*) {
396 Fl_Round_Button
*def_widget_size
[6]={(Fl_Round_Button
*)0};
398 Fl_Double_Window
* make_layout_window() {
399 { grid_window
= new Fl_Double_Window(285, 245, "Layout Settings");
400 { Fl_Int_Input
* o
= horizontal_input
= new Fl_Int_Input(106, 10, 50, 25, "x");
401 horizontal_input
->tooltip("Horizontal grid spacing.");
402 horizontal_input
->type(2);
403 horizontal_input
->box(FL_THIN_DOWN_BOX
);
404 horizontal_input
->callback((Fl_Callback
*)grid_cb
, (void*)(1));
405 horizontal_input
->align(Fl_Align(FL_ALIGN_RIGHT
));
406 o
->when(FL_WHEN_RELEASE
|FL_WHEN_ENTER_KEY
);
407 } // Fl_Int_Input* horizontal_input
408 { Fl_Int_Input
* o
= vertical_input
= new Fl_Int_Input(166, 10, 50, 25, "pixels");
409 vertical_input
->tooltip("Vertical grid spacing.");
410 vertical_input
->type(2);
411 vertical_input
->box(FL_THIN_DOWN_BOX
);
412 vertical_input
->callback((Fl_Callback
*)grid_cb
, (void*)(2));
413 vertical_input
->align(Fl_Align(FL_ALIGN_RIGHT
));
414 o
->when(FL_WHEN_RELEASE
|FL_WHEN_ENTER_KEY
);
415 } // Fl_Int_Input* vertical_input
416 { Fl_Int_Input
* o
= snap_input
= new Fl_Int_Input(106, 45, 50, 25, "pixel snap");
417 snap_input
->tooltip("Snap to grid within this many pixels.");
419 snap_input
->box(FL_THIN_DOWN_BOX
);
420 snap_input
->callback((Fl_Callback
*)grid_cb
, (void*)(3));
421 snap_input
->align(Fl_Align(FL_ALIGN_RIGHT
));
422 o
->when(FL_WHEN_RELEASE
|FL_WHEN_ENTER_KEY
);
423 } // Fl_Int_Input* snap_input
424 { guides_toggle
= new Fl_Check_Button(106, 80, 110, 25, "Show Guides");
425 guides_toggle
->tooltip("Show distance and alignment guides in overlay");
426 guides_toggle
->down_box(FL_DOWN_BOX
);
427 guides_toggle
->callback((Fl_Callback
*)guides_cb
, (void*)(4));
428 } // Fl_Check_Button* guides_toggle
429 { Fl_Button
* o
= new Fl_Button(215, 210, 60, 25, "Close");
430 o
->tooltip("Close this dialog.");
431 o
->callback((Fl_Callback
*)cb_Close2
);
433 { Fl_Box
* o
= new Fl_Box(26, 10, 70, 25, "Grid:");
435 o
->align(Fl_Align(FL_ALIGN_RIGHT
|FL_ALIGN_INSIDE
));
437 { Fl_Box
* o
= new Fl_Box(-1, 115, 97, 25, "Widget Size:");
439 o
->align(Fl_Align(FL_ALIGN_RIGHT
|FL_ALIGN_INSIDE
));
441 { Fl_Group
* o
= new Fl_Group(105, 115, 170, 75);
442 { def_widget_size
[0] = new Fl_Round_Button(105, 115, 70, 25);
443 def_widget_size
[0]->type(102);
444 def_widget_size
[0]->down_box(FL_ROUND_DOWN_BOX
);
445 def_widget_size
[0]->callback((Fl_Callback
*)default_widget_size_cb
, (void*)(8));
446 } // Fl_Round_Button* def_widget_size[0]
447 { Fl_Box
* o
= new Fl_Box(120, 115, 50, 25, "tiny");
449 o
->align(Fl_Align(FL_ALIGN_LEFT
|FL_ALIGN_INSIDE
));
451 { def_widget_size
[1] = new Fl_Round_Button(180, 115, 70, 25);
452 def_widget_size
[1]->type(102);
453 def_widget_size
[1]->down_box(FL_ROUND_DOWN_BOX
);
454 def_widget_size
[1]->callback((Fl_Callback
*)default_widget_size_cb
, (void*)(11));
455 } // Fl_Round_Button* def_widget_size[1]
456 { Fl_Box
* o
= new Fl_Box(195, 115, 50, 25, "small");
458 o
->align(Fl_Align(FL_ALIGN_LEFT
|FL_ALIGN_INSIDE
));
460 { def_widget_size
[2] = new Fl_Round_Button(105, 140, 70, 25);
461 def_widget_size
[2]->type(102);
462 def_widget_size
[2]->down_box(FL_ROUND_DOWN_BOX
);
463 def_widget_size
[2]->callback((Fl_Callback
*)default_widget_size_cb
, (void*)(14));
464 } // Fl_Round_Button* def_widget_size[2]
465 { Fl_Box
* o
= new Fl_Box(120, 140, 50, 25, "normal");
466 o
->align(Fl_Align(FL_ALIGN_LEFT
|FL_ALIGN_INSIDE
));
468 { def_widget_size
[3] = new Fl_Round_Button(180, 140, 90, 25);
469 def_widget_size
[3]->type(102);
470 def_widget_size
[3]->down_box(FL_ROUND_DOWN_BOX
);
471 def_widget_size
[3]->callback((Fl_Callback
*)default_widget_size_cb
, (void*)(18));
472 } // Fl_Round_Button* def_widget_size[3]
473 { Fl_Box
* o
= new Fl_Box(195, 140, 68, 25, "medium");
475 o
->align(Fl_Align(FL_ALIGN_LEFT
|FL_ALIGN_INSIDE
));
477 { def_widget_size
[4] = new Fl_Round_Button(105, 165, 75, 25);
478 def_widget_size
[4]->type(102);
479 def_widget_size
[4]->down_box(FL_ROUND_DOWN_BOX
);
480 def_widget_size
[4]->callback((Fl_Callback
*)default_widget_size_cb
, (void*)(24));
481 } // Fl_Round_Button* def_widget_size[4]
482 { Fl_Box
* o
= new Fl_Box(120, 165, 64, 25, "large");
484 o
->align(Fl_Align(FL_ALIGN_LEFT
|FL_ALIGN_INSIDE
));
486 { def_widget_size
[5] = new Fl_Round_Button(180, 165, 95, 25);
487 def_widget_size
[5]->type(102);
488 def_widget_size
[5]->down_box(FL_ROUND_DOWN_BOX
);
489 def_widget_size
[5]->callback((Fl_Callback
*)default_widget_size_cb
, (void*)(32));
490 } // Fl_Round_Button* def_widget_size[5]
491 { Fl_Box
* o
= new Fl_Box(195, 165, 76, 25, "huge");
493 o
->align(Fl_Align(FL_ALIGN_LEFT
|FL_ALIGN_INSIDE
));
497 grid_window
->set_non_modal();
499 } // Fl_Double_Window* grid_window
503 Copy of all options in user and system mode
505 static int opt
[10][2];
508 Update the UI using the values in the opt array
510 static void refreshUI() {
511 int mode
= wUserOrSystem
->value();
512 wVisibleFocus
->value(opt
[Fl::OPTION_VISIBLE_FOCUS
][mode
]);
513 wArrowFocus
->value(opt
[Fl::OPTION_ARROW_FOCUS
][mode
]);
514 wShowTooltips
->value(opt
[Fl::OPTION_SHOW_TOOLTIPS
][mode
]);
515 wDNDText
->value(opt
[Fl::OPTION_DND_TEXT
][mode
]);
519 read all preferences and refresh the GUI
521 static void readPrefs() {
522 // read all preferences and refresh the GUI
524 Fl_Preferences
prefs(Fl_Preferences::SYSTEM
, "fltk.org", "fltk");
525 Fl_Preferences
opt_prefs(prefs
, "options");
526 opt_prefs
.get("ArrowFocus", opt
[Fl::OPTION_ARROW_FOCUS
][1], 2);
527 opt_prefs
.get("VisibleFocus", opt
[Fl::OPTION_VISIBLE_FOCUS
][1], 2);
528 opt_prefs
.get("DNDText", opt
[Fl::OPTION_DND_TEXT
][1], 2);
529 opt_prefs
.get("ShowTooltips", opt
[Fl::OPTION_SHOW_TOOLTIPS
][1], 2);
532 Fl_Preferences
prefs(Fl_Preferences::USER
, "fltk.org", "fltk");
533 Fl_Preferences
opt_prefs(prefs
, "options");
534 opt_prefs
.get("ArrowFocus", opt
[Fl::OPTION_ARROW_FOCUS
][0], 2);
535 opt_prefs
.get("VisibleFocus", opt
[Fl::OPTION_VISIBLE_FOCUS
][0], 2);
536 opt_prefs
.get("DNDText", opt
[Fl::OPTION_DND_TEXT
][0], 2);
537 opt_prefs
.get("ShowTooltips", opt
[Fl::OPTION_SHOW_TOOLTIPS
][0], 2);
543 write all preferences using the array
545 static void writePrefs() {
546 // write all preferences using the array
548 Fl_Preferences
prefs(Fl_Preferences::SYSTEM
, "fltk.org", "fltk");
549 Fl_Preferences
opt_prefs(prefs
, "options");
550 if (opt
[Fl::OPTION_ARROW_FOCUS
][1]==2) opt_prefs
.deleteEntry("ArrowFocus");
551 else opt_prefs
.set("ArrowFocus", opt
[Fl::OPTION_ARROW_FOCUS
][1]);
552 if (opt
[Fl::OPTION_VISIBLE_FOCUS
][1]==2) opt_prefs
.deleteEntry("VisibleFocus");
553 else opt_prefs
.set("VisibleFocus", opt
[Fl::OPTION_VISIBLE_FOCUS
][1]);
554 if (opt
[Fl::OPTION_DND_TEXT
][1]==2) opt_prefs
.deleteEntry("DNDText");
555 else opt_prefs
.set("DNDText", opt
[Fl::OPTION_DND_TEXT
][1]);
556 if (opt
[Fl::OPTION_SHOW_TOOLTIPS
][1]==2) opt_prefs
.deleteEntry("ShowTooltips");
557 else opt_prefs
.set("ShowTooltips", opt
[Fl::OPTION_SHOW_TOOLTIPS
][1]);
560 Fl_Preferences
prefs(Fl_Preferences::USER
, "fltk.org", "fltk");
561 Fl_Preferences
opt_prefs(prefs
, "options");
562 if (opt
[Fl::OPTION_ARROW_FOCUS
][0]==2) opt_prefs
.deleteEntry("ArrowFocus");
563 else opt_prefs
.set("ArrowFocus", opt
[Fl::OPTION_ARROW_FOCUS
][0]);
564 if (opt
[Fl::OPTION_VISIBLE_FOCUS
][0]==2) opt_prefs
.deleteEntry("VisibleFocus");
565 else opt_prefs
.set("VisibleFocus", opt
[Fl::OPTION_VISIBLE_FOCUS
][0]);
566 if (opt
[Fl::OPTION_DND_TEXT
][0]==2) opt_prefs
.deleteEntry("DNDText");
567 else opt_prefs
.set("DNDText", opt
[Fl::OPTION_DND_TEXT
][0]);
568 if (opt
[Fl::OPTION_SHOW_TOOLTIPS
][0]==2) opt_prefs
.deleteEntry("ShowTooltips");
569 else opt_prefs
.set("ShowTooltips", opt
[Fl::OPTION_SHOW_TOOLTIPS
][0]);
573 void show_global_settings_window() {
574 if (!global_settings_window
)
575 make_global_settings_window();
580 "The following dialog changes the user interface behavior\n"
581 "of ALL FLTK applications, for the current user, or for \n"
582 "ALL users on this machine.\n\n"
583 "Please choose these settings carefully, or reset\n"
584 "user and system settings to \"default\".");
585 global_settings_window
->show();
588 Fl_Double_Window
*global_settings_window
=(Fl_Double_Window
*)0;
590 Fl_Choice
*wVisibleFocus
=(Fl_Choice
*)0;
592 static void cb_wVisibleFocus(Fl_Choice
*, void*) {
593 int mode
= wUserOrSystem
->value();
594 opt
[Fl::OPTION_VISIBLE_FOCUS
][mode
] = wVisibleFocus
->value();
597 Fl_Menu_Item menu_wVisibleFocus
[] = {
598 {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL
, 0, 14, 0},
599 {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL
, 0, 14, 0},
600 {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL
, 0, 14, 0},
604 Fl_Choice
*wArrowFocus
=(Fl_Choice
*)0;
606 static void cb_wArrowFocus(Fl_Choice
*, void*) {
607 int mode
= wUserOrSystem
->value();
608 opt
[Fl::OPTION_ARROW_FOCUS
][mode
] = wArrowFocus
->value();
611 Fl_Menu_Item menu_wArrowFocus
[] = {
612 {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL
, 0, 14, 0},
613 {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL
, 0, 14, 0},
614 {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL
, 0, 14, 0},
618 Fl_Choice
*wShowTooltips
=(Fl_Choice
*)0;
620 static void cb_wShowTooltips(Fl_Choice
*, void*) {
621 int mode
= wUserOrSystem
->value();
622 opt
[Fl::OPTION_SHOW_TOOLTIPS
][mode
] = wShowTooltips
->value();
625 Fl_Menu_Item menu_wShowTooltips
[] = {
626 {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL
, 0, 14, 0},
627 {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL
, 0, 14, 0},
628 {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL
, 0, 14, 0},
632 Fl_Choice
*wDNDText
=(Fl_Choice
*)0;
634 static void cb_wDNDText(Fl_Choice
*, void*) {
635 int mode
= wUserOrSystem
->value();
636 opt
[Fl::OPTION_DND_TEXT
][mode
] = wDNDText
->value();
639 Fl_Menu_Item menu_wDNDText
[] = {
640 {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL
, 0, 14, 0},
641 {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL
, 0, 14, 0},
642 {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL
, 0, 14, 0},
646 Fl_Choice
*wUserOrSystem
=(Fl_Choice
*)0;
648 static void cb_wUserOrSystem(Fl_Choice
*, void*) {
652 Fl_Menu_Item menu_wUserOrSystem
[] = {
653 {"User Settings", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL
, 0, 14, 0},
654 {"System Settings", 0, 0, (void*)(1), 0, FL_NORMAL_LABEL
, 0, 14, 0},
658 static void cb_Cancel1(Fl_Button
*, void*) {
659 global_settings_window
->hide();
662 static void cb_OK(Fl_Button
*, void*) {
664 global_settings_window
->hide();
667 Fl_Double_Window
* make_global_settings_window() {
668 { global_settings_window
= new Fl_Double_Window(403, 317, "FLTK Preferences");
669 global_settings_window
->color(FL_LIGHT1
);
670 { Fl_Group
* o
= new Fl_Group(10, 10, 380, 100, "Keyboard Focus Options");
671 o
->box(FL_GTK_DOWN_BOX
);
673 o
->align(Fl_Align(FL_ALIGN_TOP_LEFT
|FL_ALIGN_INSIDE
));
674 { wVisibleFocus
= new Fl_Choice(245, 40, 100, 25, "Visible Keyboard Focus:");
675 wVisibleFocus
->tooltip("OPTION_VISIBLE_FOCUS\n\nIf visible focus is switched on, FLTK will draw a dot\
676 ted rectangle inside the widget that will receive the next keystroke. If switc\
677 hed off, no such indicator will be drawn and keyboard navigation is disabled.\
678 \n\nDefault is on.");
679 wVisibleFocus
->down_box(FL_BORDER_BOX
);
680 wVisibleFocus
->callback((Fl_Callback
*)cb_wVisibleFocus
);
681 wVisibleFocus
->menu(menu_wVisibleFocus
);
682 } // Fl_Choice* wVisibleFocus
683 { wArrowFocus
= new Fl_Choice(245, 75, 100, 25, "Arrow Keys move Focus:");
684 wArrowFocus
->tooltip("OPTION_ARROW_FOCUS\n\nWhen switched on, moving the text cursor beyond the sta\
685 rt or end of the text in a text widget will change focus to the next widget. W\
686 hen switched off, the cursor will stop at the end of the text. Pressing Tab or\
687 Ctrl-Tab will advance the keyboard focus. Switch this on, if you want the old\
688 behavior of FLTK 1.1.\n\nDefault is off.");
689 wArrowFocus
->down_box(FL_BORDER_BOX
);
690 wArrowFocus
->callback((Fl_Callback
*)cb_wArrowFocus
);
691 wArrowFocus
->menu(menu_wArrowFocus
);
692 } // Fl_Choice* wArrowFocus
695 { Fl_Group
* o
= new Fl_Group(10, 120, 380, 65, "Tooltip Options");
696 o
->box(FL_GTK_DOWN_BOX
);
698 o
->align(Fl_Align(FL_ALIGN_TOP_LEFT
|FL_ALIGN_INSIDE
));
699 { wShowTooltips
= new Fl_Choice(245, 150, 100, 25, "Show Tooltips:");
700 wShowTooltips
->tooltip("OPTION_SHOW_TOOLTIPS\n\nIf tooltips are enabled, hovering the mouse over a wi\
701 dget with a tooltip text will open a little tooltip window until the mouse lea\
702 ves the widget. If disabled, no tooltip is shown.\n\nDefault is on.");
703 wShowTooltips
->down_box(FL_BORDER_BOX
);
704 wShowTooltips
->callback((Fl_Callback
*)cb_wShowTooltips
);
705 wShowTooltips
->menu(menu_wShowTooltips
);
706 } // Fl_Choice* wShowTooltips
709 { Fl_Group
* o
= new Fl_Group(10, 194, 380, 66, "Drag And Drop Options");
710 o
->box(FL_GTK_DOWN_BOX
);
712 o
->align(Fl_Align(FL_ALIGN_TOP_LEFT
|FL_ALIGN_INSIDE
));
713 { wDNDText
= new Fl_Choice(245, 225, 100, 25, "Allow dragging Text:");
714 wDNDText
->tooltip("OPTION_DND_TEXT\n\nIf text drag-and-drop is enabled, the user can select and \
715 drag text from any text widget. If disabled, no dragging is possible, however \
716 dropping text from other applications still works.\n\nDefault is on.");
717 wDNDText
->down_box(FL_BORDER_BOX
);
718 wDNDText
->callback((Fl_Callback
*)cb_wDNDText
);
719 wDNDText
->menu(menu_wDNDText
);
720 } // Fl_Choice* wDNDText
723 { wUserOrSystem
= new Fl_Choice(14, 275, 141, 25);
724 wUserOrSystem
->tooltip("Change settings for the current user, or default values for all users of this\
725 computer. Individual users can override system options, if they set their opt\
726 ions to specific values (not \'default\').");
727 wUserOrSystem
->down_box(FL_BORDER_BOX
);
728 wUserOrSystem
->callback((Fl_Callback
*)cb_wUserOrSystem
);
729 wUserOrSystem
->menu(menu_wUserOrSystem
);
730 } // Fl_Choice* wUserOrSystem
731 { Fl_Button
* o
= new Fl_Button(230, 275, 75, 25, "Cancel");
732 o
->callback((Fl_Callback
*)cb_Cancel1
);
734 { Fl_Button
* o
= new Fl_Button(315, 275, 75, 25, "OK");
735 o
->callback((Fl_Callback
*)cb_OK
);
737 global_settings_window
->end();
738 } // Fl_Double_Window* global_settings_window
740 Fl::option(Fl::OPTION_SHOW_TOOLTIPS
,1); // make sure tooltips are on !
741 return global_settings_window
;
745 // End of "$Id: alignment_panel.cxx 8089 2010-12-20 22:19:24Z matt $".