]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
better latin3&4 support
[lyx.git] / src / BufferView_pimpl.C
index dbd3f0828e3ef69001adeff7b31dc597452b77d5..c52616df71ff8a84f4f757982312a85d668ecb1c 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;
 }
 
@@ -701,7 +698,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 +805,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;
@@ -889,7 +889,7 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
            (cursor.par()->getInset(cursor.pos() - 1)->editable())) {
                Inset * tmpinset = cursor.par()->getInset(cursor.pos()-1);
                LyXFont font = text->getFont(buffer_, cursor.par(),
-                                                 cursor.pos()-1);
+                                                 cursor.pos() - 1);
                int const width = tmpinset->width(bv_, font);
                int const inset_x = font.isVisibleRightToLeft()
                        ? cursor.x() : cursor.x() - width;
@@ -1039,7 +1039,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();
        }
@@ -1215,12 +1215,7 @@ void BufferView::Pimpl::setState()
                return;
 
        LyXText * text = bv_->getLyXText();
-       if (text->real_current_font.isRightToLeft()
-#ifndef NO_LATEX
-           &&
-           text->real_current_font.latex() != LyXFont::ON
-#endif
-               ) {
+       if (text->real_current_font.isRightToLeft()) {
                if (owner_->getIntl()->keymap == Intl::PRIMARY)
                        owner_->getIntl()->KeyMapSec();
        } else {
@@ -1602,14 +1597,6 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                owner_->getDialogs()->setUserFreeFont();
                break;
 
-#ifndef NO_LATEX
-       case LFUN_TEX:
-               Tex(bv_);
-               setState();
-               owner_->showState();
-               break;
-#endif
-               
        case LFUN_FILE_INSERT:
        {
                MenuInsertLyXFile(argument);
@@ -2366,7 +2353,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();
@@ -2397,6 +2384,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_);
@@ -2422,7 +2410,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                                       | BufferView::CHANGE);
                        }
                } else {
-                       bv_->cut();
+                       bv_->cut(false);
                }
        }
        break;
@@ -2509,7 +2497,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                                showCursor();
                        }
                } else {
-                       bv_->cut();
+                       bv_->cut(false);
                }
                owner_->showState();
                setState();
@@ -2534,6 +2522,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,
@@ -2549,7 +2538,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                                       | BufferView::CHANGE);
                        }
                } else
-                       bv_->cut();
+                       bv_->cut(false);
        }
        break;
 
@@ -2604,6 +2593,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);
@@ -2748,7 +2738,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;
@@ -2764,7 +2754,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;
                }
                
@@ -2863,18 +2853,6 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        }
        break;
 
-       case LFUN_GETLATEX:
-       {
-#ifndef NO_LATEX
-               LyXFont & font = bv_->getLyXText()->current_font;
-                if (font.latex() == LyXFont::ON)
-                       owner_->getLyXFunc()->setMessage("L");
-                else
-#endif
-                       owner_->getLyXFunc()->setMessage("0");
-       }
-       break;
-
        // --- accented characters ---------------------------
                
        case LFUN_UMLAUT:
@@ -2955,9 +2933,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);
@@ -3006,11 +2982,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);
                }
@@ -3099,13 +3071,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_) ?
                        }
                }
@@ -3128,7 +3101,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
@@ -3267,6 +3240,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?
        }
 }
 
@@ -3362,13 +3337,11 @@ 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);
                update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-#ifndef NO_LATEX
-               bv_->text->current_font.setLatex(LyXFont::OFF);
-#endif
        }
        
        bv_->text->insertInset(bv_, inset);