From 821cffab63909ca1025539dc5bfecd4dca963f3a Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 8 Mar 2010 18:57:42 +0000 Subject: [PATCH] s/isBufferValid/isBufferLoaded/ git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33677 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/Inset.cpp | 2 +- src/insets/Inset.h | 7 ++++--- src/insets/InsetBibitem.cpp | 2 +- src/insets/InsetBibtex.cpp | 2 +- src/insets/InsetQuotes.cpp | 2 +- src/mathed/InsetMathHull.cpp | 2 +- src/mathed/MathMacroTemplate.cpp | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index a1ff2392da..5df7d41720 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -198,7 +198,7 @@ Buffer const & Inset::buffer() const } -bool Inset::isBufferValid() const +bool Inset::isBufferLoaded() const { return buffer_ && theBufferList().isLoaded(buffer_); } diff --git a/src/insets/Inset.h b/src/insets/Inset.h index 01907cb330..50c05645ee 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -107,9 +107,10 @@ public: /// retrieve associated Buffer virtual Buffer & buffer(); virtual Buffer const & buffer() const; - /// This checks whether the Buffer * actually points to an open - /// Buffer. It might not if that Buffer has been closed. - bool isBufferValid() const; + /// Returns true if buffer_ actually points to a Buffer that has + /// been loaded into LyX and is still open. Note that this will + /// always return false for cloned Buffers. + bool isBufferLoaded() const; /// initialize view for this inset. /** diff --git a/src/insets/InsetBibitem.cpp b/src/insets/InsetBibitem.cpp index 3191bebd1c..46f30e2147 100644 --- a/src/insets/InsetBibitem.cpp +++ b/src/insets/InsetBibitem.cpp @@ -62,7 +62,7 @@ InsetBibitem::InsetBibitem(Buffer * buf, InsetCommandParams const & p) InsetBibitem::~InsetBibitem() { - if (isBufferValid()) + if (isBufferLoaded()) buffer_->invalidateBibinfoCache(); } diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 073d2f113b..9a3f8d0033 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -59,7 +59,7 @@ InsetBibtex::InsetBibtex(Buffer * buf, InsetCommandParams const & p) InsetBibtex::~InsetBibtex() { - if (isBufferValid()) + if (isBufferLoaded()) buffer_->invalidateBibinfoCache(); } diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp index e56d809dec..cf8a941dda 100644 --- a/src/insets/InsetQuotes.cpp +++ b/src/insets/InsetQuotes.cpp @@ -185,7 +185,7 @@ void InsetQuotes::parseString(string const & s) docstring InsetQuotes::displayString() const { - Language const * loclang = isBufferValid() ? buffer().params().language : 0; + Language const * loclang = isBufferLoaded() ? buffer().params().language : 0; int const index = quote_index[side_][language_]; docstring retdisp = docstring(1, display_quote_char[times_][index]); diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 62a28ec4c9..88147a48ed 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -471,7 +471,7 @@ static docstring latexString(InsetMathHull const & inset) // first time as a whole, and the second time only the inner math. // In this last case inset.buffer() would be invalid. static Encoding const * encoding = 0; - if (inset.isBufferValid()) + if (inset.isBufferLoaded()) encoding = &(inset.buffer().params().encoding()); WriteStream wi(ls, false, true, WriteStream::wsPreview, encoding); inset.write(wi); diff --git a/src/mathed/MathMacroTemplate.cpp b/src/mathed/MathMacroTemplate.cpp index 5c1dd7bf37..17688c3b90 100644 --- a/src/mathed/MathMacroTemplate.cpp +++ b/src/mathed/MathMacroTemplate.cpp @@ -673,7 +673,7 @@ void MathMacroTemplate::shiftArguments(size_t from, int by) int MathMacroTemplate::maxArgumentInDefinition() const { // We don't have a buffer when pasting from the clipboard (bug 6014). - Buffer const * macro_buffer = this->isBufferValid() ? &buffer() : 0; + Buffer const * macro_buffer = this->isBufferLoaded() ? &buffer() : 0; int maxArg = 0; DocIterator it = doc_iterator_begin(macro_buffer, this); it.idx() = defIdx(); -- 2.39.2