]> git.lyx.org Git - features.git/commitdiff
soem more IU for \mbox
authorAndré Pönitz <poenitz@gmx.net>
Wed, 7 Apr 2004 18:15:29 +0000 (18:15 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 7 Apr 2004 18:15:29 +0000 (18:15 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8623 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_hullinset.C
src/mathed/math_hullinset.h
src/mathed/math_inset.C
src/mathed/math_inset.h
src/mathed/math_mboxinset.C
src/mathed/math_mboxinset.h
src/mathed/math_nestinset.C
src/mathed/math_nestinset.h

index c834db104d04e9024acd6a5dc357649d2dbc7d6a..9b8456a48cf23d5589d966d82fe8d4e26916d916 100644 (file)
@@ -897,12 +897,6 @@ bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
 }
 
 
-string MathHullInset::fileInsetLabel() const
-{
-       return "Formula";
-}
-
-
 /////////////////////////////////////////////////////////////////////
 
 #include "formulamacro.h"
@@ -1104,7 +1098,7 @@ bool MathHullInset::searchBackward(BufferView * bv, string const & what,
 void MathHullInset::write(Buffer const &, std::ostream & os) const
 {
        WriteStream wi(os, false, false);
-       os << fileInsetLabel() << ' ';
+       os << "Formula ";
        write(wi);
 }
 
@@ -1117,15 +1111,6 @@ void MathHullInset::read(Buffer const &, LyXLex & lex)
 }
 
 
-int MathHullInset::latex(Buffer const &, ostream & os,
-                       OutputParams const & runparams) const
-{
-       WriteStream wi(os, runparams.moving_arg, true);
-       write(wi);
-       return wi.line();
-}
-
-
 int MathHullInset::plaintext(Buffer const &, ostream & os,
                        OutputParams const &) const
 {
index f8ac234db34917286632114dcc6d04c0526f3e14..fb5aa72d5d5241f63913a4c9c2e1dd77e68eda6b 100644 (file)
@@ -81,8 +81,6 @@ public:
        ///
        bool idxLast(LCursor &) const;
 
-       ///
-       std::string fileInsetLabel() const;
        ///
        void write(WriteStream & os) const;
        ///
@@ -97,9 +95,6 @@ public:
        ///
        void read(Buffer const &, LyXLex & lex);
        ///
-       int latex(Buffer const &, std::ostream &,
-                 OutputParams const &) const;
-       ///
        int plaintext(Buffer const &, std::ostream &,
                  OutputParams const &) const;
        ///
index a8ce515c52a308770a62787ad26b4834a296f60f..00f9c90124c2306a2641963cde4bc8d9b5e67311 100644 (file)
@@ -135,9 +135,3 @@ ostream & operator<<(ostream & os, MathAtom const & at)
        at->write(wi);
        return os;
 }
-
-
-string MathInset::fileInsetLabel() const
-{
-       return "Formula";
-}
index 11716f1382e53d6c238c4e9c7682b6fa4346313c..557cd9825fb2fdab2b93219ff3d7d69c9c9673b2 100644 (file)
@@ -173,8 +173,6 @@ public:
        virtual std::string const & getType() const;
        /// change type
        virtual void mutate(std::string const &) {}
-       /// how is the inset called in the .lyx file?
-       virtual std::string fileInsetLabel() const;
        /// usually the latex name
        virtual std::string name() const;
 };
index 671c932249b5442bdf6f3b0b480fc0f0e1b89c01..11ed0a796881e66bbbdcefe1a4212a66425da57e 100644 (file)
@@ -19,7 +19,9 @@
 #include "bufferparams.h"
 #include "debug.h"
 #include "metricsinfo.h"
+#include "output_latex.h"
 #include "paragraph.h"
+#include "texrow.h"
 
 using std::auto_ptr;
 using std::endl;
@@ -52,9 +54,8 @@ void MathMBoxInset::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void MathMBoxInset::draw(PainterInfo & pi, int x, int y) const
 {
-       text_.draw(pi, x + 1, y);
+       text_.draw(pi, x + 1, y - text_.ascent());
        drawMarkers(pi, x, y);
-       setPosCache(pi, x, y);
 }
 
 
@@ -66,6 +67,17 @@ void MathMBoxInset::write(WriteStream & os) const
 }
 
 
+int MathMBoxInset::latex(Buffer const & buf, std::ostream & os,
+                       OutputParams const & runparams) const
+{
+       os << "\\mbox{\n";
+       TexRow texrow;
+       latexParagraphs(buf, text_.paragraphs(), os, texrow, runparams);
+       os << "}";
+       return texrow.rows();
+}
+
+
 void MathMBoxInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
 {
        text_.dispatch(cur, cmd);
@@ -81,6 +93,5 @@ LyXText * MathMBoxInset::getText(int) const
 void MathMBoxInset::getCursorPos(CursorSlice const & cur, int & x, int & y) const
 {
        x = text_.cursorX(cur);
-       //y = text_.cursorY(cur);
-       y = 100;
+       y = text_.cursorY(cur);
 }
index 24dfe866c40767f23e28b94d3541a80fe598dfdd..c4cd9a20d5a6d7574140e2c42c69e5ffc8ed7e50 100644 (file)
 #include "math_diminset.h"
 #include "lyxtext.h"
 
-class BufferView;
 
-
-// not yet a substitute for the real text inset...
+// almost a substitute for the real text inset...
 
 class MathMBoxInset : public MathDimInset {
 public:
@@ -33,11 +31,16 @@ public:
        ///
        void priv_dispatch(LCursor & cur, FuncRequest & cmd);
 
-       ///
-       void write(WriteStream & os) const;
        ///
        bool inMathed() const { return false; }
+       ///
+       bool isActive() const { return true; }
 
+       ///
+       void write(WriteStream & os) const;
+       ///
+       int latex(Buffer const &, std::ostream & os,
+                       OutputParams const & runparams) const;
        ///
        LyXText * getText(int) const;
        ///
index e99bd172a142ffdf7179aeed0d223b8b43aa822d..4fc2f94a3d76e3b19adda4b70c2081b63dac713c 100644 (file)
 
 #include "BufferView.h"
 #include "FuncStatus.h"
+#include "LColor.h"
 #include "bufferview_funcs.h"
 #include "cursor.h"
 #include "debug.h"
 #include "dispatchresult.h"
 #include "funcrequest.h"
 #include "gettext.h"
-#include "LColor.h"
+#include "outputparams.h"
 #include "undo.h"
 
 #include "support/std_sstream.h"
@@ -301,6 +302,15 @@ void MathNestInset::normalize(NormalStream & os) const
 }
 
 
+int MathNestInset::latex(Buffer const &, std::ostream & os,
+                       OutputParams const & runparams) const
+{
+       WriteStream wi(os, runparams.moving_arg, true);
+       write(wi);
+       return wi.line();
+}
+
+
 void MathNestInset::notifyCursorLeaves(LCursor & cur)
 {
 /*
index f00895ee25e969e48c15827be816262a1514f385..7bb9f08f22e95e9e42625d971e7f2316dfa12a31 100644 (file)
@@ -93,6 +93,9 @@ public:
        void write(WriteStream & os) const;
        /// writes [, name(), and args in []
        void normalize(NormalStream & os) const;
+       ///
+       int latex(Buffer const &, std::ostream & os,
+                       OutputParams const & runparams) const;
 
 protected:
        ///