]> git.lyx.org Git - features.git/commitdiff
* GuiTabular.{cpp,h}:
authorJürgen Spitzmüller <spitz@lyx.org>
Wed, 25 Aug 2010 06:25:07 +0000 (06:25 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Wed, 25 Aug 2010 06:25:07 +0000 (06:25 +0000)
- reimplement funcEnabled.

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

src/frontends/qt4/GuiTabular.cpp
src/frontends/qt4/GuiTabular.h

index cd86e9b168125a76bdcfd1f9521f33f82eb1bb20..0828a56a4e2f5f67454384a9c738f0460d58c222 100644 (file)
@@ -199,7 +199,7 @@ void GuiTabular::checkEnabled()
        // check if setting a first header is allowed
        // additionally check firstheaderNoContentsCB because when this is
        // the case a first header makes no sense
-       firstheaderStatusCB->setEnabled(getStatus(FuncRequest(LFUN_INSET_MODIFY, "tabular set-ltfirsthead")).enabled()
+       firstheaderStatusCB->setEnabled(funcEnabled(Tabular::SET_LTFIRSTHEAD)
                && longtabular && !firstheaderNoContentsCB->isChecked());
        firstheaderBorderAboveCB->setEnabled(longtabular
                && firstheaderStatusCB->isChecked());
@@ -219,17 +219,17 @@ void GuiTabular::checkEnabled()
        // check if setting a last footer is allowed
        // additionally check lastfooterNoContentsCB because when this is
        // the case a last footer makes no sense
-       lastfooterStatusCB->setEnabled(getStatus(FuncRequest(LFUN_INSET_MODIFY, "tabular set-ltlastfoot")).enabled()
+       lastfooterStatusCB->setEnabled(funcEnabled(Tabular::SET_LTLASTFOOT)
                && longtabular && !lastfooterNoContentsCB->isChecked());
        lastfooterBorderAboveCB->setEnabled(longtabular
                && lastfooterBorderAboveCB->isChecked());
        lastfooterBorderBelowCB->setEnabled(longtabular
                && lastfooterBorderAboveCB->isChecked());
 
-       captionStatusCB->setEnabled(getStatus(FuncRequest(LFUN_INSET_MODIFY, "tabular toggle-ltcaption")).enabled());
+       captionStatusCB->setEnabled(funcEnabled(Tabular::TOGGLE_LTCAPTION));
        
-       multicolumnCB->setEnabled(getStatus(FuncRequest(LFUN_INSET_MODIFY, "tabular multicolumn")).enabled());
-       multirowCB->setEnabled(getStatus(FuncRequest(LFUN_INSET_MODIFY, "tabular multirow")).enabled());
+       multicolumnCB->setEnabled(funcEnabled(Tabular::MULTICOLUMN));
+       multirowCB->setEnabled(funcEnabled(Tabular::MULTICOLUMN));
 
        changed();
 }
@@ -852,6 +852,13 @@ void GuiTabular::paramsToDialog(Inset const * inset)
 }
 
 
+bool GuiTabular::funcEnabled(Tabular::Feature f) const
+{
+       string cmd = "tabular " + featureAsString(f);
+       return getStatus(FuncRequest(LFUN_INSET_MODIFY, cmd)).enabled();
+}
+
+
 } // namespace frontend
 } // namespace lyx
 
index 456d30cac231aaed5a6e1b8a8d57216849ba39fc..9b31a94c79d4266e02a579cd67c8833b6b48cf65 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "InsetParamsWidget.h"
 #include "ui_TabularUi.h"
+#include "insets/InsetTabular.h"
 
 namespace lyx {
 namespace frontend {
@@ -50,6 +51,8 @@ private:
        void setTableAlignment(std::string & param_str) const;
        ///
        void setWidthAndAlignment();
+       ///
+       bool funcEnabled(Tabular::Feature f) const;
 };
 
 } // namespace frontend