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 "FormPreferences.h"
14 #include "ControlPrefs.h"
15 #include "forms/form_preferences.h"
17 #include "FormColorpicker.h"
18 #include "forms_gettext.h"
19 #include "input_validators.h"
22 #include "controllers/helper_funcs.h" // getSecond
23 #include "controllers/frnt_lang.h"
26 #include "converter.h"
31 #include "support/lstrings.h"
32 #include "support/tostr.h"
33 #include "support/path_defines.h"
34 #include "support/filetools.h"
36 #include "lyx_forms.h"
41 using lyx::support::AddName;
42 using lyx::support::ChangeExtension;
43 using lyx::support::rtrim;
44 using lyx::support::strToDbl;
45 using lyx::support::trim;
46 using lyx::support::user_lyxdir;
60 // These should probably go inside the class definition...
61 Formats local_formats;
62 Converters local_converters;
64 string makeFontName(string const & family, string const & foundry)
68 return family + ',' + foundry;
72 pair<string,string> parseFontName(string const & name)
74 string::size_type const idx = name.find(',');
75 if (idx == string::npos)
76 return make_pair(name, string());
77 return make_pair(name.substr(0, idx),
83 #if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
84 bool const scalableTabfolders = false;
86 bool const scalableTabfolders = true;
92 typedef FormCB<ControlPrefs, FormDB<FD_preferences> > base_class;
95 FormPreferences::FormPreferences()
96 : base_class(_("Preferences"), scalableTabfolders),
97 colors_(*this), converters_(*this), inputs_misc_(*this),
98 formats_(*this), interface_(*this), language_(*this),
99 lnf_misc_(*this), identity_(*this), outputs_misc_(*this),
100 paths_(*this), printer_(*this), screen_fonts_(*this),
106 void FormPreferences::redraw()
108 if (!(form() && form()->visible))
110 fl_redraw_form(form());
112 FL_FORM * form2 = fl_get_active_folder(dialog_->tabfolder_prefs);
113 if (!(form2 && form2->visible))
115 fl_redraw_form(form2);
118 if (form2 == converters_tab_->form)
119 form3 = fl_get_active_folder(converters_tab_->tabfolder_inner);
121 else if (form2 == look_n_feel_tab_->form)
122 form3 = fl_get_active_folder(look_n_feel_tab_->tabfolder_inner);
124 else if (form2 == inputs_tab_->form)
125 form3 = fl_get_active_folder(inputs_tab_->tabfolder_inner);
127 else if (form2 == outputs_tab_->form)
128 form3 = fl_get_active_folder(outputs_tab_->tabfolder_inner);
130 else if (form2 == lang_opts_tab_->form)
131 form3 = fl_get_active_folder(lang_opts_tab_->tabfolder_inner);
133 if (form3 && form3->visible)
134 fl_redraw_form(form3);
138 void FormPreferences::hide()
140 // We need to hide the active tabfolder otherwise we get a
141 // BadDrawable error from X window and LyX crashes without saving.
142 FL_FORM * inner_form = fl_get_active_folder(dialog_->tabfolder_prefs);
143 if (inner_form && inner_form->visible)
144 fl_hide_form(inner_form);
149 void FormPreferences::build()
151 dialog_.reset(build_preferences(this));
153 // Manage the restore, save, apply and cancel/close buttons
154 bcview().setOK(dialog_->button_ok);
155 bcview().setApply(dialog_->button_apply);
156 bcview().setCancel(dialog_->button_close);
157 bcview().setRestore(dialog_->button_restore);
159 // Allow the base class to control messages
160 setMessageWidget(dialog_->text_warning);
162 // build the tab folders
163 converters_tab_.reset(build_preferences_inner_tab(this));
164 look_n_feel_tab_.reset(build_preferences_inner_tab(this));
165 inputs_tab_.reset(build_preferences_inner_tab(this));
166 outputs_tab_.reset(build_preferences_inner_tab(this));
167 lang_opts_tab_.reset(build_preferences_inner_tab(this));
169 // build actual tabfolder contents
170 // these will become nested tabfolders
174 inputs_misc_.build();
179 outputs_misc_.build();
182 screen_fonts_.build();
183 spelloptions_.build();
185 // Enable the tabfolders to be rescaled correctly.
186 if (scalableTabfolders) {
187 FL_OBJECT * folder = dialog_->tabfolder_prefs;
188 fl_set_tabfolder_autofit(folder, FL_FIT);
190 folder = look_n_feel_tab_->tabfolder_inner;
191 fl_set_tabfolder_autofit(folder, FL_FIT);
193 folder = converters_tab_->tabfolder_inner;
194 fl_set_tabfolder_autofit(folder, FL_FIT);
196 folder = inputs_tab_->tabfolder_inner;
197 fl_set_tabfolder_autofit(folder, FL_FIT);
199 folder = outputs_tab_->tabfolder_inner;
200 fl_set_tabfolder_autofit(folder, FL_FIT);
202 folder = lang_opts_tab_->tabfolder_inner;
203 fl_set_tabfolder_autofit(folder, FL_FIT);
207 // Now add them to the tabfolder
208 fl_addto_tabfolder(dialog_->tabfolder_prefs,
209 _("Look & Feel").c_str(),
210 look_n_feel_tab_->form);
211 fl_addto_tabfolder(dialog_->tabfolder_prefs,
212 _("Lang Opts").c_str(),
213 lang_opts_tab_->form);
214 fl_addto_tabfolder(dialog_->tabfolder_prefs,
215 _("Conversion").c_str(),
216 converters_tab_->form);
217 fl_addto_tabfolder(dialog_->tabfolder_prefs,
220 fl_addto_tabfolder(dialog_->tabfolder_prefs,
221 _("Outputs").c_str(),
224 // now build the nested tabfolders
225 // Starting with look and feel
226 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
227 _("Screen Fonts").c_str(),
228 screen_fonts_.dialog()->form);
229 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
230 _("Interface").c_str(),
231 interface_.dialog()->form);
232 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
234 colors_.dialog()->form);
235 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
237 lnf_misc_.dialog()->form);
238 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
239 _("Identity").c_str(),
240 identity_.dialog()->form);
242 // then build converters
243 fl_addto_tabfolder(converters_tab_->tabfolder_inner,
244 _("Formats").c_str(),
245 formats_.dialog()->form);
246 fl_addto_tabfolder(converters_tab_->tabfolder_inner,
247 _("Converters").c_str(),
248 converters_.dialog()->form);
251 // Paths should probably go in a few inner_tab called Files
252 fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
254 paths_.dialog()->form);
255 fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
257 inputs_misc_.dialog()->form);
259 // then building outputs
260 fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
261 _("Printer").c_str(),
262 printer_.dialog()->form);
263 fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
265 outputs_misc_.dialog()->form);
267 // then building usage
268 fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
269 _("Spell checker").c_str(),
270 spelloptions_.dialog()->form);
271 fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
272 _("Language").c_str(),
273 language_.dialog()->form);
277 void FormPreferences::apply()
279 // set the new lyxrc entries
280 // many of these need to trigger other functions when the assignment
281 // is made. For example, screen zoom and font types. These could be
282 // handled either by signals/slots in lyxrc or just directly call the
283 // associated functions here.
284 // There are other problems with this scheme. We really should check
285 // what we copy to make sure that it really is necessary to do things
286 // like update the screen fonts because that flushes the textcache
287 // and other stuff which may cost us a lot on slower/high-load
290 LyXRC & rc(controller().rc());
293 formats_.apply(); // Must be before converters_.apply()
295 inputs_misc_.apply(rc);
296 interface_.apply(rc);
300 outputs_misc_.apply(rc);
303 screen_fonts_.apply(rc);
304 spelloptions_.apply(rc);
306 // The "Save" button has been pressed.
307 if (controller().isClosing() && colors_.modifiedXformsPrefs) {
308 string const filename =
309 AddName(user_lyxdir(), "preferences.xform");
310 colors_.modifiedXformsPrefs = !XformsColor::write(filename);
315 string const FormPreferences::getFeedback(FL_OBJECT * ob)
319 if (ob->form->fdui == colors_.dialog())
320 return colors_.feedback(ob);
321 if (ob->form->fdui == converters_.dialog())
322 return converters_.feedback(ob);
323 if (ob->form->fdui == formats_.dialog())
324 return formats_.feedback(ob);
325 if (ob->form->fdui == inputs_misc_.dialog())
326 return inputs_misc_.feedback(ob);
327 if (ob->form->fdui == interface_.dialog())
328 return interface_.feedback(ob);
329 if (ob->form->fdui == language_.dialog())
330 return language_.feedback(ob);
331 if (ob->form->fdui == lnf_misc_.dialog())
332 return lnf_misc_.feedback(ob);
333 if (ob->form->fdui == outputs_misc_.dialog())
334 return outputs_misc_.feedback(ob);
335 if (ob->form->fdui == paths_.dialog())
336 return paths_.feedback(ob);
337 if (ob->form->fdui == printer_.dialog())
338 return printer_.feedback(ob);
339 if (ob->form->fdui == screen_fonts_.dialog())
340 return screen_fonts_.feedback(ob);
341 if (ob->form->fdui == spelloptions_.dialog())
342 return spelloptions_.feedback(ob);
348 ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long)
354 // whatever checks you need to ensure the user hasn't entered
355 // some totally ridiculous value somewhere. Change activate to suit.
356 // comments before each test describe what is _valid_
358 if (ob->form->fdui == colors_.dialog()) {
360 } else if (ob->form->fdui == converters_.dialog()) {
361 valid = converters_.input(ob);
362 } else if (ob->form->fdui == formats_.dialog()) {
363 valid = formats_.input(ob);
364 } else if (ob->form->fdui == interface_.dialog()) {
365 valid = interface_.input(ob);
366 } else if (ob->form->fdui == language_.dialog()) {
367 valid = language_.input(ob);
368 } else if (ob->form->fdui == paths_.dialog()) {
369 valid = paths_.input(ob);
370 } else if (ob->form->fdui == screen_fonts_.dialog()) {
371 valid = screen_fonts_.input();
372 } else if (ob->form->fdui == spelloptions_.dialog()) {
373 valid = spelloptions_.input(ob);
376 return valid ? ButtonPolicy::SMI_VALID : ButtonPolicy::SMI_INVALID;
380 void FormPreferences::update()
382 if (!dialog_.get()) return;
384 LyXRC const & rc(controller().rc());
386 // read lyxrc entries
388 formats_.update(); // Must be before converters_.update()
389 converters_.update();
390 inputs_misc_.update(rc);
391 interface_.update(rc);
392 language_.update(rc);
393 lnf_misc_.update(rc);
394 identity_.update(rc);
395 outputs_misc_.update(rc);
398 screen_fonts_.update(rc);
399 spelloptions_.update(rc);
403 FormPreferences::Colors::Colors(FormPreferences & p)
404 : modifiedXformsPrefs(false), parent_(p)
408 FD_preferences_colors const * FormPreferences::Colors::dialog()
410 return dialog_.get();
414 void FormPreferences::Colors::apply()
416 bool modifiedText = false;
417 bool modifiedBackground = false;
419 for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
420 cit != xformsColorDB.end(); ++cit) {
422 fl_getmcolor(cit->colorID, &col.r, &col.g, &col.b);
423 if (col != cit->color()) {
424 modifiedXformsPrefs = true;
425 if (cit->colorID == FL_BLACK)
427 if (cit->colorID == FL_COL1)
428 modifiedBackground = true;
432 if (modifiedXformsPrefs) {
433 for (vector<XformsColor>::const_iterator cit =
434 xformsColorDB.begin();
435 cit != xformsColorDB.end(); ++cit) {
436 fl_mapcolor(cit->colorID, cit->r, cit->g, cit->b);
438 if (modifiedText && cit->colorID == FL_BLACK) {
439 AdjustVal(FL_INACTIVE, FL_BLACK, 0.5);
442 if (modifiedBackground && cit->colorID == FL_COL1) {
443 AdjustVal(FL_MCOL, FL_COL1, 0.1);
444 AdjustVal(FL_TOP_BCOL, FL_COL1, 0.1);
445 AdjustVal(FL_LEFT_BCOL, FL_COL1, 0.1);
447 AdjustVal(FL_RIGHT_BCOL, FL_COL1, -0.5);
448 AdjustVal(FL_BOTTOM_BCOL, FL_COL1, -0.5);
451 if (cit->colorID == GUI_COLOR_CURSOR) {
452 fl_mapcolor(GUI_COLOR_CURSOR,
453 cit->r, cit->g, cit->b);
454 setCursorColor(GUI_COLOR_CURSOR);
457 parent_.controller().redrawGUI();
460 // Now do the same for the LyX LColors...
461 for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
462 cit != lyxColorDB.end(); ++cit) {
463 LColor::color lc = lcolor.getFromGUIName(cit->getname());
464 if (lc == LColor::inherit) continue;
466 // Create a valid X11 name of the form "#rrggbb"
467 string const hexname = X11hexname(cit->color());
469 if (lcolor.getX11Name(lc) != hexname) {
471 << "FormPreferences::Colors::apply: "
472 << "resetting LColor " << lcolor.getGUIName(lc)
473 << " from \"" << lcolor.getX11Name(lc)
474 << "\" to \"" << hexname << "\"."
477 parent_.controller().setColor(lc, hexname);
483 void FormPreferences::Colors::build()
485 picker_.reset(new FormColorpicker);
486 dialog_.reset(build_preferences_colors(&parent_));
488 fl_set_object_color(dialog_->button_color,
489 GUI_COLOR_CHOICE, GUI_COLOR_CHOICE);
491 // set up the feedback mechanism
492 setPrehandler(dialog_->browser_lyx_objs);
493 setPrehandler(dialog_->button_color);
494 setPrehandler(dialog_->button_modify);
499 FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
501 if (ob == dialog_->browser_lyx_objs)
502 return _("LyX objects that can be assigned a color.");
504 if (ob == dialog_->button_modify)
505 return _("Modify the LyX object's color. Note: you must then \"Apply\" the change.");
511 void FormPreferences::Colors::input(FL_OBJECT const * const ob)
513 if (ob == dialog_->browser_lyx_objs) {
516 } else if (ob == dialog_->button_modify) {
522 void FormPreferences::Colors::AdjustVal(int colAdjust, int colParent,
526 fl_getmcolor(colParent, &rgb.r, &rgb.g, &rgb.b);
530 hsv.v = min(1.0, max(0.0, hsv.v));
533 fl_mapcolor(colAdjust, rgb.r, rgb.g, rgb.b);
537 void FormPreferences::Colors::InputBrowserLyX() const
539 vector<NamedColor>::size_type const selLyX =
540 fl_get_browser(dialog_->browser_lyx_objs);
541 if (selLyX < 1) return;
543 // Is the choice an Xforms color...
546 if (selLyX - 1 < xformsColorDB.size()) {
547 vector<XformsColor>::size_type const i = selLyX - 1;
548 col = xformsColorDB[i].color();
550 // or a LyX Logical color?
552 vector<NamedColor>::size_type const i = selLyX - 1 -
553 xformsColorDB.size();
554 col = lyxColorDB[i].color();
557 fl_freeze_form(dialog_->form);
559 fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
560 fl_redraw_object(dialog_->button_color);
562 fl_unfreeze_form(dialog_->form);
566 void FormPreferences::Colors::LoadBrowserLyX()
568 if (!dialog_->browser_lyx_objs->visible)
571 // First, define the modifiable xforms colors
572 xformsColorDB.clear();
575 xcol.name = _("GUI background");
576 xcol.colorID = FL_COL1;
577 fl_getmcolor(FL_COL1, &xcol.r, &xcol.g, &xcol.b);
579 xformsColorDB.push_back(xcol);
581 xcol.name = _("GUI text");
582 xcol.colorID = FL_BLACK;
583 fl_getmcolor(FL_BLACK, &xcol.r, &xcol.g, &xcol.b);
585 xformsColorDB.push_back(xcol);
587 xcol.name = _("GUI selection");
588 xcol.colorID = FL_YELLOW;
589 fl_getmcolor(FL_YELLOW, &xcol.r, &xcol.g, &xcol.b);
591 xformsColorDB.push_back(xcol);
593 xcol.name = _("GUI pointer");
594 xcol.colorID = GUI_COLOR_CURSOR;
595 fl_getmcolor(GUI_COLOR_CURSOR, &xcol.r, &xcol.g, &xcol.b);
597 xformsColorDB.push_back(xcol);
599 // Now create the the LyX LColors database
601 for (int i=0; i<LColor::ignore; ++i) {
602 LColor::color lc = static_cast<LColor::color>(i);
603 if (lc == LColor::none
604 || lc == LColor::black
605 || lc == LColor::white
607 || lc == LColor::green
608 || lc == LColor::blue
609 || lc == LColor::cyan
610 || lc == LColor::magenta
611 || lc == LColor::yellow
612 || lc == LColor::inherit
613 || lc == LColor::ignore) continue;
616 bool const success = getRGBColor(lc, col.r, col.g, col.b);
618 lyxerr << "FormPreferences::Colors::LoadBrowserLyX:\n"
619 << "LColor " << lcolor.getLyXName(lc)
620 << ": X can't find color \""
621 << lcolor.getX11Name(lc)
622 << "\". Set to \"black\"!" << endl;
624 string const arg = lcolor.getLyXName(lc) + " black";
625 parent_.controller().setColor(lc, "black");
629 // Create a valid X11 name of the form "#rrggbb" and change the
630 // LColor X11name to this. Don't want to trigger a redraw,
631 // as we're just changing the name not the RGB values.
632 // Also reset the system_lcolor names, so that we don't output
633 // unnecessary changes.
634 string const hexname = X11hexname(col);
636 if (lcolor.getX11Name(lc) != hexname) {
637 lcolor.setColor(lc, hexname);
638 system_lcolor.setColor(lc, hexname);
641 // Finally, push the color onto the database
642 NamedColor ncol(lcolor.getGUIName(lc), col);
643 lyxColorDB.push_back(ncol);
646 // Now construct the browser
647 FL_OBJECT * colbr = dialog_->browser_lyx_objs;
648 fl_freeze_form(dialog_->form);
649 fl_clear_browser(colbr);
650 for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
651 cit != xformsColorDB.end(); ++cit) {
652 fl_addto_browser(colbr, cit->getname().c_str());
654 for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
655 cit != lyxColorDB.end(); ++cit) {
656 fl_addto_browser(colbr, cit->getname().c_str());
659 // just to be safe...
660 fl_set_browser_topline(dialog_->browser_lyx_objs, 1);
661 fl_select_browser_line(dialog_->browser_lyx_objs, 1);
662 fl_unfreeze_form(dialog_->form);
668 void FormPreferences::Colors::Modify()
670 vector<NamedColor>::size_type const selLyX =
671 fl_get_browser(dialog_->browser_lyx_objs);
676 fl_getmcolor(GUI_COLOR_CHOICE, &before.r, &before.g, &before.b);
678 RGBColor col = picker_->requestColor(before);
682 fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
683 fl_redraw_object(dialog_->button_color);
685 // Is the choice an Xforms color...
686 if (selLyX - 1 < xformsColorDB.size()) {
687 vector<XformsColor>::size_type const i = selLyX - 1;
688 xformsColorDB[i].r = col.r;
689 xformsColorDB[i].g = col.g;
690 xformsColorDB[i].b = col.b;
692 // or a LyX Logical color?
694 vector<NamedColor>::size_type const i = selLyX - 1 -
695 xformsColorDB.size();
696 lyxColorDB[i].r = col.r;
697 lyxColorDB[i].g = col.g;
698 lyxColorDB[i].b = col.b;
703 FormPreferences::Converters::Converters(FormPreferences & p)
708 FD_preferences_converters const * FormPreferences::Converters::dialog()
710 return dialog_.get();
714 void FormPreferences::Converters::apply() const
716 parent_.controller().setConverters(local_converters);
720 void FormPreferences::Converters::build()
722 dialog_.reset(build_preferences_converters(&parent_));
724 fl_set_input_return(dialog_->input_converter, FL_RETURN_CHANGED);
725 fl_set_input_return(dialog_->input_flags, FL_RETURN_CHANGED);
727 // set up the feedback mechanism
728 setPrehandler(dialog_->browser_all);
729 setPrehandler(dialog_->button_delete);
730 setPrehandler(dialog_->button_add);
731 setPrehandler(dialog_->input_converter);
732 setPrehandler(dialog_->choice_from);
733 setPrehandler(dialog_->choice_to);
734 setPrehandler(dialog_->input_flags);
739 FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const
741 if (ob == dialog_->browser_all)
742 return _("All explicitly defined converters for LyX");
744 if (ob == dialog_->choice_from)
745 return _("Convert \"from\" this format");
747 if (ob == dialog_->choice_to)
748 return _("Convert \"to\" this format");
750 if (ob == dialog_->input_converter)
751 return _("The conversion command. $$i is the input file name, "
752 "$$b is the file name without its extension and $$o is "
753 "the name of the output file. $$s can be used as path to "
754 "LyX's own collection of conversion scripts.");
756 if (ob == dialog_->input_flags)
757 return _("Extra information for the Converter class, whether and "
758 "how to parse the result, and various other things.");
760 if (ob == dialog_->button_delete)
761 return _("Remove the current converter from the list of available "
762 "converters. Note: you must then \"Apply\" the change.");
764 if (ob == dialog_->button_add) {
765 if (string(ob->label) == _("Add"))
766 return _("Add the current converter to the list of available "
767 "converters. Note: you must then \"Apply\" the change.");
769 return _("Modify the contents of the current converter. "
770 "Note: you must then \"Apply\" the change.");
777 bool FormPreferences::Converters::input(FL_OBJECT const * const ob)
779 if (ob == dialog_->browser_all)
782 if (ob == dialog_->choice_from
783 || ob == dialog_->choice_to
784 || ob == dialog_->input_converter
785 || ob == dialog_->input_flags)
788 if (ob == dialog_->button_add)
791 if (ob == dialog_->button_delete)
798 void FormPreferences::Converters::update()
800 local_converters = converters;
801 local_converters.update(local_formats);
806 void FormPreferences::Converters::UpdateBrowser()
808 local_converters.sort();
810 fl_freeze_form(dialog_->form);
811 fl_clear_browser(dialog_->browser_all);
812 for (::Converters::const_iterator cit = local_converters.begin();
813 cit != local_converters.end(); ++cit) {
814 string const name = cit->From->prettyname() + " -> "
815 + cit->To->prettyname();
816 fl_addto_browser(dialog_->browser_all, name.c_str());
819 fl_unfreeze_form(dialog_->form);
823 bool FormPreferences::Converters::Add()
825 string const from = GetFrom();
826 string const to = GetTo();
827 string const command = fl_get_input(dialog_->input_converter);
828 string const flags = fl_get_input(dialog_->input_flags);
830 Converter const * old = local_converters.getConverter(from, to);
831 local_converters.add(from, to, command, flags);
833 local_converters.updateLast(local_formats);
836 setEnabled(dialog_->button_add, false);
842 bool FormPreferences::Converters::Browser()
844 int const i = fl_get_browser(dialog_->browser_all);
845 if (i <= 0) return false;
847 fl_freeze_form(dialog_->form);
849 Converter const & c = local_converters.get(i - 1);
850 int j = local_formats.getNumber(c.from);
852 fl_set_choice(dialog_->choice_from, j + 1);
854 j = local_formats.getNumber(c.to);
856 fl_set_choice(dialog_->choice_to, j + 1);
858 fl_set_input(dialog_->input_converter, c.command.c_str());
859 fl_set_input(dialog_->input_flags, c.flags.c_str());
861 fl_set_object_label(dialog_->button_add, idex(_("Modify|#M")).c_str());
862 fl_set_button_shortcut(dialog_->button_add,
863 scex(_("Modify|#M")).c_str(), 1);
865 setEnabled(dialog_->button_add, false);
866 setEnabled(dialog_->button_delete, true);
868 fl_unfreeze_form(dialog_->form);
873 bool FormPreferences::Converters::erase()
875 string const from = GetFrom();
876 string const to = GetTo();
878 local_converters.erase(from, to);
884 bool FormPreferences::Converters::Input()
886 string const from = GetFrom();
887 string const to = GetTo();
888 int const sel = local_converters.getNumber(from, to);
890 fl_freeze_form(dialog_->form);
893 fl_set_object_label(dialog_->button_add,
894 idex(_("Add|#A")).c_str());
895 fl_set_button_shortcut(dialog_->button_add,
896 scex(_("Add|#A")).c_str(), 1);
898 fl_deselect_browser(dialog_->browser_all);
899 setEnabled(dialog_->button_delete, false);
902 fl_set_object_label(dialog_->button_add,
903 idex(_("Modify|#M")).c_str());
904 fl_set_button_shortcut(dialog_->button_add,
905 scex(_("Modify|#M")).c_str(), 1);
907 int top = max(sel-5, 0);
908 fl_set_browser_topline(dialog_->browser_all, top);
909 fl_select_browser_line(dialog_->browser_all, sel+1);
910 setEnabled(dialog_->button_delete, true);
913 string const command = rtrim(fl_get_input(dialog_->input_converter));
914 bool const enable = !(command.empty() || from == to);
915 setEnabled(dialog_->button_add, enable);
917 fl_unfreeze_form(dialog_->form);
922 string const FormPreferences::Converters::GetFrom() const
924 ::Formats::FormatList::size_type const i =
925 fl_get_choice(dialog_->choice_from);
927 if (i > 0 && i <= local_formats.size())
928 return local_formats.get(i - 1).name();
930 lyxerr << "FormPreferences::Converters::GetFrom: No choice!" << endl;
935 string const FormPreferences::Converters::GetTo() const
937 ::Formats::FormatList::size_type const i =
938 fl_get_choice(dialog_->choice_to);
940 if (i > 0 && i <= local_formats.size())
941 return local_formats.get(i - 1).name();
943 lyxerr << "FormPreferences::Converters::GetTo: No choice!" << endl;
948 void FormPreferences::Converters::UpdateChoices() const
951 for (::Formats::const_iterator cit = local_formats.begin();
952 cit != local_formats.end(); ++cit) {
957 choice += cit->prettyname();
961 fl_clear_choice(dialog_->choice_from);
962 fl_addto_choice(dialog_->choice_from, choice.c_str());
964 fl_clear_choice(dialog_->choice_to);
965 fl_addto_choice(dialog_->choice_to, choice.c_str());
969 FormPreferences::Formats::Formats(FormPreferences & p)
974 FD_preferences_formats const * FormPreferences::Formats::dialog()
976 return dialog_.get();
980 void FormPreferences::Formats::apply() const
982 parent_.controller().setFormats(local_formats);
986 void FormPreferences::Formats::build()
988 dialog_.reset(build_preferences_formats(&parent_));
990 fl_set_input_return(dialog_->input_format, FL_RETURN_CHANGED);
991 fl_set_input_return(dialog_->input_viewer, FL_RETURN_CHANGED);
992 fl_set_input_return(dialog_->input_shrtcut, FL_RETURN_CHANGED);
993 fl_set_input_return(dialog_->input_gui_name, FL_RETURN_CHANGED);
994 fl_set_input_return(dialog_->input_extension, FL_RETURN_CHANGED);
996 fl_set_input_filter(dialog_->input_format, fl_lowercase_filter);
998 // set up the feedback mechanism
999 setPrehandler(dialog_->browser_all);
1000 setPrehandler(dialog_->input_format);
1001 setPrehandler(dialog_->input_gui_name);
1002 setPrehandler(dialog_->button_delete);
1003 setPrehandler(dialog_->button_add);
1004 setPrehandler(dialog_->input_extension);
1005 setPrehandler(dialog_->input_viewer);
1006 setPrehandler(dialog_->input_shrtcut);
1011 FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
1013 if (ob == dialog_->browser_all)
1014 return _("All the currently defined formats known to LyX.");
1016 if (ob == dialog_->input_format)
1017 return _("The format identifier.");
1019 if (ob == dialog_->input_gui_name)
1020 return _("The format name as it will appear in the menus.");
1022 if (ob == dialog_->input_shrtcut)
1023 return _("The keyboard accelerator. Use a letter in the GUI name. "
1026 if (ob == dialog_->input_extension)
1027 return _("Used to recognize the file. E.g., ps, pdf, tex.");
1029 if (ob == dialog_->input_viewer)
1030 return _("The command used to launch the viewer application.");
1032 if (ob == dialog_->button_delete)
1033 return _("Remove the current format from the list of available "
1034 "formats. Note: you must then \"Apply\" the change.");
1036 if (ob == dialog_->button_add) {
1037 if (string(ob->label) == _("Add"))
1038 return _("Add the current format to the list of available "
1039 "formats. Note: you must then \"Apply\" the change.");
1041 return _("Modify the contents of the current format. Note: "
1042 "you must then \"Apply\" the change.");
1049 bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
1051 if (ob == dialog_->browser_all)
1054 if (ob == dialog_->input_format
1055 || ob == dialog_->input_gui_name
1056 || ob == dialog_->input_shrtcut
1057 || ob == dialog_->input_extension
1058 || ob == dialog_->input_viewer)
1061 if (ob == dialog_->button_add)
1064 if (ob == dialog_->button_delete)
1071 void FormPreferences::Formats::update()
1073 local_formats = formats;
1078 void FormPreferences::Formats::UpdateBrowser()
1080 local_formats.sort();
1082 fl_freeze_form(dialog_->form);
1083 fl_deselect_browser(dialog_->browser_all);
1084 fl_clear_browser(dialog_->browser_all);
1085 for (::Formats::const_iterator cit = local_formats.begin();
1086 cit != local_formats.end(); ++cit)
1087 fl_addto_browser(dialog_->browser_all,
1088 cit->prettyname().c_str());
1091 fl_unfreeze_form(dialog_->form);
1093 // Mustn't forget to update the Formats available to the converters_
1094 parent_.converters_.UpdateChoices();
1095 local_converters.update(local_formats);
1099 bool FormPreferences::Formats::Add()
1101 string const name = fl_get_input(dialog_->input_format);
1102 string const prettyname = fl_get_input(dialog_->input_gui_name);
1103 string const extension = fl_get_input(dialog_->input_extension);
1104 string const shortcut = fl_get_input(dialog_->input_shrtcut);
1105 string const viewer = fl_get_input(dialog_->input_viewer);
1107 Format const * old = local_formats.getFormat(name);
1108 string const old_prettyname = old ? old->prettyname() : string();
1109 local_formats.add(name, extension, prettyname, shortcut);
1110 local_formats.setViewer(name, viewer);
1111 if (!old || prettyname != old_prettyname) {
1114 parent_.converters_.UpdateBrowser();
1116 setEnabled(dialog_->button_add, false);
1122 bool FormPreferences::Formats::Browser()
1124 int const i = fl_get_browser(dialog_->browser_all);
1128 fl_freeze_form(dialog_->form);
1130 Format const & f = local_formats.get(i - 1);
1132 fl_set_input(dialog_->input_format, f.name().c_str());
1133 fl_set_input(dialog_->input_gui_name, f.prettyname().c_str());
1134 fl_set_input(dialog_->input_shrtcut, f.shortcut().c_str());
1135 fl_set_input(dialog_->input_extension, f.extension().c_str());
1136 fl_set_input(dialog_->input_viewer, f.viewer().c_str());
1138 fl_set_object_label(dialog_->button_add,
1139 idex(_("Modify|#M")).c_str());
1140 fl_set_button_shortcut(dialog_->button_add,
1141 scex(_("Modify|#M")).c_str(), 1);
1143 setEnabled(dialog_->button_add, false);
1144 setEnabled(dialog_->button_delete, true);
1146 fl_unfreeze_form(dialog_->form);
1151 bool FormPreferences::Formats::erase()
1153 string const name = fl_get_input(dialog_->input_format);
1155 if (local_converters.formatIsUsed(name)) {
1156 parent_.postWarning(_("Cannot remove a Format used by a Converter. "
1157 "Remove the converter first."));
1158 setEnabled(dialog_->button_delete, false);
1162 local_formats.erase(name);
1168 bool FormPreferences::Formats::Input()
1170 string const name = fl_get_input(dialog_->input_format);
1171 int const sel = local_formats.getNumber(name);
1172 fl_freeze_form(dialog_->form);
1175 fl_set_object_label(dialog_->button_add,
1176 idex(_("Add|#A")).c_str());
1177 fl_set_button_shortcut(dialog_->button_add,
1178 scex(_("Add|#A")).c_str(), 1);
1180 fl_deselect_browser(dialog_->browser_all);
1181 setEnabled(dialog_->button_delete, false);
1184 fl_set_object_label(dialog_->button_add,
1185 idex(_("Modify|#M")).c_str());
1186 fl_set_button_shortcut(dialog_->button_add,
1187 scex(_("Modify|#M")).c_str(), 1);
1189 int const top = max(sel-5, 0);
1190 fl_set_browser_topline(dialog_->browser_all, top);
1191 fl_select_browser_line(dialog_->browser_all, sel+1);
1193 setEnabled(dialog_->button_add, true);
1194 setEnabled(dialog_->button_delete, true);
1197 string const prettyname = fl_get_input(dialog_->input_gui_name);
1198 bool const enable = !(name.empty() || prettyname.empty());
1199 setEnabled(dialog_->button_add, enable);
1201 fl_unfreeze_form(dialog_->form);
1206 FormPreferences::Identity::Identity(FormPreferences & p)
1211 FD_preferences_identity const * FormPreferences::Identity::dialog()
1213 return dialog_.get();
1217 void FormPreferences::Identity::apply(LyXRC & rc) const
1219 rc.user_name = fl_get_input(dialog_->input_user_name);
1220 rc.user_email = fl_get_input(dialog_->input_user_email);
1224 void FormPreferences::Identity::build()
1226 dialog_.reset(build_preferences_identity(&parent_));
1227 fl_set_input_return(dialog_->input_user_name, FL_RETURN_CHANGED);
1228 fl_set_input_return(dialog_->input_user_email, FL_RETURN_CHANGED);
1232 void FormPreferences::Identity::update(LyXRC const & rc)
1234 fl_set_input(dialog_->input_user_name, rc.user_name.c_str());
1235 fl_set_input(dialog_->input_user_email, rc.user_email.c_str());
1239 FormPreferences::InputsMisc::InputsMisc(FormPreferences & p)
1244 FD_preferences_inputs_misc const * FormPreferences::InputsMisc::dialog()
1246 return dialog_.get();
1250 void FormPreferences::InputsMisc::apply(LyXRC & rc) const
1252 rc.date_insert_format =
1253 fl_get_input(dialog_->input_date_format);
1257 void FormPreferences::InputsMisc::build()
1259 dialog_.reset(build_preferences_inputs_misc(&parent_));
1261 fl_set_input_return(dialog_->input_date_format, FL_RETURN_CHANGED);
1263 // set up the feedback mechanism
1264 setPrehandler(dialog_->input_date_format);
1269 FormPreferences::InputsMisc::feedback(FL_OBJECT const * const ob) const
1271 if (ob == dialog_->input_date_format)
1272 return LyXRC::getDescription(LyXRC::RC_DATE_INSERT_FORMAT);
1277 void FormPreferences::InputsMisc::update(LyXRC const & rc)
1279 fl_set_input(dialog_->input_date_format,
1280 rc.date_insert_format.c_str());
1284 FormPreferences::Interface::Interface(FormPreferences & p)
1289 FD_preferences_interface const * FormPreferences::Interface::dialog()
1291 return dialog_.get();
1295 void FormPreferences::Interface::apply(LyXRC & rc) const
1297 rc.popup_normal_font =
1298 fl_get_input(dialog_->input_popup_normal_font);
1299 rc.popup_bold_font = fl_get_input(dialog_->input_popup_bold_font);
1300 rc.popup_font_encoding =
1301 fl_get_input(dialog_->input_popup_font_encoding);
1302 rc.bind_file = fl_get_input(dialog_->input_bind_file);
1303 rc.ui_file = fl_get_input(dialog_->input_ui_file);
1307 void FormPreferences::Interface::build()
1309 dialog_.reset(build_preferences_interface(&parent_));
1311 fl_set_input_return(dialog_->input_popup_normal_font, FL_RETURN_CHANGED);
1312 fl_set_input_return(dialog_->input_popup_bold_font, FL_RETURN_CHANGED);
1313 fl_set_input_return(dialog_->input_popup_font_encoding, FL_RETURN_CHANGED);
1314 fl_set_input_return(dialog_->input_bind_file, FL_RETURN_CHANGED);
1315 fl_set_input_return(dialog_->input_ui_file, FL_RETURN_CHANGED);
1317 // set up the feedback mechanism
1318 setPrehandler(dialog_->input_popup_normal_font);
1319 setPrehandler(dialog_->input_popup_bold_font);
1320 setPrehandler(dialog_->input_popup_font_encoding);
1321 setPrehandler(dialog_->input_bind_file);
1322 setPrehandler(dialog_->button_bind_file_browse);
1323 setPrehandler(dialog_->input_ui_file);
1324 setPrehandler(dialog_->button_ui_file_browse);
1329 FormPreferences::Interface::feedback(FL_OBJECT const * const ob) const
1331 if (ob == dialog_->input_popup_normal_font)
1332 return LyXRC::getDescription(LyXRC::RC_POPUP_NORMAL_FONT);
1333 if (ob == dialog_->input_popup_bold_font)
1334 return LyXRC::getDescription(LyXRC::RC_POPUP_BOLD_FONT);
1335 if (ob == dialog_->input_popup_font_encoding)
1336 return LyXRC::getDescription(LyXRC::RC_POPUP_FONT_ENCODING);
1337 if (ob == dialog_->input_bind_file)
1338 return LyXRC::getDescription(LyXRC::RC_BINDFILE);
1339 if (ob == dialog_->input_ui_file)
1340 return LyXRC::getDescription(LyXRC::RC_UIFILE);
1345 bool FormPreferences::Interface::input(FL_OBJECT const * const ob)
1347 if (ob == dialog_->button_bind_file_browse) {
1348 string f = parent_.controller().browsebind(
1349 fl_get_input(dialog_->input_bind_file));
1351 fl_set_input(dialog_->input_bind_file, f.c_str());
1352 } else if (ob == dialog_->button_ui_file_browse) {
1353 string f = parent_.controller().browseUI(
1354 fl_get_input(dialog_->input_ui_file));
1356 fl_set_input(dialog_->input_ui_file, f.c_str());
1363 void FormPreferences::Interface::update(LyXRC const & rc)
1365 fl_set_input(dialog_->input_popup_normal_font,
1366 rc.popup_normal_font.c_str());
1367 fl_set_input(dialog_->input_popup_bold_font,
1368 rc.popup_bold_font.c_str());
1369 fl_set_input(dialog_->input_popup_font_encoding,
1370 rc.popup_font_encoding.c_str());
1371 fl_set_input(dialog_->input_bind_file,
1372 rc.bind_file.c_str());
1373 fl_set_input(dialog_->input_ui_file,
1374 rc.ui_file.c_str());
1378 FormPreferences::Language::Language(FormPreferences & p)
1383 FD_preferences_language const * FormPreferences::Language::dialog()
1385 return dialog_.get();
1389 void FormPreferences::Language::apply(LyXRC & rc)
1391 int const pos = fl_get_combox(dialog_->combox_default_lang);
1392 rc.default_language = lang_[pos-1];
1394 int button = fl_get_button(dialog_->check_use_kbmap);
1395 string const name_1 = fl_get_input(dialog_->input_kbmap1);
1396 string const name_2 = fl_get_input(dialog_->input_kbmap2);
1398 button = !(name_1.empty() && name_2.empty());
1399 rc.use_kbmap = static_cast<bool>(button);
1402 rc.primary_kbmap = name_1;
1403 rc.secondary_kbmap = name_2;
1406 button = fl_get_button(dialog_->check_rtl_support);
1407 rc.rtl_support = static_cast<bool>(button);
1409 button = fl_get_button(dialog_->check_mark_foreign);
1410 rc.mark_foreign_language = static_cast<bool>(button);
1412 button = fl_get_button(dialog_->check_auto_begin);
1413 rc.language_auto_begin = static_cast<bool>(button);
1415 button = fl_get_button(dialog_->check_auto_end);
1416 rc.language_auto_end = static_cast<bool>(button);
1418 button = fl_get_button(dialog_->check_use_babel);
1419 rc.language_use_babel = static_cast<bool>(button);
1421 button = fl_get_button(dialog_->check_global_options);
1422 rc.language_global_options = static_cast<bool>(button);
1424 rc.language_package = fl_get_input(dialog_->input_package);
1425 rc.language_command_begin = fl_get_input(dialog_->input_command_begin);
1426 rc.language_command_end = fl_get_input(dialog_->input_command_end);
1428 // Ensure that all is self-consistent.
1433 void FormPreferences::Language::build()
1435 dialog_.reset(build_preferences_language(&parent_));
1437 fl_set_input_return(dialog_->input_package, FL_RETURN_CHANGED);
1438 fl_set_input_return(dialog_->input_command_begin, FL_RETURN_CHANGED);
1439 fl_set_input_return(dialog_->input_command_end, FL_RETURN_CHANGED);
1441 // Store the lang identifiers for later
1442 vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
1443 lang_ = getSecond(langs);
1445 FL_OBJECT * obj = dialog_->combox_default_lang;
1446 vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
1447 vector<frnt::LanguagePair>::const_iterator lend = langs.end();
1448 for (; lit != lend; ++lit) {
1449 fl_addto_combox(obj, lit->first.c_str());
1451 fl_set_combox_browser_height(obj, 400);
1453 // set up the feedback mechanism
1454 setPrehandler(dialog_->input_package);
1455 setPrehandler(dialog_->check_use_kbmap);
1456 setPrehandler(dialog_->combox_default_lang);
1457 setPrehandler(dialog_->input_kbmap1);
1458 setPrehandler(dialog_->input_kbmap2);
1459 setPrehandler(dialog_->check_rtl_support);
1460 setPrehandler(dialog_->check_mark_foreign);
1461 setPrehandler(dialog_->check_auto_begin);
1462 setPrehandler(dialog_->check_auto_end);
1463 setPrehandler(dialog_->check_use_babel);
1464 setPrehandler(dialog_->check_global_options);
1465 setPrehandler(dialog_->input_command_begin);
1466 setPrehandler(dialog_->input_command_end);
1468 // Activate/Deactivate the input fields dependent on the state of the
1475 FormPreferences::Language::feedback(FL_OBJECT const * const ob) const
1477 if (ob == dialog_->combox_default_lang)
1478 return LyXRC::getDescription(LyXRC::RC_DEFAULT_LANGUAGE);
1479 if (ob == dialog_->check_use_kbmap)
1480 return LyXRC::getDescription(LyXRC::RC_KBMAP);
1481 if (ob == dialog_->input_kbmap1)
1482 return LyXRC::getDescription(LyXRC::RC_KBMAP_PRIMARY);
1483 if (ob == dialog_->input_kbmap2)
1484 return LyXRC::getDescription(LyXRC::RC_KBMAP_SECONDARY);
1485 if (ob == dialog_->check_rtl_support)
1486 return LyXRC::getDescription(LyXRC::RC_RTL_SUPPORT);
1487 if (ob == dialog_->check_mark_foreign)
1488 return LyXRC::getDescription(LyXRC::RC_MARK_FOREIGN_LANGUAGE);
1489 if (ob == dialog_->check_auto_begin)
1490 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_BEGIN);
1491 if (ob == dialog_->check_auto_end)
1492 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_END);
1493 if (ob == dialog_->check_use_babel)
1494 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_USE_BABEL);
1495 if (ob == dialog_->check_global_options)
1496 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS);
1497 if (ob == dialog_->input_package)
1498 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_PACKAGE);
1499 if (ob == dialog_->input_command_begin)
1500 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_BEGIN);
1501 if (ob == dialog_->input_command_end)
1502 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_END);
1507 bool FormPreferences::Language::input(FL_OBJECT const * const ob)
1509 bool activate = true;
1511 // !ob if function is called from Language::build() to de/activate
1513 // otherwise the function is called by an xforms CB via input().
1514 if (!ob || ob == dialog_->check_use_kbmap) {
1515 bool const enable = fl_get_button(dialog_->check_use_kbmap);
1516 setEnabled(dialog_->button_kbmap1_browse, enable);
1517 setEnabled(dialog_->button_kbmap2_browse, enable);
1518 setEnabled(dialog_->input_kbmap1, enable);
1519 setEnabled(dialog_->input_kbmap2, enable);
1522 if (ob == dialog_->button_kbmap1_browse) {
1523 string f = parent_.controller().browsekbmap(
1524 fl_get_input(dialog_->input_kbmap1));
1526 fl_set_input(dialog_->input_kbmap1, f.c_str());
1527 } else if (ob == dialog_->button_kbmap2_browse) {
1528 string f = parent_.controller().browsekbmap(
1529 fl_get_input(dialog_->input_kbmap2));
1531 fl_set_input(dialog_->input_kbmap2, f.c_str());
1538 void FormPreferences::Language::update(LyXRC const & rc)
1540 fl_set_button(dialog_->check_use_kbmap,
1543 int const pos = int(findPos(lang_, rc.default_language));
1544 fl_set_combox(dialog_->combox_default_lang, pos + 1);
1547 fl_set_input(dialog_->input_kbmap1,
1548 rc.primary_kbmap.c_str());
1549 fl_set_input(dialog_->input_kbmap2,
1550 rc.secondary_kbmap.c_str());
1552 fl_set_input(dialog_->input_kbmap1, "");
1553 fl_set_input(dialog_->input_kbmap2, "");
1556 fl_set_button(dialog_->check_rtl_support, rc.rtl_support);
1557 fl_set_button(dialog_->check_mark_foreign,
1558 rc.mark_foreign_language);
1559 fl_set_button(dialog_->check_auto_begin, rc.language_auto_begin);
1560 fl_set_button(dialog_->check_auto_end, rc.language_auto_end);
1561 fl_set_button(dialog_->check_use_babel, rc.language_use_babel);
1562 fl_set_button(dialog_->check_global_options,
1563 rc.language_global_options);
1565 fl_set_input(dialog_->input_package,
1566 rc.language_package.c_str());
1567 fl_set_input(dialog_->input_command_begin,
1568 rc.language_command_begin.c_str());
1569 fl_set_input(dialog_->input_command_end,
1570 rc.language_command_end.c_str());
1572 // Activate/Deactivate the input fields dependent on the state of the
1578 FormPreferences::LnFmisc::LnFmisc(FormPreferences & p)
1583 FD_preferences_lnf_misc const * FormPreferences::LnFmisc::dialog()
1585 return dialog_.get();
1589 void FormPreferences::LnFmisc::apply(LyXRC & rc) const
1591 rc.auto_region_delete =
1592 fl_get_button(dialog_->check_auto_region_delete);
1593 rc.cursor_follows_scrollbar =
1594 fl_get_button(dialog_->check_cursor_follows_scrollbar);
1595 rc.dialogs_iconify_with_main =
1596 fl_get_button(dialog_->check_dialogs_iconify_with_main);
1597 rc.preview = fl_get_button(dialog_->check_preview_latex);
1598 rc.autosave = static_cast<unsigned int>
1599 (fl_get_counter_value(dialog_->counter_autosave));
1600 rc.wheel_jump = static_cast<unsigned int>
1601 (fl_get_counter_value(dialog_->counter_wm_jump));
1604 // lyx::graphics::DisplayType old_value = rc.display_graphics;
1605 switch (fl_get_choice(dialog_->choice_display)) {
1607 rc.display_graphics = lyx::graphics::NoDisplay;
1610 rc.display_graphics = lyx::graphics::ColorDisplay;
1613 rc.display_graphics = lyx::graphics::GrayscaleDisplay;
1616 rc.display_graphics = lyx::graphics::MonochromeDisplay;
1619 rc.display_graphics = lyx::graphics::ColorDisplay;
1623 #ifdef WITH_WARNINGS
1624 #warning FIXME!! The graphics cache no longer has a changeDisplay method.
1627 if (old_value != rc.display_graphics) {
1628 lyx::graphics::GCache & gc = lyx::graphics::GCache::get();
1635 void FormPreferences::LnFmisc::build()
1637 dialog_.reset(build_preferences_lnf_misc(&parent_));
1639 fl_set_counter_step(dialog_->counter_autosave, 1, 10);
1640 fl_set_counter_step(dialog_->counter_wm_jump, 1, 10);
1642 fl_set_counter_return(dialog_->counter_autosave, FL_RETURN_CHANGED);
1643 fl_set_counter_return(dialog_->counter_wm_jump, FL_RETURN_CHANGED);
1645 // set up the feedback mechanism
1646 setPrehandler(dialog_->check_auto_region_delete);
1647 setPrehandler(dialog_->counter_autosave);
1648 setPrehandler(dialog_->check_cursor_follows_scrollbar);
1649 setPrehandler(dialog_->check_dialogs_iconify_with_main);
1650 setPrehandler(dialog_->check_preview_latex);
1651 setPrehandler(dialog_->counter_wm_jump);
1653 fl_addto_choice(dialog_->choice_display,
1654 _("Monochrome|Grayscale|Color|Do not display").c_str());
1659 FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const
1661 if (ob == dialog_->check_auto_region_delete)
1662 return LyXRC::getDescription(LyXRC::RC_AUTOREGIONDELETE);
1663 if (ob == dialog_->check_cursor_follows_scrollbar)
1664 return LyXRC::getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR);
1665 if (ob == dialog_->check_dialogs_iconify_with_main)
1666 return LyXRC::getDescription(LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN);
1667 if (ob == dialog_->check_preview_latex)
1668 return LyXRC::getDescription(LyXRC::RC_PREVIEW);
1669 if (ob == dialog_->counter_autosave)
1670 return LyXRC::getDescription(LyXRC::RC_AUTOSAVE);
1671 if (ob == dialog_->counter_wm_jump)
1672 return LyXRC::getDescription(LyXRC::RC_WHEEL_JUMP);
1673 if (ob == dialog_->choice_display)
1674 return LyXRC::getDescription(LyXRC::RC_DISPLAY_GRAPHICS);
1679 void FormPreferences::LnFmisc::update(LyXRC const & rc)
1681 fl_set_button(dialog_->check_auto_region_delete,
1682 rc.auto_region_delete);
1683 fl_set_button(dialog_->check_cursor_follows_scrollbar,
1684 rc.cursor_follows_scrollbar);
1685 fl_set_button(dialog_->check_dialogs_iconify_with_main,
1686 rc.dialogs_iconify_with_main);
1687 fl_set_button(dialog_->check_preview_latex,
1689 fl_set_counter_value(dialog_->counter_autosave, rc.autosave);
1690 fl_set_counter_value(dialog_->counter_wm_jump, rc.wheel_jump);
1692 switch (rc.display_graphics) {
1693 case lyx::graphics::NoDisplay:
1694 fl_set_choice(dialog_->choice_display, 4);
1696 case lyx::graphics::ColorDisplay:
1697 fl_set_choice(dialog_->choice_display, 3);
1699 case lyx::graphics::GrayscaleDisplay:
1700 fl_set_choice(dialog_->choice_display, 2);
1702 case lyx::graphics::MonochromeDisplay:
1703 fl_set_choice(dialog_->choice_display, 1);
1706 fl_set_choice(dialog_->choice_display, 3);
1712 FormPreferences::OutputsMisc::OutputsMisc(FormPreferences & p)
1717 FD_preferences_outputs_misc const * FormPreferences::OutputsMisc::dialog()
1719 return dialog_.get();
1723 void FormPreferences::OutputsMisc::apply(LyXRC & rc) const
1725 rc.ascii_linelen = static_cast<unsigned int>
1726 (fl_get_counter_value(dialog_->counter_line_len));
1727 rc.fontenc = fl_get_input(dialog_->input_tex_encoding);
1730 fl_get_choice(dialog_->choice_default_papersize) - 1;
1731 rc.default_papersize = static_cast<PAPER_SIZE>(choice);
1733 rc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff);
1734 rc.chktex_command = fl_get_input(dialog_->input_checktex);
1735 rc.view_dvi_paper_option = fl_get_input(dialog_->input_paperoption);
1736 rc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt);
1740 void FormPreferences::OutputsMisc::build()
1742 dialog_.reset(build_preferences_outputs_misc(&parent_));
1744 fl_set_counter_step(dialog_->counter_line_len, 1, 10);
1746 fl_set_counter_return(dialog_->counter_line_len, FL_RETURN_CHANGED);
1747 fl_set_input_return(dialog_->input_tex_encoding, FL_RETURN_CHANGED);
1748 fl_set_input_return(dialog_->input_ascii_roff, FL_RETURN_CHANGED);
1749 fl_set_input_return(dialog_->input_checktex, FL_RETURN_CHANGED);
1750 fl_set_input_return(dialog_->input_paperoption, FL_RETURN_CHANGED);
1752 fl_addto_choice(dialog_->choice_default_papersize,
1753 _(" default | US letter | US legal "
1754 "| US executive | A3 | A4 | A5 | B5 ").c_str());
1756 // set up the feedback mechanism
1757 setPrehandler(dialog_->counter_line_len);
1758 setPrehandler(dialog_->input_tex_encoding);
1759 setPrehandler(dialog_->choice_default_papersize);
1760 setPrehandler(dialog_->input_ascii_roff);
1761 setPrehandler(dialog_->input_checktex);
1762 setPrehandler(dialog_->input_paperoption);
1763 setPrehandler(dialog_->check_autoreset_classopt);
1768 FormPreferences::OutputsMisc::feedback(FL_OBJECT const * const ob) const
1770 if (ob == dialog_->counter_line_len)
1771 return LyXRC::getDescription(LyXRC::RC_ASCII_LINELEN);
1772 if (ob == dialog_->input_tex_encoding)
1773 return LyXRC::getDescription(LyXRC::RC_FONT_ENCODING);
1774 if (ob == dialog_->input_ascii_roff)
1775 return LyXRC::getDescription(LyXRC::RC_ASCIIROFF_COMMAND);
1776 if (ob == dialog_->input_checktex)
1777 return LyXRC::getDescription(LyXRC::RC_CHKTEX_COMMAND);
1778 if (ob == dialog_->choice_default_papersize)
1779 return LyXRC::getDescription(LyXRC::RC_DEFAULT_PAPERSIZE);
1780 if (ob == dialog_->input_paperoption)
1781 return LyXRC::getDescription(LyXRC::RC_VIEWDVI_PAPEROPTION);
1782 if (ob == dialog_->check_autoreset_classopt)
1783 return LyXRC::getDescription(LyXRC::RC_AUTORESET_OPTIONS);
1788 void FormPreferences::OutputsMisc::update(LyXRC const & rc)
1790 fl_set_counter_value(dialog_->counter_line_len,
1792 fl_set_input(dialog_->input_tex_encoding,
1793 rc.fontenc.c_str());
1794 fl_set_choice(dialog_->choice_default_papersize,
1795 rc.default_papersize + 1);
1796 fl_set_input(dialog_->input_ascii_roff,
1797 rc.ascii_roff_command.c_str());
1798 fl_set_input(dialog_->input_checktex,
1799 rc.chktex_command.c_str());
1800 fl_set_input(dialog_->input_paperoption,
1801 rc.view_dvi_paper_option.c_str());
1802 fl_set_button(dialog_->check_autoreset_classopt,
1803 rc.auto_reset_options);
1808 FormPreferences::Paths::Paths(FormPreferences & p)
1813 FD_preferences_paths const * FormPreferences::Paths::dialog()
1815 return dialog_.get();
1819 void FormPreferences::Paths::apply(LyXRC & rc)
1821 rc.document_path = fl_get_input(dialog_->input_default_path);
1822 rc.template_path = fl_get_input(dialog_->input_template_path);
1824 int button = fl_get_button(dialog_->check_use_temp_dir);
1825 string str = fl_get_input(dialog_->input_temp_dir);
1829 rc.use_tempdir = button;
1830 rc.tempdir_path = str;
1832 button = fl_get_button(dialog_->check_last_files);
1833 str = fl_get_input(dialog_->input_lastfiles);
1834 if (!button) str.erase();
1836 rc.check_lastfiles = button;
1838 rc.num_lastfiles = static_cast<unsigned int>
1839 (fl_get_counter_value(dialog_->counter_lastfiles));
1841 button = fl_get_button(dialog_->check_make_backups);
1842 str = fl_get_input(dialog_->input_backup_path);
1846 rc.make_backup = button;
1847 rc.backupdir_path = str;
1849 rc.lyxpipes = fl_get_input(dialog_->input_serverpipe);
1856 void FormPreferences::Paths::build()
1858 dialog_.reset(build_preferences_paths(&parent_));
1860 fl_set_input_return(dialog_->input_default_path, FL_RETURN_CHANGED);
1861 fl_set_input_return(dialog_->input_template_path, FL_RETURN_CHANGED);
1862 fl_set_input_return(dialog_->input_temp_dir, FL_RETURN_CHANGED);
1863 fl_set_input_return(dialog_->input_lastfiles, FL_RETURN_CHANGED);
1864 fl_set_input_return(dialog_->input_backup_path, FL_RETURN_CHANGED);
1865 fl_set_counter_return(dialog_->counter_lastfiles, FL_RETURN_CHANGED);
1866 fl_set_input_return(dialog_->input_serverpipe, FL_RETURN_CHANGED);
1868 // set up the feedback mechanism
1869 setPrehandler(dialog_->input_default_path);
1870 setPrehandler(dialog_->counter_lastfiles);
1871 setPrehandler(dialog_->input_template_path);
1872 setPrehandler(dialog_->check_last_files);
1873 setPrehandler(dialog_->input_lastfiles);
1874 setPrehandler(dialog_->check_make_backups);
1875 setPrehandler(dialog_->input_backup_path);
1876 setPrehandler(dialog_->input_serverpipe);
1877 setPrehandler(dialog_->input_temp_dir);
1878 setPrehandler(dialog_->check_use_temp_dir);
1883 FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const
1885 if (ob == dialog_->input_default_path)
1886 return LyXRC::getDescription(LyXRC::RC_DOCUMENTPATH);
1887 if (ob == dialog_->input_template_path)
1888 return LyXRC::getDescription(LyXRC::RC_TEMPLATEPATH);
1889 if (ob == dialog_->check_use_temp_dir)
1890 return LyXRC::getDescription(LyXRC::RC_USETEMPDIR);
1891 if (ob == dialog_->input_temp_dir)
1892 return LyXRC::getDescription(LyXRC::RC_TEMPDIRPATH);
1893 if (ob == dialog_->check_last_files)
1894 return LyXRC::getDescription(LyXRC::RC_CHECKLASTFILES);
1895 if (ob == dialog_->input_lastfiles)
1896 return LyXRC::getDescription(LyXRC::RC_LASTFILES);
1897 if (ob == dialog_->counter_lastfiles)
1898 return LyXRC::getDescription(LyXRC::RC_NUMLASTFILES);
1899 if (ob == dialog_->check_make_backups)
1900 return LyXRC::getDescription(LyXRC::RC_MAKE_BACKUP);
1901 if (ob == dialog_->input_backup_path)
1902 return LyXRC::getDescription(LyXRC::RC_BACKUPDIR_PATH);
1903 if (ob == dialog_->input_serverpipe)
1904 return LyXRC::getDescription(LyXRC::RC_SERVERPIPE);
1909 bool FormPreferences::Paths::input(FL_OBJECT const * const ob)
1911 bool activate = true;
1913 // !ob if function is called from Paths::update() to de/activate
1915 // otherwise the function is called by an xforms CB via input().
1916 if (!ob || ob == dialog_->check_use_temp_dir) {
1917 bool const enable = fl_get_button(dialog_->check_use_temp_dir);
1918 setEnabled(dialog_->input_temp_dir, enable);
1921 if (!ob || ob == dialog_->check_last_files) {
1922 bool const enable = fl_get_button(dialog_->check_last_files);
1923 setEnabled(dialog_->input_lastfiles, enable);
1926 if (!ob || ob == dialog_->check_make_backups) {
1927 bool const enable = fl_get_button(dialog_->check_make_backups);
1928 setEnabled(dialog_->input_backup_path, enable);
1931 if (!ob || ob == dialog_->input_default_path) {
1932 string const name = fl_get_input(dialog_->input_default_path);
1933 if (!name.empty() && !RWInfo::WriteableDir(name)) {
1934 parent_.postWarning(RWInfo::ErrorMessage());
1939 if (!ob || ob == dialog_->input_template_path) {
1940 string const name = fl_get_input(dialog_->input_template_path);
1941 if (!name.empty() && !RWInfo::ReadableDir(name)) {
1942 parent_.postWarning(RWInfo::ErrorMessage());
1947 if (!ob || ob == dialog_->input_temp_dir) {
1948 string const name = fl_get_input(dialog_->input_temp_dir);
1949 if (fl_get_button(dialog_->check_make_backups)
1951 && !RWInfo::WriteableDir(name)) {
1952 parent_.postWarning(RWInfo::ErrorMessage());
1957 if (!ob || ob == dialog_->input_backup_path) {
1958 string const name = fl_get_input(dialog_->input_backup_path);
1959 if (fl_get_button(dialog_->check_make_backups)
1961 && !RWInfo::WriteableDir(name)) {
1962 parent_.postWarning(RWInfo::ErrorMessage());
1967 if (!ob || ob == dialog_->input_lastfiles) {
1968 string const name = fl_get_input(dialog_->input_lastfiles);
1969 if (fl_get_button(dialog_->check_last_files)
1971 && !RWInfo::WriteableFile(name)) {
1972 parent_.postWarning(RWInfo::ErrorMessage());
1977 if (!ob || ob == dialog_->input_serverpipe) {
1978 string const name = fl_get_input(dialog_->input_serverpipe);
1979 if (!name.empty()) {
1980 // strip off the extension
1981 string const str = ChangeExtension(name, "");
1982 if (!RWInfo::WriteableFile(str + ".in")) {
1983 parent_.postWarning(RWInfo::ErrorMessage());
1986 if (!RWInfo::WriteableFile(str + ".out")) {
1987 parent_.postWarning(RWInfo::ErrorMessage());
1993 if (ob == dialog_->button_default_path_browse) {
1994 string f = parent_.controller().browsedir(
1995 fl_get_input(dialog_->input_default_path), _("Default path"));
1997 fl_set_input(dialog_->input_default_path, f.c_str());
1998 } else if (ob == dialog_->button_template_path_browse) {
1999 string f = parent_.controller().browsedir(
2000 fl_get_input(dialog_->input_template_path), _("Template path"));
2002 fl_set_input(dialog_->input_template_path, f.c_str());
2003 } else if (ob == dialog_->button_temp_dir_browse) {
2004 string f = parent_.controller().browsedir(
2005 fl_get_input(dialog_->input_temp_dir), _("Temporary dir"));
2007 fl_set_input(dialog_->input_temp_dir, f.c_str());
2008 } else if (ob == dialog_->button_lastfiles_browse) {
2009 string f = parent_.controller().browse(
2010 fl_get_input(dialog_->input_lastfiles), _("Last files"));
2012 fl_set_input(dialog_->input_lastfiles, f.c_str());
2013 } else if (ob == dialog_->button_backup_path_browse) {
2014 string f = parent_.controller().browsedir(
2015 fl_get_input(dialog_->input_backup_path), _("Backup path"));
2017 fl_set_input(dialog_->input_backup_path, f.c_str());
2018 } else if (ob == dialog_->button_serverpipe_browse) {
2019 string f = parent_.controller().browse(
2020 fl_get_input(dialog_->input_serverpipe), _("LyX server pipes"));
2022 fl_set_input(dialog_->input_serverpipe, f.c_str());
2029 void FormPreferences::Paths::update(LyXRC const & rc)
2031 fl_set_input(dialog_->input_default_path,
2032 rc.document_path.c_str());
2033 fl_set_input(dialog_->input_template_path,
2034 rc.template_path.c_str());
2038 str = rc.backupdir_path;
2040 fl_set_button(dialog_->check_make_backups,
2042 fl_set_input(dialog_->input_backup_path, str.c_str());
2046 str = rc.tempdir_path;
2048 fl_set_button(dialog_->check_use_temp_dir,
2050 fl_set_input(dialog_->input_temp_dir, str.c_str());
2053 if (rc.check_lastfiles)
2056 fl_set_button(dialog_->check_last_files,
2057 rc.check_lastfiles);
2058 fl_set_input(dialog_->input_lastfiles, str.c_str());
2059 fl_set_counter_value(dialog_->counter_lastfiles,
2062 fl_set_input(dialog_->input_serverpipe, rc.lyxpipes.c_str());
2064 // Activate/Deactivate the input fields dependent on the state of the
2070 FormPreferences::Printer::Printer(FormPreferences & p)
2075 FD_preferences_printer const * FormPreferences::Printer::dialog()
2077 return dialog_.get();
2081 void FormPreferences::Printer::apply(LyXRC & rc) const
2083 rc.print_adapt_output = fl_get_button(dialog_->check_adapt_output);
2084 rc.print_command = fl_get_input(dialog_->input_command);
2085 rc.print_pagerange_flag = fl_get_input(dialog_->input_page_range);
2086 rc.print_copies_flag = fl_get_input(dialog_->input_copies);
2087 rc.print_reverse_flag = fl_get_input(dialog_->input_reverse);
2088 rc.print_to_printer = fl_get_input(dialog_->input_to_printer);
2089 rc.print_file_extension =
2090 fl_get_input(dialog_->input_file_extension);
2091 rc.print_spool_command =
2092 fl_get_input(dialog_->input_spool_command);
2093 rc.print_paper_flag = fl_get_input(dialog_->input_paper_type);
2094 rc.print_evenpage_flag = fl_get_input(dialog_->input_even_pages);
2095 rc.print_oddpage_flag = fl_get_input(dialog_->input_odd_pages);
2096 rc.print_collcopies_flag = fl_get_input(dialog_->input_collated);
2097 rc.print_landscape_flag = fl_get_input(dialog_->input_landscape);
2098 rc.print_to_file = fl_get_input(dialog_->input_to_file);
2099 rc.print_extra_options =
2100 fl_get_input(dialog_->input_extra_options);
2101 rc.print_spool_printerprefix =
2102 fl_get_input(dialog_->input_spool_prefix);
2103 rc.print_paper_dimension_flag =
2104 fl_get_input(dialog_->input_paper_size);
2105 rc.printer = fl_get_input(dialog_->input_name);
2110 FormPreferences::Printer::feedback(FL_OBJECT const * const ob) const
2112 if (ob == dialog_->input_command)
2113 return LyXRC::getDescription(LyXRC::RC_PRINT_COMMAND);
2114 if (ob == dialog_->check_adapt_output)
2115 return LyXRC::getDescription(LyXRC::RC_PRINT_ADAPTOUTPUT);
2116 if (ob == dialog_->input_to_printer)
2117 return LyXRC::getDescription(LyXRC::RC_PRINTTOPRINTER);
2118 if (ob == dialog_->input_to_file)
2119 return LyXRC::getDescription(LyXRC::RC_PRINTTOFILE);
2120 if (ob == dialog_->input_file_extension)
2121 return LyXRC::getDescription(LyXRC::RC_PRINTFILEEXTENSION);
2122 if (ob == dialog_->input_extra_options)
2123 return LyXRC::getDescription(LyXRC::RC_PRINTEXSTRAOPTIONS);
2124 if (ob == dialog_->input_spool_command)
2125 return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_COMMAND);
2126 if (ob == dialog_->input_spool_prefix)
2127 return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_PRINTERPREFIX);
2128 if (ob == dialog_->input_name)
2129 return LyXRC::getDescription(LyXRC::RC_PRINTER);
2130 if (ob == dialog_->input_even_pages)
2131 return LyXRC::getDescription(LyXRC::RC_PRINTEVENPAGEFLAG);
2132 if (ob == dialog_->input_odd_pages)
2133 return LyXRC::getDescription(LyXRC::RC_PRINTODDPAGEFLAG);
2134 if (ob == dialog_->input_page_range)
2135 return LyXRC::getDescription(LyXRC::RC_PRINTPAGERANGEFLAG);
2136 if (ob == dialog_->input_reverse)
2137 return LyXRC::getDescription(LyXRC::RC_PRINTREVERSEFLAG);
2138 if (ob == dialog_->input_landscape)
2139 return LyXRC::getDescription(LyXRC::RC_PRINTLANDSCAPEFLAG);
2140 if (ob == dialog_->input_copies)
2141 return LyXRC::getDescription(LyXRC::RC_PRINTCOPIESFLAG);
2142 if (ob == dialog_->input_collated)
2143 return LyXRC::getDescription(LyXRC::RC_PRINTCOLLCOPIESFLAG);
2144 if (ob == dialog_->input_paper_type)
2145 return LyXRC::getDescription(LyXRC::RC_PRINTPAPERFLAG);
2146 if (ob == dialog_->input_paper_size)
2147 return LyXRC::getDescription(LyXRC::RC_PRINTPAPERDIMENSIONFLAG);
2152 void FormPreferences::Printer::build()
2154 dialog_.reset(build_preferences_printer(&parent_));
2156 fl_set_input_return(dialog_->input_command, FL_RETURN_CHANGED);
2157 fl_set_input_return(dialog_->input_page_range, FL_RETURN_CHANGED);
2158 fl_set_input_return(dialog_->input_copies, FL_RETURN_CHANGED);
2159 fl_set_input_return(dialog_->input_reverse, FL_RETURN_CHANGED);
2160 fl_set_input_return(dialog_->input_to_printer, FL_RETURN_CHANGED);
2161 fl_set_input_return(dialog_->input_file_extension, FL_RETURN_CHANGED);
2162 fl_set_input_return(dialog_->input_spool_command, FL_RETURN_CHANGED);
2163 fl_set_input_return(dialog_->input_paper_type, FL_RETURN_CHANGED);
2164 fl_set_input_return(dialog_->input_even_pages, FL_RETURN_CHANGED);
2165 fl_set_input_return(dialog_->input_odd_pages, FL_RETURN_CHANGED);
2166 fl_set_input_return(dialog_->input_collated, FL_RETURN_CHANGED);
2167 fl_set_input_return(dialog_->input_landscape, FL_RETURN_CHANGED);
2168 fl_set_input_return(dialog_->input_to_file, FL_RETURN_CHANGED);
2169 fl_set_input_return(dialog_->input_extra_options, FL_RETURN_CHANGED);
2170 fl_set_input_return(dialog_->input_spool_prefix, FL_RETURN_CHANGED);
2171 fl_set_input_return(dialog_->input_paper_size, FL_RETURN_CHANGED);
2172 fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
2174 // set up the feedback mechanism
2175 setPrehandler(dialog_->input_command);
2176 setPrehandler(dialog_->input_page_range);
2177 setPrehandler(dialog_->input_copies);
2178 setPrehandler(dialog_->input_reverse);
2179 setPrehandler(dialog_->input_to_printer);
2180 setPrehandler(dialog_->input_file_extension);
2181 setPrehandler(dialog_->input_spool_command);
2182 setPrehandler(dialog_->input_paper_type);
2183 setPrehandler(dialog_->input_even_pages);
2184 setPrehandler(dialog_->input_odd_pages);
2185 setPrehandler(dialog_->input_collated);
2186 setPrehandler(dialog_->input_landscape);
2187 setPrehandler(dialog_->input_to_file);
2188 setPrehandler(dialog_->input_extra_options);
2189 setPrehandler(dialog_->input_spool_prefix);
2190 setPrehandler(dialog_->input_paper_size);
2191 setPrehandler(dialog_->input_name);
2192 setPrehandler(dialog_->check_adapt_output);
2196 void FormPreferences::Printer::update(LyXRC const & rc)
2198 fl_set_button(dialog_->check_adapt_output,
2199 rc.print_adapt_output);
2200 fl_set_input(dialog_->input_command,
2201 rc.print_command.c_str());
2202 fl_set_input(dialog_->input_page_range,
2203 rc.print_pagerange_flag.c_str());
2204 fl_set_input(dialog_->input_copies,
2205 rc.print_copies_flag.c_str());
2206 fl_set_input(dialog_->input_reverse,
2207 rc.print_reverse_flag.c_str());
2208 fl_set_input(dialog_->input_to_printer,
2209 rc.print_to_printer.c_str());
2210 fl_set_input(dialog_->input_file_extension,
2211 rc.print_file_extension.c_str());
2212 fl_set_input(dialog_->input_spool_command,
2213 rc.print_spool_command.c_str());
2214 fl_set_input(dialog_->input_paper_type,
2215 rc.print_paper_flag.c_str());
2216 fl_set_input(dialog_->input_even_pages,
2217 rc.print_evenpage_flag.c_str());
2218 fl_set_input(dialog_->input_odd_pages,
2219 rc.print_oddpage_flag.c_str());
2220 fl_set_input(dialog_->input_collated,
2221 rc.print_collcopies_flag.c_str());
2222 fl_set_input(dialog_->input_landscape,
2223 rc.print_landscape_flag.c_str());
2224 fl_set_input(dialog_->input_to_file,
2225 rc.print_to_file.c_str());
2226 fl_set_input(dialog_->input_extra_options,
2227 rc.print_extra_options.c_str());
2228 fl_set_input(dialog_->input_spool_prefix,
2229 rc.print_spool_printerprefix.c_str());
2230 fl_set_input(dialog_->input_paper_size,
2231 rc.print_paper_dimension_flag.c_str());
2232 fl_set_input(dialog_->input_name,
2233 rc.printer.c_str());
2237 FormPreferences::ScreenFonts::ScreenFonts(FormPreferences & p)
2242 FD_preferences_screen_fonts const * FormPreferences::ScreenFonts::dialog()
2244 return dialog_.get();
2248 void FormPreferences::ScreenFonts::apply(LyXRC & rc) const
2250 bool changed = false;
2252 pair<string, string> tmp =
2253 parseFontName(fl_get_input(dialog_->input_roman));
2254 if (rc.roman_font_name != tmp.first ||
2255 rc.roman_font_foundry != tmp.second) {
2257 rc.roman_font_name = tmp.first;
2258 rc.roman_font_foundry = tmp.second;
2261 tmp = parseFontName(fl_get_input(dialog_->input_sans));
2262 if (rc.sans_font_name != tmp.first ||
2263 rc.sans_font_foundry != tmp.second) {
2265 rc.sans_font_name = tmp.first;
2266 rc.sans_font_foundry = tmp.second;
2269 tmp = parseFontName(fl_get_input(dialog_->input_typewriter));
2270 if (rc.typewriter_font_name != tmp.first ||
2271 rc.typewriter_font_foundry != tmp.second) {
2273 rc.typewriter_font_name = tmp.first;
2274 rc.typewriter_font_foundry = tmp.second;
2277 string str = fl_get_input(dialog_->input_screen_encoding);
2278 if (rc.font_norm != str) {
2281 rc.set_font_norm_type();
2284 bool button = fl_get_button(dialog_->check_scalable);
2285 if (rc.use_scalable_fonts != button) {
2287 rc.use_scalable_fonts = button;
2290 unsigned int ivalue = static_cast<unsigned int>
2291 (fl_get_counter_value(dialog_->counter_zoom));
2292 if (rc.zoom != ivalue) {
2297 ivalue = static_cast<unsigned int>
2298 (fl_get_counter_value(dialog_->counter_dpi));
2299 if (rc.dpi != ivalue) {
2304 double dvalue = strToDbl(fl_get_input(dialog_->input_tiny));
2305 if (rc.font_sizes[LyXFont::SIZE_TINY] != dvalue) {
2307 rc.font_sizes[LyXFont::SIZE_TINY] = dvalue;
2310 dvalue = strToDbl(fl_get_input(dialog_->input_script));
2311 if (rc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue) {
2313 rc.font_sizes[LyXFont::SIZE_SCRIPT] = dvalue;
2316 dvalue = strToDbl(fl_get_input(dialog_->input_footnote));
2317 if (rc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue) {
2319 rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = dvalue;
2322 dvalue = strToDbl(fl_get_input(dialog_->input_small));
2323 if (rc.font_sizes[LyXFont::SIZE_SMALL] != dvalue) {
2325 rc.font_sizes[LyXFont::SIZE_SMALL] = dvalue;
2328 dvalue = strToDbl(fl_get_input(dialog_->input_normal));
2329 if (rc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue) {
2331 rc.font_sizes[LyXFont::SIZE_NORMAL] = dvalue;
2334 dvalue = strToDbl(fl_get_input(dialog_->input_large));
2335 if (rc.font_sizes[LyXFont::SIZE_LARGE] != dvalue) {
2337 rc.font_sizes[LyXFont::SIZE_LARGE] = dvalue;
2340 dvalue = strToDbl(fl_get_input(dialog_->input_larger));
2341 if (rc.font_sizes[LyXFont::SIZE_LARGER] != dvalue) {
2343 rc.font_sizes[LyXFont::SIZE_LARGER] = dvalue;
2346 dvalue = strToDbl(fl_get_input(dialog_->input_largest));
2347 if (rc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue) {
2349 rc.font_sizes[LyXFont::SIZE_LARGEST] = dvalue;
2352 dvalue = strToDbl(fl_get_input(dialog_->input_huge));
2353 if (rc.font_sizes[LyXFont::SIZE_HUGE] != dvalue) {
2355 rc.font_sizes[LyXFont::SIZE_HUGE] = dvalue;
2358 dvalue = strToDbl(fl_get_input(dialog_->input_huger));
2359 if (rc.font_sizes[LyXFont::SIZE_HUGER] != dvalue) {
2361 rc.font_sizes[LyXFont::SIZE_HUGER] = dvalue;
2365 // Now update the buffers
2366 // Can anything below here affect the redraw process?
2367 parent_.controller().updateScreenFonts();
2372 void FormPreferences::ScreenFonts::build()
2374 dialog_.reset(build_preferences_screen_fonts(&parent_));
2376 fl_set_counter_step(dialog_->counter_zoom, 1, 10);
2377 fl_set_counter_step(dialog_->counter_dpi, 1, 10);
2379 fl_set_input_return(dialog_->input_roman, FL_RETURN_CHANGED);
2380 fl_set_input_return(dialog_->input_sans, FL_RETURN_CHANGED);
2381 fl_set_input_return(dialog_->input_typewriter, FL_RETURN_CHANGED);
2382 fl_set_input_return(dialog_->input_screen_encoding, FL_RETURN_CHANGED);
2383 fl_set_counter_return(dialog_->counter_zoom, FL_RETURN_CHANGED);
2384 fl_set_counter_return(dialog_->counter_dpi, FL_RETURN_CHANGED);
2385 fl_set_input_return(dialog_->input_tiny, FL_RETURN_CHANGED);
2386 fl_set_input_return(dialog_->input_script, FL_RETURN_CHANGED);
2387 fl_set_input_return(dialog_->input_footnote, FL_RETURN_CHANGED);
2388 fl_set_input_return(dialog_->input_small, FL_RETURN_CHANGED);
2389 fl_set_input_return(dialog_->input_normal, FL_RETURN_CHANGED);
2390 fl_set_input_return(dialog_->input_large, FL_RETURN_CHANGED);
2391 fl_set_input_return(dialog_->input_larger, FL_RETURN_CHANGED);
2392 fl_set_input_return(dialog_->input_largest, FL_RETURN_CHANGED);
2393 fl_set_input_return(dialog_->input_huge, FL_RETURN_CHANGED);
2394 fl_set_input_return(dialog_->input_huger, FL_RETURN_CHANGED);
2396 fl_set_input_filter(dialog_->input_tiny, fl_unsigned_float_filter);
2397 fl_set_input_filter(dialog_->input_script, fl_unsigned_float_filter);
2398 fl_set_input_filter(dialog_->input_footnote, fl_unsigned_float_filter);
2399 fl_set_input_filter(dialog_->input_small, fl_unsigned_float_filter);
2400 fl_set_input_filter(dialog_->input_normal, fl_unsigned_float_filter);
2401 fl_set_input_filter(dialog_->input_large, fl_unsigned_float_filter);
2402 fl_set_input_filter(dialog_->input_larger, fl_unsigned_float_filter);
2403 fl_set_input_filter(dialog_->input_largest, fl_unsigned_float_filter);
2404 fl_set_input_filter(dialog_->input_huge, fl_unsigned_float_filter);
2405 fl_set_input_filter(dialog_->input_huger, fl_unsigned_float_filter);
2407 // set up the feedback mechanism
2408 setPrehandler(dialog_->input_roman);
2409 setPrehandler(dialog_->input_sans);
2410 setPrehandler(dialog_->input_typewriter);
2411 setPrehandler(dialog_->counter_zoom);
2412 setPrehandler(dialog_->counter_dpi);
2413 setPrehandler(dialog_->check_scalable);
2414 setPrehandler(dialog_->input_screen_encoding);
2415 setPrehandler(dialog_->input_tiny);
2416 setPrehandler(dialog_->input_script);
2417 setPrehandler(dialog_->input_footnote);
2418 setPrehandler(dialog_->input_small);
2419 setPrehandler(dialog_->input_large);
2420 setPrehandler(dialog_->input_larger);
2421 setPrehandler(dialog_->input_largest);
2422 setPrehandler(dialog_->input_normal);
2423 setPrehandler(dialog_->input_huge);
2424 setPrehandler(dialog_->input_huger);
2429 FormPreferences::ScreenFonts::feedback(FL_OBJECT const * const ob) const
2431 if (ob == dialog_->input_roman)
2432 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ROMAN);
2433 if (ob == dialog_->input_sans)
2434 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SANS);
2435 if (ob == dialog_->input_typewriter)
2436 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_TYPEWRITER);
2437 if (ob == dialog_->check_scalable)
2438 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SCALABLE);
2439 if (ob == dialog_->input_screen_encoding)
2440 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ENCODING);
2441 if (ob == dialog_->counter_zoom)
2442 return LyXRC::getDescription(LyXRC::RC_SCREEN_ZOOM);
2443 if (ob == dialog_->counter_dpi)
2444 return LyXRC::getDescription(LyXRC::RC_SCREEN_DPI);
2445 if (ob == dialog_->input_tiny
2446 || ob == dialog_->input_script
2447 || ob == dialog_->input_footnote
2448 || ob == dialog_->input_small
2449 || ob == dialog_->input_large
2450 || ob == dialog_->input_larger
2451 || ob == dialog_->input_larger
2452 || ob == dialog_->input_largest
2453 || ob == dialog_->input_normal
2454 || ob == dialog_->input_huge
2455 || ob == dialog_->input_huger)
2456 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SIZES);
2461 bool FormPreferences::ScreenFonts::input()
2463 bool activate = true;
2466 // Make sure that all fonts all have positive entries
2467 // Also note that an empty entry is returned as 0.0 by strToDbl
2468 if (0.0 >= strToDbl(fl_get_input(dialog_->input_tiny))
2469 || 0.0 >= strToDbl(fl_get_input(dialog_->input_script))
2470 || 0.0 >= strToDbl(fl_get_input(dialog_->input_footnote))
2471 || 0.0 >= strToDbl(fl_get_input(dialog_->input_small))
2472 || 0.0 >= strToDbl(fl_get_input(dialog_->input_normal))
2473 || 0.0 >= strToDbl(fl_get_input(dialog_->input_large))
2474 || 0.0 >= strToDbl(fl_get_input(dialog_->input_larger))
2475 || 0.0 >= strToDbl(fl_get_input(dialog_->input_largest))
2476 || 0.0 >= strToDbl(fl_get_input(dialog_->input_huge))
2477 || 0.0 >= strToDbl(fl_get_input(dialog_->input_huger))) {
2479 str = _("Fonts must be positive!");
2481 } else if (strToDbl(fl_get_input(dialog_->input_tiny)) >
2482 // Fontsizes -- tiny < script < footnote etc.
2483 strToDbl(fl_get_input(dialog_->input_script)) ||
2484 strToDbl(fl_get_input(dialog_->input_script)) >
2485 strToDbl(fl_get_input(dialog_->input_footnote)) ||
2486 strToDbl(fl_get_input(dialog_->input_footnote)) >
2487 strToDbl(fl_get_input(dialog_->input_small)) ||
2488 strToDbl(fl_get_input(dialog_->input_small)) >
2489 strToDbl(fl_get_input(dialog_->input_normal)) ||
2490 strToDbl(fl_get_input(dialog_->input_normal)) >
2491 strToDbl(fl_get_input(dialog_->input_large)) ||
2492 strToDbl(fl_get_input(dialog_->input_large)) >
2493 strToDbl(fl_get_input(dialog_->input_larger)) ||
2494 strToDbl(fl_get_input(dialog_->input_larger)) >
2495 strToDbl(fl_get_input(dialog_->input_largest)) ||
2496 strToDbl(fl_get_input(dialog_->input_largest)) >
2497 strToDbl(fl_get_input(dialog_->input_huge)) ||
2498 strToDbl(fl_get_input(dialog_->input_huge)) >
2499 strToDbl(fl_get_input(dialog_->input_huger))) {
2502 str = _("Fonts must be input in the order Tiny > Smallest > Smaller > Small > Normal > Large > Larger > Largest > Huge > Huger.");
2506 parent_.postWarning(str);
2512 void FormPreferences::ScreenFonts::update(LyXRC const & rc)
2514 fl_set_input(dialog_->input_roman,
2515 makeFontName(rc.roman_font_name,
2516 rc.roman_font_foundry).c_str());
2517 fl_set_input(dialog_->input_sans,
2518 makeFontName(rc.sans_font_name,
2519 rc.sans_font_foundry).c_str());
2520 fl_set_input(dialog_->input_typewriter,
2521 makeFontName(rc.typewriter_font_name,
2522 rc.typewriter_font_foundry).c_str());
2523 fl_set_input(dialog_->input_screen_encoding,
2524 rc.font_norm.c_str());
2525 fl_set_button(dialog_->check_scalable,
2526 rc.use_scalable_fonts);
2527 fl_set_counter_value(dialog_->counter_zoom, rc.zoom);
2528 fl_set_counter_value(dialog_->counter_dpi, rc.dpi);
2529 fl_set_input(dialog_->input_tiny,
2530 tostr(rc.font_sizes[LyXFont::SIZE_TINY]).c_str());
2531 fl_set_input(dialog_->input_script,
2532 tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str());
2533 fl_set_input(dialog_->input_footnote,
2534 tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str());
2535 fl_set_input(dialog_->input_small,
2536 tostr(rc.font_sizes[LyXFont::SIZE_SMALL]).c_str());
2537 fl_set_input(dialog_->input_normal,
2538 tostr(rc.font_sizes[LyXFont::SIZE_NORMAL]).c_str());
2539 fl_set_input(dialog_->input_large,
2540 tostr(rc.font_sizes[LyXFont::SIZE_LARGE]).c_str());
2541 fl_set_input(dialog_->input_larger,
2542 tostr(rc.font_sizes[LyXFont::SIZE_LARGER]).c_str());
2543 fl_set_input(dialog_->input_largest,
2544 tostr(rc.font_sizes[LyXFont::SIZE_LARGEST]).c_str());
2545 fl_set_input(dialog_->input_huge,
2546 tostr(rc.font_sizes[LyXFont::SIZE_HUGE]).c_str());
2547 fl_set_input(dialog_->input_huger,
2548 tostr(rc.font_sizes[LyXFont::SIZE_HUGER]).c_str());
2553 FormPreferences::SpellOptions::SpellOptions(FormPreferences & p)
2558 FD_preferences_spelloptions const * FormPreferences::SpellOptions::dialog()
2560 return dialog_.get();
2564 void FormPreferences::SpellOptions::apply(LyXRC & rc)
2566 string choice = fl_get_choice_text(dialog_->choice_spell_command);
2567 choice = trim(choice);
2569 rc.isp_command = choice;
2572 // If spell checker == "none", all other input set to off.
2573 if (fl_get_choice(dialog_->choice_spell_command) == 1) {
2574 rc.isp_use_alt_lang = false;
2575 rc.isp_alt_lang.erase();
2577 rc.isp_use_esc_chars = false;
2578 rc.isp_esc_chars.erase();
2580 rc.isp_use_pers_dict = false;
2581 rc.isp_pers_dict.erase();
2583 rc.isp_accept_compound = false;
2584 rc.isp_use_input_encoding = false;
2587 int button = fl_get_button(dialog_->check_alt_lang);
2588 choice = fl_get_input(dialog_->input_alt_lang);
2589 if (button && choice.empty()) button = 0;
2590 if (!button) choice.erase();
2592 rc.isp_use_alt_lang = static_cast<bool>(button);
2593 rc.isp_alt_lang = choice;
2595 button = fl_get_button(dialog_->check_escape_chars);
2596 choice = fl_get_input(dialog_->input_escape_chars);
2597 if (button && choice.empty()) button = 0;
2598 if (!button) choice.erase();
2600 rc.isp_use_esc_chars = static_cast<bool>(button);
2601 rc.isp_esc_chars = choice;
2603 button = fl_get_button(dialog_->check_personal_dict);
2604 choice = fl_get_input(dialog_->input_personal_dict);
2605 if (button && choice.empty()) button = 0;
2606 if (!button) choice.erase();
2608 rc.isp_use_pers_dict = static_cast<bool>(button);
2609 rc.isp_pers_dict = choice;
2611 button = fl_get_button(dialog_->check_compound_words);
2612 rc.isp_accept_compound = static_cast<bool>(button);
2614 button = fl_get_button(dialog_->check_input_enc);
2615 rc.isp_use_input_encoding = static_cast<bool>(button);
2626 void FormPreferences::SpellOptions::build()
2628 dialog_.reset(build_preferences_spelloptions(&parent_));
2630 fl_addto_choice(dialog_->choice_spell_command,
2631 _(" ispell | aspell ").c_str());
2632 fl_set_input_return(dialog_->input_alt_lang, FL_RETURN_CHANGED);
2633 fl_set_input_return(dialog_->input_escape_chars, FL_RETURN_CHANGED);
2634 fl_set_input_return(dialog_->input_personal_dict, FL_RETURN_CHANGED);
2636 // set up the feedback mechanism
2637 setPrehandler(dialog_->choice_spell_command);
2638 setPrehandler(dialog_->check_alt_lang);
2639 setPrehandler(dialog_->input_alt_lang);
2640 setPrehandler(dialog_->check_escape_chars);
2641 setPrehandler(dialog_->input_escape_chars);
2642 setPrehandler(dialog_->check_personal_dict);
2643 setPrehandler(dialog_->input_personal_dict);
2644 setPrehandler(dialog_->button_personal_dict);
2645 setPrehandler(dialog_->check_compound_words);
2646 setPrehandler(dialog_->check_input_enc);
2651 FormPreferences::SpellOptions::feedback(FL_OBJECT const * const ob) const
2653 if (ob == dialog_->choice_spell_command)
2654 return LyXRC::getDescription(LyXRC::RC_SPELL_COMMAND);
2655 if (ob == dialog_->check_alt_lang)
2656 return LyXRC::getDescription(LyXRC::RC_USE_ALT_LANG);
2657 if (ob == dialog_->input_alt_lang)
2658 return LyXRC::getDescription(LyXRC::RC_ALT_LANG);
2659 if (ob == dialog_->check_escape_chars)
2660 return LyXRC::getDescription(LyXRC::RC_USE_ESC_CHARS);
2661 if (ob == dialog_->input_escape_chars)
2662 return LyXRC::getDescription(LyXRC::RC_ESC_CHARS);
2663 if (ob == dialog_->check_personal_dict)
2664 return LyXRC::getDescription(LyXRC::RC_USE_PERS_DICT);
2665 if (ob == dialog_->input_personal_dict)
2666 return LyXRC::getDescription(LyXRC::RC_PERS_DICT);
2667 if (ob == dialog_->check_compound_words)
2668 return LyXRC::getDescription(LyXRC::RC_ACCEPT_COMPOUND);
2669 if (ob == dialog_->check_input_enc)
2670 return LyXRC::getDescription(LyXRC::RC_USE_INP_ENC);
2675 bool FormPreferences::SpellOptions::input(FL_OBJECT const * const ob)
2677 // !ob if function is called from updateSpellOptions() to de/activate
2679 // otherwise the function is called by an xforms CB via input().
2682 // If spell checker == "none", disable all input.
2683 if (!ob || ob == dialog_->choice_spell_command) {
2684 if (fl_get_choice(dialog_->choice_spell_command) == 1) {
2685 fl_deactivate_object(dialog_->check_alt_lang);
2686 fl_deactivate_object(dialog_->input_alt_lang);
2687 fl_deactivate_object(dialog_->check_escape_chars);
2688 fl_deactivate_object(dialog_->input_escape_chars);
2689 fl_deactivate_object(dialog_->check_personal_dict);
2690 fl_deactivate_object(dialog_->input_personal_dict);
2691 fl_deactivate_object(dialog_->check_compound_words);
2692 fl_deactivate_object(dialog_->check_input_enc);
2695 fl_activate_object(dialog_->check_alt_lang);
2696 fl_activate_object(dialog_->check_escape_chars);
2697 fl_activate_object(dialog_->check_personal_dict);
2698 fl_activate_object(dialog_->check_compound_words);
2699 fl_activate_object(dialog_->check_input_enc);
2704 if (!ob || ob == dialog_->check_alt_lang) {
2705 bool const enable = fl_get_button(dialog_->check_alt_lang);
2706 setEnabled(dialog_->input_alt_lang, enable);
2709 if (!ob || ob == dialog_->check_escape_chars) {
2710 bool const enable = fl_get_button(dialog_->check_escape_chars);
2711 setEnabled(dialog_->input_escape_chars, enable);
2714 if (!ob || ob == dialog_->check_personal_dict) {
2715 bool const enable = fl_get_button(dialog_->check_personal_dict);
2716 setEnabled(dialog_->input_personal_dict, enable);
2719 if (ob == dialog_->button_personal_dict) {
2720 string f = parent_.controller().browsedict(
2721 fl_get_input(dialog_->input_personal_dict));
2722 fl_set_input(dialog_->input_personal_dict, f.c_str());
2725 return true; // All input is valid!
2729 void FormPreferences::SpellOptions::update(LyXRC const & rc)
2733 if (rc.isp_command == "none")
2735 else if (rc.isp_command == "ispell")
2737 else if (rc.isp_command == "aspell")
2740 if (rc.isp_command == "ispell")
2742 else if (rc.isp_command == "aspell")
2745 fl_set_choice(dialog_->choice_spell_command, choice);
2748 if (rc.isp_use_alt_lang)
2749 str = rc.isp_alt_lang;
2751 fl_set_button(dialog_->check_alt_lang,
2752 rc.isp_use_alt_lang);
2753 fl_set_input(dialog_->input_alt_lang, str.c_str());
2756 if (rc.isp_use_esc_chars)
2757 str = rc.isp_esc_chars;
2759 fl_set_button(dialog_->check_escape_chars,
2760 rc.isp_use_esc_chars);
2761 fl_set_input(dialog_->input_escape_chars, str.c_str());
2764 if (rc.isp_use_pers_dict)
2765 str = rc.isp_pers_dict;
2767 fl_set_button(dialog_->check_personal_dict,
2768 rc.isp_use_pers_dict);
2769 fl_set_input(dialog_->input_personal_dict, str.c_str());
2771 fl_set_button(dialog_->check_compound_words,
2772 rc.isp_accept_compound);
2773 fl_set_button(dialog_->check_input_enc,
2774 rc.isp_use_input_encoding);
2776 // Activate/Deactivate the input fields dependent on the state of the