On 01/28/2010 12:01 PM, Jürgen Spitzmüller wrote:
Abdelrazak Younes wrote:
As I said, this is because you construct a new inset. If you follow my
advice and create an init() method, then the code will be simpler and
you won't need to set the buffer again.
I've no idea how this is supposed to look.


Index: src/mathed/CommandInset.h
===================================================================
--- src/mathed/CommandInset.h    (revision 33247)
+++ src/mathed/CommandInset.h    (working copy)
@@ -28,6 +28,8 @@
     explicit CommandInset(Buffer * buf, docstring const & name,
         bool needs_math_mode = true);
     ///
+    void init(docstring const & name, bool needs_math_mode);
+    ///
     void metrics(MetricsInfo & mi, Dimension & dim) const;
     ///
     void draw(PainterInfo & pi, int x, int y) const;
Index: src/mathed/CommandInset.cpp
===================================================================
--- src/mathed/CommandInset.cpp    (revision 33247)
+++ src/mathed/CommandInset.cpp    (working copy)
@@ -24,10 +24,9 @@


CommandInset::CommandInset(Buffer * buf, docstring const & name, bool needs_math_mode) - : InsetMathNest(buf, 2), name_(name), needs_math_mode_(needs_math_mode),
-      set_label_(false)
+    : InsetMathNest(buf, 2)
 {
-    lock_ = true;
+    init(name, needs_math_mode);
 }


@@ -37,6 +36,15 @@
 }


+void CommandInset::init(docstring const & name, bool needs_math_mode)
+{
+    name_ = name;
+    needs_math_mode_ = needs_math_mode;
+    set_label_ = false;
+    lock_ = true;
+}
+
+
 void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
 {
     if (!set_label_) {


Reply via email to