]> git.lyx.org Git - features.git/commitdiff
Grey out outlining movement buttons for non-ToC
authorMartin Vermeer <martin.vermeer@hut.fi>
Fri, 21 Apr 2006 22:51:39 +0000 (22:51 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Fri, 21 Apr 2006 22:51:39 +0000 (22:51 +0000)
* qt2/QTocDialog.[Ch]: Add enableButtons

* qt2/QToc.[Ch]
(QToc::build_dialog):
(QToc::updateType):
(QToc::updateToc):
(QToc::updateToc):
(QToc::set_depth): Change update logic

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13709 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/QToc.C
src/frontends/qt2/QToc.h
src/frontends/qt2/QTocDialog.C
src/frontends/qt2/QTocDialog.h

index e2e2f912056af33759e172147543df7858f15908..d8898e2c9d8a70537aee6642ce6121df399da0fc 100644 (file)
@@ -48,6 +48,8 @@ void QToc::build_dialog()
 
        // Manage the cancel/close button
        bcview().setCancel(dialog_->closePB);
+       type_ = toc::getType(controller().params().getCmdName());
+       dialog_->enableButtons();
 }
 
 
@@ -67,6 +69,8 @@ void QToc::updateType()
                        setTitle(guiname);
                }
        }
+       type_ = type;
+       dialog_->enableButtons();
 }
 
 
@@ -83,6 +87,8 @@ void QToc::updateToc(int newdepth)
        string type;
        if (!choice.empty())
                type = choice[dialog_->typeCO->currentItem()];
+       type_ = type;
+       dialog_->enableButtons();
 
        toc::Toc const & contents = controller().getContents(type);
 
@@ -181,6 +187,12 @@ void QToc::updateToc(int newdepth)
 }
 
 
+bool QToc::canOutline()
+{
+       return controller().canOutline(type_);
+}
+
+
 void QToc::select(string const & text)
 {
        toc::Toc::const_iterator iter = toclist.begin();
@@ -212,28 +224,28 @@ void QToc::set_depth(int depth)
 void QToc::moveup()
 {
        controller().outline(toc::UP);
-       update_contents();
+       updateToc(depth_);
 }
 
 
 void QToc::movedn()
 {
        controller().outline(toc::DOWN);
-       update_contents();
+       updateToc(depth_);
 }
 
 
 void QToc::movein()
 {
        controller().outline(toc::IN);
-       update_contents();
+       updateToc(depth_);
 }
 
 
 void QToc::moveout()
 {
        controller().outline(toc::OUT);
-       update_contents();
+       updateToc(depth_);
 }
 
 
index fe1c3a9100f5ef4b4aff6afcc0d44c2d85ca1b85..769bc9a766a9d8249b16af7db734780d25f7b9a6 100644 (file)
@@ -33,6 +33,9 @@ private:
        /// update the listview
        void updateToc(int newdepth);
 
+       ///
+       bool canOutline();
+
        /// update the float types
        void updateType();
 
@@ -67,6 +70,9 @@ private:
 
        /// Store selected item's string
        std::string text_;
+
+       /// Store ToC list type
+       std::string type_;
 };
 
 } // namespace frontend
index d125e1bf94c0fc6b95bc2dfdf60ce4f224fed917..f276596f0e1ed08cbbf08012d31fef8c0138e00b 100644 (file)
@@ -63,6 +63,20 @@ void QTocDialog::select_adaptor(QListViewItem * item)
 }
 
 
+void QTocDialog::enableButtons(bool enable)
+{
+       updatePB->setEnabled(enable);
+
+       if (!form_->canOutline())
+               enable = false;
+
+       moveupPB->setEnabled(enable);
+       movednPB->setEnabled(enable);
+       moveinPB->setEnabled(enable);
+       moveoutPB->setEnabled(enable);
+}
+
+
 void QTocDialog::update_adaptor()
 {
        form_->update();
index 875a17db0bb3b34520ffa36c010c09b7f1b213ee..d49fbb37c6449580ee07aa67feb40da7a68573c7 100644 (file)
@@ -24,6 +24,8 @@ class QTocDialog : public QTocDialogBase {
 public:
        QTocDialog(QToc * form);
        ~QTocDialog();
+       ///
+       void enableButtons(bool enable = true);
 public slots:
        void activate_adaptor(int);
        void depth_adaptor(int);