Grey out outlining movement buttons for non-ToC

* 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
This commit is contained in:
Martin Vermeer 2006-04-21 22:51:39 +00:00
parent a2457c3b5b
commit 11145e20eb
4 changed files with 38 additions and 4 deletions

View 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_);
}

View 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

View 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();

View 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);