]> git.lyx.org Git - lyx.git/commitdiff
Simplify some of the tooltip stuff now.
authorRichard Heck <rgheck@comcast.net>
Wed, 17 Nov 2010 16:55:58 +0000 (16:55 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 17 Nov 2010 16:55:58 +0000 (16:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36346 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetIndex.cpp
src/insets/InsetPhantom.cpp
src/insets/InsetText.cpp
src/insets/InsetText.h

index 28f0eafe7bbc4ec77c52c5617be8934dde8ff478..194ccb8eca0ed05c21aadc8bcc6ae7a74c85c161 100644 (file)
@@ -288,11 +288,7 @@ docstring InsetIndex::toolTip(BufferView const &, int, int) const
                tip += ")";
        }
        tip += ": ";
-       OutputParams rp(&buffer().params().encoding());
-       odocstringstream ods;
-       InsetText::plaintext(ods, rp);
-       tip += ods.str();
-       return wrapParas(tip);
+       return InsetText::toolTipText(tip);
 }
 
 
index 8a6d2e68dbe59cb426499ea75384801dfb949906..a3c57359985e5fa8d8404ff995097a3ff2246edc 100644 (file)
@@ -299,13 +299,10 @@ bool InsetPhantom::getStatus(Cursor & cur, FuncRequest const & cmd,
 
 docstring InsetPhantom::toolTip(BufferView const &, int, int) const
 {
-       OutputParams rp(&buffer().params().encoding());
-       odocstringstream ods;
-       InsetCollapsable::plaintext(ods, rp);
-       docstring content_tip = support::wrapParas(ods.str());
+       docstring const tip = InsetText::toolTipText();
        docstring res = phantomtranslator_loc().find(params_.type);
-       if (!content_tip.empty())
-               res += from_ascii(": ") + "\n" + content_tip;
+       if (!tip.empty())
+               res += from_ascii(": ") + "\n" + tip;
        return res;
 }
 
index 0a53c7bd06b456988a900278bfe23b43cc3b3c85..a80c96eeccff2e517edce4242b4b47b472ca70fd 100644 (file)
@@ -820,11 +820,12 @@ docstring InsetText::contextMenu(BufferView const &, int, int) const
 }
 
 
-docstring InsetText::toolTipText() const
+docstring InsetText::toolTipText(docstring prefix) const
 {
        static unsigned int max_length = 400; // five 80 column lines
        OutputParams rp(&buffer().params().encoding());
        odocstringstream oss;
+       oss << prefix;
 
        ParagraphList::const_iterator beg = paragraphs().begin();
        ParagraphList::const_iterator end = paragraphs().end();
index 5743be2f518a6bb04f82b8e7ff5ce4ca6f4e31ac..35904398a89960510e4e358f3de65da092351eec 100644 (file)
@@ -191,7 +191,9 @@ public:
        ///
        void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const;
        /// returns the text to be used as tooltip
-       docstring toolTipText() const;
+       /// \param prefix: a string that will preced the tooltip,
+       /// e.g., "Index: ".
+       docstring toolTipText(docstring prefix = from_ascii("")) const;
 
        ///
        virtual docstring contextMenu(BufferView const & bv, int x, int y) const;