|
fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) ![]() |
00001 // 00002 // "$Id: alignment_panel.cxx 8089 2010-12-20 22:19:24Z matt $" 00003 // 00004 // Setting and shell dialogs for the Fast Light Tool Kit (FLTK). 00005 // 00006 // Copyright 1998-2010 by Bill Spitzak and others. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Library General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Library General Public 00019 // License along with this library; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00021 // USA. 00022 // 00023 // Please report all bugs and problems on the following page: 00024 // 00025 // http://www.fltk.org/str.php 00026 // 00027 00028 // generated by Fast Light User Interface Designer (fluid) version 1.0300 00029 00030 #include "alignment_panel.h" 00031 #include <FL/Fl_Preferences.H> 00032 #include <FL/fl_ask.H> 00033 Fl_Text_Buffer *shell_run_buffer; 00034 00035 Fl_Double_Window *project_window=(Fl_Double_Window *)0; 00036 00037 static void cb_Close(Fl_Button*, void*) { 00038 project_window->hide(); 00039 } 00040 00041 Fl_Input *header_file_input=(Fl_Input *)0; 00042 00043 Fl_Input *code_file_input=(Fl_Input *)0; 00044 00045 Fl_Check_Button *include_H_from_C_button=(Fl_Check_Button *)0; 00046 00047 Fl_Check_Button *use_FL_COMMAND_button=(Fl_Check_Button *)0; 00048 00049 Fl_Choice *i18n_type_chooser=(Fl_Choice *)0; 00050 00051 Fl_Menu_Item menu_i18n_type_chooser[] = { 00052 {"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, 00053 {"GNU gettext", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, 00054 {"POSIX catgets", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, 00055 {0,0,0,0,0,0,0,0,0} 00056 }; 00057 00058 Fl_Input *i18n_include_input=(Fl_Input *)0; 00059 00060 Fl_Input *i18n_file_input=(Fl_Input *)0; 00061 00062 Fl_Int_Input *i18n_set_input=(Fl_Int_Input *)0; 00063 00064 Fl_Input *i18n_function_input=(Fl_Input *)0; 00065 00066 Fl_Double_Window* make_project_window() { 00067 { project_window = new Fl_Double_Window(399, 252, "Project Settings"); 00068 { Fl_Button* o = new Fl_Button(328, 216, 60, 25, "Close"); 00069 o->tooltip("Close this dialog."); 00070 o->callback((Fl_Callback*)cb_Close); 00071 } // Fl_Button* o 00072 { Fl_Tabs* o = new Fl_Tabs(10, 10, 378, 195); 00073 o->selection_color((Fl_Color)12); 00074 { Fl_Group* o = new Fl_Group(10, 36, 378, 169, "Output"); 00075 o->hide(); 00076 { Fl_Box* o = new Fl_Box(100, 49, 236, 49, "Use \"name.ext\" to set a file name or just \".ext\" to set extension."); 00077 o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); 00078 } // Fl_Box* o 00079 { header_file_input = new Fl_Input(99, 103, 272, 20, "Header File:"); 00080 header_file_input->tooltip("The name of the generated header file."); 00081 header_file_input->box(FL_THIN_DOWN_BOX); 00082 header_file_input->labelfont(1); 00083 header_file_input->textfont(4); 00084 header_file_input->callback((Fl_Callback*)header_input_cb, (void*)(1)); 00085 header_file_input->when(FL_WHEN_CHANGED); 00086 } // Fl_Input* header_file_input 00087 { code_file_input = new Fl_Input(100, 128, 272, 20, "Code File:"); 00088 code_file_input->tooltip("The name of the generated code file."); 00089 code_file_input->box(FL_THIN_DOWN_BOX); 00090 code_file_input->labelfont(1); 00091 code_file_input->textfont(4); 00092 code_file_input->callback((Fl_Callback*)code_input_cb, (void*)(1)); 00093 code_file_input->when(FL_WHEN_CHANGED); 00094 } // Fl_Input* code_file_input 00095 { include_H_from_C_button = new Fl_Check_Button(100, 153, 272, 20, "Include Header from Code"); 00096 include_H_from_C_button->tooltip("Include the header file from the code file."); 00097 include_H_from_C_button->down_box(FL_DOWN_BOX); 00098 include_H_from_C_button->callback((Fl_Callback*)include_H_from_C_button_cb); 00099 } // Fl_Check_Button* include_H_from_C_button 00100 { use_FL_COMMAND_button = new Fl_Check_Button(100, 176, 272, 20, "Menu shortcuts use FL_COMMAND"); 00101 use_FL_COMMAND_button->tooltip("Replace FL_CTRL with FL_COMMAND when generating menu shortcut code."); 00102 use_FL_COMMAND_button->down_box(FL_DOWN_BOX); 00103 use_FL_COMMAND_button->callback((Fl_Callback*)use_FL_COMMAND_button_cb); 00104 } // Fl_Check_Button* use_FL_COMMAND_button 00105 o->end(); 00106 } // Fl_Group* o 00107 { Fl_Group* o = new Fl_Group(10, 36, 378, 169, "Internationalization"); 00108 { i18n_type_chooser = new Fl_Choice(100, 48, 136, 25, "Use:"); 00109 i18n_type_chooser->tooltip("Type of internationalization to use."); 00110 i18n_type_chooser->box(FL_THIN_UP_BOX); 00111 i18n_type_chooser->down_box(FL_BORDER_BOX); 00112 i18n_type_chooser->labelfont(1); 00113 i18n_type_chooser->callback((Fl_Callback*)i18n_type_cb); 00114 i18n_type_chooser->menu(menu_i18n_type_chooser); 00115 } // Fl_Choice* i18n_type_chooser 00116 { i18n_include_input = new Fl_Input(100, 78, 272, 20, "#include:"); 00117 i18n_include_input->tooltip("The include file for internationalization."); 00118 i18n_include_input->box(FL_THIN_DOWN_BOX); 00119 i18n_include_input->labelfont(1); 00120 i18n_include_input->textfont(4); 00121 i18n_include_input->callback((Fl_Callback*)i18n_text_cb); 00122 } // Fl_Input* i18n_include_input 00123 { i18n_file_input = new Fl_Input(100, 104, 272, 20, "File:"); 00124 i18n_file_input->tooltip("The name of the message catalog."); 00125 i18n_file_input->box(FL_THIN_DOWN_BOX); 00126 i18n_file_input->labelfont(1); 00127 i18n_file_input->textfont(4); 00128 i18n_file_input->callback((Fl_Callback*)i18n_text_cb); 00129 } // Fl_Input* i18n_file_input 00130 { i18n_set_input = new Fl_Int_Input(100, 128, 272, 20, "Set:"); 00131 i18n_set_input->tooltip("The message set number."); 00132 i18n_set_input->type(2); 00133 i18n_set_input->box(FL_THIN_DOWN_BOX); 00134 i18n_set_input->labelfont(1); 00135 i18n_set_input->textfont(4); 00136 i18n_set_input->callback((Fl_Callback*)i18n_int_cb); 00137 } // Fl_Int_Input* i18n_set_input 00138 { i18n_function_input = new Fl_Input(100, 103, 272, 20, "Function:"); 00139 i18n_function_input->tooltip("The function to call to internationalize the labels and tooltips."); 00140 i18n_function_input->box(FL_THIN_DOWN_BOX); 00141 i18n_function_input->labelfont(1); 00142 i18n_function_input->textfont(4); 00143 i18n_function_input->callback((Fl_Callback*)i18n_text_cb); 00144 } // Fl_Input* i18n_function_input 00145 o->end(); 00146 } // Fl_Group* o 00147 o->end(); 00148 } // Fl_Tabs* o 00149 project_window->set_modal(); 00150 project_window->end(); 00151 } // Fl_Double_Window* project_window 00152 return project_window; 00153 } 00154 void scheme_cb(Fl_Choice *, void *); 00155 00156 Fl_Double_Window *settings_window=(Fl_Double_Window *)0; 00157 00158 Fl_Choice *scheme_choice=(Fl_Choice *)0; 00159 00160 Fl_Menu_Item menu_scheme_choice[] = { 00161 {"Default", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, 00162 {"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, 00163 {"Plastic", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, 00164 {"GTK+", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, 00165 {0,0,0,0,0,0,0,0,0} 00166 }; 00167 00168 Fl_Check_Button *tooltips_button=(Fl_Check_Button *)0; 00169 00170 static void cb_tooltips_button(Fl_Check_Button*, void*) { 00171 Fl_Tooltip::enable(tooltips_button->value()); 00172 fluid_prefs.set("show_tooltips", tooltips_button->value()); 00173 } 00174 00175 Fl_Check_Button *completion_button=(Fl_Check_Button *)0; 00176 00177 static void cb_completion_button(Fl_Check_Button*, void*) { 00178 fluid_prefs.set("show_completion_dialogs", completion_button->value()); 00179 } 00180 00181 Fl_Check_Button *openlast_button=(Fl_Check_Button *)0; 00182 00183 static void cb_openlast_button(Fl_Check_Button*, void*) { 00184 fluid_prefs.set("open_previous_file", openlast_button->value()); 00185 } 00186 00187 Fl_Check_Button *prevpos_button=(Fl_Check_Button *)0; 00188 00189 static void cb_prevpos_button(Fl_Check_Button*, void*) { 00190 fluid_prefs.set("prev_window_pos", prevpos_button->value()); 00191 } 00192 00193 Fl_Check_Button *show_comments_button=(Fl_Check_Button *)0; 00194 00195 static void cb_show_comments_button(Fl_Check_Button*, void*) { 00196 show_comments = show_comments_button->value(); 00197 fluid_prefs.set("show_comments", show_comments); 00198 redraw_browser(); 00199 } 00200 00201 Fl_Spinner *recent_spinner=(Fl_Spinner *)0; 00202 00203 static void cb_recent_spinner(Fl_Spinner*, void*) { 00204 fluid_prefs.set("recent_files", recent_spinner->value()); 00205 load_history(); 00206 } 00207 00208 static void cb_Close1(Fl_Button*, void*) { 00209 settings_window->hide(); 00210 } 00211 00212 Fl_Double_Window* make_settings_window() { 00213 { settings_window = new Fl_Double_Window(339, 241, "GUI Settings"); 00214 { scheme_choice = new Fl_Choice(116, 10, 115, 25, "Scheme: "); 00215 scheme_choice->down_box(FL_BORDER_BOX); 00216 scheme_choice->labelfont(1); 00217 scheme_choice->callback((Fl_Callback*)scheme_cb); 00218 scheme_choice->menu(menu_scheme_choice); 00219 int s; 00220 fluid_prefs.get("scheme", s, 0); 00221 scheme_choice->value(s); 00222 scheme_cb(0, 0); 00223 } // Fl_Choice* scheme_choice 00224 { Fl_Group* o = new Fl_Group(116, 43, 220, 126); 00225 o->labelfont(1); 00226 o->align(Fl_Align(FL_ALIGN_CENTER)); 00227 { Fl_Box* o = new Fl_Box(116, 43, 1, 25, "Options: "); 00228 o->labelfont(1); 00229 o->align(Fl_Align(FL_ALIGN_LEFT)); 00230 } // Fl_Box* o 00231 { tooltips_button = new Fl_Check_Button(116, 43, 113, 25, "Show Tooltips"); 00232 tooltips_button->down_box(FL_DOWN_BOX); 00233 tooltips_button->callback((Fl_Callback*)cb_tooltips_button); 00234 int b; 00235 fluid_prefs.get("show_tooltips", b, 1); 00236 tooltips_button->value(b); 00237 Fl_Tooltip::enable(b); 00238 } // Fl_Check_Button* tooltips_button 00239 { completion_button = new Fl_Check_Button(116, 68, 186, 25, "Show Completion Dialogs"); 00240 completion_button->down_box(FL_DOWN_BOX); 00241 completion_button->callback((Fl_Callback*)cb_completion_button); 00242 int b; 00243 fluid_prefs.get("show_completion_dialogs", b, 1); 00244 completion_button->value(b); 00245 } // Fl_Check_Button* completion_button 00246 { openlast_button = new Fl_Check_Button(116, 93, 214, 25, "Open Previous File on Startup"); 00247 openlast_button->down_box(FL_DOWN_BOX); 00248 openlast_button->callback((Fl_Callback*)cb_openlast_button); 00249 int b; 00250 fluid_prefs.get("open_previous_file", b, 0); 00251 openlast_button->value(b); 00252 } // Fl_Check_Button* openlast_button 00253 { prevpos_button = new Fl_Check_Button(116, 118, 209, 25, "Remember Window Positions"); 00254 prevpos_button->down_box(FL_DOWN_BOX); 00255 prevpos_button->callback((Fl_Callback*)cb_prevpos_button); 00256 int b; 00257 fluid_prefs.get("prev_window_pos", b, 1); 00258 prevpos_button->value(b); 00259 } // Fl_Check_Button* prevpos_button 00260 { show_comments_button = new Fl_Check_Button(116, 143, 209, 25, "Show Comments in Browser"); 00261 show_comments_button->down_box(FL_DOWN_BOX); 00262 show_comments_button->callback((Fl_Callback*)cb_show_comments_button); 00263 fluid_prefs.get("show_comments", show_comments, 1); 00264 show_comments_button->value(show_comments); 00265 } // Fl_Check_Button* show_comments_button 00266 o->end(); 00267 } // Fl_Group* o 00268 { recent_spinner = new Fl_Spinner(115, 173, 40, 25, "# Recent Files: "); 00269 recent_spinner->labelfont(1); 00270 recent_spinner->callback((Fl_Callback*)cb_recent_spinner); 00271 recent_spinner->when(FL_WHEN_CHANGED); 00272 int c; 00273 fluid_prefs.get("recent_files", c, 5); 00274 recent_spinner->maximum(10); 00275 recent_spinner->value(c); 00276 } // Fl_Spinner* recent_spinner 00277 { Fl_Button* o = new Fl_Button(266, 205, 64, 25, "Close"); 00278 o->tooltip("Close this dialog."); 00279 o->callback((Fl_Callback*)cb_Close1); 00280 } // Fl_Button* o 00281 settings_window->set_non_modal(); 00282 settings_window->end(); 00283 } // Fl_Double_Window* settings_window 00284 return settings_window; 00285 } 00286 00287 Fl_Double_Window *shell_window=(Fl_Double_Window *)0; 00288 00289 Fl_Input *shell_command_input=(Fl_Input *)0; 00290 00291 static void cb_shell_command_input(Fl_Input*, void*) { 00292 fluid_prefs.set("shell_command", shell_command_input->value()); 00293 } 00294 00295 Fl_Check_Button *shell_writecode_button=(Fl_Check_Button *)0; 00296 00297 static void cb_shell_writecode_button(Fl_Check_Button*, void*) { 00298 fluid_prefs.set("shell_writecode", shell_writecode_button->value()); 00299 } 00300 00301 Fl_Check_Button *shell_writemsgs_button=(Fl_Check_Button *)0; 00302 00303 static void cb_shell_writemsgs_button(Fl_Check_Button*, void*) { 00304 fluid_prefs.set("shell_writemsgs", shell_writemsgs_button->value()); 00305 } 00306 00307 Fl_Check_Button *shell_savefl_button=(Fl_Check_Button *)0; 00308 00309 static void cb_shell_savefl_button(Fl_Check_Button*, void*) { 00310 fluid_prefs.set("shell_savefl", shell_savefl_button->value()); 00311 } 00312 00313 static void cb_Cancel(Fl_Button*, void*) { 00314 shell_window->hide(); 00315 } 00316 00317 Fl_Double_Window *shell_run_window=(Fl_Double_Window *)0; 00318 00319 Fl_Text_Display *shell_run_display=(Fl_Text_Display *)0; 00320 00321 Fl_Return_Button *shell_run_button=(Fl_Return_Button *)0; 00322 00323 static void cb_shell_run_button(Fl_Return_Button*, void*) { 00324 shell_run_window->hide(); 00325 } 00326 00327 Fl_Double_Window* make_shell_window() { 00328 { shell_window = new Fl_Double_Window(365, 125, "Shell Command"); 00329 { shell_command_input = new Fl_Input(10, 27, 347, 25, "Command:"); 00330 shell_command_input->labelfont(1); 00331 shell_command_input->callback((Fl_Callback*)cb_shell_command_input); 00332 shell_command_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); 00333 char buf[1024]; 00334 fluid_prefs.get("shell_command", buf, "", sizeof(buf)); 00335 shell_command_input->value(buf); 00336 } // Fl_Input* shell_command_input 00337 { shell_writecode_button = new Fl_Check_Button(128, 61, 93, 19, "Write Code"); 00338 shell_writecode_button->down_box(FL_DOWN_BOX); 00339 shell_writecode_button->callback((Fl_Callback*)cb_shell_writecode_button); 00340 int b; 00341 fluid_prefs.get("shell_writecode", b, 1); 00342 shell_writecode_button->value(b); 00343 } // Fl_Check_Button* shell_writecode_button 00344 { shell_writemsgs_button = new Fl_Check_Button(231, 61, 126, 19, "Write Messages"); 00345 shell_writemsgs_button->down_box(FL_DOWN_BOX); 00346 shell_writemsgs_button->callback((Fl_Callback*)cb_shell_writemsgs_button); 00347 int b; 00348 fluid_prefs.get("shell_writemsgs", b, 0); 00349 shell_writemsgs_button->value(b); 00350 } // Fl_Check_Button* shell_writemsgs_button 00351 { shell_savefl_button = new Fl_Check_Button(10, 62, 108, 19, "Save .FL File"); 00352 shell_savefl_button->down_box(FL_DOWN_BOX); 00353 shell_savefl_button->callback((Fl_Callback*)cb_shell_savefl_button); 00354 int b; 00355 fluid_prefs.get("shell_savefl", b, 1); 00356 shell_savefl_button->value(b); 00357 } // Fl_Check_Button* shell_savefl_button 00358 { Fl_Return_Button* o = new Fl_Return_Button(132, 90, 143, 25, "Run Command"); 00359 o->callback((Fl_Callback*)do_shell_command); 00360 } // Fl_Return_Button* o 00361 { Fl_Button* o = new Fl_Button(285, 90, 72, 25, "Cancel"); 00362 o->callback((Fl_Callback*)cb_Cancel); 00363 } // Fl_Button* o 00364 shell_window->end(); 00365 } // Fl_Double_Window* shell_window 00366 { shell_run_window = new Fl_Double_Window(555, 430, "Shell Command Output"); 00367 { shell_run_display = new Fl_Text_Display(10, 10, 535, 375); 00368 shell_run_display->box(FL_DOWN_BOX); 00369 shell_run_display->textfont(4); 00370 Fl_Group::current()->resizable(shell_run_display); 00371 shell_run_buffer = new Fl_Text_Buffer(); 00372 shell_run_display->buffer(shell_run_buffer); 00373 } // Fl_Text_Display* shell_run_display 00374 { shell_run_button = new Fl_Return_Button(468, 395, 77, 25, "Close"); 00375 shell_run_button->callback((Fl_Callback*)cb_shell_run_button); 00376 } // Fl_Return_Button* shell_run_button 00377 shell_run_window->end(); 00378 } // Fl_Double_Window* shell_run_window 00379 return shell_run_window; 00380 } 00381 00382 Fl_Double_Window *grid_window=(Fl_Double_Window *)0; 00383 00384 Fl_Int_Input *horizontal_input=(Fl_Int_Input *)0; 00385 00386 Fl_Int_Input *vertical_input=(Fl_Int_Input *)0; 00387 00388 Fl_Int_Input *snap_input=(Fl_Int_Input *)0; 00389 00390 Fl_Check_Button *guides_toggle=(Fl_Check_Button *)0; 00391 00392 static void cb_Close2(Fl_Button*, void*) { 00393 grid_window->hide(); 00394 } 00395 00396 Fl_Round_Button *def_widget_size[6]={(Fl_Round_Button *)0}; 00397 00398 Fl_Double_Window* make_layout_window() { 00399 { grid_window = new Fl_Double_Window(285, 245, "Layout Settings"); 00400 { Fl_Int_Input* o = horizontal_input = new Fl_Int_Input(106, 10, 50, 25, "x"); 00401 horizontal_input->tooltip("Horizontal grid spacing."); 00402 horizontal_input->type(2); 00403 horizontal_input->box(FL_THIN_DOWN_BOX); 00404 horizontal_input->callback((Fl_Callback*)grid_cb, (void*)(1)); 00405 horizontal_input->align(Fl_Align(FL_ALIGN_RIGHT)); 00406 o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY); 00407 } // Fl_Int_Input* horizontal_input 00408 { Fl_Int_Input* o = vertical_input = new Fl_Int_Input(166, 10, 50, 25, "pixels"); 00409 vertical_input->tooltip("Vertical grid spacing."); 00410 vertical_input->type(2); 00411 vertical_input->box(FL_THIN_DOWN_BOX); 00412 vertical_input->callback((Fl_Callback*)grid_cb, (void*)(2)); 00413 vertical_input->align(Fl_Align(FL_ALIGN_RIGHT)); 00414 o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY); 00415 } // Fl_Int_Input* vertical_input 00416 { Fl_Int_Input* o = snap_input = new Fl_Int_Input(106, 45, 50, 25, "pixel snap"); 00417 snap_input->tooltip("Snap to grid within this many pixels."); 00418 snap_input->type(2); 00419 snap_input->box(FL_THIN_DOWN_BOX); 00420 snap_input->callback((Fl_Callback*)grid_cb, (void*)(3)); 00421 snap_input->align(Fl_Align(FL_ALIGN_RIGHT)); 00422 o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY); 00423 } // Fl_Int_Input* snap_input 00424 { guides_toggle = new Fl_Check_Button(106, 80, 110, 25, "Show Guides"); 00425 guides_toggle->tooltip("Show distance and alignment guides in overlay"); 00426 guides_toggle->down_box(FL_DOWN_BOX); 00427 guides_toggle->callback((Fl_Callback*)guides_cb, (void*)(4)); 00428 } // Fl_Check_Button* guides_toggle 00429 { Fl_Button* o = new Fl_Button(215, 210, 60, 25, "Close"); 00430 o->tooltip("Close this dialog."); 00431 o->callback((Fl_Callback*)cb_Close2); 00432 } // Fl_Button* o 00433 { Fl_Box* o = new Fl_Box(26, 10, 70, 25, "Grid:"); 00434 o->labelfont(1); 00435 o->align(Fl_Align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE)); 00436 } // Fl_Box* o 00437 { Fl_Box* o = new Fl_Box(-1, 115, 97, 25, "Widget Size:"); 00438 o->labelfont(1); 00439 o->align(Fl_Align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE)); 00440 } // Fl_Box* o 00441 { Fl_Group* o = new Fl_Group(105, 115, 170, 75); 00442 { def_widget_size[0] = new Fl_Round_Button(105, 115, 70, 25); 00443 def_widget_size[0]->type(102); 00444 def_widget_size[0]->down_box(FL_ROUND_DOWN_BOX); 00445 def_widget_size[0]->callback((Fl_Callback*)default_widget_size_cb, (void*)(8)); 00446 } // Fl_Round_Button* def_widget_size[0] 00447 { Fl_Box* o = new Fl_Box(120, 115, 50, 25, "tiny"); 00448 o->labelsize(8); 00449 o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); 00450 } // Fl_Box* o 00451 { def_widget_size[1] = new Fl_Round_Button(180, 115, 70, 25); 00452 def_widget_size[1]->type(102); 00453 def_widget_size[1]->down_box(FL_ROUND_DOWN_BOX); 00454 def_widget_size[1]->callback((Fl_Callback*)default_widget_size_cb, (void*)(11)); 00455 } // Fl_Round_Button* def_widget_size[1] 00456 { Fl_Box* o = new Fl_Box(195, 115, 50, 25, "small"); 00457 o->labelsize(11); 00458 o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); 00459 } // Fl_Box* o 00460 { def_widget_size[2] = new Fl_Round_Button(105, 140, 70, 25); 00461 def_widget_size[2]->type(102); 00462 def_widget_size[2]->down_box(FL_ROUND_DOWN_BOX); 00463 def_widget_size[2]->callback((Fl_Callback*)default_widget_size_cb, (void*)(14)); 00464 } // Fl_Round_Button* def_widget_size[2] 00465 { Fl_Box* o = new Fl_Box(120, 140, 50, 25, "normal"); 00466 o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); 00467 } // Fl_Box* o 00468 { def_widget_size[3] = new Fl_Round_Button(180, 140, 90, 25); 00469 def_widget_size[3]->type(102); 00470 def_widget_size[3]->down_box(FL_ROUND_DOWN_BOX); 00471 def_widget_size[3]->callback((Fl_Callback*)default_widget_size_cb, (void*)(18)); 00472 } // Fl_Round_Button* def_widget_size[3] 00473 { Fl_Box* o = new Fl_Box(195, 140, 68, 25, "medium"); 00474 o->labelsize(18); 00475 o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); 00476 } // Fl_Box* o 00477 { def_widget_size[4] = new Fl_Round_Button(105, 165, 75, 25); 00478 def_widget_size[4]->type(102); 00479 def_widget_size[4]->down_box(FL_ROUND_DOWN_BOX); 00480 def_widget_size[4]->callback((Fl_Callback*)default_widget_size_cb, (void*)(24)); 00481 } // Fl_Round_Button* def_widget_size[4] 00482 { Fl_Box* o = new Fl_Box(120, 165, 64, 25, "large"); 00483 o->labelsize(24); 00484 o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); 00485 } // Fl_Box* o 00486 { def_widget_size[5] = new Fl_Round_Button(180, 165, 95, 25); 00487 def_widget_size[5]->type(102); 00488 def_widget_size[5]->down_box(FL_ROUND_DOWN_BOX); 00489 def_widget_size[5]->callback((Fl_Callback*)default_widget_size_cb, (void*)(32)); 00490 } // Fl_Round_Button* def_widget_size[5] 00491 { Fl_Box* o = new Fl_Box(195, 165, 76, 25, "huge"); 00492 o->labelsize(32); 00493 o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); 00494 } // Fl_Box* o 00495 o->end(); 00496 } // Fl_Group* o 00497 grid_window->set_non_modal(); 00498 grid_window->end(); 00499 } // Fl_Double_Window* grid_window 00500 return grid_window; 00501 } 00505 static int opt[10][2]; 00506 00510 static void refreshUI() { 00511 int mode = wUserOrSystem->value(); 00512 wVisibleFocus->value(opt[Fl::OPTION_VISIBLE_FOCUS][mode]); 00513 wArrowFocus->value(opt[Fl::OPTION_ARROW_FOCUS][mode]); 00514 wShowTooltips->value(opt[Fl::OPTION_SHOW_TOOLTIPS][mode]); 00515 wDNDText->value(opt[Fl::OPTION_DND_TEXT][mode]); 00516 } 00517 00521 static void readPrefs() { 00522 // read all preferences and refresh the GUI 00523 { 00524 Fl_Preferences prefs(Fl_Preferences::SYSTEM, "fltk.org", "fltk"); 00525 Fl_Preferences opt_prefs(prefs, "options"); 00526 opt_prefs.get("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][1], 2); 00527 opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][1], 2); 00528 opt_prefs.get("DNDText", opt[Fl::OPTION_DND_TEXT][1], 2); 00529 opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1], 2); 00530 } 00531 { 00532 Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk"); 00533 Fl_Preferences opt_prefs(prefs, "options"); 00534 opt_prefs.get("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][0], 2); 00535 opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][0], 2); 00536 opt_prefs.get("DNDText", opt[Fl::OPTION_DND_TEXT][0], 2); 00537 opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0], 2); 00538 } 00539 refreshUI(); 00540 } 00541 00545 static void writePrefs() { 00546 // write all preferences using the array 00547 { 00548 Fl_Preferences prefs(Fl_Preferences::SYSTEM, "fltk.org", "fltk"); 00549 Fl_Preferences opt_prefs(prefs, "options"); 00550 if (opt[Fl::OPTION_ARROW_FOCUS][1]==2) opt_prefs.deleteEntry("ArrowFocus"); 00551 else opt_prefs.set("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][1]); 00552 if (opt[Fl::OPTION_VISIBLE_FOCUS][1]==2) opt_prefs.deleteEntry("VisibleFocus"); 00553 else opt_prefs.set("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][1]); 00554 if (opt[Fl::OPTION_DND_TEXT][1]==2) opt_prefs.deleteEntry("DNDText"); 00555 else opt_prefs.set("DNDText", opt[Fl::OPTION_DND_TEXT][1]); 00556 if (opt[Fl::OPTION_SHOW_TOOLTIPS][1]==2) opt_prefs.deleteEntry("ShowTooltips"); 00557 else opt_prefs.set("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1]); 00558 } 00559 { 00560 Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk"); 00561 Fl_Preferences opt_prefs(prefs, "options"); 00562 if (opt[Fl::OPTION_ARROW_FOCUS][0]==2) opt_prefs.deleteEntry("ArrowFocus"); 00563 else opt_prefs.set("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][0]); 00564 if (opt[Fl::OPTION_VISIBLE_FOCUS][0]==2) opt_prefs.deleteEntry("VisibleFocus"); 00565 else opt_prefs.set("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][0]); 00566 if (opt[Fl::OPTION_DND_TEXT][0]==2) opt_prefs.deleteEntry("DNDText"); 00567 else opt_prefs.set("DNDText", opt[Fl::OPTION_DND_TEXT][0]); 00568 if (opt[Fl::OPTION_SHOW_TOOLTIPS][0]==2) opt_prefs.deleteEntry("ShowTooltips"); 00569 else opt_prefs.set("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0]); 00570 } 00571 } 00572 00573 void show_global_settings_window() { 00574 if (!global_settings_window) 00575 make_global_settings_window(); 00576 readPrefs(); 00577 refreshUI(); 00578 fl_message( 00579 "WARNING!\n\n" 00580 "The following dialog changes the user interface behavior\n" 00581 "of ALL FLTK applications, for the current user, or for \n" 00582 "ALL users on this machine.\n\n" 00583 "Please choose these settings carefully, or reset\n" 00584 "user and system settings to \"default\"."); 00585 global_settings_window->show(); 00586 } 00587 00588 Fl_Double_Window *global_settings_window=(Fl_Double_Window *)0; 00589 00590 Fl_Choice *wVisibleFocus=(Fl_Choice *)0; 00591 00592 static void cb_wVisibleFocus(Fl_Choice*, void*) { 00593 int mode = wUserOrSystem->value(); 00594 opt[Fl::OPTION_VISIBLE_FOCUS][mode] = wVisibleFocus->value(); 00595 } 00596 00597 Fl_Menu_Item menu_wVisibleFocus[] = { 00598 {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL, 0, 14, 0}, 00599 {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL, 0, 14, 0}, 00600 {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL, 0, 14, 0}, 00601 {0,0,0,0,0,0,0,0,0} 00602 }; 00603 00604 Fl_Choice *wArrowFocus=(Fl_Choice *)0; 00605 00606 static void cb_wArrowFocus(Fl_Choice*, void*) { 00607 int mode = wUserOrSystem->value(); 00608 opt[Fl::OPTION_ARROW_FOCUS][mode] = wArrowFocus->value(); 00609 } 00610 00611 Fl_Menu_Item menu_wArrowFocus[] = { 00612 {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL, 0, 14, 0}, 00613 {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL, 0, 14, 0}, 00614 {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL, 0, 14, 0}, 00615 {0,0,0,0,0,0,0,0,0} 00616 }; 00617 00618 Fl_Choice *wShowTooltips=(Fl_Choice *)0; 00619 00620 static void cb_wShowTooltips(Fl_Choice*, void*) { 00621 int mode = wUserOrSystem->value(); 00622 opt[Fl::OPTION_SHOW_TOOLTIPS][mode] = wShowTooltips->value(); 00623 } 00624 00625 Fl_Menu_Item menu_wShowTooltips[] = { 00626 {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL, 0, 14, 0}, 00627 {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL, 0, 14, 0}, 00628 {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL, 0, 14, 0}, 00629 {0,0,0,0,0,0,0,0,0} 00630 }; 00631 00632 Fl_Choice *wDNDText=(Fl_Choice *)0; 00633 00634 static void cb_wDNDText(Fl_Choice*, void*) { 00635 int mode = wUserOrSystem->value(); 00636 opt[Fl::OPTION_DND_TEXT][mode] = wDNDText->value(); 00637 } 00638 00639 Fl_Menu_Item menu_wDNDText[] = { 00640 {"off", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL, 0, 14, 0}, 00641 {"on", 0, 0, (void*)(1), 128, FL_NORMAL_LABEL, 0, 14, 0}, 00642 {"default", 0, 0, (void*)(2), 0, FL_NORMAL_LABEL, 0, 14, 0}, 00643 {0,0,0,0,0,0,0,0,0} 00644 }; 00645 00646 Fl_Choice *wUserOrSystem=(Fl_Choice *)0; 00647 00648 static void cb_wUserOrSystem(Fl_Choice*, void*) { 00649 refreshUI(); 00650 } 00651 00652 Fl_Menu_Item menu_wUserOrSystem[] = { 00653 {"User Settings", 0, 0, (void*)(0), 0, FL_NORMAL_LABEL, 0, 14, 0}, 00654 {"System Settings", 0, 0, (void*)(1), 0, FL_NORMAL_LABEL, 0, 14, 0}, 00655 {0,0,0,0,0,0,0,0,0} 00656 }; 00657 00658 static void cb_Cancel1(Fl_Button*, void*) { 00659 global_settings_window->hide(); 00660 } 00661 00662 static void cb_OK(Fl_Button*, void*) { 00663 writePrefs(); 00664 global_settings_window->hide(); 00665 } 00666 00667 Fl_Double_Window* make_global_settings_window() { 00668 { global_settings_window = new Fl_Double_Window(403, 317, "FLTK Preferences"); 00669 global_settings_window->color(FL_LIGHT1); 00670 { Fl_Group* o = new Fl_Group(10, 10, 380, 100, "Keyboard Focus Options"); 00671 o->box(FL_GTK_DOWN_BOX); 00672 o->labelfont(2); 00673 o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE)); 00674 { wVisibleFocus = new Fl_Choice(245, 40, 100, 25, "Visible Keyboard Focus:"); 00675 wVisibleFocus->tooltip("OPTION_VISIBLE_FOCUS\n\nIf visible focus is switched on, FLTK will draw a dot\ 00676 ted rectangle inside the widget that will receive the next keystroke. If switc\ 00677 hed off, no such indicator will be drawn and keyboard navigation is disabled.\ 00678 \n\nDefault is on."); 00679 wVisibleFocus->down_box(FL_BORDER_BOX); 00680 wVisibleFocus->callback((Fl_Callback*)cb_wVisibleFocus); 00681 wVisibleFocus->menu(menu_wVisibleFocus); 00682 } // Fl_Choice* wVisibleFocus 00683 { wArrowFocus = new Fl_Choice(245, 75, 100, 25, "Arrow Keys move Focus:"); 00684 wArrowFocus->tooltip("OPTION_ARROW_FOCUS\n\nWhen switched on, moving the text cursor beyond the sta\ 00685 rt or end of the text in a text widget will change focus to the next widget. W\ 00686 hen switched off, the cursor will stop at the end of the text. Pressing Tab or\ 00687 Ctrl-Tab will advance the keyboard focus. Switch this on, if you want the old\ 00688 behavior of FLTK 1.1.\n\nDefault is off."); 00689 wArrowFocus->down_box(FL_BORDER_BOX); 00690 wArrowFocus->callback((Fl_Callback*)cb_wArrowFocus); 00691 wArrowFocus->menu(menu_wArrowFocus); 00692 } // Fl_Choice* wArrowFocus 00693 o->end(); 00694 } // Fl_Group* o 00695 { Fl_Group* o = new Fl_Group(10, 120, 380, 65, "Tooltip Options"); 00696 o->box(FL_GTK_DOWN_BOX); 00697 o->labelfont(2); 00698 o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE)); 00699 { wShowTooltips = new Fl_Choice(245, 150, 100, 25, "Show Tooltips:"); 00700 wShowTooltips->tooltip("OPTION_SHOW_TOOLTIPS\n\nIf tooltips are enabled, hovering the mouse over a wi\ 00701 dget with a tooltip text will open a little tooltip window until the mouse lea\ 00702 ves the widget. If disabled, no tooltip is shown.\n\nDefault is on."); 00703 wShowTooltips->down_box(FL_BORDER_BOX); 00704 wShowTooltips->callback((Fl_Callback*)cb_wShowTooltips); 00705 wShowTooltips->menu(menu_wShowTooltips); 00706 } // Fl_Choice* wShowTooltips 00707 o->end(); 00708 } // Fl_Group* o 00709 { Fl_Group* o = new Fl_Group(10, 194, 380, 66, "Drag And Drop Options"); 00710 o->box(FL_GTK_DOWN_BOX); 00711 o->labelfont(2); 00712 o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE)); 00713 { wDNDText = new Fl_Choice(245, 225, 100, 25, "Allow dragging Text:"); 00714 wDNDText->tooltip("OPTION_DND_TEXT\n\nIf text drag-and-drop is enabled, the user can select and \ 00715 drag text from any text widget. If disabled, no dragging is possible, however \ 00716 dropping text from other applications still works.\n\nDefault is on."); 00717 wDNDText->down_box(FL_BORDER_BOX); 00718 wDNDText->callback((Fl_Callback*)cb_wDNDText); 00719 wDNDText->menu(menu_wDNDText); 00720 } // Fl_Choice* wDNDText 00721 o->end(); 00722 } // Fl_Group* o 00723 { wUserOrSystem = new Fl_Choice(14, 275, 141, 25); 00724 wUserOrSystem->tooltip("Change settings for the current user, or default values for all users of this\ 00725 computer. Individual users can override system options, if they set their opt\ 00726 ions to specific values (not \'default\')."); 00727 wUserOrSystem->down_box(FL_BORDER_BOX); 00728 wUserOrSystem->callback((Fl_Callback*)cb_wUserOrSystem); 00729 wUserOrSystem->menu(menu_wUserOrSystem); 00730 } // Fl_Choice* wUserOrSystem 00731 { Fl_Button* o = new Fl_Button(230, 275, 75, 25, "Cancel"); 00732 o->callback((Fl_Callback*)cb_Cancel1); 00733 } // Fl_Button* o 00734 { Fl_Button* o = new Fl_Button(315, 275, 75, 25, "OK"); 00735 o->callback((Fl_Callback*)cb_OK); 00736 } // Fl_Button* o 00737 global_settings_window->end(); 00738 } // Fl_Double_Window* global_settings_window 00739 readPrefs(); 00740 Fl::option(Fl::OPTION_SHOW_TOOLTIPS,1); // make sure tooltips are on ! 00741 return global_settings_window; 00742 } 00743 00744 // 00745 // End of "$Id: alignment_panel.cxx 8089 2010-12-20 22:19:24Z matt $". 00746 //