]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_nestinset.C
architectural changes to tex2lyx
[lyx.git] / src / mathed / math_nestinset.C
index 85c41832da10799a9921f00b9415dac65358225c..ddb730fd8cef3bd6b4032722aa5577070a6078f8 100644 (file)
@@ -1,6 +1,3 @@
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "math_nestinset.h"
 #include "math_cursor.h"
@@ -13,7 +10,7 @@
 
 
 MathNestInset::MathNestInset(idx_type nargs)
-       : MathDimInset(), cells_(nargs), lock_(false)
+       : cells_(nargs), lock_(false)
 {}
 
 
@@ -45,6 +42,7 @@ void MathNestInset::getPos(idx_type idx, pos_type pos, int & x, int & y) const
                x += 2;
 }
 
+
 void MathNestInset::substitute(MathMacro const & m)
 {
        for (idx_type i = 0; i < nargs(); ++i)
@@ -52,29 +50,14 @@ void MathNestInset::substitute(MathMacro const & m)
 }
 
 
-void MathNestInset::metrics(MathMetricsInfo const & mi) const
+void MathNestInset::metrics(MetricsInfo const & mi) const
 {
-       MathMetricsInfo m = mi;
+       MetricsInfo m = mi;
        for (idx_type i = 0; i < nargs(); ++i)
                cell(i).metrics(m);
 }
 
 
-void MathNestInset::metricsMarkers(int frame) const
-{
-       dim_.d += frame;
-       dim_.w += 2 * frame;
-}
-
-
-void MathNestInset::metricsMarkers2(int frame) const
-{
-       dim_.a += frame;
-       dim_.d += frame;
-       dim_.w += 2 * frame;
-}
-
-
 bool MathNestInset::idxNext(idx_type & idx, pos_type & pos) const
 {
        if (idx + 1 >= nargs())
@@ -158,8 +141,8 @@ void MathNestInset::dump() const
 }
 
 
-//void MathNestInset::draw(MathPainterInfo & pi, int x, int y) const
-void MathNestInset::draw(MathPainterInfo &, int, int) const
+//void MathNestInset::draw(PainterInfo & pi, int x, int y) const
+void MathNestInset::draw(PainterInfo &, int, int) const
 {
 #if 0
        if (lock_)
@@ -169,7 +152,7 @@ void MathNestInset::draw(MathPainterInfo &, int, int) const
 }
 
 
-void MathNestInset::drawSelection(MathPainterInfo & pi,
+void MathNestInset::drawSelection(PainterInfo & pi,
                idx_type idx1, pos_type pos1, idx_type idx2, pos_type pos2) const
 {
        if (idx1 == idx2) {
@@ -194,33 +177,6 @@ void MathNestInset::drawSelection(MathPainterInfo & pi,
 }
 
 
-void MathNestInset::drawMarkers(MathPainterInfo & pi, int x, int y) const
-{
-       if (!editing())
-               return;
-       int t = x + width() - 1;
-       int d = y + descent();
-       pi.pain.line(x, d - 3, x, d, LColor::mathframe);
-       pi.pain.line(t, d - 3, t, d, LColor::mathframe);
-       pi.pain.line(x, d, x + 3, d, LColor::mathframe);
-       pi.pain.line(t - 2, d, t, d, LColor::mathframe);
-}
-
-
-void MathNestInset::drawMarkers2(MathPainterInfo & pi, int x, int y) const
-{
-       if (!editing())
-               return;
-       drawMarkers(pi, x, y);
-       int t = x + width() - 1;
-       int a = y - ascent();
-       pi.pain.line(x, a + 3, x, a, LColor::mathframe);
-       pi.pain.line(t, a + 3, t, a, LColor::mathframe);
-       pi.pain.line(x, a, x + 3, a, LColor::mathframe);
-       pi.pain.line(t - 2, a, t, a, LColor::mathframe);
-}
-
-
 void MathNestInset::validate(LaTeXFeatures & features) const
 {
        for (idx_type i = 0; i < nargs(); ++i)
@@ -317,7 +273,7 @@ void MathNestInset::notifyCursorLeaves(idx_type idx)
 }
 
 
-MathInset::result_type MathNestInset::dispatch
+dispatch_result MathNestInset::dispatch
        (FuncRequest const & cmd, idx_type & idx, pos_type & pos)
 {
        BufferView * bv = cmd.view();
@@ -336,14 +292,56 @@ MathInset::result_type MathNestInset::dispatch
                        return
                                dispatch(
                                        FuncRequest(bv, LFUN_PASTE, bv->getClipboard()), idx, pos);
-                       
+
                case LFUN_MOUSE_PRESS:
                        if (cmd.button() == mouse_button::button2)
                                return dispatch(FuncRequest(bv, LFUN_PASTESELECTION), idx, pos);
                        return UNDISPATCHED;
 
-               default:        
+               default:
                        return MathInset::dispatch(cmd, idx, pos);
        }
-       return UNDISPATCHED;
 }
+
+
+void MathNestInset::metricsMarkers(int) const
+{
+       dim_.wid += 2;
+       dim_.asc += 1;
+}
+
+
+void MathNestInset::metricsMarkers2(int) const
+{
+       dim_.wid += 2;
+       dim_.asc += 1;
+       dim_.des += 1;
+}
+
+void MathNestInset::drawMarkers(PainterInfo & pi, int x, int y) const
+{
+       if (!editing())
+               return;
+       int t = x + dim_.width() - 1;
+       int d = y + dim_.descent();
+       pi.pain.line(x, d - 3, x, d, LColor::mathframe);
+       pi.pain.line(t, d - 3, t, d, LColor::mathframe);
+       pi.pain.line(x, d, x + 3, d, LColor::mathframe);
+       pi.pain.line(t - 3, d, t, d, LColor::mathframe);
+}
+
+
+void MathNestInset::drawMarkers2(PainterInfo & pi, int x, int y) const
+{
+       if (!editing())
+               return;
+       drawMarkers(pi, x, y);
+       int t = x + dim_.width() - 1;
+       int a = y - dim_.ascent();
+       pi.pain.line(x, a + 3, x, a, LColor::mathframe);
+       pi.pain.line(t, a + 3, t, a, LColor::mathframe);
+       pi.pain.line(x, a, x + 3, a, LColor::mathframe);
+       pi.pain.line(t - 3, a, t, a, LColor::mathframe);
+}
+
+