Fix bug 749: xforms gui prefs not saved.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5748 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-11-29 10:16:58 +00:00
parent 08001ad6df
commit 9068fa3b33
6 changed files with 34 additions and 33 deletions

View File

@ -1,3 +1,15 @@
2002-11-29 Angus Leeming <leeming@lyx.org>
* ControlButtons.h (isClosing): make it public, so that the view can
see it too.
(OKButton): no longer virtual. ControlPrefs should use isClosing() from
within apply.
* ControlPrefs.[Ch] (OKButton): removed.
* ControlPrefs.C (apply): dispatch a LFUN_SAVEPREFERENCES if the
dialog isClosing(). (Ie, if the "save" button has been pressed.)
2002-11-28 John Levon <levon@movementarian.org> 2002-11-28 John Levon <levon@movementarian.org>
* ControlSpellchecker.C: fix Lars' broken cleanup * ControlSpellchecker.C: fix Lars' broken cleanup

View File

@ -49,8 +49,8 @@ public:
*/ */
/// ///
void ApplyButton(); void ApplyButton();
/// virtual for ControlPrefs ///
virtual void OKButton(); void OKButton();
/// ///
void CancelButton(); void CancelButton();
/// ///
@ -66,14 +66,14 @@ public:
void setView(ViewBase &); void setView(ViewBase &);
/// ///
void setButtonController(ButtonControllerBase &); void setButtonController(ButtonControllerBase &);
protected:
///
ViewBase & view();
/** When Applying it's useful to know whether the dialog is about /** When Applying it's useful to know whether the dialog is about
to close or not (no point refreshing the display for example). */ to close or not (no point refreshing the display for example). */
bool isClosing() const { return is_closing_; } bool isClosing() const { return is_closing_; }
protected:
///
ViewBase & view();
/// Get changed parameters and Dispatch them to the kernel. /// Get changed parameters and Dispatch them to the kernel.
virtual void apply() = 0; virtual void apply() = 0;
/// Disconnect signals and hide View. /// Disconnect signals and hide View.

View File

@ -48,13 +48,11 @@ void ControlPrefs::apply()
{ {
view().apply(); view().apply();
lyxrc = rc_; lyxrc = rc_;
}
// The Save button has been pressed
void ControlPrefs::OKButton() if (isClosing()) {
{ lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
ControlDialogBI::OKButton(); }
lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
} }

View File

@ -39,9 +39,6 @@ public:
LyXRC const & rc() const { return rc_; } LyXRC const & rc() const { return rc_; }
/// make OK do the save
virtual void OKButton();
/// various file pickers /// various file pickers
string const browsebind(string const & file); string const browsebind(string const & file);
string const browseUI(string const & file); string const browseUI(string const & file);

View File

@ -1,3 +1,8 @@
2002-11-29 Angus Leeming <leeming@lyx.org>
* FormPreferences.C (apply): if controller().isClosing() (ie, if the
"save" button has been pressed), then save any modified gui colors.
2002-11-29 Angus Leeming <leeming@lyx.org> 2002-11-29 Angus Leeming <leeming@lyx.org>
* forms_gettext.[Ch] (scex, idex): re-written to receive and return * forms_gettext.[Ch] (scex, idex): re-written to receive and return

View File

@ -135,24 +135,6 @@ void FormPreferences::redraw()
} }
#if 0
void FormPreferences::ok()
{
FormBaseDeprecated::ok();
// FIXME !!
if (colors_.modifiedXformsPrefs) {
string const filename =
AddName(user_lyxdir, "preferences.xform");
colors_.modifiedXformsPrefs = !XformsColor::write(filename);
}
lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
}
#endif
void FormPreferences::hide() void FormPreferences::hide()
{ {
// We need to hide the active tabfolder otherwise we get a // We need to hide the active tabfolder otherwise we get a
@ -302,6 +284,13 @@ void FormPreferences::apply()
printer_.apply(rc); printer_.apply(rc);
screen_fonts_.apply(rc); screen_fonts_.apply(rc);
spelloptions_.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);
}
} }