* GuiTabular.{cpp,h}:

- reimplement funcEnabled.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35195 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2010-08-25 06:25:07 +00:00
parent f494131d06
commit 3ca7e00058
2 changed files with 15 additions and 5 deletions

View 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

View 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