2 * FormPreferences Interface Class Implementation
7 #include FORMS_H_LOCATION
10 #pragma implementation
13 #include "FormPreferences.h"
14 #include "form_preferences.h"
15 #include "xform_macros.h"
16 #include "input_validators.h"
22 #include "support/FileInfo.h"
23 #include "support/filetools.h"
24 #include "lyx_gui_misc.h"
26 #include "ButtonController.h"
28 #ifdef SIGC_CXX_NAMESPACES
32 C_RETURNCB(FormPreferences, WMHideCB)
33 C_GENERICCB(FormPreferences, OKCB)
34 C_GENERICCB(FormPreferences, ApplyCB)
35 C_GENERICCB(FormPreferences, CancelCB)
36 C_GENERICCB(FormPreferences, InputCB)
37 C_GENERICCB(FormPreferences, RestoreCB)
40 FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
41 : dialog_(0), bind_(0), misc_(0), screen_fonts_(0), interface_fonts_(0),
42 printer_(0), paths_(0), lv_(lv), d_(d), u_(0), h_(0),
44 bc_(new ButtonController<PreferencesPolicy>(_("Cancel"), _("Close")))
46 // let the dialog be shown
47 // This is a permanent connection so we won't bother
48 // storing a copy because we won't be disconnecting.
49 d->showPreferences.connect(slot(this, &FormPreferences::show));
53 FormPreferences::~FormPreferences()
60 void FormPreferences::build()
62 dialog_ = build_preferences();
64 // manage the restore, save, apply and cancel/close buttons
65 bc_->setOkay(dialog_->button_ok);
66 bc_->setApply(dialog_->button_apply);
67 bc_->setCancel(dialog_->button_cancel);
68 bc_->setUndoAll(dialog_->button_restore);
71 // Workaround dumb xforms sizing bug
72 minw_ = dialog_->form->w;
73 minh_ = dialog_->form->h;
76 screen_fonts_ = build_screen_fonts();
77 interface_fonts_ = build_interface_fonts();
79 printer_ = build_printer();
80 paths_ = build_paths();
82 // setup the input returns
84 fl_set_input_return(bind_->input_bind, FL_RETURN_CHANGED);
86 fl_set_counter_return(misc_->counter_autosave, FL_RETURN_CHANGED);
87 fl_set_counter_return(misc_->counter_line_len, FL_RETURN_CHANGED);
89 fl_set_input_return(screen_fonts_->input_roman, FL_RETURN_CHANGED);
90 fl_set_input_return(screen_fonts_->input_sans, FL_RETURN_CHANGED);
91 fl_set_input_return(screen_fonts_->input_typewriter,
93 fl_set_input_return(screen_fonts_->input_screen_encoding,
95 fl_set_counter_return(screen_fonts_->counter_zoom, FL_RETURN_CHANGED);
96 fl_set_input_return(screen_fonts_->input_tiny, FL_RETURN_CHANGED);
97 fl_set_input_return(screen_fonts_->input_script, FL_RETURN_CHANGED);
98 fl_set_input_return(screen_fonts_->input_footnote, FL_RETURN_CHANGED);
99 fl_set_input_return(screen_fonts_->input_small, FL_RETURN_CHANGED);
100 fl_set_input_return(screen_fonts_->input_normal, FL_RETURN_CHANGED);
101 fl_set_input_return(screen_fonts_->input_large, FL_RETURN_CHANGED);
102 fl_set_input_return(screen_fonts_->input_larger, FL_RETURN_CHANGED);
103 fl_set_input_return(screen_fonts_->input_largest, FL_RETURN_CHANGED);
104 fl_set_input_return(screen_fonts_->input_huge, FL_RETURN_CHANGED);
105 fl_set_input_return(screen_fonts_->input_huger, FL_RETURN_CHANGED);
107 fl_set_input_return(interface_fonts_->input_popup_font,
109 fl_set_input_return(interface_fonts_->input_menu_font,
111 fl_set_input_return(interface_fonts_->input_popup_encoding,
114 fl_set_input_return(printer_->input_command, FL_RETURN_CHANGED);
115 fl_set_input_return(printer_->input_page_range, FL_RETURN_CHANGED);
116 fl_set_input_return(printer_->input_copies, FL_RETURN_CHANGED);
117 fl_set_input_return(printer_->input_reverse, FL_RETURN_CHANGED);
118 fl_set_input_return(printer_->input_to_printer, FL_RETURN_CHANGED);
119 fl_set_input_return(printer_->input_file_extension, FL_RETURN_CHANGED);
120 fl_set_input_return(printer_->input_spool_command, FL_RETURN_CHANGED);
121 fl_set_input_return(printer_->input_paper_type, FL_RETURN_CHANGED);
122 fl_set_input_return(printer_->input_even_pages, FL_RETURN_CHANGED);
123 fl_set_input_return(printer_->input_odd_pages, FL_RETURN_CHANGED);
124 fl_set_input_return(printer_->input_collated, FL_RETURN_CHANGED);
125 fl_set_input_return(printer_->input_landscape, FL_RETURN_CHANGED);
126 fl_set_input_return(printer_->input_to_file, FL_RETURN_CHANGED);
127 fl_set_input_return(printer_->input_extra_options, FL_RETURN_CHANGED);
128 fl_set_input_return(printer_->input_spool_prefix, FL_RETURN_CHANGED);
129 fl_set_input_return(printer_->input_paper_size, FL_RETURN_CHANGED);
130 fl_set_input_return(printer_->input_name, FL_RETURN_CHANGED);
132 fl_set_input_return(paths_->input_default_path, FL_RETURN_CHANGED);
133 fl_set_input_return(paths_->input_template_path, FL_RETURN_CHANGED);
134 fl_set_input_return(paths_->input_temp_dir, FL_RETURN_CHANGED);
135 fl_set_input_return(paths_->input_lastfiles, FL_RETURN_CHANGED);
136 fl_set_input_return(paths_->input_backup_path, FL_RETURN_CHANGED);
137 fl_set_counter_return(paths_->counter_lastfiles, FL_RETURN_CHANGED);
139 // Now add them to the tabfolder
140 fl_addto_tabfolder(dialog_->tabfolder_prefs,
143 fl_addto_tabfolder(dialog_->tabfolder_prefs,
145 screen_fonts_->form);
146 fl_addto_tabfolder(dialog_->tabfolder_prefs,
147 _("Interface Fonts"),
148 interface_fonts_->form);
149 fl_addto_tabfolder(dialog_->tabfolder_prefs,
152 fl_addto_tabfolder(dialog_->tabfolder_prefs,
155 fl_addto_tabfolder(dialog_->tabfolder_prefs,
159 fl_set_form_atclose(dialog_->form,
160 C_FormPreferencesWMHideCB, 0);
162 // deactivate the various browse buttons because they
163 // currently aren't implemented
164 fl_deactivate_object(bind_->button_bind_file_browse);
165 fl_deactivate_object(paths_->button_document_browse);
166 fl_deactivate_object(paths_->button_template_browse);
167 fl_deactivate_object(paths_->button_temp_dir_browse);
168 fl_deactivate_object(paths_->button_lastfiles_browse);
169 fl_deactivate_object(paths_->button_backup_path_browse);
170 fl_set_object_lcol(bind_->button_bind_file_browse, FL_INACTIVE);
171 fl_set_object_lcol(paths_->button_document_browse, FL_INACTIVE);
172 fl_set_object_lcol(paths_->button_template_browse, FL_INACTIVE);
173 fl_set_object_lcol(paths_->button_temp_dir_browse, FL_INACTIVE);
174 fl_set_object_lcol(paths_->button_lastfiles_browse, FL_INACTIVE);
175 fl_set_object_lcol(paths_->button_backup_path_browse, FL_INACTIVE);
179 void FormPreferences::show()
184 update(); // make sure its up-to-date
186 if (dialog_->form->visible) {
187 fl_raise_form(dialog_->form);
189 fl_set_form_minsize(dialog_->form,
192 fl_show_form(dialog_->form,
193 FL_PLACE_MOUSE | FL_FREE_SIZE,
200 void FormPreferences::hide()
204 && dialog_->form->visible) {
206 fl_hide_form(dialog_->form);
211 void FormPreferences::apply()
213 // set the new lyxrc entries
214 // many of these need to trigger other functions when the assignment
215 // is made. For example, screen zoom and font types. These could be
216 // handled either by signals/slots in lyxrc or just directly call the
217 // associated functions here.
218 // There are other problems with this scheme. We really should check
219 // what we copy to make sure that it really is necessary to do things
220 // like update the screen fonts because that flushes the textcache
221 // and other stuff which may cost us a lot on slower/high-load machines.
224 lyxrc.bind_file = fl_get_input(bind_->input_bind);
226 lyxrc.show_banner = fl_get_button(misc_->check_banner);
227 lyxrc.auto_region_delete = fl_get_button(misc_->
228 check_auto_region_delete);
229 lyxrc.exit_confirmation = fl_get_button(misc_->check_exit_confirm);
230 lyxrc.display_shortcuts =
231 fl_get_button(misc_->check_display_shortcuts);
232 lyxrc.autosave = static_cast<unsigned int>
233 (fl_get_counter_value(misc_->counter_autosave));
234 lyxrc.ascii_linelen = static_cast<unsigned int>
235 (fl_get_counter_value(misc_->counter_line_len));
237 lyxrc.popup_font_name =
238 fl_get_input(interface_fonts_->input_popup_font);
239 lyxrc.menu_font_name = fl_get_input(interface_fonts_->input_menu_font);
240 lyxrc.font_norm_menu =
241 fl_get_input(interface_fonts_->input_popup_encoding);
243 if (lyxrc.roman_font_name !=
244 fl_get_input(screen_fonts_->input_roman) ||
245 lyxrc.sans_font_name !=
246 fl_get_input(screen_fonts_->input_sans) ||
247 lyxrc.typewriter_font_name !=
248 fl_get_input(screen_fonts_->input_typewriter) ||
250 fl_get_input(screen_fonts_->input_screen_encoding) ||
251 lyxrc.use_scalable_fonts !=
252 fl_get_button(screen_fonts_->check_scalable) ||
253 lyxrc.zoom != static_cast<unsigned int>
254 (fl_get_counter_value(screen_fonts_->counter_zoom)) ||
255 lyxrc.font_sizes[LyXFont::SIZE_TINY] !=
256 strToDbl(fl_get_input(screen_fonts_->input_tiny)) ||
257 lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] !=
258 strToDbl(fl_get_input(screen_fonts_->input_script)) ||
259 lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] !=
260 strToDbl(fl_get_input(screen_fonts_->input_footnote)) ||
261 lyxrc.font_sizes[LyXFont::SIZE_SMALL] !=
262 strToDbl(fl_get_input(screen_fonts_->input_small)) ||
263 lyxrc.font_sizes[LyXFont::SIZE_NORMAL] !=
264 strToDbl(fl_get_input(screen_fonts_->input_normal)) ||
265 lyxrc.font_sizes[LyXFont::SIZE_LARGE] !=
266 strToDbl(fl_get_input(screen_fonts_->input_large)) ||
267 lyxrc.font_sizes[LyXFont::SIZE_LARGER] !=
268 strToDbl(fl_get_input(screen_fonts_->input_larger)) ||
269 lyxrc.font_sizes[LyXFont::SIZE_LARGEST] !=
270 strToDbl(fl_get_input(screen_fonts_->input_largest)) ||
271 lyxrc.font_sizes[LyXFont::SIZE_HUGE] !=
272 strToDbl(fl_get_input(screen_fonts_->input_huge)) ||
273 lyxrc.font_sizes[LyXFont::SIZE_HUGER] !=
274 strToDbl(fl_get_input(screen_fonts_->input_huger))) {
275 // Something has changed so copy all of them and then force
276 // an update of the screen fonts (ie. redraw every buffer)
277 lyxrc.roman_font_name = fl_get_input(screen_fonts_->input_roman);
278 lyxrc.sans_font_name = fl_get_input(screen_fonts_->input_sans);
279 lyxrc.typewriter_font_name = fl_get_input(screen_fonts_->
281 lyxrc.font_norm = fl_get_input(screen_fonts_->
282 input_screen_encoding);
283 lyxrc.use_scalable_fonts =
284 fl_get_button(screen_fonts_->check_scalable);
285 lyxrc.zoom = static_cast<unsigned int>
286 (fl_get_counter_value(screen_fonts_->counter_zoom));
287 lyxrc.font_sizes[LyXFont::SIZE_TINY] =
288 strToDbl(fl_get_input(screen_fonts_->input_tiny));
289 lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] =
290 strToDbl(fl_get_input(screen_fonts_->input_script));
291 lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] =
292 strToDbl(fl_get_input(screen_fonts_->input_footnote));
293 lyxrc.font_sizes[LyXFont::SIZE_SMALL] =
294 strToDbl(fl_get_input(screen_fonts_->input_small));
295 lyxrc.font_sizes[LyXFont::SIZE_NORMAL] =
296 strToDbl(fl_get_input(screen_fonts_->input_normal));
297 lyxrc.font_sizes[LyXFont::SIZE_LARGE] =
298 strToDbl(fl_get_input(screen_fonts_->input_large));
299 lyxrc.font_sizes[LyXFont::SIZE_LARGER] =
300 strToDbl(fl_get_input(screen_fonts_->input_larger));
301 lyxrc.font_sizes[LyXFont::SIZE_LARGEST] =
302 strToDbl(fl_get_input(screen_fonts_->input_largest));
303 lyxrc.font_sizes[LyXFont::SIZE_HUGE] =
304 strToDbl(fl_get_input(screen_fonts_->input_huge));
305 lyxrc.font_sizes[LyXFont::SIZE_HUGER] =
306 strToDbl(fl_get_input(screen_fonts_->input_huger));
307 // Now update the buffers
308 // Can anything below here affect the redraw process?
309 lv_->getLyXFunc()->Dispatch(LFUN_SCREEN_FONT_UPDATE);
312 lyxrc.print_adapt_output = fl_get_button(printer_->check_adapt_output);
313 lyxrc.print_command = fl_get_input(printer_->input_command);
314 lyxrc.print_pagerange_flag = fl_get_input(printer_->input_page_range);
315 lyxrc.print_copies_flag = fl_get_input(printer_->input_copies);
316 lyxrc.print_reverse_flag = fl_get_input(printer_->input_reverse);
317 lyxrc.print_to_printer = fl_get_input(printer_->input_to_printer);
318 lyxrc.print_file_extension =
319 fl_get_input(printer_->input_file_extension);
320 lyxrc.print_spool_command =
321 fl_get_input(printer_->input_spool_command);
322 lyxrc.print_paper_flag = fl_get_input(printer_->input_paper_type);
323 lyxrc.print_evenpage_flag = fl_get_input(printer_->input_even_pages);
324 lyxrc.print_oddpage_flag = fl_get_input(printer_->input_odd_pages);
325 lyxrc.print_collcopies_flag = fl_get_input(printer_->input_collated);
326 lyxrc.print_landscape_flag = fl_get_input(printer_->input_landscape);
327 lyxrc.print_to_file = fl_get_input(printer_->input_to_file);
328 lyxrc.print_extra_options =
329 fl_get_input(printer_->input_extra_options);
330 lyxrc.print_spool_printerprefix =
331 fl_get_input(printer_->input_spool_prefix);
332 lyxrc.print_paper_dimension_flag =
333 fl_get_input(printer_->input_paper_size);
334 lyxrc.printer = fl_get_input(printer_->input_name);
336 lyxrc.document_path = fl_get_input(paths_->input_default_path);
337 lyxrc.template_path = fl_get_input(paths_->input_template_path);
338 lyxrc.tempdir_path = fl_get_input(paths_->input_temp_dir);
339 lyxrc.lastfiles = fl_get_input(paths_->input_lastfiles);
340 lyxrc.backupdir_path = fl_get_input(paths_->input_backup_path);
341 lyxrc.use_tempdir = fl_get_button(paths_->check_use_temp_dir);
342 lyxrc.check_lastfiles = fl_get_button(paths_->check_last_files);
343 lyxrc.make_backup = fl_get_button(paths_->check_make_backups);
344 lyxrc.num_lastfiles = static_cast<unsigned int>
345 (fl_get_counter_value(paths_->counter_lastfiles));
351 void FormPreferences::update()
354 // read lyxrc entries
356 fl_set_input(bind_->input_bind, lyxrc.bind_file.c_str());
358 fl_set_button(misc_->check_banner,
360 fl_set_button(misc_->check_auto_region_delete,
361 lyxrc.auto_region_delete);
362 fl_set_button(misc_->check_exit_confirm,
363 lyxrc.exit_confirmation);
364 fl_set_button(misc_->check_display_shortcuts,
365 lyxrc.display_shortcuts);
366 fl_set_counter_value(misc_->counter_autosave,
368 fl_set_counter_value(misc_->counter_line_len,
369 lyxrc.ascii_linelen);
371 fl_set_input(screen_fonts_->input_roman,
372 lyxrc.roman_font_name.c_str());
373 fl_set_input(screen_fonts_->input_sans,
374 lyxrc.sans_font_name.c_str());
375 fl_set_input(screen_fonts_->input_typewriter,
376 lyxrc.typewriter_font_name.c_str());
377 fl_set_input(screen_fonts_->input_screen_encoding,
378 lyxrc.font_norm.c_str());
379 fl_set_button(screen_fonts_->check_scalable,
380 lyxrc.use_scalable_fonts);
381 fl_set_counter_value(screen_fonts_->counter_zoom,
383 fl_set_input(screen_fonts_->input_tiny,
384 tostr(lyxrc.font_sizes[LyXFont::SIZE_TINY]).c_str());
385 fl_set_input(screen_fonts_->input_script,
386 tostr(lyxrc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str());
387 fl_set_input(screen_fonts_->input_footnote,
388 tostr(lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str());
389 fl_set_input(screen_fonts_->input_small,
390 tostr(lyxrc.font_sizes[LyXFont::SIZE_SMALL]).c_str());
391 fl_set_input(screen_fonts_->input_normal,
392 tostr(lyxrc.font_sizes[LyXFont::SIZE_NORMAL]).c_str());
393 fl_set_input(screen_fonts_->input_large,
394 tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGE]).c_str());
395 fl_set_input(screen_fonts_->input_larger,
396 tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGER]).c_str());
397 fl_set_input(screen_fonts_->input_largest,
398 tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGEST]).c_str());
399 fl_set_input(screen_fonts_->input_huge,
400 tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGE]).c_str());
401 fl_set_input(screen_fonts_->input_huger,
402 tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGER]).c_str());
404 fl_set_input(interface_fonts_->input_popup_font,
405 lyxrc.popup_font_name.c_str());
406 fl_set_input(interface_fonts_->input_menu_font,
407 lyxrc.menu_font_name.c_str());
408 fl_set_input(interface_fonts_->input_popup_encoding,
409 lyxrc.font_norm_menu.c_str());
411 fl_set_button(printer_->check_adapt_output,
412 lyxrc.print_adapt_output);
413 fl_set_input(printer_->input_command,
414 lyxrc.print_command.c_str());
415 fl_set_input(printer_->input_page_range,
416 lyxrc.print_pagerange_flag.c_str());
417 fl_set_input(printer_->input_copies,
418 lyxrc.print_copies_flag.c_str());
419 fl_set_input(printer_->input_reverse,
420 lyxrc.print_reverse_flag.c_str());
421 fl_set_input(printer_->input_to_printer,
422 lyxrc.print_to_printer.c_str());
423 fl_set_input(printer_->input_file_extension,
424 lyxrc.print_file_extension.c_str());
425 fl_set_input(printer_->input_spool_command,
426 lyxrc.print_spool_command.c_str());
427 fl_set_input(printer_->input_paper_type,
428 lyxrc.print_paper_flag.c_str());
429 fl_set_input(printer_->input_even_pages,
430 lyxrc.print_evenpage_flag.c_str());
431 fl_set_input(printer_->input_odd_pages,
432 lyxrc.print_oddpage_flag.c_str());
433 fl_set_input(printer_->input_collated,
434 lyxrc.print_collcopies_flag.c_str());
435 fl_set_input(printer_->input_landscape,
436 lyxrc.print_landscape_flag.c_str());
437 fl_set_input(printer_->input_to_file,
438 lyxrc.print_to_file.c_str());
439 fl_set_input(printer_->input_extra_options,
440 lyxrc.print_extra_options.c_str());
441 fl_set_input(printer_->input_spool_prefix,
442 lyxrc.print_spool_printerprefix.c_str());
443 fl_set_input(printer_->input_paper_size,
444 lyxrc.print_paper_dimension_flag.c_str());
445 fl_set_input(printer_->input_name,
446 lyxrc.printer.c_str());
448 fl_set_input(paths_->input_default_path,
449 lyxrc.document_path.c_str());
450 fl_set_input(paths_->input_template_path,
451 lyxrc.template_path.c_str());
452 fl_set_input(paths_->input_temp_dir,
453 lyxrc.tempdir_path.c_str());
454 fl_set_input(paths_->input_lastfiles,
455 lyxrc.lastfiles.c_str());
456 fl_set_input(paths_->input_backup_path,
457 lyxrc.backupdir_path.c_str());
458 fl_set_button(paths_->check_use_temp_dir,
460 fl_set_button(paths_->check_last_files,
461 lyxrc.check_lastfiles);
462 fl_set_button(paths_->check_make_backups,
464 fl_set_counter_value(paths_->counter_lastfiles,
465 lyxrc.num_lastfiles);
470 bool FormPreferences::input()
472 bool activate = true;
474 // whatever checks you need to ensure the user hasn't entered
475 // some totally ridiculous value somewhere. Change activate to suit.
478 // paths -- all dirs in the path should exist, be writable & absolute
479 if (!AbsolutePath(fl_get_input(paths_->input_default_path))
480 || 1 != IsDirWriteable(fl_get_input(paths_->input_default_path))
481 || !AbsolutePath(fl_get_input(paths_->input_template_path))
482 || 1 != IsDirWriteable(fl_get_input(paths_->input_template_path))
483 // lastfiles: exists && writeable || non-existent && isn't a dir
484 // NOTE: assumes IsFileWriteable == -1 means non-existent hence
485 // the extra check to see if its a directory
486 || !AbsolutePath(fl_get_input(paths_->input_lastfiles))
487 || 1 != IsDirWriteable(OnlyPath(fl_get_input(paths_->
489 || 0 == IsFileWriteable(OnlyPath(fl_get_input(paths_->
491 || FileInfo(fl_get_input(paths_->input_lastfiles)).isDir()
492 // tmpdir: only check if we are using it
493 || (fl_get_button(paths_->check_use_temp_dir)
494 && (1 != IsDirWriteable(fl_get_input(paths_->input_temp_dir))
495 || !AbsolutePath(fl_get_input(paths_->input_temp_dir))))
496 // backupdir: can safely be left empty
497 || (fl_get_button(paths_->check_make_backups)
498 && (!string(fl_get_input(paths_->input_backup_path)).empty()
499 && (1 != IsDirWriteable(fl_get_input(paths_->
501 || !AbsolutePath(fl_get_input(paths_->
502 input_backup_path)))))) {
504 lyxerr[Debug::GUI] << "Preferences: Path is wrong\n";
507 // fontsizes -- tiny < script < footnote etc.
508 if (0.0 >= strToDbl(fl_get_input(screen_fonts_->input_tiny))
509 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_script))
510 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_footnote))
511 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_small))
512 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_normal))
513 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_large))
514 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_larger))
515 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_largest))
516 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_huge))
517 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_huger))) {
518 // make sure they all have positive entries
519 // Also note that an empty entry is returned as 0.0 by strToDbl
521 lyxerr[Debug::GUI] << "Preferences: Sizes are wrong\n";
522 } else if (strToDbl(fl_get_input(screen_fonts_->input_tiny)) >
523 strToDbl(fl_get_input(screen_fonts_->input_script)) ||
524 strToDbl(fl_get_input(screen_fonts_->input_script)) >
525 strToDbl(fl_get_input(screen_fonts_->input_footnote)) ||
526 strToDbl(fl_get_input(screen_fonts_->input_footnote)) >
527 strToDbl(fl_get_input(screen_fonts_->input_small)) ||
528 strToDbl(fl_get_input(screen_fonts_->input_small)) >
529 strToDbl(fl_get_input(screen_fonts_->input_normal)) ||
530 strToDbl(fl_get_input(screen_fonts_->input_normal)) >
531 strToDbl(fl_get_input(screen_fonts_->input_large)) ||
532 strToDbl(fl_get_input(screen_fonts_->input_large)) >
533 strToDbl(fl_get_input(screen_fonts_->input_larger)) ||
534 strToDbl(fl_get_input(screen_fonts_->input_larger)) >
535 strToDbl(fl_get_input(screen_fonts_->input_largest)) ||
536 strToDbl(fl_get_input(screen_fonts_->input_largest)) >
537 strToDbl(fl_get_input(screen_fonts_->input_huge)) ||
538 strToDbl(fl_get_input(screen_fonts_->input_huge)) >
539 strToDbl(fl_get_input(screen_fonts_->input_huger))) {
541 lyxerr[Debug::GUI] << "Preferences: Sizes are wrong\n";
548 int FormPreferences::WMHideCB(FL_FORM * form, void *)
550 // Ensure that the signals (u and h) are disconnected even if the
551 // window manager is used to close the dialog.
552 FormPreferences * pre = static_cast<FormPreferences*>(form->u_vdata);
558 void FormPreferences::OKCB(FL_OBJECT * ob, long)
560 FormPreferences * pre = static_cast<FormPreferences*>(ob->form->u_vdata);
564 pre->lv_->getLyXFunc()->Dispatch(LFUN_SAVEPREFERENCES);
568 void FormPreferences::ApplyCB(FL_OBJECT * ob, long)
570 FormPreferences * pre = static_cast<FormPreferences*>(ob->form->u_vdata);
575 void FormPreferences::CancelCB(FL_OBJECT * ob, long)
577 FormPreferences * pre = static_cast<FormPreferences*>(ob->form->u_vdata);
582 void FormPreferences::InputCB(FL_OBJECT * ob, long)
584 FormPreferences * pre = static_cast<FormPreferences*>(ob->form->u_vdata);
585 pre->bc_->valid(pre->input());
589 void FormPreferences::RestoreCB(FL_OBJECT * ob, long)
591 FormPreferences * pre = static_cast<FormPreferences*>(ob->form->u_vdata);