InsetText::InsetText()
- : UpdatableInset(), lt(0), in_update(false)
+ : UpdatableInset(), lt(0), in_update(false), do_resize(0),
+ do_reinit(false)
{
par = new Paragraph;
init();
InsetText::InsetText(InsetText const & in, bool same_id)
- : UpdatableInset(in, same_id), lt(0), in_update(false)
+ : UpdatableInset(in, same_id), lt(0), in_update(false), do_resize(0),
+ do_reinit(false)
{
par = 0;
init(&in, same_id);
LyXText * InsetText::getLyXText(BufferView const * lbv,
- bool const recursive) const
+ bool const recursive) const
{
if (!recursive && (cached_bview == lbv))
return cached_text.get();
Cache::iterator it = cache.find(bv);
if (it != cache.end()) {
+ if (do_reinit)
+ reinitLyXText();
+ else if (do_resize)
+ resizeLyXText(do_resize);
if (lt || !it->second.remove) {
lyx::Assert(it->second.text.get());
cached_text = it->second.text;
void InsetText::resizeLyXText(BufferView * bv, bool force) const
{
+ if (lt) {
+ // we cannot resize this because we are in use!
+ // so do this on the next possible getLyXText()
+ do_resize = bv;
+ return;
+ }
+ do_resize = false;
// lyxerr << "InsetText::resizeLyXText\n";
if (!par->next() && !par->size()) // no data, resize not neccessary!
return;
void InsetText::reinitLyXText() const
{
+ if (lt) {
+ // we cannot resize this because we are in use!
+ // so do this on the next possible getLyXText()
+ do_reinit = true;
+ return;
+ }
+ do_reinit = false;
+ do_resize = false;
// lyxerr << "InsetText::reinitLyXText\n";
for(Cache::iterator it = cache.begin(); it != cache.end(); ++it) {
lyx::Assert(it->second.text.get());