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/filetools.h"
44 #include "support/LAssert.h"
46 #include "graphics/GraphicsCache.h"
47 #include "graphics/GraphicsTypes.h"
49 #include <boost/bind.hpp>
51 #include "lyx_forms.h"
67 extern string user_lyxdir;
69 using namespace lyx::support;
73 // These should probably go inside the class definition...
74 Formats local_formats;
75 Converters local_converters;
77 string makeFontName(string const & family, string const & foundry)
81 return family + ',' + foundry;
85 pair<string,string> parseFontName(string const & name)
87 string::size_type const idx = name.find(',');
88 if (idx == string::npos)
89 return make_pair(name, string());
90 return make_pair(name.substr(0, idx),
95 string const X11hexname(RGBColor const & col)
99 ostr << '#' << std::setbase(16) << setfill('0')
104 return STRCONV(ostr.str());
107 #if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
108 bool const scalableTabfolders = false;
110 bool const scalableTabfolders = true;
116 typedef FormCB<ControlPrefs, FormDB<FD_preferences> > base_class;
119 FormPreferences::FormPreferences()
120 : base_class(_("Preferences"), scalableTabfolders),
121 colors_(*this), converters_(*this), inputs_misc_(*this),
122 formats_(*this), interface_(*this), language_(*this),
123 lnf_misc_(*this), identity_(*this), outputs_misc_(*this),
124 paths_(*this), printer_(*this), screen_fonts_(*this),
130 void FormPreferences::redraw()
132 if (!(form() && form()->visible))
134 fl_redraw_form(form());
136 FL_FORM * form2 = fl_get_active_folder(dialog_->tabfolder_prefs);
137 if (!(form2 && form2->visible))
139 fl_redraw_form(form2);
142 if (form2 == converters_tab_->form)
143 form3 = fl_get_active_folder(converters_tab_->tabfolder_inner);
145 else if (form2 == look_n_feel_tab_->form)
146 form3 = fl_get_active_folder(look_n_feel_tab_->tabfolder_inner);
148 else if (form2 == inputs_tab_->form)
149 form3 = fl_get_active_folder(inputs_tab_->tabfolder_inner);
151 else if (form2 == outputs_tab_->form)
152 form3 = fl_get_active_folder(outputs_tab_->tabfolder_inner);
154 else if (form2 == lang_opts_tab_->form)
155 form3 = fl_get_active_folder(lang_opts_tab_->tabfolder_inner);
157 if (form3 && form3->visible)
158 fl_redraw_form(form3);
162 void FormPreferences::hide()
164 // We need to hide the active tabfolder otherwise we get a
165 // BadDrawable error from X window and LyX crashes without saving.
166 FL_FORM * inner_form = fl_get_active_folder(dialog_->tabfolder_prefs);
167 if (inner_form && inner_form->visible)
168 fl_hide_form(inner_form);
173 void FormPreferences::build()
175 dialog_.reset(build_preferences(this));
177 // Manage the restore, save, apply and cancel/close buttons
178 bcview().setOK(dialog_->button_ok);
179 bcview().setApply(dialog_->button_apply);
180 bcview().setCancel(dialog_->button_close);
181 bcview().setRestore(dialog_->button_restore);
183 // Allow the base class to control messages
184 setMessageWidget(dialog_->text_warning);
186 // build the tab folders
187 converters_tab_.reset(build_preferences_inner_tab(this));
188 look_n_feel_tab_.reset(build_preferences_inner_tab(this));
189 inputs_tab_.reset(build_preferences_inner_tab(this));
190 outputs_tab_.reset(build_preferences_inner_tab(this));
191 lang_opts_tab_.reset(build_preferences_inner_tab(this));
193 // build actual tabfolder contents
194 // these will become nested tabfolders
198 inputs_misc_.build();
203 outputs_misc_.build();
206 screen_fonts_.build();
207 spelloptions_.build();
209 // Enable the tabfolders to be rescaled correctly.
210 if (scalableTabfolders) {
211 FL_OBJECT * folder = dialog_->tabfolder_prefs;
212 fl_set_tabfolder_autofit(folder, FL_FIT);
214 folder = look_n_feel_tab_->tabfolder_inner;
215 fl_set_tabfolder_autofit(folder, FL_FIT);
217 folder = converters_tab_->tabfolder_inner;
218 fl_set_tabfolder_autofit(folder, FL_FIT);
220 folder = inputs_tab_->tabfolder_inner;
221 fl_set_tabfolder_autofit(folder, FL_FIT);
223 folder = outputs_tab_->tabfolder_inner;
224 fl_set_tabfolder_autofit(folder, FL_FIT);
226 folder = lang_opts_tab_->tabfolder_inner;
227 fl_set_tabfolder_autofit(folder, FL_FIT);
231 // Now add them to the tabfolder
232 fl_addto_tabfolder(dialog_->tabfolder_prefs,
233 _("Look & Feel").c_str(),
234 look_n_feel_tab_->form);
235 fl_addto_tabfolder(dialog_->tabfolder_prefs,
236 _("Lang Opts").c_str(),
237 lang_opts_tab_->form);
238 fl_addto_tabfolder(dialog_->tabfolder_prefs,
239 _("Conversion").c_str(),
240 converters_tab_->form);
241 fl_addto_tabfolder(dialog_->tabfolder_prefs,
244 fl_addto_tabfolder(dialog_->tabfolder_prefs,
245 _("Outputs").c_str(),
248 // now build the nested tabfolders
249 // Starting with look and feel
250 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
251 _("Screen Fonts").c_str(),
252 screen_fonts_.dialog()->form);
253 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
254 _("Interface").c_str(),
255 interface_.dialog()->form);
256 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
258 colors_.dialog()->form);
259 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
261 lnf_misc_.dialog()->form);
262 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
263 _("Identity").c_str(),
264 identity_.dialog()->form);
266 // then build converters
267 fl_addto_tabfolder(converters_tab_->tabfolder_inner,
268 _("Formats").c_str(),
269 formats_.dialog()->form);
270 fl_addto_tabfolder(converters_tab_->tabfolder_inner,
271 _("Converters").c_str(),
272 converters_.dialog()->form);
275 // Paths should probably go in a few inner_tab called Files
276 fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
278 paths_.dialog()->form);
279 fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
281 inputs_misc_.dialog()->form);
283 // then building outputs
284 fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
285 _("Printer").c_str(),
286 printer_.dialog()->form);
287 fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
289 outputs_misc_.dialog()->form);
291 // then building usage
292 fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
293 _("Spell checker").c_str(),
294 spelloptions_.dialog()->form);
295 fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
296 _("Language").c_str(),
297 language_.dialog()->form);
301 void FormPreferences::apply()
303 // set the new lyxrc entries
304 // many of these need to trigger other functions when the assignment
305 // is made. For example, screen zoom and font types. These could be
306 // handled either by signals/slots in lyxrc or just directly call the
307 // associated functions here.
308 // There are other problems with this scheme. We really should check
309 // what we copy to make sure that it really is necessary to do things
310 // like update the screen fonts because that flushes the textcache
311 // and other stuff which may cost us a lot on slower/high-load
314 LyXRC & rc(controller().rc());
317 formats_.apply(); // Must be before converters_.apply()
319 inputs_misc_.apply(rc);
320 interface_.apply(rc);
324 outputs_misc_.apply(rc);
327 screen_fonts_.apply(rc);
328 spelloptions_.apply(rc);
330 // The "Save" button has been pressed.
331 if (controller().isClosing() && colors_.modifiedXformsPrefs) {
332 string const filename =
333 AddName(user_lyxdir, "preferences.xform");
334 colors_.modifiedXformsPrefs = !XformsColor::write(filename);
339 string const FormPreferences::getFeedback(FL_OBJECT * ob)
343 if (ob->form->fdui == colors_.dialog())
344 return colors_.feedback(ob);
345 if (ob->form->fdui == converters_.dialog())
346 return converters_.feedback(ob);
347 if (ob->form->fdui == formats_.dialog())
348 return formats_.feedback(ob);
349 if (ob->form->fdui == inputs_misc_.dialog())
350 return inputs_misc_.feedback(ob);
351 if (ob->form->fdui == interface_.dialog())
352 return interface_.feedback(ob);
353 if (ob->form->fdui == language_.dialog())
354 return language_.feedback(ob);
355 if (ob->form->fdui == lnf_misc_.dialog())
356 return lnf_misc_.feedback(ob);
357 if (ob->form->fdui == outputs_misc_.dialog())
358 return outputs_misc_.feedback(ob);
359 if (ob->form->fdui == paths_.dialog())
360 return paths_.feedback(ob);
361 if (ob->form->fdui == printer_.dialog())
362 return printer_.feedback(ob);
363 if (ob->form->fdui == screen_fonts_.dialog())
364 return screen_fonts_.feedback(ob);
365 if (ob->form->fdui == spelloptions_.dialog())
366 return spelloptions_.feedback(ob);
372 ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long)
378 // whatever checks you need to ensure the user hasn't entered
379 // some totally ridiculous value somewhere. Change activate to suit.
380 // comments before each test describe what is _valid_
382 if (ob->form->fdui == colors_.dialog()) {
384 } else if (ob->form->fdui == converters_.dialog()) {
385 valid = converters_.input(ob);
386 } else if (ob->form->fdui == formats_.dialog()) {
387 valid = formats_.input(ob);
388 } else if (ob->form->fdui == interface_.dialog()) {
389 valid = interface_.input(ob);
390 } else if (ob->form->fdui == language_.dialog()) {
391 valid = language_.input(ob);
392 } else if (ob->form->fdui == paths_.dialog()) {
393 valid = paths_.input(ob);
394 } else if (ob->form->fdui == screen_fonts_.dialog()) {
395 valid = screen_fonts_.input();
396 } else if (ob->form->fdui == spelloptions_.dialog()) {
397 valid = spelloptions_.input(ob);
400 return valid ? ButtonPolicy::SMI_VALID : ButtonPolicy::SMI_INVALID;
404 void FormPreferences::update()
406 if (!dialog_.get()) return;
408 LyXRC const & rc(controller().rc());
410 // read lyxrc entries
412 formats_.update(); // Must be before converters_.update()
413 converters_.update();
414 inputs_misc_.update(rc);
415 interface_.update(rc);
416 language_.update(rc);
417 lnf_misc_.update(rc);
418 identity_.update(rc);
419 outputs_misc_.update(rc);
422 screen_fonts_.update(rc);
423 spelloptions_.update(rc);
427 FormPreferences::Colors::Colors(FormPreferences & p)
428 : modifiedXformsPrefs(false), parent_(p)
432 FD_preferences_colors const * FormPreferences::Colors::dialog()
434 return dialog_.get();
438 void FormPreferences::Colors::apply()
440 bool modifiedText = false;
441 bool modifiedBackground = false;
443 for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
444 cit != xformsColorDB.end(); ++cit) {
446 fl_getmcolor(cit->colorID, &col.r, &col.g, &col.b);
447 if (col != cit->color()) {
448 modifiedXformsPrefs = true;
449 if (cit->colorID == FL_BLACK)
451 if (cit->colorID == FL_COL1)
452 modifiedBackground = true;
456 if (modifiedXformsPrefs) {
457 for (vector<XformsColor>::const_iterator cit =
458 xformsColorDB.begin();
459 cit != xformsColorDB.end(); ++cit) {
460 fl_mapcolor(cit->colorID, cit->r, cit->g, cit->b);
462 if (modifiedText && cit->colorID == FL_BLACK) {
463 AdjustVal(FL_INACTIVE, FL_BLACK, 0.5);
466 if (modifiedBackground && cit->colorID == FL_COL1) {
467 AdjustVal(FL_MCOL, FL_COL1, 0.1);
468 AdjustVal(FL_TOP_BCOL, FL_COL1, 0.1);
469 AdjustVal(FL_LEFT_BCOL, FL_COL1, 0.1);
471 AdjustVal(FL_RIGHT_BCOL, FL_COL1, -0.5);
472 AdjustVal(FL_BOTTOM_BCOL, FL_COL1, -0.5);
475 if (cit->colorID == GUI_COLOR_CURSOR) {
476 fl_mapcolor(GUI_COLOR_CURSOR,
477 cit->r, cit->g, cit->b);
478 setCursorColor(GUI_COLOR_CURSOR);
481 parent_.controller().redrawGUI();
484 // Now do the same for the LyX LColors...
485 for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
486 cit != lyxColorDB.end(); ++cit) {
487 LColor::color lc = lcolor.getFromGUIName(cit->getname());
488 if (lc == LColor::inherit) continue;
490 // Create a valid X11 name of the form "#rrggbb"
491 string const hexname = X11hexname(cit->color());
493 if (lcolor.getX11Name(lc) != hexname) {
495 << "FormPreferences::Colors::apply: "
496 << "resetting LColor " << lcolor.getGUIName(lc)
497 << " from \"" << lcolor.getX11Name(lc)
498 << "\" to \"" << hexname << "\"."
501 parent_.controller().setColor(lc, hexname);
507 void FormPreferences::Colors::build()
509 picker_.reset(new FormColorpicker);
510 dialog_.reset(build_preferences_colors(&parent_));
512 fl_set_object_color(dialog_->button_color,
513 GUI_COLOR_CHOICE, GUI_COLOR_CHOICE);
515 // set up the feedback mechanism
516 setPrehandler(dialog_->browser_lyx_objs);
517 setPrehandler(dialog_->button_color);
518 setPrehandler(dialog_->button_modify);
523 FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
525 if (ob == dialog_->browser_lyx_objs)
526 return _("LyX objects that can be assigned a color.");
528 if (ob == dialog_->button_modify)
529 return _("Modify the LyX object's color. Note: you must then \"Apply\" the change.");
535 void FormPreferences::Colors::input(FL_OBJECT const * const ob)
537 if (ob == dialog_->browser_lyx_objs) {
540 } else if (ob == dialog_->button_modify) {
546 void FormPreferences::Colors::AdjustVal(int colAdjust, int colParent,
550 fl_getmcolor(colParent, &rgb.r, &rgb.g, &rgb.b);
554 hsv.v = min(1.0, max(0.0, hsv.v));
557 fl_mapcolor(colAdjust, rgb.r, rgb.g, rgb.b);
561 void FormPreferences::Colors::InputBrowserLyX() const
563 vector<NamedColor>::size_type const selLyX =
564 fl_get_browser(dialog_->browser_lyx_objs);
565 if (selLyX < 1) return;
567 // Is the choice an Xforms color...
570 if (selLyX - 1 < xformsColorDB.size()) {
571 vector<XformsColor>::size_type const i = selLyX - 1;
572 col = xformsColorDB[i].color();
574 // or a LyX Logical color?
576 vector<NamedColor>::size_type const i = selLyX - 1 -
577 xformsColorDB.size();
578 col = lyxColorDB[i].color();
581 fl_freeze_form(dialog_->form);
583 fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
584 fl_redraw_object(dialog_->button_color);
586 fl_unfreeze_form(dialog_->form);
590 void FormPreferences::Colors::LoadBrowserLyX()
592 if (!dialog_->browser_lyx_objs->visible)
595 // First, define the modifiable xforms colors
596 xformsColorDB.clear();
599 xcol.name = _("GUI background");
600 xcol.colorID = FL_COL1;
601 fl_getmcolor(FL_COL1, &xcol.r, &xcol.g, &xcol.b);
603 xformsColorDB.push_back(xcol);
605 xcol.name = _("GUI text");
606 xcol.colorID = FL_BLACK;
607 fl_getmcolor(FL_BLACK, &xcol.r, &xcol.g, &xcol.b);
609 xformsColorDB.push_back(xcol);
611 xcol.name = _("GUI selection");
612 xcol.colorID = FL_YELLOW;
613 fl_getmcolor(FL_YELLOW, &xcol.r, &xcol.g, &xcol.b);
615 xformsColorDB.push_back(xcol);
617 xcol.name = _("GUI pointer");
618 xcol.colorID = GUI_COLOR_CURSOR;
619 fl_getmcolor(GUI_COLOR_CURSOR, &xcol.r, &xcol.g, &xcol.b);
621 xformsColorDB.push_back(xcol);
623 // Now create the the LyX LColors database
625 for (int i=0; i<LColor::ignore; ++i) {
626 LColor::color lc = static_cast<LColor::color>(i);
627 if (lc == LColor::none
628 || lc == LColor::black
629 || lc == LColor::white
631 || lc == LColor::green
632 || lc == LColor::blue
633 || lc == LColor::cyan
634 || lc == LColor::magenta
635 || lc == LColor::yellow
636 || lc == LColor::inherit
637 || lc == LColor::ignore) continue;
640 bool const success = getRGBColor(lc, col.r, col.g, col.b);
642 lyxerr << "FormPreferences::Colors::LoadBrowserLyX:\n"
643 << "LColor " << lcolor.getLyXName(lc)
644 << ": X can't find color \""
645 << lcolor.getX11Name(lc)
646 << "\". Set to \"black\"!" << endl;
648 string const arg = lcolor.getLyXName(lc) + " black";
649 parent_.controller().setColor(lc, "black");
653 // Create a valid X11 name of the form "#rrggbb" and change the
654 // LColor X11name to this. Don't want to trigger a redraw,
655 // as we're just changing the name not the RGB values.
656 // Also reset the system_lcolor names, so that we don't output
657 // unnecessary changes.
658 string const hexname = X11hexname(col);
660 if (lcolor.getX11Name(lc) != hexname) {
661 lcolor.setColor(lc, hexname);
662 system_lcolor.setColor(lc, hexname);
665 // Finally, push the color onto the database
666 NamedColor ncol(lcolor.getGUIName(lc), col);
667 lyxColorDB.push_back(ncol);
670 // Now construct the browser
671 FL_OBJECT * colbr = dialog_->browser_lyx_objs;
672 fl_freeze_form(dialog_->form);
673 fl_clear_browser(colbr);
674 for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
675 cit != xformsColorDB.end(); ++cit) {
676 fl_addto_browser(colbr, cit->getname().c_str());
678 for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
679 cit != lyxColorDB.end(); ++cit) {
680 fl_addto_browser(colbr, cit->getname().c_str());
683 // just to be safe...
684 fl_set_browser_topline(dialog_->browser_lyx_objs, 1);
685 fl_select_browser_line(dialog_->browser_lyx_objs, 1);
686 fl_unfreeze_form(dialog_->form);
692 void FormPreferences::Colors::Modify()
694 vector<NamedColor>::size_type const selLyX =
695 fl_get_browser(dialog_->browser_lyx_objs);
700 fl_getmcolor(GUI_COLOR_CHOICE, &before.r, &before.g, &before.b);
702 RGBColor col = picker_->requestColor(before);
706 fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
707 fl_redraw_object(dialog_->button_color);
709 // Is the choice an Xforms color...
710 if (selLyX - 1 < xformsColorDB.size()) {
711 vector<XformsColor>::size_type const i = selLyX - 1;
712 xformsColorDB[i].r = col.r;
713 xformsColorDB[i].g = col.g;
714 xformsColorDB[i].b = col.b;
716 // or a LyX Logical color?
718 vector<NamedColor>::size_type const i = selLyX - 1 -
719 xformsColorDB.size();
720 lyxColorDB[i].r = col.r;
721 lyxColorDB[i].g = col.g;
722 lyxColorDB[i].b = col.b;
727 FormPreferences::Converters::Converters(FormPreferences & p)
732 FD_preferences_converters const * FormPreferences::Converters::dialog()
734 return dialog_.get();
738 void FormPreferences::Converters::apply() const
740 parent_.controller().setConverters(local_converters);
744 void FormPreferences::Converters::build()
746 dialog_.reset(build_preferences_converters(&parent_));
748 fl_set_input_return(dialog_->input_converter, FL_RETURN_CHANGED);
749 fl_set_input_return(dialog_->input_flags, FL_RETURN_CHANGED);
751 // set up the feedback mechanism
752 setPrehandler(dialog_->browser_all);
753 setPrehandler(dialog_->button_delete);
754 setPrehandler(dialog_->button_add);
755 setPrehandler(dialog_->input_converter);
756 setPrehandler(dialog_->choice_from);
757 setPrehandler(dialog_->choice_to);
758 setPrehandler(dialog_->input_flags);
763 FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const
765 if (ob == dialog_->browser_all)
766 return _("All explicitly defined converters for LyX");
768 if (ob == dialog_->choice_from)
769 return _("Convert \"from\" this format");
771 if (ob == dialog_->choice_to)
772 return _("Convert \"to\" this format");
774 if (ob == dialog_->input_converter)
775 return _("The conversion command. $$i is the input file name, "
776 "$$b is the file name without its extension and $$o is "
777 "the name of the output file. $$s can be used as path to "
778 "LyX's own collection of conversion scripts.");
780 if (ob == dialog_->input_flags)
781 return _("Extra information for the Converter class, whether and "
782 "how to parse the result, and various other things.");
784 if (ob == dialog_->button_delete)
785 return _("Remove the current converter from the list of available "
786 "converters. Note: you must then \"Apply\" the change.");
788 if (ob == dialog_->button_add) {
789 if (string(ob->label) == _("Add"))
790 return _("Add the current converter to the list of available "
791 "converters. Note: you must then \"Apply\" the change.");
793 return _("Modify the contents of the current converter. "
794 "Note: you must then \"Apply\" the change.");
801 bool FormPreferences::Converters::input(FL_OBJECT const * const ob)
803 if (ob == dialog_->browser_all)
806 if (ob == dialog_->choice_from
807 || ob == dialog_->choice_to
808 || ob == dialog_->input_converter
809 || ob == dialog_->input_flags)
812 if (ob == dialog_->button_add)
815 if (ob == dialog_->button_delete)
822 void FormPreferences::Converters::update()
824 local_converters = converters;
825 local_converters.update(local_formats);
830 void FormPreferences::Converters::UpdateBrowser()
832 local_converters.sort();
834 fl_freeze_form(dialog_->form);
835 fl_clear_browser(dialog_->browser_all);
836 for (::Converters::const_iterator cit = local_converters.begin();
837 cit != local_converters.end(); ++cit) {
838 string const name = cit->From->prettyname() + " -> "
839 + cit->To->prettyname();
840 fl_addto_browser(dialog_->browser_all, name.c_str());
843 fl_unfreeze_form(dialog_->form);
847 bool FormPreferences::Converters::Add()
849 string const from = GetFrom();
850 string const to = GetTo();
851 string const command = fl_get_input(dialog_->input_converter);
852 string const flags = fl_get_input(dialog_->input_flags);
854 Converter const * old = local_converters.getConverter(from, to);
855 local_converters.add(from, to, command, flags);
857 local_converters.updateLast(local_formats);
860 setEnabled(dialog_->button_add, false);
866 bool FormPreferences::Converters::Browser()
868 int const i = fl_get_browser(dialog_->browser_all);
869 if (i <= 0) return false;
871 fl_freeze_form(dialog_->form);
873 Converter const & c = local_converters.get(i - 1);
874 int j = local_formats.getNumber(c.from);
876 fl_set_choice(dialog_->choice_from, j + 1);
878 j = local_formats.getNumber(c.to);
880 fl_set_choice(dialog_->choice_to, j + 1);
882 fl_set_input(dialog_->input_converter, c.command.c_str());
883 fl_set_input(dialog_->input_flags, c.flags.c_str());
885 fl_set_object_label(dialog_->button_add, idex(_("Modify|#M")).c_str());
886 fl_set_button_shortcut(dialog_->button_add,
887 scex(_("Modify|#M")).c_str(), 1);
889 setEnabled(dialog_->button_add, false);
890 setEnabled(dialog_->button_delete, true);
892 fl_unfreeze_form(dialog_->form);
897 bool FormPreferences::Converters::erase()
899 string const from = GetFrom();
900 string const to = GetTo();
902 local_converters.erase(from, to);
908 bool FormPreferences::Converters::Input()
910 string const from = GetFrom();
911 string const to = GetTo();
912 int const sel = local_converters.getNumber(from, to);
914 fl_freeze_form(dialog_->form);
917 fl_set_object_label(dialog_->button_add,
918 idex(_("Add|#A")).c_str());
919 fl_set_button_shortcut(dialog_->button_add,
920 scex(_("Add|#A")).c_str(), 1);
922 fl_deselect_browser(dialog_->browser_all);
923 setEnabled(dialog_->button_delete, false);
926 fl_set_object_label(dialog_->button_add,
927 idex(_("Modify|#M")).c_str());
928 fl_set_button_shortcut(dialog_->button_add,
929 scex(_("Modify|#M")).c_str(), 1);
931 int top = max(sel-5, 0);
932 fl_set_browser_topline(dialog_->browser_all, top);
933 fl_select_browser_line(dialog_->browser_all, sel+1);
934 setEnabled(dialog_->button_delete, true);
937 string const command = rtrim(fl_get_input(dialog_->input_converter));
938 bool const enable = !(command.empty() || from == to);
939 setEnabled(dialog_->button_add, enable);
941 fl_unfreeze_form(dialog_->form);
946 string const FormPreferences::Converters::GetFrom() const
948 ::Formats::FormatList::size_type const i =
949 fl_get_choice(dialog_->choice_from);
951 if (i > 0 && i <= local_formats.size())
952 return local_formats.get(i - 1).name();
954 lyxerr << "FormPreferences::Converters::GetFrom: No choice!" << endl;
959 string const FormPreferences::Converters::GetTo() const
961 ::Formats::FormatList::size_type const i =
962 fl_get_choice(dialog_->choice_to);
964 if (i > 0 && i <= local_formats.size())
965 return local_formats.get(i - 1).name();
967 lyxerr << "FormPreferences::Converters::GetTo: No choice!" << endl;
972 void FormPreferences::Converters::UpdateChoices() const
975 for (::Formats::const_iterator cit = local_formats.begin();
976 cit != local_formats.end(); ++cit) {
981 choice += cit->prettyname();
985 fl_clear_choice(dialog_->choice_from);
986 fl_addto_choice(dialog_->choice_from, choice.c_str());
988 fl_clear_choice(dialog_->choice_to);
989 fl_addto_choice(dialog_->choice_to, choice.c_str());
993 FormPreferences::Formats::Formats(FormPreferences & p)
998 FD_preferences_formats const * FormPreferences::Formats::dialog()
1000 return dialog_.get();
1004 void FormPreferences::Formats::apply() const
1006 parent_.controller().setFormats(local_formats);
1010 void FormPreferences::Formats::build()
1012 dialog_.reset(build_preferences_formats(&parent_));
1014 fl_set_input_return(dialog_->input_format, FL_RETURN_CHANGED);
1015 fl_set_input_return(dialog_->input_viewer, FL_RETURN_CHANGED);
1016 fl_set_input_return(dialog_->input_shrtcut, FL_RETURN_CHANGED);
1017 fl_set_input_return(dialog_->input_gui_name, FL_RETURN_CHANGED);
1018 fl_set_input_return(dialog_->input_extension, FL_RETURN_CHANGED);
1020 fl_set_input_filter(dialog_->input_format, fl_lowercase_filter);
1022 // set up the feedback mechanism
1023 setPrehandler(dialog_->browser_all);
1024 setPrehandler(dialog_->input_format);
1025 setPrehandler(dialog_->input_gui_name);
1026 setPrehandler(dialog_->button_delete);
1027 setPrehandler(dialog_->button_add);
1028 setPrehandler(dialog_->input_extension);
1029 setPrehandler(dialog_->input_viewer);
1030 setPrehandler(dialog_->input_shrtcut);
1035 FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
1037 if (ob == dialog_->browser_all)
1038 return _("All the currently defined formats known to LyX.");
1040 if (ob == dialog_->input_format)
1041 return _("The format identifier.");
1043 if (ob == dialog_->input_gui_name)
1044 return _("The format name as it will appear in the menus.");
1046 if (ob == dialog_->input_shrtcut)
1047 return _("The keyboard accelerator. Use a letter in the GUI name. "
1050 if (ob == dialog_->input_extension)
1051 return _("Used to recognize the file. E.g., ps, pdf, tex.");
1053 if (ob == dialog_->input_viewer)
1054 return _("The command used to launch the viewer application.");
1056 if (ob == dialog_->button_delete)
1057 return _("Remove the current format from the list of available "
1058 "formats. Note: you must then \"Apply\" the change.");
1060 if (ob == dialog_->button_add) {
1061 if (string(ob->label) == _("Add"))
1062 return _("Add the current format to the list of available "
1063 "formats. Note: you must then \"Apply\" the change.");
1065 return _("Modify the contents of the current format. Note: "
1066 "you must then \"Apply\" the change.");
1073 bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
1075 if (ob == dialog_->browser_all)
1078 if (ob == dialog_->input_format
1079 || ob == dialog_->input_gui_name
1080 || ob == dialog_->input_shrtcut
1081 || ob == dialog_->input_extension
1082 || ob == dialog_->input_viewer)
1085 if (ob == dialog_->button_add)
1088 if (ob == dialog_->button_delete)
1095 void FormPreferences::Formats::update()
1097 local_formats = formats;
1102 void FormPreferences::Formats::UpdateBrowser()
1104 local_formats.sort();
1106 fl_freeze_form(dialog_->form);
1107 fl_deselect_browser(dialog_->browser_all);
1108 fl_clear_browser(dialog_->browser_all);
1109 for (::Formats::const_iterator cit = local_formats.begin();
1110 cit != local_formats.end(); ++cit)
1111 fl_addto_browser(dialog_->browser_all,
1112 cit->prettyname().c_str());
1115 fl_unfreeze_form(dialog_->form);
1117 // Mustn't forget to update the Formats available to the converters_
1118 parent_.converters_.UpdateChoices();
1119 local_converters.update(local_formats);
1123 bool FormPreferences::Formats::Add()
1125 string const name = fl_get_input(dialog_->input_format);
1126 string const prettyname = fl_get_input(dialog_->input_gui_name);
1127 string const extension = fl_get_input(dialog_->input_extension);
1128 string const shortcut = fl_get_input(dialog_->input_shrtcut);
1129 string const viewer = fl_get_input(dialog_->input_viewer);
1131 Format const * old = local_formats.getFormat(name);
1132 string const old_prettyname = old ? old->prettyname() : string();
1133 local_formats.add(name, extension, prettyname, shortcut);
1134 local_formats.setViewer(name, viewer);
1135 if (!old || prettyname != old_prettyname) {
1138 parent_.converters_.UpdateBrowser();
1140 setEnabled(dialog_->button_add, false);
1146 bool FormPreferences::Formats::Browser()
1148 int const i = fl_get_browser(dialog_->browser_all);
1152 fl_freeze_form(dialog_->form);
1154 Format const & f = local_formats.get(i - 1);
1156 fl_set_input(dialog_->input_format, f.name().c_str());
1157 fl_set_input(dialog_->input_gui_name, f.prettyname().c_str());
1158 fl_set_input(dialog_->input_shrtcut, f.shortcut().c_str());
1159 fl_set_input(dialog_->input_extension, f.extension().c_str());
1160 fl_set_input(dialog_->input_viewer, f.viewer().c_str());
1162 fl_set_object_label(dialog_->button_add,
1163 idex(_("Modify|#M")).c_str());
1164 fl_set_button_shortcut(dialog_->button_add,
1165 scex(_("Modify|#M")).c_str(), 1);
1167 setEnabled(dialog_->button_add, false);
1168 setEnabled(dialog_->button_delete, true);
1170 fl_unfreeze_form(dialog_->form);
1175 bool FormPreferences::Formats::erase()
1177 string const name = fl_get_input(dialog_->input_format);
1179 if (local_converters.formatIsUsed(name)) {
1180 parent_.postWarning(_("Cannot remove a Format used by a Converter. "
1181 "Remove the converter first."));
1182 setEnabled(dialog_->button_delete, false);
1186 local_formats.erase(name);
1192 bool FormPreferences::Formats::Input()
1194 string const name = fl_get_input(dialog_->input_format);
1195 int const sel = local_formats.getNumber(name);
1196 fl_freeze_form(dialog_->form);
1199 fl_set_object_label(dialog_->button_add,
1200 idex(_("Add|#A")).c_str());
1201 fl_set_button_shortcut(dialog_->button_add,
1202 scex(_("Add|#A")).c_str(), 1);
1204 fl_deselect_browser(dialog_->browser_all);
1205 setEnabled(dialog_->button_delete, false);
1208 fl_set_object_label(dialog_->button_add,
1209 idex(_("Modify|#M")).c_str());
1210 fl_set_button_shortcut(dialog_->button_add,
1211 scex(_("Modify|#M")).c_str(), 1);
1213 int const top = max(sel-5, 0);
1214 fl_set_browser_topline(dialog_->browser_all, top);
1215 fl_select_browser_line(dialog_->browser_all, sel+1);
1217 setEnabled(dialog_->button_add, true);
1218 setEnabled(dialog_->button_delete, true);
1221 string const prettyname = fl_get_input(dialog_->input_gui_name);
1222 bool const enable = !(name.empty() || prettyname.empty());
1223 setEnabled(dialog_->button_add, enable);
1225 fl_unfreeze_form(dialog_->form);
1230 FormPreferences::Identity::Identity(FormPreferences & p)
1235 FD_preferences_identity const * FormPreferences::Identity::dialog()
1237 return dialog_.get();
1241 void FormPreferences::Identity::apply(LyXRC & rc) const
1243 rc.user_name = fl_get_input(dialog_->input_user_name);
1244 rc.user_email = fl_get_input(dialog_->input_user_email);
1248 void FormPreferences::Identity::build()
1250 dialog_.reset(build_preferences_identity(&parent_));
1251 fl_set_input_return(dialog_->input_user_name, FL_RETURN_CHANGED);
1252 fl_set_input_return(dialog_->input_user_email, FL_RETURN_CHANGED);
1256 void FormPreferences::Identity::update(LyXRC const & rc)
1258 fl_set_input(dialog_->input_user_name, rc.user_name.c_str());
1259 fl_set_input(dialog_->input_user_email, rc.user_email.c_str());
1263 FormPreferences::InputsMisc::InputsMisc(FormPreferences & p)
1268 FD_preferences_inputs_misc const * FormPreferences::InputsMisc::dialog()
1270 return dialog_.get();
1274 void FormPreferences::InputsMisc::apply(LyXRC & rc) const
1276 rc.date_insert_format =
1277 fl_get_input(dialog_->input_date_format);
1281 void FormPreferences::InputsMisc::build()
1283 dialog_.reset(build_preferences_inputs_misc(&parent_));
1285 fl_set_input_return(dialog_->input_date_format, FL_RETURN_CHANGED);
1287 // set up the feedback mechanism
1288 setPrehandler(dialog_->input_date_format);
1293 FormPreferences::InputsMisc::feedback(FL_OBJECT const * const ob) const
1295 if (ob == dialog_->input_date_format)
1296 return LyXRC::getDescription(LyXRC::RC_DATE_INSERT_FORMAT);
1301 void FormPreferences::InputsMisc::update(LyXRC const & rc)
1303 fl_set_input(dialog_->input_date_format,
1304 rc.date_insert_format.c_str());
1308 FormPreferences::Interface::Interface(FormPreferences & p)
1313 FD_preferences_interface const * FormPreferences::Interface::dialog()
1315 return dialog_.get();
1319 void FormPreferences::Interface::apply(LyXRC & rc) const
1321 rc.popup_normal_font =
1322 fl_get_input(dialog_->input_popup_normal_font);
1323 rc.popup_bold_font = fl_get_input(dialog_->input_popup_bold_font);
1324 rc.popup_font_encoding =
1325 fl_get_input(dialog_->input_popup_font_encoding);
1326 rc.bind_file = fl_get_input(dialog_->input_bind_file);
1327 rc.ui_file = fl_get_input(dialog_->input_ui_file);
1331 void FormPreferences::Interface::build()
1333 dialog_.reset(build_preferences_interface(&parent_));
1335 fl_set_input_return(dialog_->input_popup_normal_font, FL_RETURN_CHANGED);
1336 fl_set_input_return(dialog_->input_popup_bold_font, FL_RETURN_CHANGED);
1337 fl_set_input_return(dialog_->input_popup_font_encoding, FL_RETURN_CHANGED);
1338 fl_set_input_return(dialog_->input_bind_file, FL_RETURN_CHANGED);
1339 fl_set_input_return(dialog_->input_ui_file, FL_RETURN_CHANGED);
1341 // set up the feedback mechanism
1342 setPrehandler(dialog_->input_popup_normal_font);
1343 setPrehandler(dialog_->input_popup_bold_font);
1344 setPrehandler(dialog_->input_popup_font_encoding);
1345 setPrehandler(dialog_->input_bind_file);
1346 setPrehandler(dialog_->button_bind_file_browse);
1347 setPrehandler(dialog_->input_ui_file);
1348 setPrehandler(dialog_->button_ui_file_browse);
1353 FormPreferences::Interface::feedback(FL_OBJECT const * const ob) const
1355 if (ob == dialog_->input_popup_normal_font)
1356 return LyXRC::getDescription(LyXRC::RC_POPUP_NORMAL_FONT);
1357 if (ob == dialog_->input_popup_bold_font)
1358 return LyXRC::getDescription(LyXRC::RC_POPUP_BOLD_FONT);
1359 if (ob == dialog_->input_popup_font_encoding)
1360 return LyXRC::getDescription(LyXRC::RC_POPUP_FONT_ENCODING);
1361 if (ob == dialog_->input_bind_file)
1362 return LyXRC::getDescription(LyXRC::RC_BINDFILE);
1363 if (ob == dialog_->input_ui_file)
1364 return LyXRC::getDescription(LyXRC::RC_UIFILE);
1369 bool FormPreferences::Interface::input(FL_OBJECT const * const ob)
1371 if (ob == dialog_->button_bind_file_browse) {
1372 string f = parent_.controller().browsebind(
1373 fl_get_input(dialog_->input_bind_file));
1375 fl_set_input(dialog_->input_bind_file, f.c_str());
1376 } else if (ob == dialog_->button_ui_file_browse) {
1377 string f = parent_.controller().browseUI(
1378 fl_get_input(dialog_->input_ui_file));
1380 fl_set_input(dialog_->input_ui_file, f.c_str());
1387 void FormPreferences::Interface::update(LyXRC const & rc)
1389 fl_set_input(dialog_->input_popup_normal_font,
1390 rc.popup_normal_font.c_str());
1391 fl_set_input(dialog_->input_popup_bold_font,
1392 rc.popup_bold_font.c_str());
1393 fl_set_input(dialog_->input_popup_font_encoding,
1394 rc.popup_font_encoding.c_str());
1395 fl_set_input(dialog_->input_bind_file,
1396 rc.bind_file.c_str());
1397 fl_set_input(dialog_->input_ui_file,
1398 rc.ui_file.c_str());
1402 FormPreferences::Language::Language(FormPreferences & p)
1407 FD_preferences_language const * FormPreferences::Language::dialog()
1409 return dialog_.get();
1413 void FormPreferences::Language::apply(LyXRC & rc)
1415 int const pos = fl_get_combox(dialog_->combox_default_lang);
1416 rc.default_language = lang_[pos-1];
1418 int button = fl_get_button(dialog_->check_use_kbmap);
1419 string const name_1 = fl_get_input(dialog_->input_kbmap1);
1420 string const name_2 = fl_get_input(dialog_->input_kbmap2);
1422 button = !(name_1.empty() && name_2.empty());
1423 rc.use_kbmap = static_cast<bool>(button);
1426 rc.primary_kbmap = name_1;
1427 rc.secondary_kbmap = name_2;
1430 button = fl_get_button(dialog_->check_rtl_support);
1431 rc.rtl_support = static_cast<bool>(button);
1433 button = fl_get_button(dialog_->check_mark_foreign);
1434 rc.mark_foreign_language = static_cast<bool>(button);
1436 button = fl_get_button(dialog_->check_auto_begin);
1437 rc.language_auto_begin = static_cast<bool>(button);
1439 button = fl_get_button(dialog_->check_auto_end);
1440 rc.language_auto_end = static_cast<bool>(button);
1442 button = fl_get_button(dialog_->check_use_babel);
1443 rc.language_use_babel = static_cast<bool>(button);
1445 button = fl_get_button(dialog_->check_global_options);
1446 rc.language_global_options = static_cast<bool>(button);
1448 rc.language_package = fl_get_input(dialog_->input_package);
1449 rc.language_command_begin = fl_get_input(dialog_->input_command_begin);
1450 rc.language_command_end = fl_get_input(dialog_->input_command_end);
1452 // Ensure that all is self-consistent.
1457 void FormPreferences::Language::build()
1459 dialog_.reset(build_preferences_language(&parent_));
1461 fl_set_input_return(dialog_->input_package, FL_RETURN_CHANGED);
1462 fl_set_input_return(dialog_->input_command_begin, FL_RETURN_CHANGED);
1463 fl_set_input_return(dialog_->input_command_end, FL_RETURN_CHANGED);
1465 // Store the lang identifiers for later
1466 vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
1467 lang_ = getSecond(langs);
1469 FL_OBJECT * obj = dialog_->combox_default_lang;
1470 vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
1471 vector<frnt::LanguagePair>::const_iterator lend = langs.end();
1472 for (; lit != lend; ++lit) {
1473 fl_addto_combox(obj, lit->first.c_str());
1475 fl_set_combox_browser_height(obj, 400);
1477 // set up the feedback mechanism
1478 setPrehandler(dialog_->input_package);
1479 setPrehandler(dialog_->check_use_kbmap);
1480 setPrehandler(dialog_->combox_default_lang);
1481 setPrehandler(dialog_->input_kbmap1);
1482 setPrehandler(dialog_->input_kbmap2);
1483 setPrehandler(dialog_->check_rtl_support);
1484 setPrehandler(dialog_->check_mark_foreign);
1485 setPrehandler(dialog_->check_auto_begin);
1486 setPrehandler(dialog_->check_auto_end);
1487 setPrehandler(dialog_->check_use_babel);
1488 setPrehandler(dialog_->check_global_options);
1489 setPrehandler(dialog_->input_command_begin);
1490 setPrehandler(dialog_->input_command_end);
1492 // Activate/Deactivate the input fields dependent on the state of the
1499 FormPreferences::Language::feedback(FL_OBJECT const * const ob) const
1501 if (ob == dialog_->combox_default_lang)
1502 return LyXRC::getDescription(LyXRC::RC_DEFAULT_LANGUAGE);
1503 if (ob == dialog_->check_use_kbmap)
1504 return LyXRC::getDescription(LyXRC::RC_KBMAP);
1505 if (ob == dialog_->input_kbmap1)
1506 return LyXRC::getDescription(LyXRC::RC_KBMAP_PRIMARY);
1507 if (ob == dialog_->input_kbmap2)
1508 return LyXRC::getDescription(LyXRC::RC_KBMAP_SECONDARY);
1509 if (ob == dialog_->check_rtl_support)
1510 return LyXRC::getDescription(LyXRC::RC_RTL_SUPPORT);
1511 if (ob == dialog_->check_mark_foreign)
1512 return LyXRC::getDescription(LyXRC::RC_MARK_FOREIGN_LANGUAGE);
1513 if (ob == dialog_->check_auto_begin)
1514 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_BEGIN);
1515 if (ob == dialog_->check_auto_end)
1516 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_END);
1517 if (ob == dialog_->check_use_babel)
1518 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_USE_BABEL);
1519 if (ob == dialog_->check_global_options)
1520 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS);
1521 if (ob == dialog_->input_package)
1522 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_PACKAGE);
1523 if (ob == dialog_->input_command_begin)
1524 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_BEGIN);
1525 if (ob == dialog_->input_command_end)
1526 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_END);
1531 bool FormPreferences::Language::input(FL_OBJECT const * const ob)
1533 bool activate = true;
1535 // !ob if function is called from Language::build() to de/activate
1537 // otherwise the function is called by an xforms CB via input().
1538 if (!ob || ob == dialog_->check_use_kbmap) {
1539 bool const enable = fl_get_button(dialog_->check_use_kbmap);
1540 setEnabled(dialog_->button_kbmap1_browse, enable);
1541 setEnabled(dialog_->button_kbmap2_browse, enable);
1542 setEnabled(dialog_->input_kbmap1, enable);
1543 setEnabled(dialog_->input_kbmap2, enable);
1546 if (ob == dialog_->button_kbmap1_browse) {
1547 string f = parent_.controller().browsekbmap(
1548 fl_get_input(dialog_->input_kbmap1));
1550 fl_set_input(dialog_->input_kbmap1, f.c_str());
1551 } else if (ob == dialog_->button_kbmap2_browse) {
1552 string f = parent_.controller().browsekbmap(
1553 fl_get_input(dialog_->input_kbmap2));
1555 fl_set_input(dialog_->input_kbmap2, f.c_str());
1562 void FormPreferences::Language::update(LyXRC const & rc)
1564 fl_set_button(dialog_->check_use_kbmap,
1567 int const pos = int(findPos(lang_, rc.default_language));
1568 fl_set_combox(dialog_->combox_default_lang, pos + 1);
1571 fl_set_input(dialog_->input_kbmap1,
1572 rc.primary_kbmap.c_str());
1573 fl_set_input(dialog_->input_kbmap2,
1574 rc.secondary_kbmap.c_str());
1576 fl_set_input(dialog_->input_kbmap1, "");
1577 fl_set_input(dialog_->input_kbmap2, "");
1580 fl_set_button(dialog_->check_rtl_support, rc.rtl_support);
1581 fl_set_button(dialog_->check_mark_foreign,
1582 rc.mark_foreign_language);
1583 fl_set_button(dialog_->check_auto_begin, rc.language_auto_begin);
1584 fl_set_button(dialog_->check_auto_end, rc.language_auto_end);
1585 fl_set_button(dialog_->check_use_babel, rc.language_use_babel);
1586 fl_set_button(dialog_->check_global_options,
1587 rc.language_global_options);
1589 fl_set_input(dialog_->input_package,
1590 rc.language_package.c_str());
1591 fl_set_input(dialog_->input_command_begin,
1592 rc.language_command_begin.c_str());
1593 fl_set_input(dialog_->input_command_end,
1594 rc.language_command_end.c_str());
1596 // Activate/Deactivate the input fields dependent on the state of the
1602 FormPreferences::LnFmisc::LnFmisc(FormPreferences & p)
1607 FD_preferences_lnf_misc const * FormPreferences::LnFmisc::dialog()
1609 return dialog_.get();
1613 void FormPreferences::LnFmisc::apply(LyXRC & rc) const
1615 rc.auto_region_delete =
1616 fl_get_button(dialog_->check_auto_region_delete);
1617 rc.cursor_follows_scrollbar =
1618 fl_get_button(dialog_->check_cursor_follows_scrollbar);
1619 rc.dialogs_iconify_with_main =
1620 fl_get_button(dialog_->check_dialogs_iconify_with_main);
1621 rc.preview = fl_get_button(dialog_->check_preview_latex);
1622 rc.autosave = static_cast<unsigned int>
1623 (fl_get_counter_value(dialog_->counter_autosave));
1624 rc.wheel_jump = static_cast<unsigned int>
1625 (fl_get_counter_value(dialog_->counter_wm_jump));
1628 // lyx::graphics::DisplayType old_value = rc.display_graphics;
1629 switch (fl_get_choice(dialog_->choice_display)) {
1631 rc.display_graphics = lyx::graphics::NoDisplay;
1634 rc.display_graphics = lyx::graphics::ColorDisplay;
1637 rc.display_graphics = lyx::graphics::GrayscaleDisplay;
1640 rc.display_graphics = lyx::graphics::MonochromeDisplay;
1643 rc.display_graphics = lyx::graphics::ColorDisplay;
1647 #ifdef WITH_WARNINGS
1648 #warning FIXME!! The graphics cache no longer has a changeDisplay method.
1651 if (old_value != rc.display_graphics) {
1652 lyx::graphics::GCache & gc = lyx::graphics::GCache::get();
1659 void FormPreferences::LnFmisc::build()
1661 dialog_.reset(build_preferences_lnf_misc(&parent_));
1663 fl_set_counter_step(dialog_->counter_autosave, 1, 10);
1664 fl_set_counter_step(dialog_->counter_wm_jump, 1, 10);
1666 fl_set_counter_return(dialog_->counter_autosave, FL_RETURN_CHANGED);
1667 fl_set_counter_return(dialog_->counter_wm_jump, FL_RETURN_CHANGED);
1669 // set up the feedback mechanism
1670 setPrehandler(dialog_->check_auto_region_delete);
1671 setPrehandler(dialog_->counter_autosave);
1672 setPrehandler(dialog_->check_cursor_follows_scrollbar);
1673 setPrehandler(dialog_->check_dialogs_iconify_with_main);
1674 setPrehandler(dialog_->check_preview_latex);
1675 setPrehandler(dialog_->counter_wm_jump);
1677 fl_addto_choice(dialog_->choice_display,
1678 _("Monochrome|Grayscale|Color|Do not display").c_str());
1683 FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const
1685 if (ob == dialog_->check_auto_region_delete)
1686 return LyXRC::getDescription(LyXRC::RC_AUTOREGIONDELETE);
1687 if (ob == dialog_->check_cursor_follows_scrollbar)
1688 return LyXRC::getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR);
1689 if (ob == dialog_->check_dialogs_iconify_with_main)
1690 return LyXRC::getDescription(LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN);
1691 if (ob == dialog_->check_preview_latex)
1692 return LyXRC::getDescription(LyXRC::RC_PREVIEW);
1693 if (ob == dialog_->counter_autosave)
1694 return LyXRC::getDescription(LyXRC::RC_AUTOSAVE);
1695 if (ob == dialog_->counter_wm_jump)
1696 return LyXRC::getDescription(LyXRC::RC_WHEEL_JUMP);
1697 if (ob == dialog_->choice_display)
1698 return LyXRC::getDescription(LyXRC::RC_DISPLAY_GRAPHICS);
1703 void FormPreferences::LnFmisc::update(LyXRC const & rc)
1705 fl_set_button(dialog_->check_auto_region_delete,
1706 rc.auto_region_delete);
1707 fl_set_button(dialog_->check_cursor_follows_scrollbar,
1708 rc.cursor_follows_scrollbar);
1709 fl_set_button(dialog_->check_dialogs_iconify_with_main,
1710 rc.dialogs_iconify_with_main);
1711 fl_set_button(dialog_->check_preview_latex,
1713 fl_set_counter_value(dialog_->counter_autosave, rc.autosave);
1714 fl_set_counter_value(dialog_->counter_wm_jump, rc.wheel_jump);
1716 switch (rc.display_graphics) {
1717 case lyx::graphics::NoDisplay:
1718 fl_set_choice(dialog_->choice_display, 4);
1720 case lyx::graphics::ColorDisplay:
1721 fl_set_choice(dialog_->choice_display, 3);
1723 case lyx::graphics::GrayscaleDisplay:
1724 fl_set_choice(dialog_->choice_display, 2);
1726 case lyx::graphics::MonochromeDisplay:
1727 fl_set_choice(dialog_->choice_display, 1);
1730 fl_set_choice(dialog_->choice_display, 3);
1736 FormPreferences::OutputsMisc::OutputsMisc(FormPreferences & p)
1741 FD_preferences_outputs_misc const * FormPreferences::OutputsMisc::dialog()
1743 return dialog_.get();
1747 void FormPreferences::OutputsMisc::apply(LyXRC & rc) const
1749 rc.ascii_linelen = static_cast<unsigned int>
1750 (fl_get_counter_value(dialog_->counter_line_len));
1751 rc.fontenc = fl_get_input(dialog_->input_tex_encoding);
1754 fl_get_choice(dialog_->choice_default_papersize) - 1;
1755 rc.default_papersize = static_cast<PAPER_SIZE>(choice);
1757 rc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff);
1758 rc.chktex_command = fl_get_input(dialog_->input_checktex);
1759 rc.view_dvi_paper_option = fl_get_input(dialog_->input_paperoption);
1760 rc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt);
1764 void FormPreferences::OutputsMisc::build()
1766 dialog_.reset(build_preferences_outputs_misc(&parent_));
1768 fl_set_counter_step(dialog_->counter_line_len, 1, 10);
1770 fl_set_counter_return(dialog_->counter_line_len, FL_RETURN_CHANGED);
1771 fl_set_input_return(dialog_->input_tex_encoding, FL_RETURN_CHANGED);
1772 fl_set_input_return(dialog_->input_ascii_roff, FL_RETURN_CHANGED);
1773 fl_set_input_return(dialog_->input_checktex, FL_RETURN_CHANGED);
1774 fl_set_input_return(dialog_->input_paperoption, FL_RETURN_CHANGED);
1776 fl_addto_choice(dialog_->choice_default_papersize,
1777 _(" default | US letter | US legal "
1778 "| US executive | A3 | A4 | A5 | B5 ").c_str());
1780 // set up the feedback mechanism
1781 setPrehandler(dialog_->counter_line_len);
1782 setPrehandler(dialog_->input_tex_encoding);
1783 setPrehandler(dialog_->choice_default_papersize);
1784 setPrehandler(dialog_->input_ascii_roff);
1785 setPrehandler(dialog_->input_checktex);
1786 setPrehandler(dialog_->input_paperoption);
1787 setPrehandler(dialog_->check_autoreset_classopt);
1792 FormPreferences::OutputsMisc::feedback(FL_OBJECT const * const ob) const
1794 if (ob == dialog_->counter_line_len)
1795 return LyXRC::getDescription(LyXRC::RC_ASCII_LINELEN);
1796 if (ob == dialog_->input_tex_encoding)
1797 return LyXRC::getDescription(LyXRC::RC_FONT_ENCODING);
1798 if (ob == dialog_->input_ascii_roff)
1799 return LyXRC::getDescription(LyXRC::RC_ASCIIROFF_COMMAND);
1800 if (ob == dialog_->input_checktex)
1801 return LyXRC::getDescription(LyXRC::RC_CHKTEX_COMMAND);
1802 if (ob == dialog_->choice_default_papersize)
1803 return LyXRC::getDescription(LyXRC::RC_DEFAULT_PAPERSIZE);
1804 if (ob == dialog_->input_paperoption)
1805 return LyXRC::getDescription(LyXRC::RC_VIEWDVI_PAPEROPTION);
1806 if (ob == dialog_->check_autoreset_classopt)
1807 return LyXRC::getDescription(LyXRC::RC_AUTORESET_OPTIONS);
1812 void FormPreferences::OutputsMisc::update(LyXRC const & rc)
1814 fl_set_counter_value(dialog_->counter_line_len,
1816 fl_set_input(dialog_->input_tex_encoding,
1817 rc.fontenc.c_str());
1818 fl_set_choice(dialog_->choice_default_papersize,
1819 rc.default_papersize + 1);
1820 fl_set_input(dialog_->input_ascii_roff,
1821 rc.ascii_roff_command.c_str());
1822 fl_set_input(dialog_->input_checktex,
1823 rc.chktex_command.c_str());
1824 fl_set_input(dialog_->input_paperoption,
1825 rc.view_dvi_paper_option.c_str());
1826 fl_set_button(dialog_->check_autoreset_classopt,
1827 rc.auto_reset_options);
1832 FormPreferences::Paths::Paths(FormPreferences & p)
1837 FD_preferences_paths const * FormPreferences::Paths::dialog()
1839 return dialog_.get();
1843 void FormPreferences::Paths::apply(LyXRC & rc)
1845 rc.document_path = fl_get_input(dialog_->input_default_path);
1846 rc.template_path = fl_get_input(dialog_->input_template_path);
1848 int button = fl_get_button(dialog_->check_use_temp_dir);
1849 string str = fl_get_input(dialog_->input_temp_dir);
1853 rc.use_tempdir = button;
1854 rc.tempdir_path = str;
1856 button = fl_get_button(dialog_->check_last_files);
1857 str = fl_get_input(dialog_->input_lastfiles);
1858 if (!button) str.erase();
1860 rc.check_lastfiles = button;
1862 rc.num_lastfiles = static_cast<unsigned int>
1863 (fl_get_counter_value(dialog_->counter_lastfiles));
1865 button = fl_get_button(dialog_->check_make_backups);
1866 str = fl_get_input(dialog_->input_backup_path);
1870 rc.make_backup = button;
1871 rc.backupdir_path = str;
1873 rc.lyxpipes = fl_get_input(dialog_->input_serverpipe);
1880 void FormPreferences::Paths::build()
1882 dialog_.reset(build_preferences_paths(&parent_));
1884 fl_set_input_return(dialog_->input_default_path, FL_RETURN_CHANGED);
1885 fl_set_input_return(dialog_->input_template_path, FL_RETURN_CHANGED);
1886 fl_set_input_return(dialog_->input_temp_dir, FL_RETURN_CHANGED);
1887 fl_set_input_return(dialog_->input_lastfiles, FL_RETURN_CHANGED);
1888 fl_set_input_return(dialog_->input_backup_path, FL_RETURN_CHANGED);
1889 fl_set_counter_return(dialog_->counter_lastfiles, FL_RETURN_CHANGED);
1890 fl_set_input_return(dialog_->input_serverpipe, FL_RETURN_CHANGED);
1892 // set up the feedback mechanism
1893 setPrehandler(dialog_->input_default_path);
1894 setPrehandler(dialog_->counter_lastfiles);
1895 setPrehandler(dialog_->input_template_path);
1896 setPrehandler(dialog_->check_last_files);
1897 setPrehandler(dialog_->input_lastfiles);
1898 setPrehandler(dialog_->check_make_backups);
1899 setPrehandler(dialog_->input_backup_path);
1900 setPrehandler(dialog_->input_serverpipe);
1901 setPrehandler(dialog_->input_temp_dir);
1902 setPrehandler(dialog_->check_use_temp_dir);
1907 FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const
1909 if (ob == dialog_->input_default_path)
1910 return LyXRC::getDescription(LyXRC::RC_DOCUMENTPATH);
1911 if (ob == dialog_->input_template_path)
1912 return LyXRC::getDescription(LyXRC::RC_TEMPLATEPATH);
1913 if (ob == dialog_->check_use_temp_dir)
1914 return LyXRC::getDescription(LyXRC::RC_USETEMPDIR);
1915 if (ob == dialog_->input_temp_dir)
1916 return LyXRC::getDescription(LyXRC::RC_TEMPDIRPATH);
1917 if (ob == dialog_->check_last_files)
1918 return LyXRC::getDescription(LyXRC::RC_CHECKLASTFILES);
1919 if (ob == dialog_->input_lastfiles)
1920 return LyXRC::getDescription(LyXRC::RC_LASTFILES);
1921 if (ob == dialog_->counter_lastfiles)
1922 return LyXRC::getDescription(LyXRC::RC_NUMLASTFILES);
1923 if (ob == dialog_->check_make_backups)
1924 return LyXRC::getDescription(LyXRC::RC_MAKE_BACKUP);
1925 if (ob == dialog_->input_backup_path)
1926 return LyXRC::getDescription(LyXRC::RC_BACKUPDIR_PATH);
1927 if (ob == dialog_->input_serverpipe)
1928 return LyXRC::getDescription(LyXRC::RC_SERVERPIPE);
1933 bool FormPreferences::Paths::input(FL_OBJECT const * const ob)
1935 bool activate = true;
1937 // !ob if function is called from Paths::update() to de/activate
1939 // otherwise the function is called by an xforms CB via input().
1940 if (!ob || ob == dialog_->check_use_temp_dir) {
1941 bool const enable = fl_get_button(dialog_->check_use_temp_dir);
1942 setEnabled(dialog_->input_temp_dir, enable);
1945 if (!ob || ob == dialog_->check_last_files) {
1946 bool const enable = fl_get_button(dialog_->check_last_files);
1947 setEnabled(dialog_->input_lastfiles, enable);
1950 if (!ob || ob == dialog_->check_make_backups) {
1951 bool const enable = fl_get_button(dialog_->check_make_backups);
1952 setEnabled(dialog_->input_backup_path, enable);
1955 if (!ob || ob == dialog_->input_default_path) {
1956 string const name = fl_get_input(dialog_->input_default_path);
1957 if (!name.empty() && !RWInfo::WriteableDir(name)) {
1958 parent_.postWarning(RWInfo::ErrorMessage());
1963 if (!ob || ob == dialog_->input_template_path) {
1964 string const name = fl_get_input(dialog_->input_template_path);
1965 if (!name.empty() && !RWInfo::ReadableDir(name)) {
1966 parent_.postWarning(RWInfo::ErrorMessage());
1971 if (!ob || ob == dialog_->input_temp_dir) {
1972 string const name = fl_get_input(dialog_->input_temp_dir);
1973 if (fl_get_button(dialog_->check_make_backups)
1975 && !RWInfo::WriteableDir(name)) {
1976 parent_.postWarning(RWInfo::ErrorMessage());
1981 if (!ob || ob == dialog_->input_backup_path) {
1982 string const name = fl_get_input(dialog_->input_backup_path);
1983 if (fl_get_button(dialog_->check_make_backups)
1985 && !RWInfo::WriteableDir(name)) {
1986 parent_.postWarning(RWInfo::ErrorMessage());
1991 if (!ob || ob == dialog_->input_lastfiles) {
1992 string const name = fl_get_input(dialog_->input_lastfiles);
1993 if (fl_get_button(dialog_->check_last_files)
1995 && !RWInfo::WriteableFile(name)) {
1996 parent_.postWarning(RWInfo::ErrorMessage());
2001 if (!ob || ob == dialog_->input_serverpipe) {
2002 string const name = fl_get_input(dialog_->input_serverpipe);
2003 if (!name.empty()) {
2004 // strip off the extension
2005 string const str = ChangeExtension(name, "");
2006 if (!RWInfo::WriteableFile(str + ".in")) {
2007 parent_.postWarning(RWInfo::ErrorMessage());
2010 if (!RWInfo::WriteableFile(str + ".out")) {
2011 parent_.postWarning(RWInfo::ErrorMessage());
2017 if (ob == dialog_->button_default_path_browse) {
2018 string f = parent_.controller().browsedir(
2019 fl_get_input(dialog_->input_default_path), _("Default path"));
2021 fl_set_input(dialog_->input_default_path, f.c_str());
2022 } else if (ob == dialog_->button_template_path_browse) {
2023 string f = parent_.controller().browsedir(
2024 fl_get_input(dialog_->input_template_path), _("Template path"));
2026 fl_set_input(dialog_->input_template_path, f.c_str());
2027 } else if (ob == dialog_->button_temp_dir_browse) {
2028 string f = parent_.controller().browsedir(
2029 fl_get_input(dialog_->input_temp_dir), _("Temporary dir"));
2031 fl_set_input(dialog_->input_temp_dir, f.c_str());
2032 } else if (ob == dialog_->button_lastfiles_browse) {
2033 string f = parent_.controller().browse(
2034 fl_get_input(dialog_->input_lastfiles), _("Last files"));
2036 fl_set_input(dialog_->input_lastfiles, f.c_str());
2037 } else if (ob == dialog_->button_backup_path_browse) {
2038 string f = parent_.controller().browsedir(
2039 fl_get_input(dialog_->input_backup_path), _("Backup path"));
2041 fl_set_input(dialog_->input_backup_path, f.c_str());
2042 } else if (ob == dialog_->button_serverpipe_browse) {
2043 string f = parent_.controller().browse(
2044 fl_get_input(dialog_->input_serverpipe), _("LyX server pipes"));
2046 fl_set_input(dialog_->input_serverpipe, f.c_str());
2053 void FormPreferences::Paths::update(LyXRC const & rc)
2055 fl_set_input(dialog_->input_default_path,
2056 rc.document_path.c_str());
2057 fl_set_input(dialog_->input_template_path,
2058 rc.template_path.c_str());
2062 str = rc.backupdir_path;
2064 fl_set_button(dialog_->check_make_backups,
2066 fl_set_input(dialog_->input_backup_path, str.c_str());
2070 str = rc.tempdir_path;
2072 fl_set_button(dialog_->check_use_temp_dir,
2074 fl_set_input(dialog_->input_temp_dir, str.c_str());
2077 if (rc.check_lastfiles)
2080 fl_set_button(dialog_->check_last_files,
2081 rc.check_lastfiles);
2082 fl_set_input(dialog_->input_lastfiles, str.c_str());
2083 fl_set_counter_value(dialog_->counter_lastfiles,
2086 fl_set_input(dialog_->input_serverpipe, rc.lyxpipes.c_str());
2088 // Activate/Deactivate the input fields dependent on the state of the
2094 FormPreferences::Printer::Printer(FormPreferences & p)
2099 FD_preferences_printer const * FormPreferences::Printer::dialog()
2101 return dialog_.get();
2105 void FormPreferences::Printer::apply(LyXRC & rc) const
2107 rc.print_adapt_output = fl_get_button(dialog_->check_adapt_output);
2108 rc.print_command = fl_get_input(dialog_->input_command);
2109 rc.print_pagerange_flag = fl_get_input(dialog_->input_page_range);
2110 rc.print_copies_flag = fl_get_input(dialog_->input_copies);
2111 rc.print_reverse_flag = fl_get_input(dialog_->input_reverse);
2112 rc.print_to_printer = fl_get_input(dialog_->input_to_printer);
2113 rc.print_file_extension =
2114 fl_get_input(dialog_->input_file_extension);
2115 rc.print_spool_command =
2116 fl_get_input(dialog_->input_spool_command);
2117 rc.print_paper_flag = fl_get_input(dialog_->input_paper_type);
2118 rc.print_evenpage_flag = fl_get_input(dialog_->input_even_pages);
2119 rc.print_oddpage_flag = fl_get_input(dialog_->input_odd_pages);
2120 rc.print_collcopies_flag = fl_get_input(dialog_->input_collated);
2121 rc.print_landscape_flag = fl_get_input(dialog_->input_landscape);
2122 rc.print_to_file = fl_get_input(dialog_->input_to_file);
2123 rc.print_extra_options =
2124 fl_get_input(dialog_->input_extra_options);
2125 rc.print_spool_printerprefix =
2126 fl_get_input(dialog_->input_spool_prefix);
2127 rc.print_paper_dimension_flag =
2128 fl_get_input(dialog_->input_paper_size);
2129 rc.printer = fl_get_input(dialog_->input_name);
2134 FormPreferences::Printer::feedback(FL_OBJECT const * const ob) const
2136 if (ob == dialog_->input_command)
2137 return LyXRC::getDescription(LyXRC::RC_PRINT_COMMAND);
2138 if (ob == dialog_->check_adapt_output)
2139 return LyXRC::getDescription(LyXRC::RC_PRINT_ADAPTOUTPUT);
2140 if (ob == dialog_->input_to_printer)
2141 return LyXRC::getDescription(LyXRC::RC_PRINTTOPRINTER);
2142 if (ob == dialog_->input_to_file)
2143 return LyXRC::getDescription(LyXRC::RC_PRINTTOFILE);
2144 if (ob == dialog_->input_file_extension)
2145 return LyXRC::getDescription(LyXRC::RC_PRINTFILEEXTENSION);
2146 if (ob == dialog_->input_extra_options)
2147 return LyXRC::getDescription(LyXRC::RC_PRINTEXSTRAOPTIONS);
2148 if (ob == dialog_->input_spool_command)
2149 return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_COMMAND);
2150 if (ob == dialog_->input_spool_prefix)
2151 return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_PRINTERPREFIX);
2152 if (ob == dialog_->input_name)
2153 return LyXRC::getDescription(LyXRC::RC_PRINTER);
2154 if (ob == dialog_->input_even_pages)
2155 return LyXRC::getDescription(LyXRC::RC_PRINTEVENPAGEFLAG);
2156 if (ob == dialog_->input_odd_pages)
2157 return LyXRC::getDescription(LyXRC::RC_PRINTODDPAGEFLAG);
2158 if (ob == dialog_->input_page_range)
2159 return LyXRC::getDescription(LyXRC::RC_PRINTPAGERANGEFLAG);
2160 if (ob == dialog_->input_reverse)
2161 return LyXRC::getDescription(LyXRC::RC_PRINTREVERSEFLAG);
2162 if (ob == dialog_->input_landscape)
2163 return LyXRC::getDescription(LyXRC::RC_PRINTLANDSCAPEFLAG);
2164 if (ob == dialog_->input_copies)
2165 return LyXRC::getDescription(LyXRC::RC_PRINTCOPIESFLAG);
2166 if (ob == dialog_->input_collated)
2167 return LyXRC::getDescription(LyXRC::RC_PRINTCOLLCOPIESFLAG);
2168 if (ob == dialog_->input_paper_type)
2169 return LyXRC::getDescription(LyXRC::RC_PRINTPAPERFLAG);
2170 if (ob == dialog_->input_paper_size)
2171 return LyXRC::getDescription(LyXRC::RC_PRINTPAPERDIMENSIONFLAG);
2176 void FormPreferences::Printer::build()
2178 dialog_.reset(build_preferences_printer(&parent_));
2180 fl_set_input_return(dialog_->input_command, FL_RETURN_CHANGED);
2181 fl_set_input_return(dialog_->input_page_range, FL_RETURN_CHANGED);
2182 fl_set_input_return(dialog_->input_copies, FL_RETURN_CHANGED);
2183 fl_set_input_return(dialog_->input_reverse, FL_RETURN_CHANGED);
2184 fl_set_input_return(dialog_->input_to_printer, FL_RETURN_CHANGED);
2185 fl_set_input_return(dialog_->input_file_extension, FL_RETURN_CHANGED);
2186 fl_set_input_return(dialog_->input_spool_command, FL_RETURN_CHANGED);
2187 fl_set_input_return(dialog_->input_paper_type, FL_RETURN_CHANGED);
2188 fl_set_input_return(dialog_->input_even_pages, FL_RETURN_CHANGED);
2189 fl_set_input_return(dialog_->input_odd_pages, FL_RETURN_CHANGED);
2190 fl_set_input_return(dialog_->input_collated, FL_RETURN_CHANGED);
2191 fl_set_input_return(dialog_->input_landscape, FL_RETURN_CHANGED);
2192 fl_set_input_return(dialog_->input_to_file, FL_RETURN_CHANGED);
2193 fl_set_input_return(dialog_->input_extra_options, FL_RETURN_CHANGED);
2194 fl_set_input_return(dialog_->input_spool_prefix, FL_RETURN_CHANGED);
2195 fl_set_input_return(dialog_->input_paper_size, FL_RETURN_CHANGED);
2196 fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
2198 // set up the feedback mechanism
2199 setPrehandler(dialog_->input_command);
2200 setPrehandler(dialog_->input_page_range);
2201 setPrehandler(dialog_->input_copies);
2202 setPrehandler(dialog_->input_reverse);
2203 setPrehandler(dialog_->input_to_printer);
2204 setPrehandler(dialog_->input_file_extension);
2205 setPrehandler(dialog_->input_spool_command);
2206 setPrehandler(dialog_->input_paper_type);
2207 setPrehandler(dialog_->input_even_pages);
2208 setPrehandler(dialog_->input_odd_pages);
2209 setPrehandler(dialog_->input_collated);
2210 setPrehandler(dialog_->input_landscape);
2211 setPrehandler(dialog_->input_to_file);
2212 setPrehandler(dialog_->input_extra_options);
2213 setPrehandler(dialog_->input_spool_prefix);
2214 setPrehandler(dialog_->input_paper_size);
2215 setPrehandler(dialog_->input_name);
2216 setPrehandler(dialog_->check_adapt_output);
2220 void FormPreferences::Printer::update(LyXRC const & rc)
2222 fl_set_button(dialog_->check_adapt_output,
2223 rc.print_adapt_output);
2224 fl_set_input(dialog_->input_command,
2225 rc.print_command.c_str());
2226 fl_set_input(dialog_->input_page_range,
2227 rc.print_pagerange_flag.c_str());
2228 fl_set_input(dialog_->input_copies,
2229 rc.print_copies_flag.c_str());
2230 fl_set_input(dialog_->input_reverse,
2231 rc.print_reverse_flag.c_str());
2232 fl_set_input(dialog_->input_to_printer,
2233 rc.print_to_printer.c_str());
2234 fl_set_input(dialog_->input_file_extension,
2235 rc.print_file_extension.c_str());
2236 fl_set_input(dialog_->input_spool_command,
2237 rc.print_spool_command.c_str());
2238 fl_set_input(dialog_->input_paper_type,
2239 rc.print_paper_flag.c_str());
2240 fl_set_input(dialog_->input_even_pages,
2241 rc.print_evenpage_flag.c_str());
2242 fl_set_input(dialog_->input_odd_pages,
2243 rc.print_oddpage_flag.c_str());
2244 fl_set_input(dialog_->input_collated,
2245 rc.print_collcopies_flag.c_str());
2246 fl_set_input(dialog_->input_landscape,
2247 rc.print_landscape_flag.c_str());
2248 fl_set_input(dialog_->input_to_file,
2249 rc.print_to_file.c_str());
2250 fl_set_input(dialog_->input_extra_options,
2251 rc.print_extra_options.c_str());
2252 fl_set_input(dialog_->input_spool_prefix,
2253 rc.print_spool_printerprefix.c_str());
2254 fl_set_input(dialog_->input_paper_size,
2255 rc.print_paper_dimension_flag.c_str());
2256 fl_set_input(dialog_->input_name,
2257 rc.printer.c_str());
2261 FormPreferences::ScreenFonts::ScreenFonts(FormPreferences & p)
2266 FD_preferences_screen_fonts const * FormPreferences::ScreenFonts::dialog()
2268 return dialog_.get();
2272 void FormPreferences::ScreenFonts::apply(LyXRC & rc) const
2274 bool changed = false;
2276 pair<string, string> tmp =
2277 parseFontName(fl_get_input(dialog_->input_roman));
2278 if (rc.roman_font_name != tmp.first ||
2279 rc.roman_font_foundry != tmp.second) {
2281 rc.roman_font_name = tmp.first;
2282 rc.roman_font_foundry = tmp.second;
2285 tmp = parseFontName(fl_get_input(dialog_->input_sans));
2286 if (rc.sans_font_name != tmp.first ||
2287 rc.sans_font_foundry != tmp.second) {
2289 rc.sans_font_name = tmp.first;
2290 rc.sans_font_foundry = tmp.second;
2293 tmp = parseFontName(fl_get_input(dialog_->input_typewriter));
2294 if (rc.typewriter_font_name != tmp.first ||
2295 rc.typewriter_font_foundry != tmp.second) {
2297 rc.typewriter_font_name = tmp.first;
2298 rc.typewriter_font_foundry = tmp.second;
2301 string str = fl_get_input(dialog_->input_screen_encoding);
2302 if (rc.font_norm != str) {
2305 rc.set_font_norm_type();
2308 bool button = fl_get_button(dialog_->check_scalable);
2309 if (rc.use_scalable_fonts != button) {
2311 rc.use_scalable_fonts = button;
2314 unsigned int ivalue = static_cast<unsigned int>
2315 (fl_get_counter_value(dialog_->counter_zoom));
2316 if (rc.zoom != ivalue) {
2321 ivalue = static_cast<unsigned int>
2322 (fl_get_counter_value(dialog_->counter_dpi));
2323 if (rc.dpi != ivalue) {
2328 double dvalue = strToDbl(fl_get_input(dialog_->input_tiny));
2329 if (rc.font_sizes[LyXFont::SIZE_TINY] != dvalue) {
2331 rc.font_sizes[LyXFont::SIZE_TINY] = dvalue;
2334 dvalue = strToDbl(fl_get_input(dialog_->input_script));
2335 if (rc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue) {
2337 rc.font_sizes[LyXFont::SIZE_SCRIPT] = dvalue;
2340 dvalue = strToDbl(fl_get_input(dialog_->input_footnote));
2341 if (rc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue) {
2343 rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = dvalue;
2346 dvalue = strToDbl(fl_get_input(dialog_->input_small));
2347 if (rc.font_sizes[LyXFont::SIZE_SMALL] != dvalue) {
2349 rc.font_sizes[LyXFont::SIZE_SMALL] = dvalue;
2352 dvalue = strToDbl(fl_get_input(dialog_->input_normal));
2353 if (rc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue) {
2355 rc.font_sizes[LyXFont::SIZE_NORMAL] = dvalue;
2358 dvalue = strToDbl(fl_get_input(dialog_->input_large));
2359 if (rc.font_sizes[LyXFont::SIZE_LARGE] != dvalue) {
2361 rc.font_sizes[LyXFont::SIZE_LARGE] = dvalue;
2364 dvalue = strToDbl(fl_get_input(dialog_->input_larger));
2365 if (rc.font_sizes[LyXFont::SIZE_LARGER] != dvalue) {
2367 rc.font_sizes[LyXFont::SIZE_LARGER] = dvalue;
2370 dvalue = strToDbl(fl_get_input(dialog_->input_largest));
2371 if (rc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue) {
2373 rc.font_sizes[LyXFont::SIZE_LARGEST] = dvalue;
2376 dvalue = strToDbl(fl_get_input(dialog_->input_huge));
2377 if (rc.font_sizes[LyXFont::SIZE_HUGE] != dvalue) {
2379 rc.font_sizes[LyXFont::SIZE_HUGE] = dvalue;
2382 dvalue = strToDbl(fl_get_input(dialog_->input_huger));
2383 if (rc.font_sizes[LyXFont::SIZE_HUGER] != dvalue) {
2385 rc.font_sizes[LyXFont::SIZE_HUGER] = dvalue;
2389 // Now update the buffers
2390 // Can anything below here affect the redraw process?
2391 parent_.controller().updateScreenFonts();
2396 void FormPreferences::ScreenFonts::build()
2398 dialog_.reset(build_preferences_screen_fonts(&parent_));
2400 fl_set_counter_step(dialog_->counter_zoom, 1, 10);
2401 fl_set_counter_step(dialog_->counter_dpi, 1, 10);
2403 fl_set_input_return(dialog_->input_roman, FL_RETURN_CHANGED);
2404 fl_set_input_return(dialog_->input_sans, FL_RETURN_CHANGED);
2405 fl_set_input_return(dialog_->input_typewriter, FL_RETURN_CHANGED);
2406 fl_set_input_return(dialog_->input_screen_encoding, FL_RETURN_CHANGED);
2407 fl_set_counter_return(dialog_->counter_zoom, FL_RETURN_CHANGED);
2408 fl_set_counter_return(dialog_->counter_dpi, FL_RETURN_CHANGED);
2409 fl_set_input_return(dialog_->input_tiny, FL_RETURN_CHANGED);
2410 fl_set_input_return(dialog_->input_script, FL_RETURN_CHANGED);
2411 fl_set_input_return(dialog_->input_footnote, FL_RETURN_CHANGED);
2412 fl_set_input_return(dialog_->input_small, FL_RETURN_CHANGED);
2413 fl_set_input_return(dialog_->input_normal, FL_RETURN_CHANGED);
2414 fl_set_input_return(dialog_->input_large, FL_RETURN_CHANGED);
2415 fl_set_input_return(dialog_->input_larger, FL_RETURN_CHANGED);
2416 fl_set_input_return(dialog_->input_largest, FL_RETURN_CHANGED);
2417 fl_set_input_return(dialog_->input_huge, FL_RETURN_CHANGED);
2418 fl_set_input_return(dialog_->input_huger, FL_RETURN_CHANGED);
2420 fl_set_input_filter(dialog_->input_tiny, fl_unsigned_float_filter);
2421 fl_set_input_filter(dialog_->input_script, fl_unsigned_float_filter);
2422 fl_set_input_filter(dialog_->input_footnote, fl_unsigned_float_filter);
2423 fl_set_input_filter(dialog_->input_small, fl_unsigned_float_filter);
2424 fl_set_input_filter(dialog_->input_normal, fl_unsigned_float_filter);
2425 fl_set_input_filter(dialog_->input_large, fl_unsigned_float_filter);
2426 fl_set_input_filter(dialog_->input_larger, fl_unsigned_float_filter);
2427 fl_set_input_filter(dialog_->input_largest, fl_unsigned_float_filter);
2428 fl_set_input_filter(dialog_->input_huge, fl_unsigned_float_filter);
2429 fl_set_input_filter(dialog_->input_huger, fl_unsigned_float_filter);
2431 // set up the feedback mechanism
2432 setPrehandler(dialog_->input_roman);
2433 setPrehandler(dialog_->input_sans);
2434 setPrehandler(dialog_->input_typewriter);
2435 setPrehandler(dialog_->counter_zoom);
2436 setPrehandler(dialog_->counter_dpi);
2437 setPrehandler(dialog_->check_scalable);
2438 setPrehandler(dialog_->input_screen_encoding);
2439 setPrehandler(dialog_->input_tiny);
2440 setPrehandler(dialog_->input_script);
2441 setPrehandler(dialog_->input_footnote);
2442 setPrehandler(dialog_->input_small);
2443 setPrehandler(dialog_->input_large);
2444 setPrehandler(dialog_->input_larger);
2445 setPrehandler(dialog_->input_largest);
2446 setPrehandler(dialog_->input_normal);
2447 setPrehandler(dialog_->input_huge);
2448 setPrehandler(dialog_->input_huger);
2453 FormPreferences::ScreenFonts::feedback(FL_OBJECT const * const ob) const
2455 if (ob == dialog_->input_roman)
2456 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ROMAN);
2457 if (ob == dialog_->input_sans)
2458 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SANS);
2459 if (ob == dialog_->input_typewriter)
2460 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_TYPEWRITER);
2461 if (ob == dialog_->check_scalable)
2462 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SCALABLE);
2463 if (ob == dialog_->input_screen_encoding)
2464 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ENCODING);
2465 if (ob == dialog_->counter_zoom)
2466 return LyXRC::getDescription(LyXRC::RC_SCREEN_ZOOM);
2467 if (ob == dialog_->counter_dpi)
2468 return LyXRC::getDescription(LyXRC::RC_SCREEN_DPI);
2469 if (ob == dialog_->input_tiny
2470 || ob == dialog_->input_script
2471 || ob == dialog_->input_footnote
2472 || ob == dialog_->input_small
2473 || ob == dialog_->input_large
2474 || ob == dialog_->input_larger
2475 || ob == dialog_->input_larger
2476 || ob == dialog_->input_largest
2477 || ob == dialog_->input_normal
2478 || ob == dialog_->input_huge
2479 || ob == dialog_->input_huger)
2480 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SIZES);
2485 bool FormPreferences::ScreenFonts::input()
2487 bool activate = true;
2490 // Make sure that all fonts all have positive entries
2491 // Also note that an empty entry is returned as 0.0 by strToDbl
2492 if (0.0 >= strToDbl(fl_get_input(dialog_->input_tiny))
2493 || 0.0 >= strToDbl(fl_get_input(dialog_->input_script))
2494 || 0.0 >= strToDbl(fl_get_input(dialog_->input_footnote))
2495 || 0.0 >= strToDbl(fl_get_input(dialog_->input_small))
2496 || 0.0 >= strToDbl(fl_get_input(dialog_->input_normal))
2497 || 0.0 >= strToDbl(fl_get_input(dialog_->input_large))
2498 || 0.0 >= strToDbl(fl_get_input(dialog_->input_larger))
2499 || 0.0 >= strToDbl(fl_get_input(dialog_->input_largest))
2500 || 0.0 >= strToDbl(fl_get_input(dialog_->input_huge))
2501 || 0.0 >= strToDbl(fl_get_input(dialog_->input_huger))) {
2503 str = _("Fonts must be positive!");
2505 } else if (strToDbl(fl_get_input(dialog_->input_tiny)) >
2506 // Fontsizes -- tiny < script < footnote etc.
2507 strToDbl(fl_get_input(dialog_->input_script)) ||
2508 strToDbl(fl_get_input(dialog_->input_script)) >
2509 strToDbl(fl_get_input(dialog_->input_footnote)) ||
2510 strToDbl(fl_get_input(dialog_->input_footnote)) >
2511 strToDbl(fl_get_input(dialog_->input_small)) ||
2512 strToDbl(fl_get_input(dialog_->input_small)) >
2513 strToDbl(fl_get_input(dialog_->input_normal)) ||
2514 strToDbl(fl_get_input(dialog_->input_normal)) >
2515 strToDbl(fl_get_input(dialog_->input_large)) ||
2516 strToDbl(fl_get_input(dialog_->input_large)) >
2517 strToDbl(fl_get_input(dialog_->input_larger)) ||
2518 strToDbl(fl_get_input(dialog_->input_larger)) >
2519 strToDbl(fl_get_input(dialog_->input_largest)) ||
2520 strToDbl(fl_get_input(dialog_->input_largest)) >
2521 strToDbl(fl_get_input(dialog_->input_huge)) ||
2522 strToDbl(fl_get_input(dialog_->input_huge)) >
2523 strToDbl(fl_get_input(dialog_->input_huger))) {
2526 str = _("Fonts must be input in the order Tiny > Smallest > Smaller > Small > Normal > Large > Larger > Largest > Huge > Huger.");
2530 parent_.postWarning(str);
2536 void FormPreferences::ScreenFonts::update(LyXRC const & rc)
2538 fl_set_input(dialog_->input_roman,
2539 makeFontName(rc.roman_font_name,
2540 rc.roman_font_foundry).c_str());
2541 fl_set_input(dialog_->input_sans,
2542 makeFontName(rc.sans_font_name,
2543 rc.sans_font_foundry).c_str());
2544 fl_set_input(dialog_->input_typewriter,
2545 makeFontName(rc.typewriter_font_name,
2546 rc.typewriter_font_foundry).c_str());
2547 fl_set_input(dialog_->input_screen_encoding,
2548 rc.font_norm.c_str());
2549 fl_set_button(dialog_->check_scalable,
2550 rc.use_scalable_fonts);
2551 fl_set_counter_value(dialog_->counter_zoom, rc.zoom);
2552 fl_set_counter_value(dialog_->counter_dpi, rc.dpi);
2553 fl_set_input(dialog_->input_tiny,
2554 tostr(rc.font_sizes[LyXFont::SIZE_TINY]).c_str());
2555 fl_set_input(dialog_->input_script,
2556 tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str());
2557 fl_set_input(dialog_->input_footnote,
2558 tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str());
2559 fl_set_input(dialog_->input_small,
2560 tostr(rc.font_sizes[LyXFont::SIZE_SMALL]).c_str());
2561 fl_set_input(dialog_->input_normal,
2562 tostr(rc.font_sizes[LyXFont::SIZE_NORMAL]).c_str());
2563 fl_set_input(dialog_->input_large,
2564 tostr(rc.font_sizes[LyXFont::SIZE_LARGE]).c_str());
2565 fl_set_input(dialog_->input_larger,
2566 tostr(rc.font_sizes[LyXFont::SIZE_LARGER]).c_str());
2567 fl_set_input(dialog_->input_largest,
2568 tostr(rc.font_sizes[LyXFont::SIZE_LARGEST]).c_str());
2569 fl_set_input(dialog_->input_huge,
2570 tostr(rc.font_sizes[LyXFont::SIZE_HUGE]).c_str());
2571 fl_set_input(dialog_->input_huger,
2572 tostr(rc.font_sizes[LyXFont::SIZE_HUGER]).c_str());
2577 FormPreferences::SpellOptions::SpellOptions(FormPreferences & p)
2582 FD_preferences_spelloptions const * FormPreferences::SpellOptions::dialog()
2584 return dialog_.get();
2588 void FormPreferences::SpellOptions::apply(LyXRC & rc)
2590 string choice = fl_get_choice_text(dialog_->choice_spell_command);
2591 choice = trim(choice);
2593 rc.isp_command = choice;
2596 // If spell checker == "none", all other input set to off.
2597 if (fl_get_choice(dialog_->choice_spell_command) == 1) {
2598 rc.isp_use_alt_lang = false;
2599 rc.isp_alt_lang.erase();
2601 rc.isp_use_esc_chars = false;
2602 rc.isp_esc_chars.erase();
2604 rc.isp_use_pers_dict = false;
2605 rc.isp_pers_dict.erase();
2607 rc.isp_accept_compound = false;
2608 rc.isp_use_input_encoding = false;
2611 int button = fl_get_button(dialog_->check_alt_lang);
2612 choice = fl_get_input(dialog_->input_alt_lang);
2613 if (button && choice.empty()) button = 0;
2614 if (!button) choice.erase();
2616 rc.isp_use_alt_lang = static_cast<bool>(button);
2617 rc.isp_alt_lang = choice;
2619 button = fl_get_button(dialog_->check_escape_chars);
2620 choice = fl_get_input(dialog_->input_escape_chars);
2621 if (button && choice.empty()) button = 0;
2622 if (!button) choice.erase();
2624 rc.isp_use_esc_chars = static_cast<bool>(button);
2625 rc.isp_esc_chars = choice;
2627 button = fl_get_button(dialog_->check_personal_dict);
2628 choice = fl_get_input(dialog_->input_personal_dict);
2629 if (button && choice.empty()) button = 0;
2630 if (!button) choice.erase();
2632 rc.isp_use_pers_dict = static_cast<bool>(button);
2633 rc.isp_pers_dict = choice;
2635 button = fl_get_button(dialog_->check_compound_words);
2636 rc.isp_accept_compound = static_cast<bool>(button);
2638 button = fl_get_button(dialog_->check_input_enc);
2639 rc.isp_use_input_encoding = static_cast<bool>(button);
2650 void FormPreferences::SpellOptions::build()
2652 dialog_.reset(build_preferences_spelloptions(&parent_));
2654 fl_addto_choice(dialog_->choice_spell_command,
2655 _(" ispell | aspell ").c_str());
2656 fl_set_input_return(dialog_->input_alt_lang, FL_RETURN_CHANGED);
2657 fl_set_input_return(dialog_->input_escape_chars, FL_RETURN_CHANGED);
2658 fl_set_input_return(dialog_->input_personal_dict, FL_RETURN_CHANGED);
2660 // set up the feedback mechanism
2661 setPrehandler(dialog_->choice_spell_command);
2662 setPrehandler(dialog_->check_alt_lang);
2663 setPrehandler(dialog_->input_alt_lang);
2664 setPrehandler(dialog_->check_escape_chars);
2665 setPrehandler(dialog_->input_escape_chars);
2666 setPrehandler(dialog_->check_personal_dict);
2667 setPrehandler(dialog_->input_personal_dict);
2668 setPrehandler(dialog_->button_personal_dict);
2669 setPrehandler(dialog_->check_compound_words);
2670 setPrehandler(dialog_->check_input_enc);
2675 FormPreferences::SpellOptions::feedback(FL_OBJECT const * const ob) const
2677 if (ob == dialog_->choice_spell_command)
2678 return LyXRC::getDescription(LyXRC::RC_SPELL_COMMAND);
2679 if (ob == dialog_->check_alt_lang)
2680 return LyXRC::getDescription(LyXRC::RC_USE_ALT_LANG);
2681 if (ob == dialog_->input_alt_lang)
2682 return LyXRC::getDescription(LyXRC::RC_ALT_LANG);
2683 if (ob == dialog_->check_escape_chars)
2684 return LyXRC::getDescription(LyXRC::RC_USE_ESC_CHARS);
2685 if (ob == dialog_->input_escape_chars)
2686 return LyXRC::getDescription(LyXRC::RC_ESC_CHARS);
2687 if (ob == dialog_->check_personal_dict)
2688 return LyXRC::getDescription(LyXRC::RC_USE_PERS_DICT);
2689 if (ob == dialog_->input_personal_dict)
2690 return LyXRC::getDescription(LyXRC::RC_PERS_DICT);
2691 if (ob == dialog_->check_compound_words)
2692 return LyXRC::getDescription(LyXRC::RC_ACCEPT_COMPOUND);
2693 if (ob == dialog_->check_input_enc)
2694 return LyXRC::getDescription(LyXRC::RC_USE_INP_ENC);
2699 bool FormPreferences::SpellOptions::input(FL_OBJECT const * const ob)
2701 // !ob if function is called from updateSpellOptions() to de/activate
2703 // otherwise the function is called by an xforms CB via input().
2706 // If spell checker == "none", disable all input.
2707 if (!ob || ob == dialog_->choice_spell_command) {
2708 if (fl_get_choice(dialog_->choice_spell_command) == 1) {
2709 fl_deactivate_object(dialog_->check_alt_lang);
2710 fl_deactivate_object(dialog_->input_alt_lang);
2711 fl_deactivate_object(dialog_->check_escape_chars);
2712 fl_deactivate_object(dialog_->input_escape_chars);
2713 fl_deactivate_object(dialog_->check_personal_dict);
2714 fl_deactivate_object(dialog_->input_personal_dict);
2715 fl_deactivate_object(dialog_->check_compound_words);
2716 fl_deactivate_object(dialog_->check_input_enc);
2719 fl_activate_object(dialog_->check_alt_lang);
2720 fl_activate_object(dialog_->check_escape_chars);
2721 fl_activate_object(dialog_->check_personal_dict);
2722 fl_activate_object(dialog_->check_compound_words);
2723 fl_activate_object(dialog_->check_input_enc);
2728 if (!ob || ob == dialog_->check_alt_lang) {
2729 bool const enable = fl_get_button(dialog_->check_alt_lang);
2730 setEnabled(dialog_->input_alt_lang, enable);
2733 if (!ob || ob == dialog_->check_escape_chars) {
2734 bool const enable = fl_get_button(dialog_->check_escape_chars);
2735 setEnabled(dialog_->input_escape_chars, enable);
2738 if (!ob || ob == dialog_->check_personal_dict) {
2739 bool const enable = fl_get_button(dialog_->check_personal_dict);
2740 setEnabled(dialog_->input_personal_dict, enable);
2743 if (ob == dialog_->button_personal_dict) {
2744 string f = parent_.controller().browsedict(
2745 fl_get_input(dialog_->input_personal_dict));
2746 fl_set_input(dialog_->input_personal_dict, f.c_str());
2749 return true; // All input is valid!
2753 void FormPreferences::SpellOptions::update(LyXRC const & rc)
2757 if (rc.isp_command == "none")
2759 else if (rc.isp_command == "ispell")
2761 else if (rc.isp_command == "aspell")
2764 if (rc.isp_command == "ispell")
2766 else if (rc.isp_command == "aspell")
2769 fl_set_choice(dialog_->choice_spell_command, choice);
2772 if (rc.isp_use_alt_lang)
2773 str = rc.isp_alt_lang;
2775 fl_set_button(dialog_->check_alt_lang,
2776 rc.isp_use_alt_lang);
2777 fl_set_input(dialog_->input_alt_lang, str.c_str());
2780 if (rc.isp_use_esc_chars)
2781 str = rc.isp_esc_chars;
2783 fl_set_button(dialog_->check_escape_chars,
2784 rc.isp_use_esc_chars);
2785 fl_set_input(dialog_->input_escape_chars, str.c_str());
2788 if (rc.isp_use_pers_dict)
2789 str = rc.isp_pers_dict;
2791 fl_set_button(dialog_->check_personal_dict,
2792 rc.isp_use_pers_dict);
2793 fl_set_input(dialog_->input_personal_dict, str.c_str());
2795 fl_set_button(dialog_->check_compound_words,
2796 rc.isp_accept_compound);
2797 fl_set_button(dialog_->check_input_enc,
2798 rc.isp_use_input_encoding);
2800 // Activate/Deactivate the input fields dependent on the state of the