]> git.lyx.org Git - features.git/commitdiff
srcdoc fixes + a little tidy or two
authorJohn Levon <levon@movementarian.org>
Thu, 30 May 2002 03:37:24 +0000 (03:37 +0000)
committerJohn Levon <levon@movementarian.org>
Thu, 30 May 2002 03:37:24 +0000 (03:37 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4288 a592a061-630c-0410-9148-cb99ea01b6c8

15 files changed:
src/ChangeLog
src/LaTeX.C
src/importer.C
src/importer.h
src/lyx_sty.C
src/lyx_sty.h
src/lyxlex.C
src/lyxrow.h
src/lyxtext.h
src/paragraph.C
src/paragraph.h
src/texrow.C
src/texrow.h
src/text.C
src/trans_mgr.h

index d9557742e145f246ffd7fc6bc8519bd61c37d097..86ae7a25b18719836755f09b3131d5534d3723c9 100644 (file)
@@ -1,3 +1,20 @@
+2002-05-30  John Levon  <moz@compsoc.man.ac.uk>
+
+       * LaTeX.C: 
+       * importer.h:
+       * importer.C:
+       * lyx_sty.h:
+       * lyx_sty.C: 
+       * lyxlex.C: 
+       * lyxrow.h: 
+       * lyxtext.h: 
+       * paragraph.h: 
+       * paragraph.C: 
+       * texrow.h:
+       * texrow.C: 
+       * text.C:
+       * trans_mgr.h: srcdocs, and some minor cleanups
 2002-05-29  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
 
        * paragraph_pimpl.C (isTextAt): rewrite to be much faster (do not
index daa1dfb1f95c86b25eecab5fff55fda642035038..55cf3348519d19206c7eab4eb78d417455b2243d 100644 (file)
@@ -376,7 +376,7 @@ bool LaTeX::runMakeIndex(string const & f)
        // It should be possible to set the switches for makeindex
        // sorting style and such. It would also be very convenient
        // to be able to make style files from within LyX. This has
-       // to come for a later time. (0.13 perhaps?)
+       // to come for a later time.
        string tmp = "makeindex -c -q ";
        tmp += f;
        Systemcall one;
index 59b943a07d3687d49dbc219f2523d50d8c439ac9..a0610964ef3b53041bb65cc1e0bc6075f0495f40 100644 (file)
@@ -87,19 +87,6 @@ bool Importer::Import(LyXView * lv, string const & filename,
 }
 
 
-#if 0
-bool Importer::IsImportable(string const & format)
-{
-       vector<string> loaders = Loaders();
-       for (vector<string>::const_iterator it = loaders.begin();
-            it != loaders.end(); ++it)
-               if (converters.IsReachable(format, *it))
-                       return true;
-       return false;
-}
-#endif
-
-
 vector<Format const *> const Importer::GetImportableFormats()
 {
        vector<string> loaders = Loaders();
index 8bcfd08140681864ca68b25d76592397e6b93bf5..0cd3e67fbd6d63619f0c3fbf8a34e154bd58f300 100644 (file)
@@ -1,13 +1,11 @@
 // -*- C++ -*-
-/* This file is part of
- * ======================================================
+/**
+ * \file importer.h
+ * Copyright 1995-2002 the LyX Team
+ * Read the file COPYING
  *
- *           LyX, The Document Processor
- *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * \author unknown
+ */
 
 #ifndef IMPORTER_H
 #define IMPORTER_H
@@ -28,11 +26,7 @@ public:
        static
        bool Import(LyXView * lv, string const & filename,
                    string const & format);
-#if 0
-       ///
-       static
-       bool IsImportable(string const & format);
-#endif
+
        ///
        static
        std::vector<Format const *> const GetImportableFormats();
index 21a72df3f4eb417ab202b76f132450433d55d766..7450237ae22aab33e45203d6ad0edf109464c2cd 100644 (file)
@@ -1,26 +1,19 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file lyx_sty.C
+ * Copyright 1995-2002 the LyX Team
+ * Read the file COPYING
  *
- *           LyX, The Document Processor
- *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * \author Lars Gullik Bjornes <larsbj@lyx.org>
+ */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "lyx_sty.h"
 
 //\NeedsTeXFormat{LaTeX2e}
 //\ProvidesPackage{lyx}[1996/01/11 LLE v0.2 (LyX LaTeX Extensions)]
 //\message{LyX LaTeX Extensions (LLE v0.2) of 11-Jan-1996.}
 
-// include this always
 string const lyx_def =
        "\\providecommand{\\LyX}{L\\kern-.1667em\\lower.25em\\hbox{Y}\\kern-.125emX\\@}";
 
@@ -37,8 +30,6 @@ string const lyxarrow_def =
 // for quotes without babel. This does not give perfect results, but
 // anybody serious about non-english quotes should use babel (JMarc).
 
-
-
 string const quotedblbase_def =
        "\\ProvideTextCommandDefault{\\quotedblbase}{%\n"
        "  \\raisebox{-1.4ex}[1ex][.5ex]{\\textquotedblright}%\n"
@@ -81,6 +72,8 @@ string const paragraphleftindent_def =
        "  \\begin{list}{}{%\n"
        "    \\setlength\\topsep{0pt}%\n"
        "    \\addtolength{\\leftmargin}{#1}\n"
+// ho hum, yet more things commented out with no hint as to why they
+// weren't just removed
 //     "%%    \\addtolength{\\leftmargin}{#1\\textwidth}\n"
 //     "%%    \\setlength{\\textwidth}{#2\\textwidth}\n"
 //     "%%    \\setlength\\listparindent\\parindent%\n"
index 52d247bda77eaacd9e21303d1e0779632ec10a84..9ac39db2c5545e11dc35bc8a20aa245341485b18 100644 (file)
@@ -1,37 +1,22 @@
 // -*- C++ -*-
-/* This file is part of
- * ======================================================
+/**
+ * \file lyx_sty.h
+ * Copyright 1995-2002 the LyX Team
+ * Read the file COPYING
  *
- *           LyX, The Document Processor
  *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
+ * A number of LaTeX command definitions for various
+ * things. The name of this file is a holdover from the
+ * days of yore.
  *
- * ====================================================== */
+ * \author Lars Gullik Bjornes <larsbj@lyx.org>
+ */
 
 #ifndef LYX_STY_H
 #define LYX_STY_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
-
 #include "LString.h"
 
-// This seems to be fixed now (JMarc)
-//#ifdef WITH_WARNINGS
-//#warning README!!
-//#endif
-// I suddenly began to get segfaults in guilsinglleft_def and had no clue
-// on why this happened, then I tried a rewrite and added lyx_sty.C. Now
-// the segfault has moved to bibcombox... It seems that we(or gcc) have a
-// problem with static (non-pointer) objects , if someone knows why please
-// tell me. I am using gcc 2.7.2.1 (Linux) and when IĀ get this segfault it
-// always has to do with a static object of some kind... I tried to rewrite
-// the objects causing the segfault, but the segfault then just moves to
-// another object. I'll let some others have a look now... (Lgb)
-
-// include this always
 ///
 extern string const lyx_def;
 ///
@@ -65,4 +50,4 @@ extern string const binom_def;
 ///
 extern string const mathcircumflex_def;
 
-#endif
+#endif // LYX_STY_H
index 118162bdc1b43c3e70f8f4a548f2f25080635d8c..04c4b23c7eb6fe7661ce6c6f5e1888106eafa539 100644 (file)
@@ -236,21 +236,22 @@ void LyXLex::pushToken(string const & pt)
 
 int LyXLex::findToken(char const * str[])
 {
+       if (!next()) {
+               pimpl_->printError("file ended while scanning string token");
+               return -1;
+       }
        int i = 0;
-
-       if (next()) {
-               if (compare(pimpl_->buff, "default")) {
-                       while (str[i][0] && compare(str[i], pimpl_->buff)) {
-                               ++i;
-                       }
-                       if (!str[i][0]) {
-                               pimpl_->printError("Unknown argument `$$Token'");
-                               i = -1;
-                       }
+   
+       if (compare(pimpl_->buff, "default")) {
+               while (str[i][0] && compare(str[i], pimpl_->buff)) {
+                       ++i;
+               }
+               if (!str[i][0]) {
+                       pimpl_->printError("Unknown argument `$$Token'");
+                       i = -1;
                }
-       } else {
-               pimpl_->printError("file ended while scanning string token");
-               i = -1;
        }
        return i;
 }
index f427b7a8a44aa189fcad9768637d73c3d18cfefe..7339c889595e10aa414bebcc4968ebcdb5a08c6b 100644 (file)
@@ -25,6 +25,7 @@ class Row {
 public:
        ///
        Row();
        ///
        void par(Paragraph * p);
        ///
index f5fd74c6111a72b8345deeacbe6cb80d0e8e250d..bd27342e775724bba3d0e179e674273cd85fee13 100644 (file)
@@ -666,11 +666,12 @@ private:
        ///
        lyx::pos_type beginningOfMainBody(Buffer const *, Paragraph const * par) const;
 
-       /** Returns the left beginning of the text.
-         This information cannot be taken from the layouts-objekt, because
-         in LaTeX the beginning of the text fits in some cases
-         (for example sections) exactly the label-width.
-         */
+       /** 
+        * Returns the left beginning of the text.
+        * This information cannot be taken from the layout object, because
+        * in LaTeX the beginning of the text fits in some cases
+        * (for example sections) exactly the label-width.
+        */
        int leftMargin(BufferView *, Row const * row) const;
        ///
        int rightMargin(Buffer const *, Row const * row) const;
index 6a8c93fc2b7eefb16055051c0ce3b78aba7e0527..301e7c918732fc3789b9915fe400e79627a8703b 100644 (file)
@@ -1704,6 +1704,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
                                }
                                if (moving_arg)
                                        os << "\\protect ";
                                os << "\\\\\n";
                        }
                        texrow.newline();
index ecc95e4fab3d84bc98eca15f97091fb9a24c301f..cfe648b4c33aae3e16162b41cb9251daca167f58 100644 (file)
@@ -261,7 +261,7 @@ public:
        value_type getUChar(BufferParams const &, lyx::pos_type pos) const;
        /// The position must already exist.
        void setChar(lyx::pos_type pos, value_type c);
-       ///
+       /// pos <= size() (there is a dummy font change at the end of each par)
        void setFont(lyx::pos_type pos, LyXFont const & font);
        /// Returns the height of the highest font in range
        LyXFont::FONT_SIZE highestFontInRange(lyx::pos_type startpos,
index 84d9c7ce009cdb11c7198477d50702135ab064da..2e3bd01fc2252e14058985fd552bf8ad647b9400 100644 (file)
@@ -1,12 +1,10 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file texrow.C
+ * Copyright 1995-2002 the LyX Team
+ * Read the file COPYING
  *
- *           LyX, The Document Processor
- *
- *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * \author Matthias Ettrich
+ */
 
 #include <config.h>
 
 #include "debug.h"
 
 using std::find_if;
+using std::for_each;
 using std::endl;
 
-// Delete linked list
+namespace {
+/// function object returning true when row number is found
+class same_rownumber {
+public:
+       same_rownumber(int row) : row_(row) {}
+       bool operator()(TexRow::RowList::value_type const & vt) const {
+               return vt.rownumber() == row_;
+       }
+private:
+       int row_;
+};
+
+
+/// increment the pos value of the argument if the par id
+/// is the same, and the pos parameter is larger
+class increase_pos {
+public:
+       increase_pos(int id, int pos)
+               : id_(id), pos_(pos) {}
+
+       void operator()(TexRow::RowList::value_type & vt) const {
+               if (vt.id() != id_ || vt.pos() >= pos_)
+                       return;
+               vt.pos(vt.pos() + 1);
+               lyxerr[Debug::INFO]
+                       << "TeXRow::increasePos: ideally this "
+                       "should never happen..." << endl;
+
+               // FIXME: When verified to work this clause should be deleted.
+               if (id_ == vt.id() && pos_ == vt.pos()) {
+                       lyxerr[Debug::INFO]
+                               << "TexRow::increasePos: this should happen "
+                               "maximum one time for each run of "
+                               "increasePos!" << endl;
+               }
+       }
+
+private:
+       int id_;
+       int pos_;
+};
+} // namespace anon 
+
 void TexRow::reset()
 {
        rowlist.clear();
@@ -33,7 +79,6 @@ void TexRow::reset()
 }
 
 
-// Defines paragraph and position for the beginning of this row
 void TexRow::start(Paragraph * par, int pos)
 {
        lastpar = par;
@@ -41,39 +86,20 @@ void TexRow::start(Paragraph * par, int pos)
 }
 
 
-// Insert node when line is completed
 void TexRow::newline()
 {
-       RowItem tmp;
-       tmp.pos(lastpos);
-       if (lastpar)
-               tmp.id(lastpar->id());
-       else
-               tmp.id(-1);
-       tmp.rownumber(++count);
+       int const id = lastpar ? lastpar->id() : -1;
+       RowList::value_type tmp(id, lastpos, ++count);
        rowlist.push_back(tmp);
 }
 
 
-class same_rownumber {
-public:
-       same_rownumber(TexRow::RowList::value_type const & v):vt(v) {}
-       bool operator()(TexRow::RowList::value_type const & vt1) const {
-               return vt.rownumber() == vt1.rownumber();
-       }
-private:
-       TexRow::RowList::value_type const & vt;
-};
-
-
-
 bool TexRow::getIdFromRow(int row, int & id, int & pos) const
 {
-       RowList::value_type vt;
-       vt.rownumber(row);
        RowList::const_iterator cit =
-               find_if(rowlist.begin(), rowlist.end(), same_rownumber(vt));
-
+               find_if(rowlist.begin(), rowlist.end(), 
+                       same_rownumber(row));
        if (cit != rowlist.end()) {
                id = cit->id();
                pos = cit->pos();
@@ -85,36 +111,15 @@ bool TexRow::getIdFromRow(int row, int & id, int & pos) const
 }
 
 
-// should perhaps have a better name...
-// Increase the pos of all rows with the
-// same id (and where the pos is larger)
-// to avoid putting errorinsets at the
-// same pos.
-void TexRow::increasePos(int id, int pos) const
+void TexRow::increasePos(int id, int pos)
 {
-       RowList::iterator kit = rowlist.begin();
+       RowList::iterator it = rowlist.begin();
        RowList::iterator end = rowlist.end();
-       for (; kit != end; ++kit) {
-               if (id == kit->id()
-                   && pos < kit->pos()) {
-                       kit->pos(kit->pos() + 1);
-                       lyxerr[Debug::INFO]
-                               << "TeXRow::increasePos: ideally this "
-                               "should never happen..." << endl;
-               }
-               // When verified to work this clause should be deleted.
-               if (id == kit->id()
-                   && pos == kit->pos()) {
-                       lyxerr[Debug::INFO]
-                               << "TexRow::increasePos: this should happen "
-                               "maximum one time for each run of "
-                               "increasePos!" << endl;
-               }
-       }
+       for_each(it, end, increase_pos(id, pos));
 }
 
 
-TexRow & TexRow::operator+= (TexRow const & tr)
+TexRow & TexRow::operator+=(TexRow const & tr)
 {
        rowlist.insert(rowlist.end(), tr.rowlist.begin(), tr.rowlist.end());
        return *this;
index 700bcd67dfff7a8e42265be55db2a5d4b154ce8e..d35c7a57a95dd78aa01209caa2126673d378cfb3 100644 (file)
@@ -1,13 +1,12 @@
 // -*- C++ -*-
-/* This file is part of
- * ======================================================
+/**
+ * \file texrow.h
+ * Copyright 1995-2002 the LyX Team
+ * Read the file COPYING
  *
- *           LyX, The Document Processor
- *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team
- *
- * ====================================================== */
+ * \author Matthias Ettrich
+ */
+
 
 #ifndef TEXROW_H
 #define TEXROW_H
@@ -20,7 +19,7 @@
 
 class Paragraph;
 
-// Controls correspondance between paragraphs and the generated LaTeX file
+/// Represents the correspondence between paragraphs and the generated LaTeX file
 class TexRow {
 public:
        ///
@@ -35,65 +34,69 @@ public:
        /// Insert node when line is completed
        void newline();
 
-       /// Returns paragraph id and position from a row number
+       /**
+        * getIdFromRow - find pid and position for a given row
+        * @param row row number to find
+        * @param id set to id if found
+        * @param pos set to paragraph position if found
+        * @return true if found, false otherwise
+        *
+        * If the row could not be found, pos is set to zero and
+        * id is set to -1
+        */
        bool getIdFromRow(int row, int & id, int & pos) const;
 
-       /// Appends another TexRow
        TexRow & operator+= (TexRow const &);
 
-       /// Returns the number of rows in this texrow
+       /// Returns the number of rows contained
        int rows() const { return count; }
 
-       /// Linked list of items
+       /// an individual id/pos <=> row mapping
        class RowItem {
        public:
-               ///
-               RowItem() : id_(-1), pos_(-1), rownumber_(0) {}
-               ///
-               void id(int i) {
-                       id_ = i;
-               }
-               ///
+               RowItem(int id, int pos, int row) 
+                       : id_(id), pos_(pos), rownumber_(row)
+               {}
+
+               /// paragraph id
                int id() const {
                        return id_;
                }
-               ///
+               /// set paragraph position
                void pos(int p) {
                        pos_ = p;
                }
-               ///
+
+               /// paragraph position
                int pos() const {
                        return pos_;
                }
-               ///
-               void rownumber(int r) {
-                       rownumber_ = r;
-               }
-               ///
+
+               /// row number
                int rownumber() const {
                        return rownumber_;
                }
        private:
-               ///
                int id_;
-               ///
                int pos_;
-               ///
                int rownumber_;
        };
        ///
        typedef std::list<RowItem> RowList;
-       ///
-       void increasePos(int id, int pos) const;
+       /// increment position of all other RowItems
+       /// with same par id, to avoid placing error insets
+       /// at the same position
+       void increasePos(int id, int pos);
 private:
-       ///
+       /// number of lines
        unsigned int count;
-       ///
-       mutable RowList rowlist;
+       /// container of id/pos <=> row mapping
+       RowList rowlist;
        /// Last paragraph
        Paragraph * lastpar;
        /// Last position
        int lastpos;
-
 };
-#endif
+#endif // TEXROW_H
index 602abcc7ae3bb852e7fa1d01044d881a4eb56575..214207ca0aaf3b51aa8a47c150e3fbdfdc295742 100644 (file)
@@ -697,10 +697,6 @@ bool LyXText::draw(DrawRowParams & p, pos_type & vpos)
 }
 
 
-// Returns the left beginning of the text.
-// This information cannot be taken from the layouts-objekt, because in
-// LaTeX the beginning of the text fits in some cases (for example sections)
-// exactly the label-width.
 int LyXText::leftMargin(BufferView * bview, Row const * row) const
 {
        Inset * ins;
index 4507f48272cef9a03678d5ec5252179452b7e10d..2620dde25db555bc0922c773e43685c175086ed9 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
-#ifndef Trans_Manager_h
-#define Trans_Manager_h
+#ifndef TRANS_MANAGER_H
+#define TRANS_MANAGER_H
 
 #ifdef __GNUG__
 #pragma interface
@@ -14,7 +14,7 @@
 class LyXText;
 class Trans;
 
-/// Translation State
+/// Translation state
 class TransState {
 public:
        ///
@@ -187,4 +187,4 @@ string const TransManager::deadkey(char c, KmodInfo t)
        return trans_fsm_.currentState->deadkey(c, t);
 }
 
-#endif
+#endif // TRANS_MANAGER_H