2002-09-25 14:26:13 +00:00
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
|
* \file InsetFootlike.cpp
|
2002-09-25 14:26:13 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:09:55 +00:00
|
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2002-03-21 17:09:55 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2000-07-04 19:16:35 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "InsetFootlike.h"
|
2000-07-04 19:16:35 +00:00
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Buffer.h"
|
2006-02-22 15:44:57 +00:00
|
|
|
|
#include "BufferView.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "BufferParams.h"
|
2007-04-26 17:34:20 +00:00
|
|
|
|
#include "Color.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "MetricsInfo.h"
|
|
|
|
|
#include "Paragraph.h"
|
2000-07-04 19:16:35 +00:00
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
2002-02-16 15:59:55 +00:00
|
|
|
|
|
2002-03-03 20:25:07 +00:00
|
|
|
|
InsetFootlike::InsetFootlike(BufferParams const & bp)
|
|
|
|
|
: InsetCollapsable(bp)
|
2000-07-04 19:16:35 +00:00
|
|
|
|
{
|
|
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
|
|
|
|
font.decSize();
|
|
|
|
|
font.decSize();
|
2007-04-26 17:34:20 +00:00
|
|
|
|
font.setColor(Color::collapsable);
|
2000-07-04 19:16:35 +00:00
|
|
|
|
setLabelFont(font);
|
2001-07-27 12:03:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-05-26 09:13:55 +00:00
|
|
|
|
InsetFootlike::InsetFootlike(InsetFootlike const & in)
|
|
|
|
|
: InsetCollapsable(in)
|
2001-07-27 12:03:36 +00:00
|
|
|
|
{
|
|
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
|
|
|
|
font.decSize();
|
|
|
|
|
font.decSize();
|
2007-04-26 17:34:20 +00:00
|
|
|
|
font.setColor(Color::collapsable);
|
2001-07-27 12:03:36 +00:00
|
|
|
|
setLabelFont(font);
|
2000-07-04 19:16:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-28 15:15:49 +00:00
|
|
|
|
bool InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
|
2005-04-10 14:07:33 +00:00
|
|
|
|
{
|
|
|
|
|
LyXFont tmpfont = mi.base.font;
|
2006-02-22 15:44:57 +00:00
|
|
|
|
mi.base.font = mi.base.bv->buffer()->params().getFont();
|
2005-04-10 14:07:33 +00:00
|
|
|
|
InsetCollapsable::metrics(mi, dim);
|
|
|
|
|
mi.base.font = tmpfont;
|
2006-11-28 15:15:49 +00:00
|
|
|
|
bool const changed = dim_ != dim;
|
2005-04-10 14:07:33 +00:00
|
|
|
|
dim_ = dim;
|
2006-11-28 15:15:49 +00:00
|
|
|
|
return changed;
|
2005-04-10 14:07:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
|
|
|
|
|
{
|
|
|
|
|
LyXFont tmpfont = pi.base.font;
|
2006-02-22 15:44:57 +00:00
|
|
|
|
pi.base.font = pi.base.bv->buffer()->params().getFont();
|
2005-04-10 14:07:33 +00:00
|
|
|
|
InsetCollapsable::draw(pi, x, y);
|
|
|
|
|
pi.base.font = tmpfont;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void InsetFootlike::write(Buffer const & buf, std::ostream & os) const
|
2000-07-04 19:16:35 +00:00
|
|
|
|
{
|
2006-10-22 10:15:23 +00:00
|
|
|
|
os << to_utf8(getInsetName()) << "\n";
|
2001-06-28 10:25:20 +00:00
|
|
|
|
InsetCollapsable::write(buf, os);
|
2000-07-04 19:16:35 +00:00
|
|
|
|
}
|
2001-07-12 14:35:38 +00:00
|
|
|
|
|
|
|
|
|
|
2004-11-25 19:13:07 +00:00
|
|
|
|
bool InsetFootlike::insetAllowed(InsetBase::Code code) const
|
2001-07-12 14:35:38 +00:00
|
|
|
|
{
|
2004-11-25 19:13:07 +00:00
|
|
|
|
if (code == InsetBase::FOOT_CODE || code == InsetBase::MARGIN_CODE
|
|
|
|
|
|| code == InsetBase::FLOAT_CODE)
|
2001-07-12 14:35:38 +00:00
|
|
|
|
return false;
|
2001-07-19 08:52:59 +00:00
|
|
|
|
return InsetCollapsable::insetAllowed(code);
|
2001-07-12 14:35:38 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|