]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormPreferences.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / FormPreferences.C
index 4e50c2d4c4255cf2bc784f5969f2021eb02b9500..df41505316aeac2f30e20183b813d9cd7f4bbf6f 100644 (file)
@@ -5,70 +5,60 @@
  *
  * \author Angus Leeming
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include "ControlPrefs.h"
 #include "FormPreferences.h"
 #include "forms/form_preferences.h"
-#include "xformsBC.h"
 
-#include "combox.h"
-#include "Color.h"
-#include "input_validators.h"
+#include "FormColorpicker.h"
 #include "forms_gettext.h"
+#include "input_validators.h"
+#include "xformsBC.h"
 #include "xforms_helpers.h"
-#include "helper_funcs.h" // getSecond
+
+#include "controllers/ControlPrefs.h"
+#include "controllers/frnt_lang.h"
+#include "controllers/helper_funcs.h" // getSecond
 
 #include "buffer.h"
-#include "converter.h"
-#include "debug.h"
-#include "language.h"
-#include "frnt_lang.h"
-#include "lyxlex.h"
-#include "lyxrc.h"
+#include "lastfiles.h"
 #include "LColor.h"
-#include "Lsstream.h"
-#include "funcrequest.h"
+#include "lyxfont.h"
 
-#include "support/lyxfunctional.h"
-#include "support/lyxmanip.h"
+#include "support/lstrings.h"
+#include "support/tostr.h"
+#include "support/path_defines.h"
 #include "support/filetools.h"
-#include "support/LAssert.h"
-
-#include "graphics/GraphicsCache.h"
-#include "graphics/GraphicsTypes.h"
 
-#include <boost/bind.hpp>
+#include "lyx_forms.h"
+#include "combox.h"
 
-#include FORMS_H_LOCATION
-#include <utility>
 #include <iomanip>
-#include <X11/Xlib.h>
 
 using std::endl;
-using std::pair;
 using std::make_pair;
 using std::max;
 using std::min;
+
+using std::pair;
 using std::vector;
-using std::setw;
-using std::setfill;
+using std::string;
 
-extern string system_lyxdir;
-extern string user_lyxdir;
+namespace lyx {
 
-namespace {
+using support::AddName;
+using support::ChangeExtension;
+using support::rtrim;
+using support::strToDbl;
+using support::trim;
+using support::user_lyxdir;
+
+namespace frontend {
 
-// These should probably go inside the class definition...
-Formats    local_formats;
-Converters local_converters;
+namespace {
 
 string makeFontName(string const & family, string const & foundry)
 {
@@ -88,19 +78,27 @@ pair<string,string> parseFontName(string const & name)
 }
 
 
+
+#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
+bool const scalableTabfolders = false;
+#else
+bool const scalableTabfolders = true;
+#endif
+
 } // namespace anon
 
 
-typedef FormCB<ControlPrefs, FormDB<FD_preferences> > base_class;
+typedef FormController<ControlPrefs, FormView<FD_preferences> > base_class;
 
-FormPreferences::FormPreferences()
-       : base_class(_("Preferences"), false),
-         colors_(*this), converters_(*this), inputs_misc_(*this),
-         formats_(*this), interface_(*this), language_(*this),
-         lnf_misc_(*this), outputs_misc_(*this), paths_(*this),
-         printer_(*this), screen_fonts_(*this), spelloptions_(*this)
-{
-}
+
+FormPreferences::FormPreferences(Dialog & parent)
+       : base_class(parent, _("Preferences"), scalableTabfolders),
+         colors_(*this), converters_(*this), copiers_(*this),
+         formats_(*this), identity_(*this), inputs_misc_(*this),
+         interface_(*this), language_(*this), lnf_misc_(*this),
+         outputs_misc_(*this), paths_(*this), printer_(*this),
+         screen_fonts_(*this), spelloptions_(*this)
+{}
 
 
 void FormPreferences::redraw()
@@ -142,7 +140,7 @@ void FormPreferences::hide()
        FL_FORM * inner_form = fl_get_active_folder(dialog_->tabfolder_prefs);
        if (inner_form && inner_form->visible)
                fl_hide_form(inner_form);
-       FormBase::hide();
+       FormDialogView::hide();
 }
 
 
@@ -151,10 +149,10 @@ void FormPreferences::build()
        dialog_.reset(build_preferences(this));
 
        // Manage the restore, save, apply and cancel/close buttons
-       bc().setOK(dialog_->button_ok);
-       bc().setApply(dialog_->button_apply);
-       bc().setCancel(dialog_->button_close);
-       bc().setRestore(dialog_->button_restore);
+       bcview().setOK(dialog_->button_ok);
+       bcview().setApply(dialog_->button_apply);
+       bcview().setCancel(dialog_->button_close);
+       bcview().setRestore(dialog_->button_restore);
 
        // Allow the base class to control messages
        setMessageWidget(dialog_->text_warning);
@@ -170,88 +168,111 @@ void FormPreferences::build()
        // these will become nested tabfolders
        colors_.build();
        converters_.build();
+       copiers_.build();
        formats_.build();
        inputs_misc_.build();
        interface_.build();
        language_.build();
        lnf_misc_.build();
+       identity_.build();
        outputs_misc_.build();
        paths_.build();
        printer_.build();
        screen_fonts_.build();
        spelloptions_.build();
 
+       // Enable the tabfolders to be rescaled correctly.
+       if (scalableTabfolders) {
+               FL_OBJECT * folder = dialog_->tabfolder_prefs;
+               fl_set_tabfolder_autofit(folder, FL_FIT);
+
+               folder = look_n_feel_tab_->tabfolder_inner;
+               fl_set_tabfolder_autofit(folder, FL_FIT);
+
+               folder = converters_tab_->tabfolder_inner;
+               fl_set_tabfolder_autofit(folder, FL_FIT);
+
+               folder = inputs_tab_->tabfolder_inner;
+               fl_set_tabfolder_autofit(folder, FL_FIT);
+
+               folder = outputs_tab_->tabfolder_inner;
+               fl_set_tabfolder_autofit(folder, FL_FIT);
+
+               folder = lang_opts_tab_->tabfolder_inner;
+               fl_set_tabfolder_autofit(folder, FL_FIT);
+       }
+
+       // Stack tabs
        // Now add them to the tabfolder
        fl_addto_tabfolder(dialog_->tabfolder_prefs,
-                          _("Look & Feel"),
+                          _("Look & Feel").c_str(),
                           look_n_feel_tab_->form);
        fl_addto_tabfolder(dialog_->tabfolder_prefs,
-                          _("Lang Opts"),
+                          _("Lang Opts").c_str(),
                           lang_opts_tab_->form);
        fl_addto_tabfolder(dialog_->tabfolder_prefs,
-                          _("Conversion"),
+                          _("Conversion").c_str(),
                           converters_tab_->form);
        fl_addto_tabfolder(dialog_->tabfolder_prefs,
-                          _("Inputs"),
+                          _("Inputs").c_str(),
                           inputs_tab_->form);
        fl_addto_tabfolder(dialog_->tabfolder_prefs,
-                          _("Outputs"),
+                          _("Outputs").c_str(),
                           outputs_tab_->form);
 
        // now build the nested tabfolders
        // Starting with look and feel
        fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
-                          _("Screen Fonts"),
+                          _("Screen Fonts").c_str(),
                           screen_fonts_.dialog()->form);
        fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
-                          _("Interface"),
+                          _("Interface").c_str(),
                           interface_.dialog()->form);
        fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
-                          _("Colors"),
+                          _("Colors").c_str(),
                           colors_.dialog()->form);
        fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
-                          _("Misc"),
+                          _("Misc").c_str(),
                           lnf_misc_.dialog()->form);
+       fl_addto_tabfolder(look_n_feel_tab_->tabfolder_inner,
+                          _("Identity").c_str(),
+                          identity_.dialog()->form);
 
        // then build converters
        fl_addto_tabfolder(converters_tab_->tabfolder_inner,
-                          _("Formats"),
+                          _("Formats").c_str(),
                           formats_.dialog()->form);
        fl_addto_tabfolder(converters_tab_->tabfolder_inner,
-                          _("Converters"),
+                          _("Converters").c_str(),
                           converters_.dialog()->form);
+       fl_addto_tabfolder(converters_tab_->tabfolder_inner,
+                          _("Copiers").c_str(),
+                          copiers_.dialog()->form);
 
        // then build inputs
        // Paths should probably go in a few inner_tab called Files
        fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
-                          _("Paths"),
+                          _("Paths").c_str(),
                           paths_.dialog()->form);
        fl_addto_tabfolder(inputs_tab_->tabfolder_inner,
-                          _("Misc"),
+                          _("Misc").c_str(),
                           inputs_misc_.dialog()->form);
 
        // then building outputs
        fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
-                          _("Printer"),
+                          _("Printer").c_str(),
                           printer_.dialog()->form);
        fl_addto_tabfolder(outputs_tab_->tabfolder_inner,
-                          _("Misc"),
+                          _("Misc").c_str(),
                           outputs_misc_.dialog()->form);
 
        // then building usage
        fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
