]> git.lyx.org Git - features.git/commitdiff
small stuff
authorAndré Pönitz <poenitz@gmx.net>
Fri, 10 Aug 2001 13:17:39 +0000 (13:17 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 10 Aug 2001 13:17:39 +0000 (13:17 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2484 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_charinset.C
src/mathed/math_charinset.h
src/mathed/math_cursor.C
src/mathed/math_inset.C
src/mathed/math_inset.h
src/mathed/math_parser.C

index 97f6759d2bd883e2ea798ffdcadd5b6f52deda21..24280e327700873246a1ca6144029f0cbb9c4d3f 100644 (file)
 
 
 MathCharInset::MathCharInset(char c, MathTextCodes t)
-       : char_(c)
-{
-       code(t);
-}
+       : char_(c), code_(t)
+{}
 
 
 MathInset * MathCharInset::clone() const
@@ -82,3 +80,9 @@ bool MathCharInset::isRelOp() const
 {
        return char_ == '=' || char_ == '<' || char_ == '>';
 }
+
+
+void MathCharInset::handleFont(MathTextCodes t)
+{
+       code_ = (code_ == t) ? LM_TC_VAR : t;
+}
index a6fef5ed9c5a4d721c91047ed709eafc97e6d0b0..c43eac27636519b5c1a4307113136c9c864ddd45 100644 (file)
@@ -38,9 +38,13 @@ public:
        char getChar() const { return char_; }
        ///
        bool isRelOp() const;
+       ///
+       void handleFont(MathTextCodes t);
 
 private:
        /// the character
        char char_;
+       /// 
+       MathTextCodes code_;
 };
 #endif
index 61889f756913f274d8d747fb6842033f3bbe8d84..aae83c91645c1d58cf2cd11aff1b05134eb0bdfe 100644 (file)
@@ -870,7 +870,8 @@ void MathCursor::drawSelection(Painter & pain) const
 
 MathTextCodes MathCursor::nextCode() const
 {
-       return (pos() == size()) ? LM_TC_MIN : nextInset()->code();
+       //return (pos() == size()) ? LM_TC_MIN : nextInset()->code();
+       return LM_TC_MIN;
 }
 
 
@@ -882,13 +883,8 @@ void MathCursor::handleFont(MathTextCodes t)
                getSelection(i1, i2); 
                if (i1.idx_ == i2.idx_) {
                        MathArray & ar = i1.cell();
-                       for (int pos = i1.pos_; pos != i2.pos_; ++pos) {
-                               MathInset * p = ar.nextInset(pos);      
-                               if (isalnum(p->getChar())) { 
-                                       MathTextCodes c = (p->code() == t) ? LM_TC_VAR : t;
-                                       p->code(c);
-                               }
-                       }
+                       for (int pos = i1.pos_; pos != i2.pos_; ++pos) 
+                               ar.nextInset(pos)->handleFont(t);
                }
        } else 
                lastcode_ = (lastcode_ == t) ? LM_TC_VAR : t;
index b7649d8ef13a0463ddc3ce0a5d5e0207943d7614..9bc23390677907a362a73df3f06b728794f56084 100644 (file)
@@ -27,7 +27,7 @@ int MathInset::workwidth;
 
 
 MathInset::MathInset()
-       : size_(LM_ST_DISPLAY), code_(LM_TC_MIN), xo_(0), yo_(0)
+       : size_(LM_ST_DISPLAY), xo_(0), yo_(0)
 {}
 
 
@@ -283,18 +283,6 @@ std::vector<int> MathInset::idxBetween(int from, int to) const
 }
 
 
-MathTextCodes MathInset::code() const
-{
-       return code_;
-}
-
-
-void MathInset::code(MathTextCodes t)
-{
-       code_ = t;
-}
-
-
 void MathInset::metrics(MathStyles st) const
 {
        lyxerr << "MathInset::metrics() called directly!\n";
index 6d6759e51b48757ab5450f8011f1767885988908..86afc24191f2360e872481596acbcee37330d288 100644 (file)
@@ -192,22 +192,17 @@ public:
 
        ///
        virtual void validate(LaTeXFeatures & features) const;
-
        ///
-       static int workwidth;
+       virtual void handleFont(MathTextCodes) {}
 
-       /// the inherited text style
-       virtual MathTextCodes code() const;
        ///
-       virtual void code(MathTextCodes t);
+       static int workwidth;
 
 protected:
        /// _sets_ style
        void size(MathStyles s) const;
        /// the used font size
        mutable MathStyles size_;
-       /// the inherited text style
-       mutable MathTextCodes code_;
 
 private:
        /// the following are used for positioning the cursor with the mouse
index bb7ef9c5be80f2d182cc4ebf9a2e8a2b5ff206dd..0c8b5e79c4c76e0e667656506d6a407afe744ec7 100644 (file)
@@ -556,9 +556,6 @@ latexkeys const * Parser::read_delim()
 
 void Parser::parse_into(MathArray & array, unsigned flags)
 {
-       static int plevel = -1;
-
-       ++plevel;
        MathTextCodes yyvarcode   = LM_TC_VAR;
 
        int  t      = yylex();
@@ -602,7 +599,7 @@ void Parser::parse_into(MathArray & array, unsigned flags)
 
                case LM_TK_ARGUMENT: {
                        MathMacroArgument * p = new MathMacroArgument(ival_);
-                       p->code(yyvarcode);
+                       //p->code(yyvarcode);
                        array.push_back(p);
                        break;
                }
@@ -670,7 +667,6 @@ void Parser::parse_into(MathArray & array, unsigned flags)
                case '&':
                        if (flags & FLAG_AMPERSAND) {
                                flags &= ~FLAG_AMPERSAND;
-                               --plevel;
                                return;
                        }
                        lyxerr[Debug::MATHED]
@@ -682,7 +678,6 @@ void Parser::parse_into(MathArray & array, unsigned flags)
                        curr_skip_ = lexArg('[');
                        if (flags & FLAG_NEWLINE) {
                                flags &= ~FLAG_NEWLINE;
-                               --plevel;
                                return;
                        }
                        lyxerr[Debug::MATHED]
@@ -773,10 +768,8 @@ void Parser::parse_into(MathArray & array, unsigned flags)
                }
                
                case LM_TK_RIGHT:
-                       if (flags & FLAG_RIGHT) { 
-                               --plevel;
+                       if (flags & FLAG_RIGHT)
                                return;
-                       }
                        error("Unmatched right delimiter");
 //       panic = true;
                        break;
@@ -825,7 +818,6 @@ void Parser::parse_into(MathArray & array, unsigned flags)
                
                case LM_TK_MATH:
                case LM_TK_END:
-                       --plevel;
                        return;
 
                case LM_TK_BEGIN:
@@ -881,7 +873,6 @@ void Parser::parse_into(MathArray & array, unsigned flags)
                        t = yylex();
                }
        }
-       --plevel;
 }