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),
94 string const X11hexname(RGBColor const & col)
98 ostr << '#' << std::setbase(16) << setfill('0')
103 return STRCONV(ostr.str());
106 #if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
107 bool const scalableTabfolders = false;
109 bool const scalableTabfolders = true;
115 typedef FormCB<ControlPrefs, FormDB<FD_preferences> > base_class;
118 FormPreferences::FormPreferences()
119 : base_class(_("Preferences"), scalableTabfolders),
120 colors_(*this), converters_(*this), inputs_misc_(*this),
121 formats_(*this), interface_(*this), language_(*this),
122 lnf_misc_(*this), identity_(*this), outputs_misc_(*this),
123 paths_(*this), printer_(*this), screen_fonts_(*this),
129 void FormPreferences::redraw()
131 if (!(form() && form()->visible))
133 fl_redraw_form(form());
135 FL_FORM * form2 = fl_get_active_folder(dialog_->tabfolder_prefs);
136 if (!(form2 && form2->visible))
138 fl_redraw_form(form2);
141 if (form2 == converters_tab_->form)
142 form3 = fl_get_active_folder(converters_tab_->tabfolder_inner);
144 else if (form2 == look_n_feel_tab_->form)
145 form3 = fl_get_active_folder(look_n_feel_tab_->tabfolder_inner);
147 else if (form2 == inputs_tab_->form)
148 form3 = fl_get_active_folder(inputs_tab_->tabfolder_inner);
150 else if (form2 == outputs_tab_->form)
151 form3 = fl_get_active_folder(outputs_tab_->tabfolder_inner);
153 else if (form2 == lang_opts_tab_->form)
154 form3 = fl_get_active_folder(lang_opts_tab_->tabfolder_inner);
156 if (form3 && form3->visible)
157 fl_redraw_form(form3);
161 void FormPreferences::hide()
163 // We need to hide the active tabfolder otherwise we get a
164 // BadDrawable error from X window and LyX crashes without saving.
165 FL_FORM * inner_form = fl_get_active_folder(dialog_->tabfolder_prefs);
166 if (inner_form && inner_form->visible)
167 fl_hide_form(inner_form);
172 void FormPreferences::build()
174 dialog_.reset(build_preferences(this));
176 // Manage the restore, save, apply and cancel/close buttons
177 bcview().setOK(dialog_->button_ok);
178 bcview().setApply(dialog_->button_apply);
179 bcview().setCancel(dialog_->button_close);
180 bcview().setRestore(dialog_->button_restore);
182 // Allow the base class to control messages
183 setMessageWidget(dialog_->text_warning);
185 // build the tab folders
186 converters_tab_.reset(build_preferences_inner_tab(this));
187 look_n_feel_tab_.reset(build_preferences_inner_tab(this));
188 inputs_tab_.reset(build_preferences_inner_tab(this));
189 outputs_tab_.reset(build_preferences_inner_tab(this));
190 lang_opts_tab_.reset(build_preferences_inner_tab(this));
192 // build actual tabfolder contents
193 // these will become nested tabfolders
197 inputs_misc_.build();
202 outputs_misc_.build();
205 screen_fonts_.build();
206 spelloptions_.build();
208 // Enable the tabfolders to be rescaled correctly.
209 if (scalableTabfolders) {
210 FL_OBJECT * folder = dialog_->tabfolder_prefs;
211 fl_set_tabfolder_autofit(folder, FL_FIT);
213 folder = look_n_feel_tab_->tabfolder_inner;
214 fl_set_tabfolder_autofit(folder, FL_FIT);
216 folder = converters_tab_->tabfolder_inner;
217 fl_set_tabfolder_autofit(folder, FL_FIT);
219 folder = inputs_tab_->tabfolder_inner;
220 fl_set_tabfolder_autofit(folder, FL_FIT);
222 folder = outputs_tab_->tabfolder_inner;
223 fl_set_tabfolder_autofit(folder, FL_FIT);
225 folder = lang_opts_tab_->tabfolder_inner;
226 fl_set_tabfolder_autofit(folder, FL_FIT);
230 // Now add them to the tabfolder
231 fl_addto_tabfolder(dialog_->tabfolder_prefs,
232 _("Look & Feel").c_str(),
233 look_n_feel_tab_->form);
234 fl_addto_tabfolder(dialog_->tabfolder_prefs,
235 _("Lang Opts").c_str(),
236 lang_opts_tab_->form);
237 fl_addto_tabfolder(dialog_->tabfolder_prefs,
238 _("Conversion").c_str(),
239 converters_tab_->form);
240 fl_addto_tabfolder(dialog_->tabfolder_prefs,
243 fl_addto_tabfolder(dialog_->tabfolder_prefs,
244 _("Outputs").c_str(),
247 // now build the nested tabfolders
248 // Starting with look and feel
249 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
250 _("Screen Fonts").c_str(),
251 screen_fonts_.dialog()->form);
252 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
253 _("Interface").c_str(),
254 interface_.dialog()->form);
255 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
257 colors_.dialog()->form);
258 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
260 lnf_misc_.dialog()->form);
261 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
262 _("Identity").c_str(),
263 identity_.dialog()->form);
265 // then build converters
266 fl_addto_tabfolder(converters_tab_->tabfolder_inner,
267 _("Formats").c_str(),
268 formats_.dialog()->form);
269 fl_addto_tabfolder(converters_tab_->tabfolder_inner,
270 _("Converters").c_str(),
271 converters_.dialog()->form);
274 // Paths should probably go in a few inner_tab called Files
275 fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
277 paths_.dialog()->form);
278 fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
280 inputs_misc_.dialog()->form);
282 // then building outputs
283 fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
284 _("Printer").c_str(),
285 printer_.dialog()->form);
286 fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
288 outputs_misc_.dialog()->form);
290 // then building usage
291 fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
292 _("Spell checker").c_str(),
293 spelloptions_.dialog()->form);
294 fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
295 _("Language").c_str(),
296 language_.dialog()->form);
300 void FormPreferences::apply()
302 // set the new lyxrc entries
303 // many of these need to trigger other functions when the assignment
304 // is made. For example, screen zoom and font types. These could be
305 // handled either by signals/slots in lyxrc or just directly call the
306 // associated functions here.
307 // There are other problems with this scheme. We really should check
308 // what we copy to make sure that it really is necessary to do things
309 // like update the screen fonts because that flushes the textcache
310 // and other stuff which may cost us a lot on slower/high-load
313 LyXRC & rc(controller().rc());
316 formats_.apply(); // Must be before converters_.apply()
318 inputs_misc_.apply(rc);
319 interface_.apply(rc);
323 outputs_misc_.apply(rc);
326 screen_fonts_.apply(rc);
327 spelloptions_.apply(rc);
329 // The "Save" button has been pressed.
330 if (controller().isClosing() && colors_.modifiedXformsPrefs) {
331 string const filename =
332 AddName(user_lyxdir(), "preferences.xform");
333 colors_.modifiedXformsPrefs = !XformsColor::write(filename);
338 string const FormPreferences::getFeedback(FL_OBJECT * ob)
342 if (ob->form->fdui == colors_.dialog())
343 return colors_.feedback(ob);
344 if (ob->form->fdui == converters_.dialog())
345 return converters_.feedback(ob);
346 if (ob->form->fdui == formats_.dialog())
347 return formats_.feedback(ob);
348 if (ob->form->fdui == inputs_misc_.dialog())
349 return inputs_misc_.feedback(ob);
350 if (ob->form->fdui == interface_.dialog())
351 return interface_.feedback(ob);
352 if (ob->form->fdui == language_.dialog())
353 return language_.feedback(ob);
354 if (ob->form->fdui == lnf_misc_.dialog())
355 return lnf_misc_.feedback(ob);
356 if (ob->form->fdui == outputs_misc_.dialog())
357 return outputs_misc_.feedback(ob);
358 if (ob->form->fdui == paths_.dialog())
359 return paths_.feedback(ob);
360 if (ob->form->fdui == printer_.dialog())
361 return printer_.feedback(ob);
362 if (ob->form->fdui == screen_fonts_.dialog())
363 return screen_fonts_.feedback(ob);
364 if (ob->form->fdui == spelloptions_.dialog())
365 return spelloptions_.feedback(ob);
371 ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long)
377 // whatever checks you need to ensure the user hasn't entered
378 // some totally ridiculous value somewhere. Change activate to suit.
379 // comments before each test describe what is _valid_
381 if (ob->form->fdui == colors_.dialog()) {
383 } else if (ob->form->fdui == converters_.dialog()) {
384 valid = converters_.input(ob);
385 } else if (ob->form->fdui == formats_.dialog()) {
386 valid = formats_.input(ob);
387 } else if (ob->form->fdui == interface_.dialog()) {
388 valid = interface_.input(ob);
389 } else if (ob->form->fdui == language_.dialog()) {
390 valid = language_.input(ob);
391 } else if (ob->form->fdui == paths_.dialog()) {
392 valid = paths_.input(ob);
393 } else if (ob->form->fdui == screen_fonts_.dialog()) {
394 valid = screen_fonts_.input();
395 } else if (ob->form->fdui == spelloptions_.dialog()) {
396 valid = spelloptions_.input(ob);
399 return valid ? ButtonPolicy::SMI_VALID : ButtonPolicy::SMI_INVALID;
403 void FormPreferences::update()
405 if (!dialog_.get()) return;
407 LyXRC const & rc(controller().rc());
409 // read lyxrc entries
411 formats_.update(); // Must be before converters_.update()
412 converters_.update();
413 inputs_misc_.update(rc);
414 interface_.update(rc);
415 language_.update(rc);
416 lnf_misc_.update(rc);
417 identity_.update(rc);
418 outputs_misc_.update(rc);
421 screen_fonts_.update(rc);
422 spelloptions_.update(rc);
426 FormPreferences::Colors::Colors(FormPreferences & p)
427 : modifiedXformsPrefs(false), parent_(p)
431 FD_preferences_colors const * FormPreferences::Colors::dialog()
433 return dialog_.get();
437 void FormPreferences::Colors::apply()
439 bool modifiedText = false;
440 bool modifiedBackground = false;
442 for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
443 cit != xformsColorDB.end(); ++cit) {
445 fl_getmcolor(cit->colorID, &col.r, &col.g, &col.b);
446 if (col != cit->color()) {
447 modifiedXformsPrefs = true;
448 if (cit->colorID == FL_BLACK)
450 if (cit->colorID == FL_COL1)
451 modifiedBackground = true;
455 if (modifiedXformsPrefs) {
456 for (vector<XformsColor>::const_iterator cit =
457 xformsColorDB.begin();
458 cit != xformsColorDB.end(); ++cit) {
459 fl_mapcolor(cit->colorID, cit->r, cit->g, cit->b);
461 if (modifiedText && cit->colorID == FL_BLACK) {
462 AdjustVal(FL_INACTIVE, FL_BLACK, 0.5);
465 if (modifiedBackground && cit->colorID == FL_COL1) {
466 AdjustVal(FL_MCOL, FL_COL1, 0.1);
467 AdjustVal(FL_TOP_BCOL, FL_COL1, 0.1);
468 AdjustVal(FL_LEFT_BCOL, FL_COL1, 0.1);
470 AdjustVal(FL_RIGHT_BCOL, FL_COL1, -0.5);
471 AdjustVal(FL_BOTTOM_BCOL, FL_COL1, -0.5);
474 if (cit->colorID == GUI_COLOR_CURSOR) {
475 fl_mapcolor(GUI_COLOR_CURSOR,
476 cit->r, cit->g, cit->b);
477 setCursorColor(GUI_COLOR_CURSOR);
480 parent_.controller().redrawGUI();
483 // Now do the same for the LyX LColors...
484 for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
485 cit != lyxColorDB.end(); ++cit) {
486 LColor::color lc = lcolor.getFromGUIName(cit->getname());
487 if (lc == LColor::inherit) continue;
489 // Create a valid X11 name of the form "#rrggbb"
490 string const hexname = X11hexname(cit->color());
492 if (lcolor.getX11Name(lc) != hexname) {
494 << "FormPreferences::Colors::apply: "
495 << "resetting LColor " << lcolor.getGUIName(lc)
496 << " from \"" << lcolor.getX11Name(lc)
497 << "\" to \"" << hexname << "\"."
500 parent_.controller().setColor(lc, hexname);
506 void FormPreferences::Colors::build()
508 picker_.reset(new FormColorpicker);
509 dialog_.reset(build_preferences_colors(&parent_));
511 fl_set_object_color(dialog_->button_color,
512 GUI_COLOR_CHOICE, GUI_COLOR_CHOICE);
514 // set up the feedback mechanism
515 setPrehandler(dialog_->browser_lyx_objs);
516 setPrehandler(dialog_->button_color);
517 setPrehandler(dialog_->button_modify);
522 FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
524 if (ob == dialog_->browser_lyx_objs)
525 return _("LyX objects that can be assigned a color.");
527 if (ob == dialog_->button_modify)
528 return _("Modify the LyX object's color. Note: you must then \"Apply\" the change.");
534 void FormPreferences::Colors::input(FL_OBJECT const * const ob)
536 if (ob == dialog_->browser_lyx_objs) {
539 } else if (ob == dialog_->button_modify) {
545 void FormPreferences::Colors::AdjustVal(int colAdjust, int colParent,
549 fl_getmcolor(colParent, &rgb.r, &rgb.g, &rgb.b);
553 hsv.v = min(1.0, max(0.0, hsv.v));
556 fl_mapcolor(colAdjust, rgb.r, rgb.g, rgb.b);
560 void FormPreferences::Colors::InputBrowserLyX() const
562 vector<NamedColor>::size_type const selLyX =
563 fl_get_browser(dialog_->browser_lyx_objs);
564 if (selLyX < 1) return;
566 // Is the choice an Xforms color...
569 if (selLyX - 1 < xformsColorDB.size()) {
570 vector<XformsColor>::size_type const i = selLyX - 1;
571 col = xformsColorDB[i].color();
573 // or a LyX Logical color?
575 vector<NamedColor>::size_type const i = selLyX - 1 -
576 xformsColorDB.size();
577 col = lyxColorDB[i].color();
580 fl_freeze_form(dialog_->form);
582 fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
583 fl_redraw_object(dialog_->button_color);
585 fl_unfreeze_form(dialog_->form);
589 void FormPreferences::Colors::LoadBrowserLyX()
591 if (!dialog_->browser_lyx_objs->visible)
594 // First, define the modifiable xforms colors
595 xformsColorDB.clear();
598 xcol.name = _("GUI background");
599 xcol.colorID = FL_COL1;
600 fl_getmcolor(FL_COL1, &xcol.r, &xcol.g, &xcol.b);
602 xformsColorDB.push_back(xcol);
604 xcol.name = _("GUI text");
605 xcol.colorID = FL_BLACK;
606 fl_getmcolor(FL_BLACK, &xcol.r, &xcol.g, &xcol.b);
608 xformsColorDB.push_back(xcol);
610 xcol.name = _("GUI selection");
611 xcol.colorID = FL_YELLOW;
612 fl_getmcolor(FL_YELLOW, &xcol.r, &xcol.g, &xcol.b);
614 xformsColorDB.push_back(xcol);
616 xcol.name = _("GUI pointer");
617 xcol.colorID = GUI_COLOR_CURSOR;
618 fl_getmcolor(GUI_COLOR_CURSOR, &xcol.r, &xcol.g, &xcol.b);
620 xformsColorDB.push_back(xcol);
622 // Now create the the LyX LColors database
624 for (int i=0; i<LColor::ignore; ++i) {
625 LColor::color lc = static_cast<LColor::color>(i);
626 if (lc == LColor::none
627 || lc == LColor::black
628 || lc == LColor::white
630 || lc == LColor::green
631 || lc == LColor::blue
632 || lc == LColor::cyan
633 || lc == LColor::magenta
634 || lc == LColor::yellow
635 || lc == LColor::inherit
636 || lc == LColor::ignore) continue;
639 bool const success = getRGBColor(lc, col.r, col.g, col.b);
641 lyxerr << "FormPreferences::Colors::LoadBrowserLyX:\n"
642 << "LColor " << lcolor.getLyXName(lc)
643 << ": X can't find color \""
644 << lcolor.getX11Name(lc)
645 << "\". Set to \"black\"!" << endl;
647 string const arg = lcolor.getLyXName(lc) + " black";
648 parent_.controller().setColor(lc, "black");
652 // Create a valid X11 name of the form "#rrggbb" and change the
653 // LColor X11name to this. Don't want to trigger a redraw,
654 // as we're just changing the name not the RGB values.
655 // Also reset the system_lcolor names, so that we don't output
656 // unnecessary changes.
657 string const hexname = X11hexname(col);
659 if (lcolor.getX11Name(lc) != hexname) {
660 lcolor.setColor(lc, hexname);
661 system_lcolor.setColor(lc, hexname);
664 // Finally, push the color onto the database
665 NamedColor ncol(lcolor.getGUIName(lc), col);
666 lyxColorDB.push_back(ncol);
669 // Now construct the browser
670 FL_OBJECT * colbr = dialog_->browser_lyx_objs;
671 fl_freeze_form(dialog_->form);
672 fl_clear_browser(colbr);
673 for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
674 cit != xformsColorDB.end(); ++cit) {
675 fl_addto_browser(colbr, cit->getname().c_str());
677 for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
678 cit != lyxColorDB.end(); ++cit) {
679 fl_addto_browser(colbr, cit->getname().c_str());
682 // just to be safe...
683 fl_set_browser_topline(dialog_->browser_lyx_objs, 1);
684 fl_select_browser_line(dialog_->browser_lyx_objs, 1);
685 fl_unfreeze_form(dialog_->form);
691 void FormPreferences::Colors::Modify()
693 vector<NamedColor>::size_type const selLyX =
694 fl_get_browser(dialog_->browser_lyx_objs);
699 fl_getmcolor(GUI_COLOR_CHOICE, &before.r, &before.g, &before.b);
701 RGBColor col = picker_->requestColor(before);
705 fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
706 fl_redraw_object(dialog_->button_color);
708 // Is the choice an Xforms color...
709 if (selLyX - 1 < xformsColorDB.size()) {
710 vector<XformsColor>::size_type const i = selLyX - 1;
711 xformsColorDB[i].r = col.r;
712 xformsColorDB[i].g = col.g;
713 xformsColorDB[i].b = col.b;
715 // or a LyX Logical color?
717 vector<NamedColor>::size_type const i = selLyX - 1 -
718 xformsColorDB.size();
719 lyxColorDB[i].r = col.r;
720 lyxColorDB[i].g = col.g;
721 lyxColorDB[i].b = col.b;
726 FormPreferences::Converters::Converters(FormPreferences & p)
731 FD_preferences_converters const * FormPreferences::Converters::dialog()
733 return dialog_.get();
737 void FormPreferences::Converters::apply() const
739 parent_.controller().setConverters(local_converters);
743 void FormPreferences::Converters::build()
745 dialog_.reset(build_preferences_converters(&parent_));
747 fl_set_input_return(dialog_->input_converter, FL_RETURN_CHANGED);
748 fl_set_input_return(dialog_->input_flags, FL_RETURN_CHANGED);
750 // set up the feedback mechanism
751 setPrehandler(dialog_->browser_all);
752 setPrehandler(dialog_->button_delete);
753 setPrehandler(dialog_->button_add);
754 setPrehandler(dialog_->input_converter);
755 setPrehandler(dialog_->choice_from);
756 setPrehandler(dialog_->choice_to);
757 setPrehandler(dialog_->input_flags);
762 FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const
764 if (ob == dialog_->browser_all)
765 return _("All explicitly defined converters for LyX");
767 if (ob == dialog_->choice_from)
768 return _("Convert \"from\" this format");
770 if (ob == dialog_->choice_to)
771 return _("Convert \"to\" this format");
773 if (ob == dialog_->input_converter)
774 return _("The conversion command. $$i is the input file name, "
775 "$$b is the file name without its extension and $$o is "
776 "the name of the output file. $$s can be used as path to "
777 "LyX's own collection of conversion scripts.");
779 if (ob == dialog_->input_flags)
780 return _("Extra information for the Converter class, whether and "
781 "how to parse the result, and various other things.");
783 if (ob == dialog_->button_delete)
784 return _("Remove the current converter from the list of available "
785 "converters. Note: you must then \"Apply\" the change.");
787 if (ob == dialog_->button_add) {
788 if (string(ob->label) == _("Add"))
789 return _("Add the current converter to the list of available "
790 "converters. Note: you must then \"Apply\" the change.");
792 return _("Modify the contents of the current converter. "
793 "Note: you must then \"Apply\" the change.");
800 bool FormPreferences::Converters::input(FL_OBJECT const * const ob)
802 if (ob == dialog_->browser_all)
805 if (ob == dialog_->choice_from
806 || ob == dialog_->choice_to
807 || ob == dialog_->input_converter
808 || ob == dialog_->input_flags)
811 if (ob == dialog_->button_add)
814 if (ob == dialog_->button_delete)
821 void FormPreferences::Converters::update()
823 local_converters = converters;
824 local_converters.update(local_formats);
829 void FormPreferences::Converters::UpdateBrowser()
831 local_converters.sort();
833 fl_freeze_form(dialog_->form);
834 fl_clear_browser(dialog_->browser_all);
835 for (::Converters::const_iterator cit = local_converters.begin();
836 cit != local_converters.end(); ++cit) {
837 string const name = cit->From->prettyname() + " -> "
838 + cit->To->prettyname();
839 fl_addto_browser(dialog_->browser_all, name.c_str());
842 fl_unfreeze_form(dialog_->form);
846 bool FormPreferences::Converters::Add()
848 string const from = GetFrom();
849 string const to = GetTo();
850 string const command = fl_get_input(dialog_->input_converter);
851 string const flags = fl_get_input(dialog_->input_flags);
853 Converter const * old = local_converters.getConverter(from, to);
854 local_converters.add(from, to, command, flags);
856 local_converters.updateLast(local_formats);
859 setEnabled(dialog_->button_add, false);
865 bool FormPreferences::Converters::Browser()
867 int const i = fl_get_browser(dialog_->browser_all);
868 if (i <= 0) return false;
870 fl_freeze_form(dialog_->form);
872 Converter const & c = local_converters.get(i - 1);
873 int j = local_formats.getNumber(c.from);
875 fl_set_choice(dialog_->choice_from, j + 1);
877 j = local_formats.getNumber(c.to);
879 fl_set_choice(dialog_->choice_to, j + 1);
881 fl_set_input(dialog_->input_converter, c.command.c_str());
882 fl_set_input(dialog_->input_flags, c.flags.c_str());
884 fl_set_object_label(dialog_->button_add, idex(_("Modify|#M")).c_str());
885 fl_set_button_shortcut(dialog_->button_add,
886 scex(_("Modify|#M")).c_str(), 1);
888 setEnabled(dialog_->button_add, false);
889 setEnabled(dialog_->button_delete, true);
891 fl_unfreeze_form(dialog_->form);
896 bool FormPreferences::Converters::erase()
898 string const from = GetFrom();
899 string const to = GetTo();
901 local_converters.erase(from, to);
907 bool FormPreferences::Converters::Input()
909 string const from = GetFrom();
910 string const to = GetTo();
911 int const sel = local_converters.getNumber(from, to);
913 fl_freeze_form(dialog_->form);
916 fl_set_object_label(dialog_->button_add,
917 idex(_("Add|#A")).c_str());
918 fl_set_button_shortcut(dialog_->button_add,
919 scex(_("Add|#A")).c_str(), 1);
921 fl_deselect_browser(dialog_->browser_all);
922 setEnabled(dialog_->button_delete, false);
925 fl_set_object_label(dialog_->button_add,
926 idex(_("Modify|#M")).c_str());
927 fl_set_button_shortcut(dialog_->button_add,
928 scex(_("Modify|#M")).c_str(), 1);
930 int top = max(sel-5, 0);
931 fl_set_browser_topline(dialog_->browser_all, top);
932 fl_select_browser_line(dialog_->browser_all, sel+1);
933 setEnabled(dialog_->button_delete, true);
936 string const command = rtrim(fl_get_input(dialog_->input_converter));
937 bool const enable = !(command.empty() || from == to);
938 setEnabled(dialog_->button_add, enable);
940 fl_unfreeze_form(dialog_->form);
945 string const FormPreferences::Converters::GetFrom() const
947 ::Formats::FormatList::size_type const i =
948 fl_get_choice(dialog_->choice_from);
950 if (i > 0 && i <= local_formats.size())
951 return local_formats.get(i - 1).name();
953 lyxerr << "FormPreferences::Converters::GetFrom: No choice!" << endl;
958 string const FormPreferences::Converters::GetTo() const
960 ::Formats::FormatList::size_type const i =
961 fl_get_choice(dialog_->choice_to);
963 if (i > 0 && i <= local_formats.size())
964 return local_formats.get(i - 1).name();
966 lyxerr << "FormPreferences::Converters::GetTo: No choice!" << endl;
971 void FormPreferences::Converters::UpdateChoices() const
974 for (::Formats::const_iterator cit = local_formats.begin();
975 cit != local_formats.end(); ++cit) {
980 choice += cit->prettyname();
984 fl_clear_choice(dialog_->choice_from);
985 fl_addto_choice(dialog_->choice_from, choice.c_str());
987 fl_clear_choice(dialog_->choice_to);
988 fl_addto_choice(dialog_->choice_to, choice.c_str());
992 FormPreferences::Formats::Formats(FormPreferences & p)
997 FD_preferences_formats const * FormPreferences::Formats::dialog()
999 return dialog_.get();
1003 void FormPreferences::Formats::apply() const
1005 parent_.controller().setFormats(local_formats);
1009 void FormPreferences::Formats::build()
1011 dialog_.reset(build_preferences_formats(&parent_));
1013 fl_set_input_return(dialog_->input_format, FL_RETURN_CHANGED);
1014 fl_set_input_return(dialog_->input_viewer, FL_RETURN_CHANGED);
1015 fl_set_input_return(dialog_->input_shrtcut, FL_RETURN_CHANGED);
1016 fl_set_input_return(dialog_->input_gui_name, FL_RETURN_CHANGED);
1017 fl_set_input_return(dialog_->input_extension, FL_RETURN_CHANGED);
1019 fl_set_input_filter(dialog_->input_format, fl_lowercase_filter);
1021 // set up the feedback mechanism
1022 setPrehandler(dialog_->browser_all);
1023 setPrehandler(dialog_->input_format);
1024 setPrehandler(dialog_->input_gui_name);
1025 setPrehandler(dialog_->button_delete);
1026 setPrehandler(dialog_->button_add);
1027 setPrehandler(dialog_->input_extension);
1028 setPrehandler(dialog_->input_viewer);
1029 setPrehandler(dialog_->input_shrtcut);
1034 FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
1036 if (ob == dialog_->browser_all)
1037 return _("All the currently defined formats known to LyX.");
1039 if (ob == dialog_->input_format)
1040 return _("The format identifier.");
1042 if (ob == dialog_->input_gui_name)
1043 return _("The format name as it will appear in the menus.");
1045 if (ob == dialog_->input_shrtcut)
1046 return _("The keyboard accelerator. Use a letter in the GUI name. "
1049 if (ob == dialog_->input_extension)
1050 return _("Used to recognize the file. E.g., ps, pdf, tex.");
1052 if (ob == dialog_->input_viewer)
1053 return _("The command used to launch the viewer application.");
1055 if (ob == dialog_->button_delete)
1056 return _("Remove the current format from the list of available "
1057 "formats. Note: you must then \"Apply\" the change.");
1059 if (ob == dialog_->button_add) {
1060 if (string(ob->label) == _("Add"))
1061 return _("Add the current format to the list of available "
1062 "formats. Note: you must then \"Apply\" the change.");
1064 return _("Modify the contents of the current format. Note: "
1065 "you must then \"Apply\" the change.");
1072 bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
1074 if (ob == dialog_->browser_all)
1077 if (ob == dialog_->input_format
1078 || ob == dialog_->input_gui_name
1079 || ob == dialog_->input_shrtcut
1080 || ob == dialog_->input_extension
1081 || ob == dialog_->input_viewer)
1084 if (ob == dialog_->button_add)
1087 if (ob == dialog_->button_delete)
1094 void FormPreferences::Formats::update()
1096 local_formats = formats;
1101 void FormPreferences::Formats::UpdateBrowser()
1103 local_formats.sort();
1105 fl_freeze_form(dialog_->form);
1106 fl_deselect_browser(dialog_->browser_all);
1107 fl_clear_browser(dialog_->browser_all);
1108 for (::Formats::const_iterator cit = local_formats.begin();
1109 cit != local_formats.end(); ++cit)
1110 fl_addto_browser(dialog_->browser_all,
1111 cit->prettyname().c_str());
1114 fl_unfreeze_form(dialog_->form);
1116 // Mustn't forget to update the Formats available to the converters_
1117 parent_.converters_.UpdateChoices();
1118 local_converters.update(local_formats);
1122 bool FormPreferences::Formats::Add()
1124 string const name = fl_get_input(dialog_->input_format);
1125 string const prettyname = fl_get_input(dialog_->input_gui_name);
1126 string const extension = fl_get_input(dialog_->input_extension);
1127 string const shortcut = fl_get_input(dialog_->input_shrtcut);
1128 string const viewer = fl_get_input(dialog_->input_viewer);
1130 Format const * old = local_formats.getFormat(name);
1131 string const old_prettyname = old ? old->prettyname() : string();
1132 local_formats.add(name, extension, prettyname, shortcut);
1133 local_formats.setViewer(name, viewer);
1134 if (!old || prettyname != old_prettyname) {
1137 parent_.converters_.UpdateBrowser();
1139 setEnabled(dialog_->button_add, false);
1145 bool FormPreferences::Formats::Browser()
1147 int const i = fl_get_browser(dialog_->browser_all);
1151 fl_freeze_form(dialog_->form);
1153 Format const & f = local_formats.get(i - 1);
1155 fl_set_input(dialog_->input_format, f.name().c_str());
1156 fl_set_input(dialog_->input_gui_name, f.prettyname().c_str());
1157 fl_set_input(dialog_->input_shrtcut, f.shortcut().c_str());
1158 fl_set_input(dialog_->input_extension, f.extension().c_str());
1159 fl_set_input(dialog_->input_viewer, f.viewer().c_str());
1161 fl_set_object_label(dialog_->button_add,
1162 idex(_("Modify|#M")).c_str());
1163 fl_set_button_shortcut(dialog_->button_add,
1164 scex(_("Modify|#M")).c_str(), 1);
1166 setEnabled(dialog_->button_add, false);
1167 setEnabled(dialog_->button_delete, true);
1169 fl_unfreeze_form(dialog_->form);
1174 bool FormPreferences::Formats::erase()
1176 string const name = fl_get_input(dialog_->input_format);
1178 if (local_converters.formatIsUsed(name)) {
1179 parent_.postWarning(_("Cannot remove a Format used by a Converter. "
1180 "Remove the converter first."));
1181 setEnabled(dialog_->button_delete, false);
1185 local_formats.erase(name);
1191 bool FormPreferences::Formats::Input()
1193 string const name = fl_get_input(dialog_->input_format);
1194 int const sel = local_formats.getNumber(name);
1195 fl_freeze_form(dialog_->form);
1198 fl_set_object_label(dialog_->button_add,
1199 idex(_("Add|#A")).c_str());
1200 fl_set_button_shortcut(dialog_->button_add,
1201 scex(_("Add|#A")).c_str(), 1);
1203 fl_deselect_browser(dialog_->browser_all);
1204 setEnabled(dialog_->button_delete, false);
1207 fl_set_object_label(dialog_->button_add,
1208 idex(_("Modify|#M")).c_str());
1209 fl_set_button_shortcut(dialog_->button_add,
1210 scex(_("Modify|#M")).c_str(), 1);
1212 int const top = max(sel-5, 0);
1213 fl_set_browser_topline(dialog_->browser_all, top);
1214 fl_select_browser_line(dialog_->browser_all, sel+1);
1216 setEnabled(dialog_->button_add, true);
1217 setEnabled(dialog_->button_delete, true);
1220 string const prettyname = fl_get_input(dialog_->input_gui_name);
1221 bool const enable = !(name.empty() || prettyname.empty());
1222 setEnabled(dialog_->button_add, enable);
1224 fl_unfreeze_form(dialog_->form);
1229 FormPreferences::Identity::Identity(FormPreferences & p)
1234 FD_preferences_identity const * FormPreferences::Identity::dialog()
1236 return dialog_.get();
1240 void FormPreferences::Identity::apply(LyXRC & rc) const
1242 rc.user_name = fl_get_input(dialog_->input_user_name);
1243 rc.user_email = fl_get_input(dialog_->input_user_email);
1247 void FormPreferences::Identity::build()
1249 dialog_.reset(build_preferences_identity(&parent_));
1250 fl_set_input_return(dialog_->input_user_name, FL_RETURN_CHANGED);
1251 fl_set_input_return(dialog_->input_user_email, FL_RETURN_CHANGED);
1255 void FormPreferences::Identity::update(LyXRC const & rc)
1257 fl_set_input(dialog_->input_user_name, rc.user_name.c_str());
1258 fl_set_input(dialog_->input_user_email, rc.user_email.c_str());
1262 FormPreferences::InputsMisc::InputsMisc(FormPreferences & p)
1267 FD_preferences_inputs_misc const * FormPreferences::InputsMisc::dialog()
1269 return dialog_.get();
1273 void FormPreferences::InputsMisc::apply(LyXRC & rc) const
1275 rc.date_insert_format =
1276 fl_get_input(dialog_->input_date_format);
1280 void FormPreferences::InputsMisc::build()
1282 dialog_.reset(build_preferences_inputs_misc(&parent_));
1284 fl_set_input_return(dialog_->input_date_format, FL_RETURN_CHANGED);
1286 // set up the feedback mechanism
1287 setPrehandler(dialog_->input_date_format);
1292 FormPreferences::InputsMisc::feedback(FL_OBJECT const * const ob) const
1294 if (ob == dialog_->input_date_format)
1295 return LyXRC::getDescription(LyXRC::RC_DATE_INSERT_FORMAT);
1300 void FormPreferences::InputsMisc::update(LyXRC const & rc)
1302 fl_set_input(dialog_->input_date_format,
1303 rc.date_insert_format.c_str());
1307 FormPreferences::Interface::Interface(FormPreferences & p)
1312 FD_preferences_interface const * FormPreferences::Interface::dialog()
1314 return dialog_.get();
1318 void FormPreferences::Interface::apply(LyXRC & rc) const
1320 rc.popup_normal_font =
1321 fl_get_input(dialog_->input_popup_normal_font);
1322 rc.popup_bold_font = fl_get_input(dialog_->input_popup_bold_font);
1323 rc.popup_font_encoding =
1324 fl_get_input(dialog_->input_popup_font_encoding);
1325 rc.bind_file = fl_get_input(dialog_->input_bind_file);
1326 rc.ui_file = fl_get_input(dialog_->input_ui_file);
1330 void FormPreferences::Interface::build()
1332 dialog_.reset(build_preferences_interface(&parent_));
1334 fl_set_input_return(dialog_->input_popup_normal_font, FL_RETURN_CHANGED);
1335 fl_set_input_return(dialog_->input_popup_bold_font, FL_RETURN_CHANGED);
1336 fl_set_input_return(dialog_->input_popup_font_encoding, FL_RETURN_CHANGED);
1337 fl_set_input_return(dialog_->input_bind_file, FL_RETURN_CHANGED);
1338 fl_set_input_return(dialog_->input_ui_file, FL_RETURN_CHANGED);
1340 // set up the feedback mechanism
1341 setPrehandler(dialog_->input_popup_normal_font);
1342 setPrehandler(dialog_->input_popup_bold_font);
1343 setPrehandler(dialog_->input_popup_font_encoding);
1344 setPrehandler(dialog_->input_bind_file);
1345 setPrehandler(dialog_->button_bind_file_browse);
1346 setPrehandler(dialog_->input_ui_file);
1347 setPrehandler(dialog_->button_ui_file_browse);
1352 FormPreferences::Interface::feedback(FL_OBJECT const * const ob) const
1354 if (ob == dialog_->input_popup_normal_font)
1355 return LyXRC::getDescription(LyXRC::RC_POPUP_NORMAL_FONT);
1356 if (ob == dialog_->input_popup_bold_font)
1357 return LyXRC::getDescription(LyXRC::RC_POPUP_BOLD_FONT);
1358 if (ob == dialog_->input_popup_font_encoding)
1359 return LyXRC::getDescription(LyXRC::RC_POPUP_FONT_ENCODING);
1360 if (ob == dialog_->input_bind_file)
1361 return LyXRC::getDescription(LyXRC::RC_BINDFILE);
1362 if (ob == dialog_->input_ui_file)
1363 return LyXRC::getDescription(LyXRC::RC_UIFILE);
1368 bool FormPreferences::Interface::input(FL_OBJECT const * const ob)
1370 if (ob == dialog_->button_bind_file_browse) {
1371 string f = parent_.controller().browsebind(
1372 fl_get_input(dialog_->input_bind_file));
1374 fl_set_input(dialog_->input_bind_file, f.c_str());
1375 } else if (ob == dialog_->button_ui_file_browse) {
1376 string f = parent_.controller().browseUI(
1377 fl_get_input(dialog_->input_ui_file));
1379 fl_set_input(dialog_->input_ui_file, f.c_str());
1386 void FormPreferences::Interface::update(LyXRC const & rc)
1388 fl_set_input(dialog_->input_popup_normal_font,
1389 rc.popup_normal_font.c_str());
1390 fl_set_input(dialog_->input_popup_bold_font,
1391 rc.popup_bold_font.c_str());
1392 fl_set_input(dialog_->input_popup_font_encoding,
1393 rc.popup_font_encoding.c_str());
1394 fl_set_input(dialog_->input_bind_file,
1395 rc.bind_file.c_str());
1396 fl_set_input(dialog_->input_ui_file,
1397 rc.ui_file.c_str());
1401 FormPreferences::Language::Language(FormPreferences & p)
1406 FD_preferences_language const * FormPreferences::Language::dialog()
1408 return dialog_.get();
1412 void FormPreferences::Language::apply(LyXRC & rc)
1414 int const pos = fl_get_combox(dialog_->combox_default_lang);
1415 rc.default_language = lang_[pos-1];
1417 int button = fl_get_button(dialog_->check_use_kbmap);
1418 string const name_1 = fl_get_input(dialog_->input_kbmap1);
1419 string const name_2 = fl_get_input(dialog_->input_kbmap2);
1421 button = !(name_1.empty() && name_2.empty());
1422 rc.use_kbmap = static_cast<bool>(button);
1425 rc.primary_kbmap = name_1;
1426 rc.secondary_kbmap = name_2;
1429 button = fl_get_button(dialog_->check_rtl_support);
1430 rc.rtl_support = static_cast<bool>(button);
1432 button = fl_get_button(dialog_->check_mark_foreign);
1433 rc.mark_foreign_language = static_cast<bool>(button);
1435 button = fl_get_button(dialog_->check_auto_begin);
1436 rc.language_auto_begin = static_cast<bool>(button);
1438 button = fl_get_button(dialog_->check_auto_end);
1439 rc.language_auto_end = static_cast<bool>(button);
1441 button = fl_get_button(dialog_->check_use_babel);
1442 rc.language_use_babel = static_cast<bool>(button);
1444 button = fl_get_button(dialog_->check_global_options);
1445 rc.language_global_options = static_cast<bool>(button);
1447 rc.language_package = fl_get_input(dialog_->input_package);
1448 rc.language_command_begin = fl_get_input(dialog_->input_command_begin);
1449 rc.language_command_end = fl_get_input(dialog_->input_command_end);
1451 // Ensure that all is self-consistent.
1456 void FormPreferences::Language::build()
1458 dialog_.reset(build_preferences_language(&parent_));
1460 fl_set_input_return(dialog_->input_package, FL_RETURN_CHANGED);
1461 fl_set_input_return(dialog_->input_command_begin, FL_RETURN_CHANGED);
1462 fl_set_input_return(dialog_->input_command_end, FL_RETURN_CHANGED);
1464 // Store the lang identifiers for later
1465 vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
1466 lang_ = getSecond(langs);
1468 FL_OBJECT * obj = dialog_->combox_default_lang;
1469 vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
1470 vector<frnt::LanguagePair>::const_iterator lend = langs.end();
1471 for (; lit != lend; ++lit) {
1472 fl_addto_combox(obj, lit->first.c_str());
1474 fl_set_combox_browser_height(obj, 400);
1476 // set up the feedback mechanism
1477 setPrehandler(dialog_->input_package);
1478 setPrehandler(dialog_->check_use_kbmap);
1479 setPrehandler(dialog_->combox_default_lang);
1480 setPrehandler(dialog_->input_kbmap1);
1481 setPrehandler(dialog_->input_kbmap2);
1482 setPrehandler(dialog_->check_rtl_support);
1483 setPrehandler(dialog_->check_mark_foreign);
1484 setPrehandler(dialog_->check_auto_begin);
1485 setPrehandler(dialog_->check_auto_end);
1486 setPrehandler(dialog_->check_use_babel);
1487 setPrehandler(dialog_->check_global_options);
1488 setPrehandler(dialog_->input_command_begin);
1489 setPrehandler(dialog_->input_command_end);
1491 // Activate/Deactivate the input fields dependent on the state of the
1498 FormPreferences::Language::feedback(FL_OBJECT const * const ob) const
1500 if (ob == dialog_->combox_default_lang)
1501 return LyXRC::getDescription(LyXRC::RC_DEFAULT_LANGUAGE);
1502 if (ob == dialog_->check_use_kbmap)
1503 return LyXRC::getDescription(LyXRC::RC_KBMAP);
1504 if (ob == dialog_->input_kbmap1)
1505 return LyXRC::getDescription(LyXRC::RC_KBMAP_PRIMARY);
1506 if (ob == dialog_->input_kbmap2)
1507 return LyXRC::getDescription(LyXRC::RC_KBMAP_SECONDARY);
1508 if (ob == dialog_->check_rtl_support)
1509 return LyXRC::getDescription(LyXRC::RC_RTL_SUPPORT);
1510 if (ob == dialog_->check_mark_foreign)
1511 return LyXRC::getDescription(LyXRC::RC_MARK_FOREIGN_LANGUAGE);
1512 if (ob == dialog_->check_auto_begin)
1513 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_BEGIN);
1514 if (ob == dialog_->check_auto_end)
1515 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_END);
1516 if (ob == dialog_->check_use_babel)
1517 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_USE_BABEL);
1518 if (ob == dialog_->check_global_options)
1519 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS);
1520 if (ob == dialog_->input_package)
1521 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_PACKAGE);
1522 if (ob == dialog_->input_command_begin)
1523 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_BEGIN);
1524 if (ob == dialog_->input_command_end)
1525 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_END);
1530 bool FormPreferences::Language::input(FL_OBJECT const * const ob)
1532 bool activate = true;
1534 // !ob if function is called from Language::build() to de/activate
1536 // otherwise the function is called by an xforms CB via input().
1537 if (!ob || ob == dialog_->check_use_kbmap) {
1538 bool const enable = fl_get_button(dialog_->check_use_kbmap);
1539 setEnabled(dialog_->button_kbmap1_browse, enable);
1540 setEnabled(dialog_->button_kbmap2_browse, enable);
1541 setEnabled(dialog_->input_kbmap1, enable);
1542 setEnabled(dialog_->input_kbmap2, enable);
1545 if (ob == dialog_->button_kbmap1_browse) {
1546 string f = parent_.controller().browsekbmap(
1547 fl_get_input(dialog_->input_kbmap1));
1549 fl_set_input(dialog_->input_kbmap1, f.c_str());
1550 } else if (ob == dialog_->button_kbmap2_browse) {
1551 string f = parent_.controller().browsekbmap(
1552 fl_get_input(dialog_->input_kbmap2));
1554 fl_set_input(dialog_->input_kbmap2, f.c_str());
1561 void FormPreferences::Language::update(LyXRC const & rc)
1563 fl_set_button(dialog_->check_use_kbmap,
1566 int const pos = int(findPos(lang_, rc.default_language));
1567 fl_set_combox(dialog_->combox_default_lang, pos + 1);
1570 fl_set_input(dialog_->input_kbmap1,
1571 rc.primary_kbmap.c_str());
1572 fl_set_input(dialog_->input_kbmap2,
1573 rc.secondary_kbmap.c_str());
1575 fl_set_input(dialog_->input_kbmap1, "");
1576 fl_set_input(dialog_->input_kbmap2, "");
1579 fl_set_button(dialog_->check_rtl_support, rc.rtl_support);
1580 fl_set_button(dialog_->check_mark_foreign,
1581 rc.mark_foreign_language);
1582 fl_set_button(dialog_->check_auto_begin, rc.language_auto_begin);
1583 fl_set_button(dialog_->check_auto_end, rc.language_auto_end);
1584 fl_set_button(dialog_->check_use_babel, rc.language_use_babel);
1585 fl_set_button(dialog_->check_global_options,
1586 rc.language_global_options);
1588 fl_set_input(dialog_->input_package,
1589 rc.language_package.c_str());
1590 fl_set_input(dialog_->input_command_begin,
1591 rc.language_command_begin.c_str());
1592 fl_set_input(dialog_->input_command_end,
1593 rc.language_command_end.c_str());
1595 // Activate/Deactivate the input fields dependent on the state of the
1601 FormPreferences::LnFmisc::LnFmisc(FormPreferences & p)
1606 FD_preferences_lnf_misc const * FormPreferences::LnFmisc::dialog()
1608 return dialog_.get();
1612 void FormPreferences::LnFmisc::apply(LyXRC & rc) const
1614 rc.auto_region_delete =
1615 fl_get_button(dialog_->check_auto_region_delete);
1616 rc.cursor_follows_scrollbar =
1617 fl_get_button(dialog_->check_cursor_follows_scrollbar);
1618 rc.dialogs_iconify_with_main =
1619 fl_get_button(dialog_->check_dialogs_iconify_with_main);
1620 rc.preview = fl_get_button(dialog_->check_preview_latex);
1621 rc.autosave = static_cast<unsigned int>
1622 (fl_get_counter_value(dialog_->counter_autosave));
1623 rc.wheel_jump = static_cast<unsigned int>
1624 (fl_get_counter_value(dialog_->counter_wm_jump));
1627 // lyx::graphics::DisplayType old_value = rc.display_graphics;
1628 switch (fl_get_choice(dialog_->choice_display)) {
1630 rc.display_graphics = lyx::graphics::NoDisplay;
1633 rc.display_graphics = lyx::graphics::ColorDisplay;
1636 rc.display_graphics = lyx::graphics::GrayscaleDisplay;
1639 rc.display_graphics = lyx::graphics::MonochromeDisplay;
1642 rc.display_graphics = lyx::graphics::ColorDisplay;
1646 #ifdef WITH_WARNINGS
1647 #warning FIXME!! The graphics cache no longer has a changeDisplay method.
1650 if (old_value != rc.display_graphics) {
1651 lyx::graphics::GCache & gc = lyx::graphics::GCache::get();
1658 void FormPreferences::LnFmisc::build()
1660 dialog_.reset(build_preferences_lnf_misc(&parent_));
1662 fl_set_counter_step(dialog_->counter_autosave, 1, 10);
1663 fl_set_counter_step(dialog_->counter_wm_jump, 1, 10);
1665 fl_set_counter_return(dialog_->counter_autosave, FL_RETURN_CHANGED);
1666 fl_set_counter_return(dialog_->counter_wm_jump, FL_RETURN_CHANGED);
1668 // set up the feedback mechanism
1669 setPrehandler(dialog_->check_auto_region_delete);
1670 setPrehandler(dialog_->counter_autosave);
1671 setPrehandler(dialog_->check_cursor_follows_scrollbar);
1672 setPrehandler(dialog_->check_dialogs_iconify_with_main);
1673 setPrehandler(dialog_->check_preview_latex);
1674 setPrehandler(dialog_->counter_wm_jump);
1676 fl_addto_choice(dialog_->choice_display,
1677 _("Monochrome|Grayscale|Color|Do not display").c_str());
1682 FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const
1684 if (ob == dialog_->check_auto_region_delete)
1685 return LyXRC::getDescription(LyXRC::RC_AUTOREGIONDELETE);
1686 if (ob == dialog_->check_cursor_follows_scrollbar)
1687 return LyXRC::getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR);
1688 if (ob == dialog_->check_dialogs_iconify_with_main)
1689 return LyXRC::getDescription(LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN);
1690 if (ob == dialog_->check_preview_latex)
1691 return LyXRC::getDescription(LyXRC::RC_PREVIEW);
1692 if (ob == dialog_->counter_autosave)
1693 return LyXRC::getDescription(LyXRC::RC_AUTOSAVE);
1694 if (ob == dialog_->counter_wm_jump)
1695 return LyXRC::getDescription(LyXRC::RC_WHEEL_JUMP);
1696 if (ob == dialog_->choice_display)
1697 return LyXRC::getDescription(LyXRC::RC_DISPLAY_GRAPHICS);
1702 void FormPreferences::LnFmisc::update(LyXRC const & rc)
1704 fl_set_button(dialog_->check_auto_region_delete,
1705 rc.auto_region_delete);
1706 fl_set_button(dialog_->check_cursor_follows_scrollbar,
1707 rc.cursor_follows_scrollbar);
1708 fl_set_button(dialog_->check_dialogs_iconify_with_main,
1709 rc.dialogs_iconify_with_main);
1710 fl_set_button(dialog_->check_preview_latex,
1712 fl_set_counter_value(dialog_->counter_autosave, rc.autosave);
1713 fl_set_counter_value(dialog_->counter_wm_jump, rc.wheel_jump);
1715 switch (rc.display_graphics) {
1716 case lyx::graphics::NoDisplay:
1717 fl_set_choice(dialog_->choice_display, 4);
1719 case lyx::graphics::ColorDisplay:
1720 fl_set_choice(dialog_->choice_display, 3);
1722 case lyx::graphics::GrayscaleDisplay:
1723 fl_set_choice(dialog_->choice_display, 2);
1725 case lyx::graphics::MonochromeDisplay:
1726 fl_set_choice(dialog_->choice_display, 1);
1729 fl_set_choice(dialog_->choice_display, 3);
1735 FormPreferences::OutputsMisc::OutputsMisc(FormPreferences & p)
1740 FD_preferences_outputs_misc const * FormPreferences::OutputsMisc::dialog()
1742 return dialog_.get();
1746 void FormPreferences::OutputsMisc::apply(LyXRC & rc) const
1748 rc.ascii_linelen = static_cast<unsigned int>
1749 (fl_get_counter_value(dialog_->counter_line_len));
1750 rc.fontenc = fl_get_input(dialog_->input_tex_encoding);
1753 fl_get_choice(dialog_->choice_default_papersize) - 1;
1754 rc.default_papersize = static_cast<PAPER_SIZE>(choice);
1756 rc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff);
1757 rc.chktex_command = fl_get_input(dialog_->input_checktex);
1758 rc.view_dvi_paper_option = fl_get_input(dialog_->input_paperoption);
1759 rc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt);
1763 void FormPreferences::OutputsMisc::build()
1765 dialog_.reset(build_preferences_outputs_misc(&parent_));
1767 fl_set_counter_step(dialog_->counter_line_len, 1, 10);
1769 fl_set_counter_return(dialog_->counter_line_len, FL_RETURN_CHANGED);
1770 fl_set_input_return(dialog_->input_tex_encoding, FL_RETURN_CHANGED);
1771 fl_set_input_return(dialog_->input_ascii_roff, FL_RETURN_CHANGED);
1772 fl_set_input_return(dialog_->input_checktex, FL_RETURN_CHANGED);
1773 fl_set_input_return(dialog_->input_paperoption, FL_RETURN_CHANGED);
1775 fl_addto_choice(dialog_->choice_default_papersize,
1776 _(" default | US letter | US legal "
1777 "| US executive | A3 | A4 | A5 | B5 ").c_str());
1779 // set up the feedback mechanism
1780 setPrehandler(dialog_->counter_line_len);
1781 setPrehandler(dialog_->input_tex_encoding);
1782 setPrehandler(dialog_->choice_default_papersize);
1783 setPrehandler(dialog_->input_ascii_roff);
1784 setPrehandler(dialog_->input_checktex);
1785 setPrehandler(dialog_->input_paperoption);
1786 setPrehandler(dialog_->check_autoreset_classopt);
1791 FormPreferences::OutputsMisc::feedback(FL_OBJECT const * const ob) const
1793 if (ob == dialog_->counter_line_len)
1794 return LyXRC::getDescription(LyXRC::RC_ASCII_LINELEN);
1795 if (ob == dialog_->input_tex_encoding)
1796 return LyXRC::getDescription(LyXRC::RC_FONT_ENCODING);
1797 if (ob == dialog_->input_ascii_roff)
1798 return LyXRC::getDescription(LyXRC::RC_ASCIIROFF_COMMAND);
1799 if (ob == dialog_->input_checktex)
1800 return LyXRC::getDescription(LyXRC::RC_CHKTEX_COMMAND);
1801 if (ob == dialog_->choice_default_papersize)
1802 return LyXRC::getDescription(LyXRC::RC_DEFAULT_PAPERSIZE);
1803 if (ob == dialog_->input_paperoption)
1804 return LyXRC::getDescription(LyXRC::RC_VIEWDVI_PAPEROPTION);
1805 if (ob == dialog_->check_autoreset_classopt)
1806 return LyXRC::getDescription(LyXRC::RC_AUTORESET_OPTIONS);
1811 void FormPreferences::OutputsMisc::update(LyXRC const & rc)
1813 fl_set_counter_value(dialog_->counter_line_len,
1815 fl_set_input(dialog_->input_tex_encoding,
1816 rc.fontenc.c_str());
1817 fl_set_choice(dialog_->choice_default_papersize,
1818 rc.default_papersize + 1);
1819 fl_set_input(dialog_->input_ascii_roff,
1820 rc.ascii_roff_command.c_str());
1821 fl_set_input(dialog_->input_checktex,
1822 rc.chktex_command.c_str());
1823 fl_set_input(dialog_->input_paperoption,
1824 rc.view_dvi_paper_option.c_str());
1825 fl_set_button(dialog_->check_autoreset_classopt,
1826 rc.auto_reset_options);
1831 FormPreferences::Paths::Paths(FormPreferences & p)
1836 FD_preferences_paths const * FormPreferences::Paths::dialog()
1838 return dialog_.get();
1842 void FormPreferences::Paths::apply(LyXRC & rc)
1844 rc.document_path = fl_get_input(dialog_->input_default_path);
1845 rc.template_path = fl_get_input(dialog_->input_template_path);
1847 int button = fl_get_button(dialog_->check_use_temp_dir);
1848 string str = fl_get_input(dialog_->input_temp_dir);
1852 rc.use_tempdir = button;
1853 rc.tempdir_path = str;
1855 button = fl_get_button(dialog_->check_last_files);
1856 str = fl_get_input(dialog_->input_lastfiles);
1857 if (!button) str.erase();
1859 rc.check_lastfiles = button;
1861 rc.num_lastfiles = static_cast<unsigned int>
1862 (fl_get_counter_value(dialog_->counter_lastfiles));
1864 button = fl_get_button(dialog_->check_make_backups);
1865 str = fl_get_input(dialog_->input_backup_path);
1869 rc.make_backup = button;
1870 rc.backupdir_path = str;
1872 rc.lyxpipes = fl_get_input(dialog_->input_serverpipe);
1879 void FormPreferences::Paths::build()
1881 dialog_.reset(build_preferences_paths(&parent_));
1883 fl_set_input_return(dialog_->input_default_path, FL_RETURN_CHANGED);
1884 fl_set_input_return(dialog_->input_template_path, FL_RETURN_CHANGED);
1885 fl_set_input_return(dialog_->input_temp_dir, FL_RETURN_CHANGED);
1886 fl_set_input_return(dialog_->input_lastfiles, FL_RETURN_CHANGED);
1887 fl_set_input_return(dialog_->input_backup_path, FL_RETURN_CHANGED);
1888 fl_set_counter_return(dialog_->counter_lastfiles, FL_RETURN_CHANGED);
1889 fl_set_input_return(dialog_->input_serverpipe, FL_RETURN_CHANGED);
1891 // set up the feedback mechanism
1892 setPrehandler(dialog_->input_default_path);
1893 setPrehandler(dialog_->counter_lastfiles);
1894 setPrehandler(dialog_->input_template_path);
1895 setPrehandler(dialog_->check_last_files);
1896 setPrehandler(dialog_->input_lastfiles);
1897 setPrehandler(dialog_->check_make_backups);
1898 setPrehandler(dialog_->input_backup_path);
1899 setPrehandler(dialog_->input_serverpipe);
1900 setPrehandler(dialog_->input_temp_dir);
1901 setPrehandler(dialog_->check_use_temp_dir);
1906 FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const
1908 if (ob == dialog_->input_default_path)
1909 return LyXRC::getDescription(LyXRC::RC_DOCUMENTPATH);
1910 if (ob == dialog_->input_template_path)
1911 return LyXRC::getDescription(LyXRC::RC_TEMPLATEPATH);
1912 if (ob == dialog_->check_use_temp_dir)
1913 return LyXRC::getDescription(LyXRC::RC_USETEMPDIR);
1914 if (ob == dialog_->input_temp_dir)
1915 return LyXRC::getDescription(LyXRC::RC_TEMPDIRPATH);
1916 if (ob == dialog_->check_last_files)
1917 return LyXRC::getDescription(LyXRC::RC_CHECKLASTFILES);
1918 if (ob == dialog_->input_lastfiles)
1919 return LyXRC::getDescription(LyXRC::RC_LASTFILES);
1920 if (ob == dialog_->counter_lastfiles)
1921 return LyXRC::getDescription(LyXRC::RC_NUMLASTFILES);
1922 if (ob == dialog_->check_make_backups)
1923 return LyXRC::getDescription(LyXRC::RC_MAKE_BACKUP);
1924 if (ob == dialog_->input_backup_path)
1925 return LyXRC::getDescription(LyXRC::RC_BACKUPDIR_PATH);
1926 if (ob == dialog_->input_serverpipe)
1927 return LyXRC::getDescription(LyXRC::RC_SERVERPIPE);
1932 bool FormPreferences::Paths::input(FL_OBJECT const * const ob)
1934 bool activate = true;
1936 // !ob if function is called from Paths::update() to de/activate
1938 // otherwise the function is called by an xforms CB via input().
1939 if (!ob || ob == dialog_->check_use_temp_dir) {
1940 bool const enable = fl_get_button(dialog_->check_use_temp_dir);
1941 setEnabled(dialog_->input_temp_dir, enable);
1944 if (!ob || ob == dialog_->check_last_files) {
1945 bool const enable = fl_get_button(dialog_->check_last_files);
1946 setEnabled(dialog_->input_lastfiles, enable);
1949 if (!ob || ob == dialog_->check_make_backups) {
1950 bool const enable = fl_get_button(dialog_->check_make_backups);
1951 setEnabled(dialog_->input_backup_path, enable);
1954 if (!ob || ob == dialog_->input_default_path) {
1955 string const name = fl_get_input(dialog_->input_default_path);
1956 if (!name.empty() && !RWInfo::WriteableDir(name)) {
1957 parent_.postWarning(RWInfo::ErrorMessage());
1962 if (!ob || ob == dialog_->input_template_path) {
1963 string const name = fl_get_input(dialog_->input_template_path);
1964 if (!name.empty() && !RWInfo::ReadableDir(name)) {
1965 parent_.postWarning(RWInfo::ErrorMessage());
1970 if (!ob || ob == dialog_->input_temp_dir) {
1971 string const name = fl_get_input(dialog_->input_temp_dir);
1972 if (fl_get_button(dialog_->check_make_backups)
1974 && !RWInfo::WriteableDir(name)) {
1975 parent_.postWarning(RWInfo::ErrorMessage());
1980 if (!ob || ob == dialog_->input_backup_path) {
1981 string const name = fl_get_input(dialog_->input_backup_path);
1982 if (fl_get_button(dialog_->check_make_backups)
1984 && !RWInfo::WriteableDir(name)) {
1985 parent_.postWarning(RWInfo::ErrorMessage());
1990 if (!ob || ob == dialog_->input_lastfiles) {
1991 string const name = fl_get_input(dialog_->input_lastfiles);
1992 if (fl_get_button(dialog_->check_last_files)
1994 && !RWInfo::WriteableFile(name)) {
1995 parent_.postWarning(RWInfo::ErrorMessage());
2000 if (!ob || ob == dialog_->input_serverpipe) {
2001 string const name = fl_get_input(dialog_->input_serverpipe);
2002 if (!name.empty()) {
2003 // strip off the extension
2004 string const str = ChangeExtension(name, "");
2005 if (!RWInfo::WriteableFile(str + ".in")) {
2006 parent_.postWarning(RWInfo::ErrorMessage());
2009 if (!RWInfo::WriteableFile(str + ".out")) {
2010 parent_.postWarning(RWInfo::ErrorMessage());
2016 if (ob == dialog_->button_default_path_browse) {
2017 string f = parent_.controller().browsedir(
2018 fl_get_input(dialog_->input_default_path), _("Default path"));
2020 fl_set_input(dialog_->input_default_path, f.c_str());
2021 } else if (ob == dialog_->button_template_path_browse) {
2022 string f = parent_.controller().browsedir(
2023 fl_get_input(dialog_->input_template_path), _("Template path"));
2025 fl_set_input(dialog_->input_template_path, f.c_str());
2026 } else if (ob == dialog_->button_temp_dir_browse) {
2027 string f = parent_.controller().browsedir(
2028 fl_get_input(dialog_->input_temp_dir), _("Temporary dir"));
2030 fl_set_input(dialog_->input_temp_dir, f.c_str());
2031 } else if (ob == dialog_->button_lastfiles_browse) {
2032 string f = parent_.controller().browse(
2033 fl_get_input(dialog_->input_lastfiles), _("Last files"));
2035 fl_set_input(dialog_->input_lastfiles, f.c_str());
2036 } else if (ob == dialog_->button_backup_path_browse) {
2037 string f = parent_.controller().browsedir(
2038 fl_get_input(dialog_->input_backup_path), _("Backup path"));
2040 fl_set_input(dialog_->input_backup_path, f.c_str());
2041 } else if (ob == dialog_->button_serverpipe_browse) {
2042 string f = parent_.controller().browse(
2043 fl_get_input(dialog_->input_serverpipe), _("LyX server pipes"));
2045 fl_set_input(dialog_->input_serverpipe, f.c_str());
2052 void FormPreferences::Paths::update(LyXRC const & rc)
2054 fl_set_input(dialog_->input_default_path,
2055 rc.document_path.c_str());
2056 fl_set_input(dialog_->input_template_path,
2057 rc.template_path.c_str());
2061 str = rc.backupdir_path;
2063 fl_set_button(dialog_->check_make_backups,
2065 fl_set_input(dialog_->input_backup_path, str.c_str());
2069 str = rc.tempdir_path;
2071 fl_set_button(dialog_->check_use_temp_dir,
2073 fl_set_input(dialog_->input_temp_dir, str.c_str());
2076 if (rc.check_lastfiles)
2079 fl_set_button(dialog_->check_last_files,
2080 rc.check_lastfiles);
2081 fl_set_input(dialog_->input_lastfiles, str.c_str());
2082 fl_set_counter_value(dialog_->counter_lastfiles,
2085 fl_set_input(dialog_->input_serverpipe, rc.lyxpipes.c_str());
2087 // Activate/Deactivate the input fields dependent on the state of the
2093 FormPreferences::Printer::Printer(FormPreferences & p)
2098 FD_preferences_printer const * FormPreferences::Printer::dialog()
2100 return dialog_.get();
2104 void FormPreferences::Printer::apply(LyXRC & rc) const
2106 rc.print_adapt_output = fl_get_button(dialog_->check_adapt_output);
2107 rc.print_command = fl_get_input(dialog_->input_command);
2108 rc.print_pagerange_flag = fl_get_input(dialog_->input_page_range);
2109 rc.print_copies_flag = fl_get_input(dialog_->input_copies);
2110 rc.print_reverse_flag = fl_get_input(dialog_->input_reverse);
2111 rc.print_to_printer = fl_get_input(dialog_->input_to_printer);
2112 rc.print_file_extension =
2113 fl_get_input(dialog_->input_file_extension);
2114 rc.print_spool_command =
2115 fl_get_input(dialog_->input_spool_command);
2116 rc.print_paper_flag = fl_get_input(dialog_->input_paper_type);
2117 rc.print_evenpage_flag = fl_get_input(dialog_->input_even_pages);
2118 rc.print_oddpage_flag = fl_get_input(dialog_->input_odd_pages);
2119 rc.print_collcopies_flag = fl_get_input(dialog_->input_collated);
2120 rc.print_landscape_flag = fl_get_input(dialog_->input_landscape);
2121 rc.print_to_file = fl_get_input(dialog_->input_to_file);
2122 rc.print_extra_options =
2123 fl_get_input(dialog_->input_extra_options);
2124 rc.print_spool_printerprefix =
2125 fl_get_input(dialog_->input_spool_prefix);
2126 rc.print_paper_dimension_flag =
2127 fl_get_input(dialog_->input_paper_size);
2128 rc.printer = fl_get_input(dialog_->input_name);
2133 FormPreferences::Printer::feedback(FL_OBJECT const * const ob) const
2135 if (ob == dialog_->input_command)
2136 return LyXRC::getDescription(LyXRC::RC_PRINT_COMMAND);
2137 if (ob == dialog_->check_adapt_output)
2138 return LyXRC::getDescription(LyXRC::RC_PRINT_ADAPTOUTPUT);
2139 if (ob == dialog_->input_to_printer)
2140 return LyXRC::getDescription(LyXRC::RC_PRINTTOPRINTER);
2141 if (ob == dialog_->input_to_file)
2142 return LyXRC::getDescription(LyXRC::RC_PRINTTOFILE);
2143 if (ob == dialog_->input_file_extension)
2144 return LyXRC::getDescription(LyXRC::RC_PRINTFILEEXTENSION);
2145 if (ob == dialog_->input_extra_options)
2146 return LyXRC::getDescription(LyXRC::RC_PRINTEXSTRAOPTIONS);
2147 if (ob == dialog_->input_spool_command)
2148 return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_COMMAND);
2149 if (ob == dialog_->input_spool_prefix)
2150 return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_PRINTERPREFIX);
2151 if (ob == dialog_->input_name)
2152 return LyXRC::getDescription(LyXRC::RC_PRINTER);
2153 if (ob == dialog_->input_even_pages)
2154 return LyXRC::getDescription(LyXRC::RC_PRINTEVENPAGEFLAG);
2155 if (ob == dialog_->input_odd_pages)
2156 return LyXRC::getDescription(LyXRC::RC_PRINTODDPAGEFLAG);
2157 if (ob == dialog_->input_page_range)
2158 return LyXRC::getDescription(LyXRC::RC_PRINTPAGERANGEFLAG);
2159 if (ob == dialog_->input_reverse)
2160 return LyXRC::getDescription(LyXRC::RC_PRINTREVERSEFLAG);
2161 if (ob == dialog_->input_landscape)
2162 return LyXRC::getDescription(LyXRC::RC_PRINTLANDSCAPEFLAG);
2163 if (ob == dialog_->input_copies)
2164 return LyXRC::getDescription(LyXRC::RC_PRINTCOPIESFLAG);
2165 if (ob == dialog_->input_collated)
2166 return LyXRC::getDescription(LyXRC::RC_PRINTCOLLCOPIESFLAG);
2167 if (ob == dialog_->input_paper_type)
2168 return LyXRC::getDescription(LyXRC::RC_PRINTPAPERFLAG);
2169 if (ob == dialog_->input_paper_size)
2170 return LyXRC::getDescription(LyXRC::RC_PRINTPAPERDIMENSIONFLAG);
2175 void FormPreferences::Printer::build()
2177 dialog_.reset(build_preferences_printer(&parent_));
2179 fl_set_input_return(dialog_->input_command, FL_RETURN_CHANGED);
2180 fl_set_input_return(dialog_->input_page_range, FL_RETURN_CHANGED);
2181 fl_set_input_return(dialog_->input_copies, FL_RETURN_CHANGED);
2182 fl_set_input_return(dialog_->input_reverse, FL_RETURN_CHANGED);
2183 fl_set_input_return(dialog_->input_to_printer, FL_RETURN_CHANGED);
2184 fl_set_input_return(dialog_->input_file_extension, FL_RETURN_CHANGED);
2185 fl_set_input_return(dialog_->input_spool_command, FL_RETURN_CHANGED);
2186 fl_set_input_return(dialog_->input_paper_type, FL_RETURN_CHANGED);
2187 fl_set_input_return(dialog_->input_even_pages, FL_RETURN_CHANGED);
2188 fl_set_input_return(dialog_->input_odd_pages, FL_RETURN_CHANGED);
2189 fl_set_input_return(dialog_->input_collated, FL_RETURN_CHANGED);
2190 fl_set_input_return(dialog_->input_landscape, FL_RETURN_CHANGED);
2191 fl_set_input_return(dialog_->input_to_file, FL_RETURN_CHANGED);
2192 fl_set_input_return(dialog_->input_extra_options, FL_RETURN_CHANGED);
2193 fl_set_input_return(dialog_->input_spool_prefix, FL_RETURN_CHANGED);
2194 fl_set_input_return(dialog_->input_paper_size, FL_RETURN_CHANGED);
2195 fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
2197 // set up the feedback mechanism
2198 setPrehandler(dialog_->input_command);
2199 setPrehandler(dialog_->input_page_range);
2200 setPrehandler(dialog_->input_copies);
2201 setPrehandler(dialog_->input_reverse);
2202 setPrehandler(dialog_->input_to_printer);
2203 setPrehandler(dialog_->input_file_extension);
2204 setPrehandler(dialog_->input_spool_command);
2205 setPrehandler(dialog_->input_paper_type);
2206 setPrehandler(dialog_->input_even_pages);
2207 setPrehandler(dialog_->input_odd_pages);
2208 setPrehandler(dialog_->input_collated);
2209 setPrehandler(dialog_->input_landscape);
2210 setPrehandler(dialog_->input_to_file);
2211 setPrehandler(dialog_->input_extra_options);
2212 setPrehandler(dialog_->input_spool_prefix);
2213 setPrehandler(dialog_->input_paper_size);
2214 setPrehandler(dialog_->input_name);
2215 setPrehandler(dialog_->check_adapt_output);
2219 void FormPreferences::Printer::update(LyXRC const & rc)
2221 fl_set_button(dialog_->check_adapt_output,
2222 rc.print_adapt_output);
2223 fl_set_input(dialog_->input_command,
2224 rc.print_command.c_str());
2225 fl_set_input(dialog_->input_page_range,
2226 rc.print_pagerange_flag.c_str());
2227 fl_set_input(dialog_->input_copies,
2228 rc.print_copies_flag.c_str());
2229 fl_set_input(dialog_->input_reverse,
2230 rc.print_reverse_flag.c_str());
2231 fl_set_input(dialog_->input_to_printer,
2232 rc.print_to_printer.c_str());
2233 fl_set_input(dialog_->input_file_extension,
2234 rc.print_file_extension.c_str());
2235 fl_set_input(dialog_->input_spool_command,
2236 rc.print_spool_command.c_str());
2237 fl_set_input(dialog_->input_paper_type,
2238 rc.print_paper_flag.c_str());
2239 fl_set_input(dialog_->input_even_pages,
2240 rc.print_evenpage_flag.c_str());
2241 fl_set_input(dialog_->input_odd_pages,
2242 rc.print_oddpage_flag.c_str());
2243 fl_set_input(dialog_->input_collated,
2244 rc.print_collcopies_flag.c_str());
2245 fl_set_input(dialog_->input_landscape,
2246 rc.print_landscape_flag.c_str());
2247 fl_set_input(dialog_->input_to_file,
2248 rc.print_to_file.c_str());
2249 fl_set_input(dialog_->input_extra_options,
2250 rc.print_extra_options.c_str());
2251 fl_set_input(dialog_->input_spool_prefix,
2252 rc.print_spool_printerprefix.c_str());
2253 fl_set_input(dialog_->input_paper_size,
2254 rc.print_paper_dimension_flag.c_str());
2255 fl_set_input(dialog_->input_name,
2256 rc.printer.c_str());
2260 FormPreferences::ScreenFonts::ScreenFonts(FormPreferences & p)
2265 FD_preferences_screen_fonts const * FormPreferences::ScreenFonts::dialog()
2267 return dialog_.get();
2271 void FormPreferences::ScreenFonts::apply(LyXRC & rc) const
2273 bool changed = false;
2275 pair<string, string> tmp =
2276 parseFontName(fl_get_input(dialog_->input_roman));
2277 if (rc.roman_font_name != tmp.first ||
2278 rc.roman_font_foundry != tmp.second) {
2280 rc.roman_font_name = tmp.first;
2281 rc.roman_font_foundry = tmp.second;
2284 tmp = parseFontName(fl_get_input(dialog_->input_sans));
2285 if (rc.sans_font_name != tmp.first ||
2286 rc.sans_font_foundry != tmp.second) {
2288 rc.sans_font_name = tmp.first;
2289 rc.sans_font_foundry = tmp.second;
2292 tmp = parseFontName(fl_get_input(dialog_->input_typewriter));
2293 if (rc.typewriter_font_name != tmp.first ||
2294 rc.typewriter_font_foundry != tmp.second) {
2296 rc.typewriter_font_name = tmp.first;
2297 rc.typewriter_font_foundry = tmp.second;
2300 string str = fl_get_input(dialog_->input_screen_encoding);
2301 if (rc.font_norm != str) {
2304 rc.set_font_norm_type();
2307 bool button = fl_get_button(dialog_->check_scalable);
2308 if (rc.use_scalable_fonts != button) {
2310 rc.use_scalable_fonts = button;
2313 unsigned int ivalue = static_cast<unsigned int>
2314 (fl_get_counter_value(dialog_->counter_zoom));
2315 if (rc.zoom != ivalue) {
2320 ivalue = static_cast<unsigned int>
2321 (fl_get_counter_value(dialog_->counter_dpi));
2322 if (rc.dpi != ivalue) {
2327 double dvalue = strToDbl(fl_get_input(dialog_->input_tiny));
2328 if (rc.font_sizes[LyXFont::SIZE_TINY] != dvalue) {
2330 rc.font_sizes[LyXFont::SIZE_TINY] = dvalue;
2333 dvalue = strToDbl(fl_get_input(dialog_->input_script));
2334 if (rc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue) {
2336 rc.font_sizes[LyXFont::SIZE_SCRIPT] = dvalue;
2339 dvalue = strToDbl(fl_get_input(dialog_->input_footnote));
2340 if (rc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue) {
2342 rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = dvalue;
2345 dvalue = strToDbl(fl_get_input(dialog_->input_small));
2346 if (rc.font_sizes[LyXFont::SIZE_SMALL] != dvalue) {
2348 rc.font_sizes[LyXFont::SIZE_SMALL] = dvalue;
2351 dvalue = strToDbl(fl_get_input(dialog_->input_normal));
2352 if (rc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue) {
2354 rc.font_sizes[LyXFont::SIZE_NORMAL] = dvalue;
2357 dvalue = strToDbl(fl_get_input(dialog_->input_large));
2358 if (rc.font_sizes[LyXFont::SIZE_LARGE] != dvalue) {
2360 rc.font_sizes[LyXFont::SIZE_LARGE] = dvalue;
2363 dvalue = strToDbl(fl_get_input(dialog_->input_larger));
2364 if (rc.font_sizes[LyXFont::SIZE_LARGER] != dvalue) {
2366 rc.font_sizes[LyXFont::SIZE_LARGER] = dvalue;
2369 dvalue = strToDbl(fl_get_input(dialog_->input_largest));
2370 if (rc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue) {
2372 rc.font_sizes[LyXFont::SIZE_LARGEST] = dvalue;
2375 dvalue = strToDbl(fl_get_input(dialog_->input_huge));
2376 if (rc.font_sizes[LyXFont::SIZE_HUGE] != dvalue) {
2378 rc.font_sizes[LyXFont::SIZE_HUGE] = dvalue;
2381 dvalue = strToDbl(fl_get_input(dialog_->input_huger));
2382 if (rc.font_sizes[LyXFont::SIZE_HUGER] != dvalue) {
2384 rc.font_sizes[LyXFont::SIZE_HUGER] = dvalue;
2388 // Now update the buffers
2389 // Can anything below here affect the redraw process?
2390 parent_.controller().updateScreenFonts();
2395 void FormPreferences::ScreenFonts::build()
2397 dialog_.reset(build_preferences_screen_fonts(&parent_));
2399 fl_set_counter_step(dialog_->counter_zoom, 1, 10);
2400 fl_set_counter_step(dialog_->counter_dpi, 1, 10);
2402 fl_set_input_return(dialog_->input_roman, FL_RETURN_CHANGED);
2403 fl_set_input_return(dialog_->input_sans, FL_RETURN_CHANGED);
2404 fl_set_input_return(dialog_->input_typewriter, FL_RETURN_CHANGED);
2405 fl_set_input_return(dialog_->input_screen_encoding, FL_RETURN_CHANGED);
2406 fl_set_counter_return(dialog_->counter_zoom, FL_RETURN_CHANGED);
2407 fl_set_counter_return(dialog_->counter_dpi, FL_RETURN_CHANGED);
2408 fl_set_input_return(dialog_->input_tiny, FL_RETURN_CHANGED);
2409 fl_set_input_return(dialog_->input_script, FL_RETURN_CHANGED);
2410 fl_set_input_return(dialog_->input_footnote, FL_RETURN_CHANGED);
2411 fl_set_input_return(dialog_->input_small, FL_RETURN_CHANGED);
2412 fl_set_input_return(dialog_->input_normal, FL_RETURN_CHANGED);
2413 fl_set_input_return(dialog_->input_large, FL_RETURN_CHANGED);
2414 fl_set_input_return(dialog_->input_larger, FL_RETURN_CHANGED);
2415 fl_set_input_return(dialog_->input_largest, FL_RETURN_CHANGED);
2416 fl_set_input_return(dialog_->input_huge, FL_RETURN_CHANGED);
2417 fl_set_input_return(dialog_->input_huger, FL_RETURN_CHANGED);
2419 fl_set_input_filter(dialog_->input_tiny, fl_unsigned_float_filter);
2420 fl_set_input_filter(dialog_->input_script, fl_unsigned_float_filter);
2421 fl_set_input_filter(dialog_->input_footnote, fl_unsigned_float_filter);
2422 fl_set_input_filter(dialog_->input_small, fl_unsigned_float_filter);
2423 fl_set_input_filter(dialog_->input_normal, fl_unsigned_float_filter);
2424 fl_set_input_filter(dialog_->input_large, fl_unsigned_float_filter);
2425 fl_set_input_filter(dialog_->input_larger, fl_unsigned_float_filter);
2426 fl_set_input_filter(dialog_->input_largest, fl_unsigned_float_filter);
2427 fl_set_input_filter(dialog_->input_huge, fl_unsigned_float_filter);
2428 fl_set_input_filter(dialog_->input_huger, fl_unsigned_float_filter);
2430 // set up the feedback mechanism
2431 setPrehandler(dialog_->input_roman);
2432 setPrehandler(dialog_->input_sans);
2433 setPrehandler(dialog_->input_typewriter);
2434 setPrehandler(dialog_->counter_zoom);
2435 setPrehandler(dialog_->counter_dpi);
2436 setPrehandler(dialog_->check_scalable);
2437 setPrehandler(dialog_->input_screen_encoding);
2438 setPrehandler(dialog_->input_tiny);
2439 setPrehandler(dialog_->input_script);
2440 setPrehandler(dialog_->input_footnote);
2441 setPrehandler(dialog_->input_small);
2442 setPrehandler(dialog_->input_large);
2443 setPrehandler(dialog_->input_larger);
2444 setPrehandler(dialog_->input_largest);
2445 setPrehandler(dialog_->input_normal);
2446 setPrehandler(dialog_->input_huge);
2447 setPrehandler(dialog_->input_huger);
2452 FormPreferences::ScreenFonts::feedback(FL_OBJECT const * const ob) const
2454 if (ob == dialog_->input_roman)
2455 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ROMAN);
2456 if (ob == dialog_->input_sans)
2457 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SANS);
2458 if (ob == dialog_->input_typewriter)
2459 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_TYPEWRITER);
2460 if (ob == dialog_->check_scalable)
2461 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SCALABLE);
2462 if (ob == dialog_->input_screen_encoding)
2463 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ENCODING);
2464 if (ob == dialog_->counter_zoom)
2465 return LyXRC::getDescription(LyXRC::RC_SCREEN_ZOOM);
2466 if (ob == dialog_->counter_dpi)
2467 return LyXRC::getDescription(LyXRC::RC_SCREEN_DPI);
2468 if (ob == dialog_->input_tiny
2469 || ob == dialog_->input_script
2470 || ob == dialog_->input_footnote
2471 || ob == dialog_->input_small
2472 || ob == dialog_->input_large
2473 || ob == dialog_->input_larger
2474 || ob == dialog_->input_larger
2475 || ob == dialog_->input_largest
2476 || ob == dialog_->input_normal
2477 || ob == dialog_->input_huge
2478 || ob == dialog_->input_huger)
2479 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SIZES);
2484 bool FormPreferences::ScreenFonts::input()
2486 bool activate = true;
2489 // Make sure that all fonts all have positive entries
2490 // Also note that an empty entry is returned as 0.0 by strToDbl
2491 if (0.0 >= strToDbl(fl_get_input(dialog_->input_tiny))
2492 || 0.0 >= strToDbl(fl_get_input(dialog_->input_script))
2493 || 0.0 >= strToDbl(fl_get_input(dialog_->input_footnote))
2494 || 0.0 >= strToDbl(fl_get_input(dialog_->input_small))
2495 || 0.0 >= strToDbl(fl_get_input(dialog_->input_normal))
2496 || 0.0 >= strToDbl(fl_get_input(dialog_->input_large))
2497 || 0.0 >= strToDbl(fl_get_input(dialog_->input_larger))
2498 || 0.0 >= strToDbl(fl_get_input(dialog_->input_largest))
2499 || 0.0 >= strToDbl(fl_get_input(dialog_->input_huge))
2500 || 0.0 >= strToDbl(fl_get_input(dialog_->input_huger))) {
2502 str = _("Fonts must be positive!");
2504 } else if (strToDbl(fl_get_input(dialog_->input_tiny)) >
2505 // Fontsizes -- tiny < script < footnote etc.
2506 strToDbl(fl_get_input(dialog_->input_script)) ||
2507 strToDbl(fl_get_input(dialog_->input_script)) >
2508 strToDbl(fl_get_input(dialog_->input_footnote)) ||
2509 strToDbl(fl_get_input(dialog_->input_footnote)) >
2510 strToDbl(fl_get_input(dialog_->input_small)) ||
2511 strToDbl(fl_get_input(dialog_->input_small)) >
2512 strToDbl(fl_get_input(dialog_->input_normal)) ||
2513 strToDbl(fl_get_input(dialog_->input_normal)) >
2514 strToDbl(fl_get_input(dialog_->input_large)) ||
2515 strToDbl(fl_get_input(dialog_->input_large)) >
2516 strToDbl(fl_get_input(dialog_->input_larger)) ||
2517 strToDbl(fl_get_input(dialog_->input_larger)) >
2518 strToDbl(fl_get_input(dialog_->input_largest)) ||
2519 strToDbl(fl_get_input(dialog_->input_largest)) >
2520 strToDbl(fl_get_input(dialog_->input_huge)) ||
2521 strToDbl(fl_get_input(dialog_->input_huge)) >
2522 strToDbl(fl_get_input(dialog_->input_huger))) {
2525 str = _("Fonts must be input in the order Tiny > Smallest > Smaller > Small > Normal > Large > Larger > Largest > Huge > Huger.");
2529 parent_.postWarning(str);
2535 void FormPreferences::ScreenFonts::update(LyXRC const & rc)
2537 fl_set_input(dialog_->input_roman,
2538 makeFontName(rc.roman_font_name,
2539 rc.roman_font_foundry).c_str());
2540 fl_set_input(dialog_->input_sans,
2541 makeFontName(rc.sans_font_name,
2542 rc.sans_font_foundry).c_str());
2543 fl_set_input(dialog_->input_typewriter,
2544 makeFontName(rc.typewriter_font_name,
2545 rc.typewriter_font_foundry).c_str());
2546 fl_set_input(dialog_->input_screen_encoding,
2547 rc.font_norm.c_str());
2548 fl_set_button(dialog_->check_scalable,
2549 rc.use_scalable_fonts);
2550 fl_set_counter_value(dialog_->counter_zoom, rc.zoom);
2551 fl_set_counter_value(dialog_->counter_dpi, rc.dpi);
2552 fl_set_input(dialog_->input_tiny,
2553 tostr(rc.font_sizes[LyXFont::SIZE_TINY]).c_str());
2554 fl_set_input(dialog_->input_script,
2555 tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str());
2556 fl_set_input(dialog_->input_footnote,
2557 tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str());
2558 fl_set_input(dialog_->input_small,
2559 tostr(rc.font_sizes[LyXFont::SIZE_SMALL]).c_str());
2560 fl_set_input(dialog_->input_normal,
2561 tostr(rc.font_sizes[LyXFont::SIZE_NORMAL]).c_str());
2562 fl_set_input(dialog_->input_large,
2563 tostr(rc.font_sizes[LyXFont::SIZE_LARGE]).c_str());
2564 fl_set_input(dialog_->input_larger,
2565 tostr(rc.font_sizes[LyXFont::SIZE_LARGER]).c_str());
2566 fl_set_input(dialog_->input_largest,
2567 tostr(rc.font_sizes[LyXFont::SIZE_LARGEST]).c_str());
2568 fl_set_input(dialog_->input_huge,
2569 tostr(rc.font_sizes[LyXFont::SIZE_HUGE]).c_str());
2570 fl_set_input(dialog_->input_huger,
2571 tostr(rc.font_sizes[LyXFont::SIZE_HUGER]).c_str());
2576 FormPreferences::SpellOptions::SpellOptions(FormPreferences & p)
2581 FD_preferences_spelloptions const * FormPreferences::SpellOptions::dialog()
2583 return dialog_.get();
2587 void FormPreferences::SpellOptions::apply(LyXRC & rc)
2589 string choice = fl_get_choice_text(dialog_->choice_spell_command);
2590 choice = trim(choice);
2592 rc.isp_command = choice;
2595 // If spell checker == "none", all other input set to off.
2596 if (fl_get_choice(dialog_->choice_spell_command) == 1) {
2597 rc.isp_use_alt_lang = false;
2598 rc.isp_alt_lang.erase();
2600 rc.isp_use_esc_chars = false;
2601 rc.isp_esc_chars.erase();
2603 rc.isp_use_pers_dict = false;
2604 rc.isp_pers_dict.erase();
2606 rc.isp_accept_compound = false;
2607 rc.isp_use_input_encoding = false;
2610 int button = fl_get_button(dialog_->check_alt_lang);
2611 choice = fl_get_input(dialog_->input_alt_lang);
2612 if (button && choice.empty()) button = 0;
2613 if (!button) choice.erase();
2615 rc.isp_use_alt_lang = static_cast<bool>(button);
2616 rc.isp_alt_lang = choice;
2618 button = fl_get_button(dialog_->check_escape_chars);
2619 choice = fl_get_input(dialog_->input_escape_chars);
2620 if (button && choice.empty()) button = 0;
2621 if (!button) choice.erase();
2623 rc.isp_use_esc_chars = static_cast<bool>(button);
2624 rc.isp_esc_chars = choice;
2626 button = fl_get_button(dialog_->check_personal_dict);
2627 choice = fl_get_input(dialog_->input_personal_dict);
2628 if (button && choice.empty()) button = 0;
2629 if (!button) choice.erase();
2631 rc.isp_use_pers_dict = static_cast<bool>(button);
2632 rc.isp_pers_dict = choice;
2634 button = fl_get_button(dialog_->check_compound_words);
2635 rc.isp_accept_compound = static_cast<bool>(button);
2637 button = fl_get_button(dialog_->check_input_enc);
2638 rc.isp_use_input_encoding = static_cast<bool>(button);
2649 void FormPreferences::SpellOptions::build()
2651 dialog_.reset(build_preferences_spelloptions(&parent_));
2653 fl_addto_choice(dialog_->choice_spell_command,
2654 _(" ispell | aspell ").c_str());
2655 fl_set_input_return(dialog_->input_alt_lang, FL_RETURN_CHANGED);
2656 fl_set_input_return(dialog_->input_escape_chars, FL_RETURN_CHANGED);
2657 fl_set_input_return(dialog_->input_personal_dict, FL_RETURN_CHANGED);
2659 // set up the feedback mechanism
2660 setPrehandler(dialog_->choice_spell_command);
2661 setPrehandler(dialog_->check_alt_lang);
2662 setPrehandler(dialog_->input_alt_lang);
2663 setPrehandler(dialog_->check_escape_chars);
2664 setPrehandler(dialog_->input_escape_chars);
2665 setPrehandler(dialog_->check_personal_dict);
2666 setPrehandler(dialog_->input_personal_dict);
2667 setPrehandler(dialog_->button_personal_dict);
2668 setPrehandler(dialog_->check_compound_words);
2669 setPrehandler(dialog_->check_input_enc);
2674 FormPreferences::SpellOptions::feedback(FL_OBJECT const * const ob) const
2676 if (ob == dialog_->choice_spell_command)
2677 return LyXRC::getDescription(LyXRC::RC_SPELL_COMMAND);
2678 if (ob == dialog_->check_alt_lang)
2679 return LyXRC::getDescription(LyXRC::RC_USE_ALT_LANG);
2680 if (ob == dialog_->input_alt_lang)
2681 return LyXRC::getDescription(LyXRC::RC_ALT_LANG);
2682 if (ob == dialog_->check_escape_chars)
2683 return LyXRC::getDescription(LyXRC::RC_USE_ESC_CHARS);
2684 if (ob == dialog_->input_escape_chars)
2685 return LyXRC::getDescription(LyXRC::RC_ESC_CHARS);
2686 if (ob == dialog_->check_personal_dict)
2687 return LyXRC::getDescription(LyXRC::RC_USE_PERS_DICT);
2688 if (ob == dialog_->input_personal_dict)
2689 return LyXRC::getDescription(LyXRC::RC_PERS_DICT);
2690 if (ob == dialog_->check_compound_words)
2691 return LyXRC::getDescription(LyXRC::RC_ACCEPT_COMPOUND);
2692 if (ob == dialog_->check_input_enc)
2693 return LyXRC::getDescription(LyXRC::RC_USE_INP_ENC);
2698 bool FormPreferences::SpellOptions::input(FL_OBJECT const * const ob)
2700 // !ob if function is called from updateSpellOptions() to de/activate
2702 // otherwise the function is called by an xforms CB via input().
2705 // If spell checker == "none", disable all input.
2706 if (!ob || ob == dialog_->choice_spell_command) {
2707 if (fl_get_choice(dialog_->choice_spell_command) == 1) {
2708 fl_deactivate_object(dialog_->check_alt_lang);
2709 fl_deactivate_object(dialog_->input_alt_lang);
2710 fl_deactivate_object(dialog_->check_escape_chars);
2711 fl_deactivate_object(dialog_->input_escape_chars);
2712 fl_deactivate_object(dialog_->check_personal_dict);
2713 fl_deactivate_object(dialog_->input_personal_dict);
2714 fl_deactivate_object(dialog_->check_compound_words);
2715 fl_deactivate_object(dialog_->check_input_enc);
2718 fl_activate_object(dialog_->check_alt_lang);
2719 fl_activate_object(dialog_->check_escape_chars);
2720 fl_activate_object(dialog_->check_personal_dict);
2721 fl_activate_object(dialog_->check_compound_words);
2722 fl_activate_object(dialog_->check_input_enc);
2727 if (!ob || ob == dialog_->check_alt_lang) {
2728 bool const enable = fl_get_button(dialog_->check_alt_lang);
2729 setEnabled(dialog_->input_alt_lang, enable);
2732 if (!ob || ob == dialog_->check_escape_chars) {
2733 bool const enable = fl_get_button(dialog_->check_escape_chars);
2734 setEnabled(dialog_->input_escape_chars, enable);
2737 if (!ob || ob == dialog_->check_personal_dict) {
2738 bool const enable = fl_get_button(dialog_->check_personal_dict);
2739 setEnabled(dialog_->input_personal_dict, enable);
2742 if (ob == dialog_->button_personal_dict) {
2743 string f = parent_.controller().browsedict(
2744 fl_get_input(dialog_->input_personal_dict));
2745 fl_set_input(dialog_->input_personal_dict, f.c_str());
2748 return true; // All input is valid!
2752 void FormPreferences::SpellOptions::update(LyXRC const & rc)
2756 if (rc.isp_command == "none")
2758 else if (rc.isp_command == "ispell")
2760 else if (rc.isp_command == "aspell")
2763 if (rc.isp_command == "ispell")
2765 else if (rc.isp_command == "aspell")
2768 fl_set_choice(dialog_->choice_spell_command, choice);
2771 if (rc.isp_use_alt_lang)
2772 str = rc.isp_alt_lang;
2774 fl_set_button(dialog_->check_alt_lang,
2775 rc.isp_use_alt_lang);
2776 fl_set_input(dialog_->input_alt_lang, str.c_str());
2779 if (rc.isp_use_esc_chars)
2780 str = rc.isp_esc_chars;
2782 fl_set_button(dialog_->check_escape_chars,
2783 rc.isp_use_esc_chars);
2784 fl_set_input(dialog_->input_escape_chars, str.c_str());
2787 if (rc.isp_use_pers_dict)
2788 str = rc.isp_pers_dict;
2790 fl_set_button(dialog_->check_personal_dict,
2791 rc.isp_use_pers_dict);
2792 fl_set_input(dialog_->input_personal_dict, str.c_str());
2794 fl_set_button(dialog_->check_compound_words,
2795 rc.isp_accept_compound);
2796 fl_set_button(dialog_->check_input_enc,
2797 rc.isp_use_input_encoding);
2799 // Activate/Deactivate the input fields dependent on the state of the