-                          _("Spell checker"),
+                          _("Spell checker").c_str(),
                           spelloptions_.dialog()->form);
        fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
-                          _("Language"),
+                          _("Language").c_str(),
                           language_.dialog()->form);
-
-       // work-around xforms bug re update of folder->x, folder->y coords.
-       setPrehandler(look_n_feel_tab_->tabfolder_inner);
-       setPrehandler(converters_tab_->tabfolder_inner);
-       setPrehandler(inputs_tab_->tabfolder_inner);
-       setPrehandler(outputs_tab_->tabfolder_inner);
-       setPrehandler(lang_opts_tab_->tabfolder_inner);
 }
 
 
@@ -271,12 +292,11 @@ void FormPreferences::apply()
        LyXRC & rc(controller().rc());
 
        colors_.apply();
-       formats_.apply();    // Must be before converters_.apply()
-       converters_.apply();
        inputs_misc_.apply(rc);
        interface_.apply(rc);
        language_.apply(rc);
        lnf_misc_.apply(rc);
+       identity_.apply(rc);
        outputs_misc_.apply(rc);
        paths_.apply(rc);
        printer_.apply(rc);
@@ -284,9 +304,9 @@ void FormPreferences::apply()
        spelloptions_.apply(rc);
 
        // The "Save" button has been pressed.
-       if (controller().isClosing() && colors_.modifiedXformsPrefs) {
+       if (dialog().isClosing() && colors_.modifiedXformsPrefs) {
                string const filename =
-                       AddName(user_lyxdir, "preferences.xform");
+                       AddName(user_lyxdir(), "preferences.xform");
                colors_.modifiedXformsPrefs = !XformsColor::write(filename);
        }
 }
@@ -294,12 +314,14 @@ void FormPreferences::apply()
 
 string const FormPreferences::getFeedback(FL_OBJECT * ob)
 {
-       lyx::Assert(ob);
+       BOOST_ASSERT(ob);
 
        if (ob->form->fdui == colors_.dialog())
                return colors_.feedback(ob);
        if (ob->form->fdui == converters_.dialog())
                return converters_.feedback(ob);
+       if (ob->form->fdui == copiers_.dialog())
+               return copiers_.feedback(ob);
        if (ob->form->fdui == formats_.dialog())
                return formats_.feedback(ob);
        if (ob->form->fdui == inputs_misc_.dialog())
@@ -327,7 +349,7 @@ string const FormPreferences::getFeedback(FL_OBJECT * ob)
 
 ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long)
 {
-       lyx::Assert(ob);
+       BOOST_ASSERT(ob);
 
        bool valid = true;
 
@@ -339,6 +361,8 @@ ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long)
                colors_.input(ob);
        } else if (ob->form->fdui == converters_.dialog()) {
                valid = converters_.input(ob);
+       } else if (ob->form->fdui == copiers_.dialog()) {
+               valid = copiers_.input(ob);
        } else if (ob->form->fdui == formats_.dialog()) {
                valid = formats_.input(ob);
        } else if  (ob->form->fdui == interface_.dialog()) {
@@ -367,10 +391,12 @@ void FormPreferences::update()
        colors_.update();
        formats_.update();   // Must be before converters_.update()
        converters_.update();
+       copiers_.update();
        inputs_misc_.update(rc);
        interface_.update(rc);
        language_.update(rc);
        lnf_misc_.update(rc);
+       identity_.update(rc);
        outputs_misc_.update(rc);
        paths_.update(rc);
        printer_.update(rc);
@@ -439,7 +465,7 @@ void FormPreferences::Colors::apply()
        // Now do the same for the LyX LColors...
        for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
             cit != lyxColorDB.end(); ++cit) {
-               LColor::color lc = lcolor.getFromGUIName(cit->getname());
+               LColor::color lc = lcolor.getFromLyXName(cit->lyxname);
                if (lc == LColor::inherit) continue;
 
                // Create a valid X11 name of the form "#rrggbb"
@@ -461,48 +487,16 @@ void FormPreferences::Colors::apply()
 
 void FormPreferences::Colors::build()
 {
+       picker_.reset(new FormColorpicker);
        dialog_.reset(build_preferences_colors(&parent_));
 
        fl_set_object_color(dialog_->button_color,
                            GUI_COLOR_CHOICE, GUI_COLOR_CHOICE);
 
-       fl_set_object_color(dialog_->dial_hue, GUI_COLOR_HUE_DIAL, FL_BLACK);
-       fl_set_dial_bounds(dialog_->dial_hue, 0.0, 360.0);
-       fl_set_dial_step(dialog_->dial_hue, 1.0);
-       fl_set_dial_return(dialog_->dial_hue, FL_RETURN_CHANGED);
-
-       fl_set_slider_bounds(dialog_->slider_saturation, 0.0, 1.0);
-       fl_set_slider_step(dialog_->slider_saturation, 0.01);
-       fl_set_slider_return(dialog_->slider_saturation, FL_RETURN_CHANGED);
-
-       fl_set_slider_bounds(dialog_->slider_value, 0.0, 1.0);
-       fl_set_slider_step(dialog_->slider_value, 0.01);
-       fl_set_slider_return(dialog_->slider_value, FL_RETURN_CHANGED);
-
-       fl_set_slider_bounds(dialog_->slider_red, 0.0, 255.0);
-       fl_set_slider_step(dialog_->slider_red, 1.0);
-       fl_set_slider_return(dialog_->slider_red, FL_RETURN_CHANGED);
-
-       fl_set_slider_bounds(dialog_->slider_green, 0.0, 255.0);
-       fl_set_slider_step(dialog_->slider_green, 1.0);
-       fl_set_slider_return(dialog_->slider_green, FL_RETURN_CHANGED);
-
-       fl_set_slider_bounds(dialog_->slider_blue, 0.0, 255.0);
-       fl_set_slider_step(dialog_->slider_blue, 1.0);
-       fl_set_slider_return(dialog_->slider_blue, FL_RETURN_CHANGED);
-
        // set up the feedback mechanism
        setPrehandler(dialog_->browser_lyx_objs);
        setPrehandler(dialog_->button_color);
        setPrehandler(dialog_->button_modify);
-       setPrehandler(dialog_->dial_hue);
-       setPrehandler(dialog_->slider_saturation);
-       setPrehandler(dialog_->slider_value);
-       setPrehandler(dialog_->slider_red);
-       setPrehandler(dialog_->slider_green);
-       setPrehandler(dialog_->slider_blue);
-       setPrehandler(dialog_->radio_rgb);
-       setPrehandler(dialog_->radio_hsv);
 }
 
 
@@ -515,17 +509,6 @@ FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
        if (ob == dialog_->button_modify)
                return _("Modify the LyX object's color. Note: you must then \"Apply\" the change.");
 
-       if (ob == dialog_->dial_hue ||
-                 ob == dialog_->slider_saturation ||
-                 ob == dialog_->slider_value ||
-                 ob == dialog_->slider_red ||
-                 ob == dialog_->slider_green ||
-                 ob == dialog_->slider_blue)
-               return  _("Find a new color.");
-
-       if (ob == dialog_->radio_rgb || ob == dialog_->radio_hsv)
-               return _("Toggle between RGB and HSV color spaces.");
-
        return string();
 }
 
@@ -535,20 +518,6 @@ void FormPreferences::Colors::input(FL_OBJECT const * const ob)
        if (ob == dialog_->browser_lyx_objs) {
                InputBrowserLyX();
 
-       } else if (ob == dialog_->dial_hue ||
-                  ob == dialog_->slider_saturation ||
-                  ob == dialog_->slider_value) {
-               InputHSV();
-
-       } else if (ob == dialog_->slider_red ||
-                  ob == dialog_->slider_green ||
-                  ob == dialog_->slider_blue) {
-               InputRGB();
-
-       } else if (ob == dialog_->radio_rgb ||
-                  ob == dialog_->radio_hsv) {
-               SwitchColorSpace();
-
        } else if (ob == dialog_->button_modify) {
                Modify();
        }
@@ -595,106 +564,7 @@ void FormPreferences::Colors::InputBrowserLyX() const
        fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
        fl_redraw_object(dialog_->button_color);
 
