]> git.lyx.org Git - features.git/commitdiff
more mathed cleanup
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 13 Feb 2001 19:10:18 +0000 (19:10 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 13 Feb 2001 19:10:18 +0000 (19:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1500 a592a061-630c-0410-9148-cb99ea01b6c8

32 files changed:
src/mathed/ChangeLog
src/mathed/Makefile.am
src/mathed/array.C
src/mathed/array.h
src/mathed/formula.C
src/mathed/formula.h
src/mathed/formulamacro.C
src/mathed/math_accentinset.C
src/mathed/math_accentinset.h
src/mathed/math_bigopinset.h
src/mathed/math_cursor.C
src/mathed/math_cursor.h
src/mathed/math_defs.h
src/mathed/math_dotsinset.h
src/mathed/math_draw.C
src/mathed/math_funcinset.h
src/mathed/math_hash.C
src/mathed/math_inset.h
src/mathed/math_iter.h
src/mathed/math_macro.C
src/mathed/math_macro.h
src/mathed/math_macrotable.C
src/mathed/math_panel.C
src/mathed/math_parinset.C
src/mathed/math_parinset.h
src/mathed/math_spaceinset.C
src/mathed/math_spaceinset.h
src/mathed/math_write.C
src/mathed/math_xiter.C
src/mathed/math_xiter.h
src/mathed/support.C
src/mathed/support.h

index f05e4cf95c09b6a9a92f1174878fc93babb5eff2..9ae6438a2a069da26950e27a9a9da0cbe8685a69 100644 (file)
@@ -1,5 +1,47 @@
 2001-02-13  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
+       * math_spaceinset.C (GetSpace): move here
+
+       * math_parinset.C: add debug.h, move several prev. inlined methods
+       here. 
+
+       * math_macrotable.C math_xiter.C support.C: add debug.h
+
+       * math_macro.h: remove debug.h, remove typedefs
+
+       * math_macro.C: remove FORMS_H_LOCATION, and LString.h, remove
+       extern decls.
+
+       * math_hash.C: change some defines to int const. change use of
+       LM_TC_NORMAL to LM_TC_VAR
+
+       * math_draw.C: delete file
+
+       * math_defs.h (MATH_DEFS): dont define byte here, remove unneded
+       forward decls. remove LM_TC_NORMAL, move inline methods to
+       support.C (and support.h)
+
+       * math_cursor.C: move several previous inlined methods here
+
+       * math_bigopinset.h math_dotsinset.h math_funcinset.h
+       math_parinset.h math_spaceinset.h: add math_defs.h
+
+       * math_accentinset.h: add support.h and math_defs.h
+
+       * formulamacro.C math_cursor.C math_iter.h math_write.C: add support.h
+
+       * formula.h: remove unused func decl: OpenMathInset
+
+       * formula.C math_inset.h: get rid of math_defs.h
+
+       * array.h: switch to support.h instead of math_defs.h
+
+       * array.C: remove one include
+
+       * Makefile.am (libmathed_la_SOURCES): remove math_draw.C
+
+       * math_panel.C (deco_cb): move the sizeof/sizeof to a const int.
+
        * math_parser.C: include macrotable and macrotemplate
 
        * math_macrotemplate.[Ch]: new files
index 07c84fe53bfadc6130f7fa244f4a59b9b09efb24..3b3e30b32e124e3f673a058dc7b26e4792fa3435 100644 (file)
@@ -31,7 +31,6 @@ libmathed_la_SOURCES = \
        math_deliminset.h \
        math_dotsinset.C \
        math_dotsinset.h \
-       math_draw.C \
        math_forms.C \
        math_forms.h \
        math_fracinset.C \
index 41bf1f4e4ec9a8c19ff52dc41666b53520643782..060effb04679aff0bf3710346dd51f002dcc0daf 100644 (file)
@@ -6,8 +6,6 @@
 #endif
 
 #include "array.h"
-#include "math_defs.h"
-
 
 // Is this still needed? (Lgb)
 static inline
index 0f3257951aff0143ed476f0227ddc06139b90d32..7801fcd7ddafd8811f41326b54864d1cbc54a8d0 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <vector>
 
-#include "math_defs.h"
+#include "mathed/support.h"
 
 class MathedInset;
 
index 67363caa0c79af950aa495617fd1e062865befb7..0997160e224de249744a4ce6e8a2b0d7308ede9f 100644 (file)
 #include "font.h"
 #include "support/lyxlib.h"
 #include "lyxrc.h"
-#include "math_defs.h"
 #include "math_inset.h"
 #include "math_parinset.h"
 #include "math_matrixinset.h"
 #include "math_rowst.h"
 #include "math_spaceinset.h"
 #include "math_deliminset.h"
-#include "support.h"
+#include "mathed/support.h"
 
 using std::ostream;
 using std::istream;
index f1dc758789d6001f1405c6cce1630de87aa68b1c..aa350a3f853eb7336f4473ddeb657b33f3a2f000 100644 (file)
@@ -128,10 +128,4 @@ private:
        ///
        string label;
 };
-
-
-// If a mathinset exist at cursor pos, just lock it.
-// Otherwise create a new one, and lock it.
-bool OpenMathInset(Buffer *);
-
 #endif
index 73af819f5e45f8815660ec44edcf53d8e6c5907f..2dfdbbf658b588b3d9abe617c26f3e886a2f1be1 100644 (file)
@@ -33,6 +33,7 @@
 #include "Painter.h"
 #include "font.h"
 #include "support/lyxlib.h"
+#include "mathed/support.h"
 
 using std::ostream;
 using std::istream;
index ac0fd1af216fb66c29b32bd597c6e5fe191f557d..e16b59be227b0514a066ad20897ee5dbe3e97a7e 100644 (file)
@@ -1,7 +1,7 @@
 #include <config.h>
 
 #include "math_accentinset.h"
-#include "support.h"
+#include "mathed/support.h"
 #include "math_parser.h"
 
 
index b6d29b4de8cdee79862b8a9cea9120030b250b94..d2b71402a227334bb1a2ba34d342ec3dfdb85b1d 100644 (file)
@@ -3,6 +3,8 @@
 #define MATH_ACCENTINSET_H
 
 #include "math_inset.h"
+#include "mathed/support.h"
+#include "math_defs.h"
 
 /// Accents
 class MathAccentInset: public MathedInset {
index 85c1e0b324240bf14c85feacc97c0c15c3fd0890..68aa22964e6df1a05d5ccedc76be440f40df40cb 100644 (file)
@@ -3,6 +3,7 @@
 #define MATH_BIGOPINSET_H
 
 #include "math_inset.h"
+#include "math_defs.h"
 
 /// big operators
 class MathBigopInset: public MathedInset {
index e91201eb7b321716d8a361fd2997c6bb3630f6e1..93479f7c23b78bff3bec1712885208bf8925e710 100644 (file)
@@ -40,6 +40,7 @@
 #include "math_decorationinset.h"
 #include "math_dotsinset.h"
 #include "math_accentinset.h"
+#include "mathed/support.h"
 
 static MathedArray * selarray = 0;
 
@@ -377,6 +378,7 @@ MathMatrixInset * create_multiline(short int type, int cols)
        return mt;
 }
 
+
 void MathedCursor::Insert(byte c, MathedTextCodes t)
 {  
    if (selection) SelDel();
@@ -1100,3 +1102,69 @@ void MathedCursor::toggleLastCode(MathedTextCodes t)
        else
                lastcode = t;
 }
+
+
+void MathedCursor::GetPos(int & x, int & y)
+{
+       cursor->GetPos(x, y);
+}
+
+
+short MathedCursor::GetFCode()
+{
+       return cursor->FCode();
+}
+
+
+MathParInset * MathedCursor::GetPar()
+{
+       return par;
+}
+
+
+MathParInset * MathedCursor::getCurrentPar() const
+{
+       return cursor->p;
+}
+
+
+string const & MathedCursor::getLabel() const
+{
+       return cursor->getLabel();
+}
+
+
+bool MathedCursor::IsEnd() const
+{
+       return !cursor->OK();
+}
+
+
+bool MathedCursor::InMacroMode()
+{
+       return macro_mode;
+}
+
+
+bool MathedCursor::Selection()
+{
+       return selection;
+}
+
+
+void MathedCursor::clearLastCode()
+{
+       lastcode = LM_TC_MIN;
+}
+
+
+void MathedCursor::setLastCode(MathedTextCodes t)
+{
+       lastcode = t;
+}
+
+
+MathedTextCodes MathedCursor::getLastCode() const
+{
+       return lastcode;
+}
index 5f6721553df29d2dcd4706600660d1b36c947253..60f76d2512e48fdc34e4fba853545558a22e4cd0 100644 (file)
 #pragma interface
 #endif
 
-#include "math_iter.h" 
-//#include "math_inset.h"
 #include "math_xiter.h"
 
 class MathFuncInset;
+class MathParInset;
+class Painter;
 
 
 /// This is the external interface of Mathed's subkernel
@@ -69,13 +69,13 @@ public:
        ///
        void SetPos(int, int);
        ///
-       void GetPos(int & x, int & y) { cursor->GetPos(x, y); }
+       void GetPos(int & x, int & y);
        ///
-       short GetFCode() { return cursor->FCode(); }
+       short GetFCode();
        ///
-       MathParInset * GetPar() { return par; }
+       MathParInset * GetPar();
        ///
-       MathParInset * getCurrentPar() const { return cursor->p; }
+       MathParInset * getCurrentPar() const;
        ///
        void SetPar(MathParInset *);
        ///
@@ -87,9 +87,7 @@ public:
        ///
        void setLabel(string const &);
        ///
-       string const & getLabel() const {
-               return cursor->getLabel();
-       }
+       string const & getLabel() const;
        ///
        bool Limits();
        /// Set accent: if argument = 0 it's considered consumed 
@@ -97,18 +95,18 @@ public:
        /// Returns last accent
        int getAccent() const;
        ///
-       bool IsEnd() const { return !cursor->OK(); }
+       bool IsEnd() const;
        // Macro mode methods
        ///
        void MacroModeOpen();
        ///
        void MacroModeClose();
        ///
-       bool InMacroMode() { return macro_mode; }
+       bool InMacroMode();
        
        // Local selection methods
        ///
-       bool Selection() { return selection; }
+       bool Selection();
        ///
        void SelCopy();
        ///
@@ -126,13 +124,13 @@ public:
        ///
        void SelGetArea(int ** xp, int ** yp, int & n);
        ///
-       void clearLastCode() { lastcode = LM_TC_MIN; }
+       void clearLastCode();
        ///
-       void setLastCode(MathedTextCodes t) { lastcode = t; }
+       void setLastCode(MathedTextCodes t);
        ///
        void toggleLastCode(MathedTextCodes t);
        ///
-       MathedTextCodes getLastCode() const { return lastcode; }
+       MathedTextCodes getLastCode() const;
        
 protected:
        ///
index 549159418342088ad663a64e256dca8d2294e58f..c207d821fa1dad230251bca498e9b76a50f5695a 100644 (file)
 #include <iosfwd>
 
 #include "LString.h"
-#include "debug.h"
-
-//#include "array.h"
-
-class MathedArray;
-class Painter;
-
-#ifndef byte
-#define byte unsigned char
-#endif
 
 ///
 enum math_align {
@@ -133,10 +123,7 @@ enum MathedTextCodes  {
 ///
 std::ostream & operator<<(std::ostream &, MathedTextCodes mtc);
 
-///
-#define LM_TC_NORMAL LM_TC_VAR
-       
+
 /// Types of lyx-math insets 
 enum MathedInsetTypes  {
        ///
@@ -200,6 +187,7 @@ enum MathedInsetTypes  {
        LM_OT_MAX
 };
 
+
 ///
 enum MathedBinaryTypes {
        ///
@@ -212,8 +200,6 @@ enum MathedBinaryTypes {
        LMB_BOP = (LMB_RELATION | LMB_OPERATOR)
 };
 
-class MathParInset;
-
 
 /// Paragraph permissions
 enum MathedParFlag {
@@ -232,146 +218,4 @@ enum MathedParFlag {
        LMPF_SCRIPT = 32
 };
 
-
-
-
-
-/*************************  Prototypes  **********************************/
-/// 
-MathedArray * mathed_parse(unsigned flags, MathedArray * data,
-                           MathParInset ** mt);
-///
-void mathed_write(MathParInset *, std::ostream &, int *, bool fragile,
-                 string const & label = string());
-
-///
-void mathed_parser_file(std::istream &, int);
-///
-int mathed_parser_lineno();
-///
-int MathedLookupBOP(short);
-
-/************************ Inline functions ********************************/
-
-///
-inline
-bool MathIsInset(short x)
-{
-       return LM_TC_INSET <= x && x <= LM_TC_ACTIVE_INSET;
-}
-
-///
-inline
-bool MathIsFont(short x)
-{
-       return LM_TC_CONST <= x && x <= LM_TC_BSYM;
-}
-
-///
-inline
-bool MathIsAlphaFont(short x)
-{
-       return LM_TC_VAR <= x && x <= LM_TC_TEXTRM;
-}
-
-///
-inline
-bool MathIsActive(short x)
-{
-       return LM_TC_INSET < x && x <= LM_TC_ACTIVE_INSET;
-}
-
-///
-inline
-bool MathIsUp(short x)
-{
-       return x == LM_TC_UP;
-}
-
-///
-inline
-bool MathIsDown(short x)
-{
-       return x == LM_TC_DOWN;
-}
-
-///
-inline
-bool MathIsScript(short x)
-{
-       return x == LM_TC_DOWN || x == LM_TC_UP;
-}
-
-///
-inline
-bool MathIsBOPS(short x)
-{
-       return MathedLookupBOP(x) > LMB_NONE;
-}
-
-///
-inline
-bool MathIsBinary(short x)
-{
-    return x == LM_TC_BOP || x == LM_TC_BOPS;
-}
-
-///
-inline
-bool MathIsSymbol(short x) {
-    return LM_TC_SYMB <= x && x <= LM_TC_BSYM;
-}
-     
-
-inline
-bool is_eqn_type(short int type)
-{
-       return type >= LM_OT_MIN && type < LM_OT_MATRIX;
-}
-
-
-inline
-bool is_matrix_type(short int type)
-{
-       return type == LM_OT_MATRIX;
-}
-
-inline
-bool is_multiline(short int type)
-{
-       return type >= LM_OT_MPAR && type < LM_OT_MATRIX;
-}
-
-
-inline bool is_ams(short int type)
-{
-       return type > LM_OT_MPARN && type < LM_OT_MATRIX;
-}
-
-inline
-bool is_singlely_numbered(short int type)
-{
-       return type == LM_OT_PARN || type == LM_OT_MULTLINEN;
-}
-
-inline
-bool is_multi_numbered(short int type)
-{
-       return type == LM_OT_MPARN || type == LM_OT_ALIGNN
-               || type == LM_OT_ALIGNATN;
-}
-
-inline
-bool is_numbered(short int type)
-{
-       return is_singlely_numbered(type) || is_multi_numbered(type);
-}
-
-inline
-bool is_multicolumn(short int type)
-{
-       return type == LM_OT_ALIGN || type == LM_OT_ALIGNN
-               || type == LM_OT_ALIGNAT || type == LM_OT_ALIGNATN;
-}
-
 #endif
index 0e848087a3ddd241609c22cfc7247c8fc6dd19be..e605aaa6e2de06328c4254abee3a1dcbe881b595 100644 (file)
@@ -2,6 +2,7 @@
 #define MATH_DOTSINSET_H
 
 #include "math_inset.h"
+#include "math_defs.h"
 
 ///
 class MathDotsInset: public MathedInset {
index 1ec03491f55a6ade02f41bea55f19dfff77644a0..05decd171dd65b009be3d4050f646eb9e1b804c1 100644 (file)
 
 using std::endl;
 
-extern LyXFont const mathed_get_font(short type, int size);
-extern int mathed_char_width(short type, int style, byte c);
-extern int mathed_string_width(short type, int style, string const &);
-extern int mathed_string_height(short, int, string const &, int &, int &);
-extern int mathed_char_height(short, int, byte, int &, int &);
+//extern LyXFont const mathed_get_font(short type, int size);
+//extern int mathed_char_width(short type, int style, byte c);
+//extern int mathed_string_width(short type, int style, string const &);
+//extern int mathed_string_height(short, int, string const &, int &, int &);
+//extern int mathed_char_height(short, int, byte, int &, int &);
 
 
 
index b08fefa026bcaee6f1124f21e30f38dd5ad2f95d..3758907e885ec07f5ed5dfd520e0c9f2958911e1 100644 (file)
@@ -2,6 +2,7 @@
 #define MATH_FUNCINSET_H
 
 #include "math_inset.h"
+#include "math_defs.h"
 
 /**
  Functions or LaTeX names for objects that I don't know how to draw.
index 66af12bcdb0dc3ca1995c2b707c3f923ca90bc08..ae083544dd13bdb4595143722ccdc54be5f6bb79 100644 (file)
@@ -7,13 +7,21 @@
 
 #include "math_defs.h"
 #include "math_parser.h"
-//struct latexkeys { char* name; short token; int id; };
 
+#if 0
 #define TOTAL_KEYWORDS 269
 #define MIN_WORD_LENGTH 2
 #define MAX_WORD_LENGTH 18
 #define MIN_HASH_VALUE 8
 #define MAX_HASH_VALUE 490
+#else
+int const TOTAL_KEYWORDS = 269;
+int const MIN_WORD_LENGTH = 2;
+int const MAX_WORD_LENGTH = 18;
+int const MIN_HASH_VALUE = 8;
+int const MAX_HASH_VALUE = 490;
+#endif
+
 /* maximum key range = 483, duplicates = 40 */
 
 static
@@ -179,7 +187,7 @@ latexkeys wordlist[] =
       {"cap",  LM_TK_SYM, LM_cap},
       {"cup",  LM_TK_SYM, LM_cup},
       {"prec",  LM_TK_SYM, LM_prec},
-      {"mathnormal",  LM_TK_FONT, LM_TC_NORMAL},
+      {"mathnormal",  LM_TK_FONT, LM_TC_VAR},
       {"wr",  LM_TK_SYM, LM_wr},
       {"inf",  LM_TK_FUNCLIM, 0},
       {"bigoplus",  LM_TK_BIGSYM, LM_oplus},
index fa759c5af6c196dc1f492926f53f9363ee88b70f..530b82ff868c96fd137e1ec7abbc851afaad7cc4 100644 (file)
 #endif
 
 #include "LString.h"
-#include "math_defs.h"
 #include "symbol_def.h"
 
+class Painter;
+
 /** Abstract base class for all math objects.
     A math insets is for use of the math editor only, it isn't a
     general LyX inset. It's used to represent all the math objects.
index bdf8c676c610aec6f9a5352bb794a5670f88827a..0973415f616164e7be50095bbfff63a89f0db13b 100644 (file)
 #pragma interface
 #endif
 
+#include "mathed/support.h"
 #include "math_defs.h"
 
 class MathedInset;
+class MathedArray;
+class MathParInset;
 
 ///
 enum mathIterFlags {
index 632c3d76763742c3da7d4da66cc00912bf5ce817..79d4d7c37fe270c6a41ffa44b5464232df31c57f 100644 (file)
  */
 
 #include <config.h>
-#include FORMS_H_LOCATION
 
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include "LString.h"
 #include "math_macro.h"
 #include "array.h"
 #include "math_iter.h"
@@ -46,9 +44,6 @@ ostream & operator<<(ostream & o, MathedTextCodes mtc)
 }
 
 
-//extern int mathed_string_width(short type, int style, string const & s);
-//extern int mathed_string_height(short, int, string const &, int &, int &);
-
 MathMacro::MathMacro(MathMacroTemplate * t): 
        MathParInset(LM_ST_TEXT, "", LM_OT_MACRO), tmplate(t)
 {
@@ -80,6 +75,7 @@ MathMacro::MathMacro(MathMacro * m):
        }
 }
 
+
 MathMacro::~MathMacro()
 {
        for (idx = 0; idx < nargs; ++idx) {
@@ -110,7 +106,8 @@ void MathMacro::Metrics()
 
 void MathMacro::draw(Painter & pain, int x, int y)
 {
-       xo = x;  yo = y;
+       xo = x;
+       yo = y;
        Metrics();
        tmplate->update(this);
        tmplate->SetStyle(size);
@@ -157,7 +154,8 @@ int MathMacro::GetColumns() const
 
 void MathMacro::GetXY(int & x, int & y) const
 {
-       x = args_[idx].x;  y = args_[idx].y;
+       x = args_[idx].x;
+       y = args_[idx].y;
 }
 
 
index f63466cd0b53808e374da0e1c47619eec1fd5b50..a250e98299ef1e72c988e03d1f398299536763ad 100644 (file)
@@ -22,9 +22,7 @@
 #endif
 
 #include <vector>
-
 #include "math_parinset.h"
-#include "debug.h"
 
 class MathMacroTemplate;
 
@@ -71,14 +69,15 @@ public:
        MathedTextCodes getTCode() const;
        ///
        bool Permit(short) const;
-    
 private:
        ///
        MathMacroTemplate * tmplate;
        ///
        struct MacroArgumentBase {
                /// Position of the macro
-               int x, y;
+               int x;
+               ///
+               int y;
                ///
                MathedRowSt * row;
                ///
@@ -96,10 +95,4 @@ private:
        ///
        friend class MathMacroTemplate;
 };
-
-///
-//typedef MathMacro * MathMacroP;
-///
-//typedef MathMacroTemplate * MathMacroTemplateP;
-
 #endif
index f39799459e334599a5b55f2e8574a1d1eaa35c80..b34ac612c8944c4791de74fa8bf2bdc30396776f 100644 (file)
@@ -9,6 +9,7 @@
 #include "math_deliminset.h"
 #include "math_fracinset.h"
 #include "math_parinset.h"
+#include "debug.h"
 
 
 MathMacroTable MathMacroTable::mathMTable;
index 22471c2f51d3aa55787b7b45e15498ef9dafac14..e81521bdbbb91e6ad3e1300e915156493c88ed33 100644 (file)
@@ -241,11 +241,12 @@ void deco_cb(FL_OBJECT *, long data)
     case MM_APPLY:
     case MM_OK:
       { 
-        int i = fl_get_bmtable(fd_deco->menu);
+        int const i = fl_get_bmtable(fd_deco->menu);
+        int const l = sizeof(deco_code)/sizeof(deco_code[0]);
         // ideally the callback should not be called if the index is
         // greater than the maxitem of the bmtable, but I do not know
         // how to enforce that (JMarc)
-        if (i <= sizeof(deco_code)/sizeof(deco_code[0])) {
+        if (i <= l) {
           lyxfunc->Dispatch(LFUN_INSERT_MATH, deco_code[i]);
           if (data == MM_APPLY) break;
         }
index a676e9ebadd6114aff962705041d7fd4a3b3f172..ea10c0baf9b8fd786740c5c0ebca3494526648b9 100644 (file)
@@ -10,6 +10,7 @@
 #include "math_parser.h"
 #include "math_rowst.h"
 #include "math_parinset.h"
+#include "debug.h"
 
 using std::endl;
 
@@ -392,3 +393,64 @@ void MathParInset::Write(ostream & os, bool fragile)
        if (brace > 0)
                os << string(brace, '}');
 }
+
+
+bool MathParInset::Inside(int x, int y) 
+{
+  return (x >= xo && x <= xo + width
+         && y <= yo + descent && y >= yo - ascent);
+}
+
+
+void MathParInset::GetXY(int & x, int & y) const
+{
+   x = xo;
+   y = yo;
+}
+
+
+void MathParInset::UserSetSize(short sz)
+{
+   if (sz >= 0) {
+       size = sz;      
+       flag = flag & ~LMPF_FIXED_SIZE;
+   }
+}
+
+
+void MathParInset::SetStyle(short sz) 
+{
+    if (Permit(LMPF_FIXED_SIZE)) {
+       if (Permit(LMPF_SCRIPT)) 
+         sz = (sz < LM_ST_SCRIPT) ? LM_ST_SCRIPT: LM_ST_SCRIPTSCRIPT;
+       if (Permit(LMPF_SMALLER) && sz < LM_ST_SCRIPTSCRIPT) {
+           ++sz;
+       } 
+       MathedInset::SetStyle(sz);
+    }
+}
+
+
+void  MathParInset::setFlag(MathedParFlag f)
+{
+       flag |= f;
+}
+
+
+bool MathParInset::Permit(short f) const
+{
+       return bool(f & flag);
+}
+
+
+MathedArray * MathParInset::GetData()
+{
+       return array;
+}
+
+
+void MathParInset::setXY(int x, int y)
+{
+       xo = x;
+       yo = y;
+}
index 04938942919a1a0bdead6279f67b3a7454087393..52ab59ad2daaffd222a45f242f3824d195fe7211 100644 (file)
@@ -3,8 +3,10 @@
 #define MATH_PARINSET_H
 
 #include "math_inset.h"
+#include "math_defs.h"
 
 struct MathedRowSt;
+class MathedArray;
 
 
 /** The math paragraph base class, base to all editable math objects */
@@ -31,11 +33,11 @@ class MathParInset: public MathedInset  {
     /// Data is stored in a LyXArray
     virtual void SetData(MathedArray *);
     ///
-    virtual MathedArray * GetData() { return array; }
+    virtual MathedArray * GetData();
     /// Paragraph position
     virtual void GetXY(int &, int &) const;
     ///
-    virtual void setXY(int x, int y) { xo = x;  yo = y; }
+    virtual void setXY(int x, int y);
     ///
     virtual void SetFocus(int, int) {}
     ///
@@ -65,7 +67,7 @@ class MathParInset: public MathedInset  {
     ///
     virtual void setRowSt(MathedRowSt *) {}
     ///
-    virtual bool Permit(short f) const { return bool(f & flag); }
+    virtual bool Permit(short f) const;
  protected:
     /// Paragraph data is stored here
     MathedArray * array;
@@ -77,7 +79,7 @@ class MathParInset: public MathedInset  {
     short flag;
  private:
     ///
-    virtual void setFlag(MathedParFlag f) { flag |= f; }
+    virtual void setFlag(MathedParFlag f);
     ///
     friend class InsetFormula;
     ///
@@ -91,40 +93,4 @@ class MathParInset: public MathedInset  {
 };
 
 
-inline
-bool MathParInset::Inside(int x, int y) 
-{
-  return (x >= xo && x <= xo + width && y <= yo + descent && y >= yo - ascent);
-}
-
-
-inline
-void MathParInset::GetXY(int & x, int & y) const
-{
-   x = xo; y = yo;
-}
-
-
-inline
-void MathParInset::UserSetSize(short sz)
-{
-   if (sz >= 0) {
-       size = sz;      
-       flag = flag & ~LMPF_FIXED_SIZE;
-   }
-}
-
-
-inline
-void MathParInset::SetStyle(short sz) 
-{
-    if (Permit(LMPF_FIXED_SIZE)) {
-       if (Permit(LMPF_SCRIPT)) 
-         sz = (sz < LM_ST_SCRIPT) ? LM_ST_SCRIPT: LM_ST_SCRIPTSCRIPT;
-       if (Permit(LMPF_SMALLER) && sz < LM_ST_SCRIPTSCRIPT) {
-           ++sz;
-       } 
-       MathedInset::SetStyle(sz);
-    }
-}
 #endif
index 11a51d9228578183ea1960e5e5bda991b31aea7e..c7561ccda3b6ada54b1610ea99870f2f50a8c5a8 100644 (file)
@@ -61,3 +61,9 @@ MathSpaceInset::Write(ostream & os, bool /* fragile */)
           os << '\\' << latex_mathspace[space] << ' ';
    }
 }
+
+
+int MathSpaceInset::GetSpace()
+{
+       return space;
+}
index fb91b26d12d113ea7acd27d9ae8677b65490a54f..31343c3fed6e021306d52d5ebed345711c3c51ef 100644 (file)
@@ -2,6 +2,7 @@
 #define MATH_SPACEINSET_H
 
 #include "math_inset.h"
+#include "math_defs.h"
 
 /// Smart spaces
 class MathSpaceInset: public MathedInset  {
@@ -19,7 +20,7 @@ public:
        ///
        void SetSpace(int sp);
        ///
-       int GetSpace() { return space; }
+       int GetSpace();
 protected:
        ///
        int space;
index 97cfd6d5486b3bc56b3198c27bc032a1441c7862..b340523ed6d47dd4511cb353e42d4c06456be388 100644 (file)
@@ -22,6 +22,7 @@
 #include "math_iter.h"
 #include "math_parser.h"
 #include "math_parinset.h"
+#include "mathed/support.h"
 #include "support/lstrings.h"
 #include "debug.h"
 
@@ -29,7 +30,6 @@ using std::ostream;
 using std::endl;
 
 extern char const * latex_mathenv[];
-extern char * latex_mathspace[];
 
 // quite a hack i know. Should be done with return values...
 int number_of_newlines = 0;
index ba56a484086235683025ada8f71e7a80b131b7a8..046257659f3b024c0a11a0bf50e1f957b05118f2 100644 (file)
@@ -5,6 +5,7 @@
 #include "math_rowst.h"
 #include "array.h"
 #include "mathed/support.h"
+#include "debug.h"
 
 using std::endl;
 
index d11e55e58ec23c2f729b087a26f1027d973e320a..77d6324282c59f9b699e3d8a0859c6829dde49a9 100644 (file)
@@ -5,6 +5,7 @@
 #include "math_iter.h"
 
 struct MathedRowSt;
+class MathParInset;
 
 /**
    A graphic iterator (updates position.) Used for
index b815aaf53717fa7cef007e87a4fb24df9d60cfa7..2e2e48a70974d211ad5bc8df6ef31a30f565c453 100644 (file)
@@ -9,6 +9,7 @@
 #include "Painter.h"
 #include "matriz.h"
 #include "symbol_def.h"
+#include "debug.h"
 
 using std::sort;
 using std::lower_bound;
@@ -456,3 +457,112 @@ math_deco_struct const * search_deco(int code)
        return 0;
 }
 #endif
+
+
+bool MathIsInset(short x)
+{
+       return LM_TC_INSET <= x && x <= LM_TC_ACTIVE_INSET;
+}
+
+
+bool MathIsFont(short x)
+{
+       return LM_TC_CONST <= x && x <= LM_TC_BSYM;
+}
+
+
+bool MathIsAlphaFont(short x)
+{
+       return LM_TC_VAR <= x && x <= LM_TC_TEXTRM;
+}
+
+
+bool MathIsActive(short x)
+{
+       return LM_TC_INSET < x && x <= LM_TC_ACTIVE_INSET;
+}
+
+
+bool MathIsUp(short x)
+{
+       return x == LM_TC_UP;
+}
+
+
+bool MathIsDown(short x)
+{
+       return x == LM_TC_DOWN;
+}
+
+
+bool MathIsScript(short x)
+{
+       return x == LM_TC_DOWN || x == LM_TC_UP;
+}
+
+
+bool MathIsBOPS(short x)
+{
+       return MathedLookupBOP(x) > LMB_NONE;
+}
+
+
+bool MathIsBinary(short x)
+{
+    return x == LM_TC_BOP || x == LM_TC_BOPS;
+}
+
+
+bool MathIsSymbol(short x) {
+    return LM_TC_SYMB <= x && x <= LM_TC_BSYM;
+}
+     
+
+bool is_eqn_type(short int type)
+{
+       return type >= LM_OT_MIN && type < LM_OT_MATRIX;
+}
+
+
+bool is_matrix_type(short int type)
+{
+       return type == LM_OT_MATRIX;
+}
+
+
+bool is_multiline(short int type)
+{
+       return type >= LM_OT_MPAR && type < LM_OT_MATRIX;
+}
+
+
+bool is_ams(short int type)
+{
+       return type > LM_OT_MPARN && type < LM_OT_MATRIX;
+}
+
+
+bool is_singlely_numbered(short int type)
+{
+       return type == LM_OT_PARN || type == LM_OT_MULTLINEN;
+}
+
+
+bool is_multi_numbered(short int type)
+{
+       return type == LM_OT_MPARN || type == LM_OT_ALIGNN
+               || type == LM_OT_ALIGNATN;
+}
+
+
+bool is_numbered(short int type)
+{
+       return is_singlely_numbered(type) || is_multi_numbered(type);
+}
+
+
+bool is_multicolumn(short int type)
+{
+       return type == LM_OT_ALIGN || type == LM_OT_ALIGNN
+               || type == LM_OT_ALIGNAT || type == LM_OT_ALIGNATN;
+}
index ee74a90ac583629193d9decee24a525c49d66884..3273d1e25f1e6d0083ead9d5f170681619c41276 100644 (file)
@@ -10,6 +10,8 @@
 #endif
 
 class Painter;
+class MathedArray;
+class MathParInset;
 
 struct math_deco_struct {
        int code;
@@ -31,4 +33,78 @@ extern int mathed_string_height(short type, int size, string const & s,
                                int & asc, int & des);
 extern int mathed_string_width(short type, int size, string const & s);
 extern math_deco_struct const * search_deco(int code);
+
+/// math_parser.C
+extern
+MathedArray * mathed_parse(unsigned flags, MathedArray * data,
+                           MathParInset ** mt);
+/// math_write.C
+extern
+void mathed_write(MathParInset *, std::ostream &, int *, bool fragile,
+                 string const & label = string());
+
+/// math_parser.C
+extern
+void mathed_parser_file(std::istream &, int);
+/// math_parser.C
+extern
+int mathed_parser_lineno();
+/// math_utils.C
+extern
+int MathedLookupBOP(short);
+
+extern
+bool MathIsInset(short x);
+
+extern
+bool MathIsFont(short x);
+
+extern
+bool MathIsAlphaFont(short x);
+
+extern
+bool MathIsActive(short x);
+
+extern
+bool MathIsUp(short x);
+
+extern
+bool MathIsDown(short x);
+
+extern
+bool MathIsScript(short x);
+
+extern
+bool MathIsBOPS(short x);
+
+extern
+bool MathIsBinary(short x);
+
+extern
+bool MathIsSymbol(short x);
+
+extern
+bool is_eqn_type(short int type);
+
+extern
+bool is_matrix_type(short int type);
+
+extern
+bool is_multiline(short int type);
+
+extern
+bool is_ams(short int type);
+
+extern
+bool is_singlely_numbered(short int type);
+
+extern
+bool is_multi_numbered(short int type);
+
+extern
+bool is_numbered(short int type);
+
+extern
+bool is_multicolumn(short int type);
+
 #endif