]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
I reactivate the code to resize the InsetText on a resize event of the main
[lyx.git] / src / BufferView_pimpl.C
index 74dd4ca64847bde7a345ca41b43d46cba09c5614..84152ccb47041b363c2642efe7a77fbe095c7659 100644 (file)
@@ -369,7 +369,9 @@ int BufferView::Pimpl::resizeCurrentBuffer()
                bv_->theLockingInset(the_locking_inset);
        }
        bv_->text->first_y = screen_->topCursorVisible(bv_->text);
-#if 0
+       // please tell me WHY the heck you deactivated this code, whoever
+       // 'you' are (Jug 20020311)
+#if 1
        buffer_->resizeInsets(bv_);
 #endif
        // this will scroll the screen such that the cursor becomes visible
@@ -756,10 +758,12 @@ void BufferView::Pimpl::selectionRequested()
  
 void BufferView::Pimpl::selectionLost()
 {
-       hideCursor();
-       toggleSelection();
-       bv_->getLyXText()->clearSelection();
-       showCursor(); 
+       if (active() && available()) { 
+               hideCursor();
+               toggleSelection();
+               bv_->getLyXText()->clearSelection();
+               showCursor(); 
+       }
 }
 
  
@@ -1143,9 +1147,8 @@ void BufferView::Pimpl::cursorPrevious(LyXText * text)
                return;
        
        int y = text->first_y;
-       if (text->inset_owner)
-               y += bv_->text->first_y;
        Row * cursorrow = text->cursor.row();
+       
        text->setCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
        finishUndo();
        // This is to allow jumping over large insets
@@ -1190,7 +1193,8 @@ void BufferView::Pimpl::cursorNext(LyXText * text)
 
 bool BufferView::Pimpl::available() const
 {
-       if (buffer_ && bv_->text) return true;
+       if (buffer_ && bv_->text)
+               return true;
        return false;
 }
 
@@ -3403,7 +3407,7 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout)
 
 void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
 {
-       if (!inset)
+       if (!inset || !available())
                return;
 
        // first check for locking insets
@@ -3429,9 +3433,14 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
                }
        }
   
-       // then check the current buffer
-       if (available()) {
-               hideCursor();
+       // then check if the inset is a top_level inset (has no owner)
+       // if yes do the update as always otherwise we have to update the
+       // toplevel inset where this inset is inside
+       Inset * tl_inset = inset;
+       while(tl_inset->owner())
+               tl_inset = tl_inset->owner();
+       hideCursor();
+       if (tl_inset == inset) {
                update(bv_->text, BufferView::UPDATE);
                if (bv_->text->updateInset(bv_, inset)) {
                        if (mark_dirty) {
@@ -3444,6 +3453,13 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
                        }
                        return;
                }
+       } else if (static_cast<UpdatableInset *>(tl_inset)
+                          ->updateInsetInInset(bv_, inset))
+       {
+                       if (bv_->text->updateInset(bv_,  tl_inset)) {
+                               update();
+                               updateScrollbar();
+                       }
        }
 }