-       // Display either RGB or HSV but not both!
-       SwitchColorSpace();
-
-       // Deactivate the modify button to begin with...
-       setEnabled(dialog_->button_modify, false);
-
-       fl_unfreeze_form(dialog_->form);
-}
-
-
-void FormPreferences::Colors::InputHSV()
-{
-       double const hue = fl_get_dial_value(dialog_->dial_hue);
-       double const sat = fl_get_slider_value(dialog_->slider_saturation);
-       double const val = fl_get_slider_value(dialog_->slider_value);
-
-       int const h = int(hue);
-       int const s = int(100.0 * sat);
-       int const v = int(100.0 * val);
-
-       string const label = tostr(h) + string(", ") + tostr(s) + string(", ") +
-               tostr(v);
-       fl_set_object_label(dialog_->text_color_values, label.c_str());
-
-       RGBColor col = HSVColor(hue, sat, val);
-
-       fl_freeze_form(dialog_->form);
-
-       fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
-       fl_redraw_object(dialog_->button_color);
-
-       col = HSVColor(hue, 1.0, 1.0);
-       col.r = max(col.r, 0);
-       fl_mapcolor(GUI_COLOR_HUE_DIAL, col.r, col.g, col.b);
-       fl_redraw_object(dialog_->dial_hue);
-
-       // Ascertain whether to activate the Modify button.
-       vector<NamedColor>::size_type const selLyX =
-               fl_get_browser(dialog_->browser_lyx_objs);
-
-       fl_unfreeze_form(dialog_->form);
-       if (selLyX < 1) return;
-
-       fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b);
-       bool modify = false;
-
-       // Is the choice an Xforms color...
-       if (selLyX - 1 < xformsColorDB.size()) {
-               vector<XformsColor>::size_type const i = selLyX - 1;
-               modify = (xformsColorDB[i].color() != col);
-       }
-       // or a LyX Logical color?
-       else {
-               vector<NamedColor>::size_type const i = selLyX - 1 -
-                       xformsColorDB.size();
-               modify = (lyxColorDB[i].color() != col);
-       }
-
-       setEnabled(dialog_->button_modify, modify);
-}
-
-
-void FormPreferences::Colors::InputRGB()
-{
-       int const red   = int(fl_get_slider_value(dialog_->slider_red));
-       int const green = int(fl_get_slider_value(dialog_->slider_green));
-       int const blue  = int(fl_get_slider_value(dialog_->slider_blue));
-
-       string const label = tostr(red) + string(", ") + tostr(green) +
-               string(", ") + tostr(blue);
-       fl_set_object_label(dialog_->text_color_values, label.c_str());
-
-       fl_freeze_form(dialog_->form);
-
-       RGBColor col = RGBColor(red, green, blue);
-       fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
-       fl_redraw_object(dialog_->button_color);
-
-       // Ascertain whether to activate the Modify button.
-       vector<NamedColor>::size_type const selLyX =
-               fl_get_browser(dialog_->browser_lyx_objs);
-
        fl_unfreeze_form(dialog_->form);
-       if (selLyX < 1) return;
-
-       bool modify = false;
-
-       // Is the choice an Xforms color...
-       if (selLyX - 1 < xformsColorDB.size()) {
-               vector<XformsColor>::size_type const i = selLyX - 1;
-               modify = (xformsColorDB[i].color() != col);
-       }
-       // or a LyX Logical color?
-       else {
-               vector<NamedColor>::size_type const i = selLyX - 1 -
-                       xformsColorDB.size();
-               modify = (lyxColorDB[i].color() != col);
-       }
-
-       setEnabled(dialog_->button_modify, modify);
 }
 
 
@@ -707,25 +577,29 @@ void FormPreferences::Colors::LoadBrowserLyX()
        xformsColorDB.clear();
        XformsColor xcol;
 
-       xcol.name = _("GUI background");
+       xcol.lyxname = "GUI background";
+       xcol.guiname = _("GUI background");
        xcol.colorID = FL_COL1;
        fl_getmcolor(FL_COL1, &xcol.r, &xcol.g, &xcol.b);
 
        xformsColorDB.push_back(xcol);
 
-       xcol.name = _("GUI text");
+       xcol.lyxname = "GUI text";
+       xcol.guiname = _("GUI text");
        xcol.colorID = FL_BLACK;
        fl_getmcolor(FL_BLACK, &xcol.r, &xcol.g, &xcol.b);
 
        xformsColorDB.push_back(xcol);
 
-       xcol.name = _("GUI selection");
+       xcol.lyxname = "GUI selection";
+       xcol.guiname = _("GUI selection");
        xcol.colorID = FL_YELLOW;
        fl_getmcolor(FL_YELLOW, &xcol.r, &xcol.g, &xcol.b);
 
        xformsColorDB.push_back(xcol);
 
-       xcol.name = _("GUI pointer");
+       xcol.lyxname = "GUI pointer";
+       xcol.guiname = _("GUI pointer");
        xcol.colorID = GUI_COLOR_CURSOR;
        fl_getmcolor(GUI_COLOR_CURSOR, &xcol.r, &xcol.g, &xcol.b);
 
@@ -747,16 +621,13 @@ void FormPreferences::Colors::LoadBrowserLyX()
                    || lc == LColor::inherit
                    || lc == LColor::ignore) continue;
 
-               string const name = lcolor.getX11Name(lc);
-               Display * display = fl_get_display();;
-               Colormap const colormap = fl_state[fl_get_vclass()].colormap;
-               XColor xcol, ccol;
-
-               if (XLookupColor(display, colormap, name.c_str(), &xcol, &ccol)
-                   == 0) {
+               RGBColor col;
+               bool const success = getRGBColor(lc, col.r, col.g, col.b);
+               if (!success) {
                        lyxerr << "FormPreferences::Colors::LoadBrowserLyX:\n"
                               << "LColor " << lcolor.getLyXName(lc)
-                              << ": X can't find color \"" << name
+                              << ": X can't find color \""
+                              << lcolor.getX11Name(lc)
                               << "\". Set to \"black\"!" << endl;
 
                        string const arg = lcolor.getLyXName(lc) + " black";
@@ -764,16 +635,6 @@ void FormPreferences::Colors::LoadBrowserLyX()
                        continue;
                }
 
-               // X has found the color. Now find the "appropriate" X11 name
-               // for this color.
-
-               // Note that X stores the RGB values in the range 0 - 65535
-               // whilst we require them in the range 0 - 255.
-               RGBColor col;
-               col.r = xcol.red   / 256;
-               col.g = xcol.green / 256;
-               col.b = xcol.blue  / 256;
-
                // Create a valid X11 name of the form "#rrggbb" and change the
                // LColor X11name to this. Don't want to trigger a redraw,
                // as we're just changing the name not the RGB values.
@@ -787,7 +648,7 @@ void FormPreferences::Colors::LoadBrowserLyX()
                }
 
                // Finally, push the color onto the database
-               NamedColor ncol(lcolor.getGUIName(lc), col);
+               NamedColor ncol(lcolor.getLyXName(lc), lcolor.getGUIName(lc), col);
                lyxColorDB.push_back(ncol);
        }
 
@@ -797,11 +658,11 @@ void FormPreferences::Colors::LoadBrowserLyX()
        fl_clear_browser(colbr);
        for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
             cit != xformsColorDB.end(); ++cit) {
-               fl_addto_browser(colbr, cit->getname().c_str());
+               fl_addto_browser(colbr, cit->guiname.c_str());
        }
        for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
             cit != lyxColorDB.end(); ++cit) {
-               fl_addto_browser(colbr, cit->getname().c_str());
+               fl_addto_browser(colbr, cit->guiname.c_str());
        }
 
        // just to be safe...
@@ -820,8 +681,15 @@ void FormPreferences::Colors::Modify()
        if (selLyX < 1)
                return;
 
-       RGBColor col;
-       fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b);
+       RGBColor before;
+       fl_getmcolor(GUI_COLOR_CHOICE, &before.r, &before.g, &before.b);
+
+       RGBColor col = picker_->requestColor(before);
+       if (before == col)
+               return;
+
+       fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
+       fl_redraw_object(dialog_->button_color);
 
        // Is the choice an Xforms color...
        if (selLyX - 1 < xformsColorDB.size()) {
@@ -838,86 +706,6 @@ void FormPreferences::Colors::Modify()
                lyxColorDB[i].g  = col.g;
                lyxColorDB[i].b  = col.b;
        }
-
-       fl_freeze_form(dialog_->form);
-       setEnabled(dialog_->button_modify, false);
-       fl_unfreeze_form(dialog_->form);
-}
-
-
-void FormPreferences::Colors::SwitchColorSpace() const
-{
-       bool const hsv = fl_get_button(dialog_->radio_hsv);
-
-       RGBColor col;
-       fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b);
-
-       fl_freeze_form(dialog_->form);
-
-       if (hsv) {
-               fl_hide_object(dialog_->slider_red);
-               fl_hide_object(dialog_->slider_blue);
-               fl_hide_object(dialog_->slider_green);
-               fl_show_object(dialog_->dial_hue);
-               fl_show_object(dialog_->slider_saturation);
-               fl_show_object(dialog_->slider_value);
-
-               HSVColor hsv = HSVColor(col);
-               hsv.h = max(hsv.h, 0.0);
-
-               fl_set_dial_value(dialog_->dial_hue, hsv.h);
-               fl_set_slider_value(dialog_->slider_saturation, hsv.s);
-               fl_set_slider_value(dialog_->slider_value, hsv.v);
-
-               col = HSVColor(hsv.h, 1.0, 1.0);
-               col.r = max(col.r, 0);
-               fl_mapcolor(GUI_COLOR_HUE_DIAL, col.r, col.g, col.b);
-               fl_redraw_object(dialog_->dial_hue);
-
-               // Adjust the label a bit, but not the actual values.
-               // Means that toggling from one space to the other has no
-               // effect on the final color.
-               int const h = int(hsv.h);
-               int const s = int(100 * hsv.s);
-               int const v = int(100 * hsv.v);
-               string const label = tostr(h) + ", " + tostr(s) +
-                       ", " + tostr(v);
-               fl_set_object_label(dialog_->text_color_values, label.c_str());
-
-       } else {
-               fl_show_object(dialog_->slider_red);
-               fl_show_object(dialog_->slider_blue);
-               fl_show_object(dialog_->slider_green);
-               fl_hide_object(dialog_->dial_hue);
-               fl_hide_object(dialog_->slider_saturation);
-               fl_hide_object(dialog_->slider_value);
-
-               fl_set_slider_value(dialog_->slider_red,   col.r);
-               fl_set_slider_value(dialog_->slider_green, col.g);
-               fl_set_slider_value(dialog_->slider_blue,  col.b);
-
-               // Adjust the label a bit. Same reasoning as above.
-               int const r = int(col.r);
-               int const g = int(col.g);
-               int const b = int(col.b);
-               string const label = tostr(r) + ", " + tostr(g) +
-                       ", " + tostr(b);
-               fl_set_object_label(dialog_->text_color_values, label.c_str());
-       }
-
-       fl_unfreeze_form(dialog_->form);
-}
-
-string const FormPreferences::Colors::X11hexname(RGBColor const & col) const
-{
-       ostringstream ostr;
-
-       ostr << '#' << std::setbase(16) << setfill('0')
-            << setw(2) << col.r
-            << setw(2) << col.g
-            << setw(2) << col.b;
-
-       return STRCONV(ostr.str());
 }
 
 
