You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

747 lines
30KB

  1. //
  2. // "$Id: alignment_panel.cxx 8089 2010-12-20 22:19:24Z matt $"
  3. //
  4. // Setting and shell dialogs for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2010 by Bill Spitzak and others.
  7. //
  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.
  12. //
  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.
  17. //
  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
  21. // USA.
  22. //
  23. // Please report all bugs and problems on the following page:
  24. //
  25. // http://www.fltk.org/str.php
  26. //
  27. // generated by Fast Light User Interface Designer (fluid) version 1.0300
  28. #include "alignment_panel.h"
  29. #include <FL/Fl_Preferences.H>
  30. #include <FL/fl_ask.H>
  31. Fl_Text_Buffer *shell_run_buffer;
  32. Fl_Double_Window *project_window=(Fl_Double_Window *)0;
  33. static void cb_Close(Fl_Button*, void*) {
  34. project_window->hide();
  35. }
  36. Fl_Input *header_file_input=(Fl_Input *)0;
  37. Fl_Input *code_file_input=(Fl_Input *)0;
  38. Fl_Check_Button *include_H_from_C_button=(Fl_Check_Button *)0;
  39. Fl_Check_Button *use_FL_COMMAND_button=(Fl_Check_Button *)0;
  40. Fl_Choice *i18n_type_chooser=(Fl_Choice *)0;
  41. Fl_Menu_Item menu_i18n_type_chooser[] = {
  42. {"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  43. {"GNU gettext", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  44. {"POSIX catgets", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  45. {0,0,0,0,0,0,0,0,0}
  46. };
  47. Fl_Input *i18n_include_input=(Fl_Input *)0;
  48. Fl_Input *i18n_file_input=(Fl_Input *)0;
  49. Fl_Int_Input *i18n_set_input=(Fl_Int_Input *)0;
  50. Fl_Input *i18n_function_input=(Fl_Input *)0;
  51. Fl_Double_Window* make_project_window() {
  52. { project_window = new Fl_Double_Window(399, 252, "Project Settings");
  53. { Fl_Button* o = new Fl_Button(328, 216, 60, 25, "Close");
  54. o->tooltip("Close this dialog.");
  55. o->callback((Fl_Callback*)cb_Close);
  56. } // Fl_Button* o
  57. { Fl_Tabs* o = new Fl_Tabs(10, 10, 378, 195);
  58. o->selection_color((Fl_Color)12);
  59. { Fl_Group* o = new Fl_Group(10, 36, 378, 169, "Output");
  60. o->hide();
  61. { Fl_Box* o = new Fl_Box(100, 49, 236, 49, "Use \"name.ext\" to set a file name or just \".ext\" to set extension.");
  62. o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE));
  63. } // Fl_Box* o
  64. { header_file_input = new Fl_Input(99, 103, 272, 20, "Header File:");
  65. header_file_input->tooltip("The name of the generated header file.");
  66. header_file_input->box(FL_THIN_DOWN_BOX);
  67. header_file_input->labelfont(1);
  68. header_file_input->textfont(4);
  69. header_file_input->callback((Fl_Callback*)header_input_cb, (void*)(1));
  70. header_file_input->when(FL_WHEN_CHANGED);
  71. } // Fl_Input* header_file_input
  72. { code_file_input = new Fl_Input(100, 128, 272, 20, "Code File:");
  73. code_file_input->tooltip("The name of the generated code file.");
  74. code_file_input->box(FL_THIN_DOWN_BOX);
  75. code_file_input->labelfont(1);
  76. code_file_input->textfont(4);
  77. code_file_input->callback((Fl_Callback*)code_input_cb, (void*)(1));
  78. code_file_input->when(FL_WHEN_CHANGED);
  79. } // Fl_Input* code_file_input
  80. { include_H_from_C_button = new Fl_Check_Button(100, 153, 272, 20, "Include Header from Code");
  81. include_H_from_C_button->tooltip("Include the header file from the code file.");
  82. include_H_from_C_button->down_box(FL_DOWN_BOX);
  83. include_H_from_C_button->callback((Fl_Callback*)include_H_from_C_button_cb);
  84. } // Fl_Check_Button* include_H_from_C_button
  85. { use_FL_COMMAND_button = new Fl_Check_Button(100, 176, 272, 20, "Menu shortcuts use FL_COMMAND");
  86. use_FL_COMMAND_button->tooltip("Replace FL_CTRL with FL_COMMAND when generating menu shortcut code.");
  87. use_FL_COMMAND_button->down_box(FL_DOWN_BOX);
  88. use_FL_COMMAND_button->callback((Fl_Callback*)use_FL_COMMAND_button_cb);
  89. } // Fl_Check_Button* use_FL_COMMAND_button
  90. o->end();
  91. } // Fl_Group* o
  92. { Fl_Group* o = new Fl_Group(10, 36, 378, 169, "Internationalization");
  93. { i18n_type_chooser = new Fl_Choice(100, 48, 136, 25, "Use:");
  94. i18n_type_chooser->tooltip("Type of internationalization to use.");
  95. i18n_type_chooser->box(FL_THIN_UP_BOX);
  96. i18n_type_chooser->down_box(FL_BORDER_BOX);
  97. i18n_type_chooser->labelfont(1);
  98. i18n_type_chooser->callback((Fl_Callback*)i18n_type_cb);
  99. i18n_type_chooser->menu(menu_i18n_type_chooser);
  100. } // Fl_Choice* i18n_type_chooser
  101. { i18n_include_input = new Fl_Input(100, 78, 272, 20, "#include:");
  102. i18n_include_input->tooltip("The include file for internationalization.");
  103. i18n_include_input->box(FL_THIN_DOWN_BOX);
  104. i18n_include_input->labelfont(1);
  105. i18n_include_input->textfont(4);
  106. i18n_include_input->callback((Fl_Callback*)i18n_text_cb);
  107. } // Fl_Input* i18n_include_input
  108. { i18n_file_input = new Fl_Input(100, 104, 272, 20, "File:");
  109. i18n_file_input->tooltip("The name of the message catalog.");
  110. i18n_file_input->box(FL_THIN_DOWN_BOX);
  111. i18n_file_input->labelfont(1);
  112. i18n_file_input->textfont(4);
  113. i18n_file_input->callback((Fl_Callback*)i18n_text_cb);
  114. } // Fl_Input* i18n_file_input
  115. { i18n_set_input = new Fl_Int_Input(100, 128, 272, 20, "Set:");
  116. i18n_set_input->tooltip("The message set number.");
  117. i18n_set_input->type(2);
  118. i18n_set_input->box(FL_THIN_DOWN_BOX);
  119. i18n_set_input->labelfont(1);
  120. i18n_set_input->textfont(4);
  121. i18n_set_input->callback((Fl_Callback*)i18n_int_cb);
  122. } // Fl_Int_Input* i18n_set_input
  123. { i18n_function_input = new Fl_Input(100, 103, 272, 20, "Function:");
  124. i18n_function_input->tooltip("The function to call to internationalize the labels and tooltips.");
  125. i18n_function_input->box(FL_THIN_DOWN_BOX);
  126. i18n_function_input->labelfont(1);
  127. i18n_function_input->textfont(4);
  128. i18n_function_input->callback((Fl_Callback*)i18n_text_cb);
  129. } // Fl_Input* i18n_function_input
  130. o->end();
  131. } // Fl_Group* o
  132. o->end();
  133. } // Fl_Tabs* o
  134. project_window->set_modal();
  135. project_window->end();
  136. } // Fl_Double_Window* project_window
  137. return project_window;
  138. }
  139. void scheme_cb(Fl_Choice *, void *);
  140. Fl_Double_Window *settings_window=(Fl_Double_Window *)0;
  141. Fl_Choice *scheme_choice=(Fl_Choice *)0;
  142. Fl_Menu_Item menu_scheme_choice[] = {
  143. {"Default", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  144. {"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  145. {"Plastic", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  146. {"GTK+", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  147. {0,0,0,0,0,0,0,0,0}
  148. };
  149. Fl_Check_Button *tooltips_button=(Fl_Check_Button *)0;
  150. static void cb_tooltips_button(Fl_Check_Button*, void*) {
  151. Fl_Tooltip::enable(tooltips_button->value());
  152. fluid_prefs.set("show_tooltips", tooltips_button->value());
  153. }
  154. Fl_Check_Button *completion_button=(Fl_Check_Button *)0;
  155. static void cb_completion_button(Fl_Check_Button*, void*) {
  156. fluid_prefs.set("show_completion_dialogs", completion_button->value());
  157. }
  158. Fl_Check_Button *openlast_button=(Fl_Check_Button *)0;
  159. static void cb_openlast_button(Fl_Check_Button*, void*) {
  160. fluid_prefs.set("open_previous_file", openlast_button->value());
  161. }
  162. Fl_Check_Button *prevpos_button=(Fl_Check_Button *)0;
  163. static void cb_prevpos_button(Fl_Check_Button*, void*) {
  164. fluid_prefs.set("prev_window_pos", prevpos_button->value());
  165. }
  166. Fl_Check_Button *show_comments_button=(Fl_Check_Button *)0;
  167. static void cb_show_comments_button(Fl_Check_Button*, void*) {
  168. show_comments = show_comments_button->value();
  169. fluid_prefs.set("show_comments", show_comments);
  170. redraw_browser();
  171. }
  172. Fl_Spinner *recent_spinner=(Fl_Spinner *)0;
  173. static void cb_recent_spinner(Fl_Spinner*, void*) {
  174. fluid_prefs.set("recent_files", recent_spinner->value());
  175. load_history();
  176. }
  177. static void cb_Close1(Fl_Button*, void*) {
  178. settings_window->hide();
  179. }
  180. Fl_Double_Window* make_settings_window() {
  181. { settings_window = new Fl_Double_Window(339, 241, "GUI Settings");
  182. { scheme_choice = new Fl_Choice(116, 10, 115, 25, "Scheme: ");
  183. scheme_choice->down_box(FL_BORDER_BOX);
  184. scheme_choice->labelfont(1);
  185. scheme_choice->callback((Fl_Callback*)scheme_cb);
  186. scheme_choice->menu(menu_scheme_choice);
  187. int s;
  188. fluid_prefs.get("scheme", s, 0);
  189. scheme_choice->value(s);
  190. scheme_cb(0, 0);
  191. } // Fl_Choice* scheme_choice
  192. { Fl_Group* o = new Fl_Group(116, 43, 220, 126);
  193. o->labelfont(1);
  194. o->align(Fl_Align(FL_ALIGN_CENTER));
  195. { Fl_Box* o = new Fl_Box(116, 43, 1, 25, "Options: ");
  196. o->labelfont(1);
  197. o->align(Fl_Align(FL_ALIGN_LEFT));
  198. } // Fl_Box* o
  199. { tooltips_button = new Fl_Check_Button(116, 43, 113, 25, "Show Tooltips");
  200. tooltips_button->down_box(FL_DOWN_BOX);
  201. tooltips_button->callback((Fl_Callback*)cb_tooltips_button);
  202. int b;
  203. fluid_prefs.get("show_tooltips", b, 1);
  204. tooltips_button->value(b);
  205. Fl_Tooltip::enable(b);
  206. } // Fl_Check_Button* tooltips_button
  207. { completion_button = new Fl_Check_Button(116, 68, 186, 25, "Show Completion Dialogs");
  208. completion_button->down_box(FL_DOWN_BOX);
  209. completion_button->callback((Fl_Callback*)cb_completion_button);
  210. int b;
  211. fluid_prefs.get("show_completion_dialogs", b, 1);
  212. completion_button->value(b);
  213. } // Fl_Check_Button* completion_button
  214. { openlast_button = new Fl_Check_Button(116, 93, 214, 25, "Open Previous File on Startup");
  215. openlast_button->down_box(FL_DOWN_BOX);
  216. openlast_button->callback((Fl_Callback*)cb_openlast_button);
  217. int b;
  218. fluid_prefs.get("open_previous_file", b, 0);
  219. openlast_button->value(b);
  220. } // Fl_Check_Button* openlast_button
  221. { prevpos_button = new Fl_Check_Button(116, 118, 209, 25, "Remember Window Positions");
  222. prevpos_button->down_box(FL_DOWN_BOX);
  223. prevpos_button->callback((Fl_Callback*)cb_prevpos_button);
  224. int b;
  225. fluid_prefs.get("prev_window_pos", b, 1);
  226. prevpos_button->value(b);
  227. } // Fl_Check_Button* prevpos_button
  228. { show_comments_button = new Fl_Check_Button(116, 143, 209, 25, "Show Comments in Browser");
  229. show_comments_button->down_box(FL_DOWN_BOX);
  230. show_comments_button->callback((Fl_Callback*)cb_show_comments_button);
  231. fluid_prefs.get("show_comments", show_comments, 1);
  232. show_comments_button->value(show_comments);
  233. } // Fl_Check_Button* show_comments_button
  234. o->end();
  235. } // Fl_Group* o
  236. { recent_spinner = new Fl_Spinner(115, 173, 40, 25, "# Recent Files: ");
  237. recent_spinner->labelfont(1);
  238. recent_spinner->callback((Fl_Callback*)cb_recent_spinner);
  239. recent_spinner->when(FL_WHEN_CHANGED);
  240. int c;
  241. fluid_prefs.get("recent_files", c, 5);
  242. recent_spinner->maximum(10);
  243. recent_spinner->value(c);
  244. } // Fl_Spinner* recent_spinner
  245. { Fl_Button* o = new Fl_Button(266, 205, 64, 25, "Close");
  246. o->tooltip("Close this dialog.");
  247. o->callback((Fl_Callback*)cb_Close1);
  248. } // Fl_Button* o
  249. settings_window->set_non_modal();
  250. settings_window->end();
  251. } // Fl_Double_Window* settings_window
  252. return settings_window;
  253. }
  254. Fl_Double_Window *shell_window=(Fl_Double_Window *)0;
  255. Fl_Input *shell_command_input=(Fl_Input *)0;
  256. static void cb_shell_command_input(Fl_Input*, void*) {
  257. fluid_prefs.set("shell_command", shell_command_input->value());
  258. }
  259. Fl_Check_Button *shell_writecode_button=(Fl_Check_Button *)0;
  260. static void cb_shell_writecode_button(Fl_Check_Button*, void*) {
  261. fluid_prefs.set("shell_writecode", shell_writecode_button->value());
  262. }
  263. Fl_Check_Button *shell_writemsgs_button=(Fl_Check_Button *)0;
  264. static void cb_shell_writemsgs_button(Fl_Check_Button*, void*) {
  265. fluid_prefs.set("shell_writemsgs", shell_writemsgs_button->value());
  266. }
  267. Fl_Check_Button *shell_savefl_button=(Fl_Check_Button *)0;
  268. static void cb_shell_savefl_button(Fl_Check_Button*, void*) {
  269. fluid_prefs.set("shell_savefl", shell_savefl_button->value());
  270. }
  271. static void cb_Cancel(Fl_Button*, void*) {
  272. shell_window->hide();
  273. }
  274. Fl_Double_Window *shell_run_window=(Fl_Double_Window *)0;
  275. Fl_Text_Display *shell_run_display=(Fl_Text_Display *)0;
  276. Fl_Return_Button *shell_run_button=(Fl_Return_Button *)0;
  277. static void cb_shell_run_button(Fl_Return_Button*, void*) {
  278. shell_run_window->hide();
  279. }
  280. Fl_Double_Window* make_shell_window() {
  281. { shell_window = new Fl_Double_Window(365, 125, "Shell Command");
  282. { shell_command_input = new Fl_Input(10, 27, 347, 25, "Command:");
  283. shell_command_input->labelfont(1);
  284. shell_command_input->callback((Fl_Callback*)cb_shell_command_input);
  285. shell_command_input->align(Fl_Align(FL_ALIGN_TOP_LEFT));
  286. char buf[1024];
  287. fluid_prefs.get("shell_command", buf, "", sizeof(buf));
  288. shell_command_input->value(buf);
  289. } // Fl_Input* shell_command_input
  290. { shell_writecode_button = new Fl_Check_Button(128, 61, 93, 19, "Write Code");
  291. shell_writecode_button->down_box(FL_DOWN_BOX);
  292. shell_writecode_button->callback((Fl_Callback*)cb_shell_writecode_button);
  293. int b;
  294. fluid_prefs.get("shell_writecode", b, 1);
  295. shell_writecode_button->value(b);
  296. } // Fl_Check_Button* shell_writecode_button
  297. { shell_writemsgs_button = new Fl_Check_Button(231, 61, 126, 19, "Write Messages");
  298. shell_writemsgs_button->down_box(FL_DOWN_BOX);
  299. shell_writemsgs_button->callback((Fl_Callback*)cb_shell_writemsgs_button);
  300. int b;
  301. fluid_prefs.get("shell_writemsgs", b, 0);
  302. shell_writemsgs_button->value(b);
  303. } // Fl_Check_Button* shell_writemsgs_button
  304. { shell_savefl_button = new Fl_Check_Button(10, 62, 108, 19, "Save .FL File");
  305. shell_savefl_button->down_box(FL_DOWN_BOX);
  306. shell_savefl_button->callback((Fl_Callback*)cb_shell_savefl_button);
  307. int b;
  308. fluid_prefs.get("shell_savefl", b, 1);
  309. shell_savefl_button->value(b);
  310. } // Fl_Check_Button* shell_savefl_button
  311. { Fl_Return_Button* o = new Fl_Return_Button(132, 90, 143, 25, "Run Command");
  312. o->callback((Fl_Callback*)do_shell_command);
  313. } // Fl_Return_Button* o
  314. { Fl_Button* o = new Fl_Button(285, 90, 72, 25, "Cancel");
  315. o->callback((Fl_Callback*)cb_Cancel);
  316. } // Fl_Button* o
  317. shell_window->end();
  318. } // Fl_Double_Window* shell_window
  319. { shell_run_window = new Fl_Double_Window(555, 430, "Shell Command Output");
  320. { shell_run_display = new Fl_Text_Display(10, 10, 535, 375);
  321. shell_run_display->box(FL_DOWN_BOX);
  322. shell_run_display->textfont(4);
  323. Fl_Group::current()->resizable(shell_run_display);
  324. shell_run_buffer = new Fl_Text_Buffer();
  325. shell_run_display->buffer(shell_run_buffer);
  326. } // Fl_Text_Display* shell_run_display
  327. { shell_run_button = new Fl_Return_Button(468, 395, 77, 25, "Close");
  328. shell_run_button->callback((Fl_Callback*)cb_shell_run_button);
  329. } // Fl_Return_Button* shell_run_button
  330. shell_run_window->end();
  331. } // Fl_Double_Window* shell_run_window
  332. return shell_run_window;
  333. }
  334. Fl_Double_Window *grid_window=(Fl_Double_Window *)0;
  335. Fl_Int_Input *horizontal_input=(Fl_Int_Input *)0;
  336. Fl_Int_Input *vertical_input=(Fl_Int_Input *)0;
  337. Fl_Int_Input *snap_input=(Fl_Int_Input *)0;
  338. Fl_Check_Button *guides_toggle=(Fl_Check_Button *)0;
  339. static void cb_Close2(Fl_Button*, void*) {
  340. grid_window->hide();
  341. }
  342. Fl_Round_Button *def_widget_size[6]={(Fl_Round_Button *)0};
  343. Fl_Double_Window* make_layout_window() {
  344. { grid_window = new Fl_Double_Window(285, 245, "Layout Settings");
  345. { Fl_Int_Input* o = horizontal_input = new Fl_Int_Input(106, 10, 50, 25, "x");
  346. horizontal_input->tooltip("Horizontal grid spacing.");
  347. horizontal_input->type(2);
  348. horizontal_input->box(FL_THIN_DOWN_BOX);
  349. horizontal_input->callback((Fl_Callback*)grid_cb, (void*)(1));
  350. horizontal_input->align(Fl_Align(FL_ALIGN_RIGHT));
  351. o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY);
  352. } // Fl_Int_Input* horizontal_input
  353. { Fl_Int_Input* o = vertical_input = new Fl_Int_Input(166, 10, 50, 25, "pixels");
  354. vertical_input->tooltip("Vertical grid spacing.");
  355. vertical_input->type(2);
  356. vertical_input->box(FL_THIN_DOWN_BOX);
  357. vertical_input->callback((Fl_Callback*)grid_cb, (void*)(2));
  358. vertical_input->align(Fl_Align(FL_ALIGN_RIGHT));
  359. o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY);
  360. } // Fl_Int_Input* vertical_input
  361. { Fl_Int_Input* o = snap_input = new Fl_Int_Input(106, 45, 50, 25, "pixel snap");
  362. snap_input->tooltip("Snap to grid within this many pixels.");
  363. snap_input->type(2);
  364. snap_input->box(FL_THIN_DOWN_BOX);
  365. snap_input->callback((Fl_Callback*)grid_cb, (void*)(3));
  366. snap_input->align(Fl_Align(FL_ALIGN_RIGHT));
  367. o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY);
  368. } // Fl_Int_Input* snap_input
  369. { guides_toggle = new Fl_Check_Button(106, 80, 110, 25, "Show Guides");
  370. guides_toggle->tooltip("Show distance and alignment guides in overlay");
  371. guides_toggle->down_box(FL_DOWN_BOX);
  372. guides_toggle->callback((Fl_Callback*)guides_cb, (void*)(4));
  373. } // Fl_Check_Button* guides_toggle
  374. { Fl_Button* o = new Fl_Button(215, 210, 60, 25, "Close");
  375. o->tooltip("Close this dialog.");
  376. o->callback((Fl_Callback*)cb_Close2);
  377. } // Fl_Button* o
  378. { Fl_Box* o = new Fl_Box(26, 10, 70, 25, "Grid:");
  379. o->labelfont(1);
  380. o->align(Fl_Align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE));
  381. } // Fl_Box* o
  382. { Fl_Box* o = new Fl_Box(-1, 115, 97, 25, "Widget Size:");
  383. o->labelfont(1);
  384. o->align(Fl_Align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE));
  385. } // Fl_Box* o
  386. { Fl_Group* o = new Fl_Group(105, 115, 170, 75);
  387. { def_widget_size[0] = new Fl_Round_Button(105, 115, 70, 25);
  388. def_widget_size[0]->type(102);
  389. def_widget_size[0]->down_box(FL_ROUND_DOWN_BOX);
  390. def_widget_size[0]->callback((Fl_Callback*)default_widget_size_cb, (void*)(8));
  391. } // Fl_Round_Button* def_widget_size[0]
  392. { Fl_Box* o = new Fl_Box(120, 115, 50, 25, "tiny");
  393. o->labelsize(8);
  394. o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
  395. } // Fl_Box* o
  396. { def_widget_size[1] = new Fl_Round_Button(180, 115, 70, 25);
  397. def_widget_size[1]->type(102);
  398. def_widget_size[1]->down_box(FL_ROUND_DOWN_BOX);
  399. def_widget_size[1]->callback((Fl_Callback*)default_widget_size_cb, (void*)(11));
  400. } // Fl_Round_Button* def_widget_size[1]
  401. { Fl_Box* o = new Fl_Box(195, 115, 50, 25, "small");
  402. o->labelsize(11);
  403. o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
  404. } // Fl_Box* o
  405. { def_widget_size[2] = new Fl_Round_Button(105, 140, 70, 25);
  406. def_widget_size[2]->type(102);
  407. def_widget_size[2]->down_box(FL_ROUND_DOWN_BOX);
  408. def_widget_size[2]->callback((Fl_Callback*)default_widget_size_cb, (void*)(14));
  409. } // Fl_Round_Button* def_widget_size[2]
  410. { Fl_Box* o = new Fl_Box(120, 140, 50, 25, "normal");
  411. o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
  412. } // Fl_Box* o
  413. { def_widget_size[3] = new Fl_Round_Button(180, 140, 90, 25);
  414. def_widget_size[3]->type(102);
  415. def_widget_size[3]->down_box(FL_ROUND_DOWN_BOX);
  416. def_widget_size[3]->callback((Fl_Callback*)default_widget_size_cb, (void*)(18));
  417. } // Fl_Round_Button* def_widget_size[3]
  418. { Fl_Box* o = new Fl_Box(195, 140, 68, 25, "medium");
  419. o->labelsize(18);
  420. o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
  421. } // Fl_Box* o
  422. { def_widget_size[4] = new Fl_Round_Button(105, 165, 75, 25);
  423. def_widget_size[4]->type(102);
  424. def_widget_size[4]->down_box(FL_ROUND_DOWN_BOX);
  425. def_widget_size[4]->callback((Fl_Callback*)default_widget_size_cb, (void*)(24));
  426. } // Fl_Round_Button* def_widget_size[4]
  427. { Fl_Box* o = new Fl_Box(120, 165, 64, 25, "large");
  428. o->labelsize(24);
  429. o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
  430. } // Fl_Box* o
  431. { def_widget_size[5] = new Fl_Round_Button(180, 165, 95, 25);
  432. def_widget_size[5]->type(102);
  433. def_widget_size[5]->down_box(FL_ROUND_DOWN_BOX);
  434. def_widget_size[5]->callback((Fl_Callback*)default_widget_size_cb, (void*)(32));
  435. } // Fl_Round_Button* def_widget_size[5]
  436. { Fl_Box* o = new Fl_Box(195, 165, 76, 25, "huge");
  437. o->labelsize(32);
  438. o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
  439. } // Fl_Box* o
  440. o->end();
  441. } // Fl_Group* o
  442. grid_window->set_non_modal();
  443. grid_window->end();
  444. } // Fl_Double_Window* grid_window
  445. return grid_window;
  446. }
  447. /**
  448. Copy of all options in user and system mode
  449. */
  450. static int opt[10][2];
  451. /**
  452. Update the UI using the values in the opt array
  453. */
  454. static void refreshUI() {
  455. int mode = wUserOrSystem->value();
  456. wVisibleFocus->value(opt[Fl::OPTION_VISIBLE_FOCUS][mode]);
  457. wArrowFocus->value(opt[Fl::OPTION_ARROW_FOCUS][mode]);
  458. wShowTooltips->value(opt[Fl::OPTION_SHOW_TOOLTIPS][mode]);
  459. wDNDText->value(opt[Fl::OPTION_DND_TEXT][mode]);
  460. }
  461. /**
  462. read all preferences and refresh the GUI
  463. */
  464. static void readPrefs() {
  465. // read all preferences and refresh the GUI
  466. {
  467. Fl_Preferences prefs(Fl_Preferences::SYSTEM, "fltk.org", "fltk");
  468. Fl_Preferences opt_prefs(prefs, "options");
  469. opt_prefs.get("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][1], 2);
  470. opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][1], 2);
  471. opt_prefs.get("DNDText", opt[Fl::OPTION_DND_TEXT][1], 2);
  472. opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1], 2);
  473. }
  474. {
  475. Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
  476. Fl_Preferences opt_prefs(prefs, "options");
  477. opt_prefs.get("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][0], 2);
  478. opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][0], 2);
  479. opt_prefs.get("DNDText", opt[Fl::OPTION_DND_TEXT][0], 2);
  480. opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0], 2);
  481. }
  482. refreshUI();
  483. }
  484. /**
  485. write all preferences using the array
  486. */
  487. static void writePrefs() {
  488. // write all preferences using the array
  489. {
  490. Fl_Preferences prefs(Fl_Preferences::SYSTEM, "fltk.org", "fltk");
  491. Fl_Preferences opt_prefs(prefs, "options");
  492. if (opt[Fl::OPTION_ARROW_FOCUS][1]==2) opt_prefs.deleteEntry("ArrowFocus");
  493. else opt_prefs.set("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][1]);
  494. if (opt[Fl::OPTION_VISIBLE_FOCUS][1]==2) opt_prefs.deleteEntry("VisibleFocus");
  495. else opt_prefs.set("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][1]);
  496. if (opt[Fl::OPTION_DND_TEXT][1]==2) opt_prefs.deleteEntry("DNDText");
  497. else opt_prefs.set("DNDText", opt[Fl::OPTION_DND_TEXT][1]);
  498. if (opt[Fl::OPTION_SHOW_TOOLTIPS][1]==2) opt_prefs.deleteEntry("ShowTooltips");
  499. else opt_prefs.set("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1]);
  500. }
  501. {
  502. Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
  503. Fl_Preferences opt_prefs(prefs, "options");
  504. if (opt[Fl::OPTION_ARROW_FOCUS][0]==2) opt_prefs.deleteEntry("ArrowFocus");
  505. else opt_prefs.set("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][0]);
  506. if (opt[Fl::OPTION_VISIBLE_FOCUS][0]==2) opt_prefs.deleteEntry("VisibleFocus");
  507. else opt_prefs.set("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][0]);
  508. if (opt[Fl::OPTION_DND_TEXT][0]==2) opt_prefs.deleteEntry("DNDText");
  509. else opt_prefs.set("DNDText", opt[Fl::OPTION_DND_TEXT][0]);
  510. if (opt[Fl::OPTION_SHOW_TOOLTIPS][0]==2) opt_prefs.deleteEntry("ShowTooltips");
  511. else opt_prefs.set("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0]);
  512. }
  513. }
  514. void show_global_settings_window() {
  515. if (!global_settings_window)
  516. make_global_settings_window();
  517. readPrefs();
  518. refreshUI();
  519. fl_message(
  520. "WARNING!\n\n"
  521. "The following dialog changes the user interface behavior\n"
  522. "of ALL FLTK applications, for the current user, or for \n"
  523. "ALL users on this machine.\n\n"
  524. "Please choose these settings carefully, or reset\n"
  525. "user and system settings to \"default\".");
  526. global_settings_window->show();
  527. }
  528. Fl_Double_Window *global_settings_window=(Fl_Double_Window *)0;
  529. Fl_Choice *wVisibleFocus=(Fl_Choice *)0;
  530. static void cb_wVisibleFocus(Fl_Choice*, void*) {
  531. int mode = wUserOrSystem->value();
  532. opt[Fl::OPTION_VISIBLE_FOCUS][mode] = wVisibleFocus->value();
  533. }
  534. Fl_Menu_Item menu_wVisibleFocus[] = {
  535. {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL, 0, 14, 0},
  536. {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL, 0, 14, 0},
  537. {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL, 0, 14, 0},
  538. {0,0,0,0,0,0,0,0,0}
  539. };
  540. Fl_Choice *wArrowFocus=(Fl_Choice *)0;
  541. static void cb_wArrowFocus(Fl_Choice*, void*) {
  542. int mode = wUserOrSystem->value();
  543. opt[Fl::OPTION_ARROW_FOCUS][mode] = wArrowFocus->value();
  544. }
  545. Fl_Menu_Item menu_wArrowFocus[] = {
  546. {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL, 0, 14, 0},
  547. {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL, 0, 14, 0},
  548. {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL, 0, 14, 0},
  549. {0,0,0,0,0,0,0,0,0}
  550. };
  551. Fl_Choice *wShowTooltips=(Fl_Choice *)0;
  552. static void cb_wShowTooltips(Fl_Choice*, void*) {
  553. int mode = wUserOrSystem->value();
  554. opt[Fl::OPTION_SHOW_TOOLTIPS][mode] = wShowTooltips->value();
  555. }
  556. Fl_Menu_Item menu_wShowTooltips[] = {
  557. {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL, 0, 14, 0},
  558. {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL, 0, 14, 0},
  559. {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL, 0, 14, 0},
  560. {0,0,0,0,0,0,0,0,0}
  561. };
  562. Fl_Choice *wDNDText=(Fl_Choice *)0;
  563. static void cb_wDNDText(Fl_Choice*, void*) {
  564. int mode = wUserOrSystem->value();
  565. opt[Fl::OPTION_DND_TEXT][mode] = wDNDText->value();
  566. }
  567. Fl_Menu_Item menu_wDNDText[] = {
  568. {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL, 0, 14, 0},
  569. {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL, 0, 14, 0},
  570. {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL, 0, 14, 0},
  571. {0,0,0,0,0,0,0,0,0}
  572. };
  573. Fl_Choice *wUserOrSystem=(Fl_Choice *)0;
  574. static void cb_wUserOrSystem(Fl_Choice*, void*) {
  575. refreshUI();
  576. }
  577. Fl_Menu_Item menu_wUserOrSystem[] = {
  578. {"User Settings", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL, 0, 14, 0},
  579. {"System Settings", 0, 0, (void*)(1), 0, FL_NORMAL_LABEL, 0, 14, 0},
  580. {0,0,0,0,0,0,0,0,0}
  581. };
  582. static void cb_Cancel1(Fl_Button*, void*) {
  583. global_settings_window->hide();
  584. }
  585. static void cb_OK(Fl_Button*, void*) {
  586. writePrefs();
  587. global_settings_window->hide();
  588. }
  589. Fl_Double_Window* make_global_settings_window() {
  590. { global_settings_window = new Fl_Double_Window(403, 317, "FLTK Preferences");
  591. global_settings_window->color(FL_LIGHT1);
  592. { Fl_Group* o = new Fl_Group(10, 10, 380, 100, "Keyboard Focus Options");
  593. o->box(FL_GTK_DOWN_BOX);
  594. o->labelfont(2);
  595. o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
  596. { wVisibleFocus = new Fl_Choice(245, 40, 100, 25, "Visible Keyboard Focus:");
  597. wVisibleFocus->tooltip("OPTION_VISIBLE_FOCUS\n\nIf visible focus is switched on, FLTK will draw a dot\
  598. ted rectangle inside the widget that will receive the next keystroke. If switc\
  599. hed off, no such indicator will be drawn and keyboard navigation is disabled.\
  600. \n\nDefault is on.");
  601. wVisibleFocus->down_box(FL_BORDER_BOX);
  602. wVisibleFocus->callback((Fl_Callback*)cb_wVisibleFocus);
  603. wVisibleFocus->menu(menu_wVisibleFocus);
  604. } // Fl_Choice* wVisibleFocus
  605. { wArrowFocus = new Fl_Choice(245, 75, 100, 25, "Arrow Keys move Focus:");
  606. wArrowFocus->tooltip("OPTION_ARROW_FOCUS\n\nWhen switched on, moving the text cursor beyond the sta\
  607. rt or end of the text in a text widget will change focus to the next widget. W\
  608. hen switched off, the cursor will stop at the end of the text. Pressing Tab or\
  609. Ctrl-Tab will advance the keyboard focus. Switch this on, if you want the old\
  610. behavior of FLTK 1.1.\n\nDefault is off.");
  611. wArrowFocus->down_box(FL_BORDER_BOX);
  612. wArrowFocus->callback((Fl_Callback*)cb_wArrowFocus);
  613. wArrowFocus->menu(menu_wArrowFocus);
  614. } // Fl_Choice* wArrowFocus
  615. o->end();
  616. } // Fl_Group* o
  617. { Fl_Group* o = new Fl_Group(10, 120, 380, 65, "Tooltip Options");
  618. o->box(FL_GTK_DOWN_BOX);
  619. o->labelfont(2);
  620. o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
  621. { wShowTooltips = new Fl_Choice(245, 150, 100, 25, "Show Tooltips:");
  622. wShowTooltips->tooltip("OPTION_SHOW_TOOLTIPS\n\nIf tooltips are enabled, hovering the mouse over a wi\
  623. dget with a tooltip text will open a little tooltip window until the mouse lea\
  624. ves the widget. If disabled, no tooltip is shown.\n\nDefault is on.");
  625. wShowTooltips->down_box(FL_BORDER_BOX);
  626. wShowTooltips->callback((Fl_Callback*)cb_wShowTooltips);
  627. wShowTooltips->menu(menu_wShowTooltips);
  628. } // Fl_Choice* wShowTooltips
  629. o->end();
  630. } // Fl_Group* o
  631. { Fl_Group* o = new Fl_Group(10, 194, 380, 66, "Drag And Drop Options");
  632. o->box(FL_GTK_DOWN_BOX);
  633. o->labelfont(2);
  634. o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
  635. { wDNDText = new Fl_Choice(245, 225, 100, 25, "Allow dragging Text:");
  636. wDNDText->tooltip("OPTION_DND_TEXT\n\nIf text drag-and-drop is enabled, the user can select and \
  637. drag text from any text widget. If disabled, no dragging is possible, however \
  638. dropping text from other applications still works.\n\nDefault is on.");
  639. wDNDText->down_box(FL_BORDER_BOX);
  640. wDNDText->callback((Fl_Callback*)cb_wDNDText);
  641. wDNDText->menu(menu_wDNDText);
  642. } // Fl_Choice* wDNDText
  643. o->end();
  644. } // Fl_Group* o
  645. { wUserOrSystem = new Fl_Choice(14, 275, 141, 25);
  646. wUserOrSystem->tooltip("Change settings for the current user, or default values for all users of this\
  647. computer. Individual users can override system options, if they set their opt\
  648. ions to specific values (not \'default\').");
  649. wUserOrSystem->down_box(FL_BORDER_BOX);
  650. wUserOrSystem->callback((Fl_Callback*)cb_wUserOrSystem);
  651. wUserOrSystem->menu(menu_wUserOrSystem);
  652. } // Fl_Choice* wUserOrSystem
  653. { Fl_Button* o = new Fl_Button(230, 275, 75, 25, "Cancel");
  654. o->callback((Fl_Callback*)cb_Cancel1);
  655. } // Fl_Button* o
  656. { Fl_Button* o = new Fl_Button(315, 275, 75, 25, "OK");
  657. o->callback((Fl_Callback*)cb_OK);
  658. } // Fl_Button* o
  659. global_settings_window->end();
  660. } // Fl_Double_Window* global_settings_window
  661. readPrefs();
  662. Fl::option(Fl::OPTION_SHOW_TOOLTIPS,1); // make sure tooltips are on !
  663. return global_settings_window;
  664. }
  665. //
  666. // End of "$Id: alignment_panel.cxx 8089 2010-12-20 22:19:24Z matt $".
  667. //