]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.C
Minimal fix needed to give Qt a label dialog again.
[lyx.git] / src / BufferView.C
index 514026d7f5b0ade64d3bd2f08ecdd6a27138768b..293e0f9f4ed9452c6b1d76dcd9a966b82ff5a9c3 100644 (file)
@@ -9,10 +9,6 @@
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "BufferView.h"
 #include "BufferView_pimpl.h"
 
@@ -29,6 +25,7 @@
 #include "lyxlex.h"
 #include "lyxtext.h"
 #include "undo_funcs.h"
+#include "changes.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
@@ -38,6 +35,7 @@
 
 #include "insets/insetcommand.h" // ChangeRefs
 #include "insets/inseterror.h"
+#include "insets/updatableinset.h"
 
 #include "support/FileInfo.h"
 #include "support/filetools.h"
@@ -154,6 +152,12 @@ bool BufferView::available() const
 }
 
 
+Change const BufferView::getCurrentChange()
+{
+       return pimpl_->getCurrentChange();
+}
+
+
 void BufferView::beforeChange(LyXText * text)
 {
        pimpl_->beforeChange(text);
@@ -258,19 +262,12 @@ bool BufferView::dispatch(FuncRequest const & ev)
 }
 
 
-int BufferView::scroll(long time)
-{
-       return pimpl_->scroll(time);
-}
-
-
-int BufferView::defaultHeight() const
+void BufferView::scroll(int lines)
 {
-       return text->defaultHeight();
+       pimpl_->scroll(lines);
 }
 
 
-
 // Inserts a file into current document
 bool BufferView::insertLyXFile(string const & filen)
        //
@@ -300,8 +297,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 +552,7 @@ bool BufferView::gotoLabel(string const & label)
 }
 
 
-void BufferView::menuUndo()
+void BufferView::undo()
 {
        if (!available())
                return;
@@ -573,7 +569,7 @@ void BufferView::menuUndo()
 }
 
 
-void BufferView::menuRedo()
+void BufferView::redo()
 {
        if (!available())
                return;
@@ -665,7 +661,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) {
@@ -792,7 +788,7 @@ int BufferView::unlockInset(UpdatableInset * inset)
                finishUndo();
                return 0;
        }
-       return bufferlist.unlockInset(inset);
+       return 1;
 }
 
 
@@ -870,12 +866,12 @@ bool BufferView::ChangeRefsIfUnique(string const & from, string const & to)
 }
 
 
-bool BufferView::ChangeCitationsIfUnique(string const & from,
-                                        string const & to)
+bool BufferView::ChangeCitationsIfUnique(string const & from, string const & to)
 {
        typedef pair<string, string> StringPair;
 
-       vector<StringPair> keys = buffer()->getBibkeyList();
+       vector<StringPair> keys;
+       buffer()->fillWithBibKeys(keys);
        if (count_if(keys.begin(), keys.end(),
                     lyx::equal_1st_in_pair<StringPair>(from))
            > 1)
@@ -933,6 +929,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);