@@ -932,9 +720,15 @@ FD_preferences_converters const * FormPreferences::Converters::dialog()
 }
 
 
-void FormPreferences::Converters::apply() const
+::Converters & FormPreferences::Converters::converters()
 {
-       parent_.controller().setConverters(local_converters);
+       return parent_.controller().converters();
+}
+
+
+::Formats & FormPreferences::Converters::formats()
+{
+       return parent_.controller().formats();
 }
 
 
@@ -960,7 +754,7 @@ string const
 FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const
 {
        if (ob == dialog_->browser_all)
-               return _("All the currently defined converters known to LyX.");
+               return _("All explicitly defined converters for LyX");
 
        if (ob == dialog_->choice_from)
                return _("Convert \"from\" this format");
@@ -1001,9 +795,9 @@ bool FormPreferences::Converters::input(FL_OBJECT const * const ob)
                return Browser();
 
        if (ob == dialog_->choice_from
-                  || ob == dialog_->choice_to
-                  || ob == dialog_->input_converter
-                  || ob == dialog_->input_flags)
+           || ob == dialog_->choice_to
+           || ob == dialog_->input_converter
+           || ob == dialog_->input_flags)
                return Input();
 
        if (ob == dialog_->button_add)
@@ -1018,20 +812,18 @@ bool FormPreferences::Converters::input(FL_OBJECT const * const ob)
 
 void FormPreferences::Converters::update()
 {
-       local_converters = converters;
-       local_converters.update(local_formats);
        UpdateBrowser();
 }
 
 
 void FormPreferences::Converters::UpdateBrowser()
 {
-       local_converters.sort();
+       converters().sort();
 
        fl_freeze_form(dialog_->form);
        fl_clear_browser(dialog_->browser_all);
-       for (::Converters::const_iterator cit = local_converters.begin();
-            cit != local_converters.end(); ++cit) {
+       for (::Converters::const_iterator cit = converters().begin();
+            cit != converters().end(); ++cit) {
                string const name = cit->From->prettyname() + " -> "
                        + cit->To->prettyname();
                fl_addto_browser(dialog_->browser_all, name.c_str());
@@ -1048,10 +840,10 @@ bool FormPreferences::Converters::Add()
        string const command = fl_get_input(dialog_->input_converter);
        string const flags = fl_get_input(dialog_->input_flags);
 
-       Converter const * old = local_converters.getConverter(from, to);
-       local_converters.add(from, to, command, flags);
+       Converter const * old = converters().getConverter(from, to);
+       converters().add(from, to, command, flags);
        if (!old) {
-               local_converters.updateLast(local_formats);
+               converters().updateLast(formats());
                UpdateBrowser();
        }
        setEnabled(dialog_->button_add, false);
@@ -1067,12 +859,12 @@ bool FormPreferences::Converters::Browser()
 
        fl_freeze_form(dialog_->form);
 
-       Converter const & c = local_converters.get(i - 1);
-       int j = local_formats.getNumber(c.from);
+       Converter const & c = converters().get(i - 1);
+       int j = formats().getNumber(c.from);
        if (j >= 0)
                fl_set_choice(dialog_->choice_from, j + 1);
 
-       j = local_formats.getNumber(c.to);
+       j = formats().getNumber(c.to);
        if (j >= 0)
                fl_set_choice(dialog_->choice_to, j + 1);
 
@@ -1096,7 +888,7 @@ bool FormPreferences::Converters::erase()
        string const from = GetFrom();
        string const to = GetTo();
 
-       local_converters.erase(from, to);
+       converters().erase(from, to);
        UpdateBrowser();
        return true;
 }
@@ -1106,7 +898,7 @@ bool FormPreferences::Converters::Input()
 {
        string const from = GetFrom();
        string const to = GetTo();
-       int const sel = local_converters.getNumber(from, to);
+       int const sel = converters().getNumber(from, to);
 
        fl_freeze_form(dialog_->form);
 
@@ -1140,37 +932,37 @@ bool FormPreferences::Converters::Input()
 }
 
 
-string const FormPreferences::Converters::GetFrom() const
+string const FormPreferences::Converters::GetFrom()
 {
        ::Formats::FormatList::size_type const i =
-               fl_get_choice(dialog_->choice_from);
+                 fl_get_choice(dialog_->choice_from);
 
-       if (i > 0 && i <= local_formats.size())
-               return local_formats.get(i - 1).name();
+       if (i > 0 && i <= formats().size())
+               return formats().get(i - 1).name();
 
        lyxerr << "FormPreferences::Converters::GetFrom: No choice!" << endl;
        return "???";
 }
 
 
-string const FormPreferences::Converters::GetTo() const
+string const FormPreferences::Converters::GetTo()
 {
        ::Formats::FormatList::size_type const i =
-               fl_get_choice(dialog_->choice_to);
+                 fl_get_choice(dialog_->choice_to);
 
-       if (i > 0 && i <= local_formats.size())
-               return local_formats.get(i - 1).name();
+       if (i > 0 && i <= formats().size())
+               return formats().get(i - 1).name();
 
        lyxerr << "FormPreferences::Converters::GetTo: No choice!" << endl;
        return "???";
 }
 
 
-void FormPreferences::Converters::UpdateChoices() const
+void FormPreferences::Converters::UpdateChoices()
 {
        string choice;
-       for (::Formats::const_iterator cit = local_formats.begin();
-            cit != local_formats.end(); ++cit) {
+       for (::Formats::const_iterator cit = formats().begin();
+            cit != formats().end(); ++cit) {
                if (!choice.empty())
                        choice += " | ";
                else
@@ -1187,6 +979,292 @@ void FormPreferences::Converters::UpdateChoices() const
 }
 
 
+FormPreferences::Copiers::Copiers(FormPreferences & p)
+       : parent_(p)
+{}
+
+
+FD_preferences_copiers const * FormPreferences::Copiers::dialog()
+{
+       return dialog_.get();
+}
+
+
+::Movers & FormPreferences::Copiers::movers()
+{
+       return parent_.controller().movers();
+}
+
+
+void FormPreferences::Copiers::build()
+{
+       dialog_.reset(build_preferences_copiers(&parent_));
+
+       fl_set_input_return(dialog_->input_copier, FL_RETURN_CHANGED);
+
+       // set up the feedback mechanism
+       setPrehandler(dialog_->browser_all);
+       setPrehandler(dialog_->button_delete);
+       setPrehandler(dialog_->button_add);
+       setPrehandler(dialog_->choice_format);
+       setPrehandler(dialog_->input_copier);
+}
+
+
+string const
+FormPreferences::Copiers::feedback(FL_OBJECT const * const ob) const
+{
+       if (ob == dialog_->browser_all)
+               return _("All explicitly defined copiers for LyX");
+
+       if (ob == dialog_->choice_format)
+               return _("Copier for this format");
+
+       if (ob == dialog_->input_copier)
+
+               return _("The command used to copy the file. "
+                        "$$i is the \"from\" file name and "
+                        "$$o is the \"to\" file name.\n"
+                        "$$s can be used as path to "
+                        "LyX's own collection of scripts.");
+
+       if (ob == dialog_->button_delete)
+               return _("Remove the current copier from the list of available "
+                        "copiers. Note: you must then \"Apply\" the change.");
+
+       if (ob == dialog_->button_add) {
+               if (string(ob->label) == _("Add"))
+                       return _("Add the current copier to the list of available "
+                                "copiers. Note: you must then \"Apply\" the change.");
+               else
+                       return _("Modify the contents of the current copier. "
+                                "Note: you must then \"Apply\" the change.");
+       }
+
+       return string();
+}
+
+
+bool FormPreferences::Copiers::input(FL_OBJECT const * const ob)
+{
+       if (ob == dialog_->browser_all)
+               return Browser();
+
+       if (ob == dialog_->choice_format
+           || ob == dialog_->input_copier)
+               return Input();
+
+       if (ob == dialog_->button_add)
+               return Add();
+
+       if (ob == dialog_->button_delete)
+               return Erase();
+
+       return true;
+}
+
+
+void FormPreferences::Copiers::update()
+{
+       // Build data for the browser widget
+       Movers::iterator const begin = movers().begin();
+       Movers::iterator const end = movers().end();
+
+       vector<string> fmts;
+       fmts.reserve(std::distance(begin, end));
+       for (Movers::iterator it = begin; it != end; ++it) {
+               std::string const & command = it->second.command();
+               if (command.empty())
+                       continue;
+               std::string const & fmt = it->first;
+               fmts.push_back(::formats.prettyName(fmt));
+       }
+
+       std::sort(fmts.begin(), fmts.end());
+
+       // Build data for the choice widget
+       string choice;
+       for (::Formats::const_iterator it = ::formats.begin();
+            it != ::formats.end(); ++it) {
+               if (!choice.empty())
+                       choice += " | ";
+               else
+                       choice += ' ';
+               choice += it->prettyname();
+       }
+       choice += ' ';
+
+       // The input widget
+       fl_freeze_form(dialog_->form);
+       fl_set_input(dialog_->input_copier, "");
+
+       // The browser widget
+       fl_clear_browser(dialog_->browser_all);
+
+       vector<string>::const_iterator it = fmts.begin();
+       vector<string>::const_iterator const fmts_end = fmts.end();
+       for (; it != fmts_end; ++it)
+               fl_addto_browser(dialog_->browser_all, it->c_str());
+
+       // The choice widget
+       fl_clear_choice(dialog_->choice_format);
+       fl_addto_choice(dialog_->choice_format, choice.c_str());
+       fl_set_choice(dialog_->choice_format, 1);
+
+       Input();
+       fl_unfreeze_form(dialog_->form);
+}
+
+
+namespace {
+
+struct SamePrettyName {
+       SamePrettyName(string const & n) : pretty_name_(n) {}
+
+       bool operator()(::Format const & fmt) const {
+               return fmt.prettyname() == pretty_name_;
+       }
+
+private:
+       string const pretty_name_;
+};
+
+
+::Format const * getFormat(std::string const & prettyname)
+{
+       ::Formats::const_iterator it = ::formats.begin();
+       ::Formats::const_iterator const end = ::formats.end();
+       it = std::find_if(it, end, SamePrettyName(prettyname));
+       return it == end ? 0 : &*it;
+}
+
+} // namespace anon
+
+
+bool FormPreferences::Copiers::Add()
+{
+       ::Format const * fmt = getFormat(getString(dialog_->choice_format));
+       if (fmt == 0)
+               return false;
+
+       string const command = getString(dialog_->input_copier);
+       if (command.empty())
+               return false;
+
+       fl_freeze_form(dialog_->form);
+
+       movers().set(fmt->name(), command);
+       update();
+       setEnabled(dialog_->button_add, false);
+
+       fl_unfreeze_form(dialog_->form);
+       return true;
+}
+
+
+bool FormPreferences::Copiers::Browser()
+{
+       int const i = fl_get_browser(dialog_->browser_all);
+       if (i <= 0) return false;
+
+       ::Format const * fmt = getFormat(getString(dialog_->browser_all, i));
+       if (fmt == 0)
+               return false;
+
+       string const & fmt_name = fmt->name();
+       string const & gui_name = fmt->prettyname();
+       string const & command = movers().command(fmt_name);
+
+       fl_freeze_form(dialog_->form);
+
+       int const choice_size = fl_get_choice_maxitems(dialog_->choice_format);
+       for (int i = 1; i <= choice_size; ++i) {
+               char const * const c_str =
+                       fl_get_choice_item_text(dialog_->choice_format, i);
+               string const line = c_str ? trim(c_str) : string();
+               if (line == gui_name) {
+                       fl_set_choice(dialog_->choice_format, i);
+                       break;
+               }
+       }
+
+       fl_set_input(dialog_->input_copier, command.c_str());
+
+       fl_set_object_label(dialog_->button_add, idex(_("Modify|#M")).c_str());
+       fl_set_button_shortcut(dialog_->button_add,
+                              scex(_("Modify|#M")).c_str(), 1);
+
+       setEnabled(dialog_->button_add,    false);
+       setEnabled(dialog_->button_delete, true);
+
+       fl_unfreeze_form(dialog_->form);
+       return false;
+}
+
+
+bool FormPreferences::Copiers::Erase()
+{
+       ::Format const * fmt = getFormat(getString(dialog_->choice_format));
+       if (fmt == 0)
+               return false;
+
+       string const & fmt_name = fmt->name();
+
+       movers().set(fmt_name, string());
+       update();
+       return true;
+}
+
+
+bool FormPreferences::Copiers::Input()
+{
+       ::Format const * fmt = getFormat(getString(dialog_->choice_format));
+       if (fmt == 0)
+               return false;
+
+       string const & gui_name = fmt->prettyname();
+       string const command = getString(dialog_->input_copier);
+
+       fl_freeze_form(dialog_->form);
+       fl_deselect_browser(dialog_->browser_all);
+       bool found_line = false;
+       int const browser_size = fl_get_browser_maxline(dialog_->browser_all);
+       for (int i = 1; i <= browser_size; ++i) {
+               char const * const c_str =
+                       fl_get_browser_line(dialog_->browser_all, i);
+               string const line = c_str ? trim(c_str) : string();
+               if (line == gui_name) {
+                       fl_select_browser_line(dialog_->browser_all, i);
+                       int top = max(i-5, 1);
+                       fl_set_browser_topline(dialog_->browser_all, top);
+                       found_line = true;
+                       break;
+               }
+       }
+
+       if (!found_line) {
+               fl_set_object_label(dialog_->button_add,
+                                   idex(_("Add|#A")).c_str());
+               fl_set_button_shortcut(dialog_->button_add,
+                                      scex(_("Add|#A")).c_str(), 1);
+
+               setEnabled(dialog_->button_delete, false);
+       } else {
+               fl_set_object_label(dialog_->button_add,
+                                   idex(_("Modify|#M")).c_str());
+               fl_set_button_shortcut(dialog_->button_add,
+                                      scex(_("Modify|#M")).c_str(), 1);
+
+               setEnabled(dialog_->button_delete, true);
+       }
+
+       setEnabled(dialog_->button_add, !command.empty());
+
+       fl_unfreeze_form(dialog_->form);
+       return false;
+}
+
+
 FormPreferences::Formats::Formats(FormPreferences &  p)
        : parent_(p)
 {}
@@ -1198,9 +1276,15 @@ FD_preferences_formats const * FormPreferences::Formats::dialog()
 }
 
 
-void FormPreferences::Formats::apply() const
+::Converters & FormPreferences::Formats::converters()
 {
-       parent_.controller().setFormats(local_formats);
+       return parent_.controller().converters();
+}
+
+
+::Formats & FormPreferences::Formats::formats()
+{
+       return parent_.controller().formats();
 }
 
 
@@ -1210,6 +1294,7 @@ void FormPreferences::Formats::build()
 
        fl_set_input_return(dialog_->input_format, FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_viewer, FL_RETURN_CHANGED);
+       fl_set_input_return(dialog_->input_editor, FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_shrtcut, FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_gui_name, FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_extension, FL_RETURN_CHANGED);
@@ -1224,6 +1309,7 @@ void FormPreferences::Formats::build()
        setPrehandler(dialog_->button_add);
        setPrehandler(dialog_->input_extension);
        setPrehandler(dialog_->input_viewer);
+       setPrehandler(dialog_->input_editor);
        setPrehandler(dialog_->input_shrtcut);
 }
 
@@ -1250,6 +1336,9 @@ FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
        if (ob == dialog_->input_viewer)
                return  _("The command used to launch the viewer application.");
 
+       if (ob == dialog_->input_editor)
+               return  _("The command used to launch the editor application.");
+
        if (ob == dialog_->button_delete)
                return  _("Remove the current format from the list of available "
                          "formats. Note: you must then \"Apply\" the change.");
@@ -1273,10 +1362,11 @@ bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
                return Browser();
 
        if (ob == dialog_->input_format
-        || ob == dialog_->input_gui_name
-        || ob == dialog_->input_shrtcut
-        || ob == dialog_->input_extension
-        || ob == dialog_->input_viewer)
+           || ob == dialog_->input_gui_name
+           || ob == dialog_->input_shrtcut
+           || ob == dialog_->input_extension
+           || ob == dialog_->input_viewer
+           || ob == dialog_->input_editor)
                return Input();
 
        if (ob == dialog_->button_add)
@@ -1291,20 +1381,19 @@ bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
 
 void FormPreferences::Formats::update()
 {
-       local_formats = formats;
        UpdateBrowser();
 }
 
 
 void FormPreferences::Formats::UpdateBrowser()
 {
-       local_formats.sort();
+       formats().sort();
 
        fl_freeze_form(dialog_->form);
        fl_deselect_browser(dialog_->browser_all);
        fl_clear_browser(dialog_->browser_all);
-       for (::Formats::const_iterator cit = local_formats.begin();
-            cit != local_formats.end(); ++cit)
+       for (::Formats::const_iterator cit = formats().begin();
+            cit != formats().end(); ++cit)
                fl_addto_browser(dialog_->browser_all,
                                 cit->prettyname().c_str());
 
@@ -1313,7 +1402,7 @@ void FormPreferences::Formats::UpdateBrowser()
 
        // Mustn't forget to update the Formats available to the converters_
        parent_.converters_.UpdateChoices();
-       local_converters.update(local_formats);
+       converters().update(formats());
 }
 
 
@@ -1324,11 +1413,11 @@ bool FormPreferences::Formats::Add()
        string const extension = fl_get_input(dialog_->input_extension);
        string const shortcut =  fl_get_input(dialog_->input_shrtcut);
        string const viewer =  fl_get_input(dialog_->input_viewer);
+       string const editor =  fl_get_input(dialog_->input_editor);
 
-       Format const * old = local_formats.getFormat(name);
+       Format const * old = formats().getFormat(name);
        string const old_prettyname = old ? old->prettyname() : string();
-       local_formats.add(name, extension, prettyname, shortcut);
-       local_formats.setViewer(name, viewer);
+       formats().add(name, extension, prettyname, shortcut, viewer, editor);
        if (!old || prettyname != old_prettyname) {
                UpdateBrowser();
                if (old)
@@ -1348,13 +1437,14 @@ bool FormPreferences::Formats::Browser()
 
        fl_freeze_form(dialog_->form);
 
-       Format const & f = local_formats.get(i - 1);
+       Format const & f = formats().get(i - 1);
 
        fl_set_input(dialog_->input_format, f.name().c_str());
        fl_set_input(dialog_->input_gui_name, f.prettyname().c_str());
        fl_set_input(dialog_->input_shrtcut, f.shortcut().c_str());
        fl_set_input(dialog_->input_extension, f.extension().c_str());
        fl_set_input(dialog_->input_viewer, f.viewer().c_str());
+       fl_set_input(dialog_->input_editor, f.editor().c_str());
 
        fl_set_object_label(dialog_->button_add,
                            idex(_("Modify|#M")).c_str());
@@ -1373,14 +1463,14 @@ bool FormPreferences::Formats::erase()
 {
        string const name = fl_get_input(dialog_->input_format);
 
-       if (local_converters.formatIsUsed(name)) {
+       if (converters().formatIsUsed(name)) {
                parent_.postWarning(_("Cannot remove a Format used by a Converter. "
                                      "Remove the converter first."));
                setEnabled(dialog_->button_delete, false);
                return false;
        }
 
-       local_formats.erase(name);
+       formats().erase(name);
        UpdateBrowser();
        return true;
 }
@@ -1389,7 +1479,7 @@ bool FormPreferences::Formats::erase()
 bool FormPreferences::Formats::Input()
 {
        string const name = fl_get_input(dialog_->input_format);
-       int const sel = local_formats.getNumber(name);
+       int const sel = formats().getNumber(name);
        fl_freeze_form(dialog_->form);
 
        if (sel < 0) {
@@ -1424,6 +1514,39 @@ bool FormPreferences::Formats::Input()
 }
 
 
+FormPreferences::Identity::Identity(FormPreferences & p)
+       : parent_(p)
+{}
+
+
+FD_preferences_identity const * FormPreferences::Identity::dialog()
+{
+       return dialog_.get();
+}
+
+
+void FormPreferences::Identity::apply(LyXRC & rc) const
+{
+       rc.user_name = fl_get_input(dialog_->input_user_name);
+       rc.user_email = fl_get_input(dialog_->input_user_email);
+}
+
+
+void FormPreferences::Identity::build()
+{
+       dialog_.reset(build_preferences_identity(&parent_));
+       fl_set_input_return(dialog_->input_user_name, FL_RETURN_CHANGED);
+       fl_set_input_return(dialog_->input_user_email, FL_RETURN_CHANGED);
+}
+
+
+void FormPreferences::Identity::update(LyXRC const & rc)
+{
+       fl_set_input(dialog_->input_user_name, rc.user_name.c_str());
+       fl_set_input(dialog_->input_user_email, rc.user_email.c_str());
+}
+
+
 FormPreferences::InputsMisc::InputsMisc(FormPreferences &  p)
        : parent_(p)
 {}
@@ -1576,7 +1699,7 @@ FD_preferences_language const * FormPreferences::Language::dialog()
 
 void FormPreferences::Language::apply(LyXRC & rc)
 {
-       int const pos = combo_default_lang->get();
+       int const pos = fl_get_combox(dialog_->combox_default_lang);
        rc.default_language = lang_[pos-1];
 
        int button = fl_get_button(dialog_->check_use_kbmap);
@@ -1627,41 +1750,21 @@ void FormPreferences::Language::build()
        fl_set_input_return(dialog_->input_command_end, FL_RETURN_CHANGED);
 
        // Store the lang identifiers for later
-       vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
+       vector<LanguagePair> const langs = getLanguageData(false);
        lang_ = getSecond(langs);
 
-       // The default_language is a combo-box and has to be inserted manually
-       fl_freeze_form(dialog_->form);
-       fl_addto_form(dialog_->form);
-
-       FL_OBJECT * obj = dialog_->choice_default_lang;
-       fl_deactivate_object(dialog_->choice_default_lang);
-       combo_default_lang.reset(new Combox(FL_COMBOX_DROPLIST));
-       combo_default_lang->add(obj->x, obj->y, obj->w, obj->h, 400);
-       combo_default_lang->shortcut("#L",1);
-       combo_default_lang->setcallback(ComboCB, &parent_);
-
-       vector<frnt::LanguagePair>::const_iterator lit  = langs.begin();
-       vector<frnt::LanguagePair>::const_iterator lend = langs.end();
+       FL_OBJECT * obj = dialog_->combox_default_lang;
+       vector<LanguagePair>::const_iterator lit  = langs.begin();
+       vector<LanguagePair>::const_iterator lend = langs.end();
        for (; lit != lend; ++lit) {
-               combo_default_lang->addto(lit->first);
+               fl_addto_combox(obj, lit->first.c_str());
        }
-       combo_default_lang->select(1);
-
-       fl_end_form();
-       fl_unfreeze_form(dialog_->form);
+       fl_set_combox_browser_height(obj, 400);
 
        // set up the feedback mechanism
        setPrehandler(dialog_->input_package);
        setPrehandler(dialog_->check_use_kbmap);
-
-       // This is safe, as nothing is done to the pointer, other than
-       // to use its address in a block-if statement.
-       // No it's not! Leads to crash.
-       // setPrehandler(
-       //              reinterpret_cast<FL_OBJECT *>(combo_default_lang),
-       //              C_FormPreferencesFeedbackCB);
-
+       setPrehandler(dialog_->combox_default_lang);
        setPrehandler(dialog_->input_kbmap1);
        setPrehandler(dialog_->input_kbmap2);
        setPrehandler(dialog_->check_rtl_support);
@@ -1682,7 +1785,7 @@ void FormPreferences::Language::build()
 string const
 FormPreferences::Language::feedback(FL_OBJECT const * const ob) const
 {
-       if (reinterpret_cast<Combox const *>(ob) == combo_default_lang.get())
+       if (ob == dialog_->combox_default_lang)
                return LyXRC::getDescription(LyXRC::RC_DEFAULT_LANGUAGE);
        if (ob == dialog_->check_use_kbmap)
                return LyXRC::getDescription(LyXRC::RC_KBMAP);
@@ -1749,7 +1852,7 @@ void FormPreferences::Language::update(LyXRC const & rc)
                      rc.use_kbmap);
 
        int const pos = int(findPos(lang_, rc.default_language));
-       combo_default_lang->select(pos + 1);
+       fl_set_combox(dialog_->combox_default_lang, pos + 1);
 
        if (rc.use_kbmap) {
                fl_set_input(dialog_->input_kbmap1,
@@ -1783,15 +1886,6 @@ void FormPreferences::Language::update(LyXRC const & rc)
 }
 
 
-void FormPreferences::Language::ComboCB(int, void * v, Combox * combox)
-{
-       FormPreferences * pre = static_cast<FormPreferences*>(v);
-       // This is safe, as nothing is done to the pointer, other than
-       // to use its address in a block-if statement.
-       pre->bc().valid(pre->input(reinterpret_cast<FL_OBJECT *>(combox), 0));
-}
-
-
 FormPreferences::LnFmisc::LnFmisc(FormPreferences &  p)
        : parent_(p)
 {}
@@ -1811,20 +1905,42 @@ void FormPreferences::LnFmisc::apply(LyXRC & rc) const
                fl_get_button(dialog_->check_cursor_follows_scrollbar);
        rc.dialogs_iconify_with_main =
                fl_get_button(dialog_->check_dialogs_iconify_with_main);
-       rc.preview = fl_get_button(dialog_->check_preview_latex);
+
+       switch (fl_get_choice(dialog_->choice_instant_preview)) {
+       case 1:
+               rc.preview = LyXRC::PREVIEW_OFF;
+               break;
+       case 2:
+               rc.preview = LyXRC::PREVIEW_NO_MATH;
+               break;
+       case 3:
+               rc.preview = LyXRC::PREVIEW_ON;
+               break;
+       }
+
        rc.autosave = static_cast<unsigned int>
                (fl_get_counter_value(dialog_->counter_autosave));
        rc.wheel_jump = static_cast<unsigned int>
                (fl_get_counter_value(dialog_->counter_wm_jump));
 
        // See FIXME below
-       // grfx::DisplayType old_value = rc.display_graphics;
-       switch (fl_get_choice(dialog_->choice_display)) {
-               case 4: rc.display_graphics = grfx::NoDisplay; break;
-               case 3: rc.display_graphics = grfx::ColorDisplay; break;
-               case 2: rc.display_graphics = grfx::GrayscaleDisplay; break;
-               case 1: rc.display_graphics = grfx::MonochromeDisplay; break;
-               default: rc.display_graphics = grfx::ColorDisplay; break;
+       // graphics::DisplayType old_value = rc.display_graphics;
+       switch (fl_get_choice(dialog_->choice_graphics_display)) {
+       case 4:
+               rc.display_graphics = graphics::NoDisplay;
+               break;
+       case 3:
+               rc.display_graphics = graphics::ColorDisplay;
+               break;
+       case 2:
+               rc.display_graphics = graphics::GrayscaleDisplay;
+               break;
+       case 1:
+               rc.display_graphics = graphics::MonochromeDisplay;
+               break;
+       default:
+               rc.display_graphics = graphics::ColorDisplay;
+               break;
        }
 
 #ifdef WITH_WARNINGS
@@ -1832,7 +1948,7 @@ void FormPreferences::LnFmisc::apply(LyXRC & rc) const
 #endif
 #if 0
        if (old_value != rc.display_graphics) {
-               grfx::GCache & gc = grfx::GCache::get();
+               graphics::GCache & gc = graphics::GCache::get();
                gc.changeDisplay();
        }
 #endif
@@ -1854,10 +1970,14 @@ void FormPreferences::LnFmisc::build()
        setPrehandler(dialog_->counter_autosave);
        setPrehandler(dialog_->check_cursor_follows_scrollbar);
        setPrehandler(dialog_->check_dialogs_iconify_with_main);
-       setPrehandler(dialog_->check_preview_latex);
+       setPrehandler(dialog_->choice_instant_preview);
        setPrehandler(dialog_->counter_wm_jump);
 
-       fl_addto_choice(dialog_->choice_display, _("Monochrome|Grayscale|Color|Do not display"));
+       fl_addto_choice(dialog_->choice_graphics_display,
+                       _("Monochrome|Grayscale|Color|Do not display").c_str());
+
+       fl_addto_choice(dialog_->choice_instant_preview,
+                       _("Off|No math|On").c_str());
 }
 
 
@@ -1870,13 +1990,13 @@ FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const
                return LyXRC::getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR);
        if (ob == dialog_->check_dialogs_iconify_with_main)
                return LyXRC::getDescription(LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN);
-       if (ob == dialog_->check_preview_latex)
+       if (ob == dialog_->choice_instant_preview)
                return LyXRC::getDescription(LyXRC::RC_PREVIEW);
        if (ob == dialog_->counter_autosave)
                return LyXRC::getDescription(LyXRC::RC_AUTOSAVE);
        if (ob == dialog_->counter_wm_jump)
                return LyXRC::getDescription(LyXRC::RC_WHEEL_JUMP);
-       if (ob == dialog_->choice_display)
+       if (ob == dialog_->choice_graphics_display)
                return LyXRC::getDescription(LyXRC::RC_DISPLAY_GRAPHICS);
        return string();
 }
@@ -1890,17 +2010,38 @@ void FormPreferences::LnFmisc::update(LyXRC const & rc)
                      rc.cursor_follows_scrollbar);
        fl_set_button(dialog_->check_dialogs_iconify_with_main,
                      rc.dialogs_iconify_with_main);
-       fl_set_button(dialog_->check_preview_latex,
-                     rc.preview);
+
+       switch (rc.preview) {
+       case LyXRC::PREVIEW_OFF:
+               fl_set_choice(dialog_->choice_instant_preview, 1);
+               break;
+       case LyXRC::PREVIEW_NO_MATH:
+               fl_set_choice(dialog_->choice_instant_preview, 2);
+               break;
+       case LyXRC::PREVIEW_ON:
+               fl_set_choice(dialog_->choice_instant_preview, 3);
+               break;
+       }
+
        fl_set_counter_value(dialog_->counter_autosave, rc.autosave);
        fl_set_counter_value(dialog_->counter_wm_jump, rc.wheel_jump);
 
        switch (rc.display_graphics) {
-               case grfx::NoDisplay:           fl_set_choice(dialog_->choice_display, 4); break;
-               case grfx::ColorDisplay:        fl_set_choice(dialog_->choice_display, 3); break;
-               case grfx::GrayscaleDisplay:    fl_set_choice(dialog_->choice_display, 2); break;
-               case grfx::MonochromeDisplay:   fl_set_choice(dialog_->choice_display, 1); break;
-               default:                        fl_set_choice(dialog_->choice_display, 3); break;
+       case graphics::NoDisplay:
+               fl_set_choice(dialog_->choice_graphics_display, 4);
+               break;
+       case graphics::ColorDisplay:
+               fl_set_choice(dialog_->choice_graphics_display, 3);
+               break;
+       case graphics::GrayscaleDisplay:
+               fl_set_choice(dialog_->choice_graphics_display, 2);
+               break;
+       case graphics::MonochromeDisplay:
+               fl_set_choice(dialog_->choice_graphics_display, 1);
+               break;
+       default:
+               fl_set_choice(dialog_->choice_graphics_display, 3);
+               break;
        }
 }
 
@@ -1924,10 +2065,12 @@ void FormPreferences::OutputsMisc::apply(LyXRC & rc) const
 
        int const choice =
                fl_get_choice(dialog_->choice_default_papersize) - 1;
-       rc.default_papersize = static_cast<BufferParams::PAPER_SIZE>(choice);
+       rc.default_papersize = static_cast<PAPER_SIZE>(choice);
 
        rc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff);
        rc.chktex_command = fl_get_input(dialog_->input_checktex);
+       rc.bibtex_command = fl_get_input(dialog_->input_bibtex);
+       rc.index_command = fl_get_input(dialog_->input_index);
        rc.view_dvi_paper_option = fl_get_input(dialog_->input_paperoption);
        rc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt);
 }
