mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
* TextMetrics::draw(): get rid of the first par ascent offset.
* BufferView::draw(): adapt to above change. * InsetCollapsable::draw(): ditto -> get rid of textdim_ member. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20068 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
762d087396
commit
d1813ca269
@ -1551,7 +1551,7 @@ void BufferView::draw(frontend::Painter & pain)
|
|||||||
tm.drawParagraph(pi, metrics_info_.p1, 0,
|
tm.drawParagraph(pi, metrics_info_.p1, 0,
|
||||||
metrics_info_.y1 + tm.parMetrics(metrics_info_.p1).ascent());
|
metrics_info_.y1 + tm.parMetrics(metrics_info_.p1).ascent());
|
||||||
else
|
else
|
||||||
tm.draw(pi, 0, metrics_info_.y1 + tm.parMetrics(metrics_info_.p1).ascent());
|
tm.draw(pi, 0, metrics_info_.y1);
|
||||||
LYXERR(Debug::PAINTING) << "\n\t\t*** END DRAWING ***" << endl;
|
LYXERR(Debug::PAINTING) << "\n\t\t*** END DRAWING ***" << endl;
|
||||||
|
|
||||||
// and grey out above (should not happen later)
|
// and grey out above (should not happen later)
|
||||||
|
@ -1806,7 +1806,6 @@ void TextMetrics::draw(PainterInfo & pi, int x, int y) const
|
|||||||
|
|
||||||
ParMetricsCache::const_iterator it = par_metrics_.begin();
|
ParMetricsCache::const_iterator it = par_metrics_.begin();
|
||||||
ParMetricsCache::const_iterator const pm_end = par_metrics_.end();
|
ParMetricsCache::const_iterator const pm_end = par_metrics_.end();
|
||||||
y -= it->second.ascent();
|
|
||||||
for (; it != pm_end; ++it) {
|
for (; it != pm_end; ++it) {
|
||||||
ParagraphMetrics const & pmi = it->second;
|
ParagraphMetrics const & pmi = it->second;
|
||||||
y += pmi.ascent();
|
y += pmi.ascent();
|
||||||
|
@ -94,7 +94,6 @@ InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs)
|
|||||||
status_(rhs.status_),
|
status_(rhs.status_),
|
||||||
openinlined_(rhs.openinlined_),
|
openinlined_(rhs.openinlined_),
|
||||||
autoOpen_(rhs.autoOpen_),
|
autoOpen_(rhs.autoOpen_),
|
||||||
textdim_(rhs.textdim_),
|
|
||||||
// the sole purpose of this copy constructor
|
// the sole purpose of this copy constructor
|
||||||
mouse_hover_(false)
|
mouse_hover_(false)
|
||||||
{
|
{
|
||||||
@ -208,16 +207,17 @@ bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
|
|||||||
dim = dimensionCollapsed();
|
dim = dimensionCollapsed();
|
||||||
if (geometry() == TopButton
|
if (geometry() == TopButton
|
||||||
|| geometry() == LeftButton) {
|
|| geometry() == LeftButton) {
|
||||||
InsetText::metrics(mi, textdim_);
|
Dimension textdim;
|
||||||
openinlined_ = (textdim_.wid + dim.wid) < mi.base.textwidth;
|
InsetText::metrics(mi, textdim);
|
||||||
|
openinlined_ = (textdim.wid + dim.wid) < mi.base.textwidth;
|
||||||
if (openinlined_) {
|
if (openinlined_) {
|
||||||
// Correct for button width.
|
// Correct for button width.
|
||||||
dim.wid += textdim_.wid;
|
dim.wid += textdim.wid;
|
||||||
dim.des = max(dim.des - textdim_.asc + dim.asc, textdim_.des);
|
dim.des = max(dim.des - textdim.asc + dim.asc, textdim.des);
|
||||||
dim.asc = textdim_.asc;
|
dim.asc = textdim.asc;
|
||||||
} else {
|
} else {
|
||||||
dim.des += textdim_.height() + TEXT_TO_BOTTOM_OFFSET;
|
dim.des += textdim.height() + TEXT_TO_BOTTOM_OFFSET;
|
||||||
dim.wid = max(dim.wid, textdim_.wid);
|
dim.wid = max(dim.wid, textdim.wid);
|
||||||
if (hasFixedWidth())
|
if (hasFixedWidth())
|
||||||
dim.wid = max(dim.wid, mi.base.textwidth);
|
dim.wid = max(dim.wid, mi.base.textwidth);
|
||||||
}
|
}
|
||||||
@ -270,25 +270,25 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const
|
|||||||
switch (geometry()) {
|
switch (geometry()) {
|
||||||
case LeftButton:
|
case LeftButton:
|
||||||
textx = xx + dimc.width();
|
textx = xx + dimc.width();
|
||||||
texty = top + textdim_.asc;
|
texty = top;
|
||||||
InsetText::draw(pi, textx, texty);
|
InsetText::draw(pi, textx, texty);
|
||||||
break;
|
break;
|
||||||
case TopButton:
|
case TopButton:
|
||||||
textx = xx;
|
textx = xx;
|
||||||
texty = top + dimc.height() + textdim_.asc;
|
texty = top + dimc.height();
|
||||||
InsetText::draw(pi, textx, texty);
|
InsetText::draw(pi, textx, texty);
|
||||||
break;
|
break;
|
||||||
case ButtonOnly:
|
case ButtonOnly:
|
||||||
break;
|
break;
|
||||||
case NoButton:
|
case NoButton:
|
||||||
textx = xx;
|
textx = xx;
|
||||||
texty = y + textdim_.asc;
|
texty = y;
|
||||||
InsetText::draw(pi, textx, texty);
|
InsetText::draw(pi, textx, texty);
|
||||||
break;
|
break;
|
||||||
case SubLabel:
|
case SubLabel:
|
||||||
case Corners:
|
case Corners:
|
||||||
textx = xx;
|
textx = xx;
|
||||||
texty = y + textdim_.asc;
|
texty = y;
|
||||||
const_cast<InsetCollapsable *>(this)->setDrawFrame(false);
|
const_cast<InsetCollapsable *>(this)->setDrawFrame(false);
|
||||||
InsetText::draw(pi, textx, texty);
|
InsetText::draw(pi, textx, texty);
|
||||||
const_cast<InsetCollapsable *>(this)->setDrawFrame(true);
|
const_cast<InsetCollapsable *>(this)->setDrawFrame(true);
|
||||||
@ -364,7 +364,7 @@ void InsetCollapsable::drawSelection(PainterInfo & pi, int x, int y) const
|
|||||||
InsetText::drawSelection(pi, x, y);
|
InsetText::drawSelection(pi, x, y);
|
||||||
break;
|
break;
|
||||||
case TopButton:
|
case TopButton:
|
||||||
y += dimensionCollapsed().des + textdim_.asc;
|
y += dimensionCollapsed().des;
|
||||||
InsetText::drawSelection(pi, x, y);
|
InsetText::drawSelection(pi, x, y);
|
||||||
break;
|
break;
|
||||||
case ButtonOnly:
|
case ButtonOnly:
|
||||||
@ -391,7 +391,7 @@ void InsetCollapsable::cursorPos(BufferView const & bv,
|
|||||||
break;
|
break;
|
||||||
case TopButton:
|
case TopButton:
|
||||||
y += dimensionCollapsed().height() - ascent()
|
y += dimensionCollapsed().height() - ascent()
|
||||||
+ TEXT_TO_INSET_OFFSET + textdim_.asc;
|
+ TEXT_TO_INSET_OFFSET;
|
||||||
break;
|
break;
|
||||||
case NoButton:
|
case NoButton:
|
||||||
case SubLabel:
|
case SubLabel:
|
||||||
|
@ -168,8 +168,6 @@ private:
|
|||||||
mutable bool openinlined_;
|
mutable bool openinlined_;
|
||||||
/// the inset will automatically open when the cursor is inside
|
/// the inset will automatically open when the cursor is inside
|
||||||
mutable bool autoOpen_;
|
mutable bool autoOpen_;
|
||||||
///
|
|
||||||
mutable Dimension textdim_;
|
|
||||||
/// changes color when mouse enters/leaves this inset
|
/// changes color when mouse enters/leaves this inset
|
||||||
bool mouse_hover_;
|
bool mouse_hover_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user