mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
Implement the getStatus mechanism for the context menu of the toc.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29200 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1c738a37fb
commit
86392456e8
@ -97,6 +97,13 @@ void GuiToc::doDispatch(Cursor & cur, FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
|
||||
bool GuiToc::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & status) const
|
||||
{
|
||||
return widget_->getStatus(cur, cmd, status);
|
||||
}
|
||||
|
||||
|
||||
Dialog * createGuiToc(GuiView & lv)
|
||||
{
|
||||
GuiView & guiview = static_cast<GuiView &>(lv);
|
||||
|
@ -59,6 +59,8 @@ public:
|
||||
bool isBufferDependent() const { return true; }
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest const & fr);
|
||||
///
|
||||
bool getStatus(Cursor & cur, FuncRequest const & fr, FuncStatus & fs) const;
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -1206,7 +1206,12 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
buf = 0;
|
||||
|
||||
if (cmd.origin == FuncRequest::TOC) {
|
||||
//FIXME: dispatch this to the toc
|
||||
GuiToc * toc = static_cast<GuiToc*>(findOrBuild("toc", false));
|
||||
FuncStatus fs;
|
||||
if (toc->getStatus(view()->cursor(), cmd, fs))
|
||||
flag |= fs;
|
||||
else
|
||||
flag.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "Buffer.h"
|
||||
#include "CutAndPaste.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "LyXFunc.h"
|
||||
#include "Menus.h"
|
||||
#include "TocBackend.h"
|
||||
@ -95,7 +96,7 @@ void TocWidget::showContextMenu(const QPoint & pos)
|
||||
}
|
||||
|
||||
|
||||
void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd)
|
||||
Inset * TocWidget::itemInset() const
|
||||
{
|
||||
QModelIndex const & index = tocTV->currentIndex();
|
||||
TocItem const & item =
|
||||
@ -116,6 +117,25 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd)
|
||||
tmp_dit.pop_back();
|
||||
inset = &tmp_dit.inset();
|
||||
}
|
||||
return inset;
|
||||
}
|
||||
|
||||
|
||||
bool TocWidget::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & status) const
|
||||
{
|
||||
Inset * inset = itemInset();
|
||||
|
||||
FuncRequest tmpcmd(cmd);
|
||||
if (inset)
|
||||
return inset->getStatus(cur, tmpcmd, status);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd)
|
||||
{
|
||||
Inset * inset = itemInset();
|
||||
|
||||
FuncRequest tmpcmd(cmd);
|
||||
if (inset)
|
||||
|
@ -36,8 +36,11 @@ public:
|
||||
|
||||
/// Initialise GUI.
|
||||
void init(QString const & str);
|
||||
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest const & fr);
|
||||
///
|
||||
bool getStatus(Cursor & cur, FuncRequest const & fr, FuncStatus & status)
|
||||
const;
|
||||
|
||||
public Q_SLOTS:
|
||||
/// Update the display of the dialog whilst it is still visible.
|
||||
@ -70,6 +73,9 @@ private:
|
||||
void setTreeDepth(int depth);
|
||||
///
|
||||
void outline(int func_code);
|
||||
/// finds the inset that is connected to the current item,
|
||||
/// if any, otherwise return null
|
||||
Inset * itemInset() const;
|
||||
///
|
||||
QString current_type_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user