mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Get rid of all-insets-toggle and explain how to replace it with inset-forall.
Change inset-forall so that screen is not repainted at each iteration, since this lead to very slow opeartion on large files. This is not a problem for current uses, but can potentially lead to crashes. See ticket #6641 for more thoughts and possible solutions. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34092 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5edd353600
commit
e8529a2ecf
@ -98,6 +98,15 @@ The following LyX functions have been removed:
|
||||
with the more general function inset-forall
|
||||
inset-forall Note:<SOURCE> inset-modify note Note <TARGET>
|
||||
|
||||
- LFUN_ALL_INSETS_TOGGLE ("all-insets-toggle"): replace
|
||||
all-insets-toggle <ACTION> <TARGET>
|
||||
all-insets-toggle <ACTION>
|
||||
with the more generic function inset-forall
|
||||
inset-forall <TARGET> inset-toggle <ACTION>
|
||||
inset-forall * inset-toggle <ACTION>
|
||||
There is a difference in the <TARGET> parameter, which is would be
|
||||
like "note" in the first case and "Note" in the second.
|
||||
|
||||
- LFUN_TABULAR_FEATURE ("tabular-feature"): use "inset-modify" instead.
|
||||
|
||||
|
||||
|
@ -179,8 +179,8 @@ Menuset
|
||||
OptItem "Open Inset|O" "inset-toggle open"
|
||||
OptItem "Close Inset|C" "inset-toggle close"
|
||||
Separator
|
||||
Item "Open All Notes|A" "all-insets-toggle open note"
|
||||
Item "Close All Notes|l" "all-insets-toggle close note"
|
||||
Item "Open All Notes|A" "inset-forall Note inset-toggle open"
|
||||
Item "Close All Notes|l" "inset-forall Note inset-toggle close"
|
||||
Separator
|
||||
Item "Dissolve Inset|D" "inset-dissolve"
|
||||
End
|
||||
|
@ -306,8 +306,8 @@ Menuset
|
||||
#
|
||||
|
||||
Menu "view"
|
||||
Item "Open All Insets|O" "all-insets-toggle open"
|
||||
Item "Close All Insets|C" "all-insets-toggle close"
|
||||
Item "Open All Insets|O" "inset-forall * inset-toggle open"
|
||||
Item "Close All Insets|C" "inset-forall * inset-toggle close"
|
||||
Separator
|
||||
Item "Unfold Math Macro|n" "math-macro-unfold"
|
||||
Item "Fold Math Macro|d" "math-macro-fold"
|
||||
|
@ -1020,7 +1020,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
case LFUN_SCREEN_SHOW_CURSOR:
|
||||
case LFUN_BIBTEX_DATABASE_ADD:
|
||||
case LFUN_BIBTEX_DATABASE_DEL:
|
||||
case LFUN_ALL_INSETS_TOGGLE:
|
||||
case LFUN_STATISTICS:
|
||||
case LFUN_BRANCH_ADD_INSERT:
|
||||
case LFUN_KEYMAP_OFF:
|
||||
@ -1714,7 +1713,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
while (!insname.empty()) {
|
||||
if (insname == name || name == from_utf8("*")) {
|
||||
cur.recordUndo();
|
||||
lyx::dispatch(fr);
|
||||
lyx::dispatch(fr, dr);
|
||||
++iterations;
|
||||
break;
|
||||
}
|
||||
@ -1739,29 +1738,6 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
}
|
||||
|
||||
|
||||
case LFUN_ALL_INSETS_TOGGLE: {
|
||||
string action;
|
||||
string const name = split(to_utf8(cmd.argument()), action, ' ');
|
||||
InsetCode const inset_code = insetCode(name);
|
||||
|
||||
FuncRequest fr(LFUN_INSET_TOGGLE, action);
|
||||
|
||||
Inset & inset = cur.buffer()->inset();
|
||||
InsetIterator it = inset_iterator_begin(inset);
|
||||
InsetIterator const end = inset_iterator_end(inset);
|
||||
for (; it != end; ++it) {
|
||||
if (it->asInsetCollapsable()
|
||||
&& (inset_code == NO_CODE
|
||||
|| inset_code == it->lyxCode())) {
|
||||
Cursor tmpcur = cur;
|
||||
tmpcur.pushBackward(*it);
|
||||
it->dispatch(tmpcur, fr);
|
||||
}
|
||||
}
|
||||
dr.update(Update::Force | Update::FitCursor);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_BRANCH_ADD_INSERT: {
|
||||
docstring branch_name = from_utf8(cmd.getArg(0));
|
||||
if (branch_name.empty())
|
||||
|
@ -322,7 +322,7 @@ enum FuncCode
|
||||
LFUN_WORD_REPLACE,
|
||||
LFUN_BUFFER_EXPORT_CUSTOM,
|
||||
LFUN_BUFFER_PRINT,
|
||||
LFUN_ALL_INSETS_TOGGLE,
|
||||
LFUN_BUFFER_CLOSE_ALL, // vfr 20090806
|
||||
// 245
|
||||
LFUN_BUFFER_LANGUAGE,
|
||||
LFUN_TEXTCLASS_APPLY,
|
||||
@ -439,12 +439,11 @@ enum FuncCode
|
||||
LFUN_BRANCH_ADD_INSERT,
|
||||
// 340
|
||||
LFUN_BRANCHES_RENAME, // spitz 20090709
|
||||
LFUN_BUFFER_CLOSE_ALL, // vfr 20090806
|
||||
LFUN_GRAPHICS_RELOAD, // vfr 20090810
|
||||
LFUN_SCREEN_SHOW_CURSOR, // vfr, 20090325
|
||||
LFUN_SPELLING_ADD, // spitz 20100118
|
||||
// 345
|
||||
LFUN_SPELLING_IGNORE, // spitz 20100118
|
||||
// 345
|
||||
LFUN_PREVIEW_INSERT, // vfr, 20100328
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
|
@ -160,6 +160,9 @@ FuncStatus getStatus(FuncRequest const & action);
|
||||
///
|
||||
void dispatch(FuncRequest const & action);
|
||||
|
||||
///
|
||||
void dispatch(FuncRequest const & action, DispatchResult & dr);
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif // LYX_H
|
||||
|
@ -2388,17 +2388,6 @@ void LyXAction::init()
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_INSET_TOGGLE, "inset-toggle", ReadOnly | AtPoint, Edit },
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_ALL_INSETS_TOGGLE
|
||||
* \li Action: Toggles (open/closes) all collapsable insets (of a given type) in the document.
|
||||
* \li Notion: Used for box, branch, ert, float, listings, note, tabular, wrap insets.
|
||||
* \li Syntax: all-insets-toggle [<STATE>] [<INSET>]
|
||||
* \li Params: <STATE>: <toggle|open|close|assign> default: toggle \n
|
||||
<INSET>: <box|branch|ert|float|listings|note|tabular|wrap> default: all insets
|
||||
* \li Origin: leeming, 30 Mar 2004
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_ALL_INSETS_TOGGLE, "all-insets-toggle", ReadOnly, Edit },
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_INSET_FORALL
|
||||
* \li Action: Apply the given commands on insets of a given name.
|
||||
@ -2408,6 +2397,9 @@ void LyXAction::init()
|
||||
inset-forall Note note-insert
|
||||
which starts an infinite loop. This is mitigated by the fact
|
||||
that the number of actions is arbitrarily limited to 10000.
|
||||
Note also that inset-forall does not update metrics between
|
||||
iterations, which can lead to bugs. This has to be eventually
|
||||
fixed.
|
||||
* \li Syntax: inset-forall <NAME> <LFUN-COMMAND> \n
|
||||
<NAME>: Type of Inset. If <NAME> is *, all insets are matched.
|
||||
The name is used like for InsetLayout in layout files: "Note"
|
||||
|
@ -3126,8 +3126,8 @@ void GuiDocument::dispatchParams()
|
||||
}
|
||||
|
||||
// Open insets of selected branches, close deselected ones
|
||||
dispatch(FuncRequest(LFUN_ALL_INSETS_TOGGLE,
|
||||
"assign branch"));
|
||||
dispatch(FuncRequest(LFUN_INSET_FORALL,
|
||||
"Branch inset-toggle assign"));
|
||||
}
|
||||
// rename branches in the document
|
||||
executeBranchRenaming();
|
||||
|
Loading…
Reference in New Issue
Block a user