From ba916a0f89d99dac83a584e60fd98c1b3d6d614d Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 11 Jan 2001 14:55:36 +0000 Subject: [PATCH] Two small patches from Dekel git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1315 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 19 +++++++++++++++++++ src/buffer.C | 2 +- src/buffer.h | 2 +- src/insets/insettoc.C | 29 ++++++++++++++++++++++++++++- src/insets/insettoc.h | 2 ++ src/lyx_main.C | 2 ++ src/paragraph.C | 38 ++++++++++++++++++-------------------- 7 files changed, 71 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee8956fb5b..c5137413f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2001-01-11 Jean-Marc Lasgouttes + + * src/buffer.C (getTocList): make the method const, so that + InsetTOC::Ascii compiles. + + * src/insets/insettoc.C (Ascii): return 0 + +2001-01-11 Dekel Tsur + + * src/insets/insettoc.C (Ascii): New method. + + * src/lyx_main.C (init) Set first_start to false when running + without a GUI. + +2000-12-19 Dekel Tsur + + * src/paragraph.C (TeXOnePar,SimpleTeXOnePar) Fix problem with + aligned paragraphs. + 2001-01-11 Lars Gullik Bjønnes * src/buffer.C (writeFile): add missing ' ' after lyxformat. diff --git a/src/buffer.C b/src/buffer.C index 3ccc76df10..682298f00b 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -3417,7 +3417,7 @@ vector const Buffer::getLabelList() } -vector > const Buffer::getTocList() +vector > const Buffer::getTocList() const { int figs = 0; int tables = 0; diff --git a/src/buffer.h b/src/buffer.h index 05ce5ba17c..371f2fe302 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -303,7 +303,7 @@ public: TOC_LOA }; /// - std::vector > const getTocList(); + std::vector > const getTocList() const; /// std::vector const getLabelList(); diff --git a/src/insets/insettoc.C b/src/insets/insettoc.C index 27f94452fd..d166b44319 100644 --- a/src/insets/insettoc.C +++ b/src/insets/insettoc.C @@ -10,9 +10,10 @@ #include "LyXView.h" #include "frontends/Dialogs.h" #include "debug.h" +#include "buffer.h" using std::ostream; - +using std::endl; string const InsetTOC::getScreenLabel() const { @@ -47,6 +48,32 @@ void InsetTOC::Edit(BufferView * bv, int, int, unsigned int) bv->owner()->getDialogs()->showTOC( this ); } +int InsetTOC::Ascii(Buffer const * buffer, ostream & os, int) const +{ + os << getScreenLabel() << endl << endl; + + Buffer::TocType type; + string cmdname = getCmdName(); + if (cmdname == "tableofcontents" ) + type = Buffer::TOC_TOC; + else if (cmdname == "listofalgorithms" ) + type = Buffer::TOC_LOA; + else if (cmdname == "listoffigures" ) + type = Buffer::TOC_LOF; + else + type = Buffer::TOC_LOT; + + vector > const toc_list = + buffer->getTocList(); + vector const & toc = toc_list[type]; + for (vector::const_iterator it = toc.begin(); + it != toc.end(); ++it) + os << string(4 * it->depth, ' ') << it->str << endl; + + os << endl; + return 0; +} + int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const { diff --git a/src/insets/insettoc.h b/src/insets/insettoc.h index 3c7d8bed37..9e2078f2cb 100644 --- a/src/insets/insettoc.h +++ b/src/insets/insettoc.h @@ -37,6 +37,8 @@ public: /// Inset::Code LyxCode() const; /// + int Ascii(Buffer const *, std::ostream &, int linelen) const; + /// int Linuxdoc(Buffer const *, std::ostream &) const; /// int DocBook(Buffer const *, std::ostream &) const; diff --git a/src/lyx_main.C b/src/lyx_main.C index 94c84c60de..cf5a25d79e 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -368,6 +368,8 @@ void LyX::init(int */*argc*/, char **argv, bool gui) // running in batch mode. if (gui) queryUserLyXDir(explicit_userdir); + else + first_start = false; // // Shine up lyxrc defaults diff --git a/src/paragraph.C b/src/paragraph.C index e0d4cb9ec2..68c85766bc 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -2373,25 +2373,21 @@ LyXParagraph * LyXParagraph::TeXOnePar(Buffer const * buf, // This is necessary because LaTeX (and LyX on the screen) // calculates the space between the baselines according // to this font. (Matthias) + // + // Is this really needed ? (Dekel) + // We do not need to use to change the font for the last paragraph + // or for a command. LyXFont font = getFont(bparams, Last() - 1); - if (need_par && next) { - if (style.resfont.size() != font.size()) { - os << '\\' - << font.latexSize() - << ' '; - } + bool is_command = textclasslist.Style(bparams.textclass, + GetLayout()).isCommand(); + if (style.resfont.size() != font.size() && next && !is_command) { + if (!need_par) + os << "{"; + os << "\\" << font.latexSize() << " \\par}"; + } else if (need_par) { os << "\\par}"; - } else if (textclasslist.Style(bparams.textclass, - GetLayout()).isCommand()) { - if (style.resfont.size() != font.size()) { - os << '\\' - << font.latexSize() - << ' '; - } - os << '}'; - } else if ((style.resfont.size() != font.size()) && next){ - os << "{\\" << font.latexSize() << " \\par}"; - } + } else if (is_command) + os << "}"; if (language->babel() != doc_language->babel() && (!par @@ -2548,9 +2544,11 @@ bool LyXParagraph::SimpleTeXOnePar(Buffer const * buf, if (style.isCommand()) { os << '{'; ++column; - } else if (align != LYX_ALIGN_LAYOUT) { - os << "{\\par"; - column += 4; + } else if (align != LYX_ALIGN_LAYOUT && next) { + // We do not need \par here (Dekel) + // os << "{\\par"; + os << "{"; + ++column; return_value = true; } -- 2.39.2