#include "frontends/Painter.h"
#include "frontends/LyXView.h"
+
using lyx::graphics::PreviewLoader;
using std::endl;
-
+using std::string;
using std::max;
using std::ostream;
InsetCollapsable::InsetCollapsable(BufferParams const & bp, bool collapsed)
- : UpdatableInset(), collapsed_(collapsed), inset(bp),
+ : UpdatableInset(), inset(bp), collapsed_(collapsed),
button_dim(0, 0, 0, 0), label("Label"),
#if 0
autocollapse(false),
InsetCollapsable::InsetCollapsable(InsetCollapsable const & in)
- : UpdatableInset(in), collapsed_(in.collapsed_),
- labelfont(in.labelfont), inset(in.inset),
- button_dim(0, 0, 0, 0), label(in.label),
+ : UpdatableInset(in), inset(in.inset), collapsed_(in.collapsed_),
+ labelfont_(in.labelfont_), button_dim(0, 0, 0, 0), label(in.label),
#if 0
autocollapse(in.autocollapse),
#endif
in_update(false), first_after_edit(false)
{
- inset.init(&(in.inset));
inset.setOwner(this);
}
void InsetCollapsable::dimension_collapsed(Dimension & dim) const
{
- font_metrics::buttonText(label, labelfont, dim.wid, dim.asc, dim.des);
+ font_metrics::buttonText(label, labelfont_, dim.wid, dim.asc, dim.des);
}
int InsetCollapsable::height_collapsed() const
{
Dimension dim;
- font_metrics::buttonText(label, labelfont, dim.wid, dim.asc, dim.des);
+ font_metrics::buttonText(label, labelfont_, dim.wid, dim.asc, dim.des);
return dim.asc + dim.des;
}
void InsetCollapsable::draw_collapsed(PainterInfo & pi, int x, int y) const
{
- pi.pain.buttonText(x, y, label, labelfont);
+ pi.pain.buttonText(x, y, label, labelfont_);
}
void InsetCollapsable::draw(PainterInfo & pi, int x, int y, bool inlined) const
{
- BOOST_ASSERT(pi.base.bv);
- cache(pi.base.bv);
-
Dimension dim_collapsed;
dimension_collapsed(dim_collapsed);
}
-InsetOld::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
+dispatch_result InsetCollapsable::localDispatch(FuncRequest const & cmd)
{
//lyxerr << "InsetCollapsable::localDispatch: "
// << cmd.action << " '" << cmd.argument << "'\n";
return DISPATCHED;
default:
- UpdatableInset::RESULT result = inset.localDispatch(cmd);
+ dispatch_result result = inset.localDispatch(cmd);
if (result >= FINISHED)
bv->unlockInset(this);
first_after_edit = false;
}
-void InsetCollapsable::getLabelList(std::vector<string> & list) const
+void InsetCollapsable::getLabelList(Buffer const & buffer,
+ std::vector<string> & list) const
{
- inset.getLabelList(list);
+ inset.getLabelList(buffer, list);
}
}
+void InsetCollapsable::setCollapsed(bool c) const
+{
+ collapsed_ = c;
+}
+
+
void InsetCollapsable::markErased()
{
inset.markErased();
{
inset.addPreview(loader);
}
-
-
-void InsetCollapsable::cache(BufferView * bv) const
-{
- view_ = bv->owner()->view();
-}
-
-
-BufferView * InsetCollapsable::view() const
-{
- return view_.lock().get();
-}