From 1a0f5eaf8d473bef131b45c70d803c210e90e192 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sat, 16 Sep 2006 14:00:13 +0000 Subject: [PATCH] deledelete BufferView::available() method because buffer serves the same purpose. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15018 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 8 +------- src/BufferView.h | 3 --- src/frontends/LyXView.C | 4 ++-- src/frontends/WorkArea.C | 4 ++-- src/frontends/controllers/Kernel.C | 2 +- src/lyx_cb.C | 4 ++-- src/lyxfind.C | 4 ++-- src/lyxfunc.C | 14 +++++++------- 8 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/BufferView.C b/src/BufferView.C index 2cde9ab9f0..709da3c6f6 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -517,12 +517,6 @@ void BufferView::setCursorFromScrollbar() } -bool BufferView::available() const -{ - return buffer_; -} - - Change const BufferView::getCurrentChange() { if (!buffer_->params().tracking_changes || !cursor_.selection()) @@ -1399,7 +1393,7 @@ void BufferView::menuInsertLyXFile(string const & filenm) // Launch a file browser string initpath = lyxrc.document_path; - if (available()) { + if (buffer_) { string const trypath = buffer_->filePath(); // If directory is writeable, use this as default. if (isDirWriteable(trypath)) diff --git a/src/BufferView.h b/src/BufferView.h index 11c95453c2..2f580a3263 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -127,9 +127,6 @@ public: /// return the Scrollbar Parameters ScrollbarParameters const & scrollbarParameters() const; - /// FIXME - bool available() const; - /// Save the current position as bookmark i void savePosition(unsigned int i); /// Restore the position from bookmark i diff --git a/src/frontends/LyXView.C b/src/frontends/LyXView.C index 8989471f45..62d41ff69f 100644 --- a/src/frontends/LyXView.C +++ b/src/frontends/LyXView.C @@ -273,7 +273,7 @@ void LyXView::autoSave() { lyxerr[Debug::INFO] << "Running autoSave()" << endl; - if (view()->available()) { + if (view()->buffer()) { ::autoSave(view()); } } @@ -318,7 +318,7 @@ void LyXView::updateWindowTitle() docstring maximize_title = lyx::from_ascii("LyX"); docstring minimize_title = lyx::from_ascii("LyX"); - if (view()->available()) { + if (view()->buffer()) { string const cur_title = buffer()->fileName(); if (!cur_title.empty()) { maximize_title += lyx::from_ascii(": ") + makeDisplayPath(cur_title, 30); diff --git a/src/frontends/WorkArea.C b/src/frontends/WorkArea.C index cf7eac4b07..41c7c62e6b 100644 --- a/src/frontends/WorkArea.C +++ b/src/frontends/WorkArea.C @@ -235,7 +235,7 @@ void WorkArea::processKeySym(LyXKeySymPtr key, * of the cursor. Note we cannot do this inside * dispatch() itself, because that's called recursively. */ -// if (buffer_view_->available()) +// if (buffer_view_->buffer()) toggleCursor(); // uneeded "redraw()" call commented out for now. @@ -343,7 +343,7 @@ void WorkArea::showCursor() if (cursor_visible_) return; - if (!buffer_view_->available()) + if (!buffer_view_->buffer()) return; CursorShape shape = BAR_SHAPE; diff --git a/src/frontends/controllers/Kernel.C b/src/frontends/controllers/Kernel.C index 17c417f8a9..7a4ea142f6 100644 --- a/src/frontends/controllers/Kernel.C +++ b/src/frontends/controllers/Kernel.C @@ -51,7 +51,7 @@ bool Kernel::isBufferAvailable() const { if (!lyxview_.view()) return false; - return lyxview_.view()->available(); + return lyxview_.view()->buffer(); } diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 3635a4a0a1..e1af6fd8fd 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -302,7 +302,7 @@ void autoSave(BufferView * bv) // should probably be moved into BufferList (Lgb) // Perfect target for a thread... { - if (!bv->available()) + if (!bv->buffer()) return; if (bv->buffer()->isBakClean() || bv->buffer()->isReadonly()) { @@ -353,7 +353,7 @@ void newFile(BufferView * bv, string const & filename) // Insert ascii file (if filename is empty, prompt for one) void insertAsciiFile(BufferView * bv, string const & f, bool asParagraph) { - if (!bv->available()) + if (!bv->buffer()) return; // FIXME: We don't know the encoding of the file diff --git a/src/lyxfind.C b/src/lyxfind.C index f2752a82f0..d18ae9b58b 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -141,7 +141,7 @@ bool searchAllowed(BufferView * bv, string const & str) Alert::error(_("Search error"), _("Search string is empty")); return false; } - return bv->available(); + return bv->buffer(); } @@ -337,7 +337,7 @@ void replace(BufferView * bv, FuncRequest const & ev) bool findNextChange(BufferView * bv) { - if (!bv->available()) + if (!bv->buffer()) return false; DocIterator cur = bv->cursor(); diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 8a61978bdb..b1aa3fb299 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -775,7 +775,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd) case LFUN_CANCEL: keyseq.reset(); meta_fake_bit = key_modifier::none; - if (view()->available()) + if (view()->buffer()) // cancel any selection dispatch(FuncRequest(LFUN_MARK_OFF)); setMessage(lyx::from_utf8(N_("Cancel"))); @@ -998,7 +998,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd) break; case LFUN_LYX_QUIT: - if (view()->available()) { + if (view()->buffer()) { // save cursor Position for opened files to .lyx/session LyX::ref().session().saveFilePosition(owner->buffer()->fileName(), boost::tie(view()->cursor().pit(), view()->cursor().pos()) ); @@ -1591,7 +1591,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd) } } - if (view()->available()) { + if (view()->buffer()) { // Redraw screen unless explicitly told otherwise. // This also initializes the position cache for all insets // in (at least partially) visible top-level paragraphs. @@ -1690,7 +1690,7 @@ void LyXFunc::menuNew(string const & name, bool fromTemplate) string initpath = lyxrc.document_path; string filename(name); - if (view()->available()) { + if (view()->buffer()) { string const trypath = owner->buffer()->filePath(); // If directory is writeable, use this as default. if (isDirWriteable(trypath)) @@ -1742,7 +1742,7 @@ void LyXFunc::open(string const & fname) { string initpath = lyxrc.document_path; - if (view()->available()) { + if (view()->buffer()) { string const trypath = owner->buffer()->filePath(); // If directory is writeable, use this as default. if (isDirWriteable(trypath)) @@ -1819,7 +1819,7 @@ void LyXFunc::doImport(string const & argument) if (filename.empty()) { string initpath = lyxrc.document_path; - if (view()->available()) { + if (view()->buffer()) { string const trypath = owner->buffer()->filePath(); // If directory is writeable, use this as default. if (isDirWriteable(trypath)) @@ -1940,7 +1940,7 @@ string const LyXFunc::viewStatusMessage() if (keyseq.length() > 0 && !keyseq.deleted()) return keyseq.printOptions(); - if (!view()->available()) + if (!view()->buffer()) return lyx::to_utf8(_("Welcome to LyX!")); return view()->cursor().currentState(); -- 2.39.2