* PanelStack.{cpp,h}:

- new members showPanel, isCurrentPanel
* GuiDocument.cpp:
	- hide Child Documents panel if there are no children.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32940 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2010-01-10 14:46:39 +00:00
parent 902dbf3f13
commit e2925a160f
3 changed files with 26 additions and 2 deletions

View File

@ -2488,10 +2488,12 @@ void GuiDocument::paramsToDialog()
std::vector<Buffer *> children = buffer().getChildren(false); std::vector<Buffer *> children = buffer().getChildren(false);
if (children.empty()) { if (children.empty()) {
masterChildModule->childrenTW->clear(); masterChildModule->childrenTW->clear();
masterChildModule->setEnabled(false);
masterChildModule->includeallRB->setChecked(true);
includeonlys_.clear(); includeonlys_.clear();
docPS->showPanel(qt_("Child Documents"), false);
if (docPS->isCurrentPanel(qt_("Child Documents")))
docPS->setCurrentPanel(qt_("Document Class"));
} else { } else {
docPS->showPanel(qt_("Child Documents"), true);
masterChildModule->setEnabled(true); masterChildModule->setEnabled(true);
includeonlys_ = bp_.getIncludedChildren(); includeonlys_ = bp_.getIncludedChildren();
updateIncludeonlys(); updateIncludeonlys();

View File

@ -94,6 +94,15 @@ void PanelStack::addPanel(QWidget * panel, QString const & name, QString const &
} }
void PanelStack::showPanel(QString const & name, bool show)
{
QTreeWidgetItem * item = panel_map_.value(name, 0);
LASSERT(item, return);
item->setHidden(!show);
}
void PanelStack::setCurrentPanel(QString const & name) void PanelStack::setCurrentPanel(QString const & name)
{ {
QTreeWidgetItem * item = panel_map_.value(name, 0); QTreeWidgetItem * item = panel_map_.value(name, 0);
@ -107,6 +116,15 @@ void PanelStack::setCurrentPanel(QString const & name)
} }
bool PanelStack::isCurrentPanel(QString const & name) const
{
QTreeWidgetItem * item = panel_map_.value(name, 0);
LASSERT(item, return false);
return (list_->currentItem() == item);
}
void PanelStack::switchPanel(QTreeWidgetItem * item, void PanelStack::switchPanel(QTreeWidgetItem * item,
QTreeWidgetItem * previous) QTreeWidgetItem * previous)
{ {

View File

@ -36,9 +36,13 @@ public:
/// add a widget panel with a given name, under the given parent /// add a widget panel with a given name, under the given parent
void addPanel(QWidget * panel, QString const & name, void addPanel(QWidget * panel, QString const & name,
QString const & parent = QString()); QString const & parent = QString());
/// show or hide panel
void showPanel(QString const & name, bool show);
/// set current panel by logical name /// set current panel by logical name
void setCurrentPanel(QString const &); void setCurrentPanel(QString const &);
/// ///
bool isCurrentPanel(QString const & name) const;
///
QSize sizeHint() const; QSize sizeHint() const;
public Q_SLOTS: public Q_SLOTS: