Am 14.09.2010 04:30, schrieb Uwe Stöhr:
Attached is the corresponding patch.
This version was incorrect, take the attached one instead. regards Uwe
Index: insets/InsetLine.cpp =================================================================== --- insets/InsetLine.cpp (revision 35358) +++ insets/InsetLine.cpp (working copy) @@ -24,6 +24,7 @@ #include "OutputParams.h" #include "output_xhtml.h" #include "Text.h" +#include "TextMetrics.h" #include "frontends/FontMetrics.h" #include "frontends/Painter.h" @@ -135,15 +136,15 @@ // get the length of the parameters in pixels Length offset = Length(to_ascii(getParam("offset"))); int o = - offset.inPixels(pi.base.textwidth, + offset.inPixels(inset_textwidth, fm.width(char_type('M'))); Length width = Length(to_ascii(getParam("width"))); int w = - width.inPixels(pi.base.textwidth, + width.inPixels(inset_textwidth, fm.width(char_type('M'))); Length height = Length(to_ascii(getParam("height"))); int h = - height.inPixels(pi.base.textwidth, + height.inPixels(inset_textwidth, fm.width(char_type('M'))); // get the surrounding text color @@ -152,8 +153,8 @@ // assure that the drawn line is not outside of the window // check that it doesn't exceed the outer boundary - if (x + w - h/2 - 2 > pi.base.textwidth) - w = pi.base.textwidth - x + h/2 + 2; + if (x + w - h/2 - 2 > inset_textwidth) + w = inset_textwidth - x + h/2 + 2; // check that it doesn't exceed the upper boundary if (y - o - h/2 < 0) o = y - h/2 - 2; Index: rowpainter.cpp =================================================================== --- rowpainter.cpp (revision 35358) +++ rowpainter.cpp (working copy) @@ -103,9 +103,6 @@ // requires a full repaint bool pi_full_repaint = pi_.full_repaint; - // FIXME: text_metrics_.width() is only about 1.0857 * mi.base.textwidth - pi_.base.textwidth = text_metrics_.width(); - // FIXME: We should always use font, see documentation of // noFontChange() in Inset.h. pi_.base.font = inset->noFontChange() ? Index: TextMetrics.cpp =================================================================== --- TextMetrics.cpp (revision 35358) +++ TextMetrics.cpp (working copy) @@ -57,7 +57,9 @@ using namespace std; +int inset_textwidth = 0; + namespace lyx { using frontend::FontMetrics; @@ -430,6 +432,8 @@ Dimension dim; int const w = max_width_ - leftMargin(max_width_, pit, ii->pos) - right_margin; + // FIXME: the textwidth is now stored in a global variable + inset_textwidth = w; Font const & font = ii->inset->noFontChange() ? bufferfont : displayFont(pit, ii->pos); MacroContext mc(&buffer, parPos); Index: TextMetrics.h =================================================================== --- TextMetrics.h (revision 35358) +++ TextMetrics.h (working copy) @@ -19,6 +19,8 @@ #include "support/types.h" +extern int inset_textwidth; + namespace lyx { class BufferView;