mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
inlined open submode, in the hope someone will actually test it. Easy take it back if there are problems.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8483 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
83d91912b5
commit
60cbc89f03
@ -1,3 +1,8 @@
|
||||
2004-03-09 Alfredo Braunstein <abraunst@lyx.org>
|
||||
|
||||
* insetcollapsable.[Ch] (metrics, draw): implemented an inlined-Open
|
||||
submode.
|
||||
|
||||
2004-03-07 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* insetcite.[Ch]: support jurabib.
|
||||
|
@ -41,7 +41,7 @@ using std::ostream;
|
||||
|
||||
InsetCollapsable::InsetCollapsable(BufferParams const & bp,
|
||||
CollapseStatus status)
|
||||
: inset(bp), label("Label"), status_(status)
|
||||
: inset(bp), label("Label"), status_(status), openinlined_(false)
|
||||
{
|
||||
inset.setOwner(this);
|
||||
inset.setAutoBreakRows(true);
|
||||
@ -127,14 +127,6 @@ void InsetCollapsable::dimension_collapsed(Dimension & dim) const
|
||||
}
|
||||
|
||||
|
||||
int InsetCollapsable::height_collapsed() const
|
||||
{
|
||||
Dimension dim;
|
||||
font_metrics::buttonText(label, labelfont_, dim.wid, dim.asc, dim.des);
|
||||
return dim.asc + dim.des;
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
if (status_ == Inlined) {
|
||||
@ -144,8 +136,16 @@ void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
if (status_ == Open) {
|
||||
Dimension insetdim;
|
||||
inset.metrics(mi, insetdim);
|
||||
dim.des += insetdim.height() + TEXT_TO_BOTTOM_OFFSET;
|
||||
dim.wid = max(dim.wid, insetdim.wid);
|
||||
openinlined_ = (insetdim.wid + dim.wid <= mi.base.textwidth);
|
||||
if (openinlined_) {
|
||||
dim.wid += insetdim.wid;
|
||||
dim.des = max(dim.des, insetdim.des);
|
||||
dim.asc = max(dim.asc, insetdim.asc);
|
||||
} else {
|
||||
dim.des += insetdim.height()
|
||||
+ TEXT_TO_BOTTOM_OFFSET;
|
||||
dim.wid = max(dim.wid, insetdim.wid);
|
||||
}
|
||||
}
|
||||
}
|
||||
dim_ = dim;
|
||||
@ -177,7 +177,11 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const
|
||||
if (status_ == Open) {
|
||||
if (!owner())
|
||||
x += scroll();
|
||||
inset.draw(pi, x, y - aa + dimc.height() + inset.ascent());
|
||||
|
||||
if (openinlined_)
|
||||
inset.draw(pi, x + dimc.width(), y - aa + inset.ascent());
|
||||
else
|
||||
inset.draw(pi, x, y - aa + dimc.height() + inset.ascent());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -324,14 +328,14 @@ void InsetCollapsable::priv_dispatch(LCursor & cur, FuncRequest const & cmd)
|
||||
case LFUN_MOUSE_PRESS:
|
||||
if (status_ == Inlined)
|
||||
inset.dispatch(cur, cmd);
|
||||
else if (status_ == Open && cmd.y > button_dim.y2)
|
||||
else if (status_ == Open && !hitButton(cmd))
|
||||
inset.dispatch(cur, cmd);
|
||||
break;
|
||||
|
||||
case LFUN_MOUSE_MOTION:
|
||||
if (status_ == Inlined)
|
||||
inset.dispatch(cur, cmd);
|
||||
else if (status_ == Open && cmd.y > button_dim.y2)
|
||||
else if (status_ == Open && !hitButton(cmd))
|
||||
inset.dispatch(cur, cmd);
|
||||
break;
|
||||
|
||||
|
@ -127,8 +127,6 @@ protected:
|
||||
///
|
||||
void dimension_collapsed(Dimension &) const;
|
||||
///
|
||||
int height_collapsed() const;
|
||||
///
|
||||
void draw_collapsed(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
int getMaxTextWidth(Painter & pain, UpdatableInset const *) const;
|
||||
@ -160,6 +158,8 @@ protected:
|
||||
private:
|
||||
///
|
||||
mutable CollapseStatus status_;
|
||||
/// a substatus of the Open status, determined automatically in metrics
|
||||
mutable bool openinlined_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user