]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.C
reverse last change
[lyx.git] / src / BufferView.C
index 514026d7f5b0ade64d3bd2f08ecdd6a27138768b..7e9eec803e7173cda53ffdd0f30cf38768c05db7 100644 (file)
@@ -29,6 +29,7 @@
 #include "lyxlex.h"
 #include "lyxtext.h"
 #include "undo_funcs.h"
+#include "changes.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
@@ -154,6 +155,12 @@ bool BufferView::available() const
 }
 
 
+Change const BufferView::getCurrentChange()
+{
+       return pimpl_->getCurrentChange();
+}
+
 void BufferView::beforeChange(LyXText * text)
 {
        pimpl_->beforeChange(text);
@@ -258,9 +265,9 @@ bool BufferView::dispatch(FuncRequest const & ev)
 }
 
 
-int BufferView::scroll(long time)
+void BufferView::scroll(int lines)
 {
-       return pimpl_->scroll(time);
+       pimpl_->scroll(lines);
 }
 
 
@@ -300,8 +307,7 @@ bool BufferView::insertLyXFile(string const & filen)
 
        ifstream ifs(fname.c_str());
        if (!ifs) {
-               Alert::alert(_("Error!"),
-                          _("Cannot open specified file: "),
+               Alert::err_alert(_("Error! Cannot open specified file:"),
                           MakeDisplayPath(fname, 50));
                return false;
        }
@@ -556,7 +562,7 @@ bool BufferView::gotoLabel(string const & label)
 }
 
 
-void BufferView::menuUndo()
+void BufferView::undo()
 {
        if (!available())
                return;
@@ -573,7 +579,7 @@ void BufferView::menuUndo()
 }
 
 
-void BufferView::menuRedo()
+void BufferView::redo()
 {
        if (!available())
                return;
@@ -665,7 +671,7 @@ void BufferView::replaceWord(string const & replacestring)
        toggleSelection(false);
        tt->replaceSelectionWithString(this, replacestring);
 
-       tt->setSelectionOverString(this, replacestring);
+       tt->setSelectionRange(this, replacestring.length());
 
        // Go back so that replacement string is also spellchecked
        for (string::size_type i = 0; i < replacestring.length() + 1; ++i) {
@@ -933,6 +939,18 @@ Language const * BufferView::getParentLanguage(Inset * inset) const
 }
 
 
+Encoding const * BufferView::getEncoding() const
+{
+       LyXText * t = getLyXText();
+       if (!t)
+               return 0;
+
+       LyXCursor const & c= t->cursor;
+       LyXFont const font = c.par()->getFont(buffer()->params, c.pos());
+       return font.language()->encoding();
+}
+
+
 void BufferView::haveSelection(bool sel)
 {
        pimpl_->workarea().haveSelection(sel);