2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
|
* \file text3.cpp
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-08-20 13:00:25 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Asger Alstrup
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Alfredo Braunstein
|
|
|
|
|
* \author Angus Leeming
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
2002-08-20 13:00:25 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2007-04-29 23:33:02 +00:00
|
|
|
|
#include "Text.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
|
2007-09-20 20:44:08 +00:00
|
|
|
|
#include "Bidi.h"
|
2005-11-02 11:27:08 +00:00
|
|
|
|
#include "BranchList.h"
|
2004-03-18 13:57:20 +00:00
|
|
|
|
#include "FloatList.h"
|
|
|
|
|
#include "FuncStatus.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Buffer.h"
|
2005-02-25 11:55:36 +00:00
|
|
|
|
#include "buffer_funcs.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "BufferParams.h"
|
2002-08-20 13:00:25 +00:00
|
|
|
|
#include "BufferView.h"
|
2007-04-26 14:56:30 +00:00
|
|
|
|
#include "Cursor.h"
|
2004-03-25 09:16:36 +00:00
|
|
|
|
#include "CutAndPaste.h"
|
2007-11-29 07:04:28 +00:00
|
|
|
|
#include "support/debug.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "DispatchResult.h"
|
|
|
|
|
#include "ErrorList.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "factory.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "FuncRequest.h"
|
2007-11-29 07:04:28 +00:00
|
|
|
|
#include "support/gettext.h"
|
2007-10-24 15:32:43 +00:00
|
|
|
|
#include "InsetList.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Intl.h"
|
|
|
|
|
#include "Language.h"
|
2007-09-29 20:02:32 +00:00
|
|
|
|
#include "Layout.h"
|
2005-02-08 02:06:39 +00:00
|
|
|
|
#include "LyXAction.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "LyXFunc.h"
|
2007-04-26 11:30:54 +00:00
|
|
|
|
#include "Lexer.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "LyXRC.h"
|
|
|
|
|
#include "Paragraph.h"
|
2003-11-10 18:15:55 +00:00
|
|
|
|
#include "paragraph_funcs.h"
|
2002-08-20 13:00:25 +00:00
|
|
|
|
#include "ParagraphParameters.h"
|
2007-11-07 23:25:08 +00:00
|
|
|
|
#include "ParIterator.h"
|
|
|
|
|
#include "TextClass.h"
|
2007-10-11 09:59:01 +00:00
|
|
|
|
#include "TextMetrics.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "VSpace.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
|
2006-07-03 20:19:33 +00:00
|
|
|
|
#include "frontends/Clipboard.h"
|
Split clipboard and X selection
* src/LyXAction.C
(LyXAction::init): handle new LFUN_CLIPBOARD_PASTE
* src/insets/insettabular.C
(InsetTabular::doDispatch): ditto
* src/insets/insetbox.C
(InsetBox::doDispatch): ditto
* src/insets/insetert.C
(InsetERT::doDispatch): ditto
(InsetERT::getStatus): ditto
* src/insets/insetcharstyle.C
(InsetCharStyle::doDispatch): ditto
* src/BufferView_pimpl.C
(BufferView::Pimpl::selectionRequest): stuff selection, not clipboard
* src/mathed/math_nestinset.C
(MathNestInset::lfunMousePress): get stuff selection, not clipboard
(MathNestInset::lfunMouseRelease): clipboard -> selection in
commented code
* src/CutAndPaste.C
(cutSelection): ditto
* src/frontends/{qt3,gtk}/GuiImplementation.C
(GuiImplementation::newWorkArea): create new selection, not clipboard,
since the clipboard is now an object
(GuiImplementation::destroyWorkArea): destroy selection, not clipboard
* src/frontends/{qt4,qt3,gtk}/GuiSelection.h: new, copied from
GuiClipboard.h
* src/frontends/{qt4,qt3,gtk}/GuiSelection.C: new, copied from
GuiClipboard.C
* src/frontends/{qt3,gtk}/GuiImplementation.h
(selection): new accessor for selection_
(selection_): new, the global selection object
* src/frontends/{qt4,qt3,gtk}/Makefile.am: add GuiSelection.C and
GuiSelection.h
* src/frontends/{qt4,qt3,gtk}/GuiClipboard.C
(GuiClipboard::get): return clipboard, not selection
(GuiClipboard::put): stuff clipboard, not selection
* src/frontends/{qt4,qt3,gtk}/GuiClipboard.h
(haveSelection): remove (this is now in GuiSelection)
* src/frontends/{qt3,gtk}/GuiClipboard.h
(old_work_area_): remove, since it is not needed anymore
* src/frontends/gtk/ghelpers.C
(getGTKStockIcon): handle LFUN_CLIPBOARD_PASTE
* src/frontends/Clipboard.h
(haveSelection): remove (this is now in Selection)
* src/frontends/qt4/GuiImplementation.[Ch]
(GuiImplementation::selection): new accessor for selection_
* src/frontends/Gui.h
(selection): New accessor for the global selection object
* src/frontends/Selection.h; new, copied from Clipboard.h
* src/frontends/Makefile.am: add Selection.h
* src/text3.C
(various): s/clipboard().haveSelection/selection().haveSelection/
(LyXText::dispatch): handle LFUN_CLIPBOARD_PASTE
(LyXText::getStatus): ditto
* src/lfuns.h: new lfun LFUN_CLIPBOARD_PASTE
* lib/ui/stdmenus.ui: add new lfun LFUN_CLIPBOARD_PASTE
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14408 a592a061-630c-0410-9148-cb99ea01b6c8
2006-07-10 11:32:25 +00:00
|
|
|
|
#include "frontends/Selection.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
|
2007-10-03 13:38:19 +00:00
|
|
|
|
#include "insets/InsetCollapsable.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetCommand.h"
|
|
|
|
|
#include "insets/InsetFloatList.h"
|
|
|
|
|
#include "insets/InsetNewline.h"
|
|
|
|
|
#include "insets/InsetQuotes.h"
|
|
|
|
|
#include "insets/InsetSpecialChar.h"
|
|
|
|
|
#include "insets/InsetText.h"
|
2007-10-11 14:52:00 +00:00
|
|
|
|
#include "insets/InsetInfo.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
|
|
|
|
|
#include "support/lstrings.h"
|
2005-01-06 16:39:35 +00:00
|
|
|
|
#include "support/convert.h"
|
2005-07-05 09:01:52 +00:00
|
|
|
|
#include "support/lyxtime.h"
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "mathed/InsetMathHull.h"
|
|
|
|
|
#include "mathed/MathMacroTemplate.h"
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2007-11-06 17:13:43 +00:00
|
|
|
|
#include <boost/next_prior.hpp>
|
2005-03-07 11:03:45 +00:00
|
|
|
|
|
2003-09-05 22:17:02 +00:00
|
|
|
|
#include <clocale>
|
2004-07-24 10:55:30 +00:00
|
|
|
|
#include <sstream>
|
2002-08-27 13:39:27 +00:00
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
|
using namespace std;
|
2007-12-12 18:57:56 +00:00
|
|
|
|
using namespace lyx::support;
|
2003-09-09 22:13:45 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
2004-03-25 09:16:36 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
using cap::copySelection;
|
|
|
|
|
using cap::cutSelection;
|
2007-02-02 03:10:15 +00:00
|
|
|
|
using cap::pasteFromStack;
|
2007-01-13 18:29:50 +00:00
|
|
|
|
using cap::pasteClipboard;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
using cap::replaceSelection;
|
|
|
|
|
|
2007-09-29 11:00:18 +00:00
|
|
|
|
// globals...
|
2007-11-14 15:07:08 +00:00
|
|
|
|
static Font freefont(ignore_font, ignore_language);
|
2007-09-29 11:00:18 +00:00
|
|
|
|
static bool toggleall = false;
|
2002-08-27 13:17:22 +00:00
|
|
|
|
|
2007-09-29 11:00:18 +00:00
|
|
|
|
static void toggleAndShow(Cursor & cur, Text * text,
|
|
|
|
|
Font const & font, bool toggleall = true)
|
|
|
|
|
{
|
|
|
|
|
text->toggleFree(cur, font, toggleall);
|
|
|
|
|
|
|
|
|
|
if (font.language() != ignore_language ||
|
2007-11-06 17:13:43 +00:00
|
|
|
|
font.fontInfo().number() != FONT_IGNORE) {
|
2007-09-29 11:00:18 +00:00
|
|
|
|
TextMetrics const & tm = cur.bv().textMetrics(text);
|
2007-11-06 17:13:43 +00:00
|
|
|
|
if (cur.boundary() != tm.isRTLBoundary(cur.pit(), cur.pos(),
|
|
|
|
|
cur.real_current_font))
|
2007-09-29 11:00:18 +00:00
|
|
|
|
text->setCursor(cur, cur.pit(), cur.pos(),
|
2007-11-06 17:13:43 +00:00
|
|
|
|
false, !cur.boundary());
|
2003-11-10 09:06:48 +00:00
|
|
|
|
}
|
2007-09-29 11:00:18 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
|
|
|
|
|
2007-09-29 11:00:18 +00:00
|
|
|
|
static void moveCursor(Cursor & cur, bool selecting)
|
|
|
|
|
{
|
|
|
|
|
if (selecting || cur.mark())
|
|
|
|
|
cur.setSelection();
|
|
|
|
|
}
|
2002-08-27 14:43:49 +00:00
|
|
|
|
|
|
|
|
|
|
2007-09-29 11:00:18 +00:00
|
|
|
|
static void finishChange(Cursor & cur, bool selecting)
|
|
|
|
|
{
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.finishUndo();
|
2007-09-29 11:00:18 +00:00
|
|
|
|
moveCursor(cur, selecting);
|
|
|
|
|
}
|
2002-08-27 13:17:22 +00:00
|
|
|
|
|
2004-02-11 14:45:44 +00:00
|
|
|
|
|
2007-09-29 11:00:18 +00:00
|
|
|
|
static void mathDispatch(Cursor & cur, FuncRequest const & cmd, bool display)
|
|
|
|
|
{
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.recordUndo();
|
2007-09-29 11:00:18 +00:00
|
|
|
|
docstring sel = cur.selectionAsString(false);
|
2004-02-11 14:45:44 +00:00
|
|
|
|
|
2007-09-29 11:00:18 +00:00
|
|
|
|
// It may happen that sel is empty but there is a selection
|
|
|
|
|
replaceSelection(cur);
|
2006-02-24 12:58:31 +00:00
|
|
|
|
|
2007-09-29 11:00:18 +00:00
|
|
|
|
if (sel.empty()) {
|
2007-01-04 14:28:22 +00:00
|
|
|
|
#ifdef ENABLE_ASSERTIONS
|
2007-09-29 11:00:18 +00:00
|
|
|
|
const int old_pos = cur.pos();
|
2007-01-04 14:28:22 +00:00
|
|
|
|
#endif
|
2007-09-29 11:00:18 +00:00
|
|
|
|
cur.insert(new InsetMathHull(hullSimple));
|
|
|
|
|
BOOST_ASSERT(old_pos == cur.pos());
|
|
|
|
|
cur.nextInset()->edit(cur, true);
|
|
|
|
|
// don't do that also for LFUN_MATH_MODE
|
|
|
|
|
// unless you want end up with always changing
|
|
|
|
|
// to mathrm when opening an inlined inset --
|
|
|
|
|
// I really hate "LyXfunc overloading"...
|
|
|
|
|
if (display)
|
|
|
|
|
cur.dispatch(FuncRequest(LFUN_MATH_DISPLAY));
|
|
|
|
|
// Avoid an unnecessary undo step if cmd.argument
|
|
|
|
|
// is empty
|
|
|
|
|
if (!cmd.argument().empty())
|
|
|
|
|
cur.dispatch(FuncRequest(LFUN_MATH_INSERT,
|
|
|
|
|
cmd.argument()));
|
|
|
|
|
} else {
|
|
|
|
|
// create a macro if we see "\\newcommand"
|
|
|
|
|
// somewhere, and an ordinary formula
|
|
|
|
|
// otherwise
|
|
|
|
|
if (sel.find(from_ascii("\\newcommand")) == string::npos
|
2007-12-23 16:32:00 +00:00
|
|
|
|
&& sel.find(from_ascii("\\newlyxcommand")) == string::npos
|
2007-09-29 11:00:18 +00:00
|
|
|
|
&& sel.find(from_ascii("\\def")) == string::npos)
|
|
|
|
|
{
|
|
|
|
|
InsetMathHull * formula = new InsetMathHull;
|
|
|
|
|
istringstream is(to_utf8(sel));
|
|
|
|
|
Lexer lex(0, 0);
|
|
|
|
|
lex.setStream(is);
|
|
|
|
|
formula->read(cur.buffer(), lex);
|
|
|
|
|
if (formula->getType() == hullNone)
|
|
|
|
|
// Don't create pseudo formulas if
|
|
|
|
|
// delimiters are left out
|
|
|
|
|
formula->mutate(hullSimple);
|
|
|
|
|
cur.insert(formula);
|
2004-02-11 14:45:44 +00:00
|
|
|
|
} else {
|
2007-09-29 11:00:18 +00:00
|
|
|
|
cur.insert(new MathMacroTemplate(sel));
|
2004-02-11 14:45:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-29 11:00:18 +00:00
|
|
|
|
cur.message(from_utf8(N_("Math editor mode")));
|
2003-11-10 09:06:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-22 13:02:14 +00:00
|
|
|
|
|
2007-09-29 11:00:18 +00:00
|
|
|
|
static void specialChar(Cursor & cur, InsetSpecialChar::Kind kind)
|
2002-08-20 13:00:25 +00:00
|
|
|
|
{
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.recordUndo();
|
2006-10-21 00:16:43 +00:00
|
|
|
|
cap::replaceSelection(cur);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
cur.insert(new InsetSpecialChar(kind));
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2002-08-20 13:00:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-02-18 11:47:16 +00:00
|
|
|
|
|
2007-09-29 11:00:18 +00:00
|
|
|
|
static bool doInsertInset(Cursor & cur, Text * text,
|
2004-02-13 07:30:59 +00:00
|
|
|
|
FuncRequest const & cmd, bool edit, bool pastesel)
|
2003-01-17 09:57:50 +00:00
|
|
|
|
{
|
2007-11-03 17:37:37 +00:00
|
|
|
|
Inset * inset = createInset(cur.bv().buffer(), cmd);
|
2003-12-12 10:05:21 +00:00
|
|
|
|
if (!inset)
|
2005-05-30 15:35:11 +00:00
|
|
|
|
return false;
|
2003-12-12 10:05:21 +00:00
|
|
|
|
|
2007-11-02 21:27:41 +00:00
|
|
|
|
if (InsetCollapsable * ci = inset->asInsetCollapsable())
|
|
|
|
|
ci->setLayout(cur.bv().buffer().params());
|
|
|
|
|
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.recordUndo();
|
2007-10-03 13:38:19 +00:00
|
|
|
|
if (cmd.action == LFUN_INDEX_INSERT) {
|
2007-12-12 19:57:42 +00:00
|
|
|
|
docstring ds = subst(text->getStringToIndex(cur), '\n', ' ');
|
2007-10-03 13:38:19 +00:00
|
|
|
|
text->insertInset(cur, inset);
|
|
|
|
|
if (edit)
|
|
|
|
|
inset->edit(cur, true);
|
|
|
|
|
// Now put this into inset
|
|
|
|
|
static_cast<InsetCollapsable *>(inset)->text_.insertStringAsParagraphs(cur, ds);
|
|
|
|
|
} else {
|
|
|
|
|
bool gotsel = false;
|
|
|
|
|
if (cur.selection()) {
|
|
|
|
|
lyx::dispatch(FuncRequest(LFUN_CUT));
|
|
|
|
|
gotsel = true;
|
|
|
|
|
}
|
|
|
|
|
text->insertInset(cur, inset);
|
|
|
|
|
|
|
|
|
|
if (edit)
|
|
|
|
|
inset->edit(cur, true);
|
|
|
|
|
|
|
|
|
|
if (gotsel && pastesel) {
|
|
|
|
|
lyx::dispatch(FuncRequest(LFUN_PASTE, "0"));
|
2007-10-13 09:14:49 +00:00
|
|
|
|
InsetText * insetText = dynamic_cast<InsetText *>(inset);
|
|
|
|
|
if (insetText && !insetText->allowMultiPar()
|
2007-10-11 10:13:45 +00:00
|
|
|
|
|| cur.lastpit() == 0) {
|
2007-10-10 13:25:37 +00:00
|
|
|
|
// reset first par to default
|
2007-10-03 13:38:19 +00:00
|
|
|
|
LayoutPtr const layout =
|
|
|
|
|
cur.buffer().params().getTextClass().defaultLayout();
|
|
|
|
|
cur.text()->paragraphs().begin()->layout(layout);
|
2007-10-10 13:25:37 +00:00
|
|
|
|
cur.pos() = 0;
|
|
|
|
|
cur.pit() = 0;
|
|
|
|
|
// Merge multiple paragraphs -- hack
|
|
|
|
|
while (cur.lastpit() > 0) {
|
|
|
|
|
mergeParagraph(cur.buffer().params(),
|
|
|
|
|
cur.text()->paragraphs(), 0);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// reset surrounding par to default
|
|
|
|
|
docstring const layoutname =
|
|
|
|
|
cur.buffer().params().getTextClass().defaultLayoutName();
|
|
|
|
|
cur.leaveInset(*inset);
|
|
|
|
|
text->setLayout(cur, layoutname);
|
2007-10-03 13:38:19 +00:00
|
|
|
|
}
|
2006-09-14 13:44:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2005-05-30 15:35:11 +00:00
|
|
|
|
return true;
|
2003-01-17 09:57:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-11-30 01:59:49 +00:00
|
|
|
|
|
2007-09-29 11:00:18 +00:00
|
|
|
|
string const freefont2string()
|
|
|
|
|
{
|
|
|
|
|
return freefont.toString(toggleall);
|
|
|
|
|
}
|
2003-10-13 01:35:47 +00:00
|
|
|
|
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2007-11-06 17:13:43 +00:00
|
|
|
|
/// the type of outline operation
|
|
|
|
|
enum OutlineOp {
|
|
|
|
|
OutlineUp, // Move this header with text down
|
|
|
|
|
OutlineDown, // Move this header with text up
|
|
|
|
|
OutlineIn, // Make this header deeper
|
|
|
|
|
OutlineOut // Make this header shallower
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void outline(OutlineOp mode, Cursor & cur)
|
|
|
|
|
{
|
|
|
|
|
Buffer & buf = cur.buffer();
|
|
|
|
|
pit_type & pit = cur.pit();
|
|
|
|
|
ParagraphList & pars = buf.text().paragraphs();
|
|
|
|
|
ParagraphList::iterator bgn = pars.begin();
|
|
|
|
|
// The first paragraph of the area to be copied:
|
|
|
|
|
ParagraphList::iterator start = boost::next(bgn, pit);
|
|
|
|
|
// The final paragraph of area to be copied:
|
|
|
|
|
ParagraphList::iterator finish = start;
|
|
|
|
|
ParagraphList::iterator end = pars.end();
|
|
|
|
|
|
|
|
|
|
TextClass::const_iterator lit =
|
|
|
|
|
buf.params().getTextClass().begin();
|
|
|
|
|
TextClass::const_iterator const lend =
|
|
|
|
|
buf.params().getTextClass().end();
|
|
|
|
|
|
|
|
|
|
int const thistoclevel = start->layout()->toclevel;
|
|
|
|
|
int toclevel;
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case OutlineUp: {
|
|
|
|
|
// Move out (down) from this section header
|
|
|
|
|
if (finish != end)
|
|
|
|
|
++finish;
|
|
|
|
|
// Seek the one (on same level) below
|
|
|
|
|
for (; finish != end; ++finish) {
|
|
|
|
|
toclevel = finish->layout()->toclevel;
|
|
|
|
|
if (toclevel != Layout::NOT_IN_TOC
|
|
|
|
|
&& toclevel <= thistoclevel) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ParagraphList::iterator dest = start;
|
|
|
|
|
// Move out (up) from this header
|
|
|
|
|
if (dest == bgn)
|
|
|
|
|
break;
|
|
|
|
|
// Search previous same-level header above
|
|
|
|
|
do {
|
|
|
|
|
--dest;
|
|
|
|
|
toclevel = dest->layout()->toclevel;
|
|
|
|
|
} while(dest != bgn
|
|
|
|
|
&& (toclevel == Layout::NOT_IN_TOC
|
|
|
|
|
|| toclevel > thistoclevel));
|
|
|
|
|
// Not found; do nothing
|
|
|
|
|
if (toclevel == Layout::NOT_IN_TOC || toclevel > thistoclevel)
|
|
|
|
|
break;
|
2007-12-12 19:28:07 +00:00
|
|
|
|
pit_type const newpit = distance(bgn, dest);
|
|
|
|
|
pit_type const len = distance(start, finish);
|
2007-11-06 17:13:43 +00:00
|
|
|
|
pit_type const deletepit = pit + len;
|
|
|
|
|
buf.undo().recordUndo(cur, ATOMIC_UNDO, newpit, deletepit - 1);
|
|
|
|
|
pars.insert(dest, start, finish);
|
|
|
|
|
start = boost::next(pars.begin(), deletepit);
|
|
|
|
|
pit = newpit;
|
|
|
|
|
pars.erase(start, finish);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case OutlineDown: {
|
|
|
|
|
// Go down out of current header:
|
|
|
|
|
if (finish != end)
|
|
|
|
|
++finish;
|
|
|
|
|
// Find next same-level header:
|
|
|
|
|
for (; finish != end; ++finish) {
|
|
|
|
|
toclevel = finish->layout()->toclevel;
|
|
|
|
|
if (toclevel != Layout::NOT_IN_TOC && toclevel <= thistoclevel)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
ParagraphList::iterator dest = finish;
|
|
|
|
|
// Go one down from *this* header:
|
|
|
|
|
if (dest != end)
|
|
|
|
|
++dest;
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
// Go further down to find header to insert in front of:
|
|
|
|
|
for (; dest != end; ++dest) {
|
|
|
|
|
toclevel = dest->layout()->toclevel;
|
|
|
|
|
if (toclevel != Layout::NOT_IN_TOC && toclevel <= thistoclevel)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// One such was found:
|
2007-12-12 19:28:07 +00:00
|
|
|
|
pit_type newpit = distance(bgn, dest);
|
|
|
|
|
pit_type const len = distance(start, finish);
|
2007-11-06 17:13:43 +00:00
|
|
|
|
buf.undo().recordUndo(cur, ATOMIC_UNDO, pit, newpit - 1);
|
|
|
|
|
pars.insert(dest, start, finish);
|
|
|
|
|
start = boost::next(bgn, pit);
|
|
|
|
|
pit = newpit - len;
|
|
|
|
|
pars.erase(start, finish);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case OutlineIn:
|
|
|
|
|
buf.undo().recordUndo(cur);
|
|
|
|
|
for (; lit != lend; ++lit) {
|
|
|
|
|
if ((*lit)->toclevel == thistoclevel + 1 &&
|
|
|
|
|
start->layout()->labeltype == (*lit)->labeltype) {
|
|
|
|
|
start->layout((*lit));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case OutlineOut:
|
|
|
|
|
buf.undo().recordUndo(cur);
|
|
|
|
|
for (; lit != lend; ++lit) {
|
|
|
|
|
if ((*lit)->toclevel == thistoclevel - 1 &&
|
|
|
|
|
start->layout()->labeltype == (*lit)->labeltype) {
|
|
|
|
|
start->layout((*lit));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 23:33:02 +00:00
|
|
|
|
void Text::number(Cursor & cur)
|
2003-11-10 09:06:48 +00:00
|
|
|
|
{
|
2007-10-28 18:51:54 +00:00
|
|
|
|
FontInfo font = ignore_font;
|
|
|
|
|
font.setNumber(FONT_TOGGLE);
|
|
|
|
|
toggleAndShow(cur, this, Font(font));
|
2003-11-10 09:06:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 23:33:02 +00:00
|
|
|
|
bool Text::isRTL(Buffer const & buffer, Paragraph const & par) const
|
2003-11-10 09:06:48 +00:00
|
|
|
|
{
|
2007-09-04 10:27:55 +00:00
|
|
|
|
return par.isRTL(buffer.params());
|
2003-11-10 09:06:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 23:33:02 +00:00
|
|
|
|
void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
2002-08-20 13:00:25 +00:00
|
|
|
|
{
|
2007-11-15 20:04:51 +00:00
|
|
|
|
LYXERR(Debug::ACTION, "Text::dispatch: cmd: " << cmd);
|
2002-08-22 15:04:27 +00:00
|
|
|
|
|
2006-11-17 17:42:52 +00:00
|
|
|
|
// FIXME: We use the update flag to indicates wether a singlePar or a
|
|
|
|
|
// full screen update is needed. We reset it here but shall we restore it
|
|
|
|
|
// at the end?
|
|
|
|
|
cur.noUpdate();
|
|
|
|
|
|
2004-03-18 13:57:20 +00:00
|
|
|
|
BOOST_ASSERT(cur.text() == this);
|
2004-01-20 14:25:24 +00:00
|
|
|
|
BufferView * bv = &cur.bv();
|
2007-09-02 09:44:08 +00:00
|
|
|
|
TextMetrics & tm = cur.bv().textMetrics(this);
|
2005-02-08 02:06:39 +00:00
|
|
|
|
CursorSlice oldTopSlice = cur.top();
|
2005-07-16 16:34:54 +00:00
|
|
|
|
bool oldBoundary = cur.boundary();
|
2004-05-18 07:18:02 +00:00
|
|
|
|
bool sel = cur.selection();
|
2005-10-07 12:00:41 +00:00
|
|
|
|
// Signals that, even if needsUpdate == false, an update of the
|
|
|
|
|
// cursor paragraph is required
|
|
|
|
|
bool singleParUpdate = lyxaction.funcHasFlag(cmd.action,
|
|
|
|
|
LyXAction::SingleParUpdate);
|
|
|
|
|
// Signals that a full-screen update is required
|
2006-04-05 23:56:29 +00:00
|
|
|
|
bool needsUpdate = !(lyxaction.funcHasFlag(cmd.action,
|
2005-10-07 12:00:41 +00:00
|
|
|
|
LyXAction::NoUpdate) || singleParUpdate);
|
2005-12-31 11:40:33 +00:00
|
|
|
|
// Remember the old paragraph metric (_outer_ paragraph!)
|
2006-12-29 23:54:48 +00:00
|
|
|
|
ParagraphMetrics const & pm = cur.bv().parMetrics(
|
|
|
|
|
cur.bottom().text(), cur.bottom().pit());
|
|
|
|
|
Dimension olddim = pm.dim();
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
|
|
|
|
switch (cmd.action) {
|
|
|
|
|
|
2006-04-26 22:43:26 +00:00
|
|
|
|
case LFUN_PARAGRAPH_MOVE_DOWN: {
|
|
|
|
|
pit_type const pit = cur.pit();
|
Move BufferView cached pointer out of LyXText:
* LyXText
- bv(), bv_owner, : deleted.
- These methods now need a (Buffer const &) argument: getFont(), applyOuterFont(), getLayoutFont(), getLabelFont(), setCharFont(), setLayout(), singleWidth(), leftMargin(), rightMargin(), computeRowMetrics(), isMainText(), spacing(), isRTL(), cursorX(), rowBreakPoint(), setRowWidth(), labelFill(), labelEnd().
- These methods now need a (BufferView const &) argument and are propably candidates for future removal when 1.6 is opened for development: redoParagraph(), x2pos(), getRowNearY(), getColumnNearX(), checkInsetHit(), setHeightOfRow().
- recUndo(): now need a LCursor argument.
* CoordCache::get(LyXText const *, pit_type):
- now const.
- use const_iterator instead of iterator.
* FontIterator:
- add (Buffer const &) argument to ctor
- buffer_: new const reference to applicable BufferView.
* InsetBase
- xo(), yo(), covers() and neverIndent() are now const.
* InsetText::setViewCache(): deleted
All other changes are due to the LyXText and InsetBase API changes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15618 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-30 12:45:33 +00:00
|
|
|
|
recUndo(cur, pit, pit + 1);
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.finishUndo();
|
2007-12-12 19:28:07 +00:00
|
|
|
|
swap(pars_[pit], pars_[pit + 1]);
|
2007-07-11 13:20:19 +00:00
|
|
|
|
updateLabels(cur.buffer());
|
2006-04-26 22:43:26 +00:00
|
|
|
|
needsUpdate = true;
|
2007-07-13 16:12:44 +00:00
|
|
|
|
++cur.pit();
|
2006-04-26 22:43:26 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case LFUN_PARAGRAPH_MOVE_UP: {
|
|
|
|
|
pit_type const pit = cur.pit();
|
Move BufferView cached pointer out of LyXText:
* LyXText
- bv(), bv_owner, : deleted.
- These methods now need a (Buffer const &) argument: getFont(), applyOuterFont(), getLayoutFont(), getLabelFont(), setCharFont(), setLayout(), singleWidth(), leftMargin(), rightMargin(), computeRowMetrics(), isMainText(), spacing(), isRTL(), cursorX(), rowBreakPoint(), setRowWidth(), labelFill(), labelEnd().
- These methods now need a (BufferView const &) argument and are propably candidates for future removal when 1.6 is opened for development: redoParagraph(), x2pos(), getRowNearY(), getColumnNearX(), checkInsetHit(), setHeightOfRow().
- recUndo(): now need a LCursor argument.
* CoordCache::get(LyXText const *, pit_type):
- now const.
- use const_iterator instead of iterator.
* FontIterator:
- add (Buffer const &) argument to ctor
- buffer_: new const reference to applicable BufferView.
* InsetBase
- xo(), yo(), covers() and neverIndent() are now const.
* InsetText::setViewCache(): deleted
All other changes are due to the LyXText and InsetBase API changes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15618 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-30 12:45:33 +00:00
|
|
|
|
recUndo(cur, pit - 1, pit);
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.finishUndo();
|
2007-12-12 19:28:07 +00:00
|
|
|
|
swap(pars_[pit], pars_[pit - 1]);
|
2007-07-11 13:20:19 +00:00
|
|
|
|
updateLabels(cur.buffer());
|
2007-07-13 16:12:44 +00:00
|
|
|
|
--cur.pit();
|
2006-04-26 22:43:26 +00:00
|
|
|
|
needsUpdate = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-20 13:00:25 +00:00
|
|
|
|
case LFUN_APPENDIX: {
|
2004-02-13 07:30:59 +00:00
|
|
|
|
Paragraph & par = cur.paragraph();
|
|
|
|
|
bool start = !par.params().startOfAppendix();
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2007-08-10 11:47:12 +00:00
|
|
|
|
// FIXME: The code below only makes sense at top level.
|
2005-02-25 11:55:36 +00:00
|
|
|
|
// Should LFUN_APPENDIX be restricted to top-level paragraphs?
|
2002-08-20 13:00:25 +00:00
|
|
|
|
// ensure that we have only one start_of_appendix in this document
|
2007-07-11 13:39:08 +00:00
|
|
|
|
// FIXME: this don't work for multipart document!
|
2004-11-24 21:53:46 +00:00
|
|
|
|
for (pit_type tmp = 0, end = pars_.size(); tmp != end; ++tmp) {
|
2004-03-25 09:16:36 +00:00
|
|
|
|
if (pars_[tmp].params().startOfAppendix()) {
|
Move BufferView cached pointer out of LyXText:
* LyXText
- bv(), bv_owner, : deleted.
- These methods now need a (Buffer const &) argument: getFont(), applyOuterFont(), getLayoutFont(), getLabelFont(), setCharFont(), setLayout(), singleWidth(), leftMargin(), rightMargin(), computeRowMetrics(), isMainText(), spacing(), isRTL(), cursorX(), rowBreakPoint(), setRowWidth(), labelFill(), labelEnd().
- These methods now need a (BufferView const &) argument and are propably candidates for future removal when 1.6 is opened for development: redoParagraph(), x2pos(), getRowNearY(), getColumnNearX(), checkInsetHit(), setHeightOfRow().
- recUndo(): now need a LCursor argument.
* CoordCache::get(LyXText const *, pit_type):
- now const.
- use const_iterator instead of iterator.
* FontIterator:
- add (Buffer const &) argument to ctor
- buffer_: new const reference to applicable BufferView.
* InsetBase
- xo(), yo(), covers() and neverIndent() are now const.
* InsetText::setViewCache(): deleted
All other changes are due to the LyXText and InsetBase API changes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15618 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-30 12:45:33 +00:00
|
|
|
|
recUndo(cur, tmp);
|
2004-03-25 09:16:36 +00:00
|
|
|
|
pars_[tmp].params().startOfAppendix(false);
|
2002-10-30 21:02:40 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.recordUndo();
|
2004-02-13 07:30:59 +00:00
|
|
|
|
par.params().startOfAppendix(start);
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
|
|
|
|
// we can set the refreshing parameters now
|
2006-04-16 14:19:25 +00:00
|
|
|
|
updateLabels(cur.buffer());
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_WORD_DELETE_FORWARD:
|
2007-07-10 12:20:00 +00:00
|
|
|
|
if (cur.selection()) {
|
|
|
|
|
cutSelection(cur, true, false);
|
|
|
|
|
} else
|
|
|
|
|
deleteWordForward(cur);
|
2004-03-08 21:14:45 +00:00
|
|
|
|
finishChange(cur, false);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_WORD_DELETE_BACKWARD:
|
2007-07-10 12:20:00 +00:00
|
|
|
|
if (cur.selection()) {
|
|
|
|
|
cutSelection(cur, true, false);
|
|
|
|
|
} else
|
|
|
|
|
deleteWordBackward(cur);
|
2004-03-08 21:14:45 +00:00
|
|
|
|
finishChange(cur, false);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_LINE_DELETE:
|
2007-07-10 12:20:00 +00:00
|
|
|
|
if (cur.selection()) {
|
|
|
|
|
cutSelection(cur, true, false);
|
|
|
|
|
} else
|
2007-09-02 11:21:33 +00:00
|
|
|
|
tm.deleteLineForward(cur);
|
2004-03-08 21:14:45 +00:00
|
|
|
|
finishChange(cur, false);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_BUFFER_BEGIN:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_BUFFER_BEGIN_SELECT:
|
2006-10-22 11:46:36 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(cmd.action == LFUN_BUFFER_BEGIN_SELECT);
|
2005-02-08 13:18:05 +00:00
|
|
|
|
if (cur.depth() == 1) {
|
2006-10-21 12:01:14 +00:00
|
|
|
|
needsUpdate |= cursorTop(cur);
|
2004-11-30 01:59:49 +00:00
|
|
|
|
} else {
|
|
|
|
|
cur.undispatched();
|
|
|
|
|
}
|
2007-12-21 10:42:59 +00:00
|
|
|
|
cur.updateFlags(Update::FitCursor);
|
2004-11-30 01:59:49 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_BUFFER_END:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_BUFFER_END_SELECT:
|
2006-10-22 11:46:36 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(cmd.action == LFUN_BUFFER_END_SELECT);
|
2005-02-08 13:18:05 +00:00
|
|
|
|
if (cur.depth() == 1) {
|
2006-10-21 12:01:14 +00:00
|
|
|
|
needsUpdate |= cursorBottom(cur);
|
2004-11-30 01:59:49 +00:00
|
|
|
|
} else {
|
|
|
|
|
cur.undispatched();
|
|
|
|
|
}
|
2007-12-21 10:42:59 +00:00
|
|
|
|
cur.updateFlags(Update::FitCursor);
|
2004-11-30 01:59:49 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_CHAR_FORWARD:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_CHAR_FORWARD_SELECT:
|
2007-11-29 21:10:35 +00:00
|
|
|
|
//LYXERR0(" LFUN_CHAR_FORWARD[SEL]:\n" << cur);
|
2006-10-22 11:46:36 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(cmd.action == LFUN_CHAR_FORWARD_SELECT);
|
2007-10-22 22:18:52 +00:00
|
|
|
|
needsUpdate |= cursorForward(cur);
|
2005-07-16 16:34:54 +00:00
|
|
|
|
|
2005-07-17 10:31:44 +00:00
|
|
|
|
if (!needsUpdate && oldTopSlice == cur.top()
|
|
|
|
|
&& cur.boundary() == oldBoundary) {
|
2004-03-25 09:16:36 +00:00
|
|
|
|
cur.undispatched();
|
2007-10-22 22:18:52 +00:00
|
|
|
|
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
2007-09-21 20:57:00 +00:00
|
|
|
|
}
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_CHAR_BACKWARD:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_CHAR_BACKWARD_SELECT:
|
|
|
|
|
//lyxerr << "handle LFUN_CHAR_BACKWARD[_SELECT]:\n" << cur << endl;
|
2006-10-22 11:46:36 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(cmd.action == LFUN_CHAR_BACKWARD_SELECT);
|
2007-10-22 22:18:52 +00:00
|
|
|
|
needsUpdate |= cursorBackward(cur);
|
2005-07-17 10:31:44 +00:00
|
|
|
|
|
|
|
|
|
if (!needsUpdate && oldTopSlice == cur.top()
|
|
|
|
|
&& cur.boundary() == oldBoundary) {
|
2004-03-25 09:16:36 +00:00
|
|
|
|
cur.undispatched();
|
2007-10-22 22:18:52 +00:00
|
|
|
|
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_CHAR_LEFT:
|
|
|
|
|
case LFUN_CHAR_LEFT_SELECT:
|
|
|
|
|
//FIXME: for visual cursor, really move left
|
|
|
|
|
if (reverseDirectionNeeded(cur)) {
|
2007-11-15 18:01:04 +00:00
|
|
|
|
cmd.action = cmd.action == LFUN_CHAR_LEFT_SELECT ?
|
|
|
|
|
LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD;
|
2007-10-22 22:18:52 +00:00
|
|
|
|
} else {
|
2007-11-15 18:01:04 +00:00
|
|
|
|
cmd.action = cmd.action == LFUN_CHAR_LEFT_SELECT ?
|
|
|
|
|
LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD;
|
2007-10-22 22:18:52 +00:00
|
|
|
|
}
|
2007-11-15 18:01:04 +00:00
|
|
|
|
dispatch(cur, cmd);
|
|
|
|
|
return;
|
2007-10-22 22:18:52 +00:00
|
|
|
|
|
|
|
|
|
case LFUN_CHAR_RIGHT:
|
|
|
|
|
case LFUN_CHAR_RIGHT_SELECT:
|
|
|
|
|
//FIXME: for visual cursor, really move right
|
|
|
|
|
if (reverseDirectionNeeded(cur)) {
|
2007-11-15 18:01:04 +00:00
|
|
|
|
cmd.action = cmd.action == LFUN_CHAR_RIGHT_SELECT ?
|
|
|
|
|
LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD;
|
2007-10-22 22:18:52 +00:00
|
|
|
|
} else {
|
2007-11-15 18:01:04 +00:00
|
|
|
|
cmd.action = cmd.action == LFUN_CHAR_RIGHT_SELECT ?
|
|
|
|
|
LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD;
|
2007-09-21 20:57:00 +00:00
|
|
|
|
}
|
2007-11-15 18:01:04 +00:00
|
|
|
|
dispatch(cur, cmd);
|
|
|
|
|
return;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2007-06-14 20:32:28 +00:00
|
|
|
|
case LFUN_UP_SELECT:
|
|
|
|
|
case LFUN_DOWN_SELECT:
|
2004-02-20 17:19:53 +00:00
|
|
|
|
case LFUN_UP:
|
2007-06-14 20:32:28 +00:00
|
|
|
|
case LFUN_DOWN: {
|
2007-06-15 05:31:11 +00:00
|
|
|
|
// stop/start the selection
|
|
|
|
|
bool select = cmd.action == LFUN_DOWN_SELECT ||
|
|
|
|
|
cmd.action == LFUN_UP_SELECT;
|
|
|
|
|
cur.selHandle(select);
|
|
|
|
|
|
2007-06-14 20:32:28 +00:00
|
|
|
|
// move cursor up/down
|
|
|
|
|
bool up = cmd.action == LFUN_UP_SELECT || cmd.action == LFUN_UP;
|
|
|
|
|
bool const successful = cur.upDownInText(up, needsUpdate);
|
|
|
|
|
if (successful) {
|
|
|
|
|
// notify insets which were left and get their update flags
|
|
|
|
|
notifyCursorLeaves(cur.beforeDispatchCursor(), cur);
|
|
|
|
|
cur.fixIfBroken();
|
|
|
|
|
|
|
|
|
|
// redraw if you leave mathed (for the decorations)
|
|
|
|
|
needsUpdate |= cur.beforeDispatchCursor().inMathed();
|
|
|
|
|
} else
|
2004-03-25 09:16:36 +00:00
|
|
|
|
cur.undispatched();
|
2007-06-14 20:32:28 +00:00
|
|
|
|
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2007-05-30 19:38:22 +00:00
|
|
|
|
}
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_PARAGRAPH_UP:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_PARAGRAPH_UP_SELECT:
|
2006-10-22 11:46:36 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(cmd.action == LFUN_PARAGRAPH_UP_SELECT);
|
2006-10-21 12:01:14 +00:00
|
|
|
|
needsUpdate |= cursorUpParagraph(cur);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_PARAGRAPH_DOWN:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_PARAGRAPH_DOWN_SELECT:
|
2006-10-22 11:46:36 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(cmd.action == LFUN_PARAGRAPH_DOWN_SELECT);
|
2006-10-21 12:01:14 +00:00
|
|
|
|
needsUpdate |= cursorDownParagraph(cur);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_SCREEN_UP_SELECT:
|
2007-09-15 12:28:41 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(true);
|
2007-05-29 20:53:32 +00:00
|
|
|
|
if (cur.pit() == 0 && cur.textRow().pos() == 0)
|
2006-07-13 07:43:48 +00:00
|
|
|
|
cur.undispatched();
|
2007-05-29 20:53:32 +00:00
|
|
|
|
else {
|
2007-09-02 09:44:08 +00:00
|
|
|
|
tm.cursorPrevious(cur);
|
2006-07-13 07:43:48 +00:00
|
|
|
|
}
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_SCREEN_DOWN_SELECT:
|
2007-09-15 12:28:41 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(true);
|
2006-07-13 07:43:48 +00:00
|
|
|
|
if (cur.pit() == cur.lastpit()
|
2007-05-29 20:53:32 +00:00
|
|
|
|
&& cur.textRow().endpos() == cur.lastpos())
|
2006-07-13 07:43:48 +00:00
|
|
|
|
cur.undispatched();
|
2007-05-29 20:53:32 +00:00
|
|
|
|
else {
|
2007-09-02 09:44:08 +00:00
|
|
|
|
tm.cursorNext(cur);
|
2006-07-13 07:43:48 +00:00
|
|
|
|
}
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-07-13 07:43:48 +00:00
|
|
|
|
case LFUN_LINE_BEGIN:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_LINE_BEGIN_SELECT:
|
2006-10-22 11:46:36 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(cmd.action == LFUN_LINE_BEGIN_SELECT);
|
2007-09-02 11:21:33 +00:00
|
|
|
|
needsUpdate |= tm.cursorHome(cur);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-07-13 07:43:48 +00:00
|
|
|
|
case LFUN_LINE_END:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_LINE_END_SELECT:
|
2006-10-22 11:46:36 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(cmd.action == LFUN_LINE_END_SELECT);
|
2007-09-02 11:21:33 +00:00
|
|
|
|
needsUpdate |= tm.cursorEnd(cur);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2007-10-28 20:35:57 +00:00
|
|
|
|
case LFUN_WORD_RIGHT:
|
|
|
|
|
case LFUN_WORD_RIGHT_SELECT:
|
|
|
|
|
//FIXME: for visual cursor mode, really move right
|
|
|
|
|
if (reverseDirectionNeeded(cur)) {
|
2007-11-15 18:01:04 +00:00
|
|
|
|
cmd.action = cmd.action == LFUN_WORD_RIGHT_SELECT ?
|
|
|
|
|
LFUN_WORD_BACKWARD_SELECT : LFUN_WORD_BACKWARD;
|
2007-10-28 20:35:57 +00:00
|
|
|
|
} else {
|
2007-11-15 18:01:04 +00:00
|
|
|
|
cmd.action = cmd.action == LFUN_WORD_RIGHT_SELECT ?
|
|
|
|
|
LFUN_WORD_FORWARD_SELECT : LFUN_WORD_FORWARD;
|
2007-10-28 20:35:57 +00:00
|
|
|
|
}
|
2007-11-15 18:01:04 +00:00
|
|
|
|
dispatch(cur, cmd);
|
|
|
|
|
return;
|
2007-10-28 20:35:57 +00:00
|
|
|
|
|
2006-07-13 07:43:48 +00:00
|
|
|
|
case LFUN_WORD_FORWARD:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_WORD_FORWARD_SELECT:
|
2006-10-22 11:46:36 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(cmd.action == LFUN_WORD_FORWARD_SELECT);
|
2007-10-28 20:35:57 +00:00
|
|
|
|
needsUpdate |= cursorForwardOneWord(cur);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_WORD_LEFT:
|
|
|
|
|
case LFUN_WORD_LEFT_SELECT:
|
|
|
|
|
//FIXME: for visual cursor mode, really move left
|
|
|
|
|
if (reverseDirectionNeeded(cur)) {
|
2007-11-15 18:01:04 +00:00
|
|
|
|
cmd.action = cmd.action == LFUN_WORD_LEFT_SELECT ?
|
|
|
|
|
LFUN_WORD_FORWARD_SELECT : LFUN_WORD_FORWARD;
|
2007-10-28 20:35:57 +00:00
|
|
|
|
} else {
|
2007-11-15 18:01:04 +00:00
|
|
|
|
cmd.action = cmd.action == LFUN_WORD_LEFT_SELECT ?
|
|
|
|
|
LFUN_WORD_BACKWARD_SELECT : LFUN_WORD_BACKWARD;
|
2007-10-28 20:35:57 +00:00
|
|
|
|
}
|
2007-11-15 18:01:04 +00:00
|
|
|
|
dispatch(cur, cmd);
|
|
|
|
|
return;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-07-13 07:43:48 +00:00
|
|
|
|
case LFUN_WORD_BACKWARD:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_WORD_BACKWARD_SELECT:
|
2006-10-22 11:46:36 +00:00
|
|
|
|
needsUpdate |= cur.selHandle(cmd.action == LFUN_WORD_BACKWARD_SELECT);
|
2007-10-28 20:35:57 +00:00
|
|
|
|
needsUpdate |= cursorBackwardOneWord(cur);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_WORD_SELECT: {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
selectWord(cur, WHOLE_WORD);
|
2004-02-06 13:59:26 +00:00
|
|
|
|
finishChange(cur, true);
|
2002-09-11 14:48:19 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-25 18:34:37 +00:00
|
|
|
|
case LFUN_NEW_LINE: {
|
2003-03-12 19:16:42 +00:00
|
|
|
|
// Not allowed by LaTeX (labels or empty par)
|
2004-02-13 07:30:59 +00:00
|
|
|
|
if (cur.pos() > cur.paragraph().beginOfBody()) {
|
2007-04-10 11:25:02 +00:00
|
|
|
|
// this avoids a double undo
|
|
|
|
|
// FIXME: should not be needed, ideally
|
2007-01-17 15:40:55 +00:00
|
|
|
|
if (!cur.selection())
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.recordUndo();
|
2006-10-21 00:16:43 +00:00
|
|
|
|
cap::replaceSelection(cur);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
cur.insert(new InsetNewline);
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2004-02-06 16:50:29 +00:00
|
|
|
|
moveCursor(cur, false);
|
|
|
|
|
}
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2003-03-12 19:16:42 +00:00
|
|
|
|
}
|
2007-11-25 18:34:37 +00:00
|
|
|
|
|
|
|
|
|
case LFUN_LINE_BREAK: {
|
|
|
|
|
// Not allowed by LaTeX (labels or empty par)
|
|
|
|
|
if (cur.pos() > cur.paragraph().beginOfBody()) {
|
|
|
|
|
// this avoids a double undo
|
|
|
|
|
// FIXME: should not be needed, ideally
|
|
|
|
|
if (!cur.selection())
|
|
|
|
|
cur.recordUndo();
|
|
|
|
|
cap::replaceSelection(cur);
|
|
|
|
|
cur.insert(new InsetLinebreak);
|
|
|
|
|
cur.posForward();
|
|
|
|
|
moveCursor(cur, false);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-08-20 15:26:52 +00:00
|
|
|
|
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_CHAR_DELETE_FORWARD:
|
2004-01-20 14:25:24 +00:00
|
|
|
|
if (!cur.selection()) {
|
2006-03-10 16:10:35 +00:00
|
|
|
|
if (cur.pos() == cur.paragraph().size())
|
|
|
|
|
// Par boundary, force full-screen update
|
|
|
|
|
singleParUpdate = false;
|
2006-10-21 12:01:14 +00:00
|
|
|
|
needsUpdate |= erase(cur);
|
2004-01-20 14:25:24 +00:00
|
|
|
|
cur.resetAnchor();
|
2002-08-20 15:26:52 +00:00
|
|
|
|
// It is possible to make it a lot faster still
|
|
|
|
|
// just comment out the line below...
|
|
|
|
|
} else {
|
2004-02-13 11:05:29 +00:00
|
|
|
|
cutSelection(cur, true, false);
|
2006-03-10 16:10:35 +00:00
|
|
|
|
singleParUpdate = false;
|
2002-08-20 15:26:52 +00:00
|
|
|
|
}
|
2004-01-20 14:25:24 +00:00
|
|
|
|
moveCursor(cur, false);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_DELETE_FORWARD_SKIP:
|
|
|
|
|
// Reverse the effect of LFUN_BREAK_PARAGRAPH_SKIP.
|
2004-01-20 14:25:24 +00:00
|
|
|
|
if (!cur.selection()) {
|
2004-02-12 16:36:01 +00:00
|
|
|
|
if (cur.pos() == cur.lastpos()) {
|
2007-10-22 22:18:52 +00:00
|
|
|
|
cursorForward(cur);
|
|
|
|
|
cursorBackward(cur);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
}
|
2006-04-09 00:26:19 +00:00
|
|
|
|
erase(cur);
|
2004-02-12 16:36:01 +00:00
|
|
|
|
cur.resetAnchor();
|
2002-08-26 13:25:49 +00:00
|
|
|
|
} else {
|
2004-02-13 11:05:29 +00:00
|
|
|
|
cutSelection(cur, true, false);
|
2002-08-26 13:25:49 +00:00
|
|
|
|
}
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_CHAR_DELETE_BACKWARD:
|
2004-01-20 14:25:24 +00:00
|
|
|
|
if (!cur.selection()) {
|
2006-09-17 10:03:00 +00:00
|
|
|
|
if (bv->getIntl().getTransManager().backspace()) {
|
2006-03-10 16:10:35 +00:00
|
|
|
|
// Par boundary, full-screen update
|
|
|
|
|
if (cur.pos() == 0)
|
|
|
|
|
singleParUpdate = false;
|
2006-10-21 12:01:14 +00:00
|
|
|
|
needsUpdate |= backspace(cur);
|
2004-01-20 14:25:24 +00:00
|
|
|
|
cur.resetAnchor();
|
2002-08-20 15:26:52 +00:00
|
|
|
|
// It is possible to make it a lot faster still
|
|
|
|
|
// just comment out the line below...
|
|
|
|
|
}
|
2002-08-26 13:25:49 +00:00
|
|
|
|
} else {
|
2004-02-13 11:05:29 +00:00
|
|
|
|
cutSelection(cur, true, false);
|
2006-03-10 16:10:35 +00:00
|
|
|
|
singleParUpdate = false;
|
2002-08-26 13:25:49 +00:00
|
|
|
|
}
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_DELETE_BACKWARD_SKIP:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
// Reverse the effect of LFUN_BREAK_PARAGRAPH_SKIP.
|
2004-01-20 14:25:24 +00:00
|
|
|
|
if (!cur.selection()) {
|
2007-08-10 11:47:12 +00:00
|
|
|
|
// FIXME: look here
|
2004-02-02 16:38:13 +00:00
|
|
|
|
//CursorSlice cur = cursor();
|
2004-02-12 16:36:01 +00:00
|
|
|
|
backspace(cur);
|
2004-02-02 16:38:13 +00:00
|
|
|
|
//anchor() = cur;
|
2002-08-26 13:25:49 +00:00
|
|
|
|
} else {
|
2004-02-13 11:05:29 +00:00
|
|
|
|
cutSelection(cur, true, false);
|
2002-08-26 13:25:49 +00:00
|
|
|
|
}
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_BREAK_PARAGRAPH:
|
2006-10-21 00:16:43 +00:00
|
|
|
|
cap::replaceSelection(cur);
|
2007-10-08 13:17:15 +00:00
|
|
|
|
breakParagraph(cur, cmd.argument() == "inverse");
|
2004-01-20 14:25:24 +00:00
|
|
|
|
cur.resetAnchor();
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_BREAK_PARAGRAPH_SKIP: {
|
2002-08-20 15:26:52 +00:00
|
|
|
|
// When at the beginning of a paragraph, remove
|
2006-05-05 20:23:12 +00:00
|
|
|
|
// indentation. Otherwise, do the same as LFUN_BREAK_PARAGRAPH.
|
2006-10-21 00:16:43 +00:00
|
|
|
|
cap::replaceSelection(cur);
|
2004-03-25 09:16:36 +00:00
|
|
|
|
if (cur.pos() == 0)
|
2006-10-20 19:26:23 +00:00
|
|
|
|
cur.paragraph().params().labelWidthString(docstring());
|
2004-03-25 09:16:36 +00:00
|
|
|
|
else
|
2007-09-14 08:00:12 +00:00
|
|
|
|
breakParagraph(cur, false);
|
2004-03-25 09:16:36 +00:00
|
|
|
|
cur.resetAnchor();
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
Add LFUN_PARAGRAPH_PARAMS (= paragraph-params), used for changing a paragraph's alignment, spacing, etc. This is complementary to LFUN_PARAGRAPH_PARAMS_APPLY, which sets the parameters. The difference is that APPLY over-rides all existing parameters, setting any not given to the default, whereas this one simply changes those that are given. So
paragraph-params \align right
will align the paragraph right, leaving spacing, etc, as they were, whereas
paragraph-params-apply \align right
will align the paragraph right but also reset all other parameters to defaults. Note, by the way, that this means that
paragraph-params-apply
sets everything to default.
Some new arguments have also been introduced. These are:
\indent
\indent-toggle
\spacing default
Of course, none of these are found in valid LyX files, but they are useful in menu bindings, etc.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19581 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-15 02:21:09 +00:00
|
|
|
|
// TODO
|
|
|
|
|
// With the creation of LFUN_PARAGRAPH_PARAMS, this is now redundant,
|
|
|
|
|
// as its duties can be performed there. Should it be removed??
|
|
|
|
|
// FIXME For now, it can just dispatch LFUN_PARAGRAPH_PARAMS...
|
2002-08-20 15:26:52 +00:00
|
|
|
|
case LFUN_PARAGRAPH_SPACING: {
|
2004-02-12 16:36:01 +00:00
|
|
|
|
Paragraph & par = cur.paragraph();
|
|
|
|
|
Spacing::Space cur_spacing = par.params().spacing().getSpace();
|
2005-01-06 13:48:13 +00:00
|
|
|
|
string cur_value = "1.0";
|
2002-08-20 15:26:52 +00:00
|
|
|
|
if (cur_spacing == Spacing::Other)
|
2005-01-06 13:48:13 +00:00
|
|
|
|
cur_value = par.params().spacing().getValueAsString();
|
2002-08-20 15:26:52 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
istringstream is(to_utf8(cmd.argument()));
|
2002-08-20 15:26:52 +00:00
|
|
|
|
string tmp;
|
|
|
|
|
is >> tmp;
|
|
|
|
|
Spacing::Space new_spacing = cur_spacing;
|
2005-01-06 13:48:13 +00:00
|
|
|
|
string new_value = cur_value;
|
2002-08-20 15:26:52 +00:00
|
|
|
|
if (tmp.empty()) {
|
|
|
|
|
lyxerr << "Missing argument to `paragraph-spacing'"
|
|
|
|
|
<< endl;
|
|
|
|
|
} else if (tmp == "single") {
|
|
|
|
|
new_spacing = Spacing::Single;
|
|
|
|
|
} else if (tmp == "onehalf") {
|
|
|
|
|
new_spacing = Spacing::Onehalf;
|
|
|
|
|
} else if (tmp == "double") {
|
|
|
|
|
new_spacing = Spacing::Double;
|
|
|
|
|
} else if (tmp == "other") {
|
|
|
|
|
new_spacing = Spacing::Other;
|
2005-01-06 13:48:13 +00:00
|
|
|
|
string tmpval = "0.0";
|
2002-08-20 15:26:52 +00:00
|
|
|
|
is >> tmpval;
|
|
|
|
|
lyxerr << "new_value = " << tmpval << endl;
|
2005-01-06 13:48:13 +00:00
|
|
|
|
if (tmpval != "0.0")
|
2002-08-20 15:26:52 +00:00
|
|
|
|
new_value = tmpval;
|
|
|
|
|
} else if (tmp == "default") {
|
|
|
|
|
new_spacing = Spacing::Default;
|
|
|
|
|
} else {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
lyxerr << to_utf8(_("Unknown spacing argument: "))
|
|
|
|
|
<< to_utf8(cmd.argument()) << endl;
|
2002-08-20 15:26:52 +00:00
|
|
|
|
}
|
2005-01-06 15:40:49 +00:00
|
|
|
|
if (cur_spacing != new_spacing || cur_value != new_value)
|
2004-02-12 16:36:01 +00:00
|
|
|
|
par.params().spacing(Spacing(new_spacing, new_value));
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-13 20:16:34 +00:00
|
|
|
|
case LFUN_INSET_INSERT: {
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.recordUndo();
|
2007-11-03 17:37:37 +00:00
|
|
|
|
Inset * inset = createInset(bv->buffer(), cmd);
|
2004-08-12 19:49:25 +00:00
|
|
|
|
if (inset) {
|
2007-02-02 10:31:22 +00:00
|
|
|
|
// FIXME (Abdel 01/02/2006):
|
|
|
|
|
// What follows would be a partial fix for bug 2154:
|
2007-02-01 17:21:05 +00:00
|
|
|
|
// http://bugzilla.lyx.org/show_bug.cgi?id=2154
|
2007-05-28 22:27:45 +00:00
|
|
|
|
// This automatically put the label inset _after_ a
|
2007-02-02 10:31:22 +00:00
|
|
|
|
// numbered section. It should be possible to extend the mechanism
|
2007-02-01 17:21:05 +00:00
|
|
|
|
// to any kind of LateX environement.
|
2007-02-02 10:31:22 +00:00
|
|
|
|
// The correct way to fix that bug would be at LateX generation.
|
|
|
|
|
// I'll let the code here for reference as it could be used for some
|
|
|
|
|
// other feature like "automatic labelling".
|
|
|
|
|
/*
|
|
|
|
|
Paragraph & par = pars_[cur.pit()];
|
2007-10-13 09:04:52 +00:00
|
|
|
|
if (inset->lyxCode() == LABEL_CODE
|
2007-02-01 17:21:05 +00:00
|
|
|
|
&& par.layout()->labeltype == LABEL_COUNTER) {
|
|
|
|
|
// Go to the end of the paragraph
|
|
|
|
|
// Warning: Because of Change-Tracking, the last
|
|
|
|
|
// position is 'size()' and not 'size()-1':
|
|
|
|
|
cur.pos() = par.size();
|
|
|
|
|
// Insert a new paragraph
|
2007-02-01 17:36:56 +00:00
|
|
|
|
FuncRequest fr(LFUN_BREAK_PARAGRAPH);
|
|
|
|
|
dispatch(cur, fr);
|
2007-02-01 17:21:05 +00:00
|
|
|
|
}
|
2007-02-02 10:31:22 +00:00
|
|
|
|
*/
|
2007-07-30 10:33:43 +00:00
|
|
|
|
if (cur.selection())
|
|
|
|
|
cutSelection(cur, true, false);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
insertInset(cur, inset);
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2004-08-12 19:49:25 +00:00
|
|
|
|
}
|
2003-11-13 20:16:34 +00:00
|
|
|
|
break;
|
2003-12-12 10:05:21 +00:00
|
|
|
|
}
|
2003-11-13 20:16:34 +00:00
|
|
|
|
|
2006-09-08 14:08:26 +00:00
|
|
|
|
case LFUN_INSET_DISSOLVE:
|
2006-10-21 12:01:14 +00:00
|
|
|
|
needsUpdate |= dissolveInset(cur);
|
2006-08-08 13:34:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2003-04-26 19:01:33 +00:00
|
|
|
|
case LFUN_INSET_SETTINGS:
|
2005-07-15 22:10:25 +00:00
|
|
|
|
cur.inset().showInsetDialog(bv);
|
2003-04-26 19:01:33 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2003-05-22 10:40:57 +00:00
|
|
|
|
case LFUN_SPACE_INSERT:
|
2004-02-13 07:30:59 +00:00
|
|
|
|
if (cur.paragraph().layout()->free_spacing)
|
|
|
|
|
insertChar(cur, ' ');
|
2004-11-02 14:25:14 +00:00
|
|
|
|
else {
|
2004-02-13 11:05:29 +00:00
|
|
|
|
doInsertInset(cur, this, cmd, false, false);
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2004-11-02 14:25:14 +00:00
|
|
|
|
}
|
2004-01-20 14:25:24 +00:00
|
|
|
|
moveCursor(cur, false);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2007-12-06 11:04:56 +00:00
|
|
|
|
case LFUN_SPECIALCHAR_INSERT: {
|
|
|
|
|
string const name = to_utf8(cmd.argument());
|
|
|
|
|
if (name == "hyphenation")
|
|
|
|
|
specialChar(cur, InsetSpecialChar::HYPHENATION);
|
|
|
|
|
else if (name == "ligature-break")
|
|
|
|
|
specialChar(cur, InsetSpecialChar::LIGATURE_BREAK);
|
|
|
|
|
else if (name == "slash")
|
|
|
|
|
specialChar(cur, InsetSpecialChar::SLASH);
|
|
|
|
|
else if (name == "nobreakdash")
|
|
|
|
|
specialChar(cur, InsetSpecialChar::NOBREAKDASH);
|
|
|
|
|
else if (name == "dots")
|
|
|
|
|
specialChar(cur, InsetSpecialChar::LDOTS);
|
|
|
|
|
else if (name == "end-of-sentence")
|
|
|
|
|
specialChar(cur, InsetSpecialChar::END_OF_SENTENCE);
|
|
|
|
|
else if (name == "menu-separator")
|
|
|
|
|
specialChar(cur, InsetSpecialChar::MENU_SEPARATOR);
|
|
|
|
|
else if (name.empty())
|
|
|
|
|
lyxerr << "LyX function 'specialchar-insert' needs an argument." << endl;
|
|
|
|
|
else
|
|
|
|
|
lyxerr << "Wrong argument for LyX function 'specialchar-insert'." << endl;
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2007-12-06 11:04:56 +00:00
|
|
|
|
}
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_WORD_UPCASE:
|
2007-10-24 08:40:38 +00:00
|
|
|
|
changeCase(cur, text_uppercase);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_WORD_LOWCASE:
|
2007-10-24 08:40:38 +00:00
|
|
|
|
changeCase(cur, text_lowercase);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_WORD_CAPITALIZE:
|
2007-10-24 08:40:38 +00:00
|
|
|
|
changeCase(cur, text_capitalization);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_CHARS_TRANSPOSE:
|
2007-05-28 22:27:45 +00:00
|
|
|
|
charsTranspose(cur);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2003-10-10 09:01:23 +00:00
|
|
|
|
case LFUN_PASTE:
|
2006-09-11 08:54:10 +00:00
|
|
|
|
cur.message(_("Paste"));
|
2006-10-21 00:16:43 +00:00
|
|
|
|
cap::replaceSelection(cur);
|
2007-01-04 12:05:24 +00:00
|
|
|
|
if (cmd.argument().empty() && !theClipboard().isInternal())
|
2007-08-21 13:03:55 +00:00
|
|
|
|
pasteClipboard(cur, bv->buffer().errorList("Paste"));
|
2007-01-04 12:05:24 +00:00
|
|
|
|
else {
|
|
|
|
|
string const arg(to_utf8(cmd.argument()));
|
2007-08-21 13:03:55 +00:00
|
|
|
|
pasteFromStack(cur, bv->buffer().errorList("Paste"),
|
2007-01-04 12:05:24 +00:00
|
|
|
|
isStrUnsignedInt(arg) ?
|
|
|
|
|
convert<unsigned int>(arg) :
|
|
|
|
|
0);
|
|
|
|
|
}
|
2007-08-21 13:03:55 +00:00
|
|
|
|
bv->buffer().errors("Paste");
|
2004-01-20 14:25:24 +00:00
|
|
|
|
cur.clearSelection(); // bug 393
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.finishUndo();
|
2002-08-26 13:25:49 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_CUT:
|
2004-02-13 11:05:29 +00:00
|
|
|
|
cutSelection(cur, true, true);
|
2006-09-11 08:54:10 +00:00
|
|
|
|
cur.message(_("Cut"));
|
2002-08-26 13:25:49 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_COPY:
|
2004-02-13 11:05:29 +00:00
|
|
|
|
copySelection(cur);
|
2006-09-11 08:54:10 +00:00
|
|
|
|
cur.message(_("Copy"));
|
2002-08-26 13:25:49 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_SERVER_GET_XY:
|
2006-10-21 00:16:43 +00:00
|
|
|
|
cur.message(from_utf8(
|
2007-09-02 09:44:08 +00:00
|
|
|
|
convert<string>(tm.cursorX(cur.top(), cur.boundary()))
|
|
|
|
|
+ ' ' + convert<string>(tm.cursorY(cur.top(), cur.boundary()))));
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_SERVER_SET_XY: {
|
2002-08-20 13:00:25 +00:00
|
|
|
|
int x = 0;
|
|
|
|
|
int y = 0;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
istringstream is(to_utf8(cmd.argument()));
|
2002-08-21 06:50:42 +00:00
|
|
|
|
is >> x >> y;
|
|
|
|
|
if (!is)
|
2002-08-20 13:00:25 +00:00
|
|
|
|
lyxerr << "SETXY: Could not parse coordinates in '"
|
2007-12-12 19:28:07 +00:00
|
|
|
|
<< to_utf8(cmd.argument()) << endl;
|
2002-11-27 10:30:28 +00:00
|
|
|
|
else
|
2007-09-02 09:44:08 +00:00
|
|
|
|
tm.setCursorFromCoordinates(cur, x, y);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_SERVER_GET_FONT:
|
2007-10-28 18:51:54 +00:00
|
|
|
|
if (cur.current_font.fontInfo().shape() == ITALIC_SHAPE)
|
2006-10-21 00:16:43 +00:00
|
|
|
|
cur.message(from_ascii("E"));
|
2007-10-28 18:51:54 +00:00
|
|
|
|
else if (cur.current_font.fontInfo().shape() == SMALLCAPS_SHAPE)
|
2006-10-21 00:16:43 +00:00
|
|
|
|
cur.message(from_ascii("N"));
|
2002-08-20 13:00:25 +00:00
|
|
|
|
else
|
2006-10-21 00:16:43 +00:00
|
|
|
|
cur.message(from_ascii("0"));
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_SERVER_GET_LAYOUT:
|
2007-07-11 13:39:08 +00:00
|
|
|
|
cur.message(cur.paragraph().layout()->name());
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_LAYOUT: {
|
2007-07-11 13:39:08 +00:00
|
|
|
|
docstring layout = cmd.argument();
|
2007-11-15 20:04:51 +00:00
|
|
|
|
LYXERR(Debug::INFO, "LFUN_LAYOUT: (arg) " << to_utf8(layout));
|
2002-08-20 15:26:52 +00:00
|
|
|
|
|
2007-10-01 20:45:50 +00:00
|
|
|
|
docstring const old_layout = cur.paragraph().layout()->name();
|
|
|
|
|
|
2002-08-20 15:26:52 +00:00
|
|
|
|
// Derive layout number from given argument (string)
|
|
|
|
|
// and current buffer's textclass (number)
|
2007-08-21 13:03:55 +00:00
|
|
|
|
TextClass const & tclass = bv->buffer().params().getTextClass();
|
2006-11-16 08:17:48 +00:00
|
|
|
|
if (layout.empty())
|
|
|
|
|
layout = tclass.defaultLayoutName();
|
|
|
|
|
bool hasLayout = tclass.hasLayout(layout);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
|
|
|
|
|
// If the entry is obsolete, use the new one instead.
|
|
|
|
|
if (hasLayout) {
|
2007-07-11 13:39:08 +00:00
|
|
|
|
docstring const & obs = tclass[layout]->obsoleted_by();
|
2002-08-20 15:26:52 +00:00
|
|
|
|
if (!obs.empty())
|
|
|
|
|
layout = obs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!hasLayout) {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
cur.errorMessage(from_utf8(N_("Layout ")) + cmd.argument() +
|
|
|
|
|
from_utf8(N_(" not known")));
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-01 20:45:50 +00:00
|
|
|
|
bool change_layout = (old_layout != layout);
|
2003-05-19 07:12:09 +00:00
|
|
|
|
|
2004-01-20 14:25:24 +00:00
|
|
|
|
if (!change_layout && cur.selection() &&
|
2004-11-24 21:53:46 +00:00
|
|
|
|
cur.selBegin().pit() != cur.selEnd().pit())
|
2002-08-20 15:26:52 +00:00
|
|
|
|
{
|
2004-11-24 21:53:46 +00:00
|
|
|
|
pit_type spit = cur.selBegin().pit();
|
|
|
|
|
pit_type epit = cur.selEnd().pit() + 1;
|
2003-04-09 09:15:20 +00:00
|
|
|
|
while (spit != epit) {
|
2007-10-01 20:45:50 +00:00
|
|
|
|
if (pars_[spit].layout()->name() != old_layout) {
|
2002-08-20 15:26:52 +00:00
|
|
|
|
change_layout = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2003-04-09 09:15:20 +00:00
|
|
|
|
++spit;
|
2002-08-20 15:26:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-05-19 07:12:09 +00:00
|
|
|
|
|
2007-10-01 20:45:50 +00:00
|
|
|
|
if (change_layout)
|
2004-02-13 07:30:59 +00:00
|
|
|
|
setLayout(cur, layout);
|
2007-10-01 20:45:50 +00:00
|
|
|
|
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-03 07:30:50 +00:00
|
|
|
|
case LFUN_CLIPBOARD_PASTE:
|
2007-01-13 18:29:50 +00:00
|
|
|
|
cur.clearSelection();
|
2007-08-21 13:03:55 +00:00
|
|
|
|
pasteClipboard(cur, bv->buffer().errorList("Paste"),
|
2007-05-28 22:27:45 +00:00
|
|
|
|
cmd.argument() == "paragraph");
|
2007-08-21 13:03:55 +00:00
|
|
|
|
bv->buffer().errors("Paste");
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2007-01-03 07:30:50 +00:00
|
|
|
|
case LFUN_PRIMARY_SELECTION_PASTE:
|
2007-01-06 15:33:07 +00:00
|
|
|
|
pasteString(cur, theSelection().get(),
|
2007-05-28 22:27:45 +00:00
|
|
|
|
cmd.argument() == "paragraph");
|
Split clipboard and X selection
* src/LyXAction.C
(LyXAction::init): handle new LFUN_CLIPBOARD_PASTE
* src/insets/insettabular.C
(InsetTabular::doDispatch): ditto
* src/insets/insetbox.C
(InsetBox::doDispatch): ditto
* src/insets/insetert.C
(InsetERT::doDispatch): ditto
(InsetERT::getStatus): ditto
* src/insets/insetcharstyle.C
(InsetCharStyle::doDispatch): ditto
* src/BufferView_pimpl.C
(BufferView::Pimpl::selectionRequest): stuff selection, not clipboard
* src/mathed/math_nestinset.C
(MathNestInset::lfunMousePress): get stuff selection, not clipboard
(MathNestInset::lfunMouseRelease): clipboard -> selection in
commented code
* src/CutAndPaste.C
(cutSelection): ditto
* src/frontends/{qt3,gtk}/GuiImplementation.C
(GuiImplementation::newWorkArea): create new selection, not clipboard,
since the clipboard is now an object
(GuiImplementation::destroyWorkArea): destroy selection, not clipboard
* src/frontends/{qt4,qt3,gtk}/GuiSelection.h: new, copied from
GuiClipboard.h
* src/frontends/{qt4,qt3,gtk}/GuiSelection.C: new, copied from
GuiClipboard.C
* src/frontends/{qt3,gtk}/GuiImplementation.h
(selection): new accessor for selection_
(selection_): new, the global selection object
* src/frontends/{qt4,qt3,gtk}/Makefile.am: add GuiSelection.C and
GuiSelection.h
* src/frontends/{qt4,qt3,gtk}/GuiClipboard.C
(GuiClipboard::get): return clipboard, not selection
(GuiClipboard::put): stuff clipboard, not selection
* src/frontends/{qt4,qt3,gtk}/GuiClipboard.h
(haveSelection): remove (this is now in GuiSelection)
* src/frontends/{qt3,gtk}/GuiClipboard.h
(old_work_area_): remove, since it is not needed anymore
* src/frontends/gtk/ghelpers.C
(getGTKStockIcon): handle LFUN_CLIPBOARD_PASTE
* src/frontends/Clipboard.h
(haveSelection): remove (this is now in Selection)
* src/frontends/qt4/GuiImplementation.[Ch]
(GuiImplementation::selection): new accessor for selection_
* src/frontends/Gui.h
(selection): New accessor for the global selection object
* src/frontends/Selection.h; new, copied from Clipboard.h
* src/frontends/Makefile.am: add Selection.h
* src/text3.C
(various): s/clipboard().haveSelection/selection().haveSelection/
(LyXText::dispatch): handle LFUN_CLIPBOARD_PASTE
(LyXText::getStatus): ditto
* src/lfuns.h: new lfun LFUN_CLIPBOARD_PASTE
* lib/ui/stdmenus.ui: add new lfun LFUN_CLIPBOARD_PASTE
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14408 a592a061-630c-0410-9148-cb99ea01b6c8
2006-07-10 11:32:25 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-10-22 18:47:19 +00:00
|
|
|
|
case LFUN_UNICODE_INSERT: {
|
|
|
|
|
if (cmd.argument().empty())
|
|
|
|
|
break;
|
|
|
|
|
docstring hexstring = cmd.argument();
|
2007-12-12 19:57:42 +00:00
|
|
|
|
if (isHex(hexstring)) {
|
|
|
|
|
char_type c = hexToInt(hexstring);
|
2007-06-22 16:27:37 +00:00
|
|
|
|
if (c >= 32 && c < 0x10ffff) {
|
2006-10-22 18:47:19 +00:00
|
|
|
|
lyxerr << "Inserting c: " << c << endl;
|
|
|
|
|
docstring s = docstring(1, c);
|
|
|
|
|
lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, s));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-05-28 22:27:45 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_QUOTE_INSERT: {
|
2004-02-13 07:30:59 +00:00
|
|
|
|
Paragraph & par = cur.paragraph();
|
2006-10-21 00:16:43 +00:00
|
|
|
|
pos_type pos = cur.pos();
|
2007-08-21 13:03:55 +00:00
|
|
|
|
BufferParams const & bufparams = bv->buffer().params();
|
2007-08-23 19:59:07 +00:00
|
|
|
|
LayoutPtr const & style = par.layout();
|
2004-02-20 10:32:44 +00:00
|
|
|
|
if (!style->pass_thru
|
|
|
|
|
&& par.getFontSettings(bufparams, pos).language()->lang() != "hebrew") {
|
2007-04-10 11:25:02 +00:00
|
|
|
|
// this avoids a double undo
|
|
|
|
|
// FIXME: should not be needed, ideally
|
|
|
|
|
if (!cur.selection())
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.recordUndo();
|
2007-04-10 11:25:02 +00:00
|
|
|
|
cap::replaceSelection(cur);
|
|
|
|
|
pos = cur.pos();
|
|
|
|
|
char_type c;
|
|
|
|
|
if (pos == 0)
|
|
|
|
|
c = ' ';
|
|
|
|
|
else if (cur.prevInset() && cur.prevInset()->isSpace())
|
|
|
|
|
c = ' ';
|
|
|
|
|
else
|
|
|
|
|
c = par.getChar(pos - 1);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
string arg = to_utf8(cmd.argument());
|
2004-02-20 10:32:44 +00:00
|
|
|
|
if (arg == "single")
|
|
|
|
|
cur.insert(new InsetQuotes(c,
|
2004-04-03 08:37:12 +00:00
|
|
|
|
bufparams.quotes_language,
|
2004-02-20 10:32:44 +00:00
|
|
|
|
InsetQuotes::SingleQ));
|
2005-10-13 10:59:39 +00:00
|
|
|
|
else
|
2004-02-20 10:32:44 +00:00
|
|
|
|
cur.insert(new InsetQuotes(c,
|
2004-04-03 08:37:12 +00:00
|
|
|
|
bufparams.quotes_language,
|
2004-02-20 10:32:44 +00:00
|
|
|
|
InsetQuotes::DoubleQ));
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2004-03-18 12:53:43 +00:00
|
|
|
|
}
|
2004-02-04 09:44:12 +00:00
|
|
|
|
else
|
2006-10-11 17:24:46 +00:00
|
|
|
|
lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, "\""));
|
2002-08-27 13:17:22 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-11 22:37:09 +00:00
|
|
|
|
case LFUN_DATE_INSERT: {
|
|
|
|
|
string const format = cmd.argument().empty()
|
|
|
|
|
? lyxrc.date_insert_format : to_utf8(cmd.argument());
|
|
|
|
|
string const time = formatted_time(current_time(), format);
|
|
|
|
|
lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, time));
|
2002-08-27 13:39:27 +00:00
|
|
|
|
break;
|
2007-08-11 22:37:09 +00:00
|
|
|
|
}
|
2002-08-27 13:39:27 +00:00
|
|
|
|
|
2002-08-28 10:45:38 +00:00
|
|
|
|
case LFUN_MOUSE_TRIPLE:
|
2004-02-06 16:50:29 +00:00
|
|
|
|
if (cmd.button() == mouse_button::button1) {
|
2007-09-02 11:21:33 +00:00
|
|
|
|
tm.cursorHome(cur);
|
2004-01-20 14:25:24 +00:00
|
|
|
|
cur.resetAnchor();
|
2007-09-02 11:21:33 +00:00
|
|
|
|
tm.cursorEnd(cur);
|
2004-01-20 14:25:24 +00:00
|
|
|
|
cur.setSelection();
|
2005-04-20 10:47:15 +00:00
|
|
|
|
bv->cursor() = cur;
|
2002-08-28 10:45:38 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_MOUSE_DOUBLE:
|
2004-02-06 16:50:29 +00:00
|
|
|
|
if (cmd.button() == mouse_button::button1) {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
selectWord(cur, WHOLE_WORD_STRICT);
|
2005-04-20 10:47:15 +00:00
|
|
|
|
bv->cursor() = cur;
|
2002-08-28 10:45:38 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// Single-click on work area
|
2003-11-06 16:43:12 +00:00
|
|
|
|
case LFUN_MOUSE_PRESS: {
|
2004-02-06 16:50:29 +00:00
|
|
|
|
// Right click on a footnote flag opens float menu
|
2007-10-11 14:46:53 +00:00
|
|
|
|
// FIXME: Why should we clear the selection in this case?
|
2006-04-15 15:10:03 +00:00
|
|
|
|
if (cmd.button() == mouse_button::button3)
|
2004-02-06 16:50:29 +00:00
|
|
|
|
cur.clearSelection();
|
|
|
|
|
|
2007-10-11 14:46:53 +00:00
|
|
|
|
bool do_selection = cmd.button() == mouse_button::button1
|
|
|
|
|
&& cmd.argument() == "region-select";
|
2007-07-31 13:34:09 +00:00
|
|
|
|
// Set the cursor
|
2007-10-11 14:46:53 +00:00
|
|
|
|
bool update = bv->mouseSetCursor(cur, do_selection);
|
2002-08-28 10:45:38 +00:00
|
|
|
|
|
|
|
|
|
// Insert primary selection with middle mouse
|
|
|
|
|
// if there is a local selection in the current buffer,
|
|
|
|
|
// insert this
|
|
|
|
|
if (cmd.button() == mouse_button::button2) {
|
2007-07-31 13:34:09 +00:00
|
|
|
|
if (cap::selection()) {
|
|
|
|
|
// Copy the selection buffer to the clipboard
|
|
|
|
|
// stack, because we want it to appear in the
|
|
|
|
|
// "Edit->Paste recent" menu.
|
|
|
|
|
cap::copySelectionToStack();
|
|
|
|
|
|
|
|
|
|
cap::pasteSelection(bv->cursor(),
|
2007-08-21 13:03:55 +00:00
|
|
|
|
bv->buffer().errorList("Paste"));
|
|
|
|
|
bv->buffer().errors("Paste");
|
|
|
|
|
bv->buffer().markDirty();
|
2007-10-18 11:51:17 +00:00
|
|
|
|
bv->cursor().finishUndo();
|
2007-06-07 18:13:10 +00:00
|
|
|
|
} else {
|
2006-10-11 17:24:46 +00:00
|
|
|
|
lyx::dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph"));
|
2007-06-07 18:13:10 +00:00
|
|
|
|
}
|
2002-08-28 10:45:38 +00:00
|
|
|
|
}
|
2004-04-07 08:07:26 +00:00
|
|
|
|
|
2007-07-31 13:34:09 +00:00
|
|
|
|
// we have to update after dEPM triggered
|
2006-12-11 13:59:40 +00:00
|
|
|
|
if (!update && cmd.button() == mouse_button::button1) {
|
2006-11-17 17:42:52 +00:00
|
|
|
|
needsUpdate = false;
|
|
|
|
|
cur.noUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-28 10:45:38 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-14 20:34:46 +00:00
|
|
|
|
case LFUN_MOUSE_MOTION: {
|
|
|
|
|
// Only use motion with button 1
|
|
|
|
|
//if (cmd.button() != mouse_button::button1)
|
|
|
|
|
// return false;
|
|
|
|
|
|
|
|
|
|
// ignore motions deeper nested than the real anchor
|
2007-04-26 14:56:30 +00:00
|
|
|
|
Cursor & bvcur = cur.bv().cursor();
|
2007-11-17 18:17:19 +00:00
|
|
|
|
if (!bvcur.anchor_.hasPart(cur)) {
|
|
|
|
|
cur.undispatched();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
CursorSlice old = bvcur.top();
|
|
|
|
|
|
|
|
|
|
int const wh = bv->workHeight();
|
2007-12-12 19:28:07 +00:00
|
|
|
|
int const y = max(0, min(wh - 1, cmd.y));
|
2007-11-17 18:17:19 +00:00
|
|
|
|
|
|
|
|
|
tm.setCursorFromCoordinates(cur, cmd.x, y);
|
|
|
|
|
cur.setTargetX(cmd.x);
|
|
|
|
|
if (cmd.y >= wh)
|
|
|
|
|
lyx::dispatch(FuncRequest(LFUN_DOWN_SELECT));
|
|
|
|
|
else if (cmd.y < 0)
|
|
|
|
|
lyx::dispatch(FuncRequest(LFUN_UP_SELECT));
|
|
|
|
|
// This is to allow jumping over large insets
|
|
|
|
|
if (cur.top() == old) {
|
2004-11-30 01:59:49 +00:00
|
|
|
|
if (cmd.y >= wh)
|
2006-12-20 14:17:50 +00:00
|
|
|
|
lyx::dispatch(FuncRequest(LFUN_DOWN_SELECT));
|
2004-11-30 01:59:49 +00:00
|
|
|
|
else if (cmd.y < 0)
|
2006-12-20 14:17:50 +00:00
|
|
|
|
lyx::dispatch(FuncRequest(LFUN_UP_SELECT));
|
2007-11-17 18:17:19 +00:00
|
|
|
|
}
|
2005-01-06 15:40:49 +00:00
|
|
|
|
|
2007-11-17 18:17:19 +00:00
|
|
|
|
if (cur.top() == old)
|
|
|
|
|
cur.noUpdate();
|
|
|
|
|
else {
|
|
|
|
|
// FIXME: This is brute force! But without it the selected
|
|
|
|
|
// area is not corrected updated while moving the mouse.
|
|
|
|
|
cur.updateFlags(Update::Force | Update::FitCursor);
|
|
|
|
|
// don't set anchor_
|
|
|
|
|
bvcur.setCursor(cur);
|
|
|
|
|
bvcur.selection() = true;
|
|
|
|
|
//lyxerr << "MOTION: " << bv->cursor() << endl;
|
|
|
|
|
}
|
2004-08-14 20:34:46 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-10 09:06:48 +00:00
|
|
|
|
case LFUN_MOUSE_RELEASE: {
|
2002-08-28 10:45:38 +00:00
|
|
|
|
if (cmd.button() == mouse_button::button2)
|
|
|
|
|
break;
|
|
|
|
|
|
2006-11-17 17:42:52 +00:00
|
|
|
|
if (cmd.button() == mouse_button::button1) {
|
2007-02-02 03:10:15 +00:00
|
|
|
|
// if there is new selection, update persistent
|
|
|
|
|
// selection, otherwise, single click does not
|
|
|
|
|
// clear persistent selection buffer
|
|
|
|
|
if (cur.selection()) {
|
|
|
|
|
// finish selection
|
|
|
|
|
// if double click, cur is moved to the end of word by selectWord
|
|
|
|
|
// but bvcur is current mouse position
|
2007-04-26 14:56:30 +00:00
|
|
|
|
Cursor & bvcur = cur.bv().cursor();
|
2007-02-02 03:10:15 +00:00
|
|
|
|
bvcur.selection() = true;
|
|
|
|
|
}
|
2006-11-17 17:42:52 +00:00
|
|
|
|
needsUpdate = false;
|
|
|
|
|
cur.noUpdate();
|
|
|
|
|
}
|
2002-08-28 10:45:38 +00:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_SELF_INSERT: {
|
2006-09-01 15:41:38 +00:00
|
|
|
|
if (cmd.argument().empty())
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
|
|
|
|
// Automatically delete the currently selected
|
|
|
|
|
// text and replace it with what is being
|
|
|
|
|
// typed in now. Depends on lyxrc settings
|
|
|
|
|
// "auto_region_delete", which defaults to
|
|
|
|
|
// true (on).
|
|
|
|
|
|
2007-11-17 11:27:03 +00:00
|
|
|
|
if (lyxrc.auto_region_delete && cur.selection())
|
2007-07-09 10:32:28 +00:00
|
|
|
|
cutSelection(cur, false, false);
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2004-01-20 14:25:24 +00:00
|
|
|
|
cur.clearSelection();
|
2007-09-02 13:35:48 +00:00
|
|
|
|
Font const old_font = cur.real_current_font;
|
2005-04-26 11:12:20 +00:00
|
|
|
|
|
2006-09-01 15:41:38 +00:00
|
|
|
|
docstring::const_iterator cit = cmd.argument().begin();
|
|
|
|
|
docstring::const_iterator end = cmd.argument().end();
|
2002-08-20 13:00:25 +00:00
|
|
|
|
for (; cit != end; ++cit)
|
2007-06-11 22:05:44 +00:00
|
|
|
|
bv->translateAndInsert(*cit, this, cur);
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2004-01-20 14:25:24 +00:00
|
|
|
|
cur.resetAnchor();
|
|
|
|
|
moveCursor(cur, false);
|
2002-08-20 15:26:52 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-10-13 19:06:09 +00:00
|
|
|
|
case LFUN_HYPERLINK_INSERT: {
|
2007-10-19 17:22:55 +00:00
|
|
|
|
InsetCommandParams p(HYPERLINK_CODE);
|
2007-07-30 10:33:43 +00:00
|
|
|
|
docstring content;
|
|
|
|
|
if (cur.selection()) {
|
|
|
|
|
content = cur.selectionAsString(false);
|
|
|
|
|
cutSelection(cur, true, false);
|
|
|
|
|
}
|
|
|
|
|
p["target"] = (cmd.argument().empty()) ?
|
|
|
|
|
content : cmd.argument();
|
2007-10-13 19:06:09 +00:00
|
|
|
|
string const data = InsetCommandMailer::params2string("href", p);
|
2007-07-30 10:33:43 +00:00
|
|
|
|
if (p["target"].empty()) {
|
2007-11-18 00:39:15 +00:00
|
|
|
|
bv->showDialog("href", data);
|
2007-07-30 10:33:43 +00:00
|
|
|
|
} else {
|
|
|
|
|
FuncRequest fr(LFUN_INSET_INSERT, data);
|
|
|
|
|
dispatch(cur, fr);
|
|
|
|
|
}
|
2002-08-29 13:41:58 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_LABEL_INSERT: {
|
2007-10-19 17:22:55 +00:00
|
|
|
|
InsetCommandParams p(LABEL_CODE);
|
2004-04-19 02:39:05 +00:00
|
|
|
|
// Try to generate a valid label
|
Rework InsetCommandParams interface and file storage
* src/insets/insetcommandparams.[Ch]:
(operator[]): New, access a parameter
(clear): New, clear all parameters
(info_): New, stire info about this command
(cmdname): Rename to name_
(contents, options, sec_options): Replace with params_. Parameters
are now stored as docstring.
(findInfo): New factor for command info for all commands
(read, write): Use new syntax
(parameter set and get methods): reimplemenmt for new parameter storage
* src/insets/insetcommand.h
(getParam): New, get a parameter
(setParam): New, set a parameter
(parameter set and get methods): Adjust to InsetCommandParams changes
* src/insets/insetbibitem.[Ch]
(write): Remove, not needed anymore
(directWrite): ditto
* src/insets/insetbibitem.C
(InsetBibitem::read): Use InsetCommand::read
* src/insets/insetref.C
(InsetRef::latex): Use new InsetCommandParams interface
* src/mathed/InsetMathHull.C
(InsetMathHull::doDispatch): ditto
* src/text3.C
(LyXText::dispatch): ditto
* src/factory.C
(createInset): Create InsetCommandParams with command name
(readInset): ditto
(readInset): Remove error message for bibitem, since bibitem is
now a normal command inset
* src/buffer.C: Bump file format number
* src/frontends/controllers/ControlCommand.[Ch]
(ControlCommand): take an additional command name parameter
* src/text.C
(readParToken): Remove code for \bibitem
* lib/lyx2lyx/LyX.py: Bump latest file format number
* lib/lyx2lyx/lyx_1_5.py
(convert_bibitem, convert_commandparams): new, convert to new format
(revert_commandparams): new, convert to old format
* development/FORMAT: document new format
* many other files: Adjust to the changes above
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15357 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-17 21:07:16 +00:00
|
|
|
|
p["name"] = (cmd.argument().empty()) ?
|
2006-11-11 11:27:47 +00:00
|
|
|
|
cur.getPossibleLabel() :
|
Rework InsetCommandParams interface and file storage
* src/insets/insetcommandparams.[Ch]:
(operator[]): New, access a parameter
(clear): New, clear all parameters
(info_): New, stire info about this command
(cmdname): Rename to name_
(contents, options, sec_options): Replace with params_. Parameters
are now stored as docstring.
(findInfo): New factor for command info for all commands
(read, write): Use new syntax
(parameter set and get methods): reimplemenmt for new parameter storage
* src/insets/insetcommand.h
(getParam): New, get a parameter
(setParam): New, set a parameter
(parameter set and get methods): Adjust to InsetCommandParams changes
* src/insets/insetbibitem.[Ch]
(write): Remove, not needed anymore
(directWrite): ditto
* src/insets/insetbibitem.C
(InsetBibitem::read): Use InsetCommand::read
* src/insets/insetref.C
(InsetRef::latex): Use new InsetCommandParams interface
* src/mathed/InsetMathHull.C
(InsetMathHull::doDispatch): ditto
* src/text3.C
(LyXText::dispatch): ditto
* src/factory.C
(createInset): Create InsetCommandParams with command name
(readInset): ditto
(readInset): Remove error message for bibitem, since bibitem is
now a normal command inset
* src/buffer.C: Bump file format number
* src/frontends/controllers/ControlCommand.[Ch]
(ControlCommand): take an additional command name parameter
* src/text.C
(readParToken): Remove code for \bibitem
* lib/lyx2lyx/LyX.py: Bump latest file format number
* lib/lyx2lyx/lyx_1_5.py
(convert_bibitem, convert_commandparams): new, convert to new format
(revert_commandparams): new, convert to old format
* development/FORMAT: document new format
* many other files: Adjust to the changes above
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15357 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-17 21:07:16 +00:00
|
|
|
|
cmd.argument();
|
2003-11-13 20:16:34 +00:00
|
|
|
|
string const data = InsetCommandMailer::params2string("label", p);
|
2004-04-19 02:39:05 +00:00
|
|
|
|
|
2006-09-01 15:41:38 +00:00
|
|
|
|
if (cmd.argument().empty()) {
|
2007-11-18 00:39:15 +00:00
|
|
|
|
bv->showDialog("label", data);
|
2004-04-19 02:39:05 +00:00
|
|
|
|
} else {
|
|
|
|
|
FuncRequest fr(LFUN_INSET_INSERT, data);
|
|
|
|
|
dispatch(cur, fr);
|
|
|
|
|
}
|
2003-11-13 20:16:34 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-11 14:52:00 +00:00
|
|
|
|
case LFUN_INFO_INSERT: {
|
2007-11-03 17:37:37 +00:00
|
|
|
|
Inset * inset = createInset(cur.bv().buffer(), cmd);
|
2007-10-11 14:52:00 +00:00
|
|
|
|
if (!inset)
|
|
|
|
|
break;
|
2007-10-14 00:47:52 +00:00
|
|
|
|
// if an empty inset is created (cmd.argument() is empty)
|
|
|
|
|
// use current selection as parameter.
|
|
|
|
|
if (cmd.argument().empty() && cur.selection()) {
|
|
|
|
|
// use selected text as info to avoid a separate UI
|
|
|
|
|
docstring ds = cur.selectionAsString(false);
|
|
|
|
|
cutSelection(cur, true, false);
|
|
|
|
|
static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds));
|
2007-12-19 18:09:00 +00:00
|
|
|
|
static_cast<InsetInfo *>(inset)->updateInfo(cur.bv().buffer());
|
2007-10-14 00:47:52 +00:00
|
|
|
|
}
|
2007-10-11 14:52:00 +00:00
|
|
|
|
insertInset(cur, inset);
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2007-10-11 14:52:00 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2002-08-28 17:33:42 +00:00
|
|
|
|
#if 0
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_LIST_INSERT:
|
|
|
|
|
case LFUN_THEOREM_INSERT:
|
2002-08-28 17:33:42 +00:00
|
|
|
|
#endif
|
2007-01-30 13:23:21 +00:00
|
|
|
|
case LFUN_CAPTION_INSERT:
|
2007-11-02 18:19:45 +00:00
|
|
|
|
case LFUN_FOOTNOTE_INSERT:
|
2007-01-31 10:54:36 +00:00
|
|
|
|
// Open the inset, and move the current selection
|
|
|
|
|
// inside it.
|
|
|
|
|
doInsertInset(cur, this, cmd, true, true);
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2007-11-02 18:19:45 +00:00
|
|
|
|
// These insets are numbered.
|
2007-08-21 13:03:55 +00:00
|
|
|
|
updateLabels(bv->buffer());
|
2007-01-31 10:54:36 +00:00
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_NOTE_INSERT:
|
2007-09-05 18:40:56 +00:00
|
|
|
|
case LFUN_FLEX_INSERT:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_BOX_INSERT:
|
|
|
|
|
case LFUN_BRANCH_INSERT:
|
|
|
|
|
case LFUN_BIBITEM_INSERT:
|
|
|
|
|
case LFUN_ERT_INSERT:
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
case LFUN_LISTING_INSERT:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_MARGINALNOTE_INSERT:
|
|
|
|
|
case LFUN_OPTIONAL_INSERT:
|
2003-03-13 11:16:56 +00:00
|
|
|
|
case LFUN_ENVIRONMENT_INSERT:
|
2003-01-17 09:57:50 +00:00
|
|
|
|
// Open the inset, and move the current selection
|
|
|
|
|
// inside it.
|
2004-02-13 11:05:29 +00:00
|
|
|
|
doInsertInset(cur, this, cmd, true, true);
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2003-01-17 09:57:50 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2005-05-30 15:35:11 +00:00
|
|
|
|
case LFUN_TABULAR_INSERT:
|
|
|
|
|
// if there were no arguments, just open the dialog
|
|
|
|
|
if (doInsertInset(cur, this, cmd, false, true))
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2005-05-30 15:35:11 +00:00
|
|
|
|
else
|
2006-09-19 13:36:20 +00:00
|
|
|
|
bv->showDialog("tabularcreate");
|
2005-05-30 15:35:11 +00:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FLOAT_INSERT:
|
|
|
|
|
case LFUN_FLOAT_WIDE_INSERT:
|
2007-02-01 09:22:03 +00:00
|
|
|
|
case LFUN_WRAP_INSERT: {
|
2007-02-09 10:57:23 +00:00
|
|
|
|
bool content = cur.selection(); // will some text be moved into the inset?
|
|
|
|
|
|
2005-04-14 10:19:39 +00:00
|
|
|
|
doInsertInset(cur, this, cmd, true, true);
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2007-02-01 09:22:03 +00:00
|
|
|
|
ParagraphList & pars = cur.text()->paragraphs();
|
2007-02-09 10:57:23 +00:00
|
|
|
|
|
2007-08-21 13:03:55 +00:00
|
|
|
|
TextClass const & tclass = bv->buffer().params().getTextClass();
|
2007-02-09 10:57:23 +00:00
|
|
|
|
|
|
|
|
|
// add a separate paragraph for the caption inset
|
|
|
|
|
pars.push_back(Paragraph());
|
|
|
|
|
pars.back().setInsetOwner(pars[0].inInset());
|
|
|
|
|
pars.back().layout(tclass.defaultLayout());
|
|
|
|
|
|
|
|
|
|
int cap_pit = pars.size() - 1;
|
|
|
|
|
|
|
|
|
|
// if an empty inset was created, we create an additional empty
|
|
|
|
|
// paragraph at the bottom so that the user can choose where to put
|
|
|
|
|
// the graphics (or table).
|
|
|
|
|
if (!content) {
|
|
|
|
|
pars.push_back(Paragraph());
|
|
|
|
|
pars.back().setInsetOwner(pars[0].inInset());
|
|
|
|
|
pars.back().layout(tclass.defaultLayout());
|
2007-05-28 22:27:45 +00:00
|
|
|
|
|
2007-02-09 10:57:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// reposition the cursor to the caption
|
|
|
|
|
cur.pit() = cap_pit;
|
2007-02-01 09:22:03 +00:00
|
|
|
|
cur.pos() = 0;
|
2007-08-27 09:03:18 +00:00
|
|
|
|
// FIXME: This Text/Cursor dispatch handling is a mess!
|
|
|
|
|
// We cannot use Cursor::dispatch here it needs access to up to
|
|
|
|
|
// date metrics.
|
2007-08-27 13:12:51 +00:00
|
|
|
|
FuncRequest cmd_caption(LFUN_CAPTION_INSERT);
|
|
|
|
|
cur.text()->dispatch(cur, cmd_caption);
|
2007-08-27 09:03:18 +00:00
|
|
|
|
cur.updateFlags(Update::Force);
|
2007-02-01 09:22:03 +00:00
|
|
|
|
// FIXME: When leaving the Float (or Wrap) inset we should
|
2007-02-01 16:23:24 +00:00
|
|
|
|
// delete any empty paragraph left above or below the
|
2007-02-01 09:22:03 +00:00
|
|
|
|
// caption.
|
2005-04-14 10:19:39 +00:00
|
|
|
|
break;
|
2007-02-01 09:22:03 +00:00
|
|
|
|
}
|
2005-04-14 10:19:39 +00:00
|
|
|
|
|
2006-11-04 17:55:36 +00:00
|
|
|
|
case LFUN_INDEX_INSERT:
|
2007-10-03 13:38:19 +00:00
|
|
|
|
doInsertInset(cur, this, cmd, true, true);
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2007-10-03 13:38:19 +00:00
|
|
|
|
break;
|
2007-11-03 17:37:37 +00:00
|
|
|
|
|
2006-11-04 17:55:36 +00:00
|
|
|
|
case LFUN_NOMENCL_INSERT: {
|
2007-11-03 17:37:37 +00:00
|
|
|
|
FuncRequest cmd1 = cmd;
|
|
|
|
|
if (cmd.argument().empty())
|
|
|
|
|
cmd1 = FuncRequest(cmd,
|
|
|
|
|
bv->cursor().innerText()->getStringToIndex(bv->cursor()));
|
|
|
|
|
Inset * inset = createInset(cur.bv().buffer(), cmd1);
|
2005-11-30 15:51:12 +00:00
|
|
|
|
if (!inset)
|
|
|
|
|
break;
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.recordUndo();
|
2005-11-30 15:51:12 +00:00
|
|
|
|
cur.clearSelection();
|
|
|
|
|
insertInset(cur, inset);
|
2006-11-04 17:55:36 +00:00
|
|
|
|
// Show the dialog for the nomenclature entry, since the
|
|
|
|
|
// description entry still needs to be filled in.
|
|
|
|
|
if (cmd.action == LFUN_NOMENCL_INSERT)
|
2007-09-10 16:06:01 +00:00
|
|
|
|
inset->edit(cur, true);
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2003-01-17 09:57:50 +00:00
|
|
|
|
break;
|
2005-11-30 15:51:12 +00:00
|
|
|
|
}
|
2003-01-17 09:57:50 +00:00
|
|
|
|
|
2002-11-27 10:30:28 +00:00
|
|
|
|
case LFUN_INDEX_PRINT:
|
2006-11-04 17:55:36 +00:00
|
|
|
|
case LFUN_NOMENCL_PRINT:
|
2002-08-28 17:33:42 +00:00
|
|
|
|
case LFUN_TOC_INSERT:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_HFILL_INSERT:
|
|
|
|
|
case LFUN_LINE_INSERT:
|
2007-11-23 02:10:00 +00:00
|
|
|
|
case LFUN_NEWPAGE_INSERT:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_PAGEBREAK_INSERT:
|
2006-11-25 15:09:01 +00:00
|
|
|
|
case LFUN_CLEARPAGE_INSERT:
|
|
|
|
|
case LFUN_CLEARDOUBLEPAGE_INSERT:
|
2003-01-17 09:57:50 +00:00
|
|
|
|
// do nothing fancy
|
2004-02-13 11:05:29 +00:00
|
|
|
|
doInsertInset(cur, this, cmd, false, false);
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2002-08-28 17:33:42 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_DEPTH_DECREMENT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
changeDepth(cur, DEC_DEPTH);
|
2003-10-02 14:42:31 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_DEPTH_INCREMENT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
changeDepth(cur, INC_DEPTH);
|
2003-10-02 14:42:31 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2003-11-10 09:06:48 +00:00
|
|
|
|
case LFUN_MATH_DISPLAY:
|
2004-03-25 09:16:36 +00:00
|
|
|
|
mathDispatch(cur, cmd, true);
|
2004-02-11 14:45:44 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2003-11-10 09:06:48 +00:00
|
|
|
|
case LFUN_MATH_IMPORT_SELECTION:
|
|
|
|
|
case LFUN_MATH_MODE:
|
2006-09-01 15:41:38 +00:00
|
|
|
|
if (cmd.argument() == "on")
|
2004-12-27 18:26:11 +00:00
|
|
|
|
// don't pass "on" as argument
|
|
|
|
|
mathDispatch(cur, FuncRequest(LFUN_MATH_MODE), false);
|
|
|
|
|
else
|
|
|
|
|
mathDispatch(cur, cmd, false);
|
2004-02-11 14:45:44 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_MATH_MACRO:
|
2006-09-01 15:41:38 +00:00
|
|
|
|
if (cmd.argument().empty())
|
2006-10-21 00:16:43 +00:00
|
|
|
|
cur.errorMessage(from_utf8(N_("Missing argument")));
|
2004-02-11 14:45:44 +00:00
|
|
|
|
else {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
string s = to_utf8(cmd.argument());
|
2004-02-11 14:45:44 +00:00
|
|
|
|
string const s1 = token(s, ' ', 1);
|
2005-01-27 21:05:44 +00:00
|
|
|
|
int const nargs = s1.empty() ? 0 : convert<int>(s1);
|
2004-02-11 14:45:44 +00:00
|
|
|
|
string const s2 = token(s, ' ', 2);
|
2007-12-21 20:42:46 +00:00
|
|
|
|
MacroType type = MacroTypeNewcommand;
|
|
|
|
|
if (s2 == "def")
|
|
|
|
|
type = MacroTypeDef;
|
|
|
|
|
cur.insert(new MathMacroTemplate(from_utf8(token(s, ' ', 0)), nargs, false, type));
|
2004-04-13 06:27:29 +00:00
|
|
|
|
//cur.nextInset()->edit(cur, true);
|
2004-02-11 14:45:44 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2005-01-06 15:40:49 +00:00
|
|
|
|
|
2005-01-04 09:18:48 +00:00
|
|
|
|
// passthrough hat and underscore outside mathed:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_MATH_SUBSCRIPT:
|
|
|
|
|
mathDispatch(cur, FuncRequest(LFUN_SELF_INSERT, "_"), false);
|
2005-01-04 09:18:48 +00:00
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_MATH_SUPERSCRIPT:
|
|
|
|
|
mathDispatch(cur, FuncRequest(LFUN_SELF_INSERT, "^"), false);
|
2005-01-04 09:18:48 +00:00
|
|
|
|
break;
|
2004-02-11 14:45:44 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_MATH_INSERT:
|
|
|
|
|
case LFUN_MATH_MATRIX:
|
2006-05-07 10:51:19 +00:00
|
|
|
|
case LFUN_MATH_DELIM:
|
|
|
|
|
case LFUN_MATH_BIGDELIM: {
|
2007-12-17 18:13:02 +00:00
|
|
|
|
cap::replaceSelection(cur);
|
2006-09-16 18:11:38 +00:00
|
|
|
|
cur.insert(new InsetMathHull(hullSimple));
|
2007-06-11 10:24:20 +00:00
|
|
|
|
checkAndActivateInset(cur, true);
|
2007-05-18 09:48:26 +00:00
|
|
|
|
BOOST_ASSERT(cur.inMathed());
|
2004-02-11 14:45:44 +00:00
|
|
|
|
cur.dispatch(cmd);
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-11 14:45:44 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_EMPH: {
|
2007-11-14 15:07:08 +00:00
|
|
|
|
Font font(ignore_font, ignore_language);
|
2007-10-28 18:51:54 +00:00
|
|
|
|
font.fontInfo().setEmph(FONT_TOGGLE);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, font);
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_BOLD: {
|
2007-11-14 15:07:08 +00:00
|
|
|
|
Font font(ignore_font, ignore_language);
|
2007-10-28 18:51:54 +00:00
|
|
|
|
font.fontInfo().setSeries(BOLD_SERIES);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, font);
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_NOUN: {
|
2007-11-14 15:07:08 +00:00
|
|
|
|
Font font(ignore_font, ignore_language);
|
2007-10-28 18:51:54 +00:00
|
|
|
|
font.fontInfo().setNoun(FONT_TOGGLE);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, font);
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2007-09-20 18:02:39 +00:00
|
|
|
|
case LFUN_FONT_TYPEWRITER: {
|
2007-11-14 15:07:08 +00:00
|
|
|
|
Font font(ignore_font, ignore_language);
|
2007-10-28 18:51:54 +00:00
|
|
|
|
font.fontInfo().setFamily(TYPEWRITER_FAMILY); // no good
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, font);
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_SANS: {
|
2007-11-14 15:07:08 +00:00
|
|
|
|
Font font(ignore_font, ignore_language);
|
2007-10-28 18:51:54 +00:00
|
|
|
|
font.fontInfo().setFamily(SANS_FAMILY);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, font);
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_ROMAN: {
|
2007-11-14 15:07:08 +00:00
|
|
|
|
Font font(ignore_font, ignore_language);
|
2007-10-28 18:51:54 +00:00
|
|
|
|
font.fontInfo().setFamily(ROMAN_FAMILY);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, font);
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_DEFAULT: {
|
2007-10-28 18:51:54 +00:00
|
|
|
|
Font font(inherit_font, ignore_language);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, font);
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_UNDERLINE: {
|
2007-11-14 15:07:08 +00:00
|
|
|
|
Font font(ignore_font, ignore_language);
|
2007-10-28 18:51:54 +00:00
|
|
|
|
font.fontInfo().setUnderbar(FONT_TOGGLE);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, font);
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2004-02-06 13:59:26 +00:00
|
|
|
|
case LFUN_FONT_SIZE: {
|
2007-11-14 15:07:08 +00:00
|
|
|
|
Font font(ignore_font, ignore_language);
|
2007-10-28 18:51:54 +00:00
|
|
|
|
setLyXSize(to_utf8(cmd.argument()), font.fontInfo());
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, font);
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2004-02-06 13:59:26 +00:00
|
|
|
|
case LFUN_LANGUAGE: {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
Language const * lang = languages.getLanguage(to_utf8(cmd.argument()));
|
2004-02-06 13:59:26 +00:00
|
|
|
|
if (!lang)
|
|
|
|
|
break;
|
2007-11-14 15:07:08 +00:00
|
|
|
|
Font font(ignore_font, lang);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, font);
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_FREE_APPLY:
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, freefont, toggleall);
|
2006-09-11 08:54:10 +00:00
|
|
|
|
cur.message(_("Character set"));
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2004-02-06 13:59:26 +00:00
|
|
|
|
// Set the freefont using the contents of \param data dispatched from
|
|
|
|
|
// the frontends and apply it at the current cursor location.
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_FREE_UPDATE: {
|
2007-04-29 18:17:15 +00:00
|
|
|
|
Font font;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
bool toggle;
|
2007-09-29 11:00:18 +00:00
|
|
|
|
if (font.fromString(to_utf8(cmd.argument()), toggle)) {
|
2004-02-06 13:59:26 +00:00
|
|
|
|
freefont = font;
|
|
|
|
|
toggleall = toggle;
|
2004-02-13 07:30:59 +00:00
|
|
|
|
toggleAndShow(cur, this, freefont, toggleall);
|
2006-09-11 08:54:10 +00:00
|
|
|
|
cur.message(_("Character set"));
|
2007-10-29 22:03:59 +00:00
|
|
|
|
} else {
|
|
|
|
|
lyxerr << "Argument not ok";
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
2004-02-06 13:59:26 +00:00
|
|
|
|
}
|
2003-11-22 14:44:59 +00:00
|
|
|
|
|
2003-11-10 09:06:48 +00:00
|
|
|
|
case LFUN_FINISHED_LEFT:
|
2007-11-15 20:04:51 +00:00
|
|
|
|
LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_LEFT:\n" << cur);
|
2007-09-24 22:20:03 +00:00
|
|
|
|
if (reverseDirectionNeeded(cur)) {
|
2007-05-15 17:19:05 +00:00
|
|
|
|
++cur.pos();
|
2007-09-24 22:20:03 +00:00
|
|
|
|
cur.setCurrentFont();
|
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_FINISHED_RIGHT:
|
2007-11-15 20:04:51 +00:00
|
|
|
|
LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_RIGHT:\n" << cur);
|
2007-09-24 22:20:03 +00:00
|
|
|
|
if (!reverseDirectionNeeded(cur)) {
|
2007-05-15 17:19:05 +00:00
|
|
|
|
++cur.pos();
|
2007-09-24 22:20:03 +00:00
|
|
|
|
cur.setCurrentFont();
|
|
|
|
|
}
|
2003-11-10 09:06:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2007-10-22 22:18:52 +00:00
|
|
|
|
case LFUN_FINISHED_BACKWARD:
|
2007-11-15 20:04:51 +00:00
|
|
|
|
LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_BACKWARD:\n" << cur);
|
2007-10-22 22:18:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_FINISHED_FORWARD:
|
2007-11-15 20:04:51 +00:00
|
|
|
|
LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_FORWARD:\n" << cur);
|
2007-10-22 22:18:52 +00:00
|
|
|
|
++cur.pos();
|
|
|
|
|
cur.setCurrentFont();
|
|
|
|
|
break;
|
|
|
|
|
|
2004-02-06 13:59:26 +00:00
|
|
|
|
case LFUN_LAYOUT_PARAGRAPH: {
|
|
|
|
|
string data;
|
|
|
|
|
params2string(cur.paragraph(), data);
|
|
|
|
|
data = "show\n" + data;
|
2007-11-18 00:39:15 +00:00
|
|
|
|
bv->showDialog("paragraph", data);
|
2004-02-06 13:59:26 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case LFUN_PARAGRAPH_UPDATE: {
|
|
|
|
|
string data;
|
|
|
|
|
params2string(cur.paragraph(), data);
|
|
|
|
|
|
|
|
|
|
// Will the paragraph accept changes from the dialog?
|
2005-11-17 08:41:56 +00:00
|
|
|
|
bool const accept = !cur.inset().forceDefaultParagraphs(cur.idx());
|
2004-02-06 13:59:26 +00:00
|
|
|
|
|
2005-01-06 15:40:49 +00:00
|
|
|
|
data = "update " + convert<string>(accept) + '\n' + data;
|
2006-09-19 13:36:20 +00:00
|
|
|
|
bv->updateDialog("paragraph", data);
|
2004-02-06 13:59:26 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_ACCENT_UMLAUT:
|
|
|
|
|
case LFUN_ACCENT_CIRCUMFLEX:
|
|
|
|
|
case LFUN_ACCENT_GRAVE:
|
|
|
|
|
case LFUN_ACCENT_ACUTE:
|
|
|
|
|
case LFUN_ACCENT_TILDE:
|
|
|
|
|
case LFUN_ACCENT_CEDILLA:
|
|
|
|
|
case LFUN_ACCENT_MACRON:
|
|
|
|
|
case LFUN_ACCENT_DOT:
|
|
|
|
|
case LFUN_ACCENT_UNDERDOT:
|
|
|
|
|
case LFUN_ACCENT_UNDERBAR:
|
|
|
|
|
case LFUN_ACCENT_CARON:
|
|
|
|
|
case LFUN_ACCENT_SPECIAL_CARON:
|
|
|
|
|
case LFUN_ACCENT_BREVE:
|
|
|
|
|
case LFUN_ACCENT_TIE:
|
|
|
|
|
case LFUN_ACCENT_HUNGARIAN_UMLAUT:
|
|
|
|
|
case LFUN_ACCENT_CIRCLE:
|
|
|
|
|
case LFUN_ACCENT_OGONEK:
|
2006-10-11 17:24:46 +00:00
|
|
|
|
theLyXFunc().handleKeyFunc(cmd.action);
|
2006-09-01 15:41:38 +00:00
|
|
|
|
if (!cmd.argument().empty())
|
|
|
|
|
// FIXME: Are all these characters encoded in one byte in utf8?
|
2007-06-11 22:05:44 +00:00
|
|
|
|
bv->translateAndInsert(cmd.argument()[0], this, cur);
|
2004-02-06 13:59:26 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2004-02-12 16:36:01 +00:00
|
|
|
|
case LFUN_FLOAT_LIST: {
|
2007-08-21 13:03:55 +00:00
|
|
|
|
TextClass const & tclass = bv->buffer().params().getTextClass();
|
2006-10-21 00:16:43 +00:00
|
|
|
|
if (tclass.floats().typeExist(to_utf8(cmd.argument()))) {
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.recordUndo();
|
2007-07-30 10:33:43 +00:00
|
|
|
|
if (cur.selection())
|
|
|
|
|
cutSelection(cur, true, false);
|
2004-02-12 16:36:01 +00:00
|
|
|
|
breakParagraph(cur);
|
|
|
|
|
|
|
|
|
|
if (cur.lastpos() != 0) {
|
2007-10-22 22:18:52 +00:00
|
|
|
|
cursorBackward(cur);
|
2004-02-12 16:36:01 +00:00
|
|
|
|
breakParagraph(cur);
|
|
|
|
|
}
|
|
|
|
|
|
2004-02-13 07:30:59 +00:00
|
|
|
|
setLayout(cur, tclass.defaultLayoutName());
|
Add LFUN_PARAGRAPH_PARAMS (= paragraph-params), used for changing a paragraph's alignment, spacing, etc. This is complementary to LFUN_PARAGRAPH_PARAMS_APPLY, which sets the parameters. The difference is that APPLY over-rides all existing parameters, setting any not given to the default, whereas this one simply changes those that are given. So
paragraph-params \align right
will align the paragraph right, leaving spacing, etc, as they were, whereas
paragraph-params-apply \align right
will align the paragraph right but also reset all other parameters to defaults. Note, by the way, that this means that
paragraph-params-apply
sets everything to default.
Some new arguments have also been introduced. These are:
\indent
\indent-toggle
\spacing default
Of course, none of these are found in valid LyX files, but they are useful in menu bindings, etc.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19581 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-15 02:21:09 +00:00
|
|
|
|
ParagraphParameters p;
|
|
|
|
|
setParagraphs(cur, p);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
insertInset(cur, new InsetFloatList(to_utf8(cmd.argument())));
|
2007-11-05 19:41:16 +00:00
|
|
|
|
cur.posForward();
|
2004-02-12 16:36:01 +00:00
|
|
|
|
} else {
|
|
|
|
|
lyxerr << "Non-existent float type: "
|
2006-10-21 00:16:43 +00:00
|
|
|
|
<< to_utf8(cmd.argument()) << endl;
|
2004-02-12 16:36:01 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_CHANGE_ACCEPT: {
|
2007-01-25 22:28:15 +00:00
|
|
|
|
acceptOrRejectChanges(cur, ACCEPT);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_CHANGE_REJECT: {
|
2007-01-25 22:28:15 +00:00
|
|
|
|
acceptOrRejectChanges(cur, REJECT);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case LFUN_THESAURUS_ENTRY: {
|
2006-09-03 07:02:38 +00:00
|
|
|
|
docstring arg = cmd.argument();
|
2004-02-13 07:30:59 +00:00
|
|
|
|
if (arg.empty()) {
|
|
|
|
|
arg = cur.selectionAsString(false);
|
|
|
|
|
// FIXME
|
|
|
|
|
if (arg.size() > 100 || arg.empty()) {
|
|
|
|
|
// Get word or selection
|
2006-10-21 00:16:43 +00:00
|
|
|
|
selectWordWhenUnderCursor(cur, WHOLE_WORD);
|
2004-02-13 07:30:59 +00:00
|
|
|
|
arg = cur.selectionAsString(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-11-18 00:39:15 +00:00
|
|
|
|
bv->showDialog("thesaurus", to_utf8(arg));
|
2004-02-13 07:30:59 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_PARAGRAPH_PARAMS_APPLY: {
|
2004-02-13 11:05:29 +00:00
|
|
|
|
// Given data, an encoding of the ParagraphParameters
|
|
|
|
|
// generated in the Paragraph dialog, this function sets
|
Add LFUN_PARAGRAPH_PARAMS (= paragraph-params), used for changing a paragraph's alignment, spacing, etc. This is complementary to LFUN_PARAGRAPH_PARAMS_APPLY, which sets the parameters. The difference is that APPLY over-rides all existing parameters, setting any not given to the default, whereas this one simply changes those that are given. So
paragraph-params \align right
will align the paragraph right, leaving spacing, etc, as they were, whereas
paragraph-params-apply \align right
will align the paragraph right but also reset all other parameters to defaults. Note, by the way, that this means that
paragraph-params-apply
sets everything to default.
Some new arguments have also been introduced. These are:
\indent
\indent-toggle
\spacing default
Of course, none of these are found in valid LyX files, but they are useful in menu bindings, etc.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19581 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-15 02:21:09 +00:00
|
|
|
|
// the current paragraph, or currently selected paragraphs,
|
|
|
|
|
// appropriately.
|
|
|
|
|
// NOTE: This function overrides all existing settings.
|
|
|
|
|
setParagraphs(cur, cmd.argument());
|
|
|
|
|
cur.message(_("Paragraph layout set"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case LFUN_PARAGRAPH_PARAMS: {
|
|
|
|
|
// Given data, an encoding of the ParagraphParameters as we'd
|
|
|
|
|
// find them in a LyX file, this function modifies the current paragraph,
|
|
|
|
|
// or currently selected paragraphs.
|
|
|
|
|
// NOTE: This function only modifies, and does not override, existing
|
|
|
|
|
// settings.
|
|
|
|
|
setParagraphs(cur, cmd.argument(), true);
|
2006-09-11 08:54:10 +00:00
|
|
|
|
cur.message(_("Paragraph layout set"));
|
2004-02-13 11:05:29 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2004-02-20 17:19:53 +00:00
|
|
|
|
case LFUN_ESCAPE:
|
2004-03-25 09:16:36 +00:00
|
|
|
|
if (cur.selection()) {
|
2004-02-20 17:19:53 +00:00
|
|
|
|
cur.selection() = false;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
} else {
|
|
|
|
|
cur.undispatched();
|
2007-10-22 22:18:52 +00:00
|
|
|
|
// This used to be LFUN_FINISHED_RIGHT, I think FORWARD is more
|
|
|
|
|
// correct, but I'm not 100% sure -- dov, 071019
|
|
|
|
|
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
2004-03-25 09:16:36 +00:00
|
|
|
|
}
|
2004-02-20 17:19:53 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2007-11-06 17:13:43 +00:00
|
|
|
|
case LFUN_OUTLINE_UP:
|
|
|
|
|
outline(OutlineUp, cur);
|
|
|
|
|
setCursor(cur, cur.pit(), 0);
|
|
|
|
|
updateLabels(cur.buffer());
|
|
|
|
|
needsUpdate = true;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_OUTLINE_DOWN:
|
|
|
|
|
outline(OutlineDown, cur);
|
|
|
|
|
setCursor(cur, cur.pit(), 0);
|
|
|
|
|
updateLabels(cur.buffer());
|
|
|
|
|
needsUpdate = true;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_OUTLINE_IN:
|
|
|
|
|
outline(OutlineIn, cur);
|
|
|
|
|
updateLabels(cur.buffer());
|
|
|
|
|
needsUpdate = true;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_OUTLINE_OUT:
|
|
|
|
|
outline(OutlineOut, cur);
|
|
|
|
|
updateLabels(cur.buffer());
|
|
|
|
|
needsUpdate = true;
|
|
|
|
|
break;
|
|
|
|
|
|
2002-08-20 13:00:25 +00:00
|
|
|
|
default:
|
2007-11-29 21:10:35 +00:00
|
|
|
|
LYXERR(Debug::ACTION, "Command " << cmd << " not DISPATCHED by Text");
|
2004-03-01 17:12:09 +00:00
|
|
|
|
cur.undispatched();
|
2004-02-20 17:19:53 +00:00
|
|
|
|
break;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
}
|
2004-05-18 07:18:02 +00:00
|
|
|
|
|
2006-10-22 11:46:36 +00:00
|
|
|
|
needsUpdate |= (cur.pos() != cur.lastpos()) && cur.selection();
|
2006-11-17 17:42:52 +00:00
|
|
|
|
|
|
|
|
|
// FIXME: The cursor flag is reset two lines below
|
|
|
|
|
// so we need to check here if some of the LFUN did touch that.
|
2007-04-29 23:33:02 +00:00
|
|
|
|
// for now only Text::erase() and Text::backspace() do that.
|
2006-11-17 17:42:52 +00:00
|
|
|
|
// The plan is to verify all the LFUNs and then to remove this
|
|
|
|
|
// singleParUpdate boolean altogether.
|
|
|
|
|
if (cur.result().update() & Update::Force) {
|
|
|
|
|
singleParUpdate = false;
|
|
|
|
|
needsUpdate = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FIXME: the following code should go in favor of fine grained
|
|
|
|
|
// update flag treatment.
|
2006-12-29 23:54:48 +00:00
|
|
|
|
if (singleParUpdate) {
|
2005-10-07 12:00:41 +00:00
|
|
|
|
// Inserting characters does not change par height
|
2007-05-28 22:27:45 +00:00
|
|
|
|
ParagraphMetrics const & pms
|
2006-12-29 23:54:48 +00:00
|
|
|
|
= cur.bv().parMetrics(cur.bottom().text(), cur.bottom().pit());
|
2007-11-15 20:04:51 +00:00
|
|
|
|
if (pms.dim().height() == olddim.height()) {
|
2005-10-07 12:00:41 +00:00
|
|
|
|
// if so, update _only_ this paragraph
|
2006-10-22 11:46:36 +00:00
|
|
|
|
cur.updateFlags(Update::SinglePar |
|
2007-11-06 09:34:16 +00:00
|
|
|
|
Update::FitCursor);
|
2006-03-10 16:10:35 +00:00
|
|
|
|
return;
|
2007-11-15 20:04:51 +00:00
|
|
|
|
}
|
|
|
|
|
needsUpdate = true;
|
2006-12-29 23:54:48 +00:00
|
|
|
|
}
|
2006-11-17 17:42:52 +00:00
|
|
|
|
|
2005-02-08 02:06:39 +00:00
|
|
|
|
if (!needsUpdate
|
|
|
|
|
&& &oldTopSlice.inset() == &cur.inset()
|
|
|
|
|
&& oldTopSlice.idx() == cur.idx()
|
2006-11-17 17:42:52 +00:00
|
|
|
|
&& !sel // sel is a backup of cur.selection() at the biginning of the function.
|
2005-02-08 02:06:39 +00:00
|
|
|
|
&& !cur.selection())
|
2006-11-27 12:49:28 +00:00
|
|
|
|
// FIXME: it would be better if we could just do this
|
|
|
|
|
//
|
|
|
|
|
//if (cur.result().update() != Update::FitCursor)
|
|
|
|
|
// cur.noUpdate();
|
2007-05-28 22:27:45 +00:00
|
|
|
|
//
|
2006-11-27 12:49:28 +00:00
|
|
|
|
// But some LFUNs do not set Update::FitCursor when needed, so we
|
|
|
|
|
// do it for all. This is not very harmfull as FitCursor will provoke
|
|
|
|
|
// a full redraw only if needed but still, a proper review of all LFUN
|
|
|
|
|
// should be done and this needsUpdate boolean can then be removed.
|
|
|
|
|
cur.updateFlags(Update::FitCursor);
|
2005-02-08 02:06:39 +00:00
|
|
|
|
else
|
2006-10-22 11:46:36 +00:00
|
|
|
|
cur.updateFlags(Update::Force | Update::FitCursor);
|
2004-02-20 17:19:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-20 13:00:25 +00:00
|
|
|
|
|
2007-04-29 23:33:02 +00:00
|
|
|
|
bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
2004-12-02 11:32:14 +00:00
|
|
|
|
FuncStatus & flag) const
|
2004-02-20 17:19:53 +00:00
|
|
|
|
{
|
2004-03-18 13:57:20 +00:00
|
|
|
|
BOOST_ASSERT(cur.text() == this);
|
2005-11-02 11:27:08 +00:00
|
|
|
|
|
2007-09-02 13:35:48 +00:00
|
|
|
|
Font const & font = cur.real_current_font;
|
2007-10-28 18:51:54 +00:00
|
|
|
|
FontInfo const & fontinfo = font.fontInfo();
|
2004-03-18 13:57:20 +00:00
|
|
|
|
bool enable = true;
|
2007-10-13 09:04:52 +00:00
|
|
|
|
InsetCode code = NO_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
|
|
|
|
|
switch (cmd.action) {
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_DEPTH_DECREMENT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = changeDepthAllowed(cur, DEC_DEPTH);
|
|
|
|
|
break;
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_DEPTH_INCREMENT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = changeDepthAllowed(cur, INC_DEPTH);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_APPENDIX:
|
|
|
|
|
flag.setOnOff(cur.paragraph().params().startOfAppendix());
|
2005-05-05 13:13:56 +00:00
|
|
|
|
return true;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_BIBITEM_INSERT:
|
2007-05-14 09:24:17 +00:00
|
|
|
|
enable = (cur.paragraph().layout()->labeltype == LABEL_BIBLIO
|
|
|
|
|
&& cur.pos() == 0);
|
2005-06-06 08:30:20 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_DIALOG_SHOW_NEW_INSET:
|
2006-09-01 15:41:38 +00:00
|
|
|
|
if (cmd.argument() == "bibitem")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = BIBITEM_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "bibtex")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = BIBTEX_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "box")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = BOX_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "branch")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = BRANCH_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "citation")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = CITE_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "ert")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = ERT_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "external")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = EXTERNAL_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "float")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = FLOAT_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "graphics")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = GRAPHICS_CODE;
|
2007-10-13 19:06:09 +00:00
|
|
|
|
else if (cmd.argument() == "href")
|
|
|
|
|
code = HYPERLINK_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "include")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = INCLUDE_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "index")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = INDEX_CODE;
|
2006-11-04 17:55:36 +00:00
|
|
|
|
else if (cmd.argument() == "nomenclature")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = NOMENCL_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "label")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = LABEL_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "note")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = NOTE_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "ref")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = REF_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "toc")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = TOC_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "vspace")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = VSPACE_CODE;
|
2006-09-01 15:41:38 +00:00
|
|
|
|
else if (cmd.argument() == "wrap")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = WRAP_CODE;
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
else if (cmd.argument() == "listings")
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = LISTINGS_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_ERT_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = ERT_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
case LFUN_LISTING_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = LISTINGS_CODE;
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FOOTNOTE_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = FOOT_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
|
|
|
|
case LFUN_TABULAR_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = TABULAR_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_MARGINALNOTE_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = MARGIN_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FLOAT_INSERT:
|
|
|
|
|
case LFUN_FLOAT_WIDE_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = FLOAT_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_WRAP_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = WRAP_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
|
|
|
|
case LFUN_FLOAT_LIST:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = FLOAT_LIST_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
|
|
|
|
#if 0
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_LIST_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = LIST_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_THEOREM_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = THEOREM_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
|
|
|
|
#endif
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_CAPTION_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = CAPTION_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_NOTE_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = NOTE_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2007-09-08 13:11:10 +00:00
|
|
|
|
case LFUN_FLEX_INSERT: {
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = FLEX_CODE;
|
2007-09-08 13:11:10 +00:00
|
|
|
|
string s = cmd.getArg(0);
|
|
|
|
|
InsetLayout il = cur.buffer().params().getTextClass().insetlayout(from_utf8(s));
|
|
|
|
|
if (il.lyxtype != "charstyle" &&
|
|
|
|
|
il.lyxtype != "custom" &&
|
2007-11-13 10:03:16 +00:00
|
|
|
|
il.lyxtype != "element" &&
|
|
|
|
|
il.lyxtype != "standard")
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = false;
|
|
|
|
|
break;
|
2007-09-08 13:11:10 +00:00
|
|
|
|
}
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_BOX_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = BOX_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_BRANCH_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = BRANCH_CODE;
|
2007-10-20 10:03:45 +00:00
|
|
|
|
if (cur.buffer().masterBuffer()->params().branchlist().empty())
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = false;
|
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_LABEL_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = LABEL_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2007-10-11 14:52:00 +00:00
|
|
|
|
case LFUN_INFO_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = INFO_CODE;
|
2007-10-11 14:52:00 +00:00
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_OPTIONAL_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = OPTARG_CODE;
|
2007-10-24 15:32:43 +00:00
|
|
|
|
enable = cur.paragraph().insetList().count(OPTARG_CODE)
|
2005-11-02 11:27:08 +00:00
|
|
|
|
< cur.paragraph().layout()->optionalargs;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
|
|
|
|
case LFUN_ENVIRONMENT_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = BOX_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
|
|
|
|
case LFUN_INDEX_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = INDEX_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
|
|
|
|
case LFUN_INDEX_PRINT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = INDEX_PRINT_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2006-11-04 17:55:36 +00:00
|
|
|
|
case LFUN_NOMENCL_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = NOMENCL_CODE;
|
2006-11-04 17:55:36 +00:00
|
|
|
|
break;
|
|
|
|
|
case LFUN_NOMENCL_PRINT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = NOMENCL_PRINT_CODE;
|
2006-11-04 17:55:36 +00:00
|
|
|
|
break;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_TOC_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = TOC_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2007-10-13 19:06:09 +00:00
|
|
|
|
case LFUN_HYPERLINK_INSERT:
|
|
|
|
|
code = HYPERLINK_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_QUOTE_INSERT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
// always allow this, since we will inset a raw quote
|
|
|
|
|
// if an inset is not allowed.
|
|
|
|
|
break;
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_HFILL_INSERT:
|
2007-12-06 11:04:56 +00:00
|
|
|
|
case LFUN_SPECIALCHAR_INSERT:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = SPECIALCHAR_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
|
|
|
|
case LFUN_SPACE_INSERT:
|
|
|
|
|
// slight hack: we know this is allowed in math mode
|
|
|
|
|
if (cur.inTexted())
|
2007-10-13 09:04:52 +00:00
|
|
|
|
code = SPACE_CODE;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2005-11-02 11:27:08 +00:00
|
|
|
|
|
2005-04-13 09:43:58 +00:00
|
|
|
|
case LFUN_INSET_MODIFY:
|
|
|
|
|
// We need to disable this, because we may get called for a
|
|
|
|
|
// tabular cell via
|
|
|
|
|
// InsetTabular::getStatus() -> InsetText::getStatus()
|
|
|
|
|
// and we don't handle LFUN_INSET_MODIFY.
|
|
|
|
|
enable = false;
|
|
|
|
|
break;
|
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_EMPH:
|
2007-10-28 18:51:54 +00:00
|
|
|
|
flag.setOnOff(fontinfo.emph() == FONT_ON);
|
2005-05-05 13:13:56 +00:00
|
|
|
|
return true;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_NOUN:
|
2007-10-28 18:51:54 +00:00
|
|
|
|
flag.setOnOff(fontinfo.noun() == FONT_ON);
|
2005-05-05 13:13:56 +00:00
|
|
|
|
return true;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_BOLD:
|
2007-10-28 18:51:54 +00:00
|
|
|
|
flag.setOnOff(fontinfo.series() == BOLD_SERIES);
|
2005-05-05 13:13:56 +00:00
|
|
|
|
return true;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_SANS:
|
2007-10-28 18:51:54 +00:00
|
|
|
|
flag.setOnOff(fontinfo.family() == SANS_FAMILY);
|
2005-05-05 13:13:56 +00:00
|
|
|
|
return true;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_ROMAN:
|
2007-10-28 18:51:54 +00:00
|
|
|
|
flag.setOnOff(fontinfo.family() == ROMAN_FAMILY);
|
2005-05-05 13:13:56 +00:00
|
|
|
|
return true;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
|
2007-09-20 18:02:39 +00:00
|
|
|
|
case LFUN_FONT_TYPEWRITER:
|
2007-10-28 18:51:54 +00:00
|
|
|
|
flag.setOnOff(fontinfo.family() == TYPEWRITER_FAMILY);
|
2005-05-05 13:13:56 +00:00
|
|
|
|
return true;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
|
2005-11-25 09:27:08 +00:00
|
|
|
|
case LFUN_CUT:
|
|
|
|
|
case LFUN_COPY:
|
|
|
|
|
enable = cur.selection();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_PASTE:
|
2007-01-04 12:05:24 +00:00
|
|
|
|
if (cmd.argument().empty()) {
|
|
|
|
|
if (theClipboard().isInternal())
|
|
|
|
|
enable = cap::numberOfSelections() > 0;
|
|
|
|
|
else
|
2007-01-07 16:43:38 +00:00
|
|
|
|
enable = !theClipboard().empty();
|
|
|
|
|
} else {
|
|
|
|
|
string const arg = to_utf8(cmd.argument());
|
|
|
|
|
if (isStrUnsignedInt(arg)) {
|
|
|
|
|
unsigned int n = convert<unsigned int>(arg);
|
|
|
|
|
enable = cap::numberOfSelections() > n;
|
|
|
|
|
} else
|
|
|
|
|
// unknown argument
|
|
|
|
|
enable = false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_CLIPBOARD_PASTE:
|
|
|
|
|
enable = !theClipboard().empty();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_PRIMARY_SELECTION_PASTE:
|
2007-01-08 18:37:40 +00:00
|
|
|
|
enable = cur.selection() || !theSelection().empty();
|
2005-11-25 09:27:08 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-09-08 14:08:26 +00:00
|
|
|
|
case LFUN_PARAGRAPH_MOVE_UP:
|
2006-04-26 22:43:26 +00:00
|
|
|
|
enable = cur.pit() > 0 && !cur.selection();
|
|
|
|
|
break;
|
|
|
|
|
|
2006-09-08 14:08:26 +00:00
|
|
|
|
case LFUN_PARAGRAPH_MOVE_DOWN:
|
2006-04-26 22:43:26 +00:00
|
|
|
|
enable = cur.pit() < cur.lastpit() && !cur.selection();
|
|
|
|
|
break;
|
|
|
|
|
|
2006-09-08 14:08:26 +00:00
|
|
|
|
case LFUN_INSET_DISSOLVE:
|
2007-10-13 12:59:44 +00:00
|
|
|
|
if (!cmd.argument().empty()) {
|
|
|
|
|
InsetLayout il = cur.inset().getLayout(cur.buffer().params());
|
2007-10-20 10:03:45 +00:00
|
|
|
|
enable = cur.inset().lyxCode() == FLEX_CODE
|
|
|
|
|
&& il.lyxtype == to_utf8(cmd.argument());
|
|
|
|
|
} else {
|
2007-10-13 12:59:44 +00:00
|
|
|
|
enable = !isMainText(cur.bv().buffer())
|
2007-10-20 10:03:45 +00:00
|
|
|
|
&& cur.inset().nargs() == 1;
|
|
|
|
|
}
|
2006-08-08 13:34:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-10-04 21:43:40 +00:00
|
|
|
|
case LFUN_CHANGE_ACCEPT:
|
|
|
|
|
case LFUN_CHANGE_REJECT:
|
2006-11-24 23:01:24 +00:00
|
|
|
|
// TODO: context-sensitive enabling of LFUN_CHANGE_ACCEPT/REJECT
|
|
|
|
|
// In principle, these LFUNs should only be enabled if there
|
|
|
|
|
// is a change at the current position/in the current selection.
|
|
|
|
|
// However, without proper optimizations, this will inevitably
|
|
|
|
|
// result in unacceptable performance - just imagine a user who
|
|
|
|
|
// wants to select the complete content of a long document.
|
|
|
|
|
enable = true;
|
2006-10-04 21:43:40 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2007-11-06 17:13:43 +00:00
|
|
|
|
case LFUN_OUTLINE_UP:
|
|
|
|
|
case LFUN_OUTLINE_DOWN:
|
|
|
|
|
case LFUN_OUTLINE_IN:
|
|
|
|
|
case LFUN_OUTLINE_OUT:
|
|
|
|
|
enable = (cur.paragraph().layout()->toclevel != Layout::NOT_IN_TOC);
|
|
|
|
|
break;
|
|
|
|
|
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_WORD_DELETE_FORWARD:
|
|
|
|
|
case LFUN_WORD_DELETE_BACKWARD:
|
|
|
|
|
case LFUN_LINE_DELETE:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_WORD_FORWARD:
|
|
|
|
|
case LFUN_WORD_BACKWARD:
|
2007-10-28 20:35:57 +00:00
|
|
|
|
case LFUN_WORD_RIGHT:
|
|
|
|
|
case LFUN_WORD_LEFT:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_CHAR_FORWARD:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_CHAR_FORWARD_SELECT:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_CHAR_BACKWARD:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_CHAR_BACKWARD_SELECT:
|
2007-10-22 22:18:52 +00:00
|
|
|
|
case LFUN_CHAR_LEFT:
|
|
|
|
|
case LFUN_CHAR_LEFT_SELECT:
|
|
|
|
|
case LFUN_CHAR_RIGHT:
|
|
|
|
|
case LFUN_CHAR_RIGHT_SELECT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_UP:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_UP_SELECT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_DOWN:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_DOWN_SELECT:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_PARAGRAPH_UP_SELECT:
|
|
|
|
|
case LFUN_PARAGRAPH_DOWN_SELECT:
|
|
|
|
|
case LFUN_SCREEN_UP_SELECT:
|
|
|
|
|
case LFUN_SCREEN_DOWN_SELECT:
|
|
|
|
|
case LFUN_LINE_BEGIN_SELECT:
|
|
|
|
|
case LFUN_LINE_END_SELECT:
|
|
|
|
|
case LFUN_WORD_FORWARD_SELECT:
|
|
|
|
|
case LFUN_WORD_BACKWARD_SELECT:
|
2007-10-28 20:35:57 +00:00
|
|
|
|
case LFUN_WORD_RIGHT_SELECT:
|
|
|
|
|
case LFUN_WORD_LEFT_SELECT:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_WORD_SELECT:
|
|
|
|
|
case LFUN_PARAGRAPH_UP:
|
|
|
|
|
case LFUN_PARAGRAPH_DOWN:
|
|
|
|
|
case LFUN_LINE_BEGIN:
|
2007-11-25 18:34:37 +00:00
|
|
|
|
case LFUN_LINE_BREAK:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_LINE_END:
|
2007-11-25 18:34:37 +00:00
|
|
|
|
case LFUN_NEW_LINE:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_CHAR_DELETE_FORWARD:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_DELETE_FORWARD_SKIP:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_CHAR_DELETE_BACKWARD:
|
|
|
|
|
case LFUN_DELETE_BACKWARD_SKIP:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_BREAK_PARAGRAPH:
|
|
|
|
|
case LFUN_BREAK_PARAGRAPH_SKIP:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_PARAGRAPH_SPACING:
|
|
|
|
|
case LFUN_INSET_INSERT:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_WORD_UPCASE:
|
|
|
|
|
case LFUN_WORD_LOWCASE:
|
|
|
|
|
case LFUN_WORD_CAPITALIZE:
|
|
|
|
|
case LFUN_CHARS_TRANSPOSE:
|
|
|
|
|
case LFUN_SERVER_GET_XY:
|
|
|
|
|
case LFUN_SERVER_SET_XY:
|
|
|
|
|
case LFUN_SERVER_GET_FONT:
|
|
|
|
|
case LFUN_SERVER_GET_LAYOUT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_LAYOUT:
|
|
|
|
|
case LFUN_DATE_INSERT:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_SELF_INSERT:
|
|
|
|
|
case LFUN_LINE_INSERT:
|
2007-11-23 02:10:00 +00:00
|
|
|
|
case LFUN_NEWPAGE_INSERT:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_PAGEBREAK_INSERT:
|
2006-11-25 15:09:01 +00:00
|
|
|
|
case LFUN_CLEARPAGE_INSERT:
|
|
|
|
|
case LFUN_CLEARDOUBLEPAGE_INSERT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_MATH_DISPLAY:
|
|
|
|
|
case LFUN_MATH_IMPORT_SELECTION:
|
|
|
|
|
case LFUN_MATH_MODE:
|
|
|
|
|
case LFUN_MATH_MACRO:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_MATH_MATRIX:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_MATH_DELIM:
|
2006-05-07 10:51:19 +00:00
|
|
|
|
case LFUN_MATH_BIGDELIM:
|
2007-06-24 15:35:45 +00:00
|
|
|
|
case LFUN_MATH_INSERT:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_MATH_SUBSCRIPT:
|
|
|
|
|
case LFUN_MATH_SUPERSCRIPT:
|
|
|
|
|
case LFUN_FONT_DEFAULT:
|
|
|
|
|
case LFUN_FONT_UNDERLINE:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_FONT_SIZE:
|
|
|
|
|
case LFUN_LANGUAGE:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_FONT_FREE_APPLY:
|
|
|
|
|
case LFUN_FONT_FREE_UPDATE:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_LAYOUT_PARAGRAPH:
|
|
|
|
|
case LFUN_PARAGRAPH_UPDATE:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_ACCENT_UMLAUT:
|
|
|
|
|
case LFUN_ACCENT_CIRCUMFLEX:
|
|
|
|
|
case LFUN_ACCENT_GRAVE:
|
|
|
|
|
case LFUN_ACCENT_ACUTE:
|
|
|
|
|
case LFUN_ACCENT_TILDE:
|
|
|
|
|
case LFUN_ACCENT_CEDILLA:
|
|
|
|
|
case LFUN_ACCENT_MACRON:
|
|
|
|
|
case LFUN_ACCENT_DOT:
|
|
|
|
|
case LFUN_ACCENT_UNDERDOT:
|
|
|
|
|
case LFUN_ACCENT_UNDERBAR:
|
|
|
|
|
case LFUN_ACCENT_CARON:
|
|
|
|
|
case LFUN_ACCENT_SPECIAL_CARON:
|
|
|
|
|
case LFUN_ACCENT_BREVE:
|
|
|
|
|
case LFUN_ACCENT_TIE:
|
|
|
|
|
case LFUN_ACCENT_HUNGARIAN_UMLAUT:
|
|
|
|
|
case LFUN_ACCENT_CIRCLE:
|
|
|
|
|
case LFUN_ACCENT_OGONEK:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_THESAURUS_ENTRY:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_PARAGRAPH_PARAMS_APPLY:
|
Add LFUN_PARAGRAPH_PARAMS (= paragraph-params), used for changing a paragraph's alignment, spacing, etc. This is complementary to LFUN_PARAGRAPH_PARAMS_APPLY, which sets the parameters. The difference is that APPLY over-rides all existing parameters, setting any not given to the default, whereas this one simply changes those that are given. So
paragraph-params \align right
will align the paragraph right, leaving spacing, etc, as they were, whereas
paragraph-params-apply \align right
will align the paragraph right but also reset all other parameters to defaults. Note, by the way, that this means that
paragraph-params-apply
sets everything to default.
Some new arguments have also been introduced. These are:
\indent
\indent-toggle
\spacing default
Of course, none of these are found in valid LyX files, but they are useful in menu bindings, etc.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19581 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-15 02:21:09 +00:00
|
|
|
|
case LFUN_PARAGRAPH_PARAMS:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_ESCAPE:
|
2006-05-05 20:23:12 +00:00
|
|
|
|
case LFUN_BUFFER_END:
|
|
|
|
|
case LFUN_BUFFER_BEGIN:
|
2006-05-08 18:09:19 +00:00
|
|
|
|
case LFUN_BUFFER_BEGIN_SELECT:
|
|
|
|
|
case LFUN_BUFFER_END_SELECT:
|
2006-10-22 18:47:19 +00:00
|
|
|
|
case LFUN_UNICODE_INSERT:
|
2004-11-30 01:59:49 +00:00
|
|
|
|
// these are handled in our dispatch()
|
2004-08-13 20:14:32 +00:00
|
|
|
|
enable = true;
|
|
|
|
|
break;
|
|
|
|
|
|
2004-03-18 13:57:20 +00:00
|
|
|
|
default:
|
2004-12-02 11:32:14 +00:00
|
|
|
|
return false;
|
2004-03-18 13:57:20 +00:00
|
|
|
|
}
|
2005-11-02 11:27:08 +00:00
|
|
|
|
|
2007-10-13 09:04:52 +00:00
|
|
|
|
if (code != NO_CODE
|
2005-11-02 11:27:08 +00:00
|
|
|
|
&& (cur.empty() || !cur.inset().insetAllowed(code)))
|
|
|
|
|
enable = false;
|
|
|
|
|
|
2004-03-18 13:57:20 +00:00
|
|
|
|
flag.enabled(enable);
|
|
|
|
|
return true;
|
2002-08-20 13:00:25 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
2007-04-29 23:33:02 +00:00
|
|
|
|
void Text::pasteString(Cursor & cur, docstring const & clip,
|
2007-01-06 15:33:07 +00:00
|
|
|
|
bool asParagraphs)
|
2007-01-03 07:30:50 +00:00
|
|
|
|
{
|
|
|
|
|
cur.clearSelection();
|
|
|
|
|
if (!clip.empty()) {
|
2007-10-18 11:51:17 +00:00
|
|
|
|
cur.recordUndo();
|
2007-01-06 15:33:07 +00:00
|
|
|
|
if (asParagraphs)
|
2007-01-03 07:30:50 +00:00
|
|
|
|
insertStringAsParagraphs(cur, clip);
|
|
|
|
|
else
|
|
|
|
|
insertStringAsLines(cur, clip);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|