Attached is a revised patch where everything should be in shape (including lyx2lyx). There now only
one remaining problem:
In InsetLine::metrics I can successfully calculate the width in pixels but I need to have this
information in InsetLine::draw. My attempt there with
int const w =
width.inPixels(pi.base.textwidth,
fm.width(char_type('M')));
fails because pi.base.textwidth is zero and I cannot access pi.base.textwidth
in InsetLine::draw.
Can anybody please help me?
thanks and regards
Uwe
Index: development/FORMAT
===================================================================
--- development/FORMAT (revision 35287)
+++ development/FORMAT (working copy)
@@ -7,6 +7,11 @@
-----------------------
+2010-09-06 Uwe Stöhr <uwesto...@web.de>
+ * Format incremented to 400: support for the LaTeX-command
+ \rule;
+ new CommandInset named "line"
+
2010-08-31 Uwe Stöhr <uwesto...@web.de>
* Format incremented to 399: support for the LaTeX-package
mathdots;
Index: development/scons/scons_manifest.py
===================================================================
--- development/scons/scons_manifest.py (revision 35287)
+++ development/scons/scons_manifest.py (working copy)
@@ -742,6 +742,7 @@
GuiInfo.h
GuiKeySymbol.h
GuiLabel.h
+ GuiLine.h
GuiListings.h
GuiLog.h
GuiMathMatrix.h
@@ -843,6 +844,7 @@
GuiInfo.cpp
GuiKeySymbol.cpp
GuiLabel.cpp
+ GuiLine.cpp
GuiListings.cpp
GuiLog.cpp
GuiMathMatrix.cpp
@@ -938,6 +940,7 @@
LabelUi.ui
LaTeXUi.ui
LanguageUi.ui
+ LineUi.ui
ListingsUi.ui
ListingsSettingsUi.ui
LocalLayoutUi.ui
Index: lib/lyx2lyx/lyx_2_0.py
===================================================================
--- lib/lyx2lyx/lyx_2_0.py (revision 35287)
+++ lib/lyx2lyx/lyx_2_0.py (working copy)
@@ -2078,6 +2078,90 @@
break
+def convert_rule(document):
+ " Convert \\lyxline to CommandInset line "
+ i = 0
+ while True:
+ i = find_token(document.body, "\\lyxline" , i)
+ if i != -1:
+ j = find_token(document.body, "\\color" , i - 2)
+ if j == i - 2:
+ color = document.body[j] + '\n'
+ else:
+ color = ''
+ k = find_token(document.body, "\\begin_layout Standard" , i - 4)
+ # we need to handle the case that \lyxline is in a separate paragraph and that it is colored
+ # the result is then an extra empty paragraph which we get by adding an empty ERT inset
+ if k == i - 4 and j == i - 2 and document.body[i - 1] == '':
+ layout = '\\begin_inset ERT\nstatus collapsed\n\n\\begin_layout Plain Layout\n\n\n\\end_layout\n\n\\end_inset\n' \
+ + '\\end_layout\n\n' \
+ + '\\begin_layout Standard\n'
+ elif k == i - 2 and document.body[i - 1] == '':
+ layout = ''
+ else:
+ layout = '\\end_layout\n\n' \
+ + '\\begin_layout Standard\n'
+ l = find_token(document.body, "\\begin_layout Standard" , i + 4)
+ if l == i + 4 and document.body[i + 1] == '':
+ layout2 = ''
+ else:
+ layout2 = '\\end_layout\n' \
+ + '\n\\begin_layout Standard\n'
+ subst = layout \
+ + '\\noindent\n\n' \
+ + color \
+ + '\\begin_inset CommandInset line\n' \
+ + 'LatexCommand rule\n' \
+ + 'offset "0.5ex"\n' \
+ + 'width "100line%"\n' \
+ + 'height "1pt"\n' \
+ + '\n\\end_inset\n\n\n' \
+ + layout2
+ document.body[i] = subst
+ i += 1
+ else:
+ return
+
+
+def revert_rule(document):
+ " Revert line insets to Tex code "
+ i = 0
+ while 1:
+ i = find_token(document.body, "\\begin_inset CommandInset line" , i)
+ if i != -1:
+ # find end of inset
+ j = find_token(document.body, "\\end_inset" , i)
+ # assure we found the end_inset of the current inset
+ if j > i + 6 or j == -1:
+ document.warning("Malformed LyX document: Can't find end of line inset.")
+ return
+ # determine the optional offset
+ k = find_token(document.body, 'offset', i)
+ if k != -1 and k < j:
+ offset = document.body[k][8:]
+ else:
+ offset = '0"'
+ # determine the width
+ l = find_token(document.body, 'width', k + 1)
+ width = document.body[l][7:]
+ # determine the height
+ m = find_token(document.body, 'height', l + 1)
+ height = document.body[m][8:]
+ # remove trailing '"'
+ offset = offset[:-1]
+ width = width[:-1]
+ height = height[:-1]
+ # output the \rule command
+ if offset <> "0":
+ subst = "\\rule[" + offset + "]{" + width + "}{" + height + "}"
+ else:
+ subst = "\\rule{" + width + "}{" + height + "}"
+ document.body[i:j + 1] = put_cmd_in_ert(subst)
+ i += 1
+ else:
+ return
+
+
##
# Conversion hub
#
@@ -2136,10 +2220,12 @@
[396, []],
[397, [remove_Nameref]],
[398, []],
- [399, [convert_mathdots]]
+ [399, [convert_mathdots]],
+ [400, [convert_rule]]
]
-revert = [[398, [revert_mathdots]],
+revert = [[399, [revert_rule]],
+ [398, [revert_mathdots]],
[397, [revert_mathrsfs]],
[396, []],
[395, [revert_nameref]],
Index: src/Buffer.cpp
===================================================================
--- src/Buffer.cpp (revision 35287)
+++ src/Buffer.cpp (working copy)
@@ -127,7 +127,7 @@
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
-int const LYX_FORMAT = 399; // uwestoehr: support for package mathdots
+int const LYX_FORMAT = 400; // uwestoehr: support for \rule
typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
Index: src/BufferView.cpp
===================================================================
--- src/BufferView.cpp (revision 35287)
+++ src/BufferView.cpp (working copy)
@@ -1027,6 +1027,7 @@
case LFUN_FONT_STATE:
case LFUN_LABEL_INSERT:
+ case LFUN_LINE_INSERT:
case LFUN_INFO_INSERT:
case LFUN_PARAGRAPH_GOTO:
case LFUN_NOTE_NEXT:
Index: src/factory.cpp
===================================================================
--- src/factory.cpp (revision 35287)
+++ src/factory.cpp (working copy)
@@ -82,9 +82,6 @@
switch (cmd.action()) {
- case LFUN_LINE_INSERT:
- return new InsetLine;
-
case LFUN_NEWPAGE_INSERT: {
string const name = cmd.getArg(0);
InsetNewpageParams inp;
@@ -292,6 +289,12 @@
return new InsetLabel(buf, icp);
}
+ case LINE_CODE: {
+ InsetCommandParams icp(code);
+ InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
+ return new InsetLine(buf, icp);
+ }
+
case LISTINGS_CODE: {
InsetListingsParams par;
InsetListings::string2params(to_utf8(cmd.argument()), par);
@@ -490,6 +493,9 @@
case LABEL_CODE:
inset.reset(new InsetLabel(buf, inscmd));
break;
+ case LINE_CODE:
+ inset.reset(new InsetLine(buf, inscmd));
+ break;
case NOMENCL_CODE:
inset.reset(new InsetNomencl(buf, inscmd));
break;
Index: src/frontends/qt4/GuiView.cpp
===================================================================
--- src/frontends/qt4/GuiView.cpp (revision 35287)
+++ src/frontends/qt4/GuiView.cpp (working copy)
@@ -3457,13 +3457,14 @@
char const * const dialognames[] = {
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
-"citation", "compare", "document", "errorlist", "ert", "external", "file",
-"findreplace", "findreplaceadv", "float", "graphics", "href", "include",
-"index", "index_print", "info", "listings", "label", "log", "mathdelimiter",
-"mathmatrix", "mathspace", "nomenclature", "nomencl_print", "note",
-"paragraph", "phantom", "prefs", "print", "ref", "sendto", "space",
-"spellchecker", "symbols", "tabular", "tabularcreate", "thesaurus", "texinfo",
-"toc", "view-source", "vspace", "wrap", "progress"};
+"citation", "compare", "document", "errorlist", "ert", "external",
+"file", "findreplace", "findreplaceadv", "float", "graphics", "href",
+"include", "index", "index_print", "info", "listings", "label", "line",
+"log", "mathdelimiter", "mathmatrix", "mathspace", "nomenclature",
+"nomencl_print", "note", "paragraph", "phantom", "prefs", "print", "ref",
+"sendto", "space", "spellchecker", "symbols", "tabular", "tabularcreate",
+"thesaurus", "texinfo", "toc", "view-source", "vspace", "wrap",
+"progress"};
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
@@ -3650,6 +3651,7 @@
Dialog * createGuiInclude(GuiView & lv);
Dialog * createGuiIndex(GuiView & lv);
Dialog * createGuiLabel(GuiView & lv);
+Dialog * createGuiLine(GuiView & lv);
Dialog * createGuiListings(GuiView & lv);
Dialog * createGuiLog(GuiView & lv);
Dialog * createGuiMathMatrix(GuiView & lv);
@@ -3723,6 +3725,8 @@
return createGuiPrintindex(*this);
if (name == "label")
return createGuiLabel(*this);
+ if (name == "line")
+ return createGuiLine(*this);
if (name == "listings")
return createGuiListings(*this);
if (name == "log")
Index: src/frontends/qt4/Makefile.am
===================================================================
--- src/frontends/qt4/Makefile.am (revision 35287)
+++ src/frontends/qt4/Makefile.am (working copy)
@@ -95,6 +95,7 @@
GuiInfo.cpp \
GuiKeySymbol.cpp \
GuiLabel.cpp \
+ GuiLine.cpp \
GuiListings.cpp \
GuiLog.cpp \
GuiMathMatrix.cpp \
@@ -199,6 +200,7 @@
GuiIndices.h \
GuiInfo.h \
GuiLabel.h \
+ GuiLine.h \
GuiListings.h \
GuiLog.h \
GuiMathMatrix.h \
@@ -280,6 +282,7 @@
LabelUi.ui \
LanguageUi.ui \
LaTeXUi.ui \
+ LineUi.ui \
ListingsUi.ui \
ListingsSettingsUi.ui \
LocalLayoutUi.ui \
Index: src/insets/InsetCommand.cpp
===================================================================
--- src/insets/InsetCommand.cpp (revision 35287)
+++ src/insets/InsetCommand.cpp (working copy)
@@ -29,6 +29,7 @@
#include "insets/InsetFloat.h"
#include "insets/InsetGraphics.h"
#include "insets/InsetInclude.h"
+#include "insets/InsetLine.h"
#include "insets/InsetListings.h"
#include "insets/InsetNote.h"
#include "insets/InsetPhantom.h"
@@ -260,6 +261,7 @@
case BIBTEX_CODE:
case INDEX_CODE:
case LABEL_CODE:
+ case LINE_CODE:
case NOMENCL_CODE:
case NOMENCL_PRINT_CODE:
case REF_CODE:
Index: src/insets/InsetCommand.h
===================================================================
--- src/insets/InsetCommand.h (revision 35287)
+++ src/insets/InsetCommand.h (working copy)
@@ -55,6 +55,8 @@
///
void setParam(std::string const & name, docstring const & value);
///
+ Dimension const dimension(BufferView const &) const { return button_.dimension(); }
+ ///
docstring const & getParam(std::string const & name) const;
/// FIXME Remove
docstring const getFirstNonOptParam() const { return p_.getFirstNonOptParam(); }
@@ -87,8 +89,6 @@
///
void metrics(MetricsInfo &, Dimension &) const;
///
- Dimension const dimension(BufferView const &) const { return button_.dimension(); }
- ///
void draw(PainterInfo & pi, int x, int y) const;
///
int latex(odocstream &, OutputParams const &) const;
Index: src/insets/InsetCommandParams.cpp
===================================================================
--- src/insets/InsetCommandParams.cpp (revision 35287)
+++ src/insets/InsetCommandParams.cpp (working copy)
@@ -23,6 +23,7 @@
#include "InsetInclude.h"
#include "InsetIndex.h"
#include "InsetLabel.h"
+#include "InsetLine.h"
#include "InsetNomencl.h"
#include "InsetRef.h"
#include "InsetTOC.h"
@@ -70,6 +71,8 @@
return InsetPrintIndex::findInfo(cmdName);
case LABEL_CODE:
return InsetLabel::findInfo(cmdName);
+ case LINE_CODE:
+ return InsetLine::findInfo(cmdName);
case NOMENCL_CODE:
return InsetNomencl::findInfo(cmdName);
case NOMENCL_PRINT_CODE:
@@ -200,6 +203,8 @@
return InsetPrintIndex::defaultCommand();
case LABEL_CODE:
return InsetLabel::defaultCommand();
+ case LINE_CODE:
+ return InsetLine::defaultCommand();
case NOMENCL_CODE:
return InsetNomencl::defaultCommand();
case NOMENCL_PRINT_CODE:
@@ -234,6 +239,8 @@
return InsetPrintIndex::isCompatibleCommand(s);
case LABEL_CODE:
return InsetLabel::isCompatibleCommand(s);
+ case LINE_CODE:
+ return InsetLine::isCompatibleCommand(s);
case NOMENCL_CODE:
return InsetNomencl::isCompatibleCommand(s);
case NOMENCL_PRINT_CODE:
Index: src/insets/InsetLine.cpp
===================================================================
--- src/insets/InsetLine.cpp (revision 35287)
+++ src/insets/InsetLine.cpp (working copy)
@@ -4,6 +4,7 @@
* Licence details can be found in the file COPYING.
*
* \author André Pönitz
+ * \author Uwe Stöhr
*
* Full author contact details are available in file CREDITS.
*/
@@ -12,21 +13,26 @@
#include "InsetLine.h"
+#include "Buffer.h"
#include "Dimension.h"
-#include "Font.h"
+#include "DispatchResult.h"
+#include "FuncRequest.h"
+#include "FuncStatus.h"
#include "LaTeXFeatures.h"
+#include "Length.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "output_xhtml.h"
#include "Text.h"
+#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "support/debug.h"
#include "support/docstream.h"
+#include "support/gettext.h"
+#include "support/lstrings.h"
-
-
using namespace std;
namespace lyx {
@@ -34,24 +40,83 @@
using frontend::Painter;
-void InsetLine::read(Lexer &)
+InsetLine::InsetLine(Buffer * buf, InsetCommandParams const & p)
+ : InsetCommand(buf, p, "line")
+{}
+
+
+ParamInfo const & InsetLine::findInfo(string const & /* cmdName */)
{
- /* Nothing to read */
+ static ParamInfo param_info_;
+ if (param_info_.empty()) {
+ param_info_.add("offset", ParamInfo::LYX_INTERNAL);
+ param_info_.add("width", ParamInfo::LYX_INTERNAL);
+ param_info_.add("height", ParamInfo::LYX_INTERNAL);
+ }
+ return param_info_;
}
-void InsetLine::write(ostream & os) const
+docstring InsetLine::screenLabel() const
{
- os << "\n\\lyxline\n";
+ return _("Horizontal line");
}
+void InsetLine::doDispatch(Cursor & cur, FuncRequest & cmd)
+{
+ switch (cmd.action()) {
+
+ case LFUN_INSET_MODIFY: {
+ InsetCommandParams p(LINE_CODE);
+ // FIXME UNICODE
+ InsetCommand::string2params("line",
+ to_utf8(cmd.argument()), p);
+ if (p.getCmdName().empty()) {
+ cur.noScreenUpdate();
+ break;
+ }
+ setParams(p);
+ break;
+ }
+
+ default:
+ InsetCommand::doDispatch(cur, cmd);
+ break;
+ }
+}
+
+
+bool InsetLine::getStatus(Cursor & cur, FuncRequest const & cmd,
+ FuncStatus & status) const
+{
+ switch (cmd.action()) {
+ case LFUN_INSET_DIALOG_UPDATE:
+ case LFUN_INSET_MODIFY:
+ status.setEnabled(true);
+ return true;
+ default:
+ return InsetCommand::getStatus(cur, cmd, status);
+ }
+}
+
+
void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
{
- dim.asc = 3;
- dim.des = 3;
- dim.wid = mi.base.textwidth;
- // Cache the inset dimension.
+ frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
+ dim.asc = fm.maxAscent();
+ dim.des = fm.maxDescent();
+
+ Length width = Length(to_ascii(getParam("width")));
+ int const w =
+ width.inPixels(mi.base.textwidth,
+ fm.width(char_type('M')));
+
+ // set a minimal width
+ int const minw = (w < 0) ? 3 * 8 : 4;
+ dim.wid = max(minw, abs(w));
+
+ // Cache the inset dimension
setDimCache(mi, dim);
}
@@ -60,18 +125,53 @@
{
Dimension const dim = dimension(*pi.base.bv);
+ frontend::FontMetrics const & fm = theFontMetrics(pi.base.font);
+
+ Length offset = Length(to_ascii(getParam("offset")));
+ int const o =
+ offset.inPixels(pi.base.textwidth,
+ fm.width(char_type('M')));
+
+ Length width = Length(to_ascii(getParam("width")));
+ int const w =
+ width.inPixels(pi.base.textwidth,
+ fm.width(char_type('M')));
+
+ Length height = Length(to_ascii(getParam("height")));
+ int const h =
+ height.inPixels(pi.base.textwidth,
+ fm.width(char_type('M')));
+
+ // get the surrounding text color
FontInfo f = pi.base.font;
Color Line_color = f.realColor();
- pi.pain.line(x, y, x + dim.wid, y, Line_color,
- Painter::line_solid, 1);
+ // the offset is a vertical one
+ pi.pain.line(x + h/2 + 1, y - o - h/2, x + w - h/2 - 2, y - o - h/2,
+ Line_color, Painter::line_solid, h);
}
int InsetLine::latex(odocstream & os, OutputParams const & runparams) const
{
- os << "\\lyxline{\\"
- << from_ascii(runparams.local_font->latexSize()) << '}';
+ bool have_offset = true;
+ Length offset_len = Length(to_ascii(getParam("offset")));
+ if (offset_len.value() == 0)
+ have_offset = false;
+
+ string const offset =
+ Length(to_ascii(getParam("offset"))).asLatexString();
+ string const width =
+ Length(to_ascii(getParam("width"))).asLatexString();
+ string const height =
+ Length(to_ascii(getParam("height"))).asLatexString();
+
+ os << "\\rule";
+ // only output the optional parameter if the offset is not 0
+ if (have_offset)
+ os << "[" << from_ascii(offset) << "]";
+ os << "{" << from_ascii(width) << "}{" << from_ascii(height) << '}';
+
return 0;
}
@@ -98,10 +198,4 @@
}
-void InsetLine::validate(LaTeXFeatures & features) const
-{
- features.require("lyxline");
-}
-
-
} // namespace lyx
Index: src/insets/InsetLine.h
===================================================================
--- src/insets/InsetLine.h (revision 35287)
+++ src/insets/InsetLine.h (working copy)
@@ -5,6 +5,7 @@
* Licence details can be found in the file COPYING.
*
* \author André Pönitz
+ * \author Uwe Stöhr
*
* Full author contact details are available in file CREDITS.
*/
@@ -14,17 +15,37 @@
#include "Inset.h"
+#include "InsetCommand.h"
namespace lyx {
-class InsetLine : public Inset {
+class LaTeXFeatures;
+
+class InsetLine : public InsetCommand {
public:
///
- InsetLine() : Inset(0) {}
+ InsetLine(Buffer * buf, InsetCommandParams const &);
///
+ int docbook(odocstream &, OutputParams const &) const;
+ /// Does nothing at the moment.
+ docstring xhtml(XHTMLStream &, OutputParams const &) const;
+ ///
InsetCode lyxCode() const { return LINE_CODE; }
///
+ bool hasSettings() const { return true; }
+ ///
+ docstring screenLabel() const;
+ ///
+ static ParamInfo const & findInfo(std::string const &);
+ ///
+ static std::string defaultCommand() { return "rule"; };
+ ///
+ static bool isCompatibleCommand(std::string const & s)
+ { return s == "rule"; }
+
+private:
+ ///
void metrics(MetricsInfo &, Dimension &) const;
///
void draw(PainterInfo & pi, int x, int y) const;
@@ -33,20 +54,10 @@
///
int plaintext(odocstream &, OutputParams const &) const;
///
- int docbook(odocstream &, OutputParams const &) const;
+ void doDispatch(Cursor & cur, FuncRequest & cmd);
///
- docstring xhtml(XHTMLStream &, OutputParams const &) const;
+ bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
///
- void read(Lexer & lex);
- ///
- void write(std::ostream & os) const;
- /// We don't need \begin_inset and \end_inset
- bool directWrite() const { return true; }
- ///
- DisplayType display() const { return AlignCenter; }
- ///
- void validate(LaTeXFeatures & features) const;
-private:
Inset * clone() const { return new InsetLine(*this); }
};
Index: src/LaTeXFeatures.cpp
===================================================================
--- src/LaTeXFeatures.cpp (revision 35287)
+++ src/LaTeXFeatures.cpp (working copy)
@@ -60,11 +60,6 @@
static docstring const lyx_def = from_ascii(
"\\providecommand{\\lyx}{l\\kern-.1667em\\lower.25em\\hbox{y}\\kern-.125em...@}");
-static docstring const lyxline_def = from_ascii(
- "\\newcommand{\\lyxline}[1][1pt]{%\n"
- " \\par\\noindent%\n"
- " \\rule[.5ex]{\\linewidth}{#1}\\par}");
-
static docstring const noun_def = from_ascii(
"\\newcommand{\\noun}[1]{\\textsc{#1}}");
@@ -805,9 +800,6 @@
if (mustProvide("LyX"))
macros << lyx_def << '\n';
- if (mustProvide("lyxline"))
- macros << lyxline_def << '\n';
-
if (mustProvide("noun"))
macros << noun_def << '\n';
Index: src/LyXAction.cpp
===================================================================
--- src/LyXAction.cpp (revision 35287)
+++ src/LyXAction.cpp (working copy)
@@ -2378,12 +2378,12 @@
* \var lyx::FuncCode lyx::LFUN_INSET_SETTINGS
* \li Action: Open the inset's properties dialog.
* \li Notion: Used for bibitem, bibtex, box, branch, citation, ert, external,
- float, graphics, href, include, index, index_print, label, listings,
- note, phantom, ref, space, tabular, vspace, wrap insets.
+ float, graphics, href, include, index, index_print, label, line,
+ listings, note, phantom, ref, space, tabular, vspace, wrap insets.
* \li Syntax: inset-settings <INSET>
* \li Params: <INSET>: <bibitem|bibtex|box|branch|citation|ert|external|float|
- graphics|href|include|index|index_print|label|listings|
- note|phantom|ref|space|tabular|vspace|wrap>.
+ graphics|href|include|index|index_print|label|line|
+ listings|note|phantom|ref|space|tabular|vspace|wrap>.
* \endvar
*/
{ LFUN_INSET_SETTINGS, "inset-settings", ReadOnly | AtPoint, Edit },
@@ -2663,7 +2663,7 @@
* \li Syntax: dialog-show <NAME> [<DATA>]
* \li Params: <NAME>: aboutlyx|bibitem|bibtex|box|branch|changes|character|citation|\n
compare|document|errorlist|ert|external|file|findreplace|findreplaceadv|float|\n
- graphics|href|include|index|index_print|info|label|listings|log|mathdelimiter|\n
+ graphics|href|include|index|index_print|info|label|line|listings|log|mathdelimiter|\n
mathmatrix|mathspace|nomenclature|nomencl_print|note|paragraph|phantom|prefs|\n
print|ref|sendto|space|spellchecker|symbols|tabular|tabularcreate|\n
thesaurus|texinfo|toc|view-source|vspace|wrap|<SPECIAL> \n
Index: src/Text.cpp
===================================================================
--- src/Text.cpp (revision 35287)
+++ src/Text.cpp (working copy)
@@ -53,7 +53,6 @@
#include "insets/InsetText.h"
#include "insets/InsetBibitem.h"
#include "insets/InsetCaption.h"
-#include "insets/InsetLine.h"
#include "insets/InsetNewline.h"
#include "insets/InsetNewpage.h"
#include "insets/InsetArgument.h"
@@ -452,11 +451,6 @@
auto_ptr<Inset> inset(new InsetTabular(buf));
inset->read(lex);
par.insertInset(par.size(), inset.release(), font, change);
- } else if (token == "\\lyxline") {
- auto_ptr<Inset> inset;
- inset.reset(new InsetLine);
- inset->setBuffer(*buf);
- par.insertInset(par.size(), inset.release(), font, change);
} else if (token == "\\change_unchanged") {
change = Change(Change::UNCHANGED);
} else if (token == "\\change_inserted" || token == "\\change_deleted") {
Index: src/Text3.cpp
===================================================================
--- src/Text3.cpp (revision 35287)
+++ src/Text3.cpp (working copy)
@@ -1548,6 +1548,22 @@
break;
}
+ case LFUN_LINE_INSERT: {
+ InsetCommandParams p(LINE_CODE);
+ p["offset"] = from_ascii(".5ex");
+ p["width"] = from_ascii("100col%");
+ p["height"] = from_ascii("1pt");
+ string const data = InsetCommand::params2string("line", p);
+
+ if (cmd.argument().empty()) {
+ bv->showDialog("line", data);
+ } else {
+ FuncRequest fr(LFUN_INSET_INSERT, data);
+ dispatch(cur, fr);
+ }
+ break;
+ }
+
case LFUN_INFO_INSERT: {
Inset * inset;
if (cmd.argument().empty() && cur.selection()) {
@@ -1672,7 +1688,6 @@
case LFUN_NOMENCL_PRINT:
case LFUN_TOC_INSERT:
- case LFUN_LINE_INSERT:
case LFUN_NEWPAGE_INSERT:
// do nothing fancy
doInsertInset(cur, this, cmd, false, false);
@@ -2229,6 +2244,8 @@
code = NOMENCL_PRINT_CODE;
else if (cmd.argument() == "label")
code = LABEL_CODE;
+ else if (cmd.argument() == "line")
+ code = LINE_CODE;
else if (cmd.argument() == "note")
code = NOTE_CODE;
else if (cmd.argument() == "phantom")