]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView2.C
Fixed cut&paste bugs and added freespacing for ERT Insets.
[lyx.git] / src / BufferView2.C
index 6226a7edafdb902e692d37b9fdb6b09d4ecc372c..0d5d4c10a418bd6a90f4c40242f5a36808a80994 100644 (file)
@@ -23,7 +23,7 @@
 #include "support/FileInfo.h"
 #include "lyxscreen.h"
 #include "support/filetools.h"
-#include "lyx_gui_misc.h"
+#include "frontends/Alert.h"
 #include "LaTeX.h"
 #include "BufferView_pimpl.h"
 #include "insets/insetcommand.h" //ChangeRefs
@@ -63,7 +63,7 @@ bool BufferView::insertLyXFile(string const & filen)
        FileInfo const fi(fname);
 
        if (!fi.readable()) {
-               WriteAlert(_("Error!"),
+               Alert::alert(_("Error!"),
                           _("Specified file is unreadable: "),
                           MakeDisplayPath(fname, 50));
                return false;
@@ -73,13 +73,13 @@ bool BufferView::insertLyXFile(string const & filen)
 
        ifstream ifs(fname.c_str());
        if (!ifs) {
-               WriteAlert(_("Error!"),
+               Alert::alert(_("Error!"),
                           _("Cannot open specified file: "),
                           MakeDisplayPath(fname, 50));
                return false;
        }
        
-       char const c = ifs.peek();
+       int const c = ifs.peek();
        
        LyXLex lex(0, 0);
        lex.setStream(ifs);
@@ -264,10 +264,6 @@ void BufferView::copyEnvironment()
 {
        if (available()) {
                text->copyEnvironmentType();
-               // clear the selection, even if mark_set
-               toggleSelection();
-               text->clearSelection();
-               update(text, BufferView::SELECT|BufferView::FITCUR);
                owner()->message(_("Paragraph environment type copied"));
        }
 }
@@ -287,10 +283,6 @@ void BufferView::copy()
 {
        if (available()) {
                text->copySelection(this);
-               // clear the selection, even if mark_set
-               toggleSelection();
-               text->clearSelection();
-               update(text, BufferView::SELECT|BufferView::FITCUR);
                owner()->message(_("Copy"));
        }
 }
@@ -339,7 +331,7 @@ string const BufferView::nextWord(float & value)
                return string();
        }
 
-       return text->selectNextWord(this, value);
+       return text->selectNextWordToSpellcheck(this, value);
 }
 
   
@@ -398,6 +390,9 @@ void BufferView::replaceWord(string const & replacestring)
 
 bool BufferView::lockInset(UpdatableInset * inset)
 {
+       // don't relock if we're already locked
+       if (theLockingInset() == inset)
+               return true;
        if (!theLockingInset() && inset) {
                theLockingInset(inset);
                return true;
@@ -415,8 +410,7 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
                Inset * locking_inset = theLockingInset()->getLockingInset();
 
                if ((cursor.pos() - 1 >= 0) &&
-                   (cursor.par()->getChar(cursor.pos() - 1) ==
-                    Paragraph::META_INSET) &&
+                   cursor.par()->isInset(cursor.pos() - 1) &&
                    (cursor.par()->getInset(cursor.pos() - 1) ==
                     locking_inset))
                        text->setCursor(this, cursor,