@@ -1942,18 +2085,23 @@ void FormPreferences::OutputsMisc::build()
        fl_set_counter_return(dialog_->counter_line_len, FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_tex_encoding, FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_ascii_roff,   FL_RETURN_CHANGED);
+       fl_set_input_return(dialog_->input_bibtex,       FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_checktex,     FL_RETURN_CHANGED);
+       fl_set_input_return(dialog_->input_index,        FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_paperoption,  FL_RETURN_CHANGED);
 
        fl_addto_choice(dialog_->choice_default_papersize,
-                       _(" default | US letter | US legal | US executive | A3 | A4 | A5 | B5 "));
+                       _(" default | US letter | US legal "
+                         "| US executive | A3 | A4 | A5 | B5 ").c_str());
 
        // set up the feedback mechanism
        setPrehandler(dialog_->counter_line_len);
        setPrehandler(dialog_->input_tex_encoding);
        setPrehandler(dialog_->choice_default_papersize);
        setPrehandler(dialog_->input_ascii_roff);
+       setPrehandler(dialog_->input_bibtex);
        setPrehandler(dialog_->input_checktex);
+       setPrehandler(dialog_->input_index);
        setPrehandler(dialog_->input_paperoption);
        setPrehandler(dialog_->check_autoreset_classopt);
 }
