alignment_panel.cxx 30 KB

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