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.
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
#
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"
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:
while (!insname.empty()) {
if (insname == name || name == from_utf8("*")) {
cur.recordUndo();
- lyx::dispatch(fr);
+ lyx::dispatch(fr, dr);
++iterations;
break;
}
}
- 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())
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,
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
///
void dispatch(FuncRequest const & action);
+///
+void dispatch(FuncRequest const & action, DispatchResult & dr);
+
} // namespace lyx
#endif // LYX_H
* \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.
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"
}
// 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();