* 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:
Jean-Marc Lasgouttes 2006-12-29 11:52:01 +00:00
parent ca6838b288
commit 7459f3ad6a
4 changed files with 13 additions and 2 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 &);