mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-20 15:01:58 +00:00
insetcharstyle.C (metrics,draw): consider inset label for
width computation; fix drawing of labels of undefined char styles git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10412 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c8c616688f
commit
70cf40ccef
@ -1,3 +1,8 @@
|
||||
2005-09-05 Michael Gerz <michael.gerz@teststep.org>
|
||||
|
||||
* insetcharstyle.C (metrics,draw): consider inset label for
|
||||
width computation; fix drawing of labels of undefined char styles
|
||||
|
||||
2005-08-07 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* insettabular.C (getStatus): fix Helge's bug that a number of insets
|
||||
|
@ -38,6 +38,7 @@
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
using std::istringstream;
|
||||
using std::max;
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
|
||||
@ -139,6 +140,21 @@ void InsetCharStyle::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
mi.base.textwidth -= 2 * TEXT_TO_INSET_OFFSET;
|
||||
InsetText::metrics(mi, dim);
|
||||
mi.base.font = tmpfont;
|
||||
if (has_label_) {
|
||||
// consider width of the inset label
|
||||
LyXFont font(params_.labelfont);
|
||||
font.realize(LyXFont(LyXFont::ALL_SANE));
|
||||
font.decSize();
|
||||
font.decSize();
|
||||
int w = 0;
|
||||
int a = 0;
|
||||
int d = 0;
|
||||
string s(params_.type);
|
||||
if (undefined())
|
||||
s = _("Undef: ") + s;
|
||||
font_metrics::rectText(s, font, w, a, d);
|
||||
dim.wid = max(dim.wid, w);
|
||||
}
|
||||
dim.asc += TEXT_TO_INSET_OFFSET;
|
||||
dim.des += TEXT_TO_INSET_OFFSET;
|
||||
dim.wid += 2 * TEXT_TO_INSET_OFFSET;
|
||||
@ -182,7 +198,7 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const
|
||||
string s(params_.type);
|
||||
if (undefined())
|
||||
s = _("Undef: ") + s;
|
||||
font_metrics::rectText(params_.type, font, w, a, d);
|
||||
font_metrics::rectText(s, font, w, a, d);
|
||||
pi.pain.rectText(x + (dim_.wid - w) / 2, y + desc + a,
|
||||
s, font, LColor::none, LColor::none);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user