From 6f851a34d2be0287fa356626fa4ec9d2724014f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 7 Apr 2004 18:15:29 +0000 Subject: [PATCH] soem more IU for \mbox git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8623 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_hullinset.C | 17 +---------------- src/mathed/math_hullinset.h | 5 ----- src/mathed/math_inset.C | 6 ------ src/mathed/math_inset.h | 2 -- src/mathed/math_mboxinset.C | 19 +++++++++++++++---- src/mathed/math_mboxinset.h | 13 ++++++++----- src/mathed/math_nestinset.C | 12 +++++++++++- src/mathed/math_nestinset.h | 3 +++ 8 files changed, 38 insertions(+), 39 deletions(-) diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index c834db104d..9b8456a48c 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -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 { diff --git a/src/mathed/math_hullinset.h b/src/mathed/math_hullinset.h index f8ac234db3..fb5aa72d5d 100644 --- a/src/mathed/math_hullinset.h +++ b/src/mathed/math_hullinset.h @@ -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; /// diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index a8ce515c52..00f9c90124 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -135,9 +135,3 @@ ostream & operator<<(ostream & os, MathAtom const & at) at->write(wi); return os; } - - -string MathInset::fileInsetLabel() const -{ - return "Formula"; -} diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index 11716f1382..557cd9825f 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -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; }; diff --git a/src/mathed/math_mboxinset.C b/src/mathed/math_mboxinset.C index 671c932249..11ed0a7968 100644 --- a/src/mathed/math_mboxinset.C +++ b/src/mathed/math_mboxinset.C @@ -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); } diff --git a/src/mathed/math_mboxinset.h b/src/mathed/math_mboxinset.h index 24dfe866c4..c4cd9a20d5 100644 --- a/src/mathed/math_mboxinset.h +++ b/src/mathed/math_mboxinset.h @@ -15,10 +15,8 @@ #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; /// diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index e99bd172a1..4fc2f94a3d 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -29,13 +29,14 @@ #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) { /* diff --git a/src/mathed/math_nestinset.h b/src/mathed/math_nestinset.h index f00895ee25..7bb9f08f22 100644 --- a/src/mathed/math_nestinset.h +++ b/src/mathed/math_nestinset.h @@ -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: /// -- 2.39.2