mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* Move handling of LFUN_INSET_SETTINGS to Inset,
* Remove the EDITABLE enum, * add functions hasSettings() for all insets. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29375 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4d121bafde
commit
4c9fe33c83
@ -729,7 +729,7 @@ bool BufferView::moveToPosition(pit_type bottom_pit, pos_type bottom_pos,
|
|||||||
// insets.
|
// insets.
|
||||||
size_t const n = dit.depth();
|
size_t const n = dit.depth();
|
||||||
for (size_t i = 0; i < n; ++i)
|
for (size_t i = 0; i < n; ++i)
|
||||||
if (dit[i].inset().editable() != Inset::HIGHLY_EDITABLE) {
|
if (!dit[i].inset().editable()) {
|
||||||
dit.resize(i);
|
dit.resize(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ void DocIterator::forwardPosIgnoreCollapsed()
|
|||||||
// FIXME: the check for asInsetMath() shouldn't be necessary
|
// FIXME: the check for asInsetMath() shouldn't be necessary
|
||||||
// but math insets do not return a sensible editable() state yet.
|
// but math insets do not return a sensible editable() state yet.
|
||||||
if (nextinset && !nextinset->asInsetMath()
|
if (nextinset && !nextinset->asInsetMath()
|
||||||
&& nextinset->editable() != Inset::HIGHLY_EDITABLE) {
|
&& !nextinset->editable()) {
|
||||||
++top().pos();
|
++top().pos();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -573,7 +573,7 @@ bool Text::checkAndActivateInset(Cursor & cur, bool front)
|
|||||||
if (!front && cur.pos() == 0)
|
if (!front && cur.pos() == 0)
|
||||||
return false;
|
return false;
|
||||||
Inset * inset = front ? cur.nextInset() : cur.prevInset();
|
Inset * inset = front ? cur.nextInset() : cur.prevInset();
|
||||||
if (!inset || inset->editable() != Inset::HIGHLY_EDITABLE)
|
if (!inset || !inset->editable())
|
||||||
return false;
|
return false;
|
||||||
/*
|
/*
|
||||||
* Apparently, when entering an inset we are expected to be positioned
|
* Apparently, when entering an inset we are expected to be positioned
|
||||||
@ -599,7 +599,7 @@ bool Text::checkAndActivateInsetVisual(Cursor & cur, bool movingForward, bool mo
|
|||||||
return false;
|
return false;
|
||||||
Paragraph & par = cur.paragraph();
|
Paragraph & par = cur.paragraph();
|
||||||
Inset * inset = par.isInset(cur.pos()) ? par.getInset(cur.pos()) : 0;
|
Inset * inset = par.isInset(cur.pos()) ? par.getInset(cur.pos()) : 0;
|
||||||
if (!inset || inset->editable() != Inset::HIGHLY_EDITABLE)
|
if (!inset || !inset->editable())
|
||||||
return false;
|
return false;
|
||||||
inset->edit(cur, movingForward,
|
inset->edit(cur, movingForward,
|
||||||
movingLeft ? Inset::ENTRY_DIRECTION_RIGHT : Inset::ENTRY_DIRECTION_LEFT);
|
movingLeft ? Inset::ENTRY_DIRECTION_RIGHT : Inset::ENTRY_DIRECTION_LEFT);
|
||||||
|
@ -223,15 +223,19 @@ void Inset::doDispatch(Cursor & cur, FuncRequest &cmd)
|
|||||||
case LFUN_MOUSE_RELEASE:
|
case LFUN_MOUSE_RELEASE:
|
||||||
// if the derived inset did not explicitly handle mouse_release,
|
// if the derived inset did not explicitly handle mouse_release,
|
||||||
// we assume we request the settings dialog
|
// we assume we request the settings dialog
|
||||||
if (!cur.selection() && cmd.button() == mouse_button::button1) {
|
if (!cur.selection() && cmd.button() == mouse_button::button1
|
||||||
|
&& hasSettings()) {
|
||||||
FuncRequest tmpcmd(LFUN_INSET_SETTINGS);
|
FuncRequest tmpcmd(LFUN_INSET_SETTINGS);
|
||||||
dispatch(cur, tmpcmd);
|
dispatch(cur, tmpcmd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_INSET_SETTINGS:
|
case LFUN_INSET_SETTINGS:
|
||||||
|
if (cmd.argument().empty() || cmd.getArg(0) == insetName(lyxCode())) {
|
||||||
showInsetDialog(&cur.bv());
|
showInsetDialog(&cur.bv());
|
||||||
cur.dispatched();
|
cur.dispatched();
|
||||||
|
} else
|
||||||
|
cur.undispatched();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -269,8 +273,14 @@ bool Inset::getStatus(Cursor &, FuncRequest const & cmd,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case LFUN_INSET_SETTINGS:
|
case LFUN_INSET_SETTINGS:
|
||||||
flag.setEnabled(false);
|
if (cmd.argument().empty() || cmd.getArg(0) == insetName(lyxCode())) {
|
||||||
|
bool const enable = hasSettings();
|
||||||
|
flag.setEnabled(enable);
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
flag.setEnabled(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -326,12 +336,19 @@ bool Inset::directWrite() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Inset::EDITABLE Inset::editable() const
|
bool Inset::editable() const
|
||||||
{
|
{
|
||||||
return NOT_EDITABLE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Inset::hasSettings() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Inset::autoDelete() const
|
bool Inset::autoDelete() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -213,9 +213,6 @@ public:
|
|||||||
/// Force inset into LTR environment if surroundings are RTL?
|
/// Force inset into LTR environment if surroundings are RTL?
|
||||||
virtual bool forceLTR() const { return false; }
|
virtual bool forceLTR() const { return false; }
|
||||||
|
|
||||||
/// is this an inset that can be moved into?
|
|
||||||
/// FIXME: merge with editable()
|
|
||||||
virtual bool isActive() const { return nargs() > 0; }
|
|
||||||
/// Where should we go when we press the up or down cursor key?
|
/// Where should we go when we press the up or down cursor key?
|
||||||
virtual bool idxUpDown(Cursor & cur, bool up) const;
|
virtual bool idxUpDown(Cursor & cur, bool up) const;
|
||||||
/// Move one cell backwards
|
/// Move one cell backwards
|
||||||
@ -301,27 +298,21 @@ public:
|
|||||||
/// the string that is passed to the TOC
|
/// the string that is passed to the TOC
|
||||||
virtual void tocString(odocstream &) const {}
|
virtual void tocString(odocstream &) const {}
|
||||||
|
|
||||||
/** This enum indicates by which means the inset can be modified:
|
|
||||||
- NOT_EDITABLE: the inset's content cannot be modified at all
|
|
||||||
(e.g. printindex, insetspecialchar)
|
|
||||||
- IS_EDITABLE: content can be edited via dialog (e.g. bibtex, index, href)
|
|
||||||
- HIGHLY_EDITABLE: content can be edited on screen (normally means that
|
|
||||||
insettext is contained, e.g. collapsables, tabular) */
|
|
||||||
// FIXME: This has not yet been fully implemented to math insets
|
|
||||||
enum EDITABLE {
|
|
||||||
///
|
|
||||||
NOT_EDITABLE = 0,
|
|
||||||
///
|
|
||||||
IS_EDITABLE,
|
|
||||||
///
|
|
||||||
HIGHLY_EDITABLE
|
|
||||||
};
|
|
||||||
/// what appears in the minibuffer when opening
|
/// what appears in the minibuffer when opening
|
||||||
virtual docstring editMessage() const;
|
virtual docstring editMessage() const;
|
||||||
///
|
/// can the contents of the inset be edited on screen ?
|
||||||
virtual EDITABLE editable() const;
|
// true for InsetCollapsables (not ButtonOnly) (not InsetInfo), InsetText
|
||||||
|
virtual bool editable() const;
|
||||||
|
/// has the Inset settings that can be modified in a dialog ?
|
||||||
|
virtual bool hasSettings() const;
|
||||||
/// can we go further down on mouse click?
|
/// can we go further down on mouse click?
|
||||||
|
// true for InsetCaption, InsetCollapsables (not ButtonOnly), InsetTabular
|
||||||
virtual bool descendable() const { return false; }
|
virtual bool descendable() const { return false; }
|
||||||
|
/// is this an inset that can be moved into?
|
||||||
|
/// FIXME: merge with editable()
|
||||||
|
// true for InsetTabular & InsetText
|
||||||
|
virtual bool isActive() const { return nargs() > 0; }
|
||||||
|
|
||||||
/// does this contain text that can be change track marked in DVI?
|
/// does this contain text that can be change track marked in DVI?
|
||||||
virtual bool canTrackChanges() const { return false; }
|
virtual bool canTrackChanges() const { return false; }
|
||||||
/// return true if the inset should be removed automatically
|
/// return true if the inset should be removed automatically
|
||||||
|
@ -53,7 +53,7 @@ private:
|
|||||||
///
|
///
|
||||||
docstring screenLabel() const;
|
docstring screenLabel() const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
InsetCode lyxCode() const { return BIBITEM_CODE; }
|
InsetCode lyxCode() const { return BIBITEM_CODE; }
|
||||||
///
|
///
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
///
|
///
|
||||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
InsetCode lyxCode() const { return BIBTEX_CODE; }
|
InsetCode lyxCode() const { return BIBTEX_CODE; }
|
||||||
///
|
///
|
||||||
|
@ -239,7 +239,6 @@ bool InsetBox::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
flag.setEnabled(true);
|
flag.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -176,7 +176,6 @@ bool InsetBranch::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
switch (cmd.action) {
|
switch (cmd.action) {
|
||||||
case LFUN_INSET_MODIFY:
|
case LFUN_INSET_MODIFY:
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
flag.setEnabled(true);
|
flag.setEnabled(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
///
|
///
|
||||||
docstring screenLabel() const;
|
docstring screenLabel() const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -437,9 +437,9 @@ void InsetCollapsable::cursorPos(BufferView const & bv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Inset::EDITABLE InsetCollapsable::editable() const
|
bool InsetCollapsable::editable() const
|
||||||
{
|
{
|
||||||
return geometry() != ButtonOnly ? HIGHLY_EDITABLE : IS_EDITABLE;
|
return geometry() != ButtonOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +74,9 @@ public:
|
|||||||
///
|
///
|
||||||
docstring const getNewLabel(docstring const & l) const;
|
docstring const getNewLabel(docstring const & l) const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const;
|
bool editable() const;
|
||||||
|
///
|
||||||
|
bool hasSettings() const { return true; }
|
||||||
/// can we go further down on mouse click?
|
/// can we go further down on mouse click?
|
||||||
bool descendable() const;
|
bool descendable() const;
|
||||||
///
|
///
|
||||||
|
@ -52,7 +52,7 @@ InsetCommand::~InsetCommand()
|
|||||||
|
|
||||||
void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
|
void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
button_.update(screenLabel(), editable() != NOT_EDITABLE);
|
button_.update(screenLabel(), editable() || hasSettings());
|
||||||
button_.metrics(mi, dim);
|
button_.metrics(mi, dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,6 @@ bool InsetCommand::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
status.setEnabled(true);
|
status.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
status.setEnabled(true);
|
status.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
@ -137,7 +137,6 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
case LFUN_PASTE:
|
case LFUN_PASTE:
|
||||||
case LFUN_PRIMARY_SELECTION_PASTE:
|
case LFUN_PRIMARY_SELECTION_PASTE:
|
||||||
case LFUN_QUOTE_INSERT:
|
case LFUN_QUOTE_INSERT:
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
status.setEnabled(true);
|
status.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -428,7 +428,6 @@ bool InsetExternal::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
case LFUN_INSET_EDIT:
|
case LFUN_INSET_EDIT:
|
||||||
case LFUN_INSET_MODIFY:
|
case LFUN_INSET_MODIFY:
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
flag.setEnabled(true);
|
flag.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ private:
|
|||||||
///
|
///
|
||||||
InsetCode lyxCode() const { return EXTERNAL_CODE; }
|
InsetCode lyxCode() const { return EXTERNAL_CODE; }
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
void metrics(MetricsInfo &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
|
@ -34,6 +34,8 @@ public:
|
|||||||
void write(std::ostream &) const;
|
void write(std::ostream &) const;
|
||||||
/// should paragraph indendation be ommitted in any case?
|
/// should paragraph indendation be ommitted in any case?
|
||||||
bool neverIndent() const { return true; }
|
bool neverIndent() const { return true; }
|
||||||
|
///
|
||||||
|
bool hasSettings() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
InsetFlex(InsetFlex const &);
|
InsetFlex(InsetFlex const &);
|
||||||
|
@ -183,7 +183,6 @@ bool InsetFloat::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
|
|
||||||
case LFUN_INSET_MODIFY:
|
case LFUN_INSET_MODIFY:
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
flag.setEnabled(true);
|
flag.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -29,8 +29,6 @@ public:
|
|||||||
///
|
///
|
||||||
docstring screenLabel() const;
|
docstring screenLabel() const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return NOT_EDITABLE; }
|
|
||||||
///
|
|
||||||
InsetCode lyxCode() const { return FLOAT_LIST_CODE; }
|
InsetCode lyxCode() const { return FLOAT_LIST_CODE; }
|
||||||
///
|
///
|
||||||
DisplayType display() const { return AlignCenter; }
|
DisplayType display() const { return AlignCenter; }
|
||||||
|
@ -24,6 +24,8 @@ class InsetFootlike : public InsetCollapsable {
|
|||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
InsetFootlike(Buffer const &);
|
InsetFootlike(Buffer const &);
|
||||||
|
///
|
||||||
|
bool hasSettings() const { return false; }
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
void metrics(MetricsInfo &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
|
@ -230,7 +230,6 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
case LFUN_INSET_EDIT:
|
case LFUN_INSET_EDIT:
|
||||||
case LFUN_INSET_MODIFY:
|
case LFUN_INSET_MODIFY:
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
flag.setEnabled(true);
|
flag.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -261,12 +260,6 @@ void InsetGraphics::draw(PainterInfo & pi, int x, int y) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Inset::EDITABLE InsetGraphics::editable() const
|
|
||||||
{
|
|
||||||
return IS_EDITABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetGraphics::write(ostream & os) const
|
void InsetGraphics::write(ostream & os) const
|
||||||
{
|
{
|
||||||
os << "Graphics\n";
|
os << "Graphics\n";
|
||||||
|
@ -60,7 +60,7 @@ private:
|
|||||||
bool isLabeled() const { return true; }
|
bool isLabeled() const { return true; }
|
||||||
void metrics(MetricsInfo &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const;
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
void write(std::ostream &) const;
|
void write(std::ostream &) const;
|
||||||
///
|
///
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
///
|
///
|
||||||
docstring screenLabel() const;
|
docstring screenLabel() const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
DisplayType display() const { return Inline; }
|
DisplayType display() const { return Inline; }
|
||||||
///
|
///
|
||||||
|
@ -299,6 +299,7 @@ void InsetInclude::editIncluded(string const & file)
|
|||||||
bool InsetInclude::getStatus(Cursor & cur, FuncRequest const & cmd,
|
bool InsetInclude::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||||
FuncStatus & flag) const
|
FuncStatus & flag) const
|
||||||
{
|
{
|
||||||
|
LYXERR0(cmd.action);
|
||||||
switch (cmd.action) {
|
switch (cmd.action) {
|
||||||
|
|
||||||
case LFUN_INSET_EDIT:
|
case LFUN_INSET_EDIT:
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
support::FileNameList const &
|
support::FileNameList const &
|
||||||
getBibfilesCache() const;
|
getBibfilesCache() const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
int latex(odocstream &, OutputParams const &) const;
|
int latex(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
|
@ -181,6 +181,8 @@ bool InsetIndex::showInsetDialog(BufferView * bv) const
|
|||||||
|
|
||||||
void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd)
|
void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||||
{
|
{
|
||||||
|
LYXERR0( cmd.action);
|
||||||
|
LYXERR0( cmd.getArg(0));
|
||||||
switch (cmd.action) {
|
switch (cmd.action) {
|
||||||
|
|
||||||
case LFUN_INSET_MODIFY: {
|
case LFUN_INSET_MODIFY: {
|
||||||
@ -210,6 +212,8 @@ void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
bool InsetIndex::getStatus(Cursor & cur, FuncRequest const & cmd,
|
bool InsetIndex::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||||
FuncStatus & flag) const
|
FuncStatus & flag) const
|
||||||
{
|
{
|
||||||
|
LYXERR0( cmd.action);
|
||||||
|
LYXERR0( cmd.getArg(0));
|
||||||
switch (cmd.action) {
|
switch (cmd.action) {
|
||||||
|
|
||||||
case LFUN_INSET_MODIFY:
|
case LFUN_INSET_MODIFY:
|
||||||
@ -226,8 +230,7 @@ bool InsetIndex::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
flag.setEnabled(true);
|
flag.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
case LFUN_INSET_SETTINGS: {
|
|
||||||
Buffer const & realbuffer = *buffer().masterBuffer();
|
Buffer const & realbuffer = *buffer().masterBuffer();
|
||||||
flag.setEnabled(realbuffer.params().use_indices);
|
flag.setEnabled(realbuffer.params().use_indices);
|
||||||
return true;
|
return true;
|
||||||
@ -340,6 +343,21 @@ docstring InsetIndex::contextMenu(BufferView const &, int, int) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool InsetIndex::hasSettings() const
|
||||||
|
{
|
||||||
|
return buffer().masterBuffer()->params().use_indices;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// InsetIndexParams
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
void InsetIndexParams::write(ostream & os) const
|
void InsetIndexParams::write(ostream & os) const
|
||||||
{
|
{
|
||||||
os << ' ';
|
os << ' ';
|
||||||
@ -446,8 +464,7 @@ bool InsetPrintIndex::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
return InsetCommand::getStatus(cur, cmd, status);
|
return InsetCommand::getStatus(cur, cmd, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
case LFUN_INSET_SETTINGS: {
|
|
||||||
Buffer const & realbuffer = *buffer().masterBuffer();
|
Buffer const & realbuffer = *buffer().masterBuffer();
|
||||||
status.setEnabled(realbuffer.params().use_indices);
|
status.setEnabled(realbuffer.params().use_indices);
|
||||||
return true;
|
return true;
|
||||||
@ -486,10 +503,9 @@ docstring InsetPrintIndex::contextMenu(BufferView const &, int, int) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Inset::EDITABLE InsetPrintIndex::editable() const
|
bool InsetPrintIndex::hasSettings() const
|
||||||
{
|
{
|
||||||
return buffer().masterBuffer()->params().use_indices ?
|
return buffer().masterBuffer()->params().use_indices;
|
||||||
IS_EDITABLE : NOT_EDITABLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
static void string2params(std::string const &, InsetIndexParams &);
|
static void string2params(std::string const &, InsetIndexParams &);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
bool hasSettings() const;
|
||||||
///
|
///
|
||||||
InsetCode lyxCode() const { return INDEX_CODE; }
|
InsetCode lyxCode() const { return INDEX_CODE; }
|
||||||
///
|
///
|
||||||
@ -112,7 +112,8 @@ private:
|
|||||||
/// Updates needed features for this inset.
|
/// Updates needed features for this inset.
|
||||||
void validate(LaTeXFeatures & features) const;
|
void validate(LaTeXFeatures & features) const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const;
|
bool hasSettings() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
DisplayType display() const { return AlignCenter; }
|
DisplayType display() const { return AlignCenter; }
|
||||||
///
|
///
|
||||||
|
@ -100,7 +100,9 @@ public:
|
|||||||
///
|
///
|
||||||
Inset * editXY(Cursor & cur, int x, int y);
|
Inset * editXY(Cursor & cur, int x, int y);
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool editable() const { return false; }
|
||||||
|
///
|
||||||
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
void read(Lexer & lex);
|
void read(Lexer & lex);
|
||||||
///
|
///
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
///
|
///
|
||||||
docstring screenLabel() const;
|
docstring screenLabel() const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
InsetCode lyxCode() const { return LABEL_CODE; }
|
InsetCode lyxCode() const { return LABEL_CODE; }
|
||||||
///
|
///
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "BufferParams.h"
|
#include "BufferParams.h"
|
||||||
#include "Counters.h"
|
#include "Counters.h"
|
||||||
#include "Cursor.h"
|
#include "Cursor.h"
|
||||||
#include "CutAndPaste.h"
|
|
||||||
#include "DispatchResult.h"
|
#include "DispatchResult.h"
|
||||||
#include "Encoding.h"
|
#include "Encoding.h"
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
@ -387,7 +386,6 @@ bool InsetListings::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
switch (cmd.action) {
|
switch (cmd.action) {
|
||||||
case LFUN_INSET_MODIFY:
|
case LFUN_INSET_MODIFY:
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
status.setEnabled(true);
|
status.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
case LFUN_CAPTION_INSERT:
|
case LFUN_CAPTION_INSERT:
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
///
|
///
|
||||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
/// Updates needed features for this inset.
|
/// Updates needed features for this inset.
|
||||||
void validate(LaTeXFeatures & features) const;
|
void validate(LaTeXFeatures & features) const;
|
||||||
///
|
///
|
||||||
@ -66,8 +66,6 @@ public:
|
|||||||
// Currently the width can be read from file and written, but not
|
// Currently the width can be read from file and written, but not
|
||||||
// changed.
|
// changed.
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return NOT_EDITABLE; }
|
|
||||||
///
|
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
InsetCode lyxCode() const;
|
InsetCode lyxCode() const;
|
||||||
|
@ -211,7 +211,6 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
flag.setEnabled(true);
|
flag.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
@ -31,6 +31,8 @@ public:
|
|||||||
|
|
||||||
/// Outputting the optional parameter of a LaTeX command
|
/// Outputting the optional parameter of a LaTeX command
|
||||||
int latexOptional(odocstream &, OutputParams const &) const;
|
int latexOptional(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
|
bool hasSettings() const { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// code of the inset
|
/// code of the inset
|
||||||
|
@ -293,7 +293,6 @@ bool InsetPhantom::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
flag.setEnabled(true);
|
flag.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
flag.setEnabled(true);
|
flag.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
///
|
///
|
||||||
docstring screenLabel() const;
|
docstring screenLabel() const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
InsetCode lyxCode() const { return REF_CODE; }
|
InsetCode lyxCode() const { return REF_CODE; }
|
||||||
///
|
///
|
||||||
|
@ -172,7 +172,6 @@ bool InsetSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
status.setOnOff(params_.kind == params.kind);
|
status.setOnOff(params_.kind == params.kind);
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
status.setEnabled(true);
|
status.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
@ -133,7 +133,7 @@ public:
|
|||||||
/// the string that is passed to the TOC
|
/// the string that is passed to the TOC
|
||||||
void tocString(odocstream &) const;
|
void tocString(odocstream &) const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
InsetCode lyxCode() const { return SPACE_CODE; }
|
InsetCode lyxCode() const { return SPACE_CODE; }
|
||||||
/// is this an expandible space (rubber length)?
|
/// is this an expandible space (rubber length)?
|
||||||
|
@ -26,8 +26,6 @@ public:
|
|||||||
///
|
///
|
||||||
docstring screenLabel() const;
|
docstring screenLabel() const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return NOT_EDITABLE; }
|
|
||||||
///
|
|
||||||
InsetCode lyxCode() const { return TOC_CODE; }
|
InsetCode lyxCode() const { return TOC_CODE; }
|
||||||
///
|
///
|
||||||
DisplayType display() const { return AlignCenter; }
|
DisplayType display() const { return AlignCenter; }
|
||||||
|
@ -4075,6 +4075,9 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
return cell(cur.idx())->getStatus(cur, cmd, status);
|
return cell(cur.idx())->getStatus(cur, cmd, status);
|
||||||
|
|
||||||
case LFUN_INSET_SETTINGS:
|
case LFUN_INSET_SETTINGS:
|
||||||
|
// relay this lfun to Inset, not to the cell.
|
||||||
|
return Inset::getStatus(cur, cmd, status);
|
||||||
|
|
||||||
case LFUN_INSET_MODIFY:
|
case LFUN_INSET_MODIFY:
|
||||||
if (insetCode(cmd.getArg(0)) == TABULAR_CODE) {
|
if (insetCode(cmd.getArg(0)) == TABULAR_CODE) {
|
||||||
status.setEnabled(true);
|
status.setEnabled(true);
|
||||||
|
@ -736,7 +736,9 @@ public:
|
|||||||
///
|
///
|
||||||
docstring editMessage() const;
|
docstring editMessage() const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
bool editable() const { return true; }
|
||||||
|
///
|
||||||
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
bool insetAllowed(InsetCode code) const;
|
bool insetAllowed(InsetCode code) const;
|
||||||
///
|
///
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
///
|
///
|
||||||
docstring editMessage() const;
|
docstring editMessage() const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
bool editable() const { return true; }
|
||||||
///
|
///
|
||||||
bool canTrackChanges() const { return true; }
|
bool canTrackChanges() const { return true; }
|
||||||
///
|
///
|
||||||
|
@ -87,10 +87,6 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
status.setEnabled(true);
|
status.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
status.setEnabled(true);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return Inset::getStatus(cur, cmd, status);
|
return Inset::getStatus(cur, cmd, status);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
///
|
///
|
||||||
InsetCode lyxCode() const { return VSPACE_CODE; }
|
InsetCode lyxCode() const { return VSPACE_CODE; }
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -107,7 +107,6 @@ bool InsetWrap::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
switch (cmd.action) {
|
switch (cmd.action) {
|
||||||
case LFUN_INSET_MODIFY:
|
case LFUN_INSET_MODIFY:
|
||||||
case LFUN_INSET_DIALOG_UPDATE:
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
case LFUN_INSET_SETTINGS:
|
|
||||||
flag.setEnabled(true);
|
flag.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
///
|
///
|
||||||
docstring const & getInsetName() const { return name_; }
|
docstring const & getInsetName() const { return name_; }
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
bool editable() const { return true; }
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
MathAtom & tmpl() const;
|
MathAtom & tmpl() const;
|
||||||
|
@ -212,7 +212,7 @@ public:
|
|||||||
///
|
///
|
||||||
virtual void revealCodes(Cursor & cur) const;
|
virtual void revealCodes(Cursor & cur) const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
bool editable() const { return true; }
|
||||||
///
|
///
|
||||||
void edit(Cursor & cur, bool front,
|
void edit(Cursor & cur, bool front,
|
||||||
EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
|
EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
/// generate something that will be understood by the Dialogs.
|
/// generate something that will be understood by the Dialogs.
|
||||||
std::string const createDialogStr() const;
|
std::string const createDialogStr() const;
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
bool hasSettings() const { return true; }
|
||||||
///
|
///
|
||||||
docstring contextMenu(BufferView const &, int, int) const;
|
docstring contextMenu(BufferView const &, int, int) const;
|
||||||
///
|
///
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
///
|
///
|
||||||
explicit MathMacroTemplate(const docstring & str);
|
explicit MathMacroTemplate(const docstring & str);
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
bool editable() const { return true; }
|
||||||
///
|
///
|
||||||
void edit(Cursor & cur, bool front, EntryDirection entry_from);
|
void edit(Cursor & cur, bool front, EntryDirection entry_from);
|
||||||
///
|
///
|
||||||
|
@ -772,7 +772,7 @@ void RowPainter::paintText()
|
|||||||
|
|
||||||
Inset const * inset = par_.getInset(pos);
|
Inset const * inset = par_.getInset(pos);
|
||||||
bool const highly_editable_inset = inset
|
bool const highly_editable_inset = inset
|
||||||
&& inset->editable() == Inset::HIGHLY_EDITABLE;
|
&& inset->editable();
|
||||||
|
|
||||||
// If we reach the end of a change or if the author changes, paint it.
|
// If we reach the end of a change or if the author changes, paint it.
|
||||||
// We also don't paint across things like tables
|
// We also don't paint across things like tables
|
||||||
|
Loading…
Reference in New Issue
Block a user