mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
* insetcollapsable.C (hasFixedWidth): new virtual method, returns
false by default. (metrics): do not set to openinlined if hasFixedWidth is true. * insetbox.C (hasFixedWidth): returns true if the box has a fixed width. (metrics): use hasFixedWidth. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16426 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ca6838b288
commit
7459f3ad6a
@ -168,10 +168,16 @@ void InsetBox::setButtonLabel()
|
||||
}
|
||||
|
||||
|
||||
bool InsetBox::hasFixedWidth() const
|
||||
{
|
||||
return params_.inner_box || params_.special != "width";
|
||||
}
|
||||
|
||||
|
||||
bool InsetBox::metrics(MetricsInfo & m, Dimension & dim) const
|
||||
{
|
||||
MetricsInfo mi = m;
|
||||
if (params_.inner_box || params_.special != "width")
|
||||
if (hasFixedWidth())
|
||||
mi.base.textwidth = params_.width.inPixels(m.base.textwidth);
|
||||
InsetCollapsable::metrics(mi, dim);
|
||||
bool const changed = dim_ != dim;
|
||||
|
@ -108,6 +108,8 @@ public:
|
||||
protected:
|
||||
InsetBox(InsetBox const &);
|
||||
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
|
||||
/// Is the width forced to some value?
|
||||
virtual bool hasFixedWidth() const;
|
||||
private:
|
||||
friend class InsetBoxParams;
|
||||
|
||||
|
@ -161,7 +161,8 @@ bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
if (status() == Open) {
|
||||
InsetText::metrics(mi, textdim_);
|
||||
// This expression should not contain mi.base.texwidth
|
||||
openinlined_ = textdim_.wid < 0.5 * mi.base.bv->workWidth();
|
||||
openinlined_ = !hasFixedWidth()
|
||||
&& textdim_.wid < 0.5 * mi.base.bv->workWidth();
|
||||
if (openinlined_) {
|
||||
// Correct for button width, and re-fit
|
||||
mi.base.textwidth -= dim.wid;
|
||||
|
@ -98,6 +98,8 @@ protected:
|
||||
InsetBase * editXY(LCursor & cur, int x, int y);
|
||||
///
|
||||
void setInlined() { status_ = Inlined; }
|
||||
/// Is the width forced to some value?
|
||||
virtual bool hasFixedWidth() const { return false; }
|
||||
///
|
||||
docstring floatName(std::string const & type, BufferParams const &);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user