From: Stefan Schimanski Date: Fri, 22 Feb 2008 21:11:19 +0000 (+0000) Subject: * following Andre's advice to rename the method into X-Git-Tag: 1.6.10~6152 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8c2149d3aae6cea1e7c67fd561c120bfcfe2664a;p=lyx.git * following Andre's advice to rename the method into createCompletionList. This makes the ownership of the returned object clear. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23143 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiCompleter.cpp b/src/frontends/qt4/GuiCompleter.cpp index 20ad50f471..b59c8ce451 100644 --- a/src/frontends/qt4/GuiCompleter.cpp +++ b/src/frontends/qt4/GuiCompleter.cpp @@ -364,7 +364,9 @@ void GuiCompleter::updateModel(Cursor & cur, bool popupUpdate, bool inlineUpdate old = last_selection_; // set new model - setModel(new GuiCompletionModel(this, cur.inset().completionList(cur))); + Inset::CompletionList const * list + = cur.inset().createCompletionList(cur); + setModel(new GuiCompletionModel(this, list)); // show popup if (popupUpdate) diff --git a/src/insets/Inset.h b/src/insets/Inset.h index 17ed08beaa..e9c6b3e9e4 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -317,7 +317,7 @@ public: /// Returns completion suggestions at cursor position. Return an /// null pointer if no completion is a available or possible. /// The caller is responsible to free the returned object! - virtual CompletionList const * completionList(Cursor const &) const + virtual CompletionList const * createCompletionList(Cursor const &) const { return 0; } /// Returns the completion prefix to filter the suggestions for completion. /// This is only called if completionList returned a non-null list. diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 0e8f3ad571..5226edb6ae 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -504,7 +504,8 @@ bool InsetText::automaticPopupCompletion() const } -Inset::CompletionList const * InsetText::completionList(Cursor const & cur) const +Inset::CompletionList const +* InsetText::createCompletionList(Cursor const & cur) const { if (!completionSupported(cur)) return 0; diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h index ccb7301474..ed748c7680 100644 --- a/src/insets/InsetText.h +++ b/src/insets/InsetText.h @@ -150,7 +150,7 @@ public: /// bool automaticPopupCompletion() const; /// - CompletionList const * completionList(Cursor const & cur) const; + CompletionList const * createCompletionList(Cursor const & cur) const; /// docstring completionPrefix(Cursor const & cur) const; /// diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index f1ab2cdc82..e0cf27a5fb 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -1607,7 +1607,8 @@ bool InsetMathNest::automaticPopupCompletion() const } -Inset::CompletionList const * InsetMathNest::completionList(Cursor const & cur) const +Inset::CompletionList const * +InsetMathNest::createCompletionList(Cursor const & cur) const { if (!cur.inMacroMode()) return 0; diff --git a/src/mathed/InsetMathNest.h b/src/mathed/InsetMathNest.h index d3fc72cc8b..bcdc13afad 100644 --- a/src/mathed/InsetMathNest.h +++ b/src/mathed/InsetMathNest.h @@ -142,7 +142,7 @@ public: /// bool automaticPopupCompletion() const; /// - CompletionList const * completionList(Cursor const & cur) const; + CompletionList const * createCompletionList(Cursor const & cur) const; /// docstring completionPrefix(Cursor const & cur) const; /// diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index bdcc025128..b86d36ca6b 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -763,10 +763,11 @@ bool MathMacro::automaticPopupCompletion() const } -Inset::CompletionList const * MathMacro::completionList(Cursor const & cur) const +Inset::CompletionList const * +MathMacro::createCompletionList(Cursor const & cur) const { if (displayMode() != DISPLAY_UNFOLDED) - return InsetMathNest::completionList(cur); + return InsetMathNest::createCompletionList(cur); return new MathCompletionList(cur.bv().cursor()); } diff --git a/src/mathed/MathMacro.h b/src/mathed/MathMacro.h index 8a10a45300..dae4d8099c 100644 --- a/src/mathed/MathMacro.h +++ b/src/mathed/MathMacro.h @@ -186,7 +186,7 @@ public: /// bool automaticPopupCompletion() const; /// - CompletionList const * completionList(Cursor const & cur) const; + CompletionList const * createCompletionList(Cursor const & cur) const; /// docstring completionPrefix(Cursor const & cur) const; ///