2002-09-12 14:58:06 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file factory.cpp
|
2002-09-12 14:58:06 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2002-09-12 14:58:06 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-12 14:58:06 +00:00
|
|
|
*/
|
2002-08-27 10:14:56 +00:00
|
|
|
|
2002-11-04 00:15:56 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2003-09-05 16:31:30 +00:00
|
|
|
#include "factory.h"
|
2003-09-09 11:24:33 +00:00
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Buffer.h"
|
|
|
|
#include "BufferParams.h"
|
2003-09-09 11:24:33 +00:00
|
|
|
#include "FloatList.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "FuncRequest.h"
|
2007-04-26 11:30:54 +00:00
|
|
|
#include "Lexer.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "LyX.h"
|
2007-11-07 23:34:45 +00:00
|
|
|
#include "TextClass.h"
|
2002-08-28 17:33:42 +00:00
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetBibitem.h"
|
|
|
|
#include "insets/InsetBibtex.h"
|
2009-05-17 21:28:35 +00:00
|
|
|
#include "insets/InsetBox.h"
|
|
|
|
#include "insets/InsetBranch.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetCaption.h"
|
2007-04-25 16:11:45 +00:00
|
|
|
#include "insets/InsetCitation.h"
|
2007-09-05 15:29:04 +00:00
|
|
|
#include "insets/InsetFlex.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetERT.h"
|
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
|
|
|
#include "insets/InsetListings.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetExternal.h"
|
|
|
|
#include "insets/InsetFloat.h"
|
|
|
|
#include "insets/InsetFloatList.h"
|
|
|
|
#include "insets/InsetFoot.h"
|
|
|
|
#include "insets/InsetGraphics.h"
|
2009-05-17 21:28:35 +00:00
|
|
|
#include "insets/InsetHyperlink.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetInclude.h"
|
|
|
|
#include "insets/InsetIndex.h"
|
2007-10-11 14:52:00 +00:00
|
|
|
#include "insets/InsetInfo.h"
|
2012-03-06 07:54:22 +00:00
|
|
|
#include "insets/InsetIPA.h"
|
2012-08-23 15:42:53 +00:00
|
|
|
#include "insets/InsetIPAMacro.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetLabel.h"
|
|
|
|
#include "insets/InsetLine.h"
|
|
|
|
#include "insets/InsetMarginal.h"
|
2008-03-26 08:10:01 +00:00
|
|
|
#include "insets/InsetNewline.h"
|
2008-03-25 09:26:03 +00:00
|
|
|
#include "insets/InsetNewpage.h"
|
2009-05-17 21:28:35 +00:00
|
|
|
#include "insets/InsetNomencl.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetNote.h"
|
2010-06-04 22:44:58 +00:00
|
|
|
#include "insets/InsetArgument.h"
|
2009-05-17 21:28:35 +00:00
|
|
|
#include "insets/InsetPhantom.h"
|
2010-03-28 13:47:50 +00:00
|
|
|
#include "insets/InsetPreview.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetRef.h"
|
2010-11-21 17:00:12 +00:00
|
|
|
#include "insets/InsetScript.h"
|
Fix bugs #8546 and #9055, and introduce new separator inset.
The algorithm used for breaking a paragraph in LaTeX export is changed
for avoiding spurious blank lines causing too much vertical space.
This change is tied to the introduction of a new inset (with two
different specializations) helping in either outputing LaTeX paragraph
breaks or separating environments in LyX. Both of the above goals were
previously achieved by the ---Separator--- layout and can now be
accomplished by the new inset in a more natural way. As an example,
after leaving an environment by hitting the Return key for two times,
a third return automatically inserts a parbreak inset, which is
equivalent to the old separator layout, i.e., it also introduces a
blank line in the output. If this blank line is not wanted, the
parbreak separator can be changed to a plain separator by a right
click of the mouse. Of course, an environment can still be separated
by the following one by using the Alt+P+Return shortcut (or the
corresponding menu key), but now the plain separator inset is used
instead of the old separator layout, such that no blank line occurs in
the LaTeX output.
Old documents are converted such that the LaTeX output remains unchanged.
As a result of this conversion, the old separator layout is replaced by
the new parbreak inset, which may also appear in places where the old
algorithm was introducing blank lines while the new one is not.
Note that not all blank lines were actually affecting the LaTeX output,
because a blank line is simply ignored by the TeX engine when it occurs
in the so called "vertical mode" (e.g., after an alignment environment).
The old ---Separator--- layout is now gone and old layout files using it
are also automatically converted.
Round trip conversions between old and new format should leave a document
unchanged. This means that the new behavior about paragraph breaking is
not "carried back" to the old format. Indeed, this would need introducing
special LaTeX commands in ERT that would accumulate in roundtrip
conversions, horribly cluttering the document. So, when converting a
modified document to old formats, the LaTeX output may slightly differ in
vertical spacing if the document is processed by an old version of LyX.
In other words, forward compatibility is guaranteed, but not backwards.
2014-05-10 21:25:11 +00:00
|
|
|
#include "insets/InsetSeparator.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetSpace.h"
|
|
|
|
#include "insets/InsetTabular.h"
|
|
|
|
#include "insets/InsetTOC.h"
|
|
|
|
#include "insets/InsetVSpace.h"
|
|
|
|
#include "insets/InsetWrap.h"
|
2004-01-26 10:13:15 +00:00
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "mathed/MathMacroTemplate.h"
|
|
|
|
#include "mathed/InsetMathHull.h"
|
2003-02-27 13:26:07 +00:00
|
|
|
|
2007-04-28 20:44:46 +00:00
|
|
|
#include "frontends/alert.h"
|
2007-04-18 12:59:07 +00:00
|
|
|
|
2007-11-29 07:04:28 +00:00
|
|
|
#include "support/debug.h"
|
2007-04-18 12:59:07 +00:00
|
|
|
#include "support/ExceptionMessage.h"
|
2008-04-30 08:26:40 +00:00
|
|
|
#include "support/lassert.h"
|
2016-06-02 20:58:52 +00:00
|
|
|
#include "support/lstrings.h"
|
|
|
|
#include "support/unique_ptr.h"
|
2003-10-01 16:27:36 +00:00
|
|
|
|
2004-07-24 10:55:30 +00:00
|
|
|
#include <sstream>
|
|
|
|
|
2016-06-02 20:58:52 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-12-12 19:57:42 +00:00
|
|
|
using namespace lyx::support;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
namespace Alert = frontend::Alert;
|
|
|
|
|
2003-09-05 22:17:02 +00:00
|
|
|
|
2009-11-08 15:53:21 +00:00
|
|
|
Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
2002-08-27 10:14:56 +00:00
|
|
|
{
|
2007-04-18 12:59:07 +00:00
|
|
|
try {
|
2003-03-11 11:52:05 +00:00
|
|
|
|
2010-04-09 19:00:42 +00:00
|
|
|
switch (cmd.action()) {
|
2003-10-27 12:41:26 +00:00
|
|
|
|
2008-03-25 09:26:03 +00:00
|
|
|
case LFUN_NEWPAGE_INSERT: {
|
|
|
|
string const name = cmd.getArg(0);
|
|
|
|
InsetNewpageParams inp;
|
|
|
|
if (name.empty() || name == "newpage")
|
|
|
|
inp.kind = InsetNewpageParams::NEWPAGE;
|
|
|
|
else if (name == "pagebreak")
|
|
|
|
inp.kind = InsetNewpageParams::PAGEBREAK;
|
|
|
|
else if (name == "clearpage")
|
|
|
|
inp.kind = InsetNewpageParams::CLEARPAGE;
|
|
|
|
else if (name == "cleardoublepage")
|
|
|
|
inp.kind = InsetNewpageParams::CLEARDOUBLEPAGE;
|
|
|
|
return new InsetNewpage(inp);
|
|
|
|
}
|
2003-11-12 14:38:26 +00:00
|
|
|
|
Fix bugs #8546 and #9055, and introduce new separator inset.
The algorithm used for breaking a paragraph in LaTeX export is changed
for avoiding spurious blank lines causing too much vertical space.
This change is tied to the introduction of a new inset (with two
different specializations) helping in either outputing LaTeX paragraph
breaks or separating environments in LyX. Both of the above goals were
previously achieved by the ---Separator--- layout and can now be
accomplished by the new inset in a more natural way. As an example,
after leaving an environment by hitting the Return key for two times,
a third return automatically inserts a parbreak inset, which is
equivalent to the old separator layout, i.e., it also introduces a
blank line in the output. If this blank line is not wanted, the
parbreak separator can be changed to a plain separator by a right
click of the mouse. Of course, an environment can still be separated
by the following one by using the Alt+P+Return shortcut (or the
corresponding menu key), but now the plain separator inset is used
instead of the old separator layout, such that no blank line occurs in
the LaTeX output.
Old documents are converted such that the LaTeX output remains unchanged.
As a result of this conversion, the old separator layout is replaced by
the new parbreak inset, which may also appear in places where the old
algorithm was introducing blank lines while the new one is not.
Note that not all blank lines were actually affecting the LaTeX output,
because a blank line is simply ignored by the TeX engine when it occurs
in the so called "vertical mode" (e.g., after an alignment environment).
The old ---Separator--- layout is now gone and old layout files using it
are also automatically converted.
Round trip conversions between old and new format should leave a document
unchanged. This means that the new behavior about paragraph breaking is
not "carried back" to the old format. Indeed, this would need introducing
special LaTeX commands in ERT that would accumulate in roundtrip
conversions, horribly cluttering the document. So, when converting a
modified document to old formats, the LaTeX output may slightly differ in
vertical spacing if the document is processed by an old version of LyX.
In other words, forward compatibility is guaranteed, but not backwards.
2014-05-10 21:25:11 +00:00
|
|
|
case LFUN_SEPARATOR_INSERT: {
|
|
|
|
string const name = cmd.getArg(0);
|
|
|
|
InsetSeparatorParams inp;
|
|
|
|
if (name.empty() || name == "plain")
|
|
|
|
inp.kind = InsetSeparatorParams::PLAIN;
|
|
|
|
else if (name == "parbreak")
|
|
|
|
inp.kind = InsetSeparatorParams::PARBREAK;
|
2016-04-06 03:25:27 +00:00
|
|
|
else if (name == "latexpar")
|
|
|
|
inp.kind = InsetSeparatorParams::LATEXPAR;
|
Fix bugs #8546 and #9055, and introduce new separator inset.
The algorithm used for breaking a paragraph in LaTeX export is changed
for avoiding spurious blank lines causing too much vertical space.
This change is tied to the introduction of a new inset (with two
different specializations) helping in either outputing LaTeX paragraph
breaks or separating environments in LyX. Both of the above goals were
previously achieved by the ---Separator--- layout and can now be
accomplished by the new inset in a more natural way. As an example,
after leaving an environment by hitting the Return key for two times,
a third return automatically inserts a parbreak inset, which is
equivalent to the old separator layout, i.e., it also introduces a
blank line in the output. If this blank line is not wanted, the
parbreak separator can be changed to a plain separator by a right
click of the mouse. Of course, an environment can still be separated
by the following one by using the Alt+P+Return shortcut (or the
corresponding menu key), but now the plain separator inset is used
instead of the old separator layout, such that no blank line occurs in
the LaTeX output.
Old documents are converted such that the LaTeX output remains unchanged.
As a result of this conversion, the old separator layout is replaced by
the new parbreak inset, which may also appear in places where the old
algorithm was introducing blank lines while the new one is not.
Note that not all blank lines were actually affecting the LaTeX output,
because a blank line is simply ignored by the TeX engine when it occurs
in the so called "vertical mode" (e.g., after an alignment environment).
The old ---Separator--- layout is now gone and old layout files using it
are also automatically converted.
Round trip conversions between old and new format should leave a document
unchanged. This means that the new behavior about paragraph breaking is
not "carried back" to the old format. Indeed, this would need introducing
special LaTeX commands in ERT that would accumulate in roundtrip
conversions, horribly cluttering the document. So, when converting a
modified document to old formats, the LaTeX output may slightly differ in
vertical spacing if the document is processed by an old version of LyX.
In other words, forward compatibility is guaranteed, but not backwards.
2014-05-10 21:25:11 +00:00
|
|
|
else {
|
|
|
|
lyxerr << "Wrong argument for LyX function 'separator-insert'." << endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return new InsetSeparator(inp);
|
|
|
|
}
|
|
|
|
|
2007-09-05 18:40:56 +00:00
|
|
|
case LFUN_FLEX_INSERT: {
|
2007-04-18 12:59:07 +00:00
|
|
|
string s = cmd.getArg(0);
|
2008-04-05 20:24:05 +00:00
|
|
|
return new InsetFlex(buf, s);
|
2007-04-18 12:59:07 +00:00
|
|
|
}
|
2003-10-27 12:41:26 +00:00
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_NOTE_INSERT: {
|
|
|
|
string arg = cmd.getArg(0);
|
|
|
|
if (arg.empty())
|
|
|
|
arg = "Note";
|
2008-03-04 22:28:18 +00:00
|
|
|
return new InsetNote(buf, arg);
|
2007-04-18 12:59:07 +00:00
|
|
|
}
|
2003-10-27 12:41:26 +00:00
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_BOX_INSERT: {
|
|
|
|
string arg = cmd.getArg(0);
|
|
|
|
if (arg.empty())
|
|
|
|
arg = "Boxed";
|
2008-03-04 22:28:18 +00:00
|
|
|
return new InsetBox(buf, arg);
|
2007-04-18 12:59:07 +00:00
|
|
|
}
|
2003-08-17 11:28:23 +00:00
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_BRANCH_INSERT: {
|
|
|
|
docstring arg = cmd.argument();
|
|
|
|
if (arg.empty())
|
|
|
|
arg = from_ascii("none");
|
2008-03-04 22:28:18 +00:00
|
|
|
return new InsetBranch(buf, InsetBranchParams(arg));
|
2007-04-18 12:59:07 +00:00
|
|
|
}
|
2003-02-26 19:28:38 +00:00
|
|
|
|
2009-01-30 00:56:37 +00:00
|
|
|
case LFUN_PHANTOM_INSERT: {
|
|
|
|
string arg = cmd.getArg(0);
|
|
|
|
if (arg.empty())
|
|
|
|
arg = "Phantom";
|
|
|
|
return new InsetPhantom(buf, arg);
|
|
|
|
}
|
|
|
|
|
2012-08-23 15:42:53 +00:00
|
|
|
case LFUN_IPAMACRO_INSERT: {
|
|
|
|
string const arg1 = cmd.getArg(0);
|
|
|
|
string const arg2 = cmd.getArg(1);
|
|
|
|
if (arg1 != "deco") {
|
|
|
|
LYXERR0("LFUN_IPAMACRO_INSERT: wrong argument");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return new InsetIPADeco(buf, arg2);
|
|
|
|
}
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_ERT_INSERT:
|
2008-03-04 22:28:18 +00:00
|
|
|
return new InsetERT(buf);
|
2003-02-26 19:28:38 +00:00
|
|
|
|
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:
|
2008-03-04 22:28:18 +00:00
|
|
|
return new InsetListings(buf);
|
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
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_FOOTNOTE_INSERT:
|
2008-03-04 22:28:18 +00:00
|
|
|
return new InsetFoot(buf);
|
2003-02-26 19:28:38 +00:00
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_MARGINALNOTE_INSERT:
|
2008-03-04 22:28:18 +00:00
|
|
|
return new InsetMarginal(buf);
|
2003-02-26 19:28:38 +00:00
|
|
|
|
2012-11-19 13:21:02 +00:00
|
|
|
case LFUN_ARGUMENT_INSERT: {
|
|
|
|
string arg = cmd.getArg(0);
|
|
|
|
if (arg.empty()) {
|
|
|
|
LYXERR0("argument-insert needs an argument!");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return new InsetArgument(buf, arg);
|
|
|
|
}
|
2003-02-26 19:28:38 +00:00
|
|
|
|
2010-11-26 17:14:21 +00:00
|
|
|
case LFUN_FLOAT_INSERT: {
|
|
|
|
string argument = to_utf8(cmd.argument());
|
|
|
|
if (!argument.empty()) {
|
|
|
|
if (!contains(argument, "sideways")) {
|
|
|
|
if (!contains(argument, "wide"))
|
|
|
|
argument += "\nwide false";
|
|
|
|
argument += "\nsideways false";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new InsetFloat(buf, argument);
|
|
|
|
}
|
2003-02-26 19:28:38 +00:00
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_FLOAT_WIDE_INSERT: {
|
2010-11-26 17:14:21 +00:00
|
|
|
string argument = to_utf8(cmd.argument());
|
|
|
|
if (!argument.empty()) {
|
|
|
|
if (!contains(argument, "sideways")) {
|
|
|
|
if (!contains(argument, "wide"))
|
|
|
|
argument += "\nwide true";
|
|
|
|
argument += "\nsideways false";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
InsetFloat * fl = new InsetFloat(buf, argument);
|
2010-02-10 17:33:39 +00:00
|
|
|
fl->setWide(true);
|
|
|
|
return fl;
|
2007-04-18 12:59:07 +00:00
|
|
|
}
|
2006-11-04 17:55:36 +00:00
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_WRAP_INSERT: {
|
|
|
|
string const argument = to_utf8(cmd.argument());
|
2007-10-03 21:07:01 +00:00
|
|
|
if (argument == "figure" || argument == "table")
|
2008-03-04 22:28:18 +00:00
|
|
|
return new InsetWrap(buf, argument);
|
2007-09-09 23:47:22 +00:00
|
|
|
lyxerr << "Non-existent wrapfig type: " << argument << endl;
|
2005-07-15 22:10:25 +00:00
|
|
|
return 0;
|
2007-04-18 12:59:07 +00:00
|
|
|
}
|
2003-02-26 19:28:38 +00:00
|
|
|
|
2009-04-16 07:29:01 +00:00
|
|
|
case LFUN_INDEX_INSERT: {
|
|
|
|
docstring arg = cmd.argument();
|
|
|
|
return new InsetIndex(buf, InsetIndexParams(arg));
|
|
|
|
}
|
2003-02-26 19:28:38 +00:00
|
|
|
|
2012-03-06 07:54:22 +00:00
|
|
|
case LFUN_IPA_INSERT:
|
|
|
|
return new InsetIPA(buf);
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_NOMENCL_INSERT: {
|
2007-10-19 17:22:55 +00:00
|
|
|
InsetCommandParams icp(NOMENCL_CODE);
|
2007-11-03 17:37:37 +00:00
|
|
|
icp["symbol"] = cmd.argument();
|
2009-11-08 16:10:34 +00:00
|
|
|
return new InsetNomencl(buf, icp);
|
2007-04-18 12:59:07 +00:00
|
|
|
}
|
2003-02-26 19:28:38 +00:00
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_TABULAR_INSERT: {
|
|
|
|
if (cmd.argument().empty())
|
|
|
|
return 0;
|
2007-12-12 19:28:07 +00:00
|
|
|
istringstream ss(to_utf8(cmd.argument()));
|
2007-04-18 12:59:07 +00:00
|
|
|
int r = 0, c = 0;
|
|
|
|
ss >> r >> c;
|
|
|
|
if (r <= 0)
|
|
|
|
r = 2;
|
|
|
|
if (c <= 0)
|
|
|
|
c = 2;
|
2007-11-03 17:37:37 +00:00
|
|
|
return new InsetTabular(buf, r, c);
|
2007-04-18 12:59:07 +00:00
|
|
|
}
|
2006-11-04 17:55:36 +00:00
|
|
|
|
2012-12-30 17:29:02 +00:00
|
|
|
case LFUN_CAPTION_INSERT: {
|
|
|
|
string arg = cmd.getArg(0);
|
|
|
|
if (arg.empty())
|
|
|
|
arg = "Standard";
|
|
|
|
return new InsetCaption(buf, arg);
|
|
|
|
}
|
2002-08-29 13:05:55 +00:00
|
|
|
|
2009-04-16 07:29:01 +00:00
|
|
|
case LFUN_INDEX_PRINT: {
|
|
|
|
InsetCommandParams icp(INDEX_PRINT_CODE);
|
|
|
|
icp["type"] = cmd.argument();
|
2009-11-08 16:10:34 +00:00
|
|
|
return new InsetPrintIndex(buf, icp);
|
2009-04-16 07:29:01 +00:00
|
|
|
}
|
2003-03-13 11:00:31 +00:00
|
|
|
|
2009-05-22 08:31:43 +00:00
|
|
|
case LFUN_NOMENCL_PRINT: {
|
|
|
|
InsetCommandParams icp(NOMENCL_PRINT_CODE);
|
|
|
|
icp["set_width"] = from_ascii("auto");
|
2009-11-08 16:10:34 +00:00
|
|
|
return new InsetPrintNomencl(buf, icp);
|
2009-05-22 08:31:43 +00:00
|
|
|
}
|
2002-08-27 10:14:56 +00:00
|
|
|
|
2008-04-18 15:54:05 +00:00
|
|
|
case LFUN_INFO_INSERT: {
|
|
|
|
InsetInfo * inset = new InsetInfo(buf, to_utf8(cmd.argument()));
|
|
|
|
inset->updateInfo();
|
|
|
|
return inset;
|
|
|
|
}
|
2003-03-05 14:59:37 +00:00
|
|
|
|
2010-03-28 13:47:50 +00:00
|
|
|
case LFUN_PREVIEW_INSERT:
|
|
|
|
return new InsetPreview(buf);
|
|
|
|
|
2010-11-23 20:09:08 +00:00
|
|
|
case LFUN_SCRIPT_INSERT: {
|
|
|
|
InsetScriptParams isp;
|
|
|
|
InsetScript::string2params("script script " + to_utf8(cmd.argument()), isp);
|
|
|
|
return new InsetScript(buf, isp);
|
|
|
|
}
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_INSET_INSERT: {
|
|
|
|
string const name = cmd.getArg(0);
|
2007-10-17 12:50:25 +00:00
|
|
|
InsetCode code = insetCode(name);
|
|
|
|
switch (code) {
|
|
|
|
case NO_CODE:
|
|
|
|
lyxerr << "No such inset '" << name << "'.";
|
|
|
|
return 0;
|
|
|
|
|
2007-10-19 17:22:55 +00:00
|
|
|
case BIBITEM_CODE: {
|
|
|
|
InsetCommandParams icp(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
More cache fixing. Similar fix as for InsetBibtex, and I've renamed the key routine.
Unfortunately, we can't do a one-short fix for InsetCommand, requiring that it take
a Buffer & in the constructor, due to problems in mathed, specifically, here:
void InsetMathHull::label(row_type row, docstring const & label)
{
...
label_[row] = new InsetLabel(p);
if (buffer_)
label_[row]->setBuffer(buffer());
}
If InsetLabel has to have a Buffer, then buffer_ has to be set, which means InsetMathHull needs a Buffer. But then truckloads of these are created in Parser, where we don't really seem to have access to a Buffer.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25137 a592a061-630c-0410-9148-cb99ea01b6c8
2008-06-05 06:55:34 +00:00
|
|
|
return new InsetBibitem(buf, icp);
|
2007-10-19 17:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case BIBTEX_CODE: {
|
|
|
|
InsetCommandParams icp(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
2008-06-05 06:42:53 +00:00
|
|
|
return new InsetBibtex(buf, icp);
|
2007-10-19 17:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case CITE_CODE: {
|
|
|
|
InsetCommandParams icp(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
2009-11-08 16:10:34 +00:00
|
|
|
return new InsetCitation(buf, icp);
|
2007-10-19 17:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case ERT_CODE: {
|
2008-03-27 23:37:59 +00:00
|
|
|
return new InsetERT(buf,
|
|
|
|
InsetERT::string2params(to_utf8(cmd.argument())));
|
2007-10-19 17:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case EXTERNAL_CODE: {
|
|
|
|
InsetExternalParams iep;
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetExternal::string2params(to_utf8(cmd.argument()), *buf, iep);
|
2016-06-02 20:58:52 +00:00
|
|
|
auto inset = make_unique<InsetExternal>(buf);
|
2009-11-08 15:53:21 +00:00
|
|
|
inset->setBuffer(*buf);
|
2008-02-27 20:43:16 +00:00
|
|
|
inset->setParams(iep);
|
2007-10-19 17:22:55 +00:00
|
|
|
return inset.release();
|
|
|
|
}
|
|
|
|
|
|
|
|
case GRAPHICS_CODE: {
|
|
|
|
InsetGraphicsParams igp;
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetGraphics::string2params(to_utf8(cmd.argument()), *buf, igp);
|
2016-06-02 20:58:52 +00:00
|
|
|
auto inset = make_unique<InsetGraphics>(buf);
|
2007-10-19 17:22:55 +00:00
|
|
|
inset->setParams(igp);
|
|
|
|
return inset.release();
|
|
|
|
}
|
|
|
|
|
|
|
|
case HYPERLINK_CODE: {
|
|
|
|
InsetCommandParams icp(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
2009-11-08 16:10:34 +00:00
|
|
|
return new InsetHyperlink(buf, icp);
|
2007-10-19 17:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case INCLUDE_CODE: {
|
2007-10-23 15:02:15 +00:00
|
|
|
InsetCommandParams icp(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
2009-11-08 16:10:34 +00:00
|
|
|
return new InsetInclude(buf, icp);
|
2007-10-19 17:22:55 +00:00
|
|
|
}
|
|
|
|
|
2009-04-16 07:29:01 +00:00
|
|
|
case INDEX_CODE: {
|
|
|
|
docstring arg = cmd.argument();
|
|
|
|
return new InsetIndex(buf, InsetIndexParams(arg));
|
|
|
|
}
|
|
|
|
|
|
|
|
case INDEX_PRINT_CODE: {
|
|
|
|
InsetCommandParams icp(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
2009-11-08 16:10:34 +00:00
|
|
|
return new InsetPrintIndex(buf, icp);
|
2009-04-16 07:29:01 +00:00
|
|
|
}
|
2007-10-19 17:22:55 +00:00
|
|
|
|
2010-09-04 13:13:44 +00:00
|
|
|
case LABEL_CODE: {
|
2007-10-19 17:22:55 +00:00
|
|
|
InsetCommandParams icp(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
2010-09-04 13:13:44 +00:00
|
|
|
return new InsetLabel(buf, icp);
|
2007-10-19 17:22:55 +00:00
|
|
|
}
|
|
|
|
|
2010-09-07 00:41:00 +00:00
|
|
|
case LINE_CODE: {
|
|
|
|
InsetCommandParams icp(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
2010-09-07 00:41:00 +00:00
|
|
|
return new InsetLine(buf, icp);
|
|
|
|
}
|
|
|
|
|
2010-09-04 13:13:44 +00:00
|
|
|
case LISTINGS_CODE: {
|
|
|
|
InsetListingsParams par;
|
|
|
|
InsetListings::string2params(to_utf8(cmd.argument()), par);
|
|
|
|
return new InsetListings(buf, par);
|
|
|
|
}
|
|
|
|
|
|
|
|
case NOMENCL_CODE: {
|
2007-10-19 17:22:55 +00:00
|
|
|
InsetCommandParams icp(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
2010-09-04 13:13:44 +00:00
|
|
|
return new InsetNomencl(buf, icp);
|
2007-10-19 17:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case REF_CODE: {
|
|
|
|
InsetCommandParams icp(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
2008-03-04 22:28:18 +00:00
|
|
|
return new InsetRef(buf, icp);
|
2007-10-19 17:22:55 +00:00
|
|
|
}
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
|
2010-11-21 17:00:12 +00:00
|
|
|
case SCRIPT_CODE: {
|
|
|
|
InsetScriptParams isp;
|
|
|
|
InsetScript::string2params(to_utf8(cmd.argument()), isp);
|
|
|
|
return new InsetScript(buf, isp);
|
|
|
|
}
|
|
|
|
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
case SPACE_CODE: {
|
|
|
|
InsetSpaceParams isp;
|
2008-03-27 22:26:24 +00:00
|
|
|
InsetSpace::string2params(to_utf8(cmd.argument()), isp);
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
return new InsetSpace(isp);
|
|
|
|
}
|
2007-10-19 17:22:55 +00:00
|
|
|
|
|
|
|
case TOC_CODE: {
|
|
|
|
InsetCommandParams icp(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), icp);
|
2009-11-08 16:10:34 +00:00
|
|
|
return new InsetTOC(buf, icp);
|
2007-10-19 17:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case VSPACE_CODE: {
|
|
|
|
VSpace vspace;
|
2008-03-27 00:21:35 +00:00
|
|
|
InsetVSpace::string2params(to_utf8(cmd.argument()), vspace);
|
2007-10-19 17:22:55 +00:00
|
|
|
return new InsetVSpace(vspace);
|
|
|
|
}
|
2010-03-28 13:47:50 +00:00
|
|
|
|
|
|
|
case PREVIEW_CODE:
|
|
|
|
return new InsetPreview(buf);
|
2007-10-19 17:22:55 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
lyxerr << "Inset '" << name << "' not permitted with LFUN_INSET_INSERT."
|
2007-12-12 19:28:07 +00:00
|
|
|
<< endl;
|
2007-10-19 17:22:55 +00:00
|
|
|
return 0;
|
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
}
|
2008-11-17 11:46:07 +00:00
|
|
|
} //end LFUN_INSET_INSERT
|
2003-02-27 13:26:07 +00:00
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
case LFUN_SPACE_INSERT: {
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
string const name = cmd.getArg(0);
|
|
|
|
string const len = cmd.getArg(1);
|
|
|
|
if (name.empty()) {
|
|
|
|
lyxerr << "LyX function 'space-insert' needs an argument." << endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
InsetSpaceParams isp;
|
2008-12-22 18:12:32 +00:00
|
|
|
// The tests for isp.math might be disabled after a file format change
|
2007-04-18 12:59:07 +00:00
|
|
|
if (name == "normal")
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
isp.kind = InsetSpaceParams::NORMAL;
|
|
|
|
else if (name == "protected")
|
|
|
|
isp.kind = InsetSpaceParams::PROTECTED;
|
2011-07-23 18:40:21 +00:00
|
|
|
else if (name == "visible")
|
|
|
|
isp.kind = InsetSpaceParams::VISIBLE;
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
else if (name == "thin")
|
|
|
|
isp.kind = InsetSpaceParams::THIN;
|
2008-12-22 18:12:32 +00:00
|
|
|
else if (isp.math && name == "med")
|
|
|
|
isp.kind = InsetSpaceParams::MEDIUM;
|
|
|
|
else if (isp.math && name == "thick")
|
|
|
|
isp.kind = InsetSpaceParams::THICK;
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
else if (name == "quad")
|
|
|
|
isp.kind = InsetSpaceParams::QUAD;
|
|
|
|
else if (name == "qquad")
|
|
|
|
isp.kind = InsetSpaceParams::QQUAD;
|
|
|
|
else if (name == "enspace")
|
|
|
|
isp.kind = InsetSpaceParams::ENSPACE;
|
|
|
|
else if (name == "enskip")
|
|
|
|
isp.kind = InsetSpaceParams::ENSKIP;
|
|
|
|
else if (name == "negthinspace")
|
|
|
|
isp.kind = InsetSpaceParams::NEGTHIN;
|
2011-08-29 14:07:30 +00:00
|
|
|
else if (name == "negmedspace")
|
2008-12-22 18:12:32 +00:00
|
|
|
isp.kind = InsetSpaceParams::NEGMEDIUM;
|
2011-08-29 14:07:30 +00:00
|
|
|
else if (name == "negthickspace")
|
2008-12-22 18:12:32 +00:00
|
|
|
isp.kind = InsetSpaceParams::NEGTHICK;
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
else if (name == "hfill")
|
|
|
|
isp.kind = InsetSpaceParams::HFILL;
|
2008-03-18 12:11:28 +00:00
|
|
|
else if (name == "hfill*")
|
|
|
|
isp.kind = InsetSpaceParams::HFILL_PROTECTED;
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
else if (name == "dotfill")
|
|
|
|
isp.kind = InsetSpaceParams::DOTFILL;
|
|
|
|
else if (name == "hrulefill")
|
|
|
|
isp.kind = InsetSpaceParams::HRULEFILL;
|
|
|
|
else if (name == "hspace") {
|
2009-07-21 11:51:43 +00:00
|
|
|
if (len.empty() || !isValidGlueLength(len)) {
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
lyxerr << "LyX function 'space-insert hspace' "
|
|
|
|
<< "needs a valid length argument." << endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
isp.kind = InsetSpaceParams::CUSTOM;
|
2009-07-21 11:51:43 +00:00
|
|
|
isp.length = GlueLength(len);
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
}
|
|
|
|
else if (name == "hspace*") {
|
2009-07-21 11:51:43 +00:00
|
|
|
if (len.empty() || !isValidGlueLength(len)) {
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
lyxerr << "LyX function 'space-insert hspace*' "
|
|
|
|
<< "needs a valid length argument." << endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
isp.kind = InsetSpaceParams::CUSTOM_PROTECTED;
|
2009-07-21 11:51:43 +00:00
|
|
|
isp.length = GlueLength(len);
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
lyxerr << "Wrong argument for LyX function 'space-insert'." << endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return new InsetSpace(isp);
|
2007-04-18 12:59:07 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-11-04 17:55:36 +00:00
|
|
|
|
2007-04-18 12:59:07 +00:00
|
|
|
default:
|
|
|
|
break;
|
2003-02-27 13:26:07 +00:00
|
|
|
}
|
2003-05-22 10:40:57 +00:00
|
|
|
|
2007-12-12 19:57:42 +00:00
|
|
|
} catch (ExceptionMessage const & message) {
|
|
|
|
if (message.type_ == ErrorException) {
|
2007-12-16 11:34:29 +00:00
|
|
|
// This should never happen!
|
2007-04-18 12:59:07 +00:00
|
|
|
Alert::error(message.title_, message.details_);
|
2008-07-14 08:35:00 +00:00
|
|
|
lyx_exit(1);
|
2007-12-12 19:57:42 +00:00
|
|
|
} else if (message.type_ == WarningException) {
|
2007-04-18 12:59:07 +00:00
|
|
|
Alert::warning(message.title_, message.details_);
|
|
|
|
return 0;
|
|
|
|
}
|
2003-05-22 10:40:57 +00:00
|
|
|
}
|
|
|
|
|
2002-08-27 10:14:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2003-03-12 11:52:23 +00:00
|
|
|
|
2008-03-27 07:26:37 +00:00
|
|
|
|
2009-11-08 15:53:21 +00:00
|
|
|
Inset * createInset(Buffer * buf, FuncRequest const & cmd)
|
2008-02-23 22:32:33 +00:00
|
|
|
{
|
|
|
|
Inset * inset = createInsetHelper(buf, cmd);
|
|
|
|
if (inset)
|
2009-11-08 15:53:21 +00:00
|
|
|
inset->setBuffer(*buf);
|
2008-02-23 22:32:33 +00:00
|
|
|
return inset;
|
|
|
|
}
|
2003-03-12 11:52:23 +00:00
|
|
|
|
2008-03-27 07:26:37 +00:00
|
|
|
|
2009-11-08 15:53:21 +00:00
|
|
|
Inset * readInset(Lexer & lex, Buffer * buf)
|
2003-03-12 11:52:23 +00:00
|
|
|
{
|
|
|
|
// consistency check
|
2008-03-27 07:26:37 +00:00
|
|
|
if (lex.getString() != "\\begin_inset")
|
|
|
|
LYXERR0("Buffer::readInset: Consistency check failed.");
|
2003-03-12 11:52:23 +00:00
|
|
|
|
2016-06-02 20:58:52 +00:00
|
|
|
unique_ptr<Inset> inset;
|
2003-03-12 11:52:23 +00:00
|
|
|
|
2008-04-05 19:27:02 +00:00
|
|
|
string tmptok;
|
|
|
|
lex >> tmptok;
|
2003-03-12 11:52:23 +00:00
|
|
|
|
|
|
|
// test the different insets
|
2007-10-17 12:50:25 +00:00
|
|
|
|
2008-03-27 07:26:37 +00:00
|
|
|
// FIXME It would be better if we did not have this branch and could
|
|
|
|
// just do one massive switch for all insets. But at present, it's
|
|
|
|
// easier to do it this way, and we can't do the massive switch until
|
|
|
|
// the conversion mentioned below. Note that if we do want to do a
|
|
|
|
// single switch, we need to remove this "CommandInset" line---or
|
|
|
|
// replace it with a single "InsetType" line that would be used in all
|
|
|
|
// insets.
|
2007-09-27 18:24:18 +00:00
|
|
|
if (tmptok == "CommandInset") {
|
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
|
|
|
lex.next();
|
2007-09-27 18:24:18 +00:00
|
|
|
string const insetType = lex.getString();
|
|
|
|
lex.pushToken(insetType);
|
2007-10-17 12:50:25 +00:00
|
|
|
|
|
|
|
InsetCode const code = insetCode(insetType);
|
|
|
|
|
|
|
|
//FIXME If we do the one massive switch, we cannot do this here, since
|
|
|
|
//we do not know in advance that we're dealing with a command inset.
|
|
|
|
//Worst case, we could put it in each case below. Better, we could
|
|
|
|
//pass the lexer to the constructor and let the params be built there.
|
2007-10-19 17:22:55 +00:00
|
|
|
InsetCommandParams inscmd(code);
|
2015-05-20 13:49:15 +00:00
|
|
|
inscmd.Read(lex, buf);
|
2003-03-12 11:52:23 +00:00
|
|
|
|
2007-10-17 12:50:25 +00:00
|
|
|
switch (code) {
|
|
|
|
case BIBITEM_CODE:
|
More cache fixing. Similar fix as for InsetBibtex, and I've renamed the key routine.
Unfortunately, we can't do a one-short fix for InsetCommand, requiring that it take
a Buffer & in the constructor, due to problems in mathed, specifically, here:
void InsetMathHull::label(row_type row, docstring const & label)
{
...
label_[row] = new InsetLabel(p);
if (buffer_)
label_[row]->setBuffer(buffer());
}
If InsetLabel has to have a Buffer, then buffer_ has to be set, which means InsetMathHull needs a Buffer. But then truckloads of these are created in Parser, where we don't really seem to have access to a Buffer.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25137 a592a061-630c-0410-9148-cb99ea01b6c8
2008-06-05 06:55:34 +00:00
|
|
|
inset.reset(new InsetBibitem(buf, inscmd));
|
2007-10-17 12:50:25 +00:00
|
|
|
break;
|
|
|
|
case BIBTEX_CODE:
|
2008-06-05 06:42:53 +00:00
|
|
|
inset.reset(new InsetBibtex(buf, inscmd));
|
2007-10-17 12:50:25 +00:00
|
|
|
break;
|
|
|
|
case CITE_CODE:
|
2009-11-08 16:10:34 +00:00
|
|
|
inset.reset(new InsetCitation(buf, inscmd));
|
2007-10-17 12:50:25 +00:00
|
|
|
break;
|
|
|
|
case HYPERLINK_CODE:
|
2009-11-08 16:10:34 +00:00
|
|
|
inset.reset(new InsetHyperlink(buf, inscmd));
|
2007-10-17 12:50:25 +00:00
|
|
|
break;
|
|
|
|
case INCLUDE_CODE:
|
2009-11-08 16:10:34 +00:00
|
|
|
inset.reset(new InsetInclude(buf, inscmd));
|
2007-10-17 12:50:25 +00:00
|
|
|
break;
|
|
|
|
case INDEX_PRINT_CODE:
|
2009-11-08 16:10:34 +00:00
|
|
|
inset.reset(new InsetPrintIndex(buf, inscmd));
|
2007-10-17 12:50:25 +00:00
|
|
|
break;
|
|
|
|
case LABEL_CODE:
|
2009-11-08 16:10:34 +00:00
|
|
|
inset.reset(new InsetLabel(buf, inscmd));
|
2007-10-17 12:50:25 +00:00
|
|
|
break;
|
2010-09-07 00:41:00 +00:00
|
|
|
case LINE_CODE:
|
|
|
|
inset.reset(new InsetLine(buf, inscmd));
|
|
|
|
break;
|
2007-10-17 12:50:25 +00:00
|
|
|
case NOMENCL_CODE:
|
2009-11-08 16:10:34 +00:00
|
|
|
inset.reset(new InsetNomencl(buf, inscmd));
|
2007-10-17 12:50:25 +00:00
|
|
|
break;
|
|
|
|
case NOMENCL_PRINT_CODE:
|
2009-11-08 16:10:34 +00:00
|
|
|
inset.reset(new InsetPrintNomencl(buf, inscmd));
|
2007-10-17 12:50:25 +00:00
|
|
|
break;
|
|
|
|
case REF_CODE:
|
2008-04-03 18:40:46 +00:00
|
|
|
if (inscmd["name"].empty() && inscmd["reference"].empty())
|
|
|
|
return 0;
|
|
|
|
inset.reset(new InsetRef(buf, inscmd));
|
2007-10-17 12:50:25 +00:00
|
|
|
break;
|
|
|
|
case TOC_CODE:
|
2009-11-08 16:10:34 +00:00
|
|
|
inset.reset(new InsetTOC(buf, inscmd));
|
2007-10-17 12:50:25 +00:00
|
|
|
break;
|
|
|
|
case NO_CODE:
|
|
|
|
default:
|
|
|
|
lyxerr << "unknown CommandInset '" << insetType
|
2007-12-12 19:28:07 +00:00
|
|
|
<< "'" << endl;
|
2007-10-17 12:50:25 +00:00
|
|
|
while (lex.isOK() && lex.getString() != "\\end_inset")
|
|
|
|
lex.next();
|
|
|
|
return 0;
|
2003-03-12 11:52:23 +00:00
|
|
|
}
|
2009-11-08 15:53:21 +00:00
|
|
|
inset->setBuffer(*buf);
|
2016-11-05 00:00:44 +00:00
|
|
|
} else {
|
2012-10-27 13:45:27 +00:00
|
|
|
// FIXME This branch should be made to use inset codes
|
|
|
|
// as the preceding branch does. Unfortunately, that
|
|
|
|
// will take some doing. It requires converting the
|
|
|
|
// representation of the insets in LyX files so that
|
|
|
|
// they use the inset names listed in Inset.cpp. Then,
|
|
|
|
// as above, the inset names can be translated to
|
|
|
|
// inset codes using insetCode(). And the insets'
|
|
|
|
// write() routines should use insetName() rather than
|
|
|
|
// hardcoding it.
|
2003-03-12 11:52:23 +00:00
|
|
|
if (tmptok == "Quotes") {
|
2008-09-06 14:04:01 +00:00
|
|
|
inset.reset(new InsetQuotes(buf));
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "External") {
|
2009-11-08 15:53:21 +00:00
|
|
|
inset.reset(new InsetExternal(buf));
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "FormulaMacro") {
|
2009-11-08 15:53:21 +00:00
|
|
|
inset.reset(new MathMacroTemplate(buf));
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "Formula") {
|
2009-11-08 15:53:21 +00:00
|
|
|
inset.reset(new InsetMathHull(buf));
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "Graphics") {
|
2009-11-08 15:53:21 +00:00
|
|
|
inset.reset(new InsetGraphics(buf));
|
2003-12-10 17:28:14 +00:00
|
|
|
} else if (tmptok == "Note") {
|
2008-03-04 22:28:18 +00:00
|
|
|
inset.reset(new InsetNote(buf, tmptok));
|
2003-12-10 21:48:40 +00:00
|
|
|
} else if (tmptok == "Box") {
|
2008-03-04 22:28:18 +00:00
|
|
|
inset.reset(new InsetBox(buf, tmptok));
|
2007-09-08 13:09:58 +00:00
|
|
|
} else if (tmptok == "Flex") {
|
2009-03-09 13:48:09 +00:00
|
|
|
lex.eatLine();
|
2003-11-28 10:12:04 +00:00
|
|
|
string s = lex.getString();
|
2008-04-05 20:24:05 +00:00
|
|
|
inset.reset(new InsetFlex(buf, s));
|
2003-08-17 11:28:23 +00:00
|
|
|
} else if (tmptok == "Branch") {
|
2008-04-05 20:24:05 +00:00
|
|
|
inset.reset(new InsetBranch(buf, InsetBranchParams()));
|
2009-01-30 00:56:37 +00:00
|
|
|
} else if (tmptok == "Phantom") {
|
|
|
|
inset.reset(new InsetPhantom(buf, tmptok));
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "ERT") {
|
2008-03-04 22:28:18 +00:00
|
|
|
inset.reset(new InsetERT(buf));
|
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 (tmptok == "listings") {
|
2008-03-04 22:28:18 +00:00
|
|
|
inset.reset(new InsetListings(buf));
|
2010-11-21 17:00:12 +00:00
|
|
|
} else if (tmptok == "script") {
|
|
|
|
inset.reset(new InsetScript(buf));
|
2008-05-30 15:38:43 +00:00
|
|
|
} else if (tmptok == "space") {
|
2003-11-03 17:47:28 +00:00
|
|
|
inset.reset(new InsetSpace);
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "Tabular") {
|
2009-11-08 15:53:21 +00:00
|
|
|
inset.reset(new InsetTabular(buf));
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "Text") {
|
2008-03-04 22:28:18 +00:00
|
|
|
inset.reset(new InsetText(buf));
|
2003-11-28 15:53:34 +00:00
|
|
|
} else if (tmptok == "VSpace") {
|
|
|
|
inset.reset(new InsetVSpace);
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "Foot") {
|
2008-03-04 22:28:18 +00:00
|
|
|
inset.reset(new InsetFoot(buf));
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "Marginal") {
|
2008-03-04 22:28:18 +00:00
|
|
|
inset.reset(new InsetMarginal(buf));
|
2008-03-25 09:26:03 +00:00
|
|
|
} else if (tmptok == "Newpage") {
|
|
|
|
inset.reset(new InsetNewpage);
|
2008-03-26 08:10:01 +00:00
|
|
|
} else if (tmptok == "Newline") {
|
|
|
|
inset.reset(new InsetNewline);
|
Fix bugs #8546 and #9055, and introduce new separator inset.
The algorithm used for breaking a paragraph in LaTeX export is changed
for avoiding spurious blank lines causing too much vertical space.
This change is tied to the introduction of a new inset (with two
different specializations) helping in either outputing LaTeX paragraph
breaks or separating environments in LyX. Both of the above goals were
previously achieved by the ---Separator--- layout and can now be
accomplished by the new inset in a more natural way. As an example,
after leaving an environment by hitting the Return key for two times,
a third return automatically inserts a parbreak inset, which is
equivalent to the old separator layout, i.e., it also introduces a
blank line in the output. If this blank line is not wanted, the
parbreak separator can be changed to a plain separator by a right
click of the mouse. Of course, an environment can still be separated
by the following one by using the Alt+P+Return shortcut (or the
corresponding menu key), but now the plain separator inset is used
instead of the old separator layout, such that no blank line occurs in
the LaTeX output.
Old documents are converted such that the LaTeX output remains unchanged.
As a result of this conversion, the old separator layout is replaced by
the new parbreak inset, which may also appear in places where the old
algorithm was introducing blank lines while the new one is not.
Note that not all blank lines were actually affecting the LaTeX output,
because a blank line is simply ignored by the TeX engine when it occurs
in the so called "vertical mode" (e.g., after an alignment environment).
The old ---Separator--- layout is now gone and old layout files using it
are also automatically converted.
Round trip conversions between old and new format should leave a document
unchanged. This means that the new behavior about paragraph breaking is
not "carried back" to the old format. Indeed, this would need introducing
special LaTeX commands in ERT that would accumulate in roundtrip
conversions, horribly cluttering the document. So, when converting a
modified document to old formats, the LaTeX output may slightly differ in
vertical spacing if the document is processed by an old version of LyX.
In other words, forward compatibility is guaranteed, but not backwards.
2014-05-10 21:25:11 +00:00
|
|
|
} else if (tmptok == "Separator") {
|
|
|
|
inset.reset(new InsetSeparator);
|
2010-06-07 21:58:27 +00:00
|
|
|
} else if (tmptok == "Argument") {
|
2012-11-19 13:21:02 +00:00
|
|
|
inset.reset(new InsetArgument(buf, tmptok));
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "Float") {
|
2010-02-10 17:33:39 +00:00
|
|
|
inset.reset(new InsetFloat(buf, string()));
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "Wrap") {
|
|
|
|
lex.next();
|
|
|
|
string tmptok = lex.getString();
|
2008-03-04 22:28:18 +00:00
|
|
|
inset.reset(new InsetWrap(buf, tmptok));
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "Caption") {
|
2012-12-30 17:29:02 +00:00
|
|
|
lex.eatLine();
|
|
|
|
string s = lex.getString();
|
|
|
|
inset.reset(new InsetCaption(buf, s));
|
2007-10-03 13:38:19 +00:00
|
|
|
} else if (tmptok == "Index") {
|
2009-04-16 07:29:01 +00:00
|
|
|
inset.reset(new InsetIndex(buf, InsetIndexParams()));
|
2003-03-12 11:52:23 +00:00
|
|
|
} else if (tmptok == "FloatList") {
|
2009-11-08 16:10:34 +00:00
|
|
|
inset.reset(new InsetFloatList(buf));
|
2007-10-11 14:52:00 +00:00
|
|
|
} else if (tmptok == "Info") {
|
2008-03-04 22:28:18 +00:00
|
|
|
inset.reset(new InsetInfo(buf));
|
2012-03-06 07:54:22 +00:00
|
|
|
} else if (tmptok == "IPA") {
|
|
|
|
inset.reset(new InsetIPA(buf));
|
2012-08-23 15:42:53 +00:00
|
|
|
} else if (tmptok == "IPADeco") {
|
|
|
|
inset.reset(new InsetIPADeco(buf, tmptok));
|
2010-03-28 13:47:50 +00:00
|
|
|
} else if (tmptok == "Preview") {
|
|
|
|
inset.reset(new InsetPreview(buf));
|
2003-10-01 16:27:36 +00:00
|
|
|
} else {
|
2003-10-14 12:49:15 +00:00
|
|
|
lyxerr << "unknown Inset type '" << tmptok
|
2007-12-12 19:28:07 +00:00
|
|
|
<< "'" << endl;
|
2003-10-14 12:49:15 +00:00
|
|
|
while (lex.isOK() && lex.getString() != "\\end_inset")
|
|
|
|
lex.next();
|
|
|
|
return 0;
|
2003-03-12 11:52:23 +00:00
|
|
|
}
|
|
|
|
|
2008-03-04 14:38:30 +00:00
|
|
|
// Set the buffer reference for proper parsing of some insets
|
|
|
|
// (InsetCollapsable for example)
|
2009-11-08 15:53:21 +00:00
|
|
|
inset->setBuffer(*buf);
|
2008-02-27 20:43:16 +00:00
|
|
|
inset->read(lex);
|
2008-03-04 14:38:30 +00:00
|
|
|
// Set again the buffer for insets that are created inside this inset
|
|
|
|
// (InsetMathHull for example).
|
2009-11-08 15:53:21 +00:00
|
|
|
inset->setBuffer(*buf);
|
2003-03-12 11:52:23 +00:00
|
|
|
}
|
2003-11-03 17:47:28 +00:00
|
|
|
return inset.release();
|
2003-03-12 11:52:23 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|