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_->setOK(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) {
205 fl_hide_form(dialog_->form);
210 void FormPreferences::apply()
212 // set the new lyxrc entries
213 // many of these need to trigger other functions when the assignment
214 // is made. For example, screen zoom and font types. These could be
215 // handled either by signals/slots in lyxrc or just directly call the
216 // associated functions here.
217 // There are other problems with this scheme. We really should check
218 // what we copy to make sure that it really is necessary to do things
219 // like update the screen fonts because that flushes the textcache
220 // and other stuff which may cost us a lot on slower/high-load machines.
223 lyxrc.bind_file = fl_get_input(bind_->input_bind);
225 lyxrc.show_banner = fl_get_button(misc_->check_banner);
226 lyxrc.auto_region_delete = fl_get_button(misc_->
227 check_auto_region_delete);
228 lyxrc.exit_confirmation = fl_get_button(misc_->check_exit_confirm);
229 lyxrc.display_shortcuts =
230 fl_get_button(misc_->check_display_shortcuts);
231 lyxrc.autosave = static_cast<unsigned int>
232 (fl_get_counter_value(misc_->counter_autosave));
233 lyxrc.ascii_linelen = static_cast<unsigned int>
234 (fl_get_counter_value(misc_->counter_line_len));
236 lyxrc.popup_font_name =
237 fl_get_input(interface_fonts_->input_popup_font);
238 lyxrc.menu_font_name = fl_get_input(interface_fonts_->input_menu_font);
239 lyxrc.font_norm_menu =
240 fl_get_input(interface_fonts_->input_popup_encoding);
242 if (lyxrc.roman_font_name !=
243 fl_get_input(screen_fonts_->input_roman) ||
244 lyxrc.sans_font_name !=
245 fl_get_input(screen_fonts_->input_sans) ||
246 lyxrc.typewriter_font_name !=
247 fl_get_input(screen_fonts_->input_typewriter) ||
249 fl_get_input(screen_fonts_->input_screen_encoding) ||
250 lyxrc.use_scalable_fonts !=
251 fl_get_button(screen_fonts_->check_scalable) ||
252 lyxrc.zoom != static_cast<unsigned int>
253 (fl_get_counter_value(screen_fonts_->counter_zoom)) ||
254 lyxrc.font_sizes[LyXFont::SIZE_TINY] !=
255 strToDbl(fl_get_input(screen_fonts_->input_tiny)) ||
256 lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] !=
257 strToDbl(fl_get_input(screen_fonts_->input_script)) ||
258 lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] !=
259 strToDbl(fl_get_input(screen_fonts_->input_footnote)) ||
260 lyxrc.font_sizes[LyXFont::SIZE_SMALL] !=
261 strToDbl(fl_get_input(screen_fonts_->input_small)) ||
262 lyxrc.font_sizes[LyXFont::SIZE_NORMAL] !=
263 strToDbl(fl_get_input(screen_fonts_->input_normal)) ||
264 lyxrc.font_sizes[LyXFont::SIZE_LARGE] !=
265 strToDbl(fl_get_input(screen_fonts_->input_large)) ||
266 lyxrc.font_sizes[LyXFont::SIZE_LARGER] !=
267 strToDbl(fl_get_input(screen_fonts_->input_larger)) ||
268 lyxrc.font_sizes[LyXFont::SIZE_LARGEST] !=
269 strToDbl(fl_get_input(screen_fonts_->input_largest)) ||
270 lyxrc.font_sizes[LyXFont::SIZE_HUGE] !=
271 strToDbl(fl_get_input(screen_fonts_->input_huge)) ||
272 lyxrc.font_sizes[LyXFont::SIZE_HUGER] !=
273 strToDbl(fl_get_input(screen_fonts_->input_huger))) {
274 // Something has changed so copy all of them and then force
275 // an update of the screen fonts (ie. redraw every buffer)
276 lyxrc.roman_font_name = fl_get_input(screen_fonts_->input_roman);
277 lyxrc.sans_font_name = fl_get_input(screen_fonts_->input_sans);
278 lyxrc.typewriter_font_name = fl_get_input(screen_fonts_->
280 lyxrc.font_norm = fl_get_input(screen_fonts_->
281 input_screen_encoding);
282 lyxrc.use_scalable_fonts =
283 fl_get_button(screen_fonts_->check_scalable);
284 lyxrc.zoom = static_cast<unsigned int>
285 (fl_get_counter_value(screen_fonts_->counter_zoom));
286 lyxrc.font_sizes[LyXFont::SIZE_TINY] =
287 strToDbl(fl_get_input(screen_fonts_->input_tiny));
288 lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] =
289 strToDbl(fl_get_input(screen_fonts_->input_script));
290 lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] =
291 strToDbl(fl_get_input(screen_fonts_->input_footnote));
292 lyxrc.font_sizes[LyXFont::SIZE_SMALL] =
293 strToDbl(fl_get_input(screen_fonts_->input_small));
294 lyxrc.font_sizes[LyXFont::SIZE_NORMAL] =
295 strToDbl(fl_get_input(screen_fonts_->input_normal));
296 lyxrc.font_sizes[LyXFont::SIZE_LARGE] =
297 strToDbl(fl_get_input(screen_fonts_->input_large));
298 lyxrc.font_sizes[LyXFont::SIZE_LARGER] =
299 strToDbl(fl_get_input(screen_fonts_->input_larger));
300 lyxrc.font_sizes[LyXFont::SIZE_LARGEST] =
301 strToDbl(fl_get_input(screen_fonts_->input_largest));
302 lyxrc.font_sizes[LyXFont::SIZE_HUGE] =
303 strToDbl(fl_get_input(screen_fonts_->input_huge));
304 lyxrc.font_sizes[LyXFont::SIZE_HUGER] =
305 strToDbl(fl_get_input(screen_fonts_->input_huger));
306 // Now update the buffers
307 // Can anything below here affect the redraw process?
308 lv_->getLyXFunc()->Dispatch(LFUN_SCREEN_FONT_UPDATE);
311 lyxrc.print_adapt_output = fl_get_button(printer_->check_adapt_output);
312 lyxrc.print_command = fl_get_input(printer_->input_command);
313 lyxrc.print_pagerange_flag = fl_get_input(printer_->input_page_range);
314 lyxrc.print_copies_flag = fl_get_input(printer_->input_copies);
315 lyxrc.print_reverse_flag = fl_get_input(printer_->input_reverse);
316 lyxrc.print_to_printer = fl_get_input(printer_->input_to_printer);
317 lyxrc.print_file_extension =
318 fl_get_input(printer_->input_file_extension);
319 lyxrc.print_spool_command =
320 fl_get_input(printer_->input_spool_command);
321 lyxrc.print_paper_flag = fl_get_input(printer_->input_paper_type);
322 lyxrc.print_evenpage_flag = fl_get_input(printer_->input_even_pages);
323 lyxrc.print_oddpage_flag = fl_get_input(printer_->input_odd_pages);
324 lyxrc.print_collcopies_flag = fl_get_input(printer_->input_collated);
325 lyxrc.print_landscape_flag = fl_get_input(printer_->input_landscape);
326 lyxrc.print_to_file = fl_get_input(printer_->input_to_file);
327 lyxrc.print_extra_options =
328 fl_get_input(printer_->input_extra_options);
329 lyxrc.print_spool_printerprefix =
330 fl_get_input(printer_->input_spool_prefix);
331 lyxrc.print_paper_dimension_flag =
332 fl_get_input(printer_->input_paper_size);
333 lyxrc.printer = fl_get_input(printer_->input_name);
335 lyxrc.document_path = fl_get_input(paths_->input_default_path);
336 lyxrc.template_path = fl_get_input(paths_->input_template_path);
337 lyxrc.tempdir_path = fl_get_input(paths_->input_temp_dir);
338 lyxrc.lastfiles = fl_get_input(paths_->input_lastfiles);
339 lyxrc.backupdir_path = fl_get_input(paths_->input_backup_path);
340 lyxrc.use_tempdir = fl_get_button(paths_->check_use_temp_dir);
341 lyxrc.check_lastfiles = fl_get_button(paths_->check_last_files);
342 lyxrc.make_backup = fl_get_button(paths_->check_make_backups);
343 lyxrc.num_lastfiles = static_cast<unsigned int>
344 (fl_get_counter_value(paths_->counter_lastfiles));
348 void FormPreferences::update()
351 // read lyxrc entries
353 fl_set_input(bind_->input_bind, lyxrc.bind_file.c_str());
355 fl_set_button(misc_->check_banner,
357 fl_set_button(misc_->check_auto_region_delete,
358 lyxrc.auto_region_delete);
359 fl_set_button(misc_->check_exit_confirm,
360 lyxrc.exit_confirmation);
361 fl_set_button(misc_->check_display_shortcuts,
362 lyxrc.display_shortcuts);
363 fl_set_counter_value(misc_->counter_autosave,
365 fl_set_counter_value(misc_->counter_line_len,
366 lyxrc.ascii_linelen);
368 fl_set_input(screen_fonts_->input_roman,
369 lyxrc.roman_font_name.c_str());
370 fl_set_input(screen_fonts_->input_sans,
371 lyxrc.sans_font_name.c_str());
372 fl_set_input(screen_fonts_->input_typewriter,
373 lyxrc.typewriter_font_name.c_str());
374 fl_set_input(screen_fonts_->input_screen_encoding,
375 lyxrc.font_norm.c_str());
376 fl_set_button(screen_fonts_->check_scalable,
377 lyxrc.use_scalable_fonts);
378 fl_set_counter_value(screen_fonts_->counter_zoom,
380 fl_set_input(screen_fonts_->input_tiny,
381 tostr(lyxrc.font_sizes[LyXFont::SIZE_TINY]).c_str());
382 fl_set_input(screen_fonts_->input_script,
383 tostr(lyxrc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str());
384 fl_set_input(screen_fonts_->input_footnote,
385 tostr(lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str());
386 fl_set_input(screen_fonts_->input_small,
387 tostr(lyxrc.font_sizes[LyXFont::SIZE_SMALL]).c_str());
388 fl_set_input(screen_fonts_->input_normal,
389 tostr(lyxrc.font_sizes[LyXFont::SIZE_NORMAL]).c_str());
390 fl_set_input(screen_fonts_->input_large,
391 tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGE]).c_str());
392 fl_set_input(screen_fonts_->input_larger,
393 tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGER]).c_str());
394 fl_set_input(screen_fonts_->input_largest,
395 tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGEST]).c_str());
396 fl_set_input(screen_fonts_->input_huge,
397 tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGE]).c_str());
398 fl_set_input(screen_fonts_->input_huger,
399 tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGER]).c_str());
401 fl_set_input(interface_fonts_->input_popup_font,
402 lyxrc.popup_font_name.c_str());
403 fl_set_input(interface_fonts_->input_menu_font,
404 lyxrc.menu_font_name.c_str());
405 fl_set_input(interface_fonts_->input_popup_encoding,
406 lyxrc.font_norm_menu.c_str());
408 fl_set_button(printer_->check_adapt_output,
409 lyxrc.print_adapt_output);
410 fl_set_input(printer_->input_command,
411 lyxrc.print_command.c_str());
412 fl_set_input(printer_->input_page_range,
413 lyxrc.print_pagerange_flag.c_str());
414 fl_set_input(printer_->input_copies,
415 lyxrc.print_copies_flag.c_str());
416 fl_set_input(printer_->input_reverse,
417 lyxrc.print_reverse_flag.c_str());
418 fl_set_input(printer_->input_to_printer,
419 lyxrc.print_to_printer.c_str());
420 fl_set_input(printer_->input_file_extension,
421 lyxrc.print_file_extension.c_str());
422 fl_set_input(printer_->input_spool_command,
423 lyxrc.print_spool_command.c_str());
424 fl_set_input(printer_->input_paper_type,
425 lyxrc.print_paper_flag.c_str());
426 fl_set_input(printer_->input_even_pages,
427 lyxrc.print_evenpage_flag.c_str());
428 fl_set_input(printer_->input_odd_pages,
429 lyxrc.print_oddpage_flag.c_str());
430 fl_set_input(printer_->input_collated,
431 lyxrc.print_collcopies_flag.c_str());
432 fl_set_input(printer_->input_landscape,
433 lyxrc.print_landscape_flag.c_str());
434 fl_set_input(printer_->input_to_file,
435 lyxrc.print_to_file.c_str());
436 fl_set_input(printer_->input_extra_options,
437 lyxrc.print_extra_options.c_str());
438 fl_set_input(printer_->input_spool_prefix,
439 lyxrc.print_spool_printerprefix.c_str());
440 fl_set_input(printer_->input_paper_size,
441 lyxrc.print_paper_dimension_flag.c_str());
442 fl_set_input(printer_->input_name,
443 lyxrc.printer.c_str());
445 fl_set_input(paths_->input_default_path,
446 lyxrc.document_path.c_str());
447 fl_set_input(paths_->input_template_path,
448 lyxrc.template_path.c_str());
449 fl_set_input(paths_->input_temp_dir,
450 lyxrc.tempdir_path.c_str());
451 fl_set_input(paths_->input_lastfiles,
452 lyxrc.lastfiles.c_str());
453 fl_set_input(paths_->input_backup_path,
454 lyxrc.backupdir_path.c_str());
455 fl_set_button(paths_->check_use_temp_dir,
457 fl_set_button(paths_->check_last_files,
458 lyxrc.check_lastfiles);
459 fl_set_button(paths_->check_make_backups,
461 fl_set_counter_value(paths_->counter_lastfiles,
462 lyxrc.num_lastfiles);
467 bool FormPreferences::input()
469 bool activate = true;
471 // whatever checks you need to ensure the user hasn't entered
472 // some totally ridiculous value somewhere. Change activate to suit.
475 // paths -- all dirs in the path should exist, be writable & absolute
476 if (!AbsolutePath(fl_get_input(paths_->input_default_path))
477 || 1 != IsDirWriteable(fl_get_input(paths_->input_default_path))
478 || !AbsolutePath(fl_get_input(paths_->input_template_path))
479 || 1 != IsDirWriteable(fl_get_input(paths_->input_template_path))
480 // lastfiles: exists && writeable || non-existent && isn't a dir
481 // NOTE: assumes IsFileWriteable == -1 means non-existent hence
482 // the extra check to see if its a directory
483 || !AbsolutePath(fl_get_input(paths_->input_lastfiles))
484 || 1 != IsDirWriteable(OnlyPath(fl_get_input(paths_->
486 || 0 == IsFileWriteable(OnlyPath(fl_get_input(paths_->
488 || FileInfo(fl_get_input(paths_->input_lastfiles)).isDir()
489 // tmpdir: only check if we are using it
490 || (fl_get_button(paths_->check_use_temp_dir)
491 && (1 != IsDirWriteable(fl_get_input(paths_->input_temp_dir))
492 || !AbsolutePath(fl_get_input(paths_->input_temp_dir))))
493 // backupdir: can safely be left empty
494 || (fl_get_button(paths_->check_make_backups)
495 && (!string(fl_get_input(paths_->input_backup_path)).empty()
496 && (1 != IsDirWriteable(fl_get_input(paths_->
498 || !AbsolutePath(fl_get_input(paths_->
499 input_backup_path)))))) {
501 lyxerr[Debug::GUI] << "Preferences: Path is wrong\n";
504 // fontsizes -- tiny < script < footnote etc.
505 if (0.0 >= strToDbl(fl_get_input(screen_fonts_->input_tiny))
506 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_script))
507 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_footnote))
508 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_small))
509 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_normal))
510 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_large))
511 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_larger))
512 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_largest))
513 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_huge))
514 || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_huger))) {
515 // make sure they all have positive entries
516 // Also note that an empty entry is returned as 0.0 by strToDbl
518 lyxerr[Debug::GUI] << "Preferences: Sizes are wrong\n";
519 } else if (strToDbl(fl_get_input(screen_fonts_->input_tiny)) >
520 strToDbl(fl_get_input(screen_fonts_->input_script)) ||
521 strToDbl(fl_get_input(screen_fonts_->input_script)) >
522 strToDbl(fl_get_input(screen_fonts_->input_footnote)) ||
523 strToDbl(fl_get_input(screen_fonts_->input_footnote)) >
524 strToDbl(fl_get_input(screen_fonts_->input_small)) ||
525 strToDbl(fl_get_input(screen_fonts_->input_small)) >
526 strToDbl(fl_get_input(screen_fonts_->input_normal)) ||
527 strToDbl(fl_get_input(screen_fonts_->input_normal)) >
528 strToDbl(fl_get_input(screen_fonts_->input_large)) ||
529 strToDbl(fl_get_input(screen_fonts_->input_large)) >
530 strToDbl(fl_get_input(screen_fonts_->input_larger)) ||
531 strToDbl(fl_get_input(screen_fonts_->input_larger)) >
532 strToDbl(fl_get_input(screen_fonts_->input_largest)) ||
533 strToDbl(fl_get_input(screen_fonts_->input_largest)) >
534 strToDbl(fl_get_input(screen_fonts_->input_huge)) ||
535 strToDbl(fl_get_input(screen_fonts_->input_huge)) >
536 strToDbl(fl_get_input(screen_fonts_->input_huger))) {
538 lyxerr[Debug::GUI] << "Preferences: Sizes are wrong\n";
545 int FormPreferences::WMHideCB(FL_FORM * form, void *)
547 // Ensure that the signals (u and h) are disconnected even if the
548 // window manager is used to close the dialog.
549 FormPreferences * pre = static_cast<FormPreferences*>(form->u_vdata);
556 void FormPreferences::OKCB(FL_OBJECT * ob, long)
558 FormPreferences * pre = static_cast<FormPreferences*>(ob->form->u_vdata);
562 pre->lv_->getLyXFunc()->Dispatch(LFUN_SAVEPREFERENCES);
566 void FormPreferences::ApplyCB(FL_OBJECT * ob, long)
568 FormPreferences * pre = static_cast<FormPreferences*>(ob->form->u_vdata);
574 void FormPreferences::CancelCB(FL_OBJECT * ob, long)
576 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);