@@ -1968,8 +2116,12 @@ FormPreferences::OutputsMisc::feedback(FL_OBJECT const * const ob) const
                return LyXRC::getDescription(LyXRC::RC_FONT_ENCODING);
        if (ob == dialog_->input_ascii_roff)
                return LyXRC::getDescription(LyXRC::RC_ASCIIROFF_COMMAND);
+       if (ob == dialog_->input_bibtex)
+               return LyXRC::getDescription(LyXRC::RC_BIBTEX_COMMAND);
        if (ob == dialog_->input_checktex)
                return LyXRC::getDescription(LyXRC::RC_CHKTEX_COMMAND);
+       if (ob == dialog_->input_index)
+               return LyXRC::getDescription(LyXRC::RC_INDEX_COMMAND);
        if (ob == dialog_->choice_default_papersize)
                return LyXRC::getDescription(LyXRC::RC_DEFAULT_PAPERSIZE);
        if (ob == dialog_->input_paperoption)
@@ -1992,6 +2144,10 @@ void FormPreferences::OutputsMisc::update(LyXRC const & rc)
                     rc.ascii_roff_command.c_str());
        fl_set_input(dialog_->input_checktex,
                     rc.chktex_command.c_str());
+       fl_set_input(dialog_->input_bibtex,
+                    rc.bibtex_command.c_str());
+       fl_set_input(dialog_->input_index,
+                    rc.index_command.c_str());
        fl_set_input(dialog_->input_paperoption,
                     rc.view_dvi_paper_option.c_str());
        fl_set_button(dialog_->check_autoreset_classopt,
@@ -2015,17 +2171,10 @@ void FormPreferences::Paths::apply(LyXRC & rc)
 {
        rc.document_path = fl_get_input(dialog_->input_default_path);
        rc.template_path = fl_get_input(dialog_->input_template_path);
+       rc.tempdir_path  = fl_get_input(dialog_->input_temp_dir);
 
-       int button = fl_get_button(dialog_->check_use_temp_dir);
-       string str  = fl_get_input(dialog_->input_temp_dir);
-       if (!button)
-               str.erase();
-
-       rc.use_tempdir = button;
-       rc.tempdir_path = str;
-
-       button = fl_get_button(dialog_->check_last_files);
-       str = fl_get_input(dialog_->input_lastfiles);
+       int button = fl_get_button(dialog_->check_last_files);
+       string str = fl_get_input(dialog_->input_lastfiles);
        if (!button) str.erase();
 
        rc.check_lastfiles = button;
@@ -2057,6 +2206,7 @@ void FormPreferences::Paths::build()
        fl_set_input_return(dialog_->input_temp_dir, FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_lastfiles, FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_backup_path, FL_RETURN_CHANGED);
+       fl_set_counter_bounds(dialog_->counter_lastfiles, 0, maxlastfiles);
        fl_set_counter_return(dialog_->counter_lastfiles, FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_serverpipe, FL_RETURN_CHANGED);
 
@@ -2070,7 +2220,6 @@ void FormPreferences::Paths::build()
        setPrehandler(dialog_->input_backup_path);
        setPrehandler(dialog_->input_serverpipe);
        setPrehandler(dialog_->input_temp_dir);
-       setPrehandler(dialog_->check_use_temp_dir);
 }
 
 
@@ -2081,8 +2230,6 @@ FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const
                return LyXRC::getDescription(LyXRC::RC_DOCUMENTPATH);
        if (ob == dialog_->input_template_path)
                return LyXRC::getDescription(LyXRC::RC_TEMPLATEPATH);
-       if (ob == dialog_->check_use_temp_dir)
-               return LyXRC::getDescription(LyXRC::RC_USETEMPDIR);
        if (ob == dialog_->input_temp_dir)
                return LyXRC::getDescription(LyXRC::RC_TEMPDIRPATH);
        if (ob == dialog_->check_last_files)
@@ -2108,11 +2255,6 @@ bool FormPreferences::Paths::input(FL_OBJECT const * const ob)
        // !ob if function is called from Paths::update() to de/activate
        // objects,
        // otherwise the function is called by an xforms CB via input().
-       if (!ob || ob == dialog_->check_use_temp_dir) {
-               bool const enable = fl_get_button(dialog_->check_use_temp_dir);
-               setEnabled(dialog_->input_temp_dir, enable);
-       }
-
        if (!ob || ob == dialog_->check_last_files) {
                bool const enable = fl_get_button(dialog_->check_last_files);
                setEnabled(dialog_->input_lastfiles, enable);
@@ -2186,29 +2328,35 @@ bool FormPreferences::Paths::input(FL_OBJECT const * const ob)
        }
 
        if (ob == dialog_->button_default_path_browse) {
-               string f = parent_.controller().browse(
+               string f = parent_.controller().browsedir(
                        fl_get_input(dialog_->input_default_path), _("Default path"));
-               fl_set_input(dialog_->input_default_path, f.c_str());
+               if (!f.empty())
+                       fl_set_input(dialog_->input_default_path, f.c_str());
        } else if (ob == dialog_->button_template_path_browse) {
-               string f = parent_.controller().browse(
+               string f = parent_.controller().browsedir(
                        fl_get_input(dialog_->input_template_path), _("Template path"));
-               fl_set_input(dialog_->input_template_path, f.c_str());
+               if (!f.empty())
+                       fl_set_input(dialog_->input_template_path, f.c_str());
        } else if (ob == dialog_->button_temp_dir_browse) {
-               string f = parent_.controller().browse(
+               string f = parent_.controller().browsedir(
                        fl_get_input(dialog_->input_temp_dir), _("Temporary dir"));
-               fl_set_input(dialog_->input_temp_dir, f.c_str());
+               if (!f.empty())
+                       fl_set_input(dialog_->input_temp_dir, f.c_str());
        } else if (ob == dialog_->button_lastfiles_browse) {
                string f = parent_.controller().browse(
                        fl_get_input(dialog_->input_lastfiles), _("Last files"));
-               fl_set_input(dialog_->input_lastfiles, f.c_str());
+               if (!f.empty())
+                       fl_set_input(dialog_->input_lastfiles, f.c_str());
        } else if (ob == dialog_->button_backup_path_browse) {
-               string f = parent_.controller().browse(
+               string f = parent_.controller().browsedir(
                        fl_get_input(dialog_->input_backup_path), _("Backup path"));
-               fl_set_input(dialog_->input_backup_path, f.c_str());
+               if (!f.empty())
+                       fl_set_input(dialog_->input_backup_path, f.c_str());
        } else if (ob == dialog_->button_serverpipe_browse) {
                string f = parent_.controller().browse(
                        fl_get_input(dialog_->input_serverpipe), _("LyX server pipes"));
-               fl_set_input(dialog_->input_serverpipe, f.c_str());
+               if (!f.empty())
+                       fl_set_input(dialog_->input_serverpipe, f.c_str());
        }
 
        return activate;
@@ -2230,13 +2378,7 @@ void FormPreferences::Paths::update(LyXRC const & rc)
                      rc.make_backup);
        fl_set_input(dialog_->input_backup_path, str.c_str());
 
-       str.erase();
-       if (rc.use_tempdir)
-               str = rc.tempdir_path;
-
-       fl_set_button(dialog_->check_use_temp_dir,
-                     rc.use_tempdir);
-       fl_set_input(dialog_->input_temp_dir, str.c_str());
+       fl_set_input(dialog_->input_temp_dir, rc.tempdir_path.c_str());
 
        str.erase();
        if (rc.check_lastfiles)
@@ -2467,6 +2609,7 @@ void FormPreferences::ScreenFonts::apply(LyXRC & rc) const
        if (rc.font_norm != str) {
                changed = true;
                rc.font_norm = str;
+               rc.set_font_norm_type();
        }
 
        bool button = fl_get_button(dialog_->check_scalable);
@@ -2631,16 +2774,16 @@ FormPreferences::ScreenFonts::feedback(FL_OBJECT const * const ob) const
        if (ob == dialog_->counter_dpi)
                return LyXRC::getDescription(LyXRC::RC_SCREEN_DPI);
        if (ob == dialog_->input_tiny
-                || ob == dialog_->input_script
-                || ob == dialog_->input_footnote
-                || ob == dialog_->input_small
-                || ob == dialog_->input_large
-                || ob == dialog_->input_larger
-                || ob == dialog_->input_larger
-                || ob == dialog_->input_largest
-                || ob == dialog_->input_normal
-                || ob == dialog_->input_huge
-                || ob == dialog_->input_huger)
+           || ob == dialog_->input_script
+           || ob == dialog_->input_footnote
+           || ob == dialog_->input_small
+           || ob == dialog_->input_large
+           || ob == dialog_->input_larger
+           || ob == dialog_->input_larger
+           || ob == dialog_->input_largest
+           || ob == dialog_->input_normal
+           || ob == dialog_->input_huge
+           || ob == dialog_->input_huger)
                return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SIZES);
        return string();
 }
@@ -2687,7 +2830,7 @@ bool FormPreferences::ScreenFonts::input()
                   strToDbl(fl_get_input(dialog_->input_huger))) {
                activate = false;
 
-               str = _("Fonts must be input in the order tiny > script> footnote > small > normal > large > larger > largest > huge > huger.");
+               str = _("Fonts must be input in the order Tiny > Smallest > Smaller > Small > Normal > Large > Larger > Largest > Huge > Huger.");
        }
 
        if (!activate)
@@ -2816,7 +2959,7 @@ void FormPreferences::SpellOptions::build()
        dialog_.reset(build_preferences_spelloptions(&parent_));
 
        fl_addto_choice(dialog_->choice_spell_command,
-                       _(" ispell | aspell "));
+                       _(" ispell | aspell ").c_str());
        fl_set_input_return(dialog_->input_alt_lang,      FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_escape_chars,  FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_personal_dict, FL_RETURN_CHANGED);
@@ -2965,3 +3108,6 @@ void FormPreferences::SpellOptions::update(LyXRC const & rc)
        // buttons.
        input(0);
 }
+
+} // namespace frontend
+} // namespace lyx