remove the hack, do it in Qt2 instead

update buttons properly

thanks
john

-- 
"That's just kitten-eating wrong."
        - Richard Henderson
? a.diff
Index: ButtonController.h
===================================================================
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ButtonController.h,v
retrieving revision 1.10
diff -u -r1.10 ButtonController.h
--- ButtonController.h  2001/06/16 14:48:12     1.10
+++ ButtonController.h  2001/08/26 00:29:55
@@ -21,6 +21,7 @@
 
 #include "gettext.h"
 #include "ButtonControllerBase.h"
+#include "debug.h" 
 
 template <class Button, class Widget>
 class GuiBC : public ButtonControllerBase
@@ -75,6 +76,8 @@
 template <class Button, class Widget>
 void GuiBC<Button, Widget>::refresh()
 {
+       lyxerr[Debug::GUI] << "Calling BC refresh()" << std::endl; 
+ 
        if (okay_) {
                bool const enabled = bp().buttonStatus(ButtonPolicy::OKAY);
                setButtonEnabled(okay_, enabled);
Index: ButtonControllerBase.C
===================================================================
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ButtonControllerBase.C,v
retrieving revision 1.5
diff -u -r1.5 ButtonControllerBase.C
--- ButtonControllerBase.C      2001/06/13 15:11:16     1.5
+++ ButtonControllerBase.C      2001/08/26 00:29:55
@@ -18,6 +18,7 @@
 #include <config.h>
 #include "ButtonControllerBase.h"
 #include "support/LAssert.h"
+#include "debug.h" 
 
 
 ButtonControllerBase::ButtonControllerBase(string const & cancel,
@@ -82,12 +83,15 @@
 
 bool ButtonControllerBase::readOnly(bool ro)
 {
+       lyxerr[Debug::GUI] << "Setting controller ro: " << ro << std::endl;
+ 
        if (ro) {
                bp().input(ButtonPolicy::SMI_READ_ONLY);
        } else {
                bp().input(ButtonPolicy::SMI_READ_WRITE);
        }
        refreshReadOnly();
+       refresh();
        return ro;
 }
 
Index: ButtonPolicies.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ButtonPolicies.C,v
retrieving revision 1.6
diff -u -r1.6 ButtonPolicies.C
--- ButtonPolicies.C    2001/06/13 15:11:16     1.6
+++ ButtonPolicies.C    2001/08/26 00:29:56
@@ -34,6 +34,11 @@
        if (ButtonPolicy::SMI_NOOP == in) return;
 
        ButtonPolicy::State tmp = s_m[state][in];
+
+       lyxerr[Debug::GUI] << "Transition from state "
+               << state << " to state " << tmp << " after input "
+               << in << std::endl;
+ 
        if (ButtonPolicy::BOGUS != tmp) {
                state = tmp;
        } else {
Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v
retrieving revision 1.78
diff -u -r1.78 ChangeLog
--- ChangeLog   2001/08/24 15:49:03     1.78
+++ ChangeLog   2001/08/26 00:30:00
@@ -1,3 +1,15 @@
+2001-08-25  John Levon  <[EMAIL PROTECTED]>
+
+       * ControlInset.h:
+       * ControlDialogs.h: remove bc() hack, now fixed in
+         Qt2 frontend. use member dialog_built_ instead of shared
+         static.
+ 
+       * ButtonController.h: 
+       * ButtonPolicies.C: more debug info
+ 
+       * ButtonControllerBase.C: call refresh() when setting readOnly !
+ 
 2001-08-15  Angus Leeming  <[EMAIL PROTECTED]>
 
        * ControlInset.h (apply): tentative fix for the press Apply multiple
Index: ControlCommand.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlCommand.h,v
retrieving revision 1.6
diff -u -r1.6 ControlCommand.h
--- ControlCommand.h    2001/06/13 14:33:30     1.6
+++ ControlCommand.h    2001/08/26 00:30:00
@@ -40,7 +40,7 @@
        ///
        ControlCommand(LyXView &, Dialogs &, kb_action=LFUN_NOACTION);
 
-private:
+protected:
        /// Dispatch the changed parameters to the kernel.
        virtual void applyParamsToInset();
        /// 
Index: ControlDialogs.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlDialogs.h,v
retrieving revision 1.7
diff -u -r1.7 ControlDialogs.h
--- ControlDialogs.h    2001/08/24 14:57:27     1.7
+++ ControlDialogs.h    2001/08/26 00:30:00
@@ -21,6 +21,7 @@
 #define CONTROLDIALOGS_H
 
 #include "ControlConnections.h"
+#include "debug.h"
 
 /** Base class to control connection/disconnection of signals with the LyX
     kernel for dialogs NOT used with insets.
@@ -45,6 +46,9 @@
        virtual void clearParams() {}
        /// set the params before show or update
        virtual void setParams() {}
+
+       /// is the dialog built ?
+       bool dialog_built_;
 };
 
 
@@ -52,7 +56,7 @@
 
 template <class Base>
 ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
-       : Base(lv, d)
+       : Base(lv, d), dialog_built_(false)
 {}
 
 
@@ -64,10 +68,9 @@
 
        setParams();
 
-       static bool isBuilt = false;
-       if (!isBuilt) {
-               isBuilt = true;
+       if (!dialog_built_) {
                view().build();
+               dialog_built_ = true;
        }
 
        bc().readOnly(isReadonly());
@@ -83,10 +86,6 @@
        setParams();
 
        bc().readOnly(isReadonly());
-       // Reset the Button Controller to it's initial state
-       bc().invalid();
-       bc().restore();
-
        view().update();
 }
 
Index: ControlInset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlInset.h,v
retrieving revision 1.14
diff -u -r1.14 ControlInset.h
--- ControlInset.h      2001/08/24 15:49:03     1.14
+++ ControlInset.h      2001/08/26 00:30:00
@@ -96,13 +96,17 @@
            Memory is allocated only whilst the dialog is visible.
        */
        Params * params_;
+
+       /// is the dialog built ?
+       bool dialog_built_;
+ 
 };
 
 
 template <class Inset, class Params>
 ControlInset<Inset, Params>::ControlInset(LyXView & lv, Dialogs & d)
        : ControlConnectBD(lv, d),
-         inset_(0), ih_(0), params_(0)
+         inset_(0), ih_(0), params_(0), dialog_built_(false)
 {}
 
 
@@ -121,7 +125,7 @@
 {
        connectInset();
 
-       if ( !arg.empty() )
+       if (!arg.empty())
                bc().valid(); // so that the user can press Ok
 
        show(getParams(arg));
@@ -136,10 +140,9 @@
 
        setDaughterParams();
 
-       static bool isBuilt = false;
-       if (!isBuilt) {
-               isBuilt = true;
+       if (!dialog_built_) {
                view().build();
+               dialog_built_ = true;
        }
 
        bc().readOnly(isReadonly());
@@ -175,10 +178,6 @@
                params_ = new Params();
 
        bc().readOnly(isReadonly());
-       // Reset the Button Controller to it's initial state
-       bc().invalid();
-       bc().restore();
-
        view().update();
 }
 
Index: ControlLabel.C
===================================================================
RCS file: ControlLabel.C
diff -N ControlLabel.C
--- /dev/null   Tue May  5 22:32:27 1998
+++ ControlLabel.C      Sun Aug 26 02:30:00 2001
@@ -0,0 +1,50 @@
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2001 The LyX Team.
+ *
+ * ======================================================
+ *
+ * \file ControlLabel.C
+ * \author Angus Leeming <[EMAIL PROTECTED]>
+ * \author John Levon <[EMAIL PROTECTED]> 
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "ViewBase.h"
+#include "ButtonControllerBase.h"
+#include "ControlLabel.h"
+#include "buffer.h"
+#include "Dialogs.h"
+#include "BufferView.h" 
+#include "LyXView.h"
+
+using SigC::slot;
+
+ControlLabel::ControlLabel(LyXView & lv, Dialogs & d)
+       : ControlCommand(lv, d, LFUN_LABEL_INSERT)
+{
+       d_.showLabel.connect(slot(this, &ControlLabel::showInset));
+       d_.createLabel.connect(slot(this, &ControlLabel::createInset));
+}
+
+
+void ControlLabel::applyParamsToInset()
+{
+       ControlCommand::applyParamsToInset();
+ 
+       bool const redraw = 
+lv_.view()->ChangeRefsIfUnique(inset()->params().getContents(),
+                                  params().getContents());
+
+       if (redraw) {
+               lv_.view()->redraw();
+               lv_.view()->fitCursor();
+       }
+}
Index: ControlLabel.h
===================================================================
RCS file: ControlLabel.h
diff -N ControlLabel.h
--- /dev/null   Tue May  5 22:32:27 1998
+++ ControlLabel.h      Sun Aug 26 02:30:00 2001
@@ -0,0 +1,36 @@
+// -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2001 The LyX Team.
+ *
+ * ======================================================
+ *
+ * \file ControlLabel.h
+ * \author Angus Leeming <[EMAIL PROTECTED]>
+ * \author John Levon <[EMAIL PROTECTED]>
+ */
+
+#ifndef CONTROLLABEL_H
+#define CONTROLLABEL_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "ControlCommand.h"
+
+/** A controller for Index dialogs.
+ */
+class ControlLabel : public ControlCommand {
+public:
+       ///
+       ControlLabel(LyXView &, Dialogs &);
+
+       /// apply parameters to existing inset
+       virtual void applyParamsToInset();
+};
+
+#endif // CONTROLLABEL_H
Index: ControlToc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlToc.C,v
retrieving revision 1.10
diff -u -r1.10 ControlToc.C
--- ControlToc.C        2001/07/16 15:42:56     1.10
+++ ControlToc.C        2001/08/26 00:30:00
@@ -36,9 +36,16 @@
 {
        d_.showTOC.connect(slot(this, &ControlToc::showInset));
        d_.createTOC.connect(slot(this, &ControlToc::createInset));
+       d_.showFloatList.connect(slot(this, &ControlToc::showFloatList));
 }
 
 
+void ControlToc::showFloatList(string const & name)
+{
+       //FIXME show(InsetCommandParams(name, string(), string()));
+}
+
+ 
 void ControlToc::Goto(int const & id) const
 {
        string const tmp = tostr(id);
@@ -93,7 +100,7 @@
 
        // It would be nice to have a map to extract this info.
        // Does one already exist, Lars?
-       if (cmdName == "tableofcontents" )
+       if (cmdName == "tableofcontents")
                type = "TOC";
 
        return cmdName;
Index: ControlToc.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlToc.h,v
retrieving revision 1.2
diff -u -r1.2 ControlToc.h
--- ControlToc.h        2001/05/04 10:36:36     1.2
+++ ControlToc.h        2001/08/26 00:30:00
@@ -38,6 +38,9 @@
 
        /// Given a type, returns the contents
        Buffer::SingleList const getContents(string const & type) const;
+
+       /// show a float list
+       void showFloatList(string const & name);
 };
 
 namespace toc 
Index: GUI.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/GUI.h,v
retrieving revision 1.21
diff -u -r1.21 GUI.h
--- GUI.h       2001/08/09 15:08:06     1.21
+++ GUI.h       2001/08/26 00:30:00
@@ -209,6 +209,20 @@
 };
 
 
+/** Specialization for Label dialog
+ */
+class ControlLabel;
+
+template <class GUIview, class GUIbc>
+class GUILabel :
+       public GUI<ControlLabel, GUIview, OkCancelReadOnlyPolicy, GUIbc> {
+public:
+       ///
+       GUILabel(LyXView & lv, Dialogs & d)
+               : GUI<ControlLabel, GUIview, OkCancelReadOnlyPolicy, GUIbc>(lv, d) {}
+};
+
+
 /** Specialization for Log dialog
  */
 class ControlLog;
Index: Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/Makefile.am,v
retrieving revision 1.25
diff -u -r1.25 Makefile.am
--- Makefile.am 2001/08/09 01:35:15     1.25
+++ Makefile.am 2001/08/26 00:30:00
@@ -50,6 +50,8 @@
        ControlIndex.C \
        ControlIndex.h \
        ControlInset.h \
+       ControlLabel.C \
+       ControlLabel.h \
        ControlLog.C \
        ControlLog.h \
        ControlMinipage.C \

Reply via email to