2 * \file FormPreferences.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS
13 #include "ControlPrefs.h"
14 #include "FormPreferences.h"
15 #include "forms/form_preferences.h"
17 #include "ButtonController.h"
19 #include "FormColorpicker.h"
21 #include "input_validators.h"
22 #include "forms_gettext.h"
23 #include "xforms_helpers.h"
24 #include "helper_funcs.h" // getSecond
27 #include "converter.h"
31 #include "frnt_lang.h"
36 #include "funcrequest.h"
39 #include "support/lstrings.h"
40 #include "support/lyxfunctional.h"
41 #include "support/lyxmanip.h"
42 #include "support/tostr.h"
43 #include "support/path_defines.h"
44 #include "support/filetools.h"
45 #include "support/LAssert.h"
47 #include "graphics/GraphicsCache.h"
48 #include "graphics/GraphicsTypes.h"
50 #include <boost/bind.hpp>
52 #include "lyx_forms.h"
68 using namespace lyx::support;
72 // These should probably go inside the class definition...
73 Formats local_formats;
74 Converters local_converters;
76 string makeFontName(string const & family, string const & foundry)
80 return family + ',' + foundry;
84 pair<string,string> parseFontName(string const & name)
86 string::size_type const idx = name.find(',');
87 if (idx == string::npos)
88 return make_pair(name, string());
89 return make_pair(name.substr(0, idx),
95 #if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
96 bool const scalableTabfolders = false;
98 bool const scalableTabfolders = true;
104 typedef FormCB<ControlPrefs, FormDB<FD_preferences> > base_class;
107 FormPreferences::FormPreferences()
108 : base_class(_("Preferences"), scalableTabfolders),
109 colors_(*this), converters_(*this), inputs_misc_(*this),
110 formats_(*this), interface_(*this), language_(*this),
111 lnf_misc_(*this), identity_(*this), outputs_misc_(*this),
112 paths_(*this), printer_(*this), screen_fonts_(*this),
118 void FormPreferences::redraw()
120 if (!(form() && form()->visible))
122 fl_redraw_form(form());
124 FL_FORM * form2 = fl_get_active_folder(dialog_->tabfolder_prefs);
125 if (!(form2 && form2->visible))
127 fl_redraw_form(form2);
130 if (form2 == converters_tab_->form)
131 form3 = fl_get_active_folder(converters_tab_->tabfolder_inner);
133 else if (form2 == look_n_feel_tab_->form)
134 form3 = fl_get_active_folder(look_n_feel_tab_->tabfolder_inner);
136 else if (form2 == inputs_tab_->form)
137 form3 = fl_get_active_folder(inputs_tab_->tabfolder_inner);
139 else if (form2 == outputs_tab_->form)
140 form3 = fl_get_active_folder(outputs_tab_->tabfolder_inner);
142 else if (form2 == lang_opts_tab_->form)
143 form3 = fl_get_active_folder(lang_opts_tab_->tabfolder_inner);
145 if (form3 && form3->visible)
146 fl_redraw_form(form3);
150 void FormPreferences::hide()
152 // We need to hide the active tabfolder otherwise we get a
153 // BadDrawable error from X window and LyX crashes without saving.
154 FL_FORM * inner_form = fl_get_active_folder(dialog_->tabfolder_prefs);
155 if (inner_form && inner_form->visible)
156 fl_hide_form(inner_form);
161 void FormPreferences::build()
163 dialog_.reset(build_preferences(this));
165 // Manage the restore, save, apply and cancel/close buttons
166 bcview().setOK(dialog_->button_ok);
167 bcview().setApply(dialog_->button_apply);
168 bcview().setCancel(dialog_->button_close);
169 bcview().setRestore(dialog_->button_restore);
171 // Allow the base class to control messages
172 setMessageWidget(dialog_->text_warning);
174 // build the tab folders
175 converters_tab_.reset(build_preferences_inner_tab(this));
176 look_n_feel_tab_.reset(build_preferences_inner_tab(this));
177 inputs_tab_.reset(build_preferences_inner_tab(this));
178 outputs_tab_.reset(build_preferences_inner_tab(this));
179 lang_opts_tab_.reset(build_preferences_inner_tab(this));
181 // build actual tabfolder contents
182 // these will become nested tabfolders
186 inputs_misc_.build();
191 outputs_misc_.build();
194 screen_fonts_.build();
195 spelloptions_.build();
197 // Enable the tabfolders to be rescaled correctly.
198 if (scalableTabfolders) {
199 FL_OBJECT * folder = dialog_->tabfolder_prefs;
200 fl_set_tabfolder_autofit(folder, FL_FIT);
202 folder = look_n_feel_tab_->tabfolder_inner;
203 fl_set_tabfolder_autofit(folder, FL_FIT);
205 folder = converters_tab_->tabfolder_inner;
206 fl_set_tabfolder_autofit(folder, FL_FIT);
208 folder = inputs_tab_->tabfolder_inner;
209 fl_set_tabfolder_autofit(folder, FL_FIT);
211 folder = outputs_tab_->tabfolder_inner;
212 fl_set_tabfolder_autofit(folder, FL_FIT);
214 folder = lang_opts_tab_->tabfolder_inner;
215 fl_set_tabfolder_autofit(folder, FL_FIT);
219 // Now add them to the tabfolder
220 fl_addto_tabfolder(dialog_->tabfolder_prefs,
221 _("Look & Feel").c_str(),
222 look_n_feel_tab_->form);
223 fl_addto_tabfolder(dialog_->tabfolder_prefs,
224 _("Lang Opts").c_str(),
225 lang_opts_tab_->form);
226 fl_addto_tabfolder(dialog_->tabfolder_prefs,
227 _("Conversion").c_str(),
228 converters_tab_->form);
229 fl_addto_tabfolder(dialog_->tabfolder_prefs,
232 fl_addto_tabfolder(dialog_->tabfolder_prefs,
233 _("Outputs").c_str(),
236 // now build the nested tabfolders
237 // Starting with look and feel
238 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
239 _("Screen Fonts").c_str(),
240 screen_fonts_.dialog()->form);
241 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
242 _("Interface").c_str(),
243 interface_.dialog()->form);
244 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
246 colors_.dialog()->form);
247 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
249 lnf_misc_.dialog()->form);
250 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
251 _("Identity").c_str(),
252 identity_.dialog()->form);
254 // then build converters
255 fl_addto_tabfolder(converters_tab_->tabfolder_inner,
256 _("Formats").c_str(),
257 formats_.dialog()->form);
258 fl_addto_tabfolder(converters_tab_->tabfolder_inner,
259 _("Converters").c_str(),
260 converters_.dialog()->form);
263 // Paths should probably go in a few inner_tab called Files
264 fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
266 paths_.dialog()->form);
267 fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
269 inputs_misc_.dialog()->form);
271 // then building outputs
272 fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
273 _("Printer").c_str(),
274 printer_.dialog()->form);
275 fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
277 outputs_misc_.dialog()->form);
279 // then building usage
280 fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
281 _("Spell checker").c_str(),
282 spelloptions_.dialog()->form);
283 fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
284 _("Language").c_str(),
285 language_.dialog()->form);
289 void FormPreferences::apply()
291 // set the new lyxrc entries
292 // many of these need to trigger other functions when the assignment
293 // is made. For example, screen zoom and font types. These could be
294 // handled either by signals/slots in lyxrc or just directly call the
295 // associated functions here.
296 // There are other problems with this scheme. We really should check
297 // what we copy to make sure that it really is necessary to do things
298 // like update the screen fonts because that flushes the textcache
299 // and other stuff which may cost us a lot on slower/high-load
302 LyXRC & rc(controller().rc());
305 formats_.apply(); // Must be before converters_.apply()
307 inputs_misc_.apply(rc);
308 interface_.apply(rc);
312 outputs_misc_.apply(rc);
315 screen_fonts_.apply(rc);
316 spelloptions_.apply(rc);
318 // The "Save" button has been pressed.
319 if (controller().isClosing() && colors_.modifiedXformsPrefs) {
320 string const filename =
321 AddName(user_lyxdir(), "preferences.xform");
322 colors_.modifiedXformsPrefs = !XformsColor::write(filename);
327 string const FormPreferences::getFeedback(FL_OBJECT * ob)
331 if (ob->form->fdui == colors_.dialog())
332 return colors_.feedback(ob);
333 if (ob->form->fdui == converters_.dialog())
334 return converters_.feedback(ob);
335 if (ob->form->fdui == formats_.dialog())
336 return formats_.feedback(ob);
337 if (ob->form->fdui == inputs_misc_.dialog())
338 return inputs_misc_.feedback(ob);
339 if (ob->form->fdui == interface_.dialog())
340 return interface_.feedback(ob);
341 if (ob->form->fdui == language_.dialog())
342 return language_.feedback(ob);
343 if (ob->form->fdui == lnf_misc_.dialog())
344 return lnf_misc_.feedback(ob);
345 if (ob->form->fdui == outputs_misc_.dialog())
346 return outputs_misc_.feedback(ob);
347 if (ob->form->fdui == paths_.dialog())
348 return paths_.feedback(ob);
349 if (ob->form->fdui == printer_.dialog())
350 return printer_.feedback(ob);
351 if (ob->form->fdui == screen_fonts_.dialog())
352 return screen_fonts_.feedback(ob);
353 if (ob->form->fdui == spelloptions_.dialog())
354 return spelloptions_.feedback(ob);
360 ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long)
366 // whatever checks you need to ensure the user hasn't entered
367 // some totally ridiculous value somewhere. Change activate to suit.
368 // comments before each test describe what is _valid_
370 if (ob->form->fdui == colors_.dialog()) {
372 } else if (ob->form->fdui == converters_.dialog()) {
373 valid = converters_.input(ob);
374 } else if (ob->form->fdui == formats_.dialog()) {
375 valid = formats_.input(ob);
376 } else if (ob->form->fdui == interface_.dialog()) {
377 valid = interface_.input(ob);
378 } else if (ob->form->fdui == language_.dialog()) {
379 valid = language_.input(ob);
380 } else if (ob->form->fdui == paths_.dialog()) {
381 valid = paths_.input(ob);
382 } else if (ob->form->fdui == screen_fonts_.dialog()) {
383 valid = screen_fonts_.input();
384 } else if (ob->form->fdui == spelloptions_.dialog()) {
385 valid = spelloptions_.input(ob);
388 return valid ? ButtonPolicy::SMI_VALID : ButtonPolicy::SMI_INVALID;
392 void FormPreferences::update()
394 if (!dialog_.get()) return;
396 LyXRC const & rc(controller().rc());
398 // read lyxrc entries
400 formats_.update(); // Must be before converters_.update()
401 converters_.update();
402 inputs_misc_.update(rc);
403 interface_.update(rc);
404 language_.update(rc);
405 lnf_misc_.update(rc);
406 identity_.update(rc);
407 outputs_misc_.update(rc);
410 screen_fonts_.update(rc);
411 spelloptions_.update(rc);
415 FormPreferences::Colors::Colors(FormPreferences & p)
416 : modifiedXformsPrefs(false), parent_(p)
420 FD_preferences_colors const * FormPreferences::Colors::dialog()
422 return dialog_.get();
426 void FormPreferences::Colors::apply()
428 bool modifiedText = false;
429 bool modifiedBackground = false;
431 for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
432 cit != xformsColorDB.end(); ++cit) {
434 fl_getmcolor(cit->colorID, &col.r, &col.g, &col.b);
435 if (col != cit->color()) {
436 modifiedXformsPrefs = true;
437 if (cit->colorID == FL_BLACK)
439 if (cit->colorID == FL_COL1)
440 modifiedBackground = true;
444 if (modifiedXformsPrefs) {
445 for (vector<XformsColor>::const_iterator cit =
446 xformsColorDB.begin();
447 cit != xformsColorDB.end(); ++cit) {
448 fl_mapcolor(cit->colorID, cit->r, cit->g, cit->b);
450 if (modifiedText && cit->colorID == FL_BLACK) {
451 AdjustVal(FL_INACTIVE, FL_BLACK, 0.5);
454 if (modifiedBackground && cit->colorID == FL_COL1) {
455 AdjustVal(FL_MCOL, FL_COL1, 0.1);
456 AdjustVal(FL_TOP_BCOL, FL_COL1, 0.1);
457 AdjustVal(FL_LEFT_BCOL, FL_COL1, 0.1);
459 AdjustVal(FL_RIGHT_BCOL, FL_COL1, -0.5);
460 AdjustVal(FL_BOTTOM_BCOL, FL_COL1, -0.5);
463 if (cit->colorID == GUI_COLOR_CURSOR) {
464 fl_mapcolor(GUI_COLOR_CURSOR,
465 cit->r, cit->g, cit->b);
466 setCursorColor(GUI_COLOR_CURSOR);
469 parent_.controller().redrawGUI();
472 // Now do the same for the LyX LColors...
473 for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
474 cit != lyxColorDB.end(); ++cit) {
475 LColor::color lc = lcolor.getFromGUIName(cit->getname());
476 if (lc == LColor::inherit) continue;
478 // Create a valid X11 name of the form "#rrggbb"
479 string const hexname = X11hexname(cit->color());
481 if (lcolor.getX11Name(lc) != hexname) {
483 << "FormPreferences::Colors::apply: "
484 << "resetting LColor " << lcolor.getGUIName(lc)
485 << " from \"" << lcolor.getX11Name(lc)
486 << "\" to \"" << hexname << "\"."
489 parent_.controller().setColor(lc, hexname);
495 void FormPreferences::Colors::build()
497 picker_.reset(new FormColorpicker);
498 dialog_.reset(build_preferences_colors(&parent_));
500 fl_set_object_color(dialog_->button_color,
501 GUI_COLOR_CHOICE, GUI_COLOR_CHOICE);
503 // set up the feedback mechanism
504 setPrehandler(dialog_->browser_lyx_objs);
505 setPrehandler(dialog_->button_color);
506 setPrehandler(dialog_->button_modify);
511 FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
513 if (ob == dialog_->browser_lyx_objs)
514 return _("LyX objects that can be assigned a color.");
516 if (ob == dialog_->button_modify)
517 return _("Modify the LyX object's color. Note: you must then \"Apply\" the change.");
523 void FormPreferences::Colors::input(FL_OBJECT const * const ob)
525 if (ob == dialog_->browser_lyx_objs) {
528 } else if (ob == dialog_->button_modify) {
534 void FormPreferences::Colors::AdjustVal(int colAdjust, int colParent,
538 fl_getmcolor(colParent, &rgb.r, &rgb.g, &rgb.b);
542 hsv.v = min(1.0, max(0.0, hsv.v));
545 fl_mapcolor(colAdjust, rgb.r, rgb.g, rgb.b);
549 void FormPreferences::Colors::InputBrowserLyX() const
551 vector<NamedColor>::size_type const selLyX =
552 fl_get_browser(dialog_->browser_lyx_objs);
553 if (selLyX < 1) return;
555 // Is the choice an Xforms color...
558 if (selLyX - 1 < xformsColorDB.size()) {
559 vector<XformsColor>::size_type const i = selLyX - 1;
560 col = xformsColorDB[i].color();
562 // or a LyX Logical color?
564 vector<NamedColor>::size_type const i = selLyX - 1 -
565 xformsColorDB.size();
566 col = lyxColorDB[i].color();
569 fl_freeze_form(dialog_->form);
571 fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
572 fl_redraw_object(dialog_->button_color);
574 fl_unfreeze_form(dialog_->form);
578 void FormPreferences::Colors::LoadBrowserLyX()
580 if (!dialog_->browser_lyx_objs->visible)
583 // First, define the modifiable xforms colors
584 xformsColorDB.clear();
587 xcol.name = _("GUI background");
588 xcol.colorID = FL_COL1;
589 fl_getmcolor(FL_COL1, &xcol.r, &xcol.g, &xcol.b);
591 xformsColorDB.push_back(xcol);
593 xcol.name = _("GUI text");
594 xcol.colorID = FL_BLACK;
595 fl_getmcolor(FL_BLACK, &xcol.r, &xcol.g, &xcol.b);
597 xformsColorDB.push_back(xcol);
599 xcol.name = _("GUI selection");
600 xcol.colorID = FL_YELLOW;
601 fl_getmcolor(FL_YELLOW, &xcol.r, &xcol.g, &xcol.b);
603 xformsColorDB.push_back(xcol);
605 xcol.name = _("GUI pointer");
606 xcol.colorID = GUI_COLOR_CURSOR;
607 fl_getmcolor(GUI_COLOR_CURSOR, &xcol.r, &xcol.g, &xcol.b);
609 xformsColorDB.push_back(xcol);
611 // Now create the the LyX LColors database
613 for (int i=0; i<LColor::ignore; ++i) {
614 LColor::color lc = static_cast<LColor::color>(i);
615 if (lc == LColor::none
616 || lc == LColor::black
617 || lc == LColor::white
619 || lc == LColor::green
620 || lc == LColor::blue
621 || lc == LColor::cyan
622 || lc == LColor::magenta
623 || lc == LColor::yellow
624 || lc == LColor::inherit
625 || lc == LColor::ignore) continue;
628 bool const success = getRGBColor(lc, col.r, col.g, col.b);
630 lyxerr << "FormPreferences::Colors::LoadBrowserLyX:\n"
631 << "LColor " << lcolor.getLyXName(lc)
632 << ": X can't find color \""
633 << lcolor.getX11Name(lc)
634 << "\". Set to \"black\"!" << endl;
636 string const arg = lcolor.getLyXName(lc) + " black";
637 parent_.controller().setColor(lc, "black");
641 // Create a valid X11 name of the form "#rrggbb" and change the
642 // LColor X11name to this. Don't want to trigger a redraw,
643 // as we're just changing the name not the RGB values.
644 // Also reset the system_lcolor names, so that we don't output
645 // unnecessary changes.
646 string const hexname = X11hexname(col);
648 if (lcolor.getX11Name(lc) != hexname) {
649 lcolor.setColor(lc, hexname);
650 system_lcolor.setColor(lc, hexname);
653 // Finally, push the color onto the database
654 NamedColor ncol(lcolor.getGUIName(lc), col);
655 lyxColorDB.push_back(ncol);
658 // Now construct the browser
659 FL_OBJECT * colbr = dialog_->browser_lyx_objs;
660 fl_freeze_form(dialog_->form);
661 fl_clear_browser(colbr);
662 for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
663 cit != xformsColorDB.end(); ++cit) {
664 fl_addto_browser(colbr, cit->getname().c_str());
666 for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
667 cit != lyxColorDB.end(); ++cit) {
668 fl_addto_browser(colbr, cit->getname().c_str());
671 // just to be safe...
672 fl_set_browser_topline(dialog_->browser_lyx_objs, 1);
673 fl_select_browser_line(dialog_->browser_lyx_objs, 1);
674 fl_unfreeze_form(dialog_->form);
680 void FormPreferences::Colors::Modify()
682 vector<NamedColor>::size_type const selLyX =
683 fl_get_browser(dialog_->browser_lyx_objs);
688 fl_getmcolor(GUI_COLOR_CHOICE, &before.r, &before.g, &before.b);
690 RGBColor col = picker_->requestColor(before);
694 fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
695 fl_redraw_object(dialog_->button_color);
697 // Is the choice an Xforms color...
698 if (selLyX - 1 < xformsColorDB.size()) {
699 vector<XformsColor>::size_type const i = selLyX - 1;
700 xformsColorDB[i].r = col.r;
701 xformsColorDB[i].g = col.g;
702 xformsColorDB[i].b = col.b;
704 // or a LyX Logical color?
706 vector<NamedColor>::size_type const i = selLyX - 1 -
707 xformsColorDB.size();
708 lyxColorDB[i].r = col.r;
709 lyxColorDB[i].g = col.g;
710 lyxColorDB[i].b = col.b;
715 FormPreferences::Converters::Converters(FormPreferences & p)
720 FD_preferences_converters const * FormPreferences::Converters::dialog()
722 return dialog_.get();
726 void FormPreferences::Converters::apply() const
728 parent_.controller().setConverters(local_converters);
732 void FormPreferences::Converters::build()
734 dialog_.reset(build_preferences_converters(&parent_));
736 fl_set_input_return(dialog_->input_converter, FL_RETURN_CHANGED);
737 fl_set_input_return(dialog_->input_flags, FL_RETURN_CHANGED);
739 // set up the feedback mechanism
740 setPrehandler(dialog_->browser_all);
741 setPrehandler(dialog_->button_delete);
742 setPrehandler(dialog_->button_add);
743 setPrehandler(dialog_->input_converter);
744 setPrehandler(dialog_->choice_from);
745 setPrehandler(dialog_->choice_to);
746 setPrehandler(dialog_->input_flags);
751 FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const
753 if (ob == dialog_->browser_all)
754 return _("All explicitly defined converters for LyX");
756 if (ob == dialog_->choice_from)
757 return _("Convert \"from\" this format");
759 if (ob == dialog_->choice_to)
760 return _("Convert \"to\" this format");
762 if (ob == dialog_->input_converter)
763 return _("The conversion command. $$i is the input file name, "
764 "$$b is the file name without its extension and $$o is "
765 "the name of the output file. $$s can be used as path to "
766 "LyX's own collection of conversion scripts.");
768 if (ob == dialog_->input_flags)
769 return _("Extra information for the Converter class, whether and "
770 "how to parse the result, and various other things.");
772 if (ob == dialog_->button_delete)
773 return _("Remove the current converter from the list of available "
774 "converters. Note: you must then \"Apply\" the change.");
776 if (ob == dialog_->button_add) {
777 if (string(ob->label) == _("Add"))
778 return _("Add the current converter to the list of available "
779 "converters. Note: you must then \"Apply\" the change.");
781 return _("Modify the contents of the current converter. "
782 "Note: you must then \"Apply\" the change.");
789 bool FormPreferences::Converters::input(FL_OBJECT const * const ob)
791 if (ob == dialog_->browser_all)
794 if (ob == dialog_->choice_from
795 || ob == dialog_->choice_to
796 || ob == dialog_->input_converter
797 || ob == dialog_->input_flags)
800 if (ob == dialog_->button_add)
803 if (ob == dialog_->button_delete)
810 void FormPreferences::Converters::update()
812 local_converters = converters;
813 local_converters.update(local_formats);
818 void FormPreferences::Converters::UpdateBrowser()
820 local_converters.sort();
822 fl_freeze_form(dialog_->form);
823 fl_clear_browser(dialog_->browser_all);
824 for (::Converters::const_iterator cit = local_converters.begin();
825 cit != local_converters.end(); ++cit) {
826 string const name = cit->From->prettyname() + " -> "
827 + cit->To->prettyname();
828 fl_addto_browser(dialog_->browser_all, name.c_str());
831 fl_unfreeze_form(dialog_->form);
835 bool FormPreferences::Converters::Add()
837 string const from = GetFrom();
838 string const to = GetTo();
839 string const command = fl_get_input(dialog_->input_converter);
840 string const flags = fl_get_input(dialog_->input_flags);
842 Converter const * old = local_converters.getConverter(from, to);
843 local_converters.add(from, to, command, flags);
845 local_converters.updateLast(local_formats);
848 setEnabled(dialog_->button_add, false);
854 bool FormPreferences::Converters::Browser()
856 int const i = fl_get_browser(dialog_->browser_all);
857 if (i <= 0) return false;
859 fl_freeze_form(dialog_->form);
861 Converter const & c = local_converters.get(i - 1);
862 int j = local_formats.getNumber(c.from);
864 fl_set_choice(dialog_->choice_from, j + 1);
866 j = local_formats.getNumber(c.to);
868 fl_set_choice(dialog_->choice_to, j + 1);
870 fl_set_input(dialog_->input_converter, c.command.c_str());
871 fl_set_input(dialog_->input_flags, c.flags.c_str());
873 fl_set_object_label(dialog_->button_add, idex(_("Modify|#M")).c_str());
874 fl_set_button_shortcut(dialog_->button_add,
875 scex(_("Modify|#M")).c_str(), 1);
877 setEnabled(dialog_->button_add, false);
878 setEnabled(dialog_->button_delete, true);
880 fl_unfreeze_form(dialog_->form);
885 bool FormPreferences::Converters::erase()
887 string const from = GetFrom();
888 string const to = GetTo();
890 local_converters.erase(from, to);
896 bool FormPreferences::Converters::Input()
898 string const from = GetFrom();
899 string const to = GetTo();
900 int const sel = local_converters.getNumber(from, to);
902 fl_freeze_form(dialog_->form);
905 fl_set_object_label(dialog_->button_add,
906 idex(_("Add|#A")).c_str());
907 fl_set_button_shortcut(dialog_->button_add,
908 scex(_("Add|#A")).c_str(), 1);
910 fl_deselect_browser(dialog_->browser_all);
911 setEnabled(dialog_->button_delete, false);
914 fl_set_object_label(dialog_->button_add,
915 idex(_("Modify|#M")).c_str());
916 fl_set_button_shortcut(dialog_->button_add,
917 scex(_("Modify|#M")).c_str(), 1);
919 int top = max(sel-5, 0);
920 fl_set_browser_topline(dialog_->browser_all, top);
921 fl_select_browser_line(dialog_->browser_all, sel+1);
922 setEnabled(dialog_->button_delete, true);
925 string const command = rtrim(fl_get_input(dialog_->input_converter));
926 bool const enable = !(command.empty() || from == to);
927 setEnabled(dialog_->button_add, enable);
929 fl_unfreeze_form(dialog_->form);
934 string const FormPreferences::Converters::GetFrom() const
936 ::Formats::FormatList::size_type const i =
937 fl_get_choice(dialog_->choice_from);
939 if (i > 0 && i <= local_formats.size())
940 return local_formats.get(i - 1).name();
942 lyxerr << "FormPreferences::Converters::GetFrom: No choice!" << endl;
947 string const FormPreferences::Converters::GetTo() const
949 ::Formats::FormatList::size_type const i =
950 fl_get_choice(dialog_->choice_to);
952 if (i > 0 && i <= local_formats.size())
953 return local_formats.get(i - 1).name();
955 lyxerr << "FormPreferences::Converters::GetTo: No choice!" << endl;
960 void FormPreferences::Converters::UpdateChoices() const
963 for (::Formats::const_iterator cit = local_formats.begin();
964 cit != local_formats.end(); ++cit) {
969 choice += cit->prettyname();
973 fl_clear_choice(dialog_->choice_from);
974 fl_addto_choice(dialog_->choice_from, choice.c_str());
976 fl_clear_choice(dialog_->choice_to);
977 fl_addto_choice(dialog_->choice_to, choice.c_str());
981 FormPreferences::Formats::Formats(FormPreferences & p)
986 FD_preferences_formats const * FormPreferences::Formats::dialog()
988 return dialog_.get();
992 void FormPreferences::Formats::apply() const
994 parent_.controller().setFormats(local_formats);
998 void FormPreferences::Formats::build()
1000 dialog_.reset(build_preferences_formats(&parent_));
1002 fl_set_input_return(dialog_->input_format, FL_RETURN_CHANGED);
1003 fl_set_input_return(dialog_->input_viewer, FL_RETURN_CHANGED);
1004 fl_set_input_return(dialog_->input_shrtcut, FL_RETURN_CHANGED);
1005 fl_set_input_return(dialog_->input_gui_name, FL_RETURN_CHANGED);
1006 fl_set_input_return(dialog_->input_extension, FL_RETURN_CHANGED);
1008 fl_set_input_filter(dialog_->input_format, fl_lowercase_filter);
1010 // set up the feedback mechanism
1011 setPrehandler(dialog_->browser_all);
1012 setPrehandler(dialog_->input_format);
1013 setPrehandler(dialog_->input_gui_name);
1014 setPrehandler(dialog_->button_delete);
1015 setPrehandler(dialog_->button_add);
1016 setPrehandler(dialog_->input_extension);
1017 setPrehandler(dialog_->input_viewer);
1018 setPrehandler(dialog_->input_shrtcut);
1023 FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
1025 if (ob == dialog_->browser_all)
1026 return _("All the currently defined formats known to LyX.");
1028 if (ob == dialog_->input_format)
1029 return _("The format identifier.");
1031 if (ob == dialog_->input_gui_name)
1032 return _("The format name as it will appear in the menus.");
1034 if (ob == dialog_->input_shrtcut)
1035 return _("The keyboard accelerator. Use a letter in the GUI name. "
1038 if (ob == dialog_->input_extension)
1039 return _("Used to recognize the file. E.g., ps, pdf, tex.");
1041 if (ob == dialog_->input_viewer)
1042 return _("The command used to launch the viewer application.");
1044 if (ob == dialog_->button_delete)
1045 return _("Remove the current format from the list of available "
1046 "formats. Note: you must then \"Apply\" the change.");
1048 if (ob == dialog_->button_add) {
1049 if (string(ob->label) == _("Add"))
1050 return _("Add the current format to the list of available "
1051 "formats. Note: you must then \"Apply\" the change.");
1053 return _("Modify the contents of the current format. Note: "
1054 "you must then \"Apply\" the change.");
1061 bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
1063 if (ob == dialog_->browser_all)
1066 if (ob == dialog_->input_format
1067 || ob == dialog_->input_gui_name
1068 || ob == dialog_->input_shrtcut
1069 || ob == dialog_->input_extension
1070 || ob == dialog_->input_viewer)
1073 if (ob == dialog_->button_add)
1076 if (ob == dialog_->button_delete)
1083 void FormPreferences::Formats::update()
1085 local_formats = formats;
1090 void FormPreferences::Formats::UpdateBrowser()
1092 local_formats.sort();
1094 fl_freeze_form(dialog_->form);
1095 fl_deselect_browser(dialog_->browser_all);
1096 fl_clear_browser(dialog_->browser_all);
1097 for (::Formats::const_iterator cit = local_formats.begin();
1098 cit != local_formats.end(); ++cit)
1099 fl_addto_browser(dialog_->browser_all,
1100 cit->prettyname().c_str());
1103 fl_unfreeze_form(dialog_->form);
1105 // Mustn't forget to update the Formats available to the converters_
1106 parent_.converters_.UpdateChoices();
1107 local_converters.update(local_formats);
1111 bool FormPreferences::Formats::Add()
1113 string const name = fl_get_input(dialog_->input_format);
1114 string const prettyname = fl_get_input(dialog_->input_gui_name);
1115 string const extension = fl_get_input(dialog_->input_extension);
1116 string const shortcut = fl_get_input(dialog_->input_shrtcut);
1117 string const viewer = fl_get_input(dialog_->input_viewer);
1119 Format const * old = local_formats.getFormat(name);
1120 string const old_prettyname = old ? old->prettyname() : string();
1121 local_formats.add(name, extension, prettyname, shortcut);
1122 local_formats.setViewer(name, viewer);
1123 if (!old || prettyname != old_prettyname) {
1126 parent_.converters_.UpdateBrowser();
1128 setEnabled(dialog_->button_add, false);
1134 bool FormPreferences::Formats::Browser()
1136 int const i = fl_get_browser(dialog_->browser_all);
1140 fl_freeze_form(dialog_->form);
1142 Format const & f = local_formats.get(i - 1);
1144 fl_set_input(dialog_->input_format, f.name().c_str());
1145 fl_set_input(dialog_->input_gui_name, f.prettyname().c_str());
1146 fl_set_input(dialog_->input_shrtcut, f.shortcut().c_str());
1147 fl_set_input(dialog_->input_extension, f.extension().c_str());
1148 fl_set_input(dialog_->input_viewer, f.viewer().c_str());
1150 fl_set_object_label(dialog_->button_add,
1151 idex(_("Modify|#M")).c_str());
1152 fl_set_button_shortcut(dialog_->button_add,
1153 scex(_("Modify|#M")).c_str(), 1);
1155 setEnabled(dialog_->button_add, false);
1156 setEnabled(dialog_->button_delete, true);
1158 fl_unfreeze_form(dialog_->form);
1163 bool FormPreferences::Formats::erase()
1165 string const name = fl_get_input(dialog_->input_format);
1167 if (local_converters.formatIsUsed(name)) {
1168 parent_.postWarning(_("Cannot remove a Format used by a Converter. "
1169 "Remove the converter first."));
1170 setEnabled(dialog_->button_delete, false);
1174 local_formats.erase(name);
1180 bool FormPreferences::Formats::Input()
1182 string const name = fl_get_input(dialog_->input_format);
1183 int const sel = local_formats.getNumber(name);
1184 fl_freeze_form(dialog_->form);
1187 fl_set_object_label(dialog_->button_add,
1188 idex(_("Add|#A")).c_str());
1189 fl_set_button_shortcut(dialog_->button_add,
1190 scex(_("Add|#A")).c_str(), 1);
1192 fl_deselect_browser(dialog_->browser_all);
1193 setEnabled(dialog_->button_delete, false);
1196 fl_set_object_label(dialog_->button_add,
1197 idex(_("Modify|#M")).c_str());
1198 fl_set_button_shortcut(dialog_->button_add,
1199 scex(_("Modify|#M")).c_str(), 1);
1201 int const top = max(sel-5, 0);
1202 fl_set_browser_topline(dialog_->browser_all, top);
1203 fl_select_browser_line(dialog_->browser_all, sel+1);
1205 setEnabled(dialog_->button_add, true);
1206 setEnabled(dialog_->button_delete, true);
1209 string const prettyname = fl_get_input(dialog_->input_gui_name);
1210 bool const enable = !(name.empty() || prettyname.empty());
1211 setEnabled(dialog_->button_add, enable);
1213 fl_unfreeze_form(dialog_->form);
1218 FormPreferences::Identity::Identity(FormPreferences & p)
1223 FD_preferences_identity const * FormPreferences::Identity::dialog()
1225 return dialog_.get();
1229 void FormPreferences::Identity::apply(LyXRC & rc) const
1231 rc.user_name = fl_get_input(dialog_->input_user_name);
1232 rc.user_email = fl_get_input(dialog_->input_user_email);
1236 void FormPreferences::Identity::build()
1238 dialog_.reset(build_preferences_identity(&parent_));
1239 fl_set_input_return(dialog_->input_user_name, FL_RETURN_CHANGED);
1240 fl_set_input_return(dialog_->input_user_email, FL_RETURN_CHANGED);
1244 void FormPreferences::Identity::update(LyXRC const & rc)
1246 fl_set_input(dialog_->input_user_name, rc.user_name.c_str());
1247 fl_set_input(dialog_->input_user_email, rc.user_email.c_str());
1251 FormPreferences::InputsMisc::InputsMisc(FormPreferences & p)
1256 FD_preferences_inputs_misc const * FormPreferences::InputsMisc::dialog()
1258 return dialog_.get();
1262 void FormPreferences::InputsMisc::apply(LyXRC & rc) const
1264 rc.date_insert_format =
1265 fl_get_input(dialog_->input_date_format);
1269 void FormPreferences::InputsMisc::build()
1271 dialog_.reset(build_preferences_inputs_misc(&parent_));
1273 fl_set_input_return(dialog_->input_date_format, FL_RETURN_CHANGED);
1275 // set up the feedback mechanism
1276 setPrehandler(dialog_->input_date_format);
1281 FormPreferences::InputsMisc::feedback(FL_OBJECT const * const ob) const
1283 if (ob == dialog_->input_date_format)
1284 return LyXRC::getDescription(LyXRC::RC_DATE_INSERT_FORMAT);
1289 void FormPreferences::InputsMisc::update(LyXRC const & rc)
1291 fl_set_input(dialog_->input_date_format,
1292 rc.date_insert_format.c_str());
1296 FormPreferences::Interface::Interface(FormPreferences & p)
1301 FD_preferences_interface const * FormPreferences::Interface::dialog()
1303 return dialog_.get();
1307 void FormPreferences::Interface::apply(LyXRC & rc) const
1309 rc.popup_normal_font =
1310 fl_get_input(dialog_->input_popup_normal_font);
1311 rc.popup_bold_font = fl_get_input(dialog_->input_popup_bold_font);
1312 rc.popup_font_encoding =
1313 fl_get_input(dialog_->input_popup_font_encoding);
1314 rc.bind_file = fl_get_input(dialog_->input_bind_file);
1315 rc.ui_file = fl_get_input(dialog_->input_ui_file);
1319 void FormPreferences::Interface::build()
1321 dialog_.reset(build_preferences_interface(&parent_));
1323 fl_set_input_return(dialog_->input_popup_normal_font, FL_RETURN_CHANGED);
1324 fl_set_input_return(dialog_->input_popup_bold_font, FL_RETURN_CHANGED);
1325 fl_set_input_return(dialog_->input_popup_font_encoding, FL_RETURN_CHANGED);
1326 fl_set_input_return(dialog_->input_bind_file, FL_RETURN_CHANGED);
1327 fl_set_input_return(dialog_->input_ui_file, FL_RETURN_CHANGED);
1329 // set up the feedback mechanism
1330 setPrehandler(dialog_->input_popup_normal_font);
1331 setPrehandler(dialog_->input_popup_bold_font);
1332 setPrehandler(dialog_->input_popup_font_encoding);
1333 setPrehandler(dialog_->input_bind_file);
1334 setPrehandler(dialog_->button_bind_file_browse);
1335 setPrehandler(dialog_->input_ui_file);
1336 setPrehandler(dialog_->button_ui_file_browse);
1341 FormPreferences::Interface::feedback(FL_OBJECT const * const ob) const
1343 if (ob == dialog_->input_popup_normal_font)
1344 return LyXRC::getDescription(LyXRC::RC_POPUP_NORMAL_FONT);
1345 if (ob == dialog_->input_popup_bold_font)
1346 return LyXRC::getDescription(LyXRC::RC_POPUP_BOLD_FONT);
1347 if (ob == dialog_->input_popup_font_encoding)
1348 return LyXRC::getDescription(LyXRC::RC_POPUP_FONT_ENCODING);
1349 if (ob == dialog_->input_bind_file)
1350 return LyXRC::getDescription(LyXRC::RC_BINDFILE);
1351 if (ob == dialog_->input_ui_file)
1352 return LyXRC::getDescription(LyXRC::RC_UIFILE);
1357 bool FormPreferences::Interface::input(FL_OBJECT const * const ob)
1359 if (ob == dialog_->button_bind_file_browse) {
1360 string f = parent_.controller().browsebind(
1361 fl_get_input(dialog_->input_bind_file));
1363 fl_set_input(dialog_->input_bind_file, f.c_str());
1364 } else if (ob == dialog_->button_ui_file_browse) {
1365 string f = parent_.controller().browseUI(
1366 fl_get_input(dialog_->input_ui_file));
1368 fl_set_input(dialog_->input_ui_file, f.c_str());
1375 void FormPreferences::Interface::update(LyXRC const & rc)
1377 fl_set_input(dialog_->input_popup_normal_font,
1378 rc.popup_normal_font.c_str());
1379 fl_set_input(dialog_->input_popup_bold_font,
1380 rc.popup_bold_font.c_str());
1381 fl_set_input(dialog_->input_popup_font_encoding,
1382 rc.popup_font_encoding.c_str());
1383 fl_set_input(dialog_->input_bind_file,
1384 rc.bind_file.c_str());
1385 fl_set_input(dialog_->input_ui_file,
1386 rc.ui_file.c_str());
1390 FormPreferences::Language::Language(FormPreferences & p)
1395 FD_preferences_language const * FormPreferences::Language::dialog()
1397 return dialog_.get();
1401 void FormPreferences::Language::apply(LyXRC & rc)
1403 int const pos = fl_get_combox(dialog_->combox_default_lang);
1404 rc.default_language = lang_[pos-1];
1406 int button = fl_get_button(dialog_->check_use_kbmap);
1407 string const name_1 = fl_get_input(dialog_->input_kbmap1);
1408 string const name_2 = fl_get_input(dialog_->input_kbmap2);
1410 button = !(name_1.empty() && name_2.empty());
1411 rc.use_kbmap = static_cast<bool>(button);
1414 rc.primary_kbmap = name_1;
1415 rc.secondary_kbmap = name_2;
1418 button = fl_get_button(dialog_->check_rtl_support);
1419 rc.rtl_support = static_cast<bool>(button);
1421 button = fl_get_button(dialog_->check_mark_foreign);
1422 rc.mark_foreign_language = static_cast<bool>(button);
1424 button = fl_get_button(dialog_->check_auto_begin);
1425 rc.language_auto_begin = static_cast<bool>(button);
1427 button = fl_get_button(dialog_->check_auto_end);
1428 rc.language_auto_end = static_cast<bool>(button);
1430 button = fl_get_button(dialog_->check_use_babel);
1431 rc.language_use_babel = static_cast<bool>(button);
1433 button = fl_get_button(dialog_->check_global_options);
1434 rc.language_global_options = static_cast<bool>(button);
1436 rc.language_package = fl_get_input(dialog_->input_package);
1437 rc.language_command_begin = fl_get_input(dialog_->input_command_begin);
1438 rc.language_command_end = fl_get_input(dialog_->input_command_end);
1440 // Ensure that all is self-consistent.
1445 void FormPreferences::Language::build()
1447 dialog_.reset(build_preferences_language(&parent_));
1449 fl_set_input_return(dialog_->input_package, FL_RETURN_CHANGED);
1450 fl_set_input_return(dialog_->input_command_begin, FL_RETURN_CHANGED);
1451 fl_set_input_return(dialog_->input_command_end, FL_RETURN_CHANGED);
1453 // Store the lang identifiers for later
1454 vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
1455 lang_ = getSecond(langs);
1457 FL_OBJECT * obj = dialog_->combox_default_lang;
1458 vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
1459 vector<frnt::LanguagePair>::const_iterator lend = langs.end();
1460 for (; lit != lend; ++lit) {
1461 fl_addto_combox(obj, lit->first.c_str());
1463 fl_set_combox_browser_height(obj, 400);
1465 // set up the feedback mechanism
1466 setPrehandler(dialog_->input_package);
1467 setPrehandler(dialog_->check_use_kbmap);
1468 setPrehandler(dialog_->combox_default_lang);
1469 setPrehandler(dialog_->input_kbmap1);
1470 setPrehandler(dialog_->input_kbmap2);
1471 setPrehandler(dialog_->check_rtl_support);
1472 setPrehandler(dialog_->check_mark_foreign);
1473 setPrehandler(dialog_->check_auto_begin);
1474 setPrehandler(dialog_->check_auto_end);
1475 setPrehandler(dialog_->check_use_babel);
1476 setPrehandler(dialog_->check_global_options);
1477 setPrehandler(dialog_->input_command_begin);
1478 setPrehandler(dialog_->input_command_end);
1480 // Activate/Deactivate the input fields dependent on the state of the
1487 FormPreferences::Language::feedback(FL_OBJECT const * const ob) const
1489 if (ob == dialog_->combox_default_lang)
1490 return LyXRC::getDescription(LyXRC::RC_DEFAULT_LANGUAGE);
1491 if (ob == dialog_->check_use_kbmap)
1492 return LyXRC::getDescription(LyXRC::RC_KBMAP);
1493 if (ob == dialog_->input_kbmap1)
1494 return LyXRC::getDescription(LyXRC::RC_KBMAP_PRIMARY);
1495 if (ob == dialog_->input_kbmap2)
1496 return LyXRC::getDescription(LyXRC::RC_KBMAP_SECONDARY);
1497 if (ob == dialog_->check_rtl_support)
1498 return LyXRC::getDescription(LyXRC::RC_RTL_SUPPORT);
1499 if (ob == dialog_->check_mark_foreign)
1500 return LyXRC::getDescription(LyXRC::RC_MARK_FOREIGN_LANGUAGE);
1501 if (ob == dialog_->check_auto_begin)
1502 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_BEGIN);
1503 if (ob == dialog_->check_auto_end)
1504 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_END);
1505 if (ob == dialog_->check_use_babel)
1506 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_USE_BABEL);
1507 if (ob == dialog_->check_global_options)
1508 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS);
1509 if (ob == dialog_->input_package)
1510 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_PACKAGE);
1511 if (ob == dialog_->input_command_begin)
1512 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_BEGIN);
1513 if (ob == dialog_->input_command_end)
1514 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_END);
1519 bool FormPreferences::Language::input(FL_OBJECT const * const ob)
1521 bool activate = true;
1523 // !ob if function is called from Language::build() to de/activate
1525 // otherwise the function is called by an xforms CB via input().
1526 if (!ob || ob == dialog_->check_use_kbmap) {
1527 bool const enable = fl_get_button(dialog_->check_use_kbmap);
1528 setEnabled(dialog_->button_kbmap1_browse, enable);
1529 setEnabled(dialog_->button_kbmap2_browse, enable);
1530 setEnabled(dialog_->input_kbmap1, enable);
1531 setEnabled(dialog_->input_kbmap2, enable);
1534 if (ob == dialog_->button_kbmap1_browse) {
1535 string f = parent_.controller().browsekbmap(
1536 fl_get_input(dialog_->input_kbmap1));
1538 fl_set_input(dialog_->input_kbmap1, f.c_str());
1539 } else if (ob == dialog_->button_kbmap2_browse) {
1540 string f = parent_.controller().browsekbmap(
1541 fl_get_input(dialog_->input_kbmap2));
1543 fl_set_input(dialog_->input_kbmap2, f.c_str());
1550 void FormPreferences::Language::update(LyXRC const & rc)
1552 fl_set_button(dialog_->check_use_kbmap,
1555 int const pos = int(findPos(lang_, rc.default_language));
1556 fl_set_combox(dialog_->combox_default_lang, pos + 1);
1559 fl_set_input(dialog_->input_kbmap1,
1560 rc.primary_kbmap.c_str());
1561 fl_set_input(dialog_->input_kbmap2,
1562 rc.secondary_kbmap.c_str());
1564 fl_set_input(dialog_->input_kbmap1, "");
1565 fl_set_input(dialog_->input_kbmap2, "");
1568 fl_set_button(dialog_->check_rtl_support, rc.rtl_support);
1569 fl_set_button(dialog_->check_mark_foreign,
1570 rc.mark_foreign_language);
1571 fl_set_button(dialog_->check_auto_begin, rc.language_auto_begin);
1572 fl_set_button(dialog_->check_auto_end, rc.language_auto_end);
1573 fl_set_button(dialog_->check_use_babel, rc.language_use_babel);
1574 fl_set_button(dialog_->check_global_options,
1575 rc.language_global_options);
1577 fl_set_input(dialog_->input_package,
1578 rc.language_package.c_str());
1579 fl_set_input(dialog_->input_command_begin,
1580 rc.language_command_begin.c_str());
1581 fl_set_input(dialog_->input_command_end,
1582 rc.language_command_end.c_str());
1584 // Activate/Deactivate the input fields dependent on the state of the
1590 FormPreferences::LnFmisc::LnFmisc(FormPreferences & p)
1595 FD_preferences_lnf_misc const * FormPreferences::LnFmisc::dialog()
1597 return dialog_.get();
1601 void FormPreferences::LnFmisc::apply(LyXRC & rc) const
1603 rc.auto_region_delete =
1604 fl_get_button(dialog_->check_auto_region_delete);
1605 rc.cursor_follows_scrollbar =
1606 fl_get_button(dialog_->check_cursor_follows_scrollbar);
1607 rc.dialogs_iconify_with_main =
1608 fl_get_button(dialog_->check_dialogs_iconify_with_main);
1609 rc.preview = fl_get_button(dialog_->check_preview_latex);
1610 rc.autosave = static_cast<unsigned int>
1611 (fl_get_counter_value(dialog_->counter_autosave));
1612 rc.wheel_jump = static_cast<unsigned int>
1613 (fl_get_counter_value(dialog_->counter_wm_jump));
1616 // lyx::graphics::DisplayType old_value = rc.display_graphics;
1617 switch (fl_get_choice(dialog_->choice_display)) {
1619 rc.display_graphics = lyx::graphics::NoDisplay;
1622 rc.display_graphics = lyx::graphics::ColorDisplay;
1625 rc.display_graphics = lyx::graphics::GrayscaleDisplay;
1628 rc.display_graphics = lyx::graphics::MonochromeDisplay;
1631 rc.display_graphics = lyx::graphics::ColorDisplay;
1635 #ifdef WITH_WARNINGS
1636 #warning FIXME!! The graphics cache no longer has a changeDisplay method.
1639 if (old_value != rc.display_graphics) {
1640 lyx::graphics::GCache & gc = lyx::graphics::GCache::get();
1647 void FormPreferences::LnFmisc::build()
1649 dialog_.reset(build_preferences_lnf_misc(&parent_));
1651 fl_set_counter_step(dialog_->counter_autosave, 1, 10);
1652 fl_set_counter_step(dialog_->counter_wm_jump, 1, 10);
1654 fl_set_counter_return(dialog_->counter_autosave, FL_RETURN_CHANGED);
1655 fl_set_counter_return(dialog_->counter_wm_jump, FL_RETURN_CHANGED);
1657 // set up the feedback mechanism
1658 setPrehandler(dialog_->check_auto_region_delete);
1659 setPrehandler(dialog_->counter_autosave);
1660 setPrehandler(dialog_->check_cursor_follows_scrollbar);
1661 setPrehandler(dialog_->check_dialogs_iconify_with_main);
1662 setPrehandler(dialog_->check_preview_latex);
1663 setPrehandler(dialog_->counter_wm_jump);
1665 fl_addto_choice(dialog_->choice_display,
1666 _("Monochrome|Grayscale|Color|Do not display").c_str());
1671 FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const
1673 if (ob == dialog_->check_auto_region_delete)
1674 return LyXRC::getDescription(LyXRC::RC_AUTOREGIONDELETE);
1675 if (ob == dialog_->check_cursor_follows_scrollbar)
1676 return LyXRC::getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR);
1677 if (ob == dialog_->check_dialogs_iconify_with_main)
1678 return LyXRC::getDescription(LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN);
1679 if (ob == dialog_->check_preview_latex)
1680 return LyXRC::getDescription(LyXRC::RC_PREVIEW);
1681 if (ob == dialog_->counter_autosave)
1682 return LyXRC::getDescription(LyXRC::RC_AUTOSAVE);
1683 if (ob == dialog_->counter_wm_jump)
1684 return LyXRC::getDescription(LyXRC::RC_WHEEL_JUMP);
1685 if (ob == dialog_->choice_display)
1686 return LyXRC::getDescription(LyXRC::RC_DISPLAY_GRAPHICS);
1691 void FormPreferences::LnFmisc::update(LyXRC const & rc)
1693 fl_set_button(dialog_->check_auto_region_delete,
1694 rc.auto_region_delete);
1695 fl_set_button(dialog_->check_cursor_follows_scrollbar,
1696 rc.cursor_follows_scrollbar);
1697 fl_set_button(dialog_->check_dialogs_iconify_with_main,
1698 rc.dialogs_iconify_with_main);
1699 fl_set_button(dialog_->check_preview_latex,
1701 fl_set_counter_value(dialog_->counter_autosave, rc.autosave);
1702 fl_set_counter_value(dialog_->counter_wm_jump, rc.wheel_jump);
1704 switch (rc.display_graphics) {
1705 case lyx::graphics::NoDisplay:
1706 fl_set_choice(dialog_->choice_display, 4);
1708 case lyx::graphics::ColorDisplay:
1709 fl_set_choice(dialog_->choice_display, 3);
1711 case lyx::graphics::GrayscaleDisplay:
1712 fl_set_choice(dialog_->choice_display, 2);
1714 case lyx::graphics::MonochromeDisplay:
1715 fl_set_choice(dialog_->choice_display, 1);
1718 fl_set_choice(dialog_->choice_display, 3);
1724 FormPreferences::OutputsMisc::OutputsMisc(FormPreferences & p)
1729 FD_preferences_outputs_misc const * FormPreferences::OutputsMisc::dialog()
1731 return dialog_.get();
1735 void FormPreferences::OutputsMisc::apply(LyXRC & rc) const
1737 rc.ascii_linelen = static_cast<unsigned int>
1738 (fl_get_counter_value(dialog_->counter_line_len));
1739 rc.fontenc = fl_get_input(dialog_->input_tex_encoding);
1742 fl_get_choice(dialog_->choice_default_papersize) - 1;
1743 rc.default_papersize = static_cast<PAPER_SIZE>(choice);
1745 rc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff);
1746 rc.chktex_command = fl_get_input(dialog_->input_checktex);
1747 rc.view_dvi_paper_option = fl_get_input(dialog_->input_paperoption);
1748 rc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt);
1752 void FormPreferences::OutputsMisc::build()
1754 dialog_.reset(build_preferences_outputs_misc(&parent_));
1756 fl_set_counter_step(dialog_->counter_line_len, 1, 10);
1758 fl_set_counter_return(dialog_->counter_line_len, FL_RETURN_CHANGED);
1759 fl_set_input_return(dialog_->input_tex_encoding, FL_RETURN_CHANGED);
1760 fl_set_input_return(dialog_->input_ascii_roff, FL_RETURN_CHANGED);
1761 fl_set_input_return(dialog_->input_checktex, FL_RETURN_CHANGED);
1762 fl_set_input_return(dialog_->input_paperoption, FL_RETURN_CHANGED);
1764 fl_addto_choice(dialog_->choice_default_papersize,
1765 _(" default | US letter | US legal "
1766 "| US executive | A3 | A4 | A5 | B5 ").c_str());
1768 // set up the feedback mechanism
1769 setPrehandler(dialog_->counter_line_len);
1770 setPrehandler(dialog_->input_tex_encoding);
1771 setPrehandler(dialog_->choice_default_papersize);
1772 setPrehandler(dialog_->input_ascii_roff);
1773 setPrehandler(dialog_->input_checktex);
1774 setPrehandler(dialog_->input_paperoption);
1775 setPrehandler(dialog_->check_autoreset_classopt);
1780 FormPreferences::OutputsMisc::feedback(FL_OBJECT const * const ob) const
1782 if (ob == dialog_->counter_line_len)
1783 return LyXRC::getDescription(LyXRC::RC_ASCII_LINELEN);
1784 if (ob == dialog_->input_tex_encoding)
1785 return LyXRC::getDescription(LyXRC::RC_FONT_ENCODING);
1786 if (ob == dialog_->input_ascii_roff)
1787 return LyXRC::getDescription(LyXRC::RC_ASCIIROFF_COMMAND);
1788 if (ob == dialog_->input_checktex)
1789 return LyXRC::getDescription(LyXRC::RC_CHKTEX_COMMAND);
1790 if (ob == dialog_->choice_default_papersize)
1791 return LyXRC::getDescription(LyXRC::RC_DEFAULT_PAPERSIZE);
1792 if (ob == dialog_->input_paperoption)
1793 return LyXRC::getDescription(LyXRC::RC_VIEWDVI_PAPEROPTION);
1794 if (ob == dialog_->check_autoreset_classopt)
1795 return LyXRC::getDescription(LyXRC::RC_AUTORESET_OPTIONS);
1800 void FormPreferences::OutputsMisc::update(LyXRC const & rc)
1802 fl_set_counter_value(dialog_->counter_line_len,
1804 fl_set_input(dialog_->input_tex_encoding,
1805 rc.fontenc.c_str());
1806 fl_set_choice(dialog_->choice_default_papersize,
1807 rc.default_papersize + 1);
1808 fl_set_input(dialog_->input_ascii_roff,
1809 rc.ascii_roff_command.c_str());
1810 fl_set_input(dialog_->input_checktex,
1811 rc.chktex_command.c_str());
1812 fl_set_input(dialog_->input_paperoption,
1813 rc.view_dvi_paper_option.c_str());
1814 fl_set_button(dialog_->check_autoreset_classopt,
1815 rc.auto_reset_options);
1820 FormPreferences::Paths::Paths(FormPreferences & p)
1825 FD_preferences_paths const * FormPreferences::Paths::dialog()
1827 return dialog_.get();
1831 void FormPreferences::Paths::apply(LyXRC & rc)
1833 rc.document_path = fl_get_input(dialog_->input_default_path);
1834 rc.template_path = fl_get_input(dialog_->input_template_path);
1836 int button = fl_get_button(dialog_->check_use_temp_dir);
1837 string str = fl_get_input(dialog_->input_temp_dir);
1841 rc.use_tempdir = button;
1842 rc.tempdir_path = str;
1844 button = fl_get_button(dialog_->check_last_files);
1845 str = fl_get_input(dialog_->input_lastfiles);
1846 if (!button) str.erase();
1848 rc.check_lastfiles = button;
1850 rc.num_lastfiles = static_cast<unsigned int>
1851 (fl_get_counter_value(dialog_->counter_lastfiles));
1853 button = fl_get_button(dialog_->check_make_backups);
1854 str = fl_get_input(dialog_->input_backup_path);
1858 rc.make_backup = button;
1859 rc.backupdir_path = str;
1861 rc.lyxpipes = fl_get_input(dialog_->input_serverpipe);
1868 void FormPreferences::Paths::build()
1870 dialog_.reset(build_preferences_paths(&parent_));
1872 fl_set_input_return(dialog_->input_default_path, FL_RETURN_CHANGED);
1873 fl_set_input_return(dialog_->input_template_path, FL_RETURN_CHANGED);
1874 fl_set_input_return(dialog_->input_temp_dir, FL_RETURN_CHANGED);
1875 fl_set_input_return(dialog_->input_lastfiles, FL_RETURN_CHANGED);
1876 fl_set_input_return(dialog_->input_backup_path, FL_RETURN_CHANGED);
1877 fl_set_counter_return(dialog_->counter_lastfiles, FL_RETURN_CHANGED);
1878 fl_set_input_return(dialog_->input_serverpipe, FL_RETURN_CHANGED);
1880 // set up the feedback mechanism
1881 setPrehandler(dialog_->input_default_path);
1882 setPrehandler(dialog_->counter_lastfiles);
1883 setPrehandler(dialog_->input_template_path);
1884 setPrehandler(dialog_->check_last_files);
1885 setPrehandler(dialog_->input_lastfiles);
1886 setPrehandler(dialog_->check_make_backups);
1887 setPrehandler(dialog_->input_backup_path);
1888 setPrehandler(dialog_->input_serverpipe);
1889 setPrehandler(dialog_->input_temp_dir);
1890 setPrehandler(dialog_->check_use_temp_dir);
1895 FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const
1897 if (ob == dialog_->input_default_path)
1898 return LyXRC::getDescription(LyXRC::RC_DOCUMENTPATH);
1899 if (ob == dialog_->input_template_path)
1900 return LyXRC::getDescription(LyXRC::RC_TEMPLATEPATH);
1901 if (ob == dialog_->check_use_temp_dir)
1902 return LyXRC::getDescription(LyXRC::RC_USETEMPDIR);
1903 if (ob == dialog_->input_temp_dir)
1904 return LyXRC::getDescription(LyXRC::RC_TEMPDIRPATH);
1905 if (ob == dialog_->check_last_files)
1906 return LyXRC::getDescription(LyXRC::RC_CHECKLASTFILES);
1907 if (ob == dialog_->input_lastfiles)
1908 return LyXRC::getDescription(LyXRC::RC_LASTFILES);
1909 if (ob == dialog_->counter_lastfiles)
1910 return LyXRC::getDescription(LyXRC::RC_NUMLASTFILES);
1911 if (ob == dialog_->check_make_backups)
1912 return LyXRC::getDescription(LyXRC::RC_MAKE_BACKUP);
1913 if (ob == dialog_->input_backup_path)
1914 return LyXRC::getDescription(LyXRC::RC_BACKUPDIR_PATH);
1915 if (ob == dialog_->input_serverpipe)
1916 return LyXRC::getDescription(LyXRC::RC_SERVERPIPE);
1921 bool FormPreferences::Paths::input(FL_OBJECT const * const ob)
1923 bool activate = true;
1925 // !ob if function is called from Paths::update() to de/activate
1927 // otherwise the function is called by an xforms CB via input().
1928 if (!ob || ob == dialog_->check_use_temp_dir) {
1929 bool const enable = fl_get_button(dialog_->check_use_temp_dir);
1930 setEnabled(dialog_->input_temp_dir, enable);
1933 if (!ob || ob == dialog_->check_last_files) {
1934 bool const enable = fl_get_button(dialog_->check_last_files);
1935 setEnabled(dialog_->input_lastfiles, enable);
1938 if (!ob || ob == dialog_->check_make_backups) {
1939 bool const enable = fl_get_button(dialog_->check_make_backups);
1940 setEnabled(dialog_->input_backup_path, enable);
1943 if (!ob || ob == dialog_->input_default_path) {
1944 string const name = fl_get_input(dialog_->input_default_path);
1945 if (!name.empty() && !RWInfo::WriteableDir(name)) {
1946 parent_.postWarning(RWInfo::ErrorMessage());
1951 if (!ob || ob == dialog_->input_template_path) {
1952 string const name = fl_get_input(dialog_->input_template_path);
1953 if (!name.empty() && !RWInfo::ReadableDir(name)) {
1954 parent_.postWarning(RWInfo::ErrorMessage());
1959 if (!ob || ob == dialog_->input_temp_dir) {
1960 string const name = fl_get_input(dialog_->input_temp_dir);
1961 if (fl_get_button(dialog_->check_make_backups)
1963 && !RWInfo::WriteableDir(name)) {
1964 parent_.postWarning(RWInfo::ErrorMessage());
1969 if (!ob || ob == dialog_->input_backup_path) {
1970 string const name = fl_get_input(dialog_->input_backup_path);
1971 if (fl_get_button(dialog_->check_make_backups)
1973 && !RWInfo::WriteableDir(name)) {
1974 parent_.postWarning(RWInfo::ErrorMessage());
1979 if (!ob || ob == dialog_->input_lastfiles) {
1980 string const name = fl_get_input(dialog_->input_lastfiles);
1981 if (fl_get_button(dialog_->check_last_files)
1983 && !RWInfo::WriteableFile(name)) {
1984 parent_.postWarning(RWInfo::ErrorMessage());
1989 if (!ob || ob == dialog_->input_serverpipe) {
1990 string const name = fl_get_input(dialog_->input_serverpipe);
1991 if (!name.empty()) {
1992 // strip off the extension
1993 string const str = ChangeExtension(name, "");
1994 if (!RWInfo::WriteableFile(str + ".in")) {
1995 parent_.postWarning(RWInfo::ErrorMessage());
1998 if (!RWInfo::WriteableFile(str + ".out")) {
1999 parent_.postWarning(RWInfo::ErrorMessage());
2005 if (ob == dialog_->button_default_path_browse) {
2006 string f = parent_.controller().browsedir(
2007 fl_get_input(dialog_->input_default_path), _("Default path"));
2009 fl_set_input(dialog_->input_default_path, f.c_str());
2010 } else if (ob == dialog_->button_template_path_browse) {
2011 string f = parent_.controller().browsedir(
2012 fl_get_input(dialog_->input_template_path), _("Template path"));
2014 fl_set_input(dialog_->input_template_path, f.c_str());
2015 } else if (ob == dialog_->button_temp_dir_browse) {
2016 string f = parent_.controller().browsedir(
2017 fl_get_input(dialog_->input_temp_dir), _("Temporary dir"));
2019 fl_set_input(dialog_->input_temp_dir, f.c_str());
2020 } else if (ob == dialog_->button_lastfiles_browse) {
2021 string f = parent_.controller().browse(
2022 fl_get_input(dialog_->input_lastfiles), _("Last files"));
2024 fl_set_input(dialog_->input_lastfiles, f.c_str());
2025 } else if (ob == dialog_->button_backup_path_browse) {
2026 string f = parent_.controller().browsedir(
2027 fl_get_input(dialog_->input_backup_path), _("Backup path"));
2029 fl_set_input(dialog_->input_backup_path, f.c_str());
2030 } else if (ob == dialog_->button_serverpipe_browse) {
2031 string f = parent_.controller().browse(
2032 fl_get_input(dialog_->input_serverpipe), _("LyX server pipes"));
2034 fl_set_input(dialog_->input_serverpipe, f.c_str());
2041 void FormPreferences::Paths::update(LyXRC const & rc)
2043 fl_set_input(dialog_->input_default_path,
2044 rc.document_path.c_str());
2045 fl_set_input(dialog_->input_template_path,
2046 rc.template_path.c_str());
2050 str = rc.backupdir_path;
2052 fl_set_button(dialog_->check_make_backups,
2054 fl_set_input(dialog_->input_backup_path, str.c_str());
2058 str = rc.tempdir_path;
2060 fl_set_button(dialog_->check_use_temp_dir,
2062 fl_set_input(dialog_->input_temp_dir, str.c_str());
2065 if (rc.check_lastfiles)
2068 fl_set_button(dialog_->check_last_files,
2069 rc.check_lastfiles);
2070 fl_set_input(dialog_->input_lastfiles, str.c_str());
2071 fl_set_counter_value(dialog_->counter_lastfiles,
2074 fl_set_input(dialog_->input_serverpipe, rc.lyxpipes.c_str());
2076 // Activate/Deactivate the input fields dependent on the state of the
2082 FormPreferences::Printer::Printer(FormPreferences & p)
2087 FD_preferences_printer const * FormPreferences::Printer::dialog()
2089 return dialog_.get();
2093 void FormPreferences::Printer::apply(LyXRC & rc) const
2095 rc.print_adapt_output = fl_get_button(dialog_->check_adapt_output);
2096 rc.print_command = fl_get_input(dialog_->input_command);
2097 rc.print_pagerange_flag = fl_get_input(dialog_->input_page_range);
2098 rc.print_copies_flag = fl_get_input(dialog_->input_copies);
2099 rc.print_reverse_flag = fl_get_input(dialog_->input_reverse);
2100 rc.print_to_printer = fl_get_input(dialog_->input_to_printer);
2101 rc.print_file_extension =
2102 fl_get_input(dialog_->input_file_extension);
2103 rc.print_spool_command =
2104 fl_get_input(dialog_->input_spool_command);
2105 rc.print_paper_flag = fl_get_input(dialog_->input_paper_type);
2106 rc.print_evenpage_flag = fl_get_input(dialog_->input_even_pages);
2107 rc.print_oddpage_flag = fl_get_input(dialog_->input_odd_pages);
2108 rc.print_collcopies_flag = fl_get_input(dialog_->input_collated);
2109 rc.print_landscape_flag = fl_get_input(dialog_->input_landscape);
2110 rc.print_to_file = fl_get_input(dialog_->input_to_file);
2111 rc.print_extra_options =
2112 fl_get_input(dialog_->input_extra_options);
2113 rc.print_spool_printerprefix =
2114 fl_get_input(dialog_->input_spool_prefix);
2115 rc.print_paper_dimension_flag =
2116 fl_get_input(dialog_->input_paper_size);
2117 rc.printer = fl_get_input(dialog_->input_name);
2122 FormPreferences::Printer::feedback(FL_OBJECT const * const ob) const
2124 if (ob == dialog_->input_command)
2125 return LyXRC::getDescription(LyXRC::RC_PRINT_COMMAND);
2126 if (ob == dialog_->check_adapt_output)
2127 return LyXRC::getDescription(LyXRC::RC_PRINT_ADAPTOUTPUT);
2128 if (ob == dialog_->input_to_printer)
2129 return LyXRC::getDescription(LyXRC::RC_PRINTTOPRINTER);
2130 if (ob == dialog_->input_to_file)
2131 return LyXRC::getDescription(LyXRC::RC_PRINTTOFILE);
2132 if (ob == dialog_->input_file_extension)
2133 return LyXRC::getDescription(LyXRC::RC_PRINTFILEEXTENSION);
2134 if (ob == dialog_->input_extra_options)
2135 return LyXRC::getDescription(LyXRC::RC_PRINTEXSTRAOPTIONS);
2136 if (ob == dialog_->input_spool_command)
2137 return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_COMMAND);
2138 if (ob == dialog_->input_spool_prefix)
2139 return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_PRINTERPREFIX);
2140 if (ob == dialog_->input_name)
2141 return LyXRC::getDescription(LyXRC::RC_PRINTER);
2142 if (ob == dialog_->input_even_pages)
2143 return LyXRC::getDescription(LyXRC::RC_PRINTEVENPAGEFLAG);
2144 if (ob == dialog_->input_odd_pages)
2145 return LyXRC::getDescription(LyXRC::RC_PRINTODDPAGEFLAG);
2146 if (ob == dialog_->input_page_range)
2147 return LyXRC::getDescription(LyXRC::RC_PRINTPAGERANGEFLAG);
2148 if (ob == dialog_->input_reverse)
2149 return LyXRC::getDescription(LyXRC::RC_PRINTREVERSEFLAG);
2150 if (ob == dialog_->input_landscape)
2151 return LyXRC::getDescription(LyXRC::RC_PRINTLANDSCAPEFLAG);
2152 if (ob == dialog_->input_copies)
2153 return LyXRC::getDescription(LyXRC::RC_PRINTCOPIESFLAG);
2154 if (ob == dialog_->input_collated)
2155 return LyXRC::getDescription(LyXRC::RC_PRINTCOLLCOPIESFLAG);
2156 if (ob == dialog_->input_paper_type)
2157 return LyXRC::getDescription(LyXRC::RC_PRINTPAPERFLAG);
2158 if (ob == dialog_->input_paper_size)
2159 return LyXRC::getDescription(LyXRC::RC_PRINTPAPERDIMENSIONFLAG);
2164 void FormPreferences::Printer::build()
2166 dialog_.reset(build_preferences_printer(&parent_));
2168 fl_set_input_return(dialog_->input_command, FL_RETURN_CHANGED);
2169 fl_set_input_return(dialog_->input_page_range, FL_RETURN_CHANGED);
2170 fl_set_input_return(dialog_->input_copies, FL_RETURN_CHANGED);
2171 fl_set_input_return(dialog_->input_reverse, FL_RETURN_CHANGED);
2172 fl_set_input_return(dialog_->input_to_printer, FL_RETURN_CHANGED);
2173 fl_set_input_return(dialog_->input_file_extension, FL_RETURN_CHANGED);
2174 fl_set_input_return(dialog_->input_spool_command, FL_RETURN_CHANGED);
2175 fl_set_input_return(dialog_->input_paper_type, FL_RETURN_CHANGED);
2176 fl_set_input_return(dialog_->input_even_pages, FL_RETURN_CHANGED);
2177 fl_set_input_return(dialog_->input_odd_pages, FL_RETURN_CHANGED);
2178 fl_set_input_return(dialog_->input_collated, FL_RETURN_CHANGED);
2179 fl_set_input_return(dialog_->input_landscape, FL_RETURN_CHANGED);
2180 fl_set_input_return(dialog_->input_to_file, FL_RETURN_CHANGED);
2181 fl_set_input_return(dialog_->input_extra_options, FL_RETURN_CHANGED);
2182 fl_set_input_return(dialog_->input_spool_prefix, FL_RETURN_CHANGED);
2183 fl_set_input_return(dialog_->input_paper_size, FL_RETURN_CHANGED);
2184 fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
2186 // set up the feedback mechanism
2187 setPrehandler(dialog_->input_command);
2188 setPrehandler(dialog_->input_page_range);
2189 setPrehandler(dialog_->input_copies);
2190 setPrehandler(dialog_->input_reverse);
2191 setPrehandler(dialog_->input_to_printer);
2192 setPrehandler(dialog_->input_file_extension);
2193 setPrehandler(dialog_->input_spool_command);
2194 setPrehandler(dialog_->input_paper_type);
2195 setPrehandler(dialog_->input_even_pages);
2196 setPrehandler(dialog_->input_odd_pages);
2197 setPrehandler(dialog_->input_collated);
2198 setPrehandler(dialog_->input_landscape);
2199 setPrehandler(dialog_->input_to_file);
2200 setPrehandler(dialog_->input_extra_options);
2201 setPrehandler(dialog_->input_spool_prefix);
2202 setPrehandler(dialog_->input_paper_size);
2203 setPrehandler(dialog_->input_name);
2204 setPrehandler(dialog_->check_adapt_output);
2208 void FormPreferences::Printer::update(LyXRC const & rc)
2210 fl_set_button(dialog_->check_adapt_output,
2211 rc.print_adapt_output);
2212 fl_set_input(dialog_->input_command,
2213 rc.print_command.c_str());
2214 fl_set_input(dialog_->input_page_range,
2215 rc.print_pagerange_flag.c_str());
2216 fl_set_input(dialog_->input_copies,
2217 rc.print_copies_flag.c_str());
2218 fl_set_input(dialog_->input_reverse,
2219 rc.print_reverse_flag.c_str());
2220 fl_set_input(dialog_->input_to_printer,
2221 rc.print_to_printer.c_str());
2222 fl_set_input(dialog_->input_file_extension,
2223 rc.print_file_extension.c_str());
2224 fl_set_input(dialog_->input_spool_command,
2225 rc.print_spool_command.c_str());
2226 fl_set_input(dialog_->input_paper_type,
2227 rc.print_paper_flag.c_str());
2228 fl_set_input(dialog_->input_even_pages,
2229 rc.print_evenpage_flag.c_str());
2230 fl_set_input(dialog_->input_odd_pages,
2231 rc.print_oddpage_flag.c_str());
2232 fl_set_input(dialog_->input_collated,
2233 rc.print_collcopies_flag.c_str());
2234 fl_set_input(dialog_->input_landscape,
2235 rc.print_landscape_flag.c_str());
2236 fl_set_input(dialog_->input_to_file,
2237 rc.print_to_file.c_str());
2238 fl_set_input(dialog_->input_extra_options,
2239 rc.print_extra_options.c_str());
2240 fl_set_input(dialog_->input_spool_prefix,
2241 rc.print_spool_printerprefix.c_str());
2242 fl_set_input(dialog_->input_paper_size,
2243 rc.print_paper_dimension_flag.c_str());
2244 fl_set_input(dialog_->input_name,
2245 rc.printer.c_str());
2249 FormPreferences::ScreenFonts::ScreenFonts(FormPreferences & p)
2254 FD_preferences_screen_fonts const * FormPreferences::ScreenFonts::dialog()
2256 return dialog_.get();
2260 void FormPreferences::ScreenFonts::apply(LyXRC & rc) const
2262 bool changed = false;
2264 pair<string, string> tmp =
2265 parseFontName(fl_get_input(dialog_->input_roman));
2266 if (rc.roman_font_name != tmp.first ||
2267 rc.roman_font_foundry != tmp.second) {
2269 rc.roman_font_name = tmp.first;
2270 rc.roman_font_foundry = tmp.second;
2273 tmp = parseFontName(fl_get_input(dialog_->input_sans));
2274 if (rc.sans_font_name != tmp.first ||
2275 rc.sans_font_foundry != tmp.second) {
2277 rc.sans_font_name = tmp.first;
2278 rc.sans_font_foundry = tmp.second;
2281 tmp = parseFontName(fl_get_input(dialog_->input_typewriter));
2282 if (rc.typewriter_font_name != tmp.first ||
2283 rc.typewriter_font_foundry != tmp.second) {
2285 rc.typewriter_font_name = tmp.first;
2286 rc.typewriter_font_foundry = tmp.second;
2289 string str = fl_get_input(dialog_->input_screen_encoding);
2290 if (rc.font_norm != str) {
2293 rc.set_font_norm_type();
2296 bool button = fl_get_button(dialog_->check_scalable);
2297 if (rc.use_scalable_fonts != button) {
2299 rc.use_scalable_fonts = button;
2302 unsigned int ivalue = static_cast<unsigned int>
2303 (fl_get_counter_value(dialog_->counter_zoom));
2304 if (rc.zoom != ivalue) {
2309 ivalue = static_cast<unsigned int>
2310 (fl_get_counter_value(dialog_->counter_dpi));
2311 if (rc.dpi != ivalue) {
2316 double dvalue = strToDbl(fl_get_input(dialog_->input_tiny));
2317 if (rc.font_sizes[LyXFont::SIZE_TINY] != dvalue) {
2319 rc.font_sizes[LyXFont::SIZE_TINY] = dvalue;
2322 dvalue = strToDbl(fl_get_input(dialog_->input_script));
2323 if (rc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue) {
2325 rc.font_sizes[LyXFont::SIZE_SCRIPT] = dvalue;
2328 dvalue = strToDbl(fl_get_input(dialog_->input_footnote));
2329 if (rc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue) {
2331 rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = dvalue;
2334 dvalue = strToDbl(fl_get_input(dialog_->input_small));
2335 if (rc.font_sizes[LyXFont::SIZE_SMALL] != dvalue) {
2337 rc.font_sizes[LyXFont::SIZE_SMALL] = dvalue;
2340 dvalue = strToDbl(fl_get_input(dialog_->input_normal));
2341 if (rc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue) {
2343 rc.font_sizes[LyXFont::SIZE_NORMAL] = dvalue;
2346 dvalue = strToDbl(fl_get_input(dialog_->input_large));
2347 if (rc.font_sizes[LyXFont::SIZE_LARGE] != dvalue) {
2349 rc.font_sizes[LyXFont::SIZE_LARGE] = dvalue;
2352 dvalue = strToDbl(fl_get_input(dialog_->input_larger));
2353 if (rc.font_sizes[LyXFont::SIZE_LARGER] != dvalue) {
2355 rc.font_sizes[LyXFont::SIZE_LARGER] = dvalue;
2358 dvalue = strToDbl(fl_get_input(dialog_->input_largest));
2359 if (rc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue) {
2361 rc.font_sizes[LyXFont::SIZE_LARGEST] = dvalue;
2364 dvalue = strToDbl(fl_get_input(dialog_->input_huge));
2365 if (rc.font_sizes[LyXFont::SIZE_HUGE] != dvalue) {
2367 rc.font_sizes[LyXFont::SIZE_HUGE] = dvalue;
2370 dvalue = strToDbl(fl_get_input(dialog_->input_huger));
2371 if (rc.font_sizes[LyXFont::SIZE_HUGER] != dvalue) {
2373 rc.font_sizes[LyXFont::SIZE_HUGER] = dvalue;
2377 // Now update the buffers
2378 // Can anything below here affect the redraw process?
2379 parent_.controller().updateScreenFonts();
2384 void FormPreferences::ScreenFonts::build()
2386 dialog_.reset(build_preferences_screen_fonts(&parent_));
2388 fl_set_counter_step(dialog_->counter_zoom, 1, 10);
2389 fl_set_counter_step(dialog_->counter_dpi, 1, 10);
2391 fl_set_input_return(dialog_->input_roman, FL_RETURN_CHANGED);
2392 fl_set_input_return(dialog_->input_sans, FL_RETURN_CHANGED);
2393 fl_set_input_return(dialog_->input_typewriter, FL_RETURN_CHANGED);
2394 fl_set_input_return(dialog_->input_screen_encoding, FL_RETURN_CHANGED);
2395 fl_set_counter_return(dialog_->counter_zoom, FL_RETURN_CHANGED);
2396 fl_set_counter_return(dialog_->counter_dpi, FL_RETURN_CHANGED);
2397 fl_set_input_return(dialog_->input_tiny, FL_RETURN_CHANGED);
2398 fl_set_input_return(dialog_->input_script, FL_RETURN_CHANGED);
2399 fl_set_input_return(dialog_->input_footnote, FL_RETURN_CHANGED);
2400 fl_set_input_return(dialog_->input_small, FL_RETURN_CHANGED);
2401 fl_set_input_return(dialog_->input_normal, FL_RETURN_CHANGED);
2402 fl_set_input_return(dialog_->input_large, FL_RETURN_CHANGED);
2403 fl_set_input_return(dialog_->input_larger, FL_RETURN_CHANGED);
2404 fl_set_input_return(dialog_->input_largest, FL_RETURN_CHANGED);
2405 fl_set_input_return(dialog_->input_huge, FL_RETURN_CHANGED);
2406 fl_set_input_return(dialog_->input_huger, FL_RETURN_CHANGED);
2408 fl_set_input_filter(dialog_->input_tiny, fl_unsigned_float_filter);
2409 fl_set_input_filter(dialog_->input_script, fl_unsigned_float_filter);
2410 fl_set_input_filter(dialog_->input_footnote, fl_unsigned_float_filter);
2411 fl_set_input_filter(dialog_->input_small, fl_unsigned_float_filter);
2412 fl_set_input_filter(dialog_->input_normal, fl_unsigned_float_filter);
2413 fl_set_input_filter(dialog_->input_large, fl_unsigned_float_filter);
2414 fl_set_input_filter(dialog_->input_larger, fl_unsigned_float_filter);
2415 fl_set_input_filter(dialog_->input_largest, fl_unsigned_float_filter);
2416 fl_set_input_filter(dialog_->input_huge, fl_unsigned_float_filter);
2417 fl_set_input_filter(dialog_->input_huger, fl_unsigned_float_filter);
2419 // set up the feedback mechanism
2420 setPrehandler(dialog_->input_roman);
2421 setPrehandler(dialog_->input_sans);
2422 setPrehandler(dialog_->input_typewriter);
2423 setPrehandler(dialog_->counter_zoom);
2424 setPrehandler(dialog_->counter_dpi);
2425 setPrehandler(dialog_->check_scalable);
2426 setPrehandler(dialog_->input_screen_encoding);
2427 setPrehandler(dialog_->input_tiny);
2428 setPrehandler(dialog_->input_script);
2429 setPrehandler(dialog_->input_footnote);
2430 setPrehandler(dialog_->input_small);
2431 setPrehandler(dialog_->input_large);
2432 setPrehandler(dialog_->input_larger);
2433 setPrehandler(dialog_->input_largest);
2434 setPrehandler(dialog_->input_normal);
2435 setPrehandler(dialog_->input_huge);
2436 setPrehandler(dialog_->input_huger);
2441 FormPreferences::ScreenFonts::feedback(FL_OBJECT const * const ob) const
2443 if (ob == dialog_->input_roman)
2444 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ROMAN);
2445 if (ob == dialog_->input_sans)
2446 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SANS);
2447 if (ob == dialog_->input_typewriter)
2448 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_TYPEWRITER);
2449 if (ob == dialog_->check_scalable)
2450 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SCALABLE);
2451 if (ob == dialog_->input_screen_encoding)
2452 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ENCODING);
2453 if (ob == dialog_->counter_zoom)
2454 return LyXRC::getDescription(LyXRC::RC_SCREEN_ZOOM);
2455 if (ob == dialog_->counter_dpi)
2456 return LyXRC::getDescription(LyXRC::RC_SCREEN_DPI);
2457 if (ob == dialog_->input_tiny
2458 || ob == dialog_->input_script
2459 || ob == dialog_->input_footnote
2460 || ob == dialog_->input_small
2461 || ob == dialog_->input_large
2462 || ob == dialog_->input_larger
2463 || ob == dialog_->input_larger
2464 || ob == dialog_->input_largest
2465 || ob == dialog_->input_normal
2466 || ob == dialog_->input_huge
2467 || ob == dialog_->input_huger)
2468 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SIZES);
2473 bool FormPreferences::ScreenFonts::input()
2475 bool activate = true;
2478 // Make sure that all fonts all have positive entries
2479 // Also note that an empty entry is returned as 0.0 by strToDbl
2480 if (0.0 >= strToDbl(fl_get_input(dialog_->input_tiny))
2481 || 0.0 >= strToDbl(fl_get_input(dialog_->input_script))
2482 || 0.0 >= strToDbl(fl_get_input(dialog_->input_footnote))
2483 || 0.0 >= strToDbl(fl_get_input(dialog_->input_small))
2484 || 0.0 >= strToDbl(fl_get_input(dialog_->input_normal))
2485 || 0.0 >= strToDbl(fl_get_input(dialog_->input_large))
2486 || 0.0 >= strToDbl(fl_get_input(dialog_->input_larger))
2487 || 0.0 >= strToDbl(fl_get_input(dialog_->input_largest))
2488 || 0.0 >= strToDbl(fl_get_input(dialog_->input_huge))
2489 || 0.0 >= strToDbl(fl_get_input(dialog_->input_huger))) {
2491 str = _("Fonts must be positive!");
2493 } else if (strToDbl(fl_get_input(dialog_->input_tiny)) >
2494 // Fontsizes -- tiny < script < footnote etc.
2495 strToDbl(fl_get_input(dialog_->input_script)) ||
2496 strToDbl(fl_get_input(dialog_->input_script)) >
2497 strToDbl(fl_get_input(dialog_->input_footnote)) ||
2498 strToDbl(fl_get_input(dialog_->input_footnote)) >
2499 strToDbl(fl_get_input(dialog_->input_small)) ||
2500 strToDbl(fl_get_input(dialog_->input_small)) >
2501 strToDbl(fl_get_input(dialog_->input_normal)) ||
2502 strToDbl(fl_get_input(dialog_->input_normal)) >
2503 strToDbl(fl_get_input(dialog_->input_large)) ||
2504 strToDbl(fl_get_input(dialog_->input_large)) >
2505 strToDbl(fl_get_input(dialog_->input_larger)) ||
2506 strToDbl(fl_get_input(dialog_->input_larger)) >
2507 strToDbl(fl_get_input(dialog_->input_largest)) ||
2508 strToDbl(fl_get_input(dialog_->input_largest)) >
2509 strToDbl(fl_get_input(dialog_->input_huge)) ||
2510 strToDbl(fl_get_input(dialog_->input_huge)) >
2511 strToDbl(fl_get_input(dialog_->input_huger))) {
2514 str = _("Fonts must be input in the order Tiny > Smallest > Smaller > Small > Normal > Large > Larger > Largest > Huge > Huger.");
2518 parent_.postWarning(str);
2524 void FormPreferences::ScreenFonts::update(LyXRC const & rc)
2526 fl_set_input(dialog_->input_roman,
2527 makeFontName(rc.roman_font_name,
2528 rc.roman_font_foundry).c_str());
2529 fl_set_input(dialog_->input_sans,
2530 makeFontName(rc.sans_font_name,
2531 rc.sans_font_foundry).c_str());
2532 fl_set_input(dialog_->input_typewriter,
2533 makeFontName(rc.typewriter_font_name,
2534 rc.typewriter_font_foundry).c_str());
2535 fl_set_input(dialog_->input_screen_encoding,
2536 rc.font_norm.c_str());
2537 fl_set_button(dialog_->check_scalable,
2538 rc.use_scalable_fonts);
2539 fl_set_counter_value(dialog_->counter_zoom, rc.zoom);
2540 fl_set_counter_value(dialog_->counter_dpi, rc.dpi);
2541 fl_set_input(dialog_->input_tiny,
2542 tostr(rc.font_sizes[LyXFont::SIZE_TINY]).c_str());
2543 fl_set_input(dialog_->input_script,
2544 tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str());
2545 fl_set_input(dialog_->input_footnote,
2546 tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str());
2547 fl_set_input(dialog_->input_small,
2548 tostr(rc.font_sizes[LyXFont::SIZE_SMALL]).c_str());
2549 fl_set_input(dialog_->input_normal,
2550 tostr(rc.font_sizes[LyXFont::SIZE_NORMAL]).c_str());
2551 fl_set_input(dialog_->input_large,
2552 tostr(rc.font_sizes[LyXFont::SIZE_LARGE]).c_str());
2553 fl_set_input(dialog_->input_larger,
2554 tostr(rc.font_sizes[LyXFont::SIZE_LARGER]).c_str());
2555 fl_set_input(dialog_->input_largest,
2556 tostr(rc.font_sizes[LyXFont::SIZE_LARGEST]).c_str());
2557 fl_set_input(dialog_->input_huge,
2558 tostr(rc.font_sizes[LyXFont::SIZE_HUGE]).c_str());
2559 fl_set_input(dialog_->input_huger,
2560 tostr(rc.font_sizes[LyXFont::SIZE_HUGER]).c_str());
2565 FormPreferences::SpellOptions::SpellOptions(FormPreferences & p)
2570 FD_preferences_spelloptions const * FormPreferences::SpellOptions::dialog()
2572 return dialog_.get();
2576 void FormPreferences::SpellOptions::apply(LyXRC & rc)
2578 string choice = fl_get_choice_text(dialog_->choice_spell_command);
2579 choice = trim(choice);
2581 rc.isp_command = choice;
2584 // If spell checker == "none", all other input set to off.
2585 if (fl_get_choice(dialog_->choice_spell_command) == 1) {
2586 rc.isp_use_alt_lang = false;
2587 rc.isp_alt_lang.erase();
2589 rc.isp_use_esc_chars = false;
2590 rc.isp_esc_chars.erase();
2592 rc.isp_use_pers_dict = false;
2593 rc.isp_pers_dict.erase();
2595 rc.isp_accept_compound = false;
2596 rc.isp_use_input_encoding = false;
2599 int button = fl_get_button(dialog_->check_alt_lang);
2600 choice = fl_get_input(dialog_->input_alt_lang);
2601 if (button && choice.empty()) button = 0;
2602 if (!button) choice.erase();
2604 rc.isp_use_alt_lang = static_cast<bool>(button);
2605 rc.isp_alt_lang = choice;
2607 button = fl_get_button(dialog_->check_escape_chars);
2608 choice = fl_get_input(dialog_->input_escape_chars);
2609 if (button && choice.empty()) button = 0;
2610 if (!button) choice.erase();
2612 rc.isp_use_esc_chars = static_cast<bool>(button);
2613 rc.isp_esc_chars = choice;
2615 button = fl_get_button(dialog_->check_personal_dict);
2616 choice = fl_get_input(dialog_->input_personal_dict);
2617 if (button && choice.empty()) button = 0;
2618 if (!button) choice.erase();
2620 rc.isp_use_pers_dict = static_cast<bool>(button);
2621 rc.isp_pers_dict = choice;
2623 button = fl_get_button(dialog_->check_compound_words);
2624 rc.isp_accept_compound = static_cast<bool>(button);
2626 button = fl_get_button(dialog_->check_input_enc);
2627 rc.isp_use_input_encoding = static_cast<bool>(button);
2638 void FormPreferences::SpellOptions::build()
2640 dialog_.reset(build_preferences_spelloptions(&parent_));
2642 fl_addto_choice(dialog_->choice_spell_command,
2643 _(" ispell | aspell ").c_str());
2644 fl_set_input_return(dialog_->input_alt_lang, FL_RETURN_CHANGED);
2645 fl_set_input_return(dialog_->input_escape_chars, FL_RETURN_CHANGED);
2646 fl_set_input_return(dialog_->input_personal_dict, FL_RETURN_CHANGED);
2648 // set up the feedback mechanism
2649 setPrehandler(dialog_->choice_spell_command);
2650 setPrehandler(dialog_->check_alt_lang);
2651 setPrehandler(dialog_->input_alt_lang);
2652 setPrehandler(dialog_->check_escape_chars);
2653 setPrehandler(dialog_->input_escape_chars);
2654 setPrehandler(dialog_->check_personal_dict);
2655 setPrehandler(dialog_->input_personal_dict);
2656 setPrehandler(dialog_->button_personal_dict);
2657 setPrehandler(dialog_->check_compound_words);
2658 setPrehandler(dialog_->check_input_enc);
2663 FormPreferences::SpellOptions::feedback(FL_OBJECT const * const ob) const
2665 if (ob == dialog_->choice_spell_command)
2666 return LyXRC::getDescription(LyXRC::RC_SPELL_COMMAND);
2667 if (ob == dialog_->check_alt_lang)
2668 return LyXRC::getDescription(LyXRC::RC_USE_ALT_LANG);
2669 if (ob == dialog_->input_alt_lang)
2670 return LyXRC::getDescription(LyXRC::RC_ALT_LANG);
2671 if (ob == dialog_->check_escape_chars)
2672 return LyXRC::getDescription(LyXRC::RC_USE_ESC_CHARS);
2673 if (ob == dialog_->input_escape_chars)
2674 return LyXRC::getDescription(LyXRC::RC_ESC_CHARS);
2675 if (ob == dialog_->check_personal_dict)
2676 return LyXRC::getDescription(LyXRC::RC_USE_PERS_DICT);
2677 if (ob == dialog_->input_personal_dict)
2678 return LyXRC::getDescription(LyXRC::RC_PERS_DICT);
2679 if (ob == dialog_->check_compound_words)
2680 return LyXRC::getDescription(LyXRC::RC_ACCEPT_COMPOUND);
2681 if (ob == dialog_->check_input_enc)
2682 return LyXRC::getDescription(LyXRC::RC_USE_INP_ENC);
2687 bool FormPreferences::SpellOptions::input(FL_OBJECT const * const ob)
2689 // !ob if function is called from updateSpellOptions() to de/activate
2691 // otherwise the function is called by an xforms CB via input().
2694 // If spell checker == "none", disable all input.
2695 if (!ob || ob == dialog_->choice_spell_command) {
2696 if (fl_get_choice(dialog_->choice_spell_command) == 1) {
2697 fl_deactivate_object(dialog_->check_alt_lang);
2698 fl_deactivate_object(dialog_->input_alt_lang);
2699 fl_deactivate_object(dialog_->check_escape_chars);
2700 fl_deactivate_object(dialog_->input_escape_chars);
2701 fl_deactivate_object(dialog_->check_personal_dict);
2702 fl_deactivate_object(dialog_->input_personal_dict);
2703 fl_deactivate_object(dialog_->check_compound_words);
2704 fl_deactivate_object(dialog_->check_input_enc);
2707 fl_activate_object(dialog_->check_alt_lang);
2708 fl_activate_object(dialog_->check_escape_chars);
2709 fl_activate_object(dialog_->check_personal_dict);
2710 fl_activate_object(dialog_->check_compound_words);
2711 fl_activate_object(dialog_->check_input_enc);
2716 if (!ob || ob == dialog_->check_alt_lang) {
2717 bool const enable = fl_get_button(dialog_->check_alt_lang);
2718 setEnabled(dialog_->input_alt_lang, enable);
2721 if (!ob || ob == dialog_->check_escape_chars) {
2722 bool const enable = fl_get_button(dialog_->check_escape_chars);
2723 setEnabled(dialog_->input_escape_chars, enable);
2726 if (!ob || ob == dialog_->check_personal_dict) {
2727 bool const enable = fl_get_button(dialog_->check_personal_dict);
2728 setEnabled(dialog_->input_personal_dict, enable);
2731 if (ob == dialog_->button_personal_dict) {
2732 string f = parent_.controller().browsedict(
2733 fl_get_input(dialog_->input_personal_dict));
2734 fl_set_input(dialog_->input_personal_dict, f.c_str());
2737 return true; // All input is valid!
2741 void FormPreferences::SpellOptions::update(LyXRC const & rc)
2745 if (rc.isp_command == "none")
2747 else if (rc.isp_command == "ispell")
2749 else if (rc.isp_command == "aspell")
2752 if (rc.isp_command == "ispell")
2754 else if (rc.isp_command == "aspell")
2757 fl_set_choice(dialog_->choice_spell_command, choice);
2760 if (rc.isp_use_alt_lang)
2761 str = rc.isp_alt_lang;
2763 fl_set_button(dialog_->check_alt_lang,
2764 rc.isp_use_alt_lang);
2765 fl_set_input(dialog_->input_alt_lang, str.c_str());
2768 if (rc.isp_use_esc_chars)
2769 str = rc.isp_esc_chars;
2771 fl_set_button(dialog_->check_escape_chars,
2772 rc.isp_use_esc_chars);
2773 fl_set_input(dialog_->input_escape_chars, str.c_str());
2776 if (rc.isp_use_pers_dict)
2777 str = rc.isp_pers_dict;
2779 fl_set_button(dialog_->check_personal_dict,
2780 rc.isp_use_pers_dict);
2781 fl_set_input(dialog_->input_personal_dict, str.c_str());
2783 fl_set_button(dialog_->check_compound_words,
2784 rc.isp_accept_compound);
2785 fl_set_button(dialog_->check_input_enc,
2786 rc.isp_use_input_encoding);
2788 // Activate/Deactivate the input fields dependent on the state of the