]> git.lyx.org Git - features.git/commitdiff
Two small patches from Dekel
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 11 Jan 2001 14:55:36 +0000 (14:55 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 11 Jan 2001 14:55:36 +0000 (14:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1315 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/buffer.C
src/buffer.h
src/insets/insettoc.C
src/insets/insettoc.h
src/lyx_main.C
src/paragraph.C

index ee8956fb5bd830bfd948e9afa8f3fcca1777e0e1..c5137413f64e3eec66d0b6cdb2a651bbf31e30d1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2001-01-11  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * 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  <dekelts@tau.ac.il>
+
+       * 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  <dekelts@tau.ac.il>
+
+       * src/paragraph.C (TeXOnePar,SimpleTeXOnePar) Fix problem with
+       aligned paragraphs.
+
 2001-01-11  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
        * src/buffer.C (writeFile): add missing ' ' after lyxformat.
index 3ccc76df10b1385f51e3385cf786df981a330725..682298f00be437511c567113237b4620ba1a111c 100644 (file)
@@ -3417,7 +3417,7 @@ vector<string> const Buffer::getLabelList()
 }
 
 
-vector<vector<Buffer::TocItem> > const Buffer::getTocList()
+vector<vector<Buffer::TocItem> > const Buffer::getTocList() const
 {
        int figs = 0;
        int tables = 0;
index 05ce5ba17c7a5064e190c6c4453e0550ed39fcb0..371f2fe30293117f4136e38552db4fa050a77970 100644 (file)
@@ -303,7 +303,7 @@ public:
                TOC_LOA
        };
        ///
-       std::vector<std::vector<TocItem> > const getTocList();
+       std::vector<std::vector<TocItem> > const getTocList() const;
        ///
        std::vector<string> const getLabelList();
 
index 27f94452fdc8df54480e56fbb4f49e0e338dad2e..d166b443193d626529f3085c2e8f70d365a2d34e 100644 (file)
 #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<vector<Buffer::TocItem> > const toc_list =
+                buffer->getTocList();
+       vector<Buffer::TocItem> const & toc = toc_list[type];
+       for (vector<Buffer::TocItem>::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
 {
index 3c7d8bed37587ed116c22583710f8f3ca9a921b1..9e2078f2cbb637c44f409e5305dc9c8d9e997194 100644 (file)
@@ -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;
index 94c84c60de004e79459f0c86e11e938934f03f25..cf5a25d79e8771132e1a489d9261a902dfc0e1c0 100644 (file)
@@ -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
index e0d4cb9ec28f0ae613c566f60ca9982a8a4c71cd..68c85766bcb3c4de0035bb79c0b23d7b1bb56040 100644 (file)
@@ -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;
                        }