X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2FFormPreferences.C;h=f8c5ac63b7616df2307c17ee9b930f3c7c8e364e;hb=4c6e0fe4226ce3b55d13726977f1e579f17c2ad1;hp=9025c83aa0e43e454f9ed1bef6f6117d3ec23d4d;hpb=cf27d6019a775a1c56c6766ffd4c2f8643a4b06f;p=lyx.git diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 9025c83aa0..f8c5ac63b7 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -3,67 +3,50 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Angus Leeming + * \author Angus Leeming * - * Full author contact details are available in file CREDITS + * Full author contact details are available in file CREDITS. */ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "FormPreferences.h" +#include "ControlPrefs.h" #include "forms/form_preferences.h" -#include "combox.h" -#include "Color.h" -#include "input_validators.h" +#include "FormColorpicker.h" #include "forms_gettext.h" -#include "xforms_helpers.h" -#include "helper_funcs.h" +#include "input_validators.h" +#include "xformsBC.h" + +#include "controllers/helper_funcs.h" // getSecond #include "buffer.h" #include "converter.h" -#include "debug.h" -#include "language.h" +#include "format.h" #include "frnt_lang.h" -#include "lyxlex.h" -#include "lyxrc.h" -#include "LColor.h" -#include "Lsstream.h" -#include "funcrequest.h" - -#include "frontends/LyXView.h" -#include "frontends/Dialogs.h" -#include "support/lyxfunctional.h" -#include "support/lyxmanip.h" -#include "support/filetools.h" #include "support/LAssert.h" +#include "support/lstrings.h" +#include "support/tostr.h" +#include "support/path_defines.h" +#include "support/filetools.h" -#include "graphics/GraphicsCache.h" -#include "graphics/GraphicsTypes.h" - -#include +#include "lyx_forms.h" +#include "combox.h" -#include FORMS_H_LOCATION -#include #include -#include 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; -extern string system_lyxdir; -extern string user_lyxdir; +using namespace lyx::support; + namespace { @@ -71,19 +54,45 @@ namespace { Formats local_formats; Converters local_converters; +string makeFontName(string const & family, string const & foundry) +{ + if (foundry.empty()) + return family; + return family + ',' + foundry; +} + + +pair parseFontName(string const & name) +{ + string::size_type const idx = name.find(','); + if (idx == string::npos) + return make_pair(name, string()); + return make_pair(name.substr(0, idx), + name.substr(idx+1)); +} + + + +#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2) +bool const scalableTabfolders = false; +#else +bool const scalableTabfolders = true; +#endif + } // namespace anon -FormPreferences::FormPreferences(LyXView & lv, Dialogs & d) - : FormBaseBI(lv, d, _("Preferences"), false), +typedef FormCB > base_class; + + +FormPreferences::FormPreferences() + : base_class(_("Preferences"), scalableTabfolders), 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) + lnf_misc_(*this), identity_(*this), outputs_misc_(*this), + paths_(*this), printer_(*this), screen_fonts_(*this), + spelloptions_(*this) { - // let the dialog be shown - // This is a permanent connection so we won't bother - // storing a copy because we won't be disconnecting. } @@ -119,26 +128,6 @@ void FormPreferences::redraw() } -FL_FORM * FormPreferences::form() const -{ - return dialog_.get() ? dialog_->form : 0; -} - - -void FormPreferences::ok() -{ - FormBaseDeprecated::ok(); - - if (colors_.modifiedXformsPrefs) { - string const filename = - AddName(user_lyxdir, "preferences.xform"); - colors_.modifiedXformsPrefs = !XformsColor::write(filename); - } - - lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES)); -} - - void FormPreferences::hide() { // We need to hide the active tabfolder otherwise we get a @@ -146,7 +135,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); - FormBaseDeprecated::hide(); + FormBase::hide(); } @@ -155,10 +144,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); @@ -179,83 +168,102 @@ void FormPreferences::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); // 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); } @@ -272,24 +280,34 @@ void FormPreferences::apply() // and other stuff which may cost us a lot on slower/high-load // machines. + LyXRC & rc(controller().rc()); + colors_.apply(); formats_.apply(); // Must be before converters_.apply() converters_.apply(); - inputs_misc_.apply(); - interface_.apply(); - language_.apply(); - lnf_misc_.apply(); - outputs_misc_.apply(); - paths_.apply(); - printer_.apply(); - screen_fonts_.apply(); - spelloptions_.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); + screen_fonts_.apply(rc); + spelloptions_.apply(rc); + + // The "Save" button has been pressed. + if (controller().isClosing() && colors_.modifiedXformsPrefs) { + string const filename = + AddName(user_lyxdir(), "preferences.xform"); + colors_.modifiedXformsPrefs = !XformsColor::write(filename); + } } string const FormPreferences::getFeedback(FL_OBJECT * ob) { - lyx::Assert(ob); + Assert(ob); if (ob->form->fdui == colors_.dialog()) return colors_.feedback(ob); @@ -320,9 +338,11 @@ string const FormPreferences::getFeedback(FL_OBJECT * ob) } -bool FormPreferences::input(FL_OBJECT * ob, long) +ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long) { - lyx::Assert(ob); + Assert(ob); + + bool valid = true; // whatever checks you need to ensure the user hasn't entered // some totally ridiculous value somewhere. Change activate to suit. @@ -330,24 +350,23 @@ bool FormPreferences::input(FL_OBJECT * ob, long) if (ob->form->fdui == colors_.dialog()) { colors_.input(ob); - return true; + } else if (ob->form->fdui == converters_.dialog()) { + valid = converters_.input(ob); + } else if (ob->form->fdui == formats_.dialog()) { + valid = formats_.input(ob); + } else if (ob->form->fdui == interface_.dialog()) { + valid = interface_.input(ob); + } else if (ob->form->fdui == language_.dialog()) { + valid = language_.input(ob); + } else if (ob->form->fdui == paths_.dialog()) { + valid = paths_.input(ob); + } else if (ob->form->fdui == screen_fonts_.dialog()) { + valid = screen_fonts_.input(); + } else if (ob->form->fdui == spelloptions_.dialog()) { + valid = spelloptions_.input(ob); } - if (ob->form->fdui == converters_.dialog()) - return converters_.input(ob); - if (ob->form->fdui == formats_.dialog()) - return formats_.input(ob); - if (ob->form->fdui == interface_.dialog()) - return interface_.input(ob); - if (ob->form->fdui == language_.dialog()) - return language_.input(ob); - if (ob->form->fdui == paths_.dialog()) - return paths_.input(ob); - if (ob->form->fdui == screen_fonts_.dialog()) - return screen_fonts_.input(); - if (ob->form->fdui == spelloptions_.dialog()) - return spelloptions_.input(ob); - return true; + return valid ? ButtonPolicy::SMI_VALID : ButtonPolicy::SMI_INVALID; } @@ -355,19 +374,22 @@ void FormPreferences::update() { if (!dialog_.get()) return; + LyXRC const & rc(controller().rc()); + // read lyxrc entries colors_.update(); formats_.update(); // Must be before converters_.update() converters_.update(); - inputs_misc_.update(); - interface_.update(); - language_.update(); - lnf_misc_.update(); - outputs_misc_.update(); - paths_.update(); - printer_.update(); - screen_fonts_.update(); - spelloptions_.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); + screen_fonts_.update(rc); + spelloptions_.update(rc); } @@ -425,7 +447,7 @@ void FormPreferences::Colors::apply() setCursorColor(GUI_COLOR_CURSOR); } } - parent_.lv_.getDialogs().redrawGUI(); + parent_.controller().redrawGUI(); } // Now do the same for the LyX LColors... @@ -445,9 +467,7 @@ void FormPreferences::Colors::apply() << "\" to \"" << hexname << "\"." << endl; - string const s = lcolor.getLyXName(lc) + string(" ") + - hexname; - parent_.lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s)); + parent_.controller().setColor(lc, hexname); } } } @@ -455,48 +475,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); } @@ -509,17 +497,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(); } @@ -529,20 +506,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(); } @@ -589,106 +552,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::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::size_type const i = selLyX - 1; - modify = (xformsColorDB[i].color() != col); - } - // or a LyX Logical color? - else { - vector::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::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::size_type const i = selLyX - 1; - modify = (xformsColorDB[i].color() != col); - } - // or a LyX Logical color? - else { - vector::size_type const i = selLyX - 1 - - xformsColorDB.size(); - modify = (lyxColorDB[i].color() != col); - } - - setEnabled(dialog_->button_modify, modify); } @@ -741,33 +605,20 @@ 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"; - parent_.lv_.dispatch(FuncRequest(LFUN_SET_COLOR, arg)); + parent_.controller().setColor(lc, "black"); 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. @@ -814,8 +665,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()) { @@ -832,86 +690,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 ostr.str().c_str(); } @@ -928,9 +706,7 @@ FD_preferences_converters const * FormPreferences::Converters::dialog() void FormPreferences::Converters::apply() const { - converters = local_converters; - converters.update(formats); - converters.buildGraph(); + parent_.controller().setConverters(local_converters); } @@ -956,7 +732,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"); @@ -997,9 +773,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) @@ -1075,8 +851,9 @@ bool FormPreferences::Converters::Browser() fl_set_input(dialog_->input_converter, c.command.c_str()); fl_set_input(dialog_->input_flags, c.flags.c_str()); - fl_set_object_label(dialog_->button_add, idex(_("Modify|#M"))); - fl_set_button_shortcut(dialog_->button_add, scex(_("Modify|#M")), 1); + 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); @@ -1106,17 +883,19 @@ bool FormPreferences::Converters::Input() fl_freeze_form(dialog_->form); if (sel < 0) { - fl_set_object_label(dialog_->button_add, idex(_("Add|#A"))); + fl_set_object_label(dialog_->button_add, + idex(_("Add|#A")).c_str()); fl_set_button_shortcut(dialog_->button_add, - scex(_("Add|#A")), 1); + scex(_("Add|#A")).c_str(), 1); fl_deselect_browser(dialog_->browser_all); setEnabled(dialog_->button_delete, false); } else { - fl_set_object_label(dialog_->button_add, idex(_("Modify|#M"))); + fl_set_object_label(dialog_->button_add, + idex(_("Modify|#M")).c_str()); fl_set_button_shortcut(dialog_->button_add, - scex(_("Modify|#M")), 1); + scex(_("Modify|#M")).c_str(), 1); int top = max(sel-5, 0); fl_set_browser_topline(dialog_->browser_all, top); @@ -1136,7 +915,7 @@ bool FormPreferences::Converters::Input() string const FormPreferences::Converters::GetFrom() const { ::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(); @@ -1149,7 +928,7 @@ string const FormPreferences::Converters::GetFrom() const string const FormPreferences::Converters::GetTo() const { ::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(); @@ -1167,10 +946,10 @@ void FormPreferences::Converters::UpdateChoices() const if (!choice.empty()) choice += " | "; else - choice += " "; + choice += ' '; choice += cit->prettyname(); } - choice += " "; + choice += ' '; fl_clear_choice(dialog_->choice_from); fl_addto_choice(dialog_->choice_from, choice.c_str()); @@ -1193,7 +972,7 @@ FD_preferences_formats const * FormPreferences::Formats::dialog() void FormPreferences::Formats::apply() const { - formats = local_formats; + parent_.controller().setFormats(local_formats); } @@ -1266,10 +1045,10 @@ 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) return Input(); if (ob == dialog_->button_add) @@ -1349,8 +1128,10 @@ bool FormPreferences::Formats::Browser() fl_set_input(dialog_->input_extension, f.extension().c_str()); fl_set_input(dialog_->input_viewer, f.viewer().c_str()); - fl_set_object_label(dialog_->button_add, idex(_("Modify|#M"))); - fl_set_button_shortcut(dialog_->button_add, scex(_("Modify|#M")), 1); + 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); @@ -1385,18 +1166,18 @@ bool FormPreferences::Formats::Input() if (sel < 0) { fl_set_object_label(dialog_->button_add, - idex(_("Add|#A"))); + idex(_("Add|#A")).c_str()); fl_set_button_shortcut(dialog_->button_add, - scex(_("Add|#A")), 1); + scex(_("Add|#A")).c_str(), 1); fl_deselect_browser(dialog_->browser_all); setEnabled(dialog_->button_delete, false); } else { fl_set_object_label(dialog_->button_add, - idex(_("Modify|#M"))); + idex(_("Modify|#M")).c_str()); fl_set_button_shortcut(dialog_->button_add, - scex(_("Modify|#M")), 1); + scex(_("Modify|#M")).c_str(), 1); int const top = max(sel-5, 0); fl_set_browser_topline(dialog_->browser_all, top); @@ -1415,6 +1196,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) {} @@ -1426,9 +1240,9 @@ FD_preferences_inputs_misc const * FormPreferences::InputsMisc::dialog() } -void FormPreferences::InputsMisc::apply() const +void FormPreferences::InputsMisc::apply(LyXRC & rc) const { - lyxrc.date_insert_format = + rc.date_insert_format = fl_get_input(dialog_->input_date_format); } @@ -1448,15 +1262,15 @@ string const FormPreferences::InputsMisc::feedback(FL_OBJECT const * const ob) const { if (ob == dialog_->input_date_format) - return lyxrc.getDescription(LyXRC::RC_DATE_INSERT_FORMAT); + return LyXRC::getDescription(LyXRC::RC_DATE_INSERT_FORMAT); return string(); } -void FormPreferences::InputsMisc::update() +void FormPreferences::InputsMisc::update(LyXRC const & rc) { fl_set_input(dialog_->input_date_format, - lyxrc.date_insert_format.c_str()); + rc.date_insert_format.c_str()); } @@ -1471,17 +1285,15 @@ FD_preferences_interface const * FormPreferences::Interface::dialog() } -void FormPreferences::Interface::apply() const +void FormPreferences::Interface::apply(LyXRC & rc) const { - lyxrc.popup_normal_font = + rc.popup_normal_font = fl_get_input(dialog_->input_popup_normal_font); - lyxrc.popup_bold_font = fl_get_input(dialog_->input_popup_bold_font); - lyxrc.popup_font_encoding = + rc.popup_bold_font = fl_get_input(dialog_->input_popup_bold_font); + rc.popup_font_encoding = fl_get_input(dialog_->input_popup_font_encoding); - lyxrc.bind_file = fl_get_input(dialog_->input_bind_file); - lyxrc.ui_file = fl_get_input(dialog_->input_ui_file); - lyxrc.override_x_deadkeys = - fl_get_button(dialog_->check_override_x_dead_keys); + rc.bind_file = fl_get_input(dialog_->input_bind_file); + rc.ui_file = fl_get_input(dialog_->input_ui_file); } @@ -1503,7 +1315,6 @@ void FormPreferences::Interface::build() setPrehandler(dialog_->button_bind_file_browse); setPrehandler(dialog_->input_ui_file); setPrehandler(dialog_->button_ui_file_browse); - setPrehandler(dialog_->check_override_x_dead_keys); } @@ -1511,17 +1322,15 @@ string const FormPreferences::Interface::feedback(FL_OBJECT const * const ob) const { if (ob == dialog_->input_popup_normal_font) - return lyxrc.getDescription(LyXRC::RC_POPUP_NORMAL_FONT); + return LyXRC::getDescription(LyXRC::RC_POPUP_NORMAL_FONT); if (ob == dialog_->input_popup_bold_font) - return lyxrc.getDescription(LyXRC::RC_POPUP_BOLD_FONT); + return LyXRC::getDescription(LyXRC::RC_POPUP_BOLD_FONT); if (ob == dialog_->input_popup_font_encoding) - return lyxrc.getDescription(LyXRC::RC_POPUP_FONT_ENCODING); + return LyXRC::getDescription(LyXRC::RC_POPUP_FONT_ENCODING); if (ob == dialog_->input_bind_file) - return lyxrc.getDescription(LyXRC::RC_BINDFILE); + return LyXRC::getDescription(LyXRC::RC_BINDFILE); if (ob == dialog_->input_ui_file) - return lyxrc.getDescription(LyXRC::RC_UIFILE); - if (ob == dialog_->check_override_x_dead_keys) - return lyxrc.getDescription(LyXRC::RC_OVERRIDE_X_DEADKEYS); + return LyXRC::getDescription(LyXRC::RC_UIFILE); return string(); } @@ -1529,48 +1338,33 @@ FormPreferences::Interface::feedback(FL_OBJECT const * const ob) const bool FormPreferences::Interface::input(FL_OBJECT const * const ob) { if (ob == dialog_->button_bind_file_browse) { - string dir = AddName(system_lyxdir, "bind"); - string name = _("Sys Bind|#S#s"); - pair dir1(name, dir); - - dir = AddName(user_lyxdir, "bind"); - name = _("User Bind|#U#u"); - pair dir2(name, dir); - - parent_.browse(dialog_->input_bind_file, - _("Bind file"), "*.bind", dir1, dir2); + string f = parent_.controller().browsebind( + fl_get_input(dialog_->input_bind_file)); + fl_set_input(dialog_->input_bind_file, f.c_str()); } else if (ob == dialog_->button_ui_file_browse) { - string dir = AddName(system_lyxdir, "ui"); - string name = _("Sys UI|#S#s"); - pair dir1(name, dir); + string f = parent_.controller().browseUI( + fl_get_input(dialog_->input_ui_file)); - dir = AddName(user_lyxdir, "ui"); - name = _("User UI|#U#u"); - pair dir2(name, dir); - - parent_.browse(dialog_->input_ui_file, - _("UI file"), "*.ui", dir1, dir2); + fl_set_input(dialog_->input_ui_file, f.c_str()); } return true; } -void FormPreferences::Interface::update() +void FormPreferences::Interface::update(LyXRC const & rc) { fl_set_input(dialog_->input_popup_normal_font, - lyxrc.popup_normal_font.c_str()); + rc.popup_normal_font.c_str()); fl_set_input(dialog_->input_popup_bold_font, - lyxrc.popup_bold_font.c_str()); + rc.popup_bold_font.c_str()); fl_set_input(dialog_->input_popup_font_encoding, - lyxrc.popup_font_encoding.c_str()); + rc.popup_font_encoding.c_str()); fl_set_input(dialog_->input_bind_file, - lyxrc.bind_file.c_str()); + rc.bind_file.c_str()); fl_set_input(dialog_->input_ui_file, - lyxrc.ui_file.c_str()); - fl_set_button(dialog_->check_override_x_dead_keys, - lyxrc.override_x_deadkeys); + rc.ui_file.c_str()); } @@ -1585,47 +1379,47 @@ FD_preferences_language const * FormPreferences::Language::dialog() } -void FormPreferences::Language::apply() +void FormPreferences::Language::apply(LyXRC & rc) { - int const pos = combo_default_lang->get(); - lyxrc.default_language = lang_[pos-1]; + 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); string const name_1 = fl_get_input(dialog_->input_kbmap1); string const name_2 = fl_get_input(dialog_->input_kbmap2); if (button) button = !(name_1.empty() && name_2.empty()); - lyxrc.use_kbmap = static_cast(button); + rc.use_kbmap = static_cast(button); - if (lyxrc.use_kbmap) { - lyxrc.primary_kbmap = name_1; - lyxrc.secondary_kbmap = name_2; + if (rc.use_kbmap) { + rc.primary_kbmap = name_1; + rc.secondary_kbmap = name_2; } button = fl_get_button(dialog_->check_rtl_support); - lyxrc.rtl_support = static_cast(button); + rc.rtl_support = static_cast(button); button = fl_get_button(dialog_->check_mark_foreign); - lyxrc.mark_foreign_language = static_cast(button); + rc.mark_foreign_language = static_cast(button); button = fl_get_button(dialog_->check_auto_begin); - lyxrc.language_auto_begin = static_cast(button); + rc.language_auto_begin = static_cast(button); button = fl_get_button(dialog_->check_auto_end); - lyxrc.language_auto_end = static_cast(button); + rc.language_auto_end = static_cast(button); button = fl_get_button(dialog_->check_use_babel); - lyxrc.language_use_babel = static_cast(button); + rc.language_use_babel = static_cast(button); button = fl_get_button(dialog_->check_global_options); - lyxrc.language_global_options = static_cast(button); + rc.language_global_options = static_cast(button); - lyxrc.language_package = fl_get_input(dialog_->input_package); - lyxrc.language_command_begin = fl_get_input(dialog_->input_command_begin); - lyxrc.language_command_end = fl_get_input(dialog_->input_command_end); + rc.language_package = fl_get_input(dialog_->input_package); + rc.language_command_begin = fl_get_input(dialog_->input_command_begin); + rc.language_command_end = fl_get_input(dialog_->input_command_end); // Ensure that all is self-consistent. - update(); + update(rc); } @@ -1641,40 +1435,18 @@ void FormPreferences::Language::build() vector const langs = frnt::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, - parent_.lang_opts_tab_->tabfolder_inner, - parent_.dialog_->tabfolder_prefs); - combo_default_lang->shortcut("#L",1); - combo_default_lang->setcallback(ComboCB, &parent_); - + FL_OBJECT * obj = dialog_->combox_default_lang; vector::const_iterator lit = langs.begin(); vector::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(combo_default_lang), - // C_FormPreferencesFeedbackCB); - + setPrehandler(dialog_->combox_default_lang); setPrehandler(dialog_->input_kbmap1); setPrehandler(dialog_->input_kbmap2); setPrehandler(dialog_->check_rtl_support); @@ -1695,32 +1467,32 @@ void FormPreferences::Language::build() string const FormPreferences::Language::feedback(FL_OBJECT const * const ob) const { - if (reinterpret_cast(ob) == combo_default_lang.get()) - return lyxrc.getDescription(LyXRC::RC_DEFAULT_LANGUAGE); + 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); + return LyXRC::getDescription(LyXRC::RC_KBMAP); if (ob == dialog_->input_kbmap1) - return lyxrc.getDescription(LyXRC::RC_KBMAP_PRIMARY); + return LyXRC::getDescription(LyXRC::RC_KBMAP_PRIMARY); if (ob == dialog_->input_kbmap2) - return lyxrc.getDescription(LyXRC::RC_KBMAP_SECONDARY); + return LyXRC::getDescription(LyXRC::RC_KBMAP_SECONDARY); if (ob == dialog_->check_rtl_support) - return lyxrc.getDescription(LyXRC::RC_RTL_SUPPORT); + return LyXRC::getDescription(LyXRC::RC_RTL_SUPPORT); if (ob == dialog_->check_mark_foreign) - return lyxrc.getDescription(LyXRC::RC_MARK_FOREIGN_LANGUAGE); + return LyXRC::getDescription(LyXRC::RC_MARK_FOREIGN_LANGUAGE); if (ob == dialog_->check_auto_begin) - return lyxrc.getDescription(LyXRC::RC_LANGUAGE_AUTO_BEGIN); + return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_BEGIN); if (ob == dialog_->check_auto_end) - return lyxrc.getDescription(LyXRC::RC_LANGUAGE_AUTO_END); + return LyXRC::getDescription(LyXRC::RC_LANGUAGE_AUTO_END); if (ob == dialog_->check_use_babel) - return lyxrc.getDescription(LyXRC::RC_LANGUAGE_USE_BABEL); + return LyXRC::getDescription(LyXRC::RC_LANGUAGE_USE_BABEL); if (ob == dialog_->check_global_options) - return lyxrc.getDescription(LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS); + return LyXRC::getDescription(LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS); if (ob == dialog_->input_package) - return lyxrc.getDescription(LyXRC::RC_LANGUAGE_PACKAGE); + return LyXRC::getDescription(LyXRC::RC_LANGUAGE_PACKAGE); if (ob == dialog_->input_command_begin) - return lyxrc.getDescription(LyXRC::RC_LANGUAGE_COMMAND_BEGIN); + return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_BEGIN); if (ob == dialog_->input_command_end) - return lyxrc.getDescription(LyXRC::RC_LANGUAGE_COMMAND_END); + return LyXRC::getDescription(LyXRC::RC_LANGUAGE_COMMAND_END); return string(); } @@ -1741,58 +1513,54 @@ bool FormPreferences::Language::input(FL_OBJECT const * const ob) } if (ob == dialog_->button_kbmap1_browse) { - string const dir = AddName(system_lyxdir, "kbd"); - string const name = _("Key maps|#K#k"); - pair dir1(name, dir); + string f = parent_.controller().browsekbmap( + fl_get_input(dialog_->input_kbmap1)); - parent_.browse(dialog_->input_kbmap1, - _("Keyboard map"), "*.kmap", dir1); + fl_set_input(dialog_->input_kbmap1, f.c_str()); } else if (ob == dialog_->button_kbmap2_browse) { - string const dir = AddName(system_lyxdir, "kbd"); - string const name = _("Key maps|#K#k"); - pair dir1(name, dir); + string f = parent_.controller().browsekbmap( + fl_get_input(dialog_->input_kbmap2)); - parent_.browse(dialog_->input_kbmap2, - _("Keyboard map"), "*.kmap", dir1); + fl_set_input(dialog_->input_kbmap2, f.c_str()); } return activate; } -void FormPreferences::Language::update() +void FormPreferences::Language::update(LyXRC const & rc) { fl_set_button(dialog_->check_use_kbmap, - lyxrc.use_kbmap); + rc.use_kbmap); - int const pos = int(findPos(lang_, lyxrc.default_language)); - combo_default_lang->select(pos + 1); + int const pos = int(findPos(lang_, rc.default_language)); + fl_set_combox(dialog_->combox_default_lang, pos + 1); - if (lyxrc.use_kbmap) { + if (rc.use_kbmap) { fl_set_input(dialog_->input_kbmap1, - lyxrc.primary_kbmap.c_str()); + rc.primary_kbmap.c_str()); fl_set_input(dialog_->input_kbmap2, - lyxrc.secondary_kbmap.c_str()); + rc.secondary_kbmap.c_str()); } else { fl_set_input(dialog_->input_kbmap1, ""); fl_set_input(dialog_->input_kbmap2, ""); } - fl_set_button(dialog_->check_rtl_support, lyxrc.rtl_support); + fl_set_button(dialog_->check_rtl_support, rc.rtl_support); fl_set_button(dialog_->check_mark_foreign, - lyxrc.mark_foreign_language); - fl_set_button(dialog_->check_auto_begin, lyxrc.language_auto_begin); - fl_set_button(dialog_->check_auto_end, lyxrc.language_auto_end); - fl_set_button(dialog_->check_use_babel, lyxrc.language_use_babel); + rc.mark_foreign_language); + fl_set_button(dialog_->check_auto_begin, rc.language_auto_begin); + fl_set_button(dialog_->check_auto_end, rc.language_auto_end); + fl_set_button(dialog_->check_use_babel, rc.language_use_babel); fl_set_button(dialog_->check_global_options, - lyxrc.language_global_options); + rc.language_global_options); fl_set_input(dialog_->input_package, - lyxrc.language_package.c_str()); + rc.language_package.c_str()); fl_set_input(dialog_->input_command_begin, - lyxrc.language_command_begin.c_str()); + rc.language_command_begin.c_str()); fl_set_input(dialog_->input_command_end, - lyxrc.language_command_end.c_str()); + rc.language_command_end.c_str()); // Activate/Deactivate the input fields dependent on the state of the // buttons. @@ -1800,15 +1568,6 @@ void FormPreferences::Language::update() } -void FormPreferences::Language::ComboCB(int, void * v, Combox * combox) -{ - FormPreferences * pre = static_cast(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(combox), 0)); -} - - FormPreferences::LnFmisc::LnFmisc(FormPreferences & p) : parent_(p) {} @@ -1820,36 +1579,46 @@ FD_preferences_lnf_misc const * FormPreferences::LnFmisc::dialog() } -void FormPreferences::LnFmisc::apply() const +void FormPreferences::LnFmisc::apply(LyXRC & rc) const { - lyxrc.auto_region_delete = + rc.auto_region_delete = fl_get_button(dialog_->check_auto_region_delete); - lyxrc.cursor_follows_scrollbar = + rc.cursor_follows_scrollbar = fl_get_button(dialog_->check_cursor_follows_scrollbar); - lyxrc.dialogs_iconify_with_main = + rc.dialogs_iconify_with_main = fl_get_button(dialog_->check_dialogs_iconify_with_main); - lyxrc.preview = fl_get_button(dialog_->check_preview_latex); - lyxrc.autosave = static_cast + rc.preview = fl_get_button(dialog_->check_preview_latex); + rc.autosave = static_cast (fl_get_counter_value(dialog_->counter_autosave)); - lyxrc.wheel_jump = static_cast + rc.wheel_jump = static_cast (fl_get_counter_value(dialog_->counter_wm_jump)); // See FIXME below - // grfx::DisplayType old_value = lyxrc.display_graphics; + // lyx::graphics::DisplayType old_value = rc.display_graphics; switch (fl_get_choice(dialog_->choice_display)) { - case 4: lyxrc.display_graphics = grfx::NoDisplay; break; - case 3: lyxrc.display_graphics = grfx::ColorDisplay; break; - case 2: lyxrc.display_graphics = grfx::GrayscaleDisplay; break; - case 1: lyxrc.display_graphics = grfx::MonochromeDisplay; break; - default: lyxrc.display_graphics = grfx::ColorDisplay; break; + case 4: + rc.display_graphics = lyx::graphics::NoDisplay; + break; + case 3: + rc.display_graphics = lyx::graphics::ColorDisplay; + break; + case 2: + rc.display_graphics = lyx::graphics::GrayscaleDisplay; + break; + case 1: + rc.display_graphics = lyx::graphics::MonochromeDisplay; + break; + default: + rc.display_graphics = lyx::graphics::ColorDisplay; + break; } #ifdef WITH_WARNINGS #warning FIXME!! The graphics cache no longer has a changeDisplay method. #endif #if 0 - if (old_value != lyxrc.display_graphics) { - grfx::GCache & gc = grfx::GCache::get(); + if (old_value != rc.display_graphics) { + lyx::graphics::GCache & gc = lyx::graphics::GCache::get(); gc.changeDisplay(); } #endif @@ -1873,8 +1642,9 @@ void FormPreferences::LnFmisc::build() setPrehandler(dialog_->check_dialogs_iconify_with_main); setPrehandler(dialog_->check_preview_latex); setPrehandler(dialog_->counter_wm_jump); - - fl_addto_choice(dialog_->choice_display, _("Monochrome|Grayscale|Color|Do not display")); + + fl_addto_choice(dialog_->choice_display, + _("Monochrome|Grayscale|Color|Do not display").c_str()); } @@ -1882,42 +1652,52 @@ string const FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const { if (ob == dialog_->check_auto_region_delete) - return lyxrc.getDescription(LyXRC::RC_AUTOREGIONDELETE); + return LyXRC::getDescription(LyXRC::RC_AUTOREGIONDELETE); if (ob == dialog_->check_cursor_follows_scrollbar) - return lyxrc.getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR); + 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); + return LyXRC::getDescription(LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN); if (ob == dialog_->check_preview_latex) - return lyxrc.getDescription(LyXRC::RC_PREVIEW); + return LyXRC::getDescription(LyXRC::RC_PREVIEW); if (ob == dialog_->counter_autosave) - return lyxrc.getDescription(LyXRC::RC_AUTOSAVE); + return LyXRC::getDescription(LyXRC::RC_AUTOSAVE); if (ob == dialog_->counter_wm_jump) - return lyxrc.getDescription(LyXRC::RC_WHEEL_JUMP); + return LyXRC::getDescription(LyXRC::RC_WHEEL_JUMP); if (ob == dialog_->choice_display) - return lyxrc.getDescription(LyXRC::RC_DISPLAY_GRAPHICS); + return LyXRC::getDescription(LyXRC::RC_DISPLAY_GRAPHICS); return string(); } -void FormPreferences::LnFmisc::update() +void FormPreferences::LnFmisc::update(LyXRC const & rc) { fl_set_button(dialog_->check_auto_region_delete, - lyxrc.auto_region_delete); + rc.auto_region_delete); fl_set_button(dialog_->check_cursor_follows_scrollbar, - lyxrc.cursor_follows_scrollbar); + rc.cursor_follows_scrollbar); fl_set_button(dialog_->check_dialogs_iconify_with_main, - lyxrc.dialogs_iconify_with_main); + rc.dialogs_iconify_with_main); fl_set_button(dialog_->check_preview_latex, - lyxrc.preview); - fl_set_counter_value(dialog_->counter_autosave, lyxrc.autosave); - fl_set_counter_value(dialog_->counter_wm_jump, lyxrc.wheel_jump); - - switch (lyxrc.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; + rc.preview); + 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 lyx::graphics::NoDisplay: + fl_set_choice(dialog_->choice_display, 4); + break; + case lyx::graphics::ColorDisplay: + fl_set_choice(dialog_->choice_display, 3); + break; + case lyx::graphics::GrayscaleDisplay: + fl_set_choice(dialog_->choice_display, 2); + break; + case lyx::graphics::MonochromeDisplay: + fl_set_choice(dialog_->choice_display, 1); + break; + default: + fl_set_choice(dialog_->choice_display, 3); + break; } } @@ -1933,20 +1713,20 @@ FD_preferences_outputs_misc const * FormPreferences::OutputsMisc::dialog() } -void FormPreferences::OutputsMisc::apply() const +void FormPreferences::OutputsMisc::apply(LyXRC & rc) const { - lyxrc.ascii_linelen = static_cast + rc.ascii_linelen = static_cast (fl_get_counter_value(dialog_->counter_line_len)); - lyxrc.fontenc = fl_get_input(dialog_->input_tex_encoding); + rc.fontenc = fl_get_input(dialog_->input_tex_encoding); int const choice = fl_get_choice(dialog_->choice_default_papersize) - 1; - lyxrc.default_papersize = static_cast(choice); + rc.default_papersize = static_cast(choice); - lyxrc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff); - lyxrc.chktex_command = fl_get_input(dialog_->input_checktex); - lyxrc.view_dvi_paper_option = fl_get_input(dialog_->input_paperoption); - lyxrc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt); + rc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff); + rc.chktex_command = fl_get_input(dialog_->input_checktex); + rc.view_dvi_paper_option = fl_get_input(dialog_->input_paperoption); + rc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt); } @@ -1963,7 +1743,8 @@ void FormPreferences::OutputsMisc::build() 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); @@ -1980,39 +1761,39 @@ string const FormPreferences::OutputsMisc::feedback(FL_OBJECT const * const ob) const { if (ob == dialog_->counter_line_len) - return lyxrc.getDescription(LyXRC::RC_ASCII_LINELEN); + return LyXRC::getDescription(LyXRC::RC_ASCII_LINELEN); if (ob == dialog_->input_tex_encoding) - return lyxrc.getDescription(LyXRC::RC_FONT_ENCODING); + return LyXRC::getDescription(LyXRC::RC_FONT_ENCODING); if (ob == dialog_->input_ascii_roff) - return lyxrc.getDescription(LyXRC::RC_ASCIIROFF_COMMAND); + return LyXRC::getDescription(LyXRC::RC_ASCIIROFF_COMMAND); if (ob == dialog_->input_checktex) - return lyxrc.getDescription(LyXRC::RC_CHKTEX_COMMAND); + return LyXRC::getDescription(LyXRC::RC_CHKTEX_COMMAND); if (ob == dialog_->choice_default_papersize) - return lyxrc.getDescription(LyXRC::RC_DEFAULT_PAPERSIZE); + return LyXRC::getDescription(LyXRC::RC_DEFAULT_PAPERSIZE); if (ob == dialog_->input_paperoption) - return lyxrc.getDescription(LyXRC::RC_VIEWDVI_PAPEROPTION); + return LyXRC::getDescription(LyXRC::RC_VIEWDVI_PAPEROPTION); if (ob == dialog_->check_autoreset_classopt) - return lyxrc.getDescription(LyXRC::RC_AUTORESET_OPTIONS); + return LyXRC::getDescription(LyXRC::RC_AUTORESET_OPTIONS); return string(); } -void FormPreferences::OutputsMisc::update() +void FormPreferences::OutputsMisc::update(LyXRC const & rc) { fl_set_counter_value(dialog_->counter_line_len, - lyxrc.ascii_linelen); + rc.ascii_linelen); fl_set_input(dialog_->input_tex_encoding, - lyxrc.fontenc.c_str()); + rc.fontenc.c_str()); fl_set_choice(dialog_->choice_default_papersize, - lyxrc.default_papersize+1); + rc.default_papersize + 1); fl_set_input(dialog_->input_ascii_roff, - lyxrc.ascii_roff_command.c_str()); + rc.ascii_roff_command.c_str()); fl_set_input(dialog_->input_checktex, - lyxrc.chktex_command.c_str()); + rc.chktex_command.c_str()); fl_set_input(dialog_->input_paperoption, - lyxrc.view_dvi_paper_option.c_str()); + rc.view_dvi_paper_option.c_str()); fl_set_button(dialog_->check_autoreset_classopt, - lyxrc.auto_reset_options); + rc.auto_reset_options); } @@ -2028,26 +1809,26 @@ FD_preferences_paths const * FormPreferences::Paths::dialog() } -void FormPreferences::Paths::apply() +void FormPreferences::Paths::apply(LyXRC & rc) { - lyxrc.document_path = fl_get_input(dialog_->input_default_path); - lyxrc.template_path = fl_get_input(dialog_->input_template_path); + rc.document_path = fl_get_input(dialog_->input_default_path); + rc.template_path = fl_get_input(dialog_->input_template_path); int button = fl_get_button(dialog_->check_use_temp_dir); string str = fl_get_input(dialog_->input_temp_dir); if (!button) str.erase(); - lyxrc.use_tempdir = button; - lyxrc.tempdir_path = str; + rc.use_tempdir = button; + rc.tempdir_path = str; button = fl_get_button(dialog_->check_last_files); str = fl_get_input(dialog_->input_lastfiles); if (!button) str.erase(); - lyxrc.check_lastfiles = button; - lyxrc.lastfiles = str; - lyxrc.num_lastfiles = static_cast + rc.check_lastfiles = button; + rc.lastfiles = str; + rc.num_lastfiles = static_cast (fl_get_counter_value(dialog_->counter_lastfiles)); button = fl_get_button(dialog_->check_make_backups); @@ -2055,13 +1836,13 @@ void FormPreferences::Paths::apply() if (!button) str.erase(); - lyxrc.make_backup = button; - lyxrc.backupdir_path = str; + rc.make_backup = button; + rc.backupdir_path = str; - lyxrc.lyxpipes = fl_get_input(dialog_->input_serverpipe); + rc.lyxpipes = fl_get_input(dialog_->input_serverpipe); // update view - update(); + update(rc); } @@ -2095,25 +1876,25 @@ string const FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const { if (ob == dialog_->input_default_path) - return lyxrc.getDescription(LyXRC::RC_DOCUMENTPATH); + return LyXRC::getDescription(LyXRC::RC_DOCUMENTPATH); if (ob == dialog_->input_template_path) - return lyxrc.getDescription(LyXRC::RC_TEMPLATEPATH); + return LyXRC::getDescription(LyXRC::RC_TEMPLATEPATH); if (ob == dialog_->check_use_temp_dir) - return lyxrc.getDescription(LyXRC::RC_USETEMPDIR); + return LyXRC::getDescription(LyXRC::RC_USETEMPDIR); if (ob == dialog_->input_temp_dir) - return lyxrc.getDescription(LyXRC::RC_TEMPDIRPATH); + return LyXRC::getDescription(LyXRC::RC_TEMPDIRPATH); if (ob == dialog_->check_last_files) - return lyxrc.getDescription(LyXRC::RC_CHECKLASTFILES); + return LyXRC::getDescription(LyXRC::RC_CHECKLASTFILES); if (ob == dialog_->input_lastfiles) - return lyxrc.getDescription(LyXRC::RC_LASTFILES); + return LyXRC::getDescription(LyXRC::RC_LASTFILES); if (ob == dialog_->counter_lastfiles) - return lyxrc.getDescription(LyXRC::RC_NUMLASTFILES); + return LyXRC::getDescription(LyXRC::RC_NUMLASTFILES); if (ob == dialog_->check_make_backups) - return lyxrc.getDescription(LyXRC::RC_MAKE_BACKUP); + return LyXRC::getDescription(LyXRC::RC_MAKE_BACKUP); if (ob == dialog_->input_backup_path) - return lyxrc.getDescription(LyXRC::RC_BACKUPDIR_PATH); + return LyXRC::getDescription(LyXRC::RC_BACKUPDIR_PATH); if (ob == dialog_->input_serverpipe) - return lyxrc.getDescription(LyXRC::RC_SERVERPIPE); + return LyXRC::getDescription(LyXRC::RC_SERVERPIPE); return string(); } @@ -2203,65 +1984,75 @@ bool FormPreferences::Paths::input(FL_OBJECT const * const ob) } if (ob == dialog_->button_default_path_browse) { - parent_.browse(dialog_->input_default_path, - _("Default path"), string()); + string f = parent_.controller().browsedir( + fl_get_input(dialog_->input_default_path), _("Default path")); + if (!f.empty()) + fl_set_input(dialog_->input_default_path, f.c_str()); } else if (ob == dialog_->button_template_path_browse) { - parent_.browse(dialog_->input_template_path, - _("Template path"), string()); + string f = parent_.controller().browsedir( + fl_get_input(dialog_->input_template_path), _("Template path")); + if (!f.empty()) + fl_set_input(dialog_->input_template_path, f.c_str()); } else if (ob == dialog_->button_temp_dir_browse) { - parent_.browse(dialog_->input_temp_dir, - _("Temp dir"), string()); + string f = parent_.controller().browsedir( + fl_get_input(dialog_->input_temp_dir), _("Temporary dir")); + if (!f.empty()) + fl_set_input(dialog_->input_temp_dir, f.c_str()); } else if (ob == dialog_->button_lastfiles_browse) { - pair dir(_("User|#U#u"), user_lyxdir); - - parent_.browse(dialog_->input_lastfiles, - _("Lastfiles"), string(), dir); + string f = parent_.controller().browse( + fl_get_input(dialog_->input_lastfiles), _("Last files")); + if (!f.empty()) + fl_set_input(dialog_->input_lastfiles, f.c_str()); } else if (ob == dialog_->button_backup_path_browse) { - parent_.browse(dialog_->input_backup_path, - _("Backup path"), string()); + string f = parent_.controller().browsedir( + fl_get_input(dialog_->input_backup_path), _("Backup path")); + if (!f.empty()) + fl_set_input(dialog_->input_backup_path, f.c_str()); } else if (ob == dialog_->button_serverpipe_browse) { - parent_.browse(dialog_->input_serverpipe, - _("LyX Server pipes"), string()); + string f = parent_.controller().browse( + fl_get_input(dialog_->input_serverpipe), _("LyX server pipes")); + if (!f.empty()) + fl_set_input(dialog_->input_serverpipe, f.c_str()); } return activate; } -void FormPreferences::Paths::update() +void FormPreferences::Paths::update(LyXRC const & rc) { fl_set_input(dialog_->input_default_path, - lyxrc.document_path.c_str()); + rc.document_path.c_str()); fl_set_input(dialog_->input_template_path, - lyxrc.template_path.c_str()); + rc.template_path.c_str()); string str; - if (lyxrc.make_backup) - str = lyxrc.backupdir_path; + if (rc.make_backup) + str = rc.backupdir_path; fl_set_button(dialog_->check_make_backups, - lyxrc.make_backup); + rc.make_backup); fl_set_input(dialog_->input_backup_path, str.c_str()); str.erase(); - if (lyxrc.use_tempdir) - str = lyxrc.tempdir_path; + if (rc.use_tempdir) + str = rc.tempdir_path; fl_set_button(dialog_->check_use_temp_dir, - lyxrc.use_tempdir); + rc.use_tempdir); fl_set_input(dialog_->input_temp_dir, str.c_str()); str.erase(); - if (lyxrc.check_lastfiles) - str = lyxrc.lastfiles; + if (rc.check_lastfiles) + str = rc.lastfiles; fl_set_button(dialog_->check_last_files, - lyxrc.check_lastfiles); + rc.check_lastfiles); fl_set_input(dialog_->input_lastfiles, str.c_str()); fl_set_counter_value(dialog_->counter_lastfiles, - lyxrc.num_lastfiles); + rc.num_lastfiles); - fl_set_input(dialog_->input_serverpipe, lyxrc.lyxpipes.c_str()); + fl_set_input(dialog_->input_serverpipe, rc.lyxpipes.c_str()); // Activate/Deactivate the input fields dependent on the state of the // buttons. @@ -2280,31 +2071,31 @@ FD_preferences_printer const * FormPreferences::Printer::dialog() } -void FormPreferences::Printer::apply() const +void FormPreferences::Printer::apply(LyXRC & rc) const { - lyxrc.print_adapt_output = fl_get_button(dialog_->check_adapt_output); - lyxrc.print_command = fl_get_input(dialog_->input_command); - lyxrc.print_pagerange_flag = fl_get_input(dialog_->input_page_range); - lyxrc.print_copies_flag = fl_get_input(dialog_->input_copies); - lyxrc.print_reverse_flag = fl_get_input(dialog_->input_reverse); - lyxrc.print_to_printer = fl_get_input(dialog_->input_to_printer); - lyxrc.print_file_extension = + rc.print_adapt_output = fl_get_button(dialog_->check_adapt_output); + rc.print_command = fl_get_input(dialog_->input_command); + rc.print_pagerange_flag = fl_get_input(dialog_->input_page_range); + rc.print_copies_flag = fl_get_input(dialog_->input_copies); + rc.print_reverse_flag = fl_get_input(dialog_->input_reverse); + rc.print_to_printer = fl_get_input(dialog_->input_to_printer); + rc.print_file_extension = fl_get_input(dialog_->input_file_extension); - lyxrc.print_spool_command = + rc.print_spool_command = fl_get_input(dialog_->input_spool_command); - lyxrc.print_paper_flag = fl_get_input(dialog_->input_paper_type); - lyxrc.print_evenpage_flag = fl_get_input(dialog_->input_even_pages); - lyxrc.print_oddpage_flag = fl_get_input(dialog_->input_odd_pages); - lyxrc.print_collcopies_flag = fl_get_input(dialog_->input_collated); - lyxrc.print_landscape_flag = fl_get_input(dialog_->input_landscape); - lyxrc.print_to_file = fl_get_input(dialog_->input_to_file); - lyxrc.print_extra_options = + rc.print_paper_flag = fl_get_input(dialog_->input_paper_type); + rc.print_evenpage_flag = fl_get_input(dialog_->input_even_pages); + rc.print_oddpage_flag = fl_get_input(dialog_->input_odd_pages); + rc.print_collcopies_flag = fl_get_input(dialog_->input_collated); + rc.print_landscape_flag = fl_get_input(dialog_->input_landscape); + rc.print_to_file = fl_get_input(dialog_->input_to_file); + rc.print_extra_options = fl_get_input(dialog_->input_extra_options); - lyxrc.print_spool_printerprefix = + rc.print_spool_printerprefix = fl_get_input(dialog_->input_spool_prefix); - lyxrc.print_paper_dimension_flag = + rc.print_paper_dimension_flag = fl_get_input(dialog_->input_paper_size); - lyxrc.printer = fl_get_input(dialog_->input_name); + rc.printer = fl_get_input(dialog_->input_name); } @@ -2312,41 +2103,41 @@ string const FormPreferences::Printer::feedback(FL_OBJECT const * const ob) const { if (ob == dialog_->input_command) - return lyxrc.getDescription(LyXRC::RC_PRINT_COMMAND); + return LyXRC::getDescription(LyXRC::RC_PRINT_COMMAND); if (ob == dialog_->check_adapt_output) - return lyxrc.getDescription(LyXRC::RC_PRINT_ADAPTOUTPUT); + return LyXRC::getDescription(LyXRC::RC_PRINT_ADAPTOUTPUT); if (ob == dialog_->input_to_printer) - return lyxrc.getDescription(LyXRC::RC_PRINTTOPRINTER); + return LyXRC::getDescription(LyXRC::RC_PRINTTOPRINTER); if (ob == dialog_->input_to_file) - return lyxrc.getDescription(LyXRC::RC_PRINTTOFILE); + return LyXRC::getDescription(LyXRC::RC_PRINTTOFILE); if (ob == dialog_->input_file_extension) - return lyxrc.getDescription(LyXRC::RC_PRINTFILEEXTENSION); + return LyXRC::getDescription(LyXRC::RC_PRINTFILEEXTENSION); if (ob == dialog_->input_extra_options) - return lyxrc.getDescription(LyXRC::RC_PRINTEXSTRAOPTIONS); + return LyXRC::getDescription(LyXRC::RC_PRINTEXSTRAOPTIONS); if (ob == dialog_->input_spool_command) - return lyxrc.getDescription(LyXRC::RC_PRINTSPOOL_COMMAND); + return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_COMMAND); if (ob == dialog_->input_spool_prefix) - return lyxrc.getDescription(LyXRC::RC_PRINTSPOOL_PRINTERPREFIX); + return LyXRC::getDescription(LyXRC::RC_PRINTSPOOL_PRINTERPREFIX); if (ob == dialog_->input_name) - return lyxrc.getDescription(LyXRC::RC_PRINTER); + return LyXRC::getDescription(LyXRC::RC_PRINTER); if (ob == dialog_->input_even_pages) - return lyxrc.getDescription(LyXRC::RC_PRINTEVENPAGEFLAG); + return LyXRC::getDescription(LyXRC::RC_PRINTEVENPAGEFLAG); if (ob == dialog_->input_odd_pages) - return lyxrc.getDescription(LyXRC::RC_PRINTODDPAGEFLAG); + return LyXRC::getDescription(LyXRC::RC_PRINTODDPAGEFLAG); if (ob == dialog_->input_page_range) - return lyxrc.getDescription(LyXRC::RC_PRINTPAGERANGEFLAG); + return LyXRC::getDescription(LyXRC::RC_PRINTPAGERANGEFLAG); if (ob == dialog_->input_reverse) - return lyxrc.getDescription(LyXRC::RC_PRINTREVERSEFLAG); + return LyXRC::getDescription(LyXRC::RC_PRINTREVERSEFLAG); if (ob == dialog_->input_landscape) - return lyxrc.getDescription(LyXRC::RC_PRINTLANDSCAPEFLAG); + return LyXRC::getDescription(LyXRC::RC_PRINTLANDSCAPEFLAG); if (ob == dialog_->input_copies) - return lyxrc.getDescription(LyXRC::RC_PRINTCOPIESFLAG); + return LyXRC::getDescription(LyXRC::RC_PRINTCOPIESFLAG); if (ob == dialog_->input_collated) - return lyxrc.getDescription(LyXRC::RC_PRINTCOLLCOPIESFLAG); + return LyXRC::getDescription(LyXRC::RC_PRINTCOLLCOPIESFLAG); if (ob == dialog_->input_paper_type) - return lyxrc.getDescription(LyXRC::RC_PRINTPAPERFLAG); + return LyXRC::getDescription(LyXRC::RC_PRINTPAPERFLAG); if (ob == dialog_->input_paper_size) - return lyxrc.getDescription(LyXRC::RC_PRINTPAPERDIMENSIONFLAG); + return LyXRC::getDescription(LyXRC::RC_PRINTPAPERDIMENSIONFLAG); return string(); } @@ -2395,44 +2186,44 @@ void FormPreferences::Printer::build() } -void FormPreferences::Printer::update() +void FormPreferences::Printer::update(LyXRC const & rc) { fl_set_button(dialog_->check_adapt_output, - lyxrc.print_adapt_output); + rc.print_adapt_output); fl_set_input(dialog_->input_command, - lyxrc.print_command.c_str()); + rc.print_command.c_str()); fl_set_input(dialog_->input_page_range, - lyxrc.print_pagerange_flag.c_str()); + rc.print_pagerange_flag.c_str()); fl_set_input(dialog_->input_copies, - lyxrc.print_copies_flag.c_str()); + rc.print_copies_flag.c_str()); fl_set_input(dialog_->input_reverse, - lyxrc.print_reverse_flag.c_str()); + rc.print_reverse_flag.c_str()); fl_set_input(dialog_->input_to_printer, - lyxrc.print_to_printer.c_str()); + rc.print_to_printer.c_str()); fl_set_input(dialog_->input_file_extension, - lyxrc.print_file_extension.c_str()); + rc.print_file_extension.c_str()); fl_set_input(dialog_->input_spool_command, - lyxrc.print_spool_command.c_str()); + rc.print_spool_command.c_str()); fl_set_input(dialog_->input_paper_type, - lyxrc.print_paper_flag.c_str()); + rc.print_paper_flag.c_str()); fl_set_input(dialog_->input_even_pages, - lyxrc.print_evenpage_flag.c_str()); + rc.print_evenpage_flag.c_str()); fl_set_input(dialog_->input_odd_pages, - lyxrc.print_oddpage_flag.c_str()); + rc.print_oddpage_flag.c_str()); fl_set_input(dialog_->input_collated, - lyxrc.print_collcopies_flag.c_str()); + rc.print_collcopies_flag.c_str()); fl_set_input(dialog_->input_landscape, - lyxrc.print_landscape_flag.c_str()); + rc.print_landscape_flag.c_str()); fl_set_input(dialog_->input_to_file, - lyxrc.print_to_file.c_str()); + rc.print_to_file.c_str()); fl_set_input(dialog_->input_extra_options, - lyxrc.print_extra_options.c_str()); + rc.print_extra_options.c_str()); fl_set_input(dialog_->input_spool_prefix, - lyxrc.print_spool_printerprefix.c_str()); + rc.print_spool_printerprefix.c_str()); fl_set_input(dialog_->input_paper_size, - lyxrc.print_paper_dimension_flag.c_str()); + rc.print_paper_dimension_flag.c_str()); fl_set_input(dialog_->input_name, - lyxrc.printer.c_str()); + rc.printer.c_str()); } @@ -2447,118 +2238,126 @@ FD_preferences_screen_fonts const * FormPreferences::ScreenFonts::dialog() } -void FormPreferences::ScreenFonts::apply() const +void FormPreferences::ScreenFonts::apply(LyXRC & rc) const { bool changed = false; - string str = fl_get_input(dialog_->input_roman); - if (lyxrc.roman_font_name != str) { + pair tmp = + parseFontName(fl_get_input(dialog_->input_roman)); + if (rc.roman_font_name != tmp.first || + rc.roman_font_foundry != tmp.second) { changed = true; - lyxrc.roman_font_name = str; + rc.roman_font_name = tmp.first; + rc.roman_font_foundry = tmp.second; } - str = fl_get_input(dialog_->input_sans); - if (lyxrc.sans_font_name != str) { + tmp = parseFontName(fl_get_input(dialog_->input_sans)); + if (rc.sans_font_name != tmp.first || + rc.sans_font_foundry != tmp.second) { changed = true; - lyxrc.sans_font_name = str; + rc.sans_font_name = tmp.first; + rc.sans_font_foundry = tmp.second; } - str = fl_get_input(dialog_->input_typewriter); - if (lyxrc.typewriter_font_name != str) { + tmp = parseFontName(fl_get_input(dialog_->input_typewriter)); + if (rc.typewriter_font_name != tmp.first || + rc.typewriter_font_foundry != tmp.second) { changed = true; - lyxrc.typewriter_font_name = str; + rc.typewriter_font_name = tmp.first; + rc.typewriter_font_foundry = tmp.second; } - str = fl_get_input(dialog_->input_screen_encoding); - if (lyxrc.font_norm != str) { + string str = fl_get_input(dialog_->input_screen_encoding); + if (rc.font_norm != str) { changed = true; - lyxrc.font_norm = str; + rc.font_norm = str; + rc.set_font_norm_type(); } bool button = fl_get_button(dialog_->check_scalable); - if (lyxrc.use_scalable_fonts != button) { + if (rc.use_scalable_fonts != button) { changed = true; - lyxrc.use_scalable_fonts = button; + rc.use_scalable_fonts = button; } unsigned int ivalue = static_cast (fl_get_counter_value(dialog_->counter_zoom)); - if (lyxrc.zoom != ivalue) { + if (rc.zoom != ivalue) { changed = true; - lyxrc.zoom = ivalue; + rc.zoom = ivalue; } ivalue = static_cast (fl_get_counter_value(dialog_->counter_dpi)); - if (lyxrc.dpi != ivalue) { + if (rc.dpi != ivalue) { changed = true; - lyxrc.dpi = ivalue; + rc.dpi = ivalue; } double dvalue = strToDbl(fl_get_input(dialog_->input_tiny)); - if (lyxrc.font_sizes[LyXFont::SIZE_TINY] != dvalue) { + if (rc.font_sizes[LyXFont::SIZE_TINY] != dvalue) { changed = true; - lyxrc.font_sizes[LyXFont::SIZE_TINY] = dvalue; + rc.font_sizes[LyXFont::SIZE_TINY] = dvalue; } dvalue = strToDbl(fl_get_input(dialog_->input_script)); - if (lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue) { + if (rc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue) { changed = true; - lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] = dvalue; + rc.font_sizes[LyXFont::SIZE_SCRIPT] = dvalue; } dvalue = strToDbl(fl_get_input(dialog_->input_footnote)); - if (lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue) { + if (rc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue) { changed = true; - lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] = dvalue; + rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = dvalue; } dvalue = strToDbl(fl_get_input(dialog_->input_small)); - if (lyxrc.font_sizes[LyXFont::SIZE_SMALL] != dvalue) { + if (rc.font_sizes[LyXFont::SIZE_SMALL] != dvalue) { changed = true; - lyxrc.font_sizes[LyXFont::SIZE_SMALL] = dvalue; + rc.font_sizes[LyXFont::SIZE_SMALL] = dvalue; } dvalue = strToDbl(fl_get_input(dialog_->input_normal)); - if (lyxrc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue) { + if (rc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue) { changed = true; - lyxrc.font_sizes[LyXFont::SIZE_NORMAL] = dvalue; + rc.font_sizes[LyXFont::SIZE_NORMAL] = dvalue; } dvalue = strToDbl(fl_get_input(dialog_->input_large)); - if (lyxrc.font_sizes[LyXFont::SIZE_LARGE] != dvalue) { + if (rc.font_sizes[LyXFont::SIZE_LARGE] != dvalue) { changed = true; - lyxrc.font_sizes[LyXFont::SIZE_LARGE] = dvalue; + rc.font_sizes[LyXFont::SIZE_LARGE] = dvalue; } dvalue = strToDbl(fl_get_input(dialog_->input_larger)); - if (lyxrc.font_sizes[LyXFont::SIZE_LARGER] != dvalue) { + if (rc.font_sizes[LyXFont::SIZE_LARGER] != dvalue) { changed = true; - lyxrc.font_sizes[LyXFont::SIZE_LARGER] = dvalue; + rc.font_sizes[LyXFont::SIZE_LARGER] = dvalue; } dvalue = strToDbl(fl_get_input(dialog_->input_largest)); - if (lyxrc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue) { + if (rc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue) { changed = true; - lyxrc.font_sizes[LyXFont::SIZE_LARGEST] = dvalue; + rc.font_sizes[LyXFont::SIZE_LARGEST] = dvalue; } dvalue = strToDbl(fl_get_input(dialog_->input_huge)); - if (lyxrc.font_sizes[LyXFont::SIZE_HUGE] != dvalue) { + if (rc.font_sizes[LyXFont::SIZE_HUGE] != dvalue) { changed = true; - lyxrc.font_sizes[LyXFont::SIZE_HUGE] = dvalue; + rc.font_sizes[LyXFont::SIZE_HUGE] = dvalue; } dvalue = strToDbl(fl_get_input(dialog_->input_huger)); - if (lyxrc.font_sizes[LyXFont::SIZE_HUGER] != dvalue) { + if (rc.font_sizes[LyXFont::SIZE_HUGER] != dvalue) { changed = true; - lyxrc.font_sizes[LyXFont::SIZE_HUGER] = dvalue; + rc.font_sizes[LyXFont::SIZE_HUGER] = dvalue; } if (changed) { // Now update the buffers // Can anything below here affect the redraw process? - parent_.lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE)); + parent_.controller().updateScreenFonts(); } } @@ -2623,31 +2422,31 @@ string const FormPreferences::ScreenFonts::feedback(FL_OBJECT const * const ob) const { if (ob == dialog_->input_roman) - return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_ROMAN); + return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ROMAN); if (ob == dialog_->input_sans) - return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_SANS); + return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SANS); if (ob == dialog_->input_typewriter) - return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_TYPEWRITER); + return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_TYPEWRITER); if (ob == dialog_->check_scalable) - return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_SCALABLE); + return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_SCALABLE); if (ob == dialog_->input_screen_encoding) - return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_ENCODING); + return LyXRC::getDescription(LyXRC::RC_SCREEN_FONT_ENCODING); if (ob == dialog_->counter_zoom) - return lyxrc.getDescription(LyXRC::RC_SCREEN_ZOOM); + return LyXRC::getDescription(LyXRC::RC_SCREEN_ZOOM); if (ob == dialog_->counter_dpi) - return lyxrc.getDescription(LyXRC::RC_SCREEN_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) - return lyxrc.getDescription(LyXRC::RC_SCREEN_FONT_SIZES); + || 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(); } @@ -2693,7 +2492,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) @@ -2703,40 +2502,43 @@ bool FormPreferences::ScreenFonts::input() } -void FormPreferences::ScreenFonts::update() +void FormPreferences::ScreenFonts::update(LyXRC const & rc) { fl_set_input(dialog_->input_roman, - lyxrc.roman_font_name.c_str()); + makeFontName(rc.roman_font_name, + rc.roman_font_foundry).c_str()); fl_set_input(dialog_->input_sans, - lyxrc.sans_font_name.c_str()); + makeFontName(rc.sans_font_name, + rc.sans_font_foundry).c_str()); fl_set_input(dialog_->input_typewriter, - lyxrc.typewriter_font_name.c_str()); + makeFontName(rc.typewriter_font_name, + rc.typewriter_font_foundry).c_str()); fl_set_input(dialog_->input_screen_encoding, - lyxrc.font_norm.c_str()); + rc.font_norm.c_str()); fl_set_button(dialog_->check_scalable, - lyxrc.use_scalable_fonts); - fl_set_counter_value(dialog_->counter_zoom, lyxrc.zoom); - fl_set_counter_value(dialog_->counter_dpi, lyxrc.dpi); + rc.use_scalable_fonts); + fl_set_counter_value(dialog_->counter_zoom, rc.zoom); + fl_set_counter_value(dialog_->counter_dpi, rc.dpi); fl_set_input(dialog_->input_tiny, - tostr(lyxrc.font_sizes[LyXFont::SIZE_TINY]).c_str()); + tostr(rc.font_sizes[LyXFont::SIZE_TINY]).c_str()); fl_set_input(dialog_->input_script, - tostr(lyxrc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str()); + tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str()); fl_set_input(dialog_->input_footnote, - tostr(lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str()); + tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str()); fl_set_input(dialog_->input_small, - tostr(lyxrc.font_sizes[LyXFont::SIZE_SMALL]).c_str()); + tostr(rc.font_sizes[LyXFont::SIZE_SMALL]).c_str()); fl_set_input(dialog_->input_normal, - tostr(lyxrc.font_sizes[LyXFont::SIZE_NORMAL]).c_str()); + tostr(rc.font_sizes[LyXFont::SIZE_NORMAL]).c_str()); fl_set_input(dialog_->input_large, - tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGE]).c_str()); + tostr(rc.font_sizes[LyXFont::SIZE_LARGE]).c_str()); fl_set_input(dialog_->input_larger, - tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGER]).c_str()); + tostr(rc.font_sizes[LyXFont::SIZE_LARGER]).c_str()); fl_set_input(dialog_->input_largest, - tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGEST]).c_str()); + tostr(rc.font_sizes[LyXFont::SIZE_LARGEST]).c_str()); fl_set_input(dialog_->input_huge, - tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGE]).c_str()); + tostr(rc.font_sizes[LyXFont::SIZE_HUGE]).c_str()); fl_set_input(dialog_->input_huger, - tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGER]).c_str()); + tostr(rc.font_sizes[LyXFont::SIZE_HUGER]).c_str()); } @@ -2752,28 +2554,27 @@ FD_preferences_spelloptions const * FormPreferences::SpellOptions::dialog() } -void FormPreferences::SpellOptions::apply() +void FormPreferences::SpellOptions::apply(LyXRC & rc) { - string choice = fl_get_choice_text(dialog_->choice_spell_command); choice = trim(choice); - lyxrc.isp_command = choice; + rc.isp_command = choice; #if 0 // If spell checker == "none", all other input set to off. if (fl_get_choice(dialog_->choice_spell_command) == 1) { - lyxrc.isp_use_alt_lang = false; - lyxrc.isp_alt_lang.erase(); + rc.isp_use_alt_lang = false; + rc.isp_alt_lang.erase(); - lyxrc.isp_use_esc_chars = false; - lyxrc.isp_esc_chars.erase(); + rc.isp_use_esc_chars = false; + rc.isp_esc_chars.erase(); - lyxrc.isp_use_pers_dict = false; - lyxrc.isp_pers_dict.erase(); + rc.isp_use_pers_dict = false; + rc.isp_pers_dict.erase(); - lyxrc.isp_accept_compound = false; - lyxrc.isp_use_input_encoding = false; + rc.isp_accept_compound = false; + rc.isp_use_input_encoding = false; } else { #else int button = fl_get_button(dialog_->check_alt_lang); @@ -2781,37 +2582,37 @@ void FormPreferences::SpellOptions::apply() if (button && choice.empty()) button = 0; if (!button) choice.erase(); - lyxrc.isp_use_alt_lang = static_cast(button); - lyxrc.isp_alt_lang = choice; + rc.isp_use_alt_lang = static_cast(button); + rc.isp_alt_lang = choice; button = fl_get_button(dialog_->check_escape_chars); choice = fl_get_input(dialog_->input_escape_chars); if (button && choice.empty()) button = 0; if (!button) choice.erase(); - lyxrc.isp_use_esc_chars = static_cast(button); - lyxrc.isp_esc_chars = choice; + rc.isp_use_esc_chars = static_cast(button); + rc.isp_esc_chars = choice; button = fl_get_button(dialog_->check_personal_dict); choice = fl_get_input(dialog_->input_personal_dict); if (button && choice.empty()) button = 0; if (!button) choice.erase(); - lyxrc.isp_use_pers_dict = static_cast(button); - lyxrc.isp_pers_dict = choice; + rc.isp_use_pers_dict = static_cast(button); + rc.isp_pers_dict = choice; button = fl_get_button(dialog_->check_compound_words); - lyxrc.isp_accept_compound = static_cast(button); + rc.isp_accept_compound = static_cast(button); button = fl_get_button(dialog_->check_input_enc); - lyxrc.isp_use_input_encoding = static_cast(button); + rc.isp_use_input_encoding = static_cast(button); #endif #if 0 } #endif // Reset view - update(); + update(rc); } @@ -2820,7 +2621,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); @@ -2843,23 +2644,23 @@ string const FormPreferences::SpellOptions::feedback(FL_OBJECT const * const ob) const { if (ob == dialog_->choice_spell_command) - return lyxrc.getDescription(LyXRC::RC_SPELL_COMMAND); + return LyXRC::getDescription(LyXRC::RC_SPELL_COMMAND); if (ob == dialog_->check_alt_lang) - return lyxrc.getDescription(LyXRC::RC_USE_ALT_LANG); + return LyXRC::getDescription(LyXRC::RC_USE_ALT_LANG); if (ob == dialog_->input_alt_lang) - return lyxrc.getDescription(LyXRC::RC_ALT_LANG); + return LyXRC::getDescription(LyXRC::RC_ALT_LANG); if (ob == dialog_->check_escape_chars) - return lyxrc.getDescription(LyXRC::RC_USE_ESC_CHARS); + return LyXRC::getDescription(LyXRC::RC_USE_ESC_CHARS); if (ob == dialog_->input_escape_chars) - return lyxrc.getDescription(LyXRC::RC_ESC_CHARS); + return LyXRC::getDescription(LyXRC::RC_ESC_CHARS); if (ob == dialog_->check_personal_dict) - return lyxrc.getDescription(LyXRC::RC_USE_PERS_DICT); + return LyXRC::getDescription(LyXRC::RC_USE_PERS_DICT); if (ob == dialog_->input_personal_dict) - return lyxrc.getDescription(LyXRC::RC_PERS_DICT); + return LyXRC::getDescription(LyXRC::RC_PERS_DICT); if (ob == dialog_->check_compound_words) - return lyxrc.getDescription(LyXRC::RC_ACCEPT_COMPOUND); + return LyXRC::getDescription(LyXRC::RC_ACCEPT_COMPOUND); if (ob == dialog_->check_input_enc) - return lyxrc.getDescription(LyXRC::RC_USE_INP_ENC); + return LyXRC::getDescription(LyXRC::RC_USE_INP_ENC); return string(); } @@ -2909,83 +2710,63 @@ bool FormPreferences::SpellOptions::input(FL_OBJECT const * const ob) } if (ob == dialog_->button_personal_dict) { - parent_.browse(dialog_->input_personal_dict, - _("Personal dictionary"), "*.ispell"); + string f = parent_.controller().browsedict( + fl_get_input(dialog_->input_personal_dict)); + fl_set_input(dialog_->input_personal_dict, f.c_str()); } return true; // All input is valid! } -void FormPreferences::SpellOptions::update() +void FormPreferences::SpellOptions::update(LyXRC const & rc) { int choice = 1; #if 0 - if (lyxrc.isp_command == "none") + if (rc.isp_command == "none") choice = 1; - else if (lyxrc.isp_command == "ispell") + else if (rc.isp_command == "ispell") choice = 2; - else if (lyxrc.isp_command == "aspell") + else if (rc.isp_command == "aspell") choice = 3; #else - if (lyxrc.isp_command == "ispell") + if (rc.isp_command == "ispell") choice = 1; - else if (lyxrc.isp_command == "aspell") + else if (rc.isp_command == "aspell") choice = 2; #endif fl_set_choice(dialog_->choice_spell_command, choice); string str; - if (lyxrc.isp_use_alt_lang) - str = lyxrc.isp_alt_lang; + if (rc.isp_use_alt_lang) + str = rc.isp_alt_lang; fl_set_button(dialog_->check_alt_lang, - lyxrc.isp_use_alt_lang); + rc.isp_use_alt_lang); fl_set_input(dialog_->input_alt_lang, str.c_str()); str.erase(); - if (lyxrc.isp_use_esc_chars) - str = lyxrc.isp_esc_chars; + if (rc.isp_use_esc_chars) + str = rc.isp_esc_chars; fl_set_button(dialog_->check_escape_chars, - lyxrc.isp_use_esc_chars); + rc.isp_use_esc_chars); fl_set_input(dialog_->input_escape_chars, str.c_str()); str.erase(); - if (lyxrc.isp_use_pers_dict) - str = lyxrc.isp_pers_dict; + if (rc.isp_use_pers_dict) + str = rc.isp_pers_dict; fl_set_button(dialog_->check_personal_dict, - lyxrc.isp_use_pers_dict); + rc.isp_use_pers_dict); fl_set_input(dialog_->input_personal_dict, str.c_str()); fl_set_button(dialog_->check_compound_words, - lyxrc.isp_accept_compound); + rc.isp_accept_compound); fl_set_button(dialog_->check_input_enc, - lyxrc.isp_use_input_encoding); + rc.isp_use_input_encoding); // Activate/Deactivate the input fields dependent on the state of the // buttons. input(0); } - - -void FormPreferences::browse(FL_OBJECT * inpt, - string const & title, - string const & pattern, - pair const & dir1, - pair const & dir2) -{ - // Get the filename from the dialog - string const filename = fl_get_input(inpt); - - // Show the file browser dialog - string const new_filename = - browseFile(&lv_, filename, title, pattern, dir1, dir2); - - // Save the filename to the dialog - if (new_filename != filename && !new_filename.empty()) { - fl_set_input(inpt, new_filename.c_str()); - input(inpt, 0); - } -}