]> git.lyx.org Git - features.git/commitdiff
small mathed change add the find_if
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 27 Feb 2001 11:26:18 +0000 (11:26 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 27 Feb 2001 11:26:18 +0000 (11:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1632 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/mathed/ChangeLog
src/mathed/math_macro.C
src/mathed/math_macrotemplate.C
src/mathed/math_parinset.C

index a0865b74a33abc9aac9029247c02f1533d07fd09..ddc32735da91f0b6b6bcf94351f59c9bec8cfdb1 100644 (file)
@@ -63,6 +63,7 @@ extern int greek_kb_flag;
 using SigC::slot;
 #endif
 
+using std::find_if;
 using std::pair;
 using std::endl;
 using std::make_pair;
index ecd545cba1b91938d4131ff8e27f1444ddecd308..c549ab874dfe40f67b10e1ee4f76600349848ed7 100644 (file)
@@ -1,3 +1,7 @@
+2001-02-27  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
+
+       * BufferView_pimpl.C: add using std::find_if
+
 2001-02-27  José Matos  <jamatos@fep.up.pt>
        
        * LaTeXFeatures.C (getIncludedFiles): call to BasePath replaced
index 42d16107699c8523415b0bcdd1c131267a40e6b2..2cdd809a06e9e259aa6c2d0cd5b7fd110ea2ba0a 100644 (file)
@@ -1,3 +1,11 @@
+2001-02-27  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
+
+       * math_parinset.C (draw): move MathedXiter data(this) up. and
+       remove it two other places.
+
+       * math_macro.C (MathMacro): use array directly, don't use
+       setArgumentIdx and GetData
+
 2001-02-26  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
        * math_macroarg.C (MathMacroArgument): delete
index 13ac9b5531d280a7815eb189d33038255a9d8619..606caf9e70c5ceda1676809891ae0c3e87a6fa34 100644 (file)
@@ -44,8 +44,8 @@ ostream & operator<<(ostream & o, MathedTextCodes mtc)
 }
 
 
-MathMacro::MathMacro(MathMacroTemplate * t)
-       MathParInset(LM_ST_TEXT, "", LM_OT_MACRO), tmplate_(t)
+MathMacro::MathMacro(MathMacroTemplate * t)
+       MathParInset(LM_ST_TEXT, "", LM_OT_MACRO), tmplate_(t)
 {
        nargs_ = tmplate_->getNoArgs();
        tcode_ = tmplate_->getTCode();
@@ -58,8 +58,8 @@ MathMacro::MathMacro(MathMacroTemplate * t):
 }
 
 
-MathMacro::MathMacro(MathMacro * m)
-       MathParInset(LM_ST_TEXT, m->GetName(), LM_OT_MACRO)
+MathMacro::MathMacro(MathMacro * m)
+       MathParInset(LM_ST_TEXT, m->GetName(), LM_OT_MACRO)
 {
        tmplate_ = m->tmplate_;
        nargs_ = tmplate_->getNoArgs();
@@ -68,9 +68,10 @@ MathMacro::MathMacro(MathMacro * m):
        idx_ = 0;
        SetName(tmplate_->GetName());
        for (int i = 0; i < tmplate_->getNoArgs(); ++i) {
-               m->setArgumentIdx(i);
+               //m->setArgumentIdx(i);
                args_[i].row   = m->args_[i].row;
-               args_[i].array = m->GetData();
+               //args_[i].array = m->GetData();
+               args_[i].array = m->args_[i].array;
        }
 }
 
index d2579604ce9ef15e27ec004e51c8e22ba7e1adb7..4e7836636345caf22bdb8b26f7a5f0b150599a28 100644 (file)
@@ -59,8 +59,7 @@ void MathMacroTemplate::setEditMode(bool ed)
                for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(false);
                }
