X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferView.C;h=7e9eec803e7173cda53ffdd0f30cf38768c05db7;hb=8a5d04fd84e344a1ba1cfd3f5cce67d41874cfa3;hp=207fc5c7b9c3f3f8e54bab8695c2e42e573c5163;hpb=edc55ba120c15ac51a03515f95bdaff91a19587d;p=lyx.git diff --git a/src/BufferView.C b/src/BufferView.C index 207fc5c7b9..7e9eec803e 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -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" @@ -86,12 +87,6 @@ LyXScreen & BufferView::screen() const } -WorkArea & BufferView::workarea() const -{ - return pimpl_->workarea(); -} - - LyXView * BufferView::owner() const { return pimpl_->owner_; @@ -160,6 +155,12 @@ bool BufferView::available() const } +Change const BufferView::getCurrentChange() +{ + return pimpl_->getCurrentChange(); +} + + void BufferView::beforeChange(LyXText * text) { pimpl_->beforeChange(text); @@ -264,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); } @@ -306,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; } @@ -321,7 +321,7 @@ bool BufferView::insertLyXFile(string const & filen) if (c == '#') { lyxerr[Debug::INFO] << "Will insert file with header" << endl; - res = buffer()->readFile(lex, text->cursor.par()); + res = buffer()->readFile(lex, fname, text->cursor.par()); } else { lyxerr[Debug::INFO] << "Will insert file without header" << endl; @@ -562,7 +562,7 @@ bool BufferView::gotoLabel(string const & label) } -void BufferView::menuUndo() +void BufferView::undo() { if (!available()) return; @@ -579,7 +579,7 @@ void BufferView::menuUndo() } -void BufferView::menuRedo() +void BufferView::redo() { if (!available()) return; @@ -671,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) { @@ -937,3 +937,27 @@ Language const * BufferView::getParentLanguage(Inset * inset) const return text->cursor.par()->getFontSettings(buffer()->params, text->cursor.pos()).language(); } + + +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); +} + + +int BufferView::workHeight() const +{ + return pimpl_->workarea().workHeight(); +}