mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
A slightly buggy lfun all-insets-toggle.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8564 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
72dd20be15
commit
991b0ec589
@ -1,3 +1,10 @@
|
|||||||
|
2004-03-30 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* bind/aqua.bind:
|
||||||
|
* bind/cua.bind:
|
||||||
|
* bind/emacs.bind:
|
||||||
|
* bind/xemacs.bind: s/inset_toggle/next-inset-toggle/.
|
||||||
|
|
||||||
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* dco/LaTeXConfig.lyx.in: check for bibtopic.
|
* dco/LaTeXConfig.lyx.in: check for bibtopic.
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
\bind "M-~S-e s" "spellchecker"
|
\bind "M-~S-e s" "spellchecker"
|
||||||
\bind "M-~S-e h" "buffer-chktex"
|
\bind "M-~S-e h" "buffer-chktex"
|
||||||
\bind "M-~S-e e" "error-remove-all"
|
\bind "M-~S-e e" "error-remove-all"
|
||||||
\bind "M-~S-e l" "inset-toggle"
|
\bind "M-~S-e l" "next-inset-toggle"
|
||||||
\bind "M-~S-e p" "dialog-preferences"
|
\bind "M-~S-e p" "dialog-preferences"
|
||||||
\bind "M-~S-e r" "reconfigure"
|
\bind "M-~S-e r" "reconfigure"
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
\bind "C-f" "dialog-show findreplace"
|
\bind "C-f" "dialog-show findreplace"
|
||||||
\bind "C-g" "error-next"
|
\bind "C-g" "error-next"
|
||||||
\bind "C-i" "inset-toggle" # 'i' for Inset
|
\bind "C-i" "next-inset-toggle" # 'i' for Inset
|
||||||
|
|
||||||
\bind "C-c" "copy"
|
\bind "C-c" "copy"
|
||||||
\bind "C-x" "cut"
|
\bind "C-x" "cut"
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
\bind "C-l" "screen-recenter"
|
\bind "C-l" "screen-recenter"
|
||||||
\bind "C-m" "mark-toggle"
|
\bind "C-m" "mark-toggle"
|
||||||
\bind "C-n" "down"
|
\bind "C-n" "down"
|
||||||
\bind "C-o" "inset-toggle"
|
\bind "C-o" "next-inset-toggle"
|
||||||
\bind "C-p" "up"
|
\bind "C-p" "up"
|
||||||
|
|
||||||
# this is "quoted-insert" a total different meaning from "quote-insert"
|
# this is "quoted-insert" a total different meaning from "quote-insert"
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
\bind "C-l" "screen-recenter"
|
\bind "C-l" "screen-recenter"
|
||||||
\bind "C-m" "mark-toggle"
|
\bind "C-m" "mark-toggle"
|
||||||
\bind "C-n" "down"
|
\bind "C-n" "down"
|
||||||
\bind "C-o" "inset-toggle"
|
\bind "C-o" "next-inset-toggle"
|
||||||
\bind "C-p" "up"
|
\bind "C-p" "up"
|
||||||
|
|
||||||
# this is "quoted-insert" a total different meaning from "quote-insert"
|
# this is "quoted-insert" a total different meaning from "quote-insert"
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
2004-03-30 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* lfuns.h:
|
||||||
|
* LyXAction.C (init): new lfuns, LFUN_KEYMAP_TOGGLE,
|
||||||
|
LFUN_NEXT_INSET_TOGGLE, LFUN_ALL_INSETS_TOGGLE.
|
||||||
|
|
||||||
|
* lyxfunc.C (dispatch): LFUN_ALL_INSETS_TOGGLE is used to toggle the
|
||||||
|
open/closed state of ollapsable insets. Usage:
|
||||||
|
|
||||||
|
all-inset-toggle <state> <name>, where
|
||||||
|
<state> == "open" || "closed" || "toggle" and
|
||||||
|
<name> is an identifier for a 'type' of inset. Eg "branch", "ert",...
|
||||||
|
|
||||||
|
* lyxtext.h, text2.C (toggleInset): removed.
|
||||||
|
|
||||||
|
* text3.C (dispatch): split the existing LFUN_INSET_TOGGLE in two,
|
||||||
|
LFUN_KEYMAP_TOGGLE and LFUN_NEXT_INSET_TOGGLE. LFUN_NEXT_INSET_TOGGLE
|
||||||
|
now passes LFUN_INSET_TOGGLE to the found inset.
|
||||||
|
|
||||||
|
* InsetList.[Ch] (insetsOpenCloseBranch): removed. Functionality
|
||||||
|
is now invoked as "all-insets-toggle toggle branch".
|
||||||
|
|
||||||
2004-03-30 Angus Leeming <leeming@lyx.org>
|
2004-03-30 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* dociterator.C:
|
* dociterator.C:
|
||||||
|
@ -135,23 +135,3 @@ void InsetList::decreasePosAfterPos(pos_type pos)
|
|||||||
--it->pos;
|
--it->pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetList::insetsOpenCloseBranch(Buffer const & buf)
|
|
||||||
{
|
|
||||||
List::iterator it = list.begin();
|
|
||||||
List::iterator end = list.end();
|
|
||||||
for (; it != end; ++it) {
|
|
||||||
if (!it->inset)
|
|
||||||
continue;
|
|
||||||
if (it->inset->lyxCode() != InsetBase::BRANCH_CODE)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
InsetBranch * inset = static_cast<InsetBranch *>(it->inset);
|
|
||||||
if (inset->isBranchSelected(buf.params().branchlist())) {
|
|
||||||
inset->open();
|
|
||||||
} else {
|
|
||||||
inset->close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -67,8 +67,6 @@ public:
|
|||||||
void increasePosAfterPos(lyx::pos_type pos);
|
void increasePosAfterPos(lyx::pos_type pos);
|
||||||
///
|
///
|
||||||
void decreasePosAfterPos(lyx::pos_type pos);
|
void decreasePosAfterPos(lyx::pos_type pos);
|
||||||
///
|
|
||||||
void insetsOpenCloseBranch(Buffer const & buf);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
|
@ -231,7 +231,9 @@ void LyXAction::init()
|
|||||||
{ LFUN_INSERT_NOTE, "note-insert", Noop },
|
{ LFUN_INSERT_NOTE, "note-insert", Noop },
|
||||||
{ LFUN_INSERT_BOX, "box-insert", Noop },
|
{ LFUN_INSERT_BOX, "box-insert", Noop },
|
||||||
{ LFUN_GOTONOTE, "note-next", ReadOnly },
|
{ LFUN_GOTONOTE, "note-next", ReadOnly },
|
||||||
{ LFUN_INSET_TOGGLE, "inset-toggle", ReadOnly },
|
{ LFUN_INSET_TOGGLE, "", ReadOnly },
|
||||||
|
{ LFUN_NEXT_INSET_TOGGLE, "next-inset-toggle", ReadOnly },
|
||||||
|
{ LFUN_ALL_INSETS_TOGGLE, "all-insets-toggle", ReadOnly },
|
||||||
{ LFUN_DOWN_PARAGRAPH, "paragraph-down", ReadOnly },
|
{ LFUN_DOWN_PARAGRAPH, "paragraph-down", ReadOnly },
|
||||||
{ LFUN_DOWN_PARAGRAPHSEL, "paragraph-down-select", ReadOnly },
|
{ LFUN_DOWN_PARAGRAPHSEL, "paragraph-down-select", ReadOnly },
|
||||||
{ LFUN_GOTO_PARAGRAPH, "paragraph-goto", ReadOnly },
|
{ LFUN_GOTO_PARAGRAPH, "paragraph-goto", ReadOnly },
|
||||||
@ -326,6 +328,7 @@ void LyXAction::init()
|
|||||||
{ LFUN_REPEAT, "repeat", NoBuffer },
|
{ LFUN_REPEAT, "repeat", NoBuffer },
|
||||||
{ LFUN_WORD_FIND, "word-find", Noop },
|
{ LFUN_WORD_FIND, "word-find", Noop },
|
||||||
{ LFUN_WORD_REPLACE, "word-replace", Noop },
|
{ LFUN_WORD_REPLACE, "word-replace", Noop },
|
||||||
|
{ LFUN_KEYMAP_TOGGLE, "keymap-toggle", Noop },
|
||||||
{ LFUN_NOACTION, "", Noop }
|
{ LFUN_NOACTION, "", Noop }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2004-03-30 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* ControlDocument.C (apply): replace the loop over paragraphs
|
||||||
|
invoking insetsOpenCloseBranch with
|
||||||
|
LFUN_ALL_INSETS_TOGGLE, "toggle branch".
|
||||||
|
|
||||||
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* ControlBibtex.[Ch]: add member usingBibtopic().
|
* ControlBibtex.[Ch]: add member usingBibtopic().
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "lfuns.h"
|
#include "lfuns.h"
|
||||||
#include "paragraph.h"
|
#include "paragraph.h"
|
||||||
#include "ParagraphList_fwd.h"
|
#include "ParagraphList_fwd.h"
|
||||||
#include "pariterator.h"
|
|
||||||
|
|
||||||
#include "frontends/Alert.h"
|
#include "frontends/Alert.h"
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
@ -104,12 +103,7 @@ void ControlDocument::apply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Open insets of selected branches, close deselected ones
|
// Open insets of selected branches, close deselected ones
|
||||||
// Currently only top-level insets in buffer handled (bug).
|
lv_.dispatch(FuncRequest(LFUN_ALL_INSETS_TOGGLE, "toggle branch"));
|
||||||
ParIterator pit = buffer()->par_iterator_begin();
|
|
||||||
ParIterator pend = buffer()->par_iterator_end();
|
|
||||||
for (; pit != pend; ++pit) {
|
|
||||||
pit->insetlist.insetsOpenCloseBranch(*buffer());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
2004-03-30 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* insetbase.[Ch] (translate): new static member function, returns
|
||||||
|
an InsetBase::Code corresponding to the input string.
|
||||||
|
|
||||||
|
* insetcollapsable.C (priv_dispatch): handle LFUN_INSET_TOGGLE.
|
||||||
|
|
||||||
|
* insetbranch.C(priv_dispatch): specialize LFUN_INSET_TOGGLE
|
||||||
|
so that it opens the inset if it refers to the currently active
|
||||||
|
branch.
|
||||||
|
|
||||||
2004-03-30 Alfredo Braunstein <abraunst@lyx.org>
|
2004-03-30 Alfredo Braunstein <abraunst@lyx.org>
|
||||||
|
|
||||||
|
@ -25,6 +25,88 @@
|
|||||||
|
|
||||||
#include "frontends/Painter.h"
|
#include "frontends/Painter.h"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
struct InsetName {
|
||||||
|
InsetName(std::string const & n, InsetBase::Code c)
|
||||||
|
: name(n), code(c) {}
|
||||||
|
std::string name;
|
||||||
|
InsetBase::Code code;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::map<std::string, InsetBase::Code> TranslatorMap;
|
||||||
|
|
||||||
|
TranslatorMap const build_translator()
|
||||||
|
{
|
||||||
|
InsetName const insetnames[] = {
|
||||||
|
InsetName("toc", InsetBase::TOC_CODE),
|
||||||
|
InsetName("quote", InsetBase::QUOTE_CODE),
|
||||||
|
InsetName("ref", InsetBase::REF_CODE),
|
||||||
|
InsetName("url", InsetBase::URL_CODE),
|
||||||
|
InsetName("htmlurl", InsetBase::HTMLURL_CODE),
|
||||||
|
InsetName("separator", InsetBase::SEPARATOR_CODE),
|
||||||
|
InsetName("ending", InsetBase::ENDING_CODE),
|
||||||
|
InsetName("label", InsetBase::LABEL_CODE),
|
||||||
|
InsetName("note", InsetBase::NOTE_CODE),
|
||||||
|
InsetName("accent", InsetBase::ACCENT_CODE),
|
||||||
|
InsetName("math", InsetBase::MATH_CODE),
|
||||||
|
InsetName("index", InsetBase::INDEX_CODE),
|
||||||
|
InsetName("include", InsetBase::INCLUDE_CODE),
|
||||||
|
InsetName("graphics", InsetBase::GRAPHICS_CODE),
|
||||||
|
InsetName("bibitem", InsetBase::BIBITEM_CODE),
|
||||||
|
InsetName("bibtex", InsetBase::BIBTEX_CODE),
|
||||||
|
InsetName("text", InsetBase::TEXT_CODE),
|
||||||
|
InsetName("ert", InsetBase::ERT_CODE),
|
||||||
|
InsetName("foot", InsetBase::FOOT_CODE),
|
||||||
|
InsetName("margin", InsetBase::MARGIN_CODE),
|
||||||
|
InsetName("float", InsetBase::FLOAT_CODE),
|
||||||
|
InsetName("wrap", InsetBase::WRAP_CODE),
|
||||||
|
InsetName("specialchar", InsetBase::SPECIALCHAR_CODE),
|
||||||
|
InsetName("tabular", InsetBase::TABULAR_CODE),
|
||||||
|
InsetName("external", InsetBase::EXTERNAL_CODE),
|
||||||
|
InsetName("caption", InsetBase::CAPTION_CODE),
|
||||||
|
InsetName("mathmacro", InsetBase::MATHMACRO_CODE),
|
||||||
|
InsetName("error", InsetBase::ERROR_CODE),
|
||||||
|
InsetName("cite", InsetBase::CITE_CODE),
|
||||||
|
InsetName("float_list", InsetBase::FLOAT_LIST_CODE),
|
||||||
|
InsetName("index_print", InsetBase::INDEX_PRINT_CODE),
|
||||||
|
InsetName("optarg", InsetBase::OPTARG_CODE),
|
||||||
|
InsetName("environment", InsetBase::ENVIRONMENT_CODE),
|
||||||
|
InsetName("hfill", InsetBase::HFILL_CODE),
|
||||||
|
InsetName("newline", InsetBase::NEWLINE_CODE),
|
||||||
|
InsetName("line", InsetBase::LINE_CODE),
|
||||||
|
InsetName("branch", InsetBase::BRANCH_CODE),
|
||||||
|
InsetName("box", InsetBase::BOX_CODE),
|
||||||
|
InsetName("charstyle", InsetBase::CHARSTYLE_CODE),
|
||||||
|
InsetName("vspace", InsetBase::VSPACE_CODE),
|
||||||
|
InsetName("mathgrid", InsetBase::MATHGRID_CODE),
|
||||||
|
InsetName("mathhull", InsetBase::MATHHULL_CODE)
|
||||||
|
};
|
||||||
|
|
||||||
|
std::size_t const insetnames_size =
|
||||||
|
sizeof(insetnames) / sizeof(insetnames[0]);
|
||||||
|
|
||||||
|
std::map<std::string, InsetBase::Code> data;
|
||||||
|
for (std::size_t i = 0; i != insetnames_size; ++i) {
|
||||||
|
InsetName const & var = insetnames[i];
|
||||||
|
data[var.name] = var.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
|
InsetBase::Code InsetBase::translate(std::string const & name)
|
||||||
|
{
|
||||||
|
static TranslatorMap const translator = build_translator();
|
||||||
|
|
||||||
|
TranslatorMap::const_iterator it = translator.find(name);
|
||||||
|
return it == translator.end() ? NO_CODE : it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetBase::dispatch(LCursor & cur, FuncRequest & cmd)
|
void InsetBase::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||||
@ -229,5 +311,3 @@ bool isHighlyEditableInset(InsetBase const * inset)
|
|||||||
{
|
{
|
||||||
return inset && inset->editable() == InsetBase::HIGHLY_EDITABLE;
|
return inset && inset->editable() == InsetBase::HIGHLY_EDITABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,6 +298,12 @@ public:
|
|||||||
///
|
///
|
||||||
MATHHULL_CODE
|
MATHHULL_CODE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** returns the Code corresponding to the \c name.
|
||||||
|
* Eg, translate("branch") == BRANCH_CODE
|
||||||
|
*/
|
||||||
|
static Code translate(std::string const & name);
|
||||||
|
|
||||||
/// returns true the inset can hold an inset of given type
|
/// returns true the inset can hold an inset of given type
|
||||||
virtual bool insetAllowed(Code) const { return false; }
|
virtual bool insetAllowed(Code) const { return false; }
|
||||||
// if this inset has paragraphs should they be output all as default
|
// if this inset has paragraphs should they be output all as default
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "insetbranch.h"
|
#include "insetbranch.h"
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
#include "BufferView.h"
|
||||||
#include "bufferparams.h"
|
#include "bufferparams.h"
|
||||||
#include "BranchList.h"
|
#include "BranchList.h"
|
||||||
#include "cursor.h"
|
#include "cursor.h"
|
||||||
@ -139,6 +140,35 @@ void InsetBranch::priv_dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
InsetCollapsable::priv_dispatch(cur, cmd);
|
InsetCollapsable::priv_dispatch(cur, cmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case LFUN_INSET_TOGGLE:
|
||||||
|
// We assume that this lfun is indeed going to be dispatched.
|
||||||
|
cur.dispatched();
|
||||||
|
|
||||||
|
if (cmd.argument == "open")
|
||||||
|
setStatus(Open);
|
||||||
|
else if (cmd.argument == "close")
|
||||||
|
setStatus(Collapsed);
|
||||||
|
|
||||||
|
// The branch inset specialises its behaviour on "toggle".
|
||||||
|
else if (cmd.argument == "toggle"
|
||||||
|
|| cmd.argument.empty()) {
|
||||||
|
BranchList const & branchlist =
|
||||||
|
cur.bv().buffer()->params().branchlist();
|
||||||
|
if (isBranchSelected(branchlist)) {
|
||||||
|
if (status() != Open)
|
||||||
|
setStatus(Open);
|
||||||
|
else
|
||||||
|
cur.undispatched();
|
||||||
|
} else {
|
||||||
|
if (status() != Collapsed)
|
||||||
|
setStatus(Collapsed);
|
||||||
|
else
|
||||||
|
cur.undispatched();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
InsetCollapsable::priv_dispatch(cur, cmd);
|
InsetCollapsable::priv_dispatch(cur, cmd);
|
||||||
break;
|
break;
|
||||||
|
@ -300,15 +300,18 @@ void InsetCollapsable::priv_dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_INSET_TOGGLE:
|
case LFUN_INSET_TOGGLE:
|
||||||
if (InsetText::text_.toggleInset(cur))
|
if (cmd.argument == "open")
|
||||||
break;
|
setStatus(Open);
|
||||||
if (status_ == Open) {
|
else if (cmd.argument == "close")
|
||||||
setStatus(Inlined);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
setStatus(Collapsed);
|
setStatus(Collapsed);
|
||||||
cur.undispatched();
|
else if (cmd.argument == "toggle"
|
||||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
|| cmd.argument.empty()) {
|
||||||
|
if (isOpen())
|
||||||
|
setStatus(Collapsed);
|
||||||
|
else
|
||||||
|
setStatus(Open);
|
||||||
|
}
|
||||||
|
cur.dispatched();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -337,6 +337,9 @@ enum kb_action {
|
|||||||
// 255
|
// 255
|
||||||
LFUN_EXPORT_CUSTOM,
|
LFUN_EXPORT_CUSTOM,
|
||||||
LFUN_PRINT,
|
LFUN_PRINT,
|
||||||
|
LFUN_KEYMAP_TOGGLE,
|
||||||
|
LFUN_NEXT_INSET_TOGGLE,
|
||||||
|
LFUN_ALL_INSETS_TOGGLE,
|
||||||
|
|
||||||
LFUN_LASTACTION // end of the table
|
LFUN_LASTACTION // end of the table
|
||||||
};
|
};
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "funcrequest.h"
|
#include "funcrequest.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "importer.h"
|
#include "importer.h"
|
||||||
|
#include "insetiterator.h"
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "kbmap.h"
|
#include "kbmap.h"
|
||||||
#include "LColor.h"
|
#include "LColor.h"
|
||||||
@ -494,6 +495,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
|||||||
case LFUN_FILE_INSERT:
|
case LFUN_FILE_INSERT:
|
||||||
case LFUN_FILE_INSERT_ASCII:
|
case LFUN_FILE_INSERT_ASCII:
|
||||||
case LFUN_FILE_INSERT_ASCII_PARA:
|
case LFUN_FILE_INSERT_ASCII_PARA:
|
||||||
|
case LFUN_ALL_INSETS_TOGGLE:
|
||||||
// these are handled in our dispatch()
|
// these are handled in our dispatch()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1242,6 +1244,31 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
|
|||||||
|
|
||||||
case LFUN_BREAKLINE: {
|
case LFUN_BREAKLINE: {
|
||||||
#warning swallow 'Return' if the minibuffer is focused. But how?
|
#warning swallow 'Return' if the minibuffer is focused. But how?
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case LFUN_ALL_INSETS_TOGGLE: {
|
||||||
|
string action;
|
||||||
|
string const name = split(argument, action, ' ');
|
||||||
|
InsetBase::Code const inset_code =
|
||||||
|
InsetBase::translate(name);
|
||||||
|
|
||||||
|
LCursor & cur = view()->cursor();
|
||||||
|
FuncRequest fr(LFUN_INSET_TOGGLE, action);
|
||||||
|
|
||||||
|
InsetBase & inset = owner->buffer()->inset();
|
||||||
|
InsetIterator it = inset_iterator_begin(inset);
|
||||||
|
InsetIterator const end = inset_iterator_end(inset);
|
||||||
|
for (; it != end; ++it) {
|
||||||
|
if (inset_code == InsetBase::NO_CODE
|
||||||
|
|| inset_code == it->lyxCode()) {
|
||||||
|
it->dispatch(cur, fr);
|
||||||
|
if (&cur.inset() == &*it
|
||||||
|
&& cur.disp_.dispatched())
|
||||||
|
cur.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
|
@ -231,8 +231,6 @@ public:
|
|||||||
};
|
};
|
||||||
/// Change the case of the word at cursor position.
|
/// Change the case of the word at cursor position.
|
||||||
void changeCase(LCursor & cur, TextCase action);
|
void changeCase(LCursor & cur, TextCase action);
|
||||||
/// returns success
|
|
||||||
bool toggleInset(LCursor & cur);
|
|
||||||
|
|
||||||
/** the DTP switches for paragraphs. LyX will store the top settings
|
/** the DTP switches for paragraphs. LyX will store the top settings
|
||||||
always in the first physical paragraph, the bottom settings in the
|
always in the first physical paragraph, the bottom settings in the
|
||||||
|
20
src/text2.C
20
src/text2.C
@ -1413,26 +1413,6 @@ void LyXText::recUndo(par_type par) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LyXText::toggleInset(LCursor & cur)
|
|
||||||
{
|
|
||||||
InsetBase * inset = cur.nextInset();
|
|
||||||
// is there an editable inset at cursor position?
|
|
||||||
if (!isEditableInset(inset))
|
|
||||||
return false;
|
|
||||||
cur.message(inset->editMessage());
|
|
||||||
|
|
||||||
// do we want to keep this?? (JMarc)
|
|
||||||
if (!isHighlyEditableInset(inset))
|
|
||||||
recordUndo(cur);
|
|
||||||
|
|
||||||
if (inset->isOpen())
|
|
||||||
inset->close();
|
|
||||||
else
|
|
||||||
inset->open();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int defaultRowHeight()
|
int defaultRowHeight()
|
||||||
{
|
{
|
||||||
return int(font_metrics::maxHeight(LyXFont(LyXFont::ALL_SANE)) * 1.2);
|
return int(font_metrics::maxHeight(LyXFont(LyXFont::ALL_SANE)) * 1.2);
|
||||||
|
19
src/text3.C
19
src/text3.C
@ -787,11 +787,19 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
cur.inset().asUpdatableInset()->showInsetDialog(bv);
|
cur.inset().asUpdatableInset()->showInsetDialog(bv);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_INSET_TOGGLE:
|
case LFUN_NEXT_INSET_TOGGLE: {
|
||||||
|
InsetBase * inset = cur.nextInset();
|
||||||
|
if (inset) {
|
||||||
|
cur.clearSelection();
|
||||||
|
FuncRequest fr = cmd;
|
||||||
|
fr.action = LFUN_INSET_TOGGLE;
|
||||||
|
inset->dispatch(cur, fr);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case LFUN_KEYMAP_TOGGLE:
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
if (!toggleInset(cur))
|
|
||||||
cur.undispatched();
|
|
||||||
else
|
|
||||||
bv->switchKeyMap();
|
bv->switchKeyMap();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1815,7 +1823,7 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
|
|||||||
case LFUN_PARAGRAPH_SPACING:
|
case LFUN_PARAGRAPH_SPACING:
|
||||||
case LFUN_INSET_APPLY:
|
case LFUN_INSET_APPLY:
|
||||||
case LFUN_INSET_INSERT:
|
case LFUN_INSET_INSERT:
|
||||||
case LFUN_INSET_TOGGLE:
|
case LFUN_NEXT_INSET_TOGGLE:
|
||||||
case LFUN_UPCASE_WORD:
|
case LFUN_UPCASE_WORD:
|
||||||
case LFUN_LOWCASE_WORD:
|
case LFUN_LOWCASE_WORD:
|
||||||
case LFUN_CAPITALIZE_WORD:
|
case LFUN_CAPITALIZE_WORD:
|
||||||
@ -1884,6 +1892,7 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
|
|||||||
case LFUN_THESAURUS_ENTRY:
|
case LFUN_THESAURUS_ENTRY:
|
||||||
case LFUN_PARAGRAPH_APPLY:
|
case LFUN_PARAGRAPH_APPLY:
|
||||||
case LFUN_ESCAPE:
|
case LFUN_ESCAPE:
|
||||||
|
case LFUN_KEYMAP_TOGGLE:
|
||||||
// these are handled in our dispatch()
|
// these are handled in our dispatch()
|
||||||
enable = true;
|
enable = true;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user