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
25 #include "converter.h"
27 #include "frnt_lang.h"
30 #include "support/lstrings.h"
31 #include "support/tostr.h"
32 #include "support/path_defines.h"
33 #include "support/filetools.h"
35 #include "lyx_forms.h"
40 using lyx::support::AddName;
41 using lyx::support::ChangeExtension;
42 using lyx::support::rtrim;
43 using lyx::support::strToDbl;
44 using lyx::support::trim;
45 using lyx::support::user_lyxdir;
58 // These should probably go inside the class definition...
59 Formats local_formats;
60 Converters local_converters;
62 string makeFontName(string const & family, string const & foundry)
66 return family + ',' + foundry;
70 pair<string,string> parseFontName(string const & name)
72 string::size_type const idx = name.find(',');
73 if (idx == string::npos)
74 return make_pair(name, string());
75 return make_pair(name.substr(0, idx),
81 #if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
82 bool const scalableTabfolders = false;
84 bool const scalableTabfolders = true;
90 typedef FormCB<ControlPrefs, FormDB<FD_preferences> > base_class;
93 FormPreferences::FormPreferences()
94 : base_class(_("Preferences"), scalableTabfolders),
95 colors_(*this), converters_(*this), inputs_misc_(*this),
96 formats_(*this), interface_(*this), language_(*this),
97 lnf_misc_(*this), identity_(*this), outputs_misc_(*this),
98 paths_(*this), printer_(*this), screen_fonts_(*this),
104 void FormPreferences::redraw()
106 if (!(form() && form()->visible))
108 fl_redraw_form(form());
110 FL_FORM * form2 = fl_get_active_folder(dialog_->tabfolder_prefs);
111 if (!(form2 && form2->visible))
113 fl_redraw_form(form2);
116 if (form2 == converters_tab_->form)
117 form3 = fl_get_active_folder(converters_tab_->tabfolder_inner);
119 else if (form2 == look_n_feel_tab_->form)
120 form3 = fl_get_active_folder(look_n_feel_tab_->tabfolder_inner);
122 else if (form2 == inputs_tab_->form)
123 form3 = fl_get_active_folder(inputs_tab_->tabfolder_inner);
125 else if (form2 == outputs_tab_->form)
126 form3 = fl_get_active_folder(outputs_tab_->tabfolder_inner);
128 else if (form2 == lang_opts_tab_->form)
129 form3 = fl_get_active_folder(lang_opts_tab_->tabfolder_inner);
131 if (form3 && form3->visible)
132 fl_redraw_form(form3);
136 void FormPreferences::hide()
138 // We need to hide the active tabfolder otherwise we get a
139 // BadDrawable error from X window and LyX crashes without saving.
140 FL_FORM * inner_form = fl_get_active_folder(dialog_->tabfolder_prefs);
141 if (inner_form && inner_form->visible)
142 fl_hide_form(inner_form);
147 void FormPreferences::build()
149 dialog_.reset(build_preferences(this));
151 // Manage the restore, save, apply and cancel/close buttons
152 bcview().setOK(dialog_->button_ok);
153 bcview().setApply(dialog_->button_apply);
154 bcview().setCancel(dialog_->button_close);
155 bcview().setRestore(dialog_->button_restore);
157 // Allow the base class to control messages
158 setMessageWidget(dialog_->text_warning);
160 // build the tab folders
161 converters_tab_.reset(build_preferences_inner_tab(this));
162 look_n_feel_tab_.reset(build_preferences_inner_tab(this));
163 inputs_tab_.reset(build_preferences_inner_tab(this));
164 outputs_tab_.reset(build_preferences_inner_tab(this));
165 lang_opts_tab_.reset(build_preferences_inner_tab(this));
167 // build actual tabfolder contents
168 // these will become nested tabfolders
172 inputs_misc_.build();
177 outputs_misc_.build();
180 screen_fonts_.build();
181 spelloptions_.build();
183 // Enable the tabfolders to be rescaled correctly.
184 if (scalableTabfolders) {
185 FL_OBJECT * folder = dialog_->tabfolder_prefs;
186 fl_set_tabfolder_autofit(folder, FL_FIT);
188 folder = look_n_feel_tab_->tabfolder_inner;
189 fl_set_tabfolder_autofit(folder, FL_FIT);
191 folder = converters_tab_->tabfolder_inner;
192 fl_set_tabfolder_autofit(folder, FL_FIT);
194 folder = inputs_tab_->tabfolder_inner;
195 fl_set_tabfolder_autofit(folder, FL_FIT);
197 folder = outputs_tab_->tabfolder_inner;
198 fl_set_tabfolder_autofit(folder, FL_FIT);
200 folder = lang_opts_tab_->tabfolder_inner;
201 fl_set_tabfolder_autofit(folder, FL_FIT);
205 // Now add them to the tabfolder
206 fl_addto_tabfolder(dialog_->tabfolder_prefs,
207 _("Look & Feel").c_str(),
208 look_n_feel_tab_->form);
209 fl_addto_tabfolder(dialog_->tabfolder_prefs,
210 _("Lang Opts").c_str(),
211 lang_opts_tab_->form);
212 fl_addto_tabfolder(dialog_->tabfolder_prefs,
213 _("Conversion").c_str(),
214 converters_tab_->form);
215 fl_addto_tabfolder(dialog_->tabfolder_prefs,
218 fl_addto_tabfolder(dialog_->tabfolder_prefs,
219 _("Outputs").c_str(),
222 // now build the nested tabfolders
223 // Starting with look and feel
224 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
225 _("Screen Fonts").c_str(),
226 screen_fonts_.dialog()->form);
227 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
228 _("Interface").c_str(),
229 interface_.dialog()->form);
230 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
232 colors_.dialog()->form);
233 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
235 lnf_misc_.dialog()->form);
236 fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
237 _("Identity").c_str(),
238 identity_.dialog()->form);
240 // then build converters
241 fl_addto_tabfolder(converters_tab_->tabfolder_inner,
242 _("Formats").c_str(),
243 formats_.dialog()->form);
244 fl_addto_tabfolder(converters_tab_->tabfolder_inner,
245 _("Converters").c_str(),
246 converters_.dialog()->form);
249 // Paths should probably go in a few inner_tab called Files
250 fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
252 paths_.dialog()->form);
253 fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
255 inputs_misc_.dialog()->form);
257 // then building outputs
258 fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
259 _("Printer").c_str(),
260 printer_.dialog()->form);
261 fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
263 outputs_misc_.dialog()->form);
265 // then building usage
266 fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
267 _("Spell checker").c_str(),
268 spelloptions_.dialog()->form);
269 fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
270 _("Language").c_str(),
271 language_.dialog()->form);
275 void FormPreferences::apply()
277 // set the new lyxrc entries
278 // many of these need to trigger other functions when the assignment
279 // is made. For example, screen zoom and font types. These could be
280 // handled either by signals/slots in lyxrc or just directly call the
281 // associated functions here.
282 // There are other problems with this scheme. We really should check
283 // what we copy to make sure that it really is necessary to do things
284 // like update the screen fonts because that flushes the textcache
285 // and other stuff which may cost us a lot on slower/high-load
288 LyXRC & rc(controller().rc());
291 formats_.apply(); // Must be before converters_.apply()
293 inputs_misc_.apply(rc);
294 interface_.apply(rc);
298 outputs_misc_.apply(rc);
301 screen_fonts_.apply(rc);
302 spelloptions_.apply(rc);
304 // The "Save" button has been pressed.
305 if (controller().isClosing() && colors_.modifiedXformsPrefs) {
306 string const filename =
307 AddName(user_lyxdir(), "preferences.xform");
308 colors_.modifiedXformsPrefs = !XformsColor::write(filename);
313 string const FormPreferences::getFeedback(FL_OBJECT * ob)
317 if (ob->form->fdui == colors_.dialog())
318 return colors_.feedback(ob);
319 if (ob->form->fdui == converters_.dialog())
320 return converters_.feedback(ob);
321 if (ob->form->fdui == formats_.dialog())
322 return formats_.feedback(ob);
323 if (ob->form->fdui == inputs_misc_.dialog())
324 return inputs_misc_.feedback(ob);
325 if (ob->form->fdui == interface_.dialog())
326 return interface_.feedback(ob);
327 if (ob->form->fdui == language_.dialog())
328 return language_.feedback(ob);
329 if (ob->form->fdui == lnf_misc_.dialog())
330 return lnf_misc_.feedback(ob);
331 if (ob->form->fdui == outputs_misc_.dialog())
332 return outputs_misc_.feedback(ob);
333 if (ob->form->fdui == paths_.dialog())
334 return paths_.feedback(ob);
335 if (ob->form->fdui == printer_.dialog())
336 return printer_.feedback(ob);
337 if (ob->form->fdui == screen_fonts_.dialog())
338 return screen_fonts_.feedback(ob);
339 if (ob->form->fdui == spelloptions_.dialog())
340 return spelloptions_.feedback(ob);
346 ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long)
352 // whatever checks you need to ensure the user hasn't entered
353 // some totally ridiculous value somewhere. Change activate to suit.
354 // comments before each test describe what is _valid_
356 if (ob->form->fdui == colors_.dialog()) {
358 } else if (ob->form->fdui == converters_.dialog()) {
359 valid = converters_.input(ob);
360 } else if (ob->form->fdui == formats_.dialog()) {
361 valid = formats_.input(ob);
362 } else if (ob->form->fdui == interface_.dialog()) {
363 valid = interface_.input(ob);
364 } else if (ob->form->fdui == language_.dialog()) {
365 valid = language_.input(ob);
366 } else if (ob->form->fdui == paths_.dialog()) {
367 valid = paths_.input(ob);
368 } else if (ob->form->fdui == screen_fonts_.dialog()) {
369 valid = screen_fonts_.input();
370 } else if (ob->form->fdui == spelloptions_.dialog()) {
371 valid = spelloptions_.input(ob);
374 return valid ? ButtonPolicy::SMI_VALID : ButtonPolicy::SMI_INVALID;
378 void FormPreferences::update()
380 if (!dialog_.get()) return;
382 LyXRC const & rc(controller().rc());
384 // read lyxrc entries
386 formats_.update(); // Must be before converters_.update()
387 converters_.update();
388 inputs_misc_.update(rc);
389 interface_.update(rc);
390 language_.update(rc);
391 lnf_misc_.update(rc);
392 identity_.update(rc);
393 outputs_misc_.update(rc);
396 screen_fonts_.update(rc);
397 spelloptions_.update(rc);
401 FormPreferences::Colors::Colors(FormPreferences & p)
402 : modifiedXformsPrefs(false), parent_(p)
406 FD_preferences_colors const * FormPreferences::Colors::dialog()
408 return dialog_.get();
412 void FormPreferences::Colors::apply()
414 bool modifiedText = false;
415 bool modifiedBackground = false;
417 for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
418 cit != xformsColorDB.end(); ++cit) {
420 fl_getmcolor(cit->colorID, &col.r, &col.g, &col.b);
421 if (col != cit->color()) {
422 modifiedXformsPrefs = true;
423 if (cit->colorID == FL_BLACK)
425 if (cit->colorID == FL_COL1)
426 modifiedBackground = true;
430 if (modifiedXformsPrefs) {
431 for (vector<XformsColor>::const_iterator cit =
432 xformsColorDB.begin();
433 cit != xformsColorDB.end(); ++cit) {
434 fl_mapcolor(cit->colorID, cit->r, cit->g, cit->b);
436 if (modifiedText && cit->colorID == FL_BLACK) {
437 AdjustVal(FL_INACTIVE, FL_BLACK, 0.5);
440 if (modifiedBackground && cit->colorID == FL_COL1) {
441 AdjustVal(FL_MCOL, FL_COL1, 0.1);
442 AdjustVal(FL_TOP_BCOL, FL_COL1, 0.1);
443 AdjustVal(FL_LEFT_BCOL, FL_COL1, 0.1);
445 AdjustVal(FL_RIGHT_BCOL, FL_COL1, -0.5);
446 AdjustVal(FL_BOTTOM_BCOL, FL_COL1, -0.5);
449 if (cit->colorID == GUI_COLOR_CURSOR) {
450 fl_mapcolor(GUI_COLOR_CURSOR,
451 cit->r, cit->g, cit->b);
452 setCursorColor(GUI_COLOR_CURSOR);
455 parent_.controller().redrawGUI();
458 // Now do the same for the LyX LColors...
459 for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
460 cit != lyxColorDB.end(); ++cit) {
461 LColor::color lc = lcolor.getFromGUIName(cit->getname());
462 if (lc == LColor::inherit) continue;
464 // Create a valid X11 name of the form "#rrggbb"
465 string const hexname = X11hexname(cit->color());
467 if (lcolor.getX11Name(lc) != hexname) {
469 << "FormPreferences::Colors::apply: "
470 << "resetting LColor " << lcolor.getGUIName(lc)
471 << " from \"" << lcolor.getX11Name(lc)
472 << "\" to \"" << hexname << "\"."
475 parent_.controller().setColor(lc, hexname);
481 void FormPreferences::Colors::build()
483 picker_.reset(new FormColorpicker);
484 dialog_.reset(build_preferences_colors(&parent_));
486 fl_set_object_color(dialog_->button_color,
487 GUI_COLOR_CHOICE, GUI_COLOR_CHOICE);
489 // set up the feedback mechanism
490 setPrehandler(dialog_->browser_lyx_objs);
491 setPrehandler(dialog_->button_color);
492 setPrehandler(dialog_->button_modify);
497 FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
499 if (ob == dialog_->browser_lyx_objs)
500 return _("LyX objects that can be assigned a color.");
502 if (ob == dialog_->button_modify)
503 return _("Modify the LyX object's color. Note: you must then \"Apply\" the change.");
509 void FormPreferences::Colors::input(FL_OBJECT const * const ob)
511 if (ob == dialog_->browser_lyx_objs) {
514 } else if (ob == dialog_->button_modify) {
520 void FormPreferences::Colors::AdjustVal(int colAdjust, int colParent,
524 fl_getmcolor(colParent, &rgb.r, &rgb.g, &rgb.b);
528 hsv.v = min(1.0, max(0.0, hsv.v));
531 fl_mapcolor(colAdjust, rgb.r, rgb.g, rgb.b);
535 void FormPreferences::Colors::InputBrowserLyX() const
537 vector<NamedColor>::size_type const selLyX =
538 fl_get_browser(dialog_->browser_lyx_objs);
539 if (selLyX < 1) return;
541 // Is the choice an Xforms color...
544 if (selLyX - 1 < xformsColorDB.size()) {
545 vector<XformsColor>::size_type const i = selLyX - 1;
546 col = xformsColorDB[i].color();
548 // or a LyX Logical color?
550 vector<NamedColor>::size_type const i = selLyX - 1 -
551 xformsColorDB.size();
552 col = lyxColorDB[i].color();
555 fl_freeze_form(dialog_->form);
557 fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
558 fl_redraw_object(dialog_->button_color);
560 fl_unfreeze_form(dialog_->form);
564 void FormPreferences::Colors::LoadBrowserLyX()
566 if (!dialog_->browser_lyx_objs->visible)
569 // First, define the modifiable xforms colors
570 xformsColorDB.clear();
573 xcol.name = _("GUI background");
574 xcol.colorID = FL_COL1;
575 fl_getmcolor(FL_COL1, &xcol.r, &xcol.g, &xcol.b);
577 xformsColorDB.push_back(xcol);
579 xcol.name = _("GUI text");
580 xcol.colorID = FL_BLACK;
581 fl_getmcolor(FL_BLACK, &xcol.r, &xcol.g, &xcol.b);
583 xformsColorDB.push_back(xcol);
585 xcol.name = _("GUI selection");
586 xcol.colorID = FL_YELLOW;
587 fl_getmcolor(FL_YELLOW, &xcol.r, &xcol.g, &xcol.b);
589 xformsColorDB.push_back(xcol);
591 xcol.name = _("GUI pointer");
592 xcol.colorID = GUI_COLOR_CURSOR;
593 fl_getmcolor(GUI_COLOR_CURSOR, &xcol.r, &xcol.g, &xcol.b);
595 xformsColorDB.push_back(xcol);
597 // Now create the the LyX LColors database
599 for (int i=0; i<LColor::ignore; ++i) {
600 LColor::color lc = static_cast<LColor::color>(i);
601 if (lc == LColor::none
602 || lc == LColor::black
603 || lc == LColor::white
605 || lc == LColor::green
606 || lc == LColor::blue
607 || lc == LColor::cyan
608 || lc == LColor::magenta
609 || lc == LColor::yellow
610 || lc == LColor::inherit
611 || lc == LColor::ignore) continue;
614 bool const success = getRGBColor(lc, col.r, col.g, col.b);
616 lyxerr << "FormPreferences::Colors::LoadBrowserLyX:\n"
617 << "LColor " << lcolor.getLyXName(lc)
618 << ": X can't find color \""
619 << lcolor.getX11Name(lc)
620 << "\". Set to \"black\"!" << endl;
622 string const arg = lcolor.getLyXName(lc) + " black";
623 parent_.controller().setColor(lc, "black");
627 // Create a valid X11 name of the form "#rrggbb" and change the
628 // LColor X11name to this. Don't want to trigger a redraw,
629 // as we're just changing the name not the RGB values.
630 // Also reset the system_lcolor names, so that we don't output
631 // unnecessary changes.
632 string const hexname = X11hexname(col);
634 if (lcolor.getX11Name(lc) != hexname) {
635 lcolor.setColor(lc, hexname);
636 system_lcolor.setColor(lc, hexname);
639 // Finally, push the color onto the database
640 NamedColor ncol(lcolor.getGUIName(lc), col);
641 lyxColorDB.push_back(ncol);
644 // Now construct the browser
645 FL_OBJECT * colbr = dialog_->browser_lyx_objs;
646 fl_freeze_form(dialog_->form);
647 fl_clear_browser(colbr);
648 for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
649 cit != xformsColorDB.end(); ++cit) {
650 fl_addto_browser(colbr, cit->getname().c_str());
652 for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
653 cit != lyxColorDB.end(); ++cit) {
654 fl_addto_browser(colbr, cit->getname().c_str());
657 // just to be safe...
658 fl_set_browser_topline(dialog_->browser_lyx_objs, 1);
659 fl_select_browser_line(dialog_->browser_lyx_objs, 1);
660 fl_unfreeze_form(dialog_->form);
666 void FormPreferences::Colors::Modify()
668 vector<NamedColor>::size_type const selLyX =
669 fl_get_browser(dialog_->browser_lyx_objs);
674 fl_getmcolor(GUI_COLOR_CHOICE, &before.r, &before.g, &before.b);
676 RGBColor col = picker_->requestColor(before);
680 fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
681 fl_redraw_object(dialog_->button_color);
683 // Is the choice an Xforms color...
684 if (selLyX - 1 < xformsColorDB.size()) {
685 vector<XformsColor>::size_type const i = selLyX - 1;
686 xformsColorDB[i].r = col.r;
687 xformsColorDB[i].g = col.g;
688 xformsColorDB[i].b = col.b;
690 // or a LyX Logical color?
692 vector<NamedColor>::size_type const i = selLyX - 1 -
693 xformsColorDB.size();
694 lyxColorDB[i].r = col.r;
695 lyxColorDB[i].g = col.g;
696 lyxColorDB[i].b = col.b;
701 FormPreferences::Converters::Converters(FormPreferences & p)
706 FD_preferences_converters const * FormPreferences::Converters::dialog()
708 return dialog_.get();
712 void FormPreferences::Converters::apply() const
714 parent_.controller().setConverters(local_converters);
718 void FormPreferences::Converters::build()
720 dialog_.reset(build_preferences_converters(&parent_));
722 fl_set_input_return(dialog_->input_converter, FL_RETURN_CHANGED);
723 fl_set_input_return(dialog_->input_flags, FL_RETURN_CHANGED);
725 // set up the feedback mechanism
726 setPrehandler(dialog_->browser_all);
727 setPrehandler(dialog_->button_delete);
728 setPrehandler(dialog_->button_add);
729 setPrehandler(dialog_->input_converter);
730 setPrehandler(dialog_->choice_from);
731 setPrehandler(dialog_->choice_to);
732 setPrehandler(dialog_->input_flags);
737 FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const
739 if (ob == dialog_->browser_all)
740 return _("All explicitly defined converters for LyX");
742 if (ob == dialog_->choice_from)
743 return _("Convert \"from\" this format");
745 if (ob == dialog_->choice_to)
746 return _("Convert \"to\" this format");
748 if (ob == dialog_->input_converter)
749 return _("The conversion command. $$i is the input file name, "
750 "$$b is the file name without its extension and $$o is "
751 "the name of the output file. $$s can be used as path to "
752 "LyX's own collection of conversion scripts.");
754 if (ob == dialog_->input_flags)
755 return _("Extra information for the Converter class, whether and "
756 "how to parse the result, and various other things.");
758 if (ob == dialog_->button_delete)
759 return _("Remove the current converter from the list of available "
760 "converters. Note: you must then \"Apply\" the change.");
762 if (ob == dialog_->button_add) {
763 if (string(ob->label) == _("Add"))
764 return _("Add the current converter to the list of available "
765 "converters. Note: you must then \"Apply\" the change.");
767 return _("Modify the contents of the current converter. "
768 "Note: you must then \"Apply\" the change.");
775 bool FormPreferences::Converters::input(FL_OBJECT const * const ob)
777 if (ob == dialog_->browser_all)
780 if (ob == dialog_->choice_from
781 || ob == dialog_->choice_to
782 || ob == dialog_->input_converter
783 || ob == dialog_->input_flags)
786 if (ob == dialog_->button_add)
789 if (ob == dialog_->button_delete)
796 void FormPreferences::Converters::update()
798 local_converters = converters;
799 local_converters.update(local_formats);
804 void FormPreferences::Converters::UpdateBrowser()
806 local_converters.sort();
808 fl_freeze_form(dialog_->form);
809 fl_clear_browser(dialog_->browser_all);
810 for (::Converters::const_iterator cit = local_converters.begin();
811 cit != local_converters.end(); ++cit) {
812 string const name = cit->From->prettyname() + " -> "
813 + cit->To->prettyname();
814 fl_addto_browser(dialog_->browser_all, name.c_str());
817 fl_unfreeze_form(dialog_->form);
821 bool FormPreferences::Converters::Add()
823 string const from = GetFrom();
824 string const to = GetTo();
825 string const command = fl_get_input(dialog_->input_converter);
826 string const flags = fl_get_input(dialog_->input_flags);
828 Converter const * old = local_converters.getConverter(from, to);
829 local_converters.add(from, to, command, flags);
831 local_converters.updateLast(local_formats);
834 setEnabled(dialog_->button_add, false);
840 bool FormPreferences::Converters::Browser()
842 int const i = fl_get_browser(dialog_->browser_all);
843 if (i <= 0) return false;
845 fl_freeze_form(dialog_->form);
847 Converter const & c = local_converters.get(i - 1);
848 int j = local_formats.getNumber(c.from);
850 fl_set_choice(dialog_->choice_from, j + 1);
852 j = local_formats.getNumber(c.to);
854 fl_set_choice(dialog_->choice_to, j + 1);
856 fl_set_input(dialog_->input_converter, c.command.c_str());
857 fl_set_input(dialog_->input_flags, c.flags.c_str());
859 fl_set_object_label(dialog_->button_add, idex(_("Modify|#M")).c_str());
860 fl_set_button_shortcut(dialog_->button_add,
861 scex(_("Modify|#M")).c_str(), 1);
863 setEnabled(dialog_->button_add, false);
864 setEnabled(dialog_->button_delete, true);
866 fl_unfreeze_form(dialog_->form);
871 bool FormPreferences::Converters::erase()
873 string const from = GetFrom();
874 string const to = GetTo();
876 local_converters.erase(from, to);
882 bool FormPreferences::Converters::Input()
884 string const from = GetFrom();
885 string const to = GetTo();
886 int const sel = local_converters.getNumber(from, to);
888 fl_freeze_form(dialog_->form);
891 fl_set_object_label(dialog_->button_add,
892 idex(_("Add|#A")).c_str());
893 fl_set_button_shortcut(dialog_->button_add,
894 scex(_("Add|#A")).c_str(), 1);
896 fl_deselect_browser(dialog_->browser_all);
897 setEnabled(dialog_->button_delete, false);
900 fl_set_object_label(dialog_->button_add,
901 idex(_("Modify|#M")).c_str());
902 fl_set_button_shortcut(dialog_->button_add,
903 scex(_("Modify|#M")).c_str(), 1);
905 int top = max(sel-5, 0);
906 fl_set_browser_topline(dialog_->browser_all, top);
907 fl_select_browser_line(dialog_->browser_all, sel+1);
908 setEnabled(dialog_->button_delete, true);
911 string const command = rtrim(fl_get_input(dialog_->input_converter));
912 bool const enable = !(command.empty() || from == to);
913 setEnabled(dialog_->button_add, enable);
915 fl_unfreeze_form(dialog_->form);
920 string const FormPreferences::Converters::GetFrom() const
922 ::Formats::FormatList::size_type const i =
923 fl_get_choice(dialog_->choice_from);
925 if (i > 0 && i <= local_formats.size())
926 return local_formats.get(i - 1).name();
928 lyxerr << "FormPreferences::Converters::GetFrom: No choice!" << endl;
933 string const FormPreferences::Converters::GetTo() const
935 ::Formats::FormatList::size_type const i =
936 fl_get_choice(dialog_->choice_to);
938 if (i > 0 && i <= local_formats.size())
939 return local_formats.get(i - 1).name();
941 lyxerr << "FormPreferences::Converters::GetTo: No choice!" << endl;
946 void FormPreferences::Converters::UpdateChoices() const
949 for (::Formats::const_iterator cit = local_formats.begin();
950 cit != local_formats.end(); ++cit) {
955 choice += cit->prettyname();
959 fl_clear_choice(dialog_->choice_from);
960 fl_addto_choice(dialog_->choice_from, choice.c_str());
962 fl_clear_choice(dialog_->choice_to);
963 fl_addto_choice(dialog_->choice_to, choice.c_str());
967 FormPreferences::Formats::Formats(FormPreferences & p)
972 FD_preferences_formats const * FormPreferences::Formats::dialog()
974 return dialog_.get();
978 void FormPreferences::Formats::apply() const
980 parent_.controller().setFormats(local_formats);
984 void FormPreferences::Formats::build()
986 dialog_.reset(build_preferences_formats(&parent_));
988 fl_set_input_return(dialog_->input_format, FL_RETURN_CHANGED);
989 fl_set_input_return(dialog_->input_viewer, FL_RETURN_CHANGED);
990 fl_set_input_return(dialog_->input_shrtcut, FL_RETURN_CHANGED);
991 fl_set_input_return(dialog_->input_gui_name, FL_RETURN_CHANGED);
992 fl_set_input_return(dialog_->input_extension, FL_RETURN_CHANGED);
994 fl_set_input_filter(dialog_->input_format, fl_lowercase_filter);
996 // set up the feedback mechanism
997 setPrehandler(dialog_->browser_all);
998 setPrehandler(dialog_->input_format);
999 setPrehandler(dialog_->input_gui_name);
1000 setPrehandler(dialog_->button_delete);
1001 setPrehandler(dialog_->button_add);
1002 setPrehandler(dialog_->input_extension);
1003 setPrehandler(dialog_->input_viewer);
1004 setPrehandler(dialog_->input_shrtcut);
1009 FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
1011 if (ob == dialog_->browser_all)
1012 return _("All the currently defined formats known to LyX.");
1014 if (ob == dialog_->input_format)
1015 return _("The format identifier.");
1017 if (ob == dialog_->input_gui_name)
1018 return _("The format name as it will appear in the menus.");
1020 if (ob == dialog_->input_shrtcut)
1021 return _("The keyboard accelerator. Use a letter in the GUI name. "
1024 if (ob == dialog_->input_extension)
1025 return _("Used to recognize the file. E.g., ps, pdf, tex.");
1027 if (ob == dialog_->input_viewer)
1028 return _("The command used to launch the viewer application.");
1030 if (ob == dialog_->button_delete)
1031 return _("Remove the current format from the list of available "
1032 "formats. Note: you must then \"Apply\" the change.");
1034 if (ob == dialog_->button_add) {
1035 if (string(ob->label) == _("Add"))
1036 return _("Add the current format to the list of available "
1037 "formats. Note: you must then \"Apply\" the change.");
1039 return _("Modify the contents of the current format. Note: "
1040 "you must then \"Apply\" the change.");
1047 bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
1049 if (ob == dialog_->browser_all)
1052 if (ob == dialog_->input_format
1053 || ob == dialog_->input_gui_name
1054 || ob == dialog_->input_shrtcut
1055 || ob == dialog_->input_extension
1056 || ob == dialog_->input_viewer)
1059 if (ob == dialog_->button_add)
1062 if (ob == dialog_->button_delete)
1069 void FormPreferences::Formats::update()
1071 local_formats = formats;
1076 void FormPreferences::Formats::UpdateBrowser()
1078 local_formats.sort();
1080 fl_freeze_form(dialog_->form);
1081 fl_deselect_browser(dialog_->browser_all);
1082 fl_clear_browser(dialog_->browser_all);
1083 for (::Formats::const_iterator cit = local_formats.begin();
1084 cit != local_formats.end(); ++cit)
1085 fl_addto_browser(dialog_->browser_all,
1086 cit->prettyname().c_str());
1089 fl_unfreeze_form(dialog_->form);
1091 // Mustn't forget to update the Formats available to the converters_
1092 parent_.converters_.UpdateChoices();
1093 local_converters.update(local_formats);
1097 bool FormPreferences::Formats::Add()
1099 string const name = fl_get_input(dialog_->input_format);
1100 string const prettyname = fl_get_input(dialog_->input_gui_name);
1101 string const extension = fl_get_input(dialog_->input_extension);
1102 string const shortcut = fl_get_input(dialog_->input_shrtcut);
1103 string const viewer = fl_get_input(dialog_->input_viewer);
1105 Format const * old = local_formats.getFormat(name);
1106 string const old_prettyname = old ? old->prettyname() : string();
1107 local_formats.add(name, extension, prettyname, shortcut);
1108 local_formats.setViewer(name, viewer);
1109 if (!old || prettyname != old_prettyname) {
1112 parent_.converters_.UpdateBrowser();
1114 setEnabled(dialog_->button_add, false);
1120 bool FormPreferences::Formats::Browser()
1122 int const i = fl_get_browser(dialog_->browser_all);
1126 fl_freeze_form(dialog_->form);
1128 Format const & f = local_formats.get(i - 1);
1130 fl_set_input(dialog_->input_format, f.name().c_str());
1131 fl_set_input(dialog_->input_gui_name, f.prettyname().c_str());
1132 fl_set_input(dialog_->input_shrtcut, f.shortcut().c_str());
1133 fl_set_input(dialog_->input_extension, f.extension().c_str());
1134 fl_set_input(dialog_->input_viewer, f.viewer().c_str());
1136 fl_set_object_label(dialog_->button_add,
1137 idex(_("Modify|#M")).c_str());
1138 fl_set_button_shortcut(dialog_->button_add,
1139 scex(_("Modify|#M")).c_str(), 1);
1141 setEnabled(dialog_->button_add, false);
1142 setEnabled(dialog_->button_delete, true);
1144 fl_unfreeze_form(dialog_->form);
1149 bool FormPreferences::Formats::erase()
1151 string const name = fl_get_input(dialog_->input_format);
1153 if (local_converters.formatIsUsed(name)) {
1154 parent_.postWarning(_("Cannot remove a Format used by a Converter. "
1155 "Remove the converter first."));
1156 setEnabled(dialog_->button_delete, false);
1160 local_formats.erase(name);
1166 bool FormPreferences::Formats::Input()
1168 string const name = fl_get_input(dialog_->input_format);
1169 int const sel = local_formats.getNumber(name);
1170 fl_freeze_form(dialog_->form);
1173 fl_set_object_label(dialog_->button_add,
1174 idex(_("Add|#A")).c_str());
1175 fl_set_button_shortcut(dialog_->button_add,
1176 scex(_("Add|#A")).c_str(), 1);
1178 fl_deselect_browser(dialog_->browser_all);
1179 setEnabled(dialog_->button_delete, false);
1182 fl_set_object_label(dialog_->button_add,
1183 idex(_("Modify|#M")).c_str());
1184 fl_set_button_shortcut(dialog_->button_add,
1185 scex(_("Modify|#M")).c_str(), 1);
1187 int const top = max(sel-5, 0);
1188 fl_set_browser_topline(dialog_->browser_all, top);
1189 fl_select_browser_line(dialog_->browser_all, sel+1);
1191 setEnabled(dialog_->button_add, true);
1192 setEnabled(dialog_->button_delete, true);
1195 string const prettyname = fl_get_input(dialog_->input_gui_name);
1196 bool const enable = !(name.empty() || prettyname.empty());
1197 setEnabled(dialog_->button_add, enable);
1199 fl_unfreeze_form(dialog_->form);
1204 FormPreferences::Identity::Identity(FormPreferences & p)
1209 FD_preferences_identity const * FormPreferences::Identity::dialog()
1211 return dialog_.get();
1215 void FormPreferences::Identity::apply(LyXRC & rc) const
1217 rc.user_name = fl_get_input(dialog_->input_user_name);
1218 rc.user_email = fl_get_input(dialog_->input_user_email);
1222 void FormPreferences::Identity::build()
1224 dialog_.reset(build_preferences_identity(&parent_));
1225 fl_set_input_return(dialog_->input_user_name, FL_RETURN_CHANGED);
1226 fl_set_input_return(dialog_->input_user_email, FL_RETURN_CHANGED);
1230 void FormPreferences::Identity::update(LyXRC const & rc)
1232 fl_set_input(dialog_->input_user_name, rc.user_name.c_str());
1233 fl_set_input(dialog_->input_user_email, rc.user_email.c_str());
1237 FormPreferences::InputsMisc::InputsMisc(FormPreferences & p)
1242 FD_preferences_inputs_misc const * FormPreferences::InputsMisc::dialog()
1244 return dialog_.get();
1248 void FormPreferences::InputsMisc::apply(LyXRC & rc) const
1250 rc.date_insert_format =
1251 fl_get_input(dialog_->input_date_format);
1255 void FormPreferences::InputsMisc::build()
1257 dialog_.reset(build_preferences_inputs_misc(&parent_));
1259 fl_set_input_return(dialog_->input_date_format, FL_RETURN_CHANGED);
1261 // set up the feedback mechanism
1262 setPrehandler(dialog_->input_date_format);
1267 FormPreferences::InputsMisc::feedback(FL_OBJECT const * const ob) const
1269 if (ob == dialog_->input_date_format)
1270 return LyXRC::getDescription(LyXRC::RC_DATE_INSERT_FORMAT);
1275 void FormPreferences::InputsMisc::update(LyXRC const & rc)
1277 fl_set_input(dialog_->input_date_format,
1278 rc.date_insert_format.c_str());
1282 FormPreferences::Interface::Interface(FormPreferences & p)
1287 FD_preferences_interface const * FormPreferences::Interface::dialog()
1289 return dialog_.get();
1293 void FormPreferences::Interface::apply(LyXRC & rc) const
1295 rc.popup_normal_font =
1296 fl_get_input(dialog_->input_popup_normal_font);
1297 rc.popup_bold_font = fl_get_input(dialog_->input_popup_bold_font);
1298 rc.popup_font_encoding =
1299 fl_get_input(dialog_->input_popup_font_encoding);
1300 rc.bind_file = fl_get_input(dialog_->input_bind_file);
1301 rc.ui_file = fl_get_input(dialog_->input_ui_file);
1305 void FormPreferences::Interface::build()
1307 dialog_.reset(build_preferences_interface(&parent_));
1309 fl_set_input_return(dialog_->input_popup_normal_font, FL_RETURN_CHANGED);
1310 fl_set_input_return(dialog_->input_popup_bold_font, FL_RETURN_CHANGED);
1311 fl_set_input_return(dialog_->input_popup_font_encoding, FL_RETURN_CHANGED);
1312 fl_set_input_return(dialog_->input_bind_file, FL_RETURN_CHANGED);
1313 fl_set_input_return(dialog_->input_ui_file, FL_RETURN_CHANGED);
1315 // set up the feedback mechanism
1316 setPrehandler(dialog_->input_popup_normal_font);
1317 setPrehandler(dialog_->input_popup_bold_font);
1318 setPrehandler(dialog_->input_popup_font_encoding);
1319 setPrehandler(dialog_->input_bind_file);
1320 setPrehandler(dialog_->button_bind_file_browse);
1321 setPrehandler(dialog_->input_ui_file);
1322 setPrehandler(dialog_->button_ui_file_browse);
1327 FormPreferences::Interface::feedback(FL_OBJECT const * const ob) const
1329 if (ob == dialog_->input_popup_normal_font)
1330 return LyXRC::getDescription(LyXRC::RC_POPUP_NORMAL_FONT);
1331 if (ob == dialog_->input_popup_bold_font)
1332 return LyXRC::getDescription(LyXRC::RC_POPUP_BOLD_FONT);
1333 if (ob == dialog_->input_popup_font_encoding)
1334 return LyXRC::getDescription(LyXRC::RC_POPUP_FONT_ENCODING);
1335 if (ob == dialog_->input_bind_file)
1336 return LyXRC::getDescription(LyXRC::RC_BINDFILE);
1337 if (ob == dialog_->input_ui_file)
1338 return LyXRC::getDescription(LyXRC::RC_UIFILE);
1343 bool FormPreferences::Interface::input(FL_OBJECT const * const ob)
1345 if (ob == dialog_->button_bind_file_browse) {
1346 string f = parent_.controller().browsebind(
1347 fl_get_input(dialog_->input_bind_file));
1349 fl_set_input(dialog_->input_bind_file, f.c_str());
1350 } else if (ob == dialog_->button_ui_file_browse) {
1351 string f = parent_.controller().browseUI(
1352 fl_get_input(dialog_->input_ui_file));
1354 fl_set_input(dialog_->input_ui_file, f.c_str());
1361 void FormPreferences::Interface::update(LyXRC const & rc)
1363 fl_set_input(dialog_->input_popup_normal_font,
1364 rc.popup_normal_font.c_str());
1365 fl_set_input(dialog_->input_popup_bold_font,
1366 rc.popup_bold_font.c_str());
1367 fl_set_input(dialog_->input_popup_font_encoding,
1368 rc.popup_font_encoding.c_str());
1369 fl_set_input(dialog_->input_bind_file,
1370 rc.bind_file.c_str());
1371 fl_set_input(dialog_->input_ui_file,
1372 rc.ui_file.c_str());
1376 FormPreferences::Language::Language(FormPreferences & p)
1381 FD_preferences_language const * FormPreferences::Language::dialog()
1383 return dialog_.get();
1387 void FormPreferences::Language::apply(LyXRC & rc)
1389 int const pos = fl_get_combox(dialog_->combox_default_lang);
1390 rc.default_language = lang_[pos-1];
1392 int button = fl_get_button(dialog_->check_use_kbmap);
1393 string const name_1 = fl_get_input(dialog_->input_kbmap1);
1394 string const name_2 = fl_get_input(dialog_->input_kbmap2);
1396 button = !(name_1.empty() && name_2.empty());
1397 rc.use_kbmap = static_cast<bool>(button);
1400 rc.primary_kbmap = name_1;
1401 rc.secondary_kbmap = name_2;
1404 button = fl_get_button(dialog_->check_rtl_support);
1405 rc.rtl_support = static_cast<bool>(button);
1407 button = fl_get_button(dialog_->check_mark_foreign);
1408 rc.mark_foreign_language = static_cast<bool>(button);
1410 button = fl_get_button(dialog_->check_auto_begin);
1411 rc.language_auto_begin = static_cast<bool>(button);
1413 button = fl_get_button(dialog_->check_auto_end);
1414 rc.language_auto_end = static_cast<bool>(button);
1416 button = fl_get_button(dialog_->check_use_babel);
1417 rc.language_use_babel = static_cast<bool>(button);
1419 button = fl_get_button(dialog_->check_global_options);
1420 rc.language_global_options = static_cast<bool>(button);
1422 rc.language_package = fl_get_input(dialog_->input_package);
1423 rc.language_command_begin = fl_get_input(dialog_->input_command_begin);
1424 rc.language_command_end = fl_get_input(dialog_->input_command_end);
1426 // Ensure that all is self-consistent.
1431 void FormPreferences::Language::build()
1433 dialog_.reset(build_preferences_language(&parent_));
1435 fl_set_input_return(dialog_->input_package, FL_RETURN_CHANGED);
1436 fl_set_input_return(dialog_->input_command_begin, FL_RETURN_CHANGED);
1437 fl_set_input_return(dialog_->input_command_end, FL_RETURN_CHANGED);
1439 // Store the lang identifiers for later
1440 vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
1441 lang_ = getSecond(langs);
1443 FL_OBJECT * obj = dialog_->combox_default_lang;
1444 vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
1445 vector<frnt::LanguagePair>::const_iterator lend = langs.end();
1446 for (; lit != lend; ++lit) {
1447 fl_addto_combox(obj, lit->first.c_str());
1449 fl_set_combox_browser_height(obj, 400);
1451 // set up the feedback mechanism
1452 setPrehandler(dialog_->input_package);
1453 setPrehandler(dialog_->check_use_kbmap);
1454 setPrehandler(dialog_->combox_default_lang);
1455 setPrehandler(dialog_->input_kbmap1);
1456 setPrehandler(dialog_->input_kbmap2);
1457 setPrehandler(dialog_->check_rtl_support);
1458 setPrehandler(dialog_->check_mark_foreign);
1459 setPrehandler(dialog_->check_auto_begin);
1460 setPrehandler(dialog_->check_auto_end);
1461 setPrehandler(dialog_->check_use_babel);
1462 setPrehandler(dialog_->check_global_options);
1463 setPrehandler(dialog_->input_command_begin);
1464 setPrehandler(dialog_->input_command_end);
1466 // Activate/Deactivate the input fields dependent on the state of the
1473 FormPreferences::Language::feedback(FL_OBJECT const * const ob) const
1475 if (ob == dialog_->combox_default_lang)
1476 return LyXRC::getDescription(LyXRC::RC_DEFAULT_LANGUAGE);
1477 if (ob == dialog_->check_use_kbmap)
1478 return LyXRC::getDescription(LyXRC::RC_KBMAP);
1479 if (ob == dialog_->input_kbmap1)
1480 return LyXRC::getDescription(LyXRC::RC_KBMAP_PRIMARY);
1481 if (ob == dialog_->input_kbmap2)
1482 return LyXRC::getDescription(LyXRC::RC_KBMAP_SECONDARY);
1483 if (ob == dialog_->check_rtl_support)
1484 return LyXRC::getDescription(LyXRC::RC_RTL_SUPPORT);
1485 if (ob == dialog_->check_mark_foreign)
1486 return LyXRC::getDescription(LyXRC::RC_MARK_FOREIGN_LANGUAGE);
1487 if (ob == dialog_->check_auto_begin)
1488 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_BEGIN);
1489 if (ob == dialog_->check_auto_end)
1490 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_END);
1491 if (ob == dialog_->check_use_babel)
1492 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_USE_BABEL);
1493 if (ob == dialog_->check_global_options)
1494 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS);
1495 if (ob == dialog_->input_package)
1496 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_PACKAGE);
1497 if (ob == dialog_->input_command_begin)
1498 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_BEGIN);
1499 if (ob == dialog_->input_command_end)
1500 return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_END);
1505 bool FormPreferences::Language::input(FL_OBJECT const * const ob)
1507 bool activate = true;
1509 // !ob if function is called from Language::build() to de/activate
1511 // otherwise the function is called by an xforms CB via input().
1512 if (!ob || ob == dialog_->check_use_kbmap) {
1513 bool const enable = fl_get_button(dialog_->check_use_kbmap);
1514 setEnabled(dialog_->button_kbmap1_browse, enable);
1515 setEnabled(dialog_->button_kbmap2_browse, enable);
1516 setEnabled(dialog_->input_kbmap1, enable);
1517 setEnabled(dialog_->input_kbmap2, enable);
1520 if (ob == dialog_->button_kbmap1_browse) {
1521 string f = parent_.controller().browsekbmap(
1522 fl_get_input(dialog_->input_kbmap1));
1524 fl_set_input(dialog_->input_kbmap1, f.c_str());
1525 } else if (ob == dialog_->button_kbmap2_browse) {
1526 string f = parent_.controller().browsekbmap(
1527 fl_get_input(dialog_->input_kbmap2));
1529 fl_set_input(dialog_->input_kbmap2, f.c_str());
1536 void FormPreferences::Language::update(LyXRC const & rc)
1538 fl_set_button(dialog_->check_use_kbmap,
1541 int const pos = int(findPos(lang_, rc.default_language));
1542 fl_set_combox(dialog_->combox_default_lang, pos + 1);
1545 fl_set_input(dialog_->input_kbmap1,
1546 rc.primary_kbmap.c_str());
1547 fl_set_input(dialog_->input_kbmap2,
1548 rc.secondary_kbmap.c_str());
1550 fl_set_input(dialog_->input_kbmap1, "");
1551 fl_set_input(dialog_->input_kbmap2, "");
1554 fl_set_button(dialog_->check_rtl_support, rc.rtl_support);
1555 fl_set_button(dialog_->check_mark_foreign,
1556 rc.mark_foreign_language);
1557 fl_set_button(dialog_->check_auto_begin, rc.language_auto_begin);
1558 fl_set_button(dialog_->check_auto_end, rc.language_auto_end);
1559 fl_set_button(dialog_->check_use_babel, rc.language_use_babel);
1560 fl_set_button(dialog_->check_global_options,
1561 rc.language_global_options);
1563 fl_set_input(dialog_->input_package,
1564 rc.language_package.c_str());
1565 fl_set_input(dialog_->input_command_begin,
1566 rc.language_command_begin.c_str());
1567 fl_set_input(dialog_->input_command_end,
1568 rc.language_command_end.c_str());
1570 // Activate/Deactivate the input fields dependent on the state of the
1576 FormPreferences::LnFmisc::LnFmisc(FormPreferences & p)
1581 FD_preferences_lnf_misc const * FormPreferences::LnFmisc::dialog()
1583 return dialog_.get();
1587 void FormPreferences::LnFmisc::apply(LyXRC & rc) const
1589 rc.auto_region_delete =
1590 fl_get_button(dialog_->check_auto_region_delete);
1591 rc.cursor_follows_scrollbar =
1592 fl_get_button(dialog_->check_cursor_follows_scrollbar);
1593 rc.dialogs_iconify_with_main =
1594 fl_get_button(dialog_->check_dialogs_iconify_with_main);
1595 rc.preview = fl_get_button(dialog_->check_preview_latex);
1596 rc.autosave = static_cast<unsigned int>
1597 (fl_get_counter_value(dialog_->counter_autosave));
1598 rc.wheel_jump = static_cast<unsigned int>
1599 (fl_get_counter_value(dialog_->counter_wm_jump));
1602 // lyx::graphics::DisplayType old_value = rc.display_graphics;
1603 switch (fl_get_choice(dialog_->choice_display)) {
1605 rc.display_graphics = lyx::graphics::NoDisplay;
1608 rc.display_graphics = lyx::graphics::ColorDisplay;
1611 rc.display_graphics = lyx::graphics::GrayscaleDisplay;
1614 rc.display_graphics = lyx::graphics::MonochromeDisplay;
1617 rc.display_graphics = lyx::graphics::ColorDisplay;
1621 #ifdef WITH_WARNINGS
1622 #warning FIXME!! The graphics cache no longer has a changeDisplay method.
1625 if (old_value != rc.display_graphics) {
1626 lyx::graphics::GCache & gc = lyx::graphics::GCache::get();
1633 void FormPreferences::LnFmisc::build()
1635 dialog_.reset(build_preferences_lnf_misc(&parent_));
1637 fl_set_counter_step(dialog_->counter_autosave, 1, 10);
1638 fl_set_counter_step(dialog_->counter_wm_jump, 1, 10);
1640 fl_set_counter_return(dialog_->counter_autosave, FL_RETURN_CHANGED);
1641 fl_set_counter_return(dialog_->counter_wm_jump, FL_RETURN_CHANGED);
1643 // set up the feedback mechanism
1644 setPrehandler(dialog_->check_auto_region_delete);
1645 setPrehandler(dialog_->counter_autosave);
1646 setPrehandler(dialog_->check_cursor_follows_scrollbar);
1647 setPrehandler(dialog_->check_dialogs_iconify_with_main);
1648 setPrehandler(dialog_->check_preview_latex);
1649 setPrehandler(dialog_->counter_wm_jump);
1651 fl_addto_choice(dialog_->choice_display,
1652 _("Monochrome|Grayscale|Color|Do not display").c_str());
1657 FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const
1659 if (ob == dialog_->check_auto_region_delete)
1660 return LyXRC::getDescription(LyXRC::RC_AUTOREGIONDELETE);
1661 if (ob == dialog_->check_cursor_follows_scrollbar)
1662 return LyXRC::getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR);
1663 if (ob == dialog_->check_dialogs_iconify_with_main)
1664 return LyXRC::getDescription(LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN);
1665 if (ob == dialog_->check_preview_latex)
1666 return LyXRC::getDescription(LyXRC::RC_PREVIEW);
1667 if (ob == dialog_->counter_autosave)
1668 return LyXRC::getDescription(LyXRC::RC_AUTOSAVE);
1669 if (ob == dialog_->counter_wm_jump)
1670 return LyXRC::getDescription(LyXRC::RC_WHEEL_JUMP);
1671 if (ob == dialog_->choice_display)
1672 return LyXRC::getDescription(LyXRC::RC_DISPLAY_GRAPHICS);
1677 void FormPreferences::LnFmisc::update(LyXRC const & rc)
1679 fl_set_button(dialog_->check_auto_region_delete,
1680 rc.auto_region_delete);
1681 fl_set_button(dialog_->check_cursor_follows_scrollbar,
1682 rc.cursor_follows_scrollbar);
1683 fl_set_button(dialog_->check_dialogs_iconify_with_main,
1684 rc.dialogs_iconify_with_main);
1685 fl_set_button(dialog_->check_preview_latex,
1687 fl_set_counter_value(dialog_->counter_autosave, rc.autosave);
1688 fl_set_counter_value(dialog_->counter_wm_jump, rc.wheel_jump);
1690 switch (rc.display_graphics) {
1691 case lyx::graphics::NoDisplay:
1692 fl_set_choice(dialog_->choice_display, 4);
1694 case lyx::graphics::ColorDisplay:
1695 fl_set_choice(dialog_->choice_display, 3);
1697 case lyx::graphics::GrayscaleDisplay:
1698 fl_set_choice(dialog_->choice_display, 2);
1700 case lyx::graphics::MonochromeDisplay:
1701 fl_set_choice(dialog_->choice_display, 1);
1704 fl_set_choice(dialog_->choice_display, 3);
1710 FormPreferences::OutputsMisc::OutputsMisc(FormPreferences & p)
1715 FD_preferences_outputs_misc const * FormPreferences::OutputsMisc::dialog()
1717 return dialog_.get();
1721 void FormPreferences::OutputsMisc::apply(LyXRC & rc) const
1723 rc.ascii_linelen = static_cast<unsigned int>
1724 (fl_get_counter_value(dialog_->counter_line_len));
1725 rc.fontenc = fl_get_input(dialog_->input_tex_encoding);
1728 fl_get_choice(dialog_->choice_default_papersize) - 1;
1729 rc.default_papersize = static_cast<PAPER_SIZE>(choice);
1731 rc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff);
1732 rc.chktex_command = fl_get_input(dialog_->input_checktex);
1733 rc.view_dvi_paper_option = fl_get_input(dialog_->input_paperoption);
1734 rc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt);
1738 void FormPreferences::OutputsMisc::build()
1740 dialog_.reset(build_preferences_outputs_misc(&parent_));
1742 fl_set_counter_step(dialog_->counter_line_len, 1, 10);
1744 fl_set_counter_return(dialog_->counter_line_len, FL_RETURN_CHANGED);
1745 fl_set_input_return(dialog_->input_tex_encoding, FL_RETURN_CHANGED);
1746 fl_set_input_return(dialog_->input_ascii_roff, FL_RETURN_CHANGED);
1747 fl_set_input_return(dialog_->input_checktex, FL_RETURN_CHANGED);
1748 fl_set_input_return(dialog_->input_paperoption, FL_RETURN_CHANGED);
1750 fl_addto_choice(dialog_->choice_default_papersize,
1751 _(" default | US letter | US legal "
1752 "| US executive | A3 | A4 | A5 | B5 ").c_str());
1754 // set up the feedback mechanism
1755 setPrehandler(dialog_->counter_line_len);
1756 setPrehandler(dialog_->input_tex_encoding);
1757 setPrehandler(dialog_->choice_default_papersize);
1758 setPrehandler(dialog_->input_ascii_roff);
1759 setPrehandler(dialog_->input_checktex);
1760 setPrehandler(dialog_->input_paperoption);
1761 setPrehandler(dialog_->check_autoreset_classopt);
1766 FormPreferences::OutputsMisc::feedback(FL_OBJECT const * const ob) const
1768 if (ob == dialog_->counter_line_len)
1769 return LyXRC::getDescription(LyXRC::RC_ASCII_LINELEN);
1770 if (ob == dialog_->input_tex_encoding)
1771 return LyXRC::getDescription(LyXRC::RC_FONT_ENCODING);
1772 if (ob == dialog_->input_ascii_roff)
1773 return LyXRC::getDescription(LyXRC::RC_ASCIIROFF_COMMAND);
1774 if (ob == dialog_->input_checktex)
1775 return LyXRC::getDescription(LyXRC::RC_CHKTEX_COMMAND);
1776 if (ob == dialog_->choice_default_papersize)
1777 return LyXRC::getDescription(LyXRC::RC_DEFAULT_PAPERSIZE);
1778 if (ob == dialog_->input_paperoption)
1779 return LyXRC::getDescription(LyXRC::RC_VIEWDVI_PAPEROPTION);
1780 if (ob == dialog_->check_autoreset_classopt)
1781 return LyXRC::getDescription(LyXRC::RC_AUTORESET_OPTIONS);
1786 void FormPreferences::OutputsMisc::update(LyXRC const & rc)
1788 fl_set_counter_value(dialog_->counter_line_len,
1790 fl_set_input(dialog_->input_tex_encoding,
1791 rc.fontenc.c_str());
1792 fl_set_choice(dialog_->choice_default_papersize,
1793 rc.default_papersize + 1);
1794 fl_set_input(dialog_->input_ascii_roff,
1795 rc.ascii_roff_command.c_str());
1796 fl_set_input(dialog_->input_checktex,
1797 rc.chktex_command.c_str());
1798 fl_set_input(dialog_->input_paperoption,
1799 rc.view_dvi_paper_option.c_str());
1800 fl_set_button(dialog_->check_autoreset_classopt,
1801 rc.auto_reset_options);
1806 FormPreferences::Paths::Paths(FormPreferences & p)
1811 FD_preferences_paths const * FormPreferences::Paths::dialog()
1813 return dialog_.get();
1817 void FormPreferences::Paths::apply(LyXRC & rc)
1819 rc.document_path = fl_get_input(dialog_->input_default_path);
1820 rc.template_path = fl_get_input(dialog_->input_template_path);
1822 int button = fl_get_button(dialog_->check_use_temp_dir);
1823 string str = fl_get_input(dialog_->input_temp_dir);
1827 rc.use_tempdir = button;
1828 rc.tempdir_path = str;
1830 button = fl_get_button(dialog_->check_last_files);
1831 str = fl_get_input(dialog_->input_lastfiles);
1832 if (!button) str.erase();
1834 rc.check_lastfiles = button;
1836 rc.num_lastfiles = static_cast<unsigned int>
1837 (fl_get_counter_value(dialog_->counter_lastfiles));
1839 button = fl_get_button(dialog_->check_make_backups);
1840 str = fl_get_input(dialog_->input_backup_path);
1844 rc.make_backup = button;
1845 rc.backupdir_path = str;
1847 rc.lyxpipes = fl_get_input(dialog_->input_serverpipe);
1854 void FormPreferences::Paths::build()
1856 dialog_.reset(build_preferences_paths(&parent_));
1858 fl_set_input_return(dialog_->input_default_path, FL_RETURN_CHANGED);
1859 fl_set_input_return(dialog_->input_template_path, FL_RETURN_CHANGED);
1860 fl_set_input_return(dialog_->input_temp_dir, FL_RETURN_CHANGED);
1861 fl_set_input_return(dialog_->input_lastfiles, FL_RETURN_CHANGED);
1862 fl_set_input_return(dialog_->input_backup_path, FL_RETURN_CHANGED);
1863 fl_set_counter_return(dialog_->counter_lastfiles, FL_RETURN_CHANGED);
1864 fl_set_input_return(dialog_->input_serverpipe, FL_RETURN_CHANGED);
1866 // set up the feedback mechanism
1867 setPrehandler(dialog_->input_default_path);
1868 setPrehandler(dialog_->counter_lastfiles);
1869 setPrehandler(dialog_->input_template_path);
1870 setPrehandler(dialog_->check_last_files);
1871 setPrehandler(dialog_->input_lastfiles);
1872 setPrehandler(dialog_->check_make_backups);
1873 setPrehandler(dialog_->input_backup_path);
1874 setPrehandler(dialog_->input_serverpipe);
1875 setPrehandler(dialog_->input_temp_dir);
1876 setPrehandler(dialog_->check_use_temp_dir);
1881 FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const
1883 if (ob == dialog_->input_default_path)
1884 return LyXRC::getDescription(LyXRC::RC_DOCUMENTPATH);
1885 if (ob == dialog_->input_template_path)
1886 return LyXRC::getDescription(LyXRC::RC_TEMPLATEPATH);
1887 if (ob == dialog_->check_use_temp_dir)
1888 return LyXRC::getDescription(LyXRC::RC_USETEMPDIR);
1889 if (ob == dialog_->input_temp_dir)
1890 return LyXRC::getDescription(LyXRC::RC_TEMPDIRPATH);
1891 if (ob == dialog_->check_last_files)
1892 return LyXRC::getDescription(LyXRC::RC_CHECKLASTFILES);
1893 if (ob == dialog_->input_lastfiles)
1894 return LyXRC::getDescription(LyXRC::RC_LASTFILES);
1895 if (ob == dialog_->counter_lastfiles)
1896 return LyXRC::getDescription(LyXRC::RC_NUMLASTFILES);
1897 if (ob == dialog_->check_make_backups)
1898 return LyXRC::getDescription(LyXRC::RC_MAKE_BACKUP);
1899 if (ob == dialog_->input_backup_path)
1900 return LyXRC::getDescription(LyXRC::RC_BACKUPDIR_PATH);
1901 if (ob == dialog_->input_serverpipe)
1902 return LyXRC::getDescription(LyXRC::RC_SERVERPIPE);
1907 bool FormPreferences::Paths::input(FL_OBJECT const * const ob)
1909 bool activate = true;
1911 // !ob if function is called from Paths::update() to de/activate
1913 // otherwise the function is called by an xforms CB via input().
1914 if (!ob || ob == dialog_->check_use_temp_dir) {
1915 bool const enable = fl_get_button(dialog_->check_use_temp_dir);
1916 setEnabled(dialog_->input_temp_dir, enable);
1919 if (!ob || ob == dialog_->check_last_files) {
1920 bool const enable = fl_get_button(dialog_->check_last_files);
1921 setEnabled(dialog_->input_lastfiles, enable);
1924 if (!ob || ob == dialog_->check_make_backups) {
1925 bool const enable = fl_get_button(dialog_->check_make_backups);
1926 setEnabled(dialog_->input_backup_path, enable);
1929 if (!ob || ob == dialog_->input_default_path) {
1930 string const name = fl_get_input(dialog_->input_default_path);
1931 if (!name.empty() && !RWInfo::WriteableDir(name)) {
1932 parent_.postWarning(RWInfo::ErrorMessage());
1937 if (!ob || ob == dialog_->input_template_path) {
1938 string const name = fl_get_input(dialog_->input_template_path);
1939 if (!name.empty() && !RWInfo::ReadableDir(name)) {
1940 parent_.postWarning(RWInfo::ErrorMessage());
1945 if (!ob || ob == dialog_->input_temp_dir) {
1946 string const name = fl_get_input(dialog_->input_temp_dir);
1947 if (fl_get_button(dialog_->check_make_backups)
1949 && !RWInfo::WriteableDir(name)) {
1950 parent_.postWarning(RWInfo::ErrorMessage());
1955 if (!ob || ob == dialog_->input_backup_path) {
1956 string const name = fl_get_input(dialog_->input_backup_path);
1957 if (fl_get_button(dialog_->check_make_backups)
1959 && !RWInfo::WriteableDir(name)) {
1960 parent_.postWarning(RWInfo::ErrorMessage());
1965 if (!ob || ob == dialog_->input_lastfiles) {
1966 string const name = fl_get_input(dialog_->input_lastfiles);
1967 if (fl_get_button(dialog_->check_last_files)
1969 && !RWInfo::WriteableFile(name)) {
1970 parent_.postWarning(RWInfo::ErrorMessage());
1975 if (!ob || ob == dialog_->input_serverpipe) {
1976 string const name = fl_get_input(dialog_->input_serverpipe);
1977 if (!name.empty()) {
1978 // strip off the extension
1979 string const str = ChangeExtension(name, "");
1980 if (!RWInfo::WriteableFile(str + ".in")) {
1981 parent_.postWarning(RWInfo::ErrorMessage());
1984 if (!RWInfo::WriteableFile(str + ".out")) {
1985 parent_.postWarning(RWInfo::ErrorMessage());
1991 if (ob == dialog_->button_default_path_browse) {
1992 string f = parent_.controller().browsedir(
1993 fl_get_input(dialog_->input_default_path), _("Default path"));
1995 fl_set_input(dialog_->input_default_path, f.c_str());
1996 } else if (ob == dialog_->button_template_path_browse) {
1997 string f = parent_.controller().browsedir(
1998 fl_get_input(dialog_->input_template_path), _("Template path"));
2000 fl_set_input(dialog_->input_template_path, f.c_str());
2001 } else if (ob == dialog_->button_temp_dir_browse) {
2002 string f = parent_.controller().browsedir(
2003 fl_get_input(dialog_->input_temp_dir), _("Temporary dir"));
2005 fl_set_input(dialog_->input_temp_dir, f.c_str());
2006 } else if (ob == dialog_->button_lastfiles_browse) {
2007 string f = parent_.controller().browse(
2008 fl_get_input(dialog_->input_lastfiles), _("Last files"));
2010 fl_set_input(dialog_->input_lastfiles, f.c_str());
2011 } else if (ob == dialog_->button_backup_path_browse) {
2012 string f = parent_.controller().browsedir(
2013 fl_get_input(dialog_->input_backup_path), _("Backup path"));
2015 fl_set_input(dialog_->input_backup_path, f.c_str());
2016 } else if (ob == dialog_->button_serverpipe_browse) {
2017 string f = parent_.controller().browse(
2018 fl_get_input(dialog_->input_serverpipe), _("LyX server pipes"));
2020 fl_set_input(dialog_->input_serverpipe, f.c_str());
2027 void FormPreferences::Paths::update(LyXRC const & rc)
2029 fl_set_input(dialog_->input_default_path,
2030 rc.document_path.c_str());
2031 fl_set_input(dialog_->input_template_path,
2032 rc.template_path.c_str());
2036 str = rc.backupdir_path;
2038 fl_set_button(dialog_->check_make_backups,
2040 fl_set_input(dialog_->input_backup_path, str.c_str());
2044 str = rc.tempdir_path;
2046 fl_set_button(dialog_->check_use_temp_dir,
2048 fl_set_input(dialog_->input_temp_dir, str.c_str());
2051 if (rc.check_lastfiles)
2054 fl_set_button(dialog_->check_last_files,
2055 rc.check_lastfiles);
2056 fl_set_input(dialog_->input_lastfiles, str.c_str());
2057 fl_set_counter_value(dialog_->counter_lastfiles,
2060 fl_set_input(dialog_->input_serverpipe, rc.lyxpipes.c_str());
2062 // Activate/Deactivate the input fields dependent on the state of the
2068 FormPreferences::Printer::Printer(FormPreferences & p)
2073 FD_preferences_printer const * FormPreferences::Printer::dialog()
2075 return dialog_.get();
2079 void FormPreferences::Printer::apply(LyXRC & rc) const
2081 rc.print_adapt_output = fl_get_button(dialog_->check_adapt_output);
2082 rc.print_command = fl_get_input(dialog_->input_command);
2083 rc.print_pagerange_flag = fl_get_input(dialog_->input_page_range);
2084 rc.print_copies_flag = fl_get_input(dialog_->input_copies);
2085 rc.print_reverse_flag = fl_get_input(dialog_->input_reverse);
2086 rc.print_to_printer = fl_get_input(dialog_->input_to_printer);
2087 rc.print_file_extension =
2088 fl_get_input(dialog_->input_file_extension);
2089 rc.print_spool_command =
2090 fl_get_input(dialog_->input_spool_command);
2091 rc.print_paper_flag = fl_get_input(dialog_->input_paper_type);
2092 rc.print_evenpage_flag = fl_get_input(dialog_->input_even_pages);
2093 rc.print_oddpage_flag = fl_get_input(dialog_->input_odd_pages);
2094 rc.print_collcopies_flag = fl_get_input(dialog_->input_collated);
2095 rc.print_landscape_flag = fl_get_input(dialog_->input_landscape);
2096 rc.print_to_file = fl_get_input(dialog_->input_to_file);
2097 rc.print_extra_options =
2098 fl_get_input(dialog_->input_extra_options);
2099 rc.print_spool_printerprefix =
2100 fl_get_input(dialog_->input_spool_prefix);
2101 rc.print_paper_dimension_flag =
2102 fl_get_input(dialog_->input_paper_size);
2103 rc.printer = fl_get_input(dialog_->input_name);
2108 FormPreferences::Printer::feedback(FL_OBJECT const * const ob) const
2110 if (ob == dialog_->input_command)
2111 return LyXRC::getDescription(LyXRC::RC_PRINT_COMMAND);
2112 if (ob == dialog_->check_adapt_output)
2113 return LyXRC::getDescription(LyXRC::RC_PRINT_ADAPTOUTPUT);
2114 if (ob == dialog_->input_to_printer)
2115 return LyXRC::getDescription(LyXRC::RC_PRINTTOPRINTER);
2116 if (ob == dialog_->input_to_file)
2117 return LyXRC::getDescription(LyXRC::RC_PRINTTOFILE);
2118 if (ob == dialog_->input_file_extension)
2119 return LyXRC::getDescription(LyXRC::RC_PRINTFILEEXTENSION);
2120 if (ob == dialog_->input_extra_options)
2121 return LyXRC::getDescription(LyXRC::RC_PRINTEXSTRAOPTIONS);
2122 if (ob == dialog_->input_spool_command)
2123 return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_COMMAND);
2124 if (ob == dialog_->input_spool_prefix)
2125 return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_PRINTERPREFIX);
2126 if (ob == dialog_->input_name)
2127 return LyXRC::getDescription(LyXRC::RC_PRINTER);
2128 if (ob == dialog_->input_even_pages)
2129 return LyXRC::getDescription(LyXRC::RC_PRINTEVENPAGEFLAG);
2130 if (ob == dialog_->input_odd_pages)
2131 return LyXRC::getDescription(LyXRC::RC_PRINTODDPAGEFLAG);
2132 if (ob == dialog_->input_page_range)
2133 return LyXRC::getDescription(LyXRC::RC_PRINTPAGERANGEFLAG);
2134 if (ob == dialog_->input_reverse)
2135 return LyXRC::getDescription(LyXRC::RC_PRINTREVERSEFLAG);
2136 if (ob == dialog_->input_landscape)
2137 return LyXRC::getDescription(LyXRC::RC_PRINTLANDSCAPEFLAG);
2138 if (ob == dialog_->input_copies)
2139 return LyXRC::getDescription(LyXRC::RC_PRINTCOPIESFLAG);
2140 if (ob == dialog_->input_collated)
2141 return LyXRC::getDescription(LyXRC::RC_PRINTCOLLCOPIESFLAG);
2142 if (ob == dialog_->input_paper_type)
2143 return LyXRC::getDescription(LyXRC::RC_PRINTPAPERFLAG);
2144 if (ob == dialog_->input_paper_size)
2145 return LyXRC::getDescription(LyXRC::RC_PRINTPAPERDIMENSIONFLAG);
2150 void FormPreferences::Printer::build()
2152 dialog_.reset(build_preferences_printer(&parent_));
2154 fl_set_input_return(dialog_->input_command, FL_RETURN_CHANGED);
2155 fl_set_input_return(dialog_->input_page_range, FL_RETURN_CHANGED);
2156 fl_set_input_return(dialog_->input_copies, FL_RETURN_CHANGED);
2157 fl_set_input_return(dialog_->input_reverse, FL_RETURN_CHANGED);
2158 fl_set_input_return(dialog_->input_to_printer, FL_RETURN_CHANGED);
2159 fl_set_input_return(dialog_->input_file_extension, FL_RETURN_CHANGED);
2160 fl_set_input_return(dialog_->input_spool_command, FL_RETURN_CHANGED);
2161 fl_set_input_return(dialog_->input_paper_type, FL_RETURN_CHANGED);
2162 fl_set_input_return(dialog_->input_even_pages, FL_RETURN_CHANGED);
2163 fl_set_input_return(dialog_->input_odd_pages, FL_RETURN_CHANGED);
2164 fl_set_input_return(dialog_->input_collated, FL_RETURN_CHANGED);
2165 fl_set_input_return(dialog_->input_landscape, FL_RETURN_CHANGED);
2166 fl_set_input_return(dialog_->input_to_file, FL_RETURN_CHANGED);
2167 fl_set_input_return(dialog_->input_extra_options, FL_RETURN_CHANGED);
2168 fl_set_input_return(dialog_->input_spool_prefix, FL_RETURN_CHANGED);
2169 fl_set_input_return(dialog_->input_paper_size, FL_RETURN_CHANGED);
2170 fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
2172 // set up the feedback mechanism
2173 setPrehandler(dialog_->input_command);
2174 setPrehandler(dialog_->input_page_range);
2175 setPrehandler(dialog_->input_copies);
2176 setPrehandler(dialog_->input_reverse);
2177 setPrehandler(dialog_->input_to_printer);
2178 setPrehandler(dialog_->input_file_extension);
2179 setPrehandler(dialog_->input_spool_command);
2180 setPrehandler(dialog_->input_paper_type);
2181 setPrehandler(dialog_->input_even_pages);
2182 setPrehandler(dialog_->input_odd_pages);
2183 setPrehandler(dialog_->input_collated);
2184 setPrehandler(dialog_->input_landscape);
2185 setPrehandler(dialog_->input_to_file);
2186 setPrehandler(dialog_->input_extra_options);
2187 setPrehandler(dialog_->input_spool_prefix);
2188 setPrehandler(dialog_->input_paper_size);
2189 setPrehandler(dialog_->input_name);
2190 setPrehandler(dialog_->check_adapt_output);
2194 void FormPreferences::Printer::update(LyXRC const & rc)
2196 fl_set_button(dialog_->check_adapt_output,
2197 rc.print_adapt_output);
2198 fl_set_input(dialog_->input_command,
2199 rc.print_command.c_str());
2200 fl_set_input(dialog_->input_page_range,
2201 rc.print_pagerange_flag.c_str());
2202 fl_set_input(dialog_->input_copies,
2203 rc.print_copies_flag.c_str());
2204 fl_set_input(dialog_->input_reverse,
2205 rc.print_reverse_flag.c_str());
2206 fl_set_input(dialog_->input_to_printer,
2207 rc.print_to_printer.c_str());
2208 fl_set_input(dialog_->input_file_extension,
2209 rc.print_file_extension.c_str());
2210 fl_set_input(dialog_->input_spool_command,
2211 rc.print_spool_command.c_str());
2212 fl_set_input(dialog_->input_paper_type,
2213 rc.print_paper_flag.c_str());
2214 fl_set_input(dialog_->input_even_pages,
2215 rc.print_evenpage_flag.c_str());
2216 fl_set_input(dialog_->input_odd_pages,
2217 rc.print_oddpage_flag.c_str());
2218 fl_set_input(dialog_->input_collated,
2219 rc.print_collcopies_flag.c_str());
2220 fl_set_input(dialog_->input_landscape,
2221 rc.print_landscape_flag.c_str());
2222 fl_set_input(dialog_->input_to_file,
2223 rc.print_to_file.c_str());
2224 fl_set_input(dialog_->input_extra_options,
2225 rc.print_extra_options.c_str());
2226 fl_set_input(dialog_->input_spool_prefix,
2227 rc.print_spool_printerprefix.c_str());
2228 fl_set_input(dialog_->input_paper_size,
2229 rc.print_paper_dimension_flag.c_str());
2230 fl_set_input(dialog_->input_name,
2231 rc.printer.c_str());
2235 FormPreferences::ScreenFonts::ScreenFonts(FormPreferences & p)
2240 FD_preferences_screen_fonts const * FormPreferences::ScreenFonts::dialog()
2242 return dialog_.get();
2246 void FormPreferences::ScreenFonts::apply(LyXRC & rc) const
2248 bool changed = false;
2250 pair<string, string> tmp =
2251 parseFontName(fl_get_input(dialog_->input_roman));
2252 if (rc.roman_font_name != tmp.first ||
2253 rc.roman_font_foundry != tmp.second) {
2255 rc.roman_font_name = tmp.first;
2256 rc.roman_font_foundry = tmp.second;
2259 tmp = parseFontName(fl_get_input(dialog_->input_sans));
2260 if (rc.sans_font_name != tmp.first ||
2261 rc.sans_font_foundry != tmp.second) {
2263 rc.sans_font_name = tmp.first;
2264 rc.sans_font_foundry = tmp.second;
2267 tmp = parseFontName(fl_get_input(dialog_->input_typewriter));
2268 if (rc.typewriter_font_name != tmp.first ||
2269 rc.typewriter_font_foundry != tmp.second) {
2271 rc.typewriter_font_name = tmp.first;
2272 rc.typewriter_font_foundry = tmp.second;
2275 string str = fl_get_input(dialog_->input_screen_encoding);
2276 if (rc.font_norm != str) {
2279 rc.set_font_norm_type();
2282 bool button = fl_get_button(dialog_->check_scalable);
2283 if (rc.use_scalable_fonts != button) {
2285 rc.use_scalable_fonts = button;
2288 unsigned int ivalue = static_cast<unsigned int>
2289 (fl_get_counter_value(dialog_->counter_zoom));
2290 if (rc.zoom != ivalue) {
2295 ivalue = static_cast<unsigned int>
2296 (fl_get_counter_value(dialog_->counter_dpi));
2297 if (rc.dpi != ivalue) {
2302 double dvalue = strToDbl(fl_get_input(dialog_->input_tiny));
2303 if (rc.font_sizes[LyXFont::SIZE_TINY] != dvalue) {
2305 rc.font_sizes[LyXFont::SIZE_TINY] = dvalue;
2308 dvalue = strToDbl(fl_get_input(dialog_->input_script));
2309 if (rc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue) {
2311 rc.font_sizes[LyXFont::SIZE_SCRIPT] = dvalue;
2314 dvalue = strToDbl(fl_get_input(dialog_->input_footnote));
2315 if (rc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue) {
2317 rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = dvalue;
2320 dvalue = strToDbl(fl_get_input(dialog_->input_small));
2321 if (rc.font_sizes[LyXFont::SIZE_SMALL] != dvalue) {
2323 rc.font_sizes[LyXFont::SIZE_SMALL] = dvalue;
2326 dvalue = strToDbl(fl_get_input(dialog_->input_normal));
2327 if (rc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue) {
2329 rc.font_sizes[LyXFont::SIZE_NORMAL] = dvalue;
2332 dvalue = strToDbl(fl_get_input(dialog_->input_large));
2333 if (rc.font_sizes[LyXFont::SIZE_LARGE] != dvalue) {
2335 rc.font_sizes[LyXFont::SIZE_LARGE] = dvalue;
2338 dvalue = strToDbl(fl_get_input(dialog_->input_larger));
2339 if (rc.font_sizes[LyXFont::SIZE_LARGER] != dvalue) {
2341 rc.font_sizes[LyXFont::SIZE_LARGER] = dvalue;
2344 dvalue = strToDbl(fl_get_input(dialog_->input_largest));
2345 if (rc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue) {
2347 rc.font_sizes[LyXFont::SIZE_LARGEST] = dvalue;
2350 dvalue = strToDbl(fl_get_input(dialog_->input_huge));
2351 if (rc.font_sizes[LyXFont::SIZE_HUGE] != dvalue) {
2353 rc.font_sizes[LyXFont::SIZE_HUGE] = dvalue;
2356 dvalue = strToDbl(fl_get_input(dialog_->input_huger));
2357 if (rc.font_sizes[LyXFont::SIZE_HUGER] != dvalue) {
2359 rc.font_sizes[LyXFont::SIZE_HUGER] = dvalue;
2363 // Now update the buffers
2364 // Can anything below here affect the redraw process?
2365 parent_.controller().updateScreenFonts();
2370 void FormPreferences::ScreenFonts::build()
2372 dialog_.reset(build_preferences_screen_fonts(&parent_));
2374 fl_set_counter_step(dialog_->counter_zoom, 1, 10);
2375 fl_set_counter_step(dialog_->counter_dpi, 1, 10);
2377 fl_set_input_return(dialog_->input_roman, FL_RETURN_CHANGED);
2378 fl_set_input_return(dialog_->input_sans, FL_RETURN_CHANGED);
2379 fl_set_input_return(dialog_->input_typewriter, FL_RETURN_CHANGED);
2380 fl_set_input_return(dialog_->input_screen_encoding, FL_RETURN_CHANGED);
2381 fl_set_counter_return(dialog_->counter_zoom, FL_RETURN_CHANGED);
2382 fl_set_counter_return(dialog_->counter_dpi, FL_RETURN_CHANGED);
2383 fl_set_input_return(dialog_->input_tiny, FL_RETURN_CHANGED);
2384 fl_set_input_return(dialog_->input_script, FL_RETURN_CHANGED);
2385 fl_set_input_return(dialog_->input_footnote, FL_RETURN_CHANGED);
2386 fl_set_input_return(dialog_->input_small, FL_RETURN_CHANGED);
2387 fl_set_input_return(dialog_->input_normal, FL_RETURN_CHANGED);
2388 fl_set_input_return(dialog_->input_large, FL_RETURN_CHANGED);
2389 fl_set_input_return(dialog_->input_larger, FL_RETURN_CHANGED);
2390 fl_set_input_return(dialog_->input_largest, FL_RETURN_CHANGED);
2391 fl_set_input_return(dialog_->input_huge, FL_RETURN_CHANGED);
2392 fl_set_input_return(dialog_->input_huger, FL_RETURN_CHANGED);
2394 fl_set_input_filter(dialog_->input_tiny, fl_unsigned_float_filter);
2395 fl_set_input_filter(dialog_->input_script, fl_unsigned_float_filter);
2396 fl_set_input_filter(dialog_->input_footnote, fl_unsigned_float_filter);
2397 fl_set_input_filter(dialog_->input_small, fl_unsigned_float_filter);
2398 fl_set_input_filter(dialog_->input_normal, fl_unsigned_float_filter);
2399 fl_set_input_filter(dialog_->input_large, fl_unsigned_float_filter);
2400 fl_set_input_filter(dialog_->input_larger, fl_unsigned_float_filter);
2401 fl_set_input_filter(dialog_->input_largest, fl_unsigned_float_filter);
2402 fl_set_input_filter(dialog_->input_huge, fl_unsigned_float_filter);
2403 fl_set_input_filter(dialog_->input_huger, fl_unsigned_float_filter);
2405 // set up the feedback mechanism
2406 setPrehandler(dialog_->input_roman);
2407 setPrehandler(dialog_->input_sans);
2408 setPrehandler(dialog_->input_typewriter);
2409 setPrehandler(dialog_->counter_zoom);
2410 setPrehandler(dialog_->counter_dpi);
2411 setPrehandler(dialog_->check_scalable);
2412 setPrehandler(dialog_->input_screen_encoding);
2413 setPrehandler(dialog_->input_tiny);
2414 setPrehandler(dialog_->input_script);
2415 setPrehandler(dialog_->input_footnote);
2416 setPrehandler(dialog_->input_small);
2417 setPrehandler(dialog_->input_large);
2418 setPrehandler(dialog_->input_larger);
2419 setPrehandler(dialog_->input_largest);
2420 setPrehandler(dialog_->input_normal);
2421 setPrehandler(dialog_->input_huge);
2422 setPrehandler(dialog_->input_huger);
2427 FormPreferences::ScreenFonts::feedback(FL_OBJECT const * const ob) const
2429 if (ob == dialog_->input_roman)
2430 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ROMAN);
2431 if (ob == dialog_->input_sans)
2432 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SANS);
2433 if (ob == dialog_->input_typewriter)
2434 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_TYPEWRITER);
2435 if (ob == dialog_->check_scalable)
2436 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SCALABLE);
2437 if (ob == dialog_->input_screen_encoding)
2438 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ENCODING);
2439 if (ob == dialog_->counter_zoom)
2440 return LyXRC::getDescription(LyXRC::RC_SCREEN_ZOOM);
2441 if (ob == dialog_->counter_dpi)
2442 return LyXRC::getDescription(LyXRC::RC_SCREEN_DPI);
2443 if (ob == dialog_->input_tiny
2444 || ob == dialog_->input_script
2445 || ob == dialog_->input_footnote
2446 || ob == dialog_->input_small
2447 || ob == dialog_->input_large
2448 || ob == dialog_->input_larger
2449 || ob == dialog_->input_larger
2450 || ob == dialog_->input_largest
2451 || ob == dialog_->input_normal
2452 || ob == dialog_->input_huge
2453 || ob == dialog_->input_huger)
2454 return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SIZES);
2459 bool FormPreferences::ScreenFonts::input()
2461 bool activate = true;
2464 // Make sure that all fonts all have positive entries
2465 // Also note that an empty entry is returned as 0.0 by strToDbl
2466 if (0.0 >= strToDbl(fl_get_input(dialog_->input_tiny))
2467 || 0.0 >= strToDbl(fl_get_input(dialog_->input_script))
2468 || 0.0 >= strToDbl(fl_get_input(dialog_->input_footnote))
2469 || 0.0 >= strToDbl(fl_get_input(dialog_->input_small))
2470 || 0.0 >= strToDbl(fl_get_input(dialog_->input_normal))
2471 || 0.0 >= strToDbl(fl_get_input(dialog_->input_large))
2472 || 0.0 >= strToDbl(fl_get_input(dialog_->input_larger))
2473 || 0.0 >= strToDbl(fl_get_input(dialog_->input_largest))
2474 || 0.0 >= strToDbl(fl_get_input(dialog_->input_huge))
2475 || 0.0 >= strToDbl(fl_get_input(dialog_->input_huger))) {
2477 str = _("Fonts must be positive!");
2479 } else if (strToDbl(fl_get_input(dialog_->input_tiny)) >
2480 // Fontsizes -- tiny < script < footnote etc.
2481 strToDbl(fl_get_input(dialog_->input_script)) ||
2482 strToDbl(fl_get_input(dialog_->input_script)) >
2483 strToDbl(fl_get_input(dialog_->input_footnote)) ||
2484 strToDbl(fl_get_input(dialog_->input_footnote)) >
2485 strToDbl(fl_get_input(dialog_->input_small)) ||
2486 strToDbl(fl_get_input(dialog_->input_small)) >
2487 strToDbl(fl_get_input(dialog_->input_normal)) ||
2488 strToDbl(fl_get_input(dialog_->input_normal)) >
2489 strToDbl(fl_get_input(dialog_->input_large)) ||
2490 strToDbl(fl_get_input(dialog_->input_large)) >
2491 strToDbl(fl_get_input(dialog_->input_larger)) ||
2492 strToDbl(fl_get_input(dialog_->input_larger)) >
2493 strToDbl(fl_get_input(dialog_->input_largest)) ||
2494 strToDbl(fl_get_input(dialog_->input_largest)) >
2495 strToDbl(fl_get_input(dialog_->input_huge)) ||
2496 strToDbl(fl_get_input(dialog_->input_huge)) >
2497 strToDbl(fl_get_input(dialog_->input_huger))) {
2500 str = _("Fonts must be input in the order Tiny > Smallest > Smaller > Small > Normal > Large > Larger > Largest > Huge > Huger.");
2504 parent_.postWarning(str);
2510 void FormPreferences::ScreenFonts::update(LyXRC const & rc)
2512 fl_set_input(dialog_->input_roman,
2513 makeFontName(rc.roman_font_name,
2514 rc.roman_font_foundry).c_str());
2515 fl_set_input(dialog_->input_sans,
2516 makeFontName(rc.sans_font_name,
2517 rc.sans_font_foundry).c_str());
2518 fl_set_input(dialog_->input_typewriter,
2519 makeFontName(rc.typewriter_font_name,
2520 rc.typewriter_font_foundry).c_str());
2521 fl_set_input(dialog_->input_screen_encoding,
2522 rc.font_norm.c_str());
2523 fl_set_button(dialog_->check_scalable,
2524 rc.use_scalable_fonts);
2525 fl_set_counter_value(dialog_->counter_zoom, rc.zoom);
2526 fl_set_counter_value(dialog_->counter_dpi, rc.dpi);
2527 fl_set_input(dialog_->input_tiny,
2528 tostr(rc.font_sizes[LyXFont::SIZE_TINY]).c_str());
2529 fl_set_input(dialog_->input_script,
2530 tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str());
2531 fl_set_input(dialog_->input_footnote,
2532 tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str());
2533 fl_set_input(dialog_->input_small,
2534 tostr(rc.font_sizes[LyXFont::SIZE_SMALL]).c_str());
2535 fl_set_input(dialog_->input_normal,
2536 tostr(rc.font_sizes[LyXFont::SIZE_NORMAL]).c_str());
2537 fl_set_input(dialog_->input_large,
2538 tostr(rc.font_sizes[LyXFont::SIZE_LARGE]).c_str());
2539 fl_set_input(dialog_->input_larger,
2540 tostr(rc.font_sizes[LyXFont::SIZE_LARGER]).c_str());
2541 fl_set_input(dialog_->input_largest,
2542 tostr(rc.font_sizes[LyXFont::SIZE_LARGEST]).c_str());
2543 fl_set_input(dialog_->input_huge,
2544 tostr(rc.font_sizes[LyXFont::SIZE_HUGE]).c_str());
2545 fl_set_input(dialog_->input_huger,
2546 tostr(rc.font_sizes[LyXFont::SIZE_HUGER]).c_str());
2551 FormPreferences::SpellOptions::SpellOptions(FormPreferences & p)
2556 FD_preferences_spelloptions const * FormPreferences::SpellOptions::dialog()
2558 return dialog_.get();
2562 void FormPreferences::SpellOptions::apply(LyXRC & rc)
2564 string choice = fl_get_choice_text(dialog_->choice_spell_command);
2565 choice = trim(choice);
2567 rc.isp_command = choice;
2570 // If spell checker == "none", all other input set to off.
2571 if (fl_get_choice(dialog_->choice_spell_command) == 1) {
2572 rc.isp_use_alt_lang = false;
2573 rc.isp_alt_lang.erase();
2575 rc.isp_use_esc_chars = false;
2576 rc.isp_esc_chars.erase();
2578 rc.isp_use_pers_dict = false;
2579 rc.isp_pers_dict.erase();
2581 rc.isp_accept_compound = false;
2582 rc.isp_use_input_encoding = false;
2585 int button = fl_get_button(dialog_->check_alt_lang);
2586 choice = fl_get_input(dialog_->input_alt_lang);
2587 if (button && choice.empty()) button = 0;
2588 if (!button) choice.erase();
2590 rc.isp_use_alt_lang = static_cast<bool>(button);
2591 rc.isp_alt_lang = choice;
2593 button = fl_get_button(dialog_->check_escape_chars);
2594 choice = fl_get_input(dialog_->input_escape_chars);
2595 if (button && choice.empty()) button = 0;
2596 if (!button) choice.erase();
2598 rc.isp_use_esc_chars = static_cast<bool>(button);
2599 rc.isp_esc_chars = choice;
2601 button = fl_get_button(dialog_->check_personal_dict);
2602 choice = fl_get_input(dialog_->input_personal_dict);
2603 if (button && choice.empty()) button = 0;
2604 if (!button) choice.erase();
2606 rc.isp_use_pers_dict = static_cast<bool>(button);
2607 rc.isp_pers_dict = choice;
2609 button = fl_get_button(dialog_->check_compound_words);
2610 rc.isp_accept_compound = static_cast<bool>(button);
2612 button = fl_get_button(dialog_->check_input_enc);
2613 rc.isp_use_input_encoding = static_cast<bool>(button);
2624 void FormPreferences::SpellOptions::build()
2626 dialog_.reset(build_preferences_spelloptions(&parent_));
2628 fl_addto_choice(dialog_->choice_spell_command,
2629 _(" ispell | aspell ").c_str());
2630 fl_set_input_return(dialog_->input_alt_lang, FL_RETURN_CHANGED);
2631 fl_set_input_return(dialog_->input_escape_chars, FL_RETURN_CHANGED);
2632 fl_set_input_return(dialog_->input_personal_dict, FL_RETURN_CHANGED);
2634 // set up the feedback mechanism
2635 setPrehandler(dialog_->choice_spell_command);
2636 setPrehandler(dialog_->check_alt_lang);
2637 setPrehandler(dialog_->input_alt_lang);
2638 setPrehandler(dialog_->check_escape_chars);
2639 setPrehandler(dialog_->input_escape_chars);
2640 setPrehandler(dialog_->check_personal_dict);
2641 setPrehandler(dialog_->input_personal_dict);
2642 setPrehandler(dialog_->button_personal_dict);
2643 setPrehandler(dialog_->check_compound_words);
2644 setPrehandler(dialog_->check_input_enc);
2649 FormPreferences::SpellOptions::feedback(FL_OBJECT const * const ob) const
2651 if (ob == dialog_->choice_spell_command)
2652 return LyXRC::getDescription(LyXRC::RC_SPELL_COMMAND);
2653 if (ob == dialog_->check_alt_lang)
2654 return LyXRC::getDescription(LyXRC::RC_USE_ALT_LANG);
2655 if (ob == dialog_->input_alt_lang)
2656 return LyXRC::getDescription(LyXRC::RC_ALT_LANG);
2657 if (ob == dialog_->check_escape_chars)
2658 return LyXRC::getDescription(LyXRC::RC_USE_ESC_CHARS);
2659 if (ob == dialog_->input_escape_chars)
2660 return LyXRC::getDescription(LyXRC::RC_ESC_CHARS);
2661 if (ob == dialog_->check_personal_dict)
2662 return LyXRC::getDescription(LyXRC::RC_USE_PERS_DICT);
2663 if (ob == dialog_->input_personal_dict)
2664 return LyXRC::getDescription(LyXRC::RC_PERS_DICT);
2665 if (ob == dialog_->check_compound_words)
2666 return LyXRC::getDescription(LyXRC::RC_ACCEPT_COMPOUND);
2667 if (ob == dialog_->check_input_enc)
2668 return LyXRC::getDescription(LyXRC::RC_USE_INP_ENC);
2673 bool FormPreferences::SpellOptions::input(FL_OBJECT const * const ob)
2675 // !ob if function is called from updateSpellOptions() to de/activate
2677 // otherwise the function is called by an xforms CB via input().
2680 // If spell checker == "none", disable all input.
2681 if (!ob || ob == dialog_->choice_spell_command) {
2682 if (fl_get_choice(dialog_->choice_spell_command) == 1) {
2683 fl_deactivate_object(dialog_->check_alt_lang);
2684 fl_deactivate_object(dialog_->input_alt_lang);
2685 fl_deactivate_object(dialog_->check_escape_chars);
2686 fl_deactivate_object(dialog_->input_escape_chars);
2687 fl_deactivate_object(dialog_->check_personal_dict);
2688 fl_deactivate_object(dialog_->input_personal_dict);
2689 fl_deactivate_object(dialog_->check_compound_words);
2690 fl_deactivate_object(dialog_->check_input_enc);
2693 fl_activate_object(dialog_->check_alt_lang);
2694 fl_activate_object(dialog_->check_escape_chars);
2695 fl_activate_object(dialog_->check_personal_dict);
2696 fl_activate_object(dialog_->check_compound_words);
2697 fl_activate_object(dialog_->check_input_enc);
2702 if (!ob || ob == dialog_->check_alt_lang) {
2703 bool const enable = fl_get_button(dialog_->check_alt_lang);
2704 setEnabled(dialog_->input_alt_lang, enable);
2707 if (!ob || ob == dialog_->check_escape_chars) {
2708 bool const enable = fl_get_button(dialog_->check_escape_chars);
2709 setEnabled(dialog_->input_escape_chars, enable);
2712 if (!ob || ob == dialog_->check_personal_dict) {
2713 bool const enable = fl_get_button(dialog_->check_personal_dict);
2714 setEnabled(dialog_->input_personal_dict, enable);
2717 if (ob == dialog_->button_personal_dict) {
2718 string f = parent_.controller().browsedict(
2719 fl_get_input(dialog_->input_personal_dict));
2720 fl_set_input(dialog_->input_personal_dict, f.c_str());
2723 return true; // All input is valid!
2727 void FormPreferences::SpellOptions::update(LyXRC const & rc)
2731 if (rc.isp_command == "none")
2733 else if (rc.isp_command == "ispell")
2735 else if (rc.isp_command == "aspell")
2738 if (rc.isp_command == "ispell")
2740 else if (rc.isp_command == "aspell")
2743 fl_set_choice(dialog_->choice_spell_command, choice);
2746 if (rc.isp_use_alt_lang)
2747 str = rc.isp_alt_lang;
2749 fl_set_button(dialog_->check_alt_lang,
2750 rc.isp_use_alt_lang);
2751 fl_set_input(dialog_->input_alt_lang, str.c_str());
2754 if (rc.isp_use_esc_chars)
2755 str = rc.isp_esc_chars;
2757 fl_set_button(dialog_->check_escape_chars,
2758 rc.isp_use_esc_chars);
2759 fl_set_input(dialog_->input_escape_chars, str.c_str());
2762 if (rc.isp_use_pers_dict)
2763 str = rc.isp_pers_dict;
2765 fl_set_button(dialog_->check_personal_dict,
2766 rc.isp_use_pers_dict);
2767 fl_set_input(dialog_->input_personal_dict, str.c_str());
2769 fl_set_button(dialog_->check_compound_words,
2770 rc.isp_accept_compound);
2771 fl_set_button(dialog_->check_input_enc,
2772 rc.isp_use_input_encoding);
2774 // Activate/Deactivate the input fields dependent on the state of the