soem more IU for \mbox

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8623 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2004-04-07 18:15:29 +00:00
parent 7ae9a86d4d
commit 6f851a34d2
8 changed files with 38 additions and 39 deletions

View File

@ -897,12 +897,6 @@ bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
} }
string MathHullInset::fileInsetLabel() const
{
return "Formula";
}
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
#include "formulamacro.h" #include "formulamacro.h"
@ -1104,7 +1098,7 @@ bool MathHullInset::searchBackward(BufferView * bv, string const & what,
void MathHullInset::write(Buffer const &, std::ostream & os) const void MathHullInset::write(Buffer const &, std::ostream & os) const
{ {
WriteStream wi(os, false, false); WriteStream wi(os, false, false);
os << fileInsetLabel() << ' '; os << "Formula ";
write(wi); 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, int MathHullInset::plaintext(Buffer const &, ostream & os,
OutputParams const &) const OutputParams const &) const
{ {

View File

@ -81,8 +81,6 @@ public:
/// ///
bool idxLast(LCursor &) const; bool idxLast(LCursor &) const;
///
std::string fileInsetLabel() const;
/// ///
void write(WriteStream & os) const; void write(WriteStream & os) const;
/// ///
@ -97,9 +95,6 @@ public:
/// ///
void read(Buffer const &, LyXLex & lex); void read(Buffer const &, LyXLex & lex);
/// ///
int latex(Buffer const &, std::ostream &,
OutputParams const &) const;
///
int plaintext(Buffer const &, std::ostream &, int plaintext(Buffer const &, std::ostream &,
OutputParams const &) const; OutputParams const &) const;
/// ///

View File

@ -135,9 +135,3 @@ ostream & operator<<(ostream & os, MathAtom const & at)
at->write(wi); at->write(wi);
return os; return os;
} }
string MathInset::fileInsetLabel() const
{
return "Formula";
}

View File

@ -173,8 +173,6 @@ public:
virtual std::string const & getType() const; virtual std::string const & getType() const;
/// change type /// change type
virtual void mutate(std::string const &) {} virtual void mutate(std::string const &) {}
/// how is the inset called in the .lyx file?
virtual std::string fileInsetLabel() const;
/// usually the latex name /// usually the latex name
virtual std::string name() const; virtual std::string name() const;
}; };

View File

@ -19,7 +19,9 @@
#include "bufferparams.h" #include "bufferparams.h"
#include "debug.h" #include "debug.h"
#include "metricsinfo.h" #include "metricsinfo.h"
#include "output_latex.h"
#include "paragraph.h" #include "paragraph.h"
#include "texrow.h"
using std::auto_ptr; using std::auto_ptr;
using std::endl; 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 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); 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) void MathMBoxInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
{ {
text_.dispatch(cur, 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 void MathMBoxInset::getCursorPos(CursorSlice const & cur, int & x, int & y) const
{ {
x = text_.cursorX(cur); x = text_.cursorX(cur);
//y = text_.cursorY(cur); y = text_.cursorY(cur);
y = 100;
} }

View File

@ -15,10 +15,8 @@
#include "math_diminset.h" #include "math_diminset.h"
#include "lyxtext.h" #include "lyxtext.h"
class BufferView;
// almost a substitute for the real text inset...
// not yet a substitute for the real text inset...
class MathMBoxInset : public MathDimInset { class MathMBoxInset : public MathDimInset {
public: public:
@ -33,11 +31,16 @@ public:
/// ///
void priv_dispatch(LCursor & cur, FuncRequest & cmd); void priv_dispatch(LCursor & cur, FuncRequest & cmd);
///
bool inMathed() const { return false; }
///
bool isActive() const { return true; }
/// ///
void write(WriteStream & os) const; void write(WriteStream & os) const;
/// ///
bool inMathed() const { return false; } int latex(Buffer const &, std::ostream & os,
OutputParams const & runparams) const;
/// ///
LyXText * getText(int) const; LyXText * getText(int) const;
/// ///

View File

@ -29,13 +29,14 @@
#include "BufferView.h" #include "BufferView.h"
#include "FuncStatus.h" #include "FuncStatus.h"
#include "LColor.h"
#include "bufferview_funcs.h" #include "bufferview_funcs.h"
#include "cursor.h" #include "cursor.h"
#include "debug.h" #include "debug.h"
#include "dispatchresult.h" #include "dispatchresult.h"
#include "funcrequest.h" #include "funcrequest.h"
#include "gettext.h" #include "gettext.h"
#include "LColor.h" #include "outputparams.h"
#include "undo.h" #include "undo.h"
#include "support/std_sstream.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) void MathNestInset::notifyCursorLeaves(LCursor & cur)
{ {
/* /*

View File

@ -93,6 +93,9 @@ public:
void write(WriteStream & os) const; void write(WriteStream & os) const;
/// writes [, name(), and args in [] /// writes [, name(), and args in []
void normalize(NormalStream & os) const; void normalize(NormalStream & os) const;
///
int latex(Buffer const &, std::ostream & os,
OutputParams const & runparams) const;
protected: protected:
/// ///