]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
add missing writeNormal() methods to some insets
[lyx.git] / src / BufferView_pimpl.C
index f8bcd15520cb494e75532812aeece4514e4fec07..082bfb463eb7b460700ddec9e0e4cbe4e9b72330 100644 (file)
@@ -366,10 +366,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
 
        /// clear the "Formatting Document" message 
        owner_->message("");
-       /// get rid of the splash screen if it's not gone already
-       owner_->getDialogs()->destroySplash();
+
        return 0;
 }
 
@@ -567,7 +564,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
 
 // Single-click on work area
 void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
-                                           unsigned int button)
+                                            unsigned int button)
 {
        if (!buffer_ || !screen_.get()) return;
 
@@ -592,9 +589,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
                   otherwise give the event to the inset */
                if (inset_hit == bv_->theLockingInset()) {
                        bv_->theLockingInset()->
-                               insetButtonPress(bv_,
-                                                xpos, ypos,
-                                                button);
+                               insetButtonPress(bv_,xpos, ypos,button);
                        return;
                } else {
                        bv_->unlockInset(bv_->theLockingInset());
@@ -701,7 +696,7 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button)
 void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
 {
        // select a line
-       if (buffer_)
+       if (!buffer_)
                return;
 
        LyXText * text = bv_->getLyXText();
@@ -808,6 +803,9 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                return;
        }
 
+#ifdef WITH_WARNINGS
+#warning variable c is set but never used. What is it good for?? (JMarc)
+#endif
        // check whether we want to open a float
        if (bv_->text) {
                bool hit = false;
@@ -1039,7 +1037,7 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f)
 
        if (text->inset_owner) {
                text->inset_owner->setUpdateStatus(bv_, InsetText::NONE);
-           updateInset(text->inset_owner, true);
+           updateInset(text->inset_owner, false);
        } else {
            update();
        }
@@ -2353,7 +2351,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                        // just comment out the line below...
                        showCursor();
                } else {
-                       bv_->cut();
+                       bv_->cut(false);
                }
                moveCursorUpdate(false);
                owner_->showState();
@@ -2384,6 +2382,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                                                 cursor.par()->params().pagebreakBottom(),
                                                 VSpace(VSpace::NONE), 
                                                 cursor.par()->params().spaceBottom(),
+                                                cursor.par()->params().spacing(), 
                                                 cursor.par()->params().align(), 
                                                 cursor.par()->params().labelWidthString(), 0);
                                        lt->cursorLeft(bv_);
@@ -2409,7 +2408,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                                       | BufferView::CHANGE);
                        }
                } else {
-                       bv_->cut();
+                       bv_->cut(false);
                }
        }
        break;
@@ -2496,7 +2495,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                                showCursor();
                        }
                } else {
-                       bv_->cut();
+                       bv_->cut(false);
                }
                owner_->showState();
                setState();
@@ -2521,6 +2520,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                                         cursor.par()->params().pagebreakTop(), 
                                         cursor.par()->params().pagebreakBottom(),
                                         VSpace(VSpace::NONE), cursor.par()->params().spaceBottom(),
+                                        cursor.par()->params().spacing(), 
                                         cursor.par()->params().align(), 
                                         cursor.par()->params().labelWidthString(), 0);
                                update(lt,
@@ -2536,7 +2536,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                                       | BufferView::CHANGE);
                        }
                } else
-                       bv_->cut();
+                       bv_->cut(false);
        }
        break;
 
@@ -2591,6 +2591,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                                         cursor.par()->params().pagebreakTop(), 
                                         cursor.par()->params().pagebreakBottom(),
                                         VSpace(VSpace::DEFSKIP), cursor.par()->params().spaceBottom(),
+                                        cursor.par()->params().spacing(), 
                                         cursor.par()->params().align(), 
                                         cursor.par()->params().labelWidthString(), 1);
                                //update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
@@ -2735,7 +2736,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                if (floatList.typeExist(argument)) {
                        insertAndEditInset(new InsetFloat(argument));
                } else {
-                       lyxerr << "Non-existant float type: "
+                       lyxerr << "Non-existent float type: "
                               << argument << endl;
                }
                break;
@@ -2751,7 +2752,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                        else
                                delete new_inset;
                } else {
-                       lyxerr << "Non-existant float type: "
+                       lyxerr << "Non-existent float type: "
                               << argument << endl;
                }
                
@@ -2911,6 +2912,10 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                mathDispatchMathMode(bv_, argument);
                break;
                
+       case LFUN_GREEK:                 // Insert a single greek letter
+               mathDispatchGreek(bv_, argument);
+               break;
+               
        case LFUN_CITATION_INSERT:
        {
                InsetCommandParams p;
@@ -2930,9 +2935,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                // The argument can be up to two tokens separated 
                // by a space. The first one is the bibstyle.
                string const db       = token(argument, ' ', 0);
-               string bibstyle = token(argument, ' ', 1);
-               if (bibstyle.empty())
-                       bibstyle = "plain";
+               string const bibstyle = token(argument, ' ', 1);
 
                InsetCommandParams p( "BibTeX", db, bibstyle );
                InsetBibtex * inset = new InsetBibtex(p);
@@ -2981,11 +2984,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                InsetCommandParams p("index");
                if (argument.empty()) {
                        string const idxstring(bv_->getLyXText()->getStringToIndex(bv_));
-                       if (!idxstring.empty()) {
-                               p.setContents(idxstring);
-                       } else {
-                               break;
-                       }
+                       p.setContents(idxstring);
                } else {
                        p.setContents(argument);
                }
@@ -3074,13 +3073,14 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                string arg = argument;
 
                if (arg.empty()) {
-                       arg = bv_->getLyXText()->selectionAsString(buffer_);
+                       arg = bv_->getLyXText()->selectionAsString(buffer_,
+                                                                  false);
  
                        // FIXME
                        if (arg.size() > 100 || arg.empty()) {
                                // Get word or selection
                                bv_->getLyXText()->selectWordWhenUnderCursor(bv_, LyXText::WHOLE_WORD);
-                               arg = bv_->getLyXText()->selectionAsString(buffer_);
+                               arg = bv_->getLyXText()->selectionAsString(buffer_, false);
                                // FIXME: where is getLyXText()->unselect(bv_) ?
                        }
                }
@@ -3103,7 +3103,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                
                if (lyxrc.auto_region_delete) {
                        if (lt->selection.set()) {
-                               lt->cutSelection(bv_, false);
+                               lt->cutSelection(bv_, false, false);
                                bv_->update(lt,
                                            BufferView::SELECT
                                            | BufferView::FITCUR
@@ -3242,6 +3242,8 @@ void BufferView::Pimpl::specialChar(InsetSpecialChar::Kind kind)
                InsetSpecialChar * new_inset = 
                        new InsetSpecialChar(kind);
                insertInset(new_inset);
+               // Ok, what happens here if we are unable to insert
+               // the inset? Leak it?
        }
 }
 
@@ -3337,6 +3339,7 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout)
                bv_->text->setParagraph(bv_, 0, 0,
                                   0, 0,
                                   VSpace(VSpace::NONE), VSpace(VSpace::NONE),
+                                  Spacing(),
                                   LYX_ALIGN_LAYOUT, 
                                   string(),
                                   0);