#include "BufferView.h"
#include "Painter.h"
#include "support/LOstream.h"
+#include "support/lstrings.h"
using std::ostream;
autocollapse = true;
autoBreakRows = true;
framecolor = LColor::footnoteframe;
- widthOffset = 6; // 2+2 (behind+back), 1+1 (frame)
+ widthOffset = 2 * TEXT_TO_INSET_OFFSET + 2; // 1+1 (frame)
button_length = button_top_y = button_bottom_y = 0;
setInsetName("Collapsable");
}
return result;
}
+
void InsetCollapsable::Write(Buffer const * buf, ostream & os) const
{
- os << getInsetName() << "\n\ncollapsed ";
- if (display())
- os << "false\n";
- else
- os << "true\n";
- WriteParagraphData(buf, os);
+ os << "collapsed " << tostr(!display()) << "\n";
+ WriteParagraphData(buf, os);
}
draw_collapsed(pain, f, baseline, x);
x -= TEXT_TO_INSET_OFFSET;
- int w = InsetText::width(pain, f) + 2 * TEXT_TO_INSET_OFFSET;
+ int w = InsetText::width(pain, f) + (2 * TEXT_TO_INSET_OFFSET);
int h = ascent(pain,f) + descent(pain, f);
int save_x = static_cast<int>(x);
x += TEXT_TO_INSET_OFFSET;
- drawTextXOffset = int(x) - top_x;
InsetText::draw(bv, f, baseline, x, cleared);
pain.rectangle(save_x, baseline - ascent(pain, f), w, h, framecolor);
}
return getMaxWidth(pain, inset) -
width_collapsed(pain, labelfont) - widthOffset;
}
+
+
+void InsetCollapsable::update(BufferView * bv,
+ LyXFont const & font, bool dodraw)
+{
+ drawTextXOffset = width_collapsed(bv->painter(), font);
+ InsetText::update(bv, font, dodraw);
+}