-       }
-       else {
+       } else {
                flags_ &= ~MMF_Edit;
                for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(true);
@@ -73,7 +72,7 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y)
 {
        int x2;
        int y2;
-       bool expnd = (nargs_ > 0) ? args_[0].getExpand(): false;
+       bool expnd = (nargs_ > 0) ? args_[0].getExpand() : false;
        if (flags_ & MMF_Edit) {
                for (int i = 0; i < nargs_; ++i) {
                        args_[i].setExpand(false);
@@ -99,7 +98,7 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y)
 
 void MathMacroTemplate::Metrics()
 {
-       bool expnd = (nargs_ > 0) ? args_[0].getExpand(): false;
+       bool expnd = (nargs_ > 0) ? args_[0].getExpand() : false;
     
        if (flags_ & MMF_Edit) {
                for (int i = 0; i < nargs_; ++i) {
index 1a0e01b25dd4cc1cbd0ad11881747762ef445bc7..83336a8753f27fa34303869216229b862771b18c 100644 (file)
@@ -35,6 +35,7 @@ MathParInset::MathParInset(short st, string const & nm, short ot)
 }
 
 
+// This is virtual and needed.
 MathParInset::~MathParInset()
 {
 }
@@ -72,25 +73,26 @@ MathParInset::draw(Painter & pain, int x, int y)
        bool limits = false;
        
        xo_ = x;
-       yo_ = y; 
+       yo_ = y;
+       MathedXIter data(this);
        if (array.empty()) {
-               MathedXIter data(this);
+               //MathedXIter data(this);
                data.GetPos(x, y);
-               pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline);
+               pain.rectangle(x, y - df_asc, df_width, df_asc,
+                              LColor::mathline);
                return;
-       }  
-       MathedXIter data(this);
+       }
+       //MathedXIter data(this);
        data.GoBegin();
        while (data.OK()) {
                data.GetPos(x, y);
                byte cx = data.GetChar();
                if (cx >= ' ') {
-                       string s = data.GetString();
+                       string const s = data.GetString();
                        drawStr(pain, data.fcode(), size(), x, y, s);
                        mathed_char_height(LM_TC_CONST, size(), 'y', asc, des);
                        limits = false;
-               }
-               else {
+               } else {
                        if (cx == 0)
                                break;
                        if (MathIsInset(cx)) {
@@ -98,46 +100,49 @@ MathParInset::draw(Painter & pain, int x, int y)
                                MathedInset * p = data.GetInset();
                                if (cx == LM_TC_UP) {
                                        if (limits) {
-                                               x -= (xp>p->Width()) ? p->Width()+(xp-p->Width())/2: xp;  
-                                               yy -= (asc + p->Descent()+4);
-                                       }       
-                                       else
-                                               yy -= (p->Descent()>asc) ? p->Descent()+4: asc;
-                               }
-                               else if (cx == LM_TC_DOWN) {
+                                               x -= (xp > p->Width()) ?
+                                                       p->Width() + (xp - p->Width()) / 2 : xp;  
+                                               yy -= (asc + p->Descent() + 4);
+                                       else
+                                               yy -= (p->Descent() > asc) ?
+                                                       p->Descent() + 4 : asc;
+                               else if (cx == LM_TC_DOWN) {
                                        if (limits) {
-                                               x -= (xp>p->Width()) ? p->Width()+(xp-p->Width())/2: xp;
+                                               x -= (xp > p->Width()) ?
+                                                       p->Width() + (xp - p->Width()) / 2 : xp;
                                                yy += des + p->Ascent() + 2;
                                        } else
-                                               yy += des + p->Ascent()/2;
-                               }
-                               else {
+                                               yy += des + p->Ascent() / 2;
+                               } else {
                                        asc = p->Ascent();
                                        des = p->Descent();
                                }
                                p->draw(pain, x, yy);
-                               if (cx!= LM_TC_UP && cx!= LM_TC_DOWN) {
+                               if (cx != LM_TC_UP && cx != LM_TC_DOWN) {
                                        limits = p->GetLimits();
                                        if (limits)
                                                xp = p->Width();
                                }
                                data.Next();
-                       }
-                       else if (cx == LM_TC_TAB) {
-                               if (cxp == cx || cxp == LM_TC_CR || data.IsFirst()) {
-                                       pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline);
+                       } else if (cx == LM_TC_TAB) {
+                               if (cxp == cx
+                                   || cxp == LM_TC_CR || data.IsFirst()) {
+                                       pain.rectangle(x, y - df_asc,
+                                                      df_width, df_asc,
+                                                      LColor::mathline);
                                }
                                data.Next();
                                limits = false;
-                       }
-                       else if (cx == LM_TC_CR) {
-                               if (cxp == LM_TC_TAB || cxp == LM_TC_CR || data.IsFirst()) {
-                                       pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline);
+                       } else if (cx == LM_TC_CR) {
+                               if (cxp == LM_TC_TAB
+                                   || cxp == LM_TC_CR || data.IsFirst()) {
+                                       pain.rectangle(x, y - df_asc,
+                                                      df_width, df_asc,
+                                                      LColor::mathline);
                                }
                                data.Next();
                                limits = false;
-                       }
-                       else {   
+                       } else {         
                                lyxerr << "GMathed Error: Unrecognized code[" << cx << "]" << endl;
                                break;
                        }
@@ -146,7 +151,8 @@ MathParInset::draw(Painter & pain, int x, int y)
        }
        if (cxp == LM_TC_TAB || cxp == LM_TC_CR) { 
                data.GetPos(x, y);
-               pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline);
+               pain.rectangle(x, y - df_asc, df_width, df_asc,
+                              LColor::mathline);
        }
 }