]> git.lyx.org Git - features.git/commitdiff
Fix bug 749: xforms gui prefs not saved.
authorAngus Leeming <leeming@lyx.org>
Fri, 29 Nov 2002 10:16:58 +0000 (10:16 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 29 Nov 2002 10:16:58 +0000 (10:16 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5748 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlButtons.h
src/frontends/controllers/ControlPrefs.C
src/frontends/controllers/ControlPrefs.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormPreferences.C

index 097d2d20bf7cbe809350651342175efb7ff86867..0d0acd499377615979023131f69ddeae7c095ddd 100644 (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>
  
         * ControlSpellchecker.C: fix Lars' broken cleanup
index e1600a2d79e317b5884f89119bd952ff78989d17..07b7f7e274f65a75b000096cc1f1c999e3a240dc 100644 (file)
@@ -49,8 +49,8 @@ public:
         */
        ///
        void ApplyButton();
-       /// virtual for ControlPrefs
-       virtual void OKButton();
+       ///
+       void OKButton();
        ///
        void CancelButton();
        ///
@@ -66,14 +66,14 @@ public:
        void setView(ViewBase &);
        ///
        void setButtonController(ButtonControllerBase &);
-protected:
-       ///
-       ViewBase & view();
-
        /** When Applying it's useful to know whether the dialog is about
            to close or not (no point refreshing the display for example). */
        bool isClosing() const { return is_closing_; }
 
+protected:
+       ///
+       ViewBase & view();
+
        /// Get changed parameters and Dispatch them to the kernel.
        virtual void apply() = 0;
        /// Disconnect signals and hide View.
index 499968c3295f6ca8b910f4872dd56e0aa97ed009..fea1d823c1aa8d58005b65a859ade660588e1ce3 100644 (file)
@@ -48,13 +48,11 @@ void ControlPrefs::apply()
 {
        view().apply();
        lyxrc = rc_;
-}
-
 
-void ControlPrefs::OKButton()
-{
-       ControlDialogBI::OKButton();
-       lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
+       // The Save button has been pressed
+       if (isClosing()) {
+               lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
+       }
 }
 
 
index 2c0afe5f8da44d3235013b05764c9d3a1e0e2704..bbdb54d8b456b47ee3085c2d88e99d9dc3a54492 100644 (file)
@@ -39,9 +39,6 @@ public:
 
        LyXRC const & rc() const { return rc_; }
  
-       /// make OK do the save
-       virtual void OKButton();
        /// various file pickers
        string const browsebind(string const & file);
        string const browseUI(string const & file);
index afedbb3f6c2dcbde00d1263c687cffd1070cb88a..605169f722e308b1ff1929347504631bcd835da7 100644 (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>
 
        * forms_gettext.[Ch] (scex, idex): re-written to receive and return
index 05729deb1a9daadeafae25bb9e964f87a1256d7b..8d29e5e33bfbeea27cd23609dd24c06c90fea808 100644 (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()
 {
        // We need to hide the active tabfolder otherwise we get a
@@ -302,6 +284,13 @@ void FormPreferences::apply()
        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);
+       }
 }