]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
Fix crash when running lyx -dbg insets -e ...
[lyx.git] / src / BufferView_pimpl.C
index b15dd9ad75811a2349fbabd7d216dc5e1312ba70..f0c6fc86c0ae4636fd558733850dbed11e9ed5af 100644 (file)
@@ -82,7 +82,7 @@ extern BufferList bufferlist;
 extern char ascii_type;
 
 extern bool math_insert_greek(BufferView *, char);
-extern void sigchldhandler(pid_t pid, int * status);
+extern void sigchldchecker(pid_t pid, int * status);
 extern int bibitemMaxWidth(BufferView *, LyXFont const &);
 
 
@@ -598,7 +598,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        bool paste_internally = false;
        if (button == 2
            && bv_->text->selection.set()) {
-               owner_->getLyXFunc()->Dispatch(LFUN_COPY);
+               owner_->getLyXFunc()->dispatch(LFUN_COPY);
                paste_internally = true;
        }
        
@@ -644,9 +644,9 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        // insert this
        if (button == 2) {
                if (paste_internally)
-                       owner_->getLyXFunc()->Dispatch(LFUN_PASTE);
+                       owner_->getLyXFunc()->dispatch(LFUN_PASTE);
                else
-                       owner_->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
+                       owner_->getLyXFunc()->dispatch(LFUN_PASTESELECTION,
                                                       "paragraph");
                selection_possible = false;
                return;
@@ -1034,7 +1034,7 @@ void BufferView::Pimpl::cursorToggle()
        if (pid == -1) // error find out what is wrong
                ; // ignore it for now.
        else if (pid > 0)
-               sigchldhandler(pid, &status);
+               sigchldchecker(pid, &status);
 
        updatelist.update(bv_);
        
@@ -1149,7 +1149,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
                if (b != 0 ) buffer(b);
        }
 
-       Paragraph * par = bv_->text->getParFromID(saved_positions[i].par_id);
+       Paragraph * par = buffer_->getParFromID(saved_positions[i].par_id);
        if (!par)
                return;
 
@@ -1266,8 +1266,11 @@ void BufferView::Pimpl::hideCursor()
 
 void BufferView::Pimpl::toggleSelection(bool b)
 {
-       if (screen_.get())
+       if (screen_.get()) {
+               if (bv_->theLockingInset())
+                       bv_->theLockingInset()->toggleSelection(bv_, b);
                screen_->toggleSelection(bv_->text, bv_, b);
+       }
 }
 
 
@@ -2634,6 +2637,18 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        }
        break;
        
+       case LFUN_INSET_TOGGLE:
+       {
+               LyXText * lt = bv_->getLyXText();
+               hideCursor();
+               beforeChange(lt);
+               update(lt, BufferView::SELECT|BufferView::FITCUR);
+               lt->toggleInset(bv_);
+               update(lt, BufferView::SELECT|BufferView::FITCUR);
+               setState();
+       }       
+               break;
+
        case LFUN_QUOTE:
                bv_->insertCorrectQuote();
                break;
@@ -3328,7 +3343,7 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout)
        // if we are in a locking inset we should try to insert the
        // inset there otherwise this is a illegal function now
        if (bv_->theLockingInset()) {
-               if (bv_->theLockingInset()->insertInsetAllowed(inset))
+               if (bv_->theLockingInset()->insetAllowed(inset))
                    return bv_->theLockingInset()->insertInset(bv_, inset);
                return false;
        }