]> git.lyx.org Git - features.git/commitdiff
some inline fix + mathed16.diff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 13 Feb 2001 15:27:03 +0000 (15:27 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 13 Feb 2001 15:27:03 +0000 (15:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1496 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/math_iter.C
src/mathed/math_iter.h
src/mathed/math_macro.C
src/mathed/math_macro.h
src/mathed/math_xiter.C
src/mathed/math_xiter.h

index 72af1de76223503cadcf8402908bdace744d8246..71d3948aad61a0ce22aa63d131cd2e61e44eb0f8 100644 (file)
@@ -1,5 +1,7 @@
 2001-02-13  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
+       * math_xiter.h: remove a couple of "inline"
+
        * array.C (strange_copy): fix bug (hopefully) 
        * many files: add a lot of new files and move methods to the class
        files they belong to. Only first attempt at cleanup more will
index a9cb0b006cc509e9bc1e4ac813d11c1576f0e4d9..781d14b3587147bbeaf021c0277f5ae7a781848c 100644 (file)
 #include "symbol_def.h"
 #include "support/lstrings.h"
 #include "debug.h"
+#include "mathed/support.h"
 
 using std::endl;
 
 const int SizeInset = sizeof(char*) + 2;
 
-extern int mathed_char_width(short type, int style, byte c);
-extern int mathed_string_width(short type, int style, string const & s);
-extern int mathed_char_height(short, int, byte, int &, int &);
+//extern int mathed_char_width(short type, int style, byte c);
+//extern int mathed_string_width(short type, int style, string const & s);
+//extern int mathed_char_height(short, int, byte, int &, int &);
+
+
+MathedIter::MathedIter()
+       : flags(0), fcode(0), pos(0), row(0), col(0), ncols(0), array(0)
+{}
+
 
 void MathedIter::SetData(MathedArray * a)
 {
        array = a; Reset();
index 29bf9297c1a7f1c2cae3c6e45e4eed8a88ea8599..bdf8c676c610aec6f9a5352bb794a5670f88827a 100644 (file)
@@ -30,10 +30,10 @@ class MathedInset;
 
 ///
 enum mathIterFlags {
-    /// Allow newlines
-    MthIF_CR = 1,
-    /// Allow tabs
-    MthIF_Tabs = 2
+       /// Allow newlines
+       MthIF_CR = 1,
+       /// Allow tabs
+       MthIF_Tabs = 2
 };
 
 
@@ -43,13 +43,7 @@ enum mathIterFlags {
 class MathedIter {
 public:
        ///
-       MathedIter() {
-               pos = 0;
-               fcode = 0;
-               array = 0;
-               flags = 0;
-               ncols = row = col = 0;
-       }
+       MathedIter();
        ///
        explicit
        MathedIter(MathedArray *);
@@ -131,7 +125,11 @@ protected:
        ///
        mutable int pos;
        ///
-       int row, col, ncols;
+       int row;
+       ///
+       int col;
+       ///
+       int ncols;
        ///
        MathedArray * array;
        // one element stack
@@ -139,9 +137,15 @@ protected:
                ///
                short fcode;
                ///
-               int x, y;
+               int x;
+               ///
+               int y;
+               ///
+               int pos;
+               ///
+               int row;
                ///
-               int pos, row, col;
+               int col;
        };
        ///
        MIState stck;
@@ -152,8 +156,8 @@ protected:
 };
 
 ///
-#define MX_WAS_SUB   1
+//#define MX_WAS_SUB   1
 ///
-#define MX_WAS_SUPER 2
+//#define MX_WAS_SUPER 2
 
 #endif
index 22562489f4b701b57e9e34fc4eba99dea9952b28..5274462b061420ef92df776b3875a929bce19523 100644 (file)
@@ -406,37 +406,20 @@ void MathMacroTemplate::SetMacroFocus(int &idx, int x, int y)
 
 /* -------------------------- MathMacroTable -----------------------*/
 
-MathMacroTable::MathMacroTable(int n) : max_macros(n)
-{
-    macro_table = new MathMacroTemplateP[max_macros];
-    num_macros = 0;
-}
-
-
-MathMacroTable::~MathMacroTable()
-{
-    delete[] macro_table;
-}
-
-
 // The search is currently linear but will be binary or hash, later.
 MathMacroTemplate * MathMacroTable::getTemplate(string const & name) const
 {
-    for (int i = 0; i < num_macros; ++i) {
-      if (name == macro_table[i]->GetName()) 
-       return macro_table[i];
-    }
-    
-    return 0;
+       for (size_type i = 0; i < macro_table.size(); ++i) {
+               if (name == macro_table[i]->GetName()) 
+                       return macro_table[i];
+       }
+
+       return 0;
 }
 
 void MathMacroTable::addTemplate(MathMacroTemplate * m)
 {
-    if (num_macros < max_macros)
-      macro_table[num_macros++] = m;
-    else
-           lyxerr << "Error (MathMacroTable::addTemplate): "
-                   "Macro table exhausted!" << endl;
+       macro_table.push_back(m);
 }
 
 
@@ -531,5 +514,5 @@ void MathMacroTable::builtinMacros()
 }
 
 
-MathMacroTable MathMacroTable::mathMTable(255);
+MathMacroTable MathMacroTable::mathMTable;
 bool MathMacroTable::built = false;
index cc8ea80f2dde914736dc56807c6379b2ed177247..6f0de9d645ed08e7b33f5973e6420f9408858b9c 100644 (file)
@@ -190,11 +190,6 @@ typedef MathMacroTemplate * MathMacroTemplateP;
 ///
 class MathMacroTable {
 public:
-    ///
-    explicit
-    MathMacroTable(int);
-    ///
-    ~MathMacroTable();
     ///
     void addTemplate(MathMacroTemplate *);
     ///
@@ -210,11 +205,11 @@ public:
     
 private:
     ///
-    const int max_macros;
-    ///
-    int num_macros;
+    typedef std::vector<MathMacroTemplateP> table_type;
+               ///
+    typedef table_type::size_type size_type;
     ///
-    MathMacroTemplateP * macro_table;
+    table_type macro_table;
 };
 
 
index 0fa446250e5a7e8f7762bd3b29c22f3559b55802..558395858d5c5755bbc1ad116322903f9ee2e06e 100644 (file)
@@ -16,6 +16,12 @@ MathedXIter::MathedXIter()
 }
 
 
+MathParInset * MathedXIter::getPar() const
+{
+       return p;
+}
+
+
 void MathedXIter::GetPos(int & xx, int & yy) const
 { 
        if (p) 
index b97aaafc9953baa656eab107f9b2fba80089a0e4..d11e55e58ec23c2f729b087a26f1027d973e320a 100644 (file)
 struct MathedRowSt;
 
 /**
- A graphic iterator (updates position.) Used for
- metrics and updating cursor position
- */
  A graphic iterator (updates position.) Used for
  metrics and updating cursor position
+*/
 class MathedXIter: public MathedIter {
-  public:
-  ///
-  MathedXIter();
-    //
-    MathedXIter(MathParInset *);
-    ///
-    void SetData(MathParInset *);
-    ///
-    MathParInset * getPar() const { return p; }
-    ///
-    bool Next();
-    ///
-    bool Prev();
-    ///
-    bool Up();
-    ///
-    bool Down();
-    ///
-    bool goNextColumn();
-    ///
-    void GoLast();
-    ///
-    void GoBegin();
-    ///
-    void Adjust();
-    ///
-    inline
-    void GetPos(int &, int &) const;
-    ///
-    inline
-    void GetIncPos(int &, int &) const;
-    ///
-    string const GetString() const;
-    ///
-    int GetX() const;
-    ///
-    int GetY() const;
-    ///
-    void subMetrics(int, int);
-    ///
-    void fitCoord(int, int);
-    /// 
-    void getAD(int & a, int & d) const;
-    
-    /// Create a new row and insert #ncols# tabs.
-    void addRow();
-    ///
-    void delRow();
-    
-    ///
-    bool setLabel(string const & label);
-    ///
-    static string error_label;
-    ///
-    string const & getLabel() const;
-    ///
-    bool setNumbered(bool);
+public:
+       ///
+       MathedXIter();
+       //
+       MathedXIter(MathParInset *);
+       ///
+       void SetData(MathParInset *);
+       ///
+       MathParInset * getPar() const;
+       ///
+       bool Next();
+       ///
+       bool Prev();
+       ///
+       bool Up();
+       ///
+       bool Down();
+       ///
+       bool goNextColumn();
+       ///
+       void GoLast();
+       ///
+       void GoBegin();
+       ///
+       void Adjust();
+       ///
+       void GetPos(int &, int &) const;
+       ///
+       void GetIncPos(int &, int &) const;
+       ///
+       string const GetString() const;
+       ///
+       int GetX() const;
+       ///
+       int GetY() const;
+       ///
+       void subMetrics(int, int);
+       ///
+       void fitCoord(int, int);
+       /// 
+       void getAD(int & a, int & d) const;
        
-    ///
-    void setTab(int, int);
-    /// Merge the array at current position
-    void Merge(MathedArray *);
-    /// Delete every object from current position to pos2
-    void Clean(int pos2);
-    ///
-    MathedRowSt * adjustVerticalSt();
-    
+       /// Create a new row and insert #ncols# tabs.
+       void addRow();
+       ///
+       void delRow();
+       
+       ///
+       bool setLabel(string const & label);
+       ///
+       static string error_label;
+       ///
+       string const & getLabel() const;
+       ///
+       bool setNumbered(bool);
+       
+       ///
+       void setTab(int, int);
+       /// Merge the array at current position
+       void Merge(MathedArray *);
+       /// Delete every object from current position to pos2
+       void Clean(int pos2);
+       ///
+       MathedRowSt * adjustVerticalSt();
 private:
-    /// This function is not recursive, as MathPar::Metrics is
-    void IMetrics(int, int &, int &, int &);
-    /// Font size (display, text, script, script2) 
-    int size;
-    /// current position
-    mutable int x;
-    ///
-    int y;
-    ///
-    MathParInset * p;
-    
-    // Limits auxiliary variables
-    /// Position and max width of a script
-    int sx, sw;
-    /// true= center, false= left align (default)
-    bool limits;
-    /// Type of previous script
-    short s_type;  
-    ///
-    void ipush();
-    ///
-    void ipop();
-
+       /// This function is not recursive, as MathPar::Metrics is
+       void IMetrics(int, int &, int &, int &);
+       /// Font size (display, text, script, script2) 
+       int size;
+       /// current position
+       mutable int x;
+       ///
+       int y;
+       ///
+       MathParInset * p;
+       
+       // Limits auxiliary variables
+       /// Position and max width of a script
+       int sx;
+       ///
+       int sw;
+       /// true= center, false= left align (default)
+       bool limits;
+       /// Type of previous script
+       short s_type;  
+       ///
+       void ipush();
+       ///
+       void ipop();
 protected:
-    /// 
-    MathedRowSt * crow;
-    
+       /// 
+       MathedRowSt * crow;
+       
 private:
-    ///
-    friend class MathedCursor;
+       ///
+       friend class MathedCursor;
 };
 #endif