]> git.lyx.org Git - features.git/commitdiff
- InsetPhantom.h: remove unneeded declarations
authorUwe Stöhr <uwestoehr@web.de>
Sun, 1 Feb 2009 20:18:52 +0000 (20:18 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Sun, 1 Feb 2009 20:18:52 +0000 (20:18 +0000)
- InsetPhantom.cpp: add tooltips

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28311 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetPhantom.cpp
src/insets/InsetPhantom.h

index 65634ef455ec9438975f034f9962a78790178468..07728ea3d37223db393b3a0dc0a4f4146b5cdbb9 100644 (file)
@@ -303,6 +303,24 @@ bool InsetPhantom::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
+docstring InsetPhantom::toolTip(BufferView const & bv, int x, int y) const
+{
+       OutputParams rp(&buffer().params().encoding());
+       odocstringstream ods;
+       InsetText::plaintext(ods, rp);
+       docstring content_tip = ods.str();
+       // shorten it if necessary
+       if (content_tip.size() > 200)
+               content_tip = content_tip.substr(0, 200) + "...";
+       if (params_.type == InsetPhantomParams::Phantom)
+               return from_ascii("Phantom: ") + content_tip;
+       if (params_.type == InsetPhantomParams::HPhantom)
+               return from_ascii("HPhantom: ") + content_tip;
+       if (params_.type == InsetPhantomParams::VPhantom)
+               return from_ascii("VPhantom: ") + content_tip;
+}
+
+
 int InsetPhantom::latex(odocstream & os, OutputParams const & runparams_in) const
 {
        OutputParams runparams(runparams_in);
index 0b69bc879bf3c7eb1dede04dd707cba76dbf9489..e1e976b8232aadbed559e20ede4f979849ee3a47 100644 (file)
@@ -60,14 +60,10 @@ private:
        ///
        docstring editMessage() const;
        ///
-       InsetCode lyxCode() const { return PHANTOM_CODE; }
-       ///
        docstring name() const;
        ///
        DisplayType display() const;
        ///
-       bool noFontChange() const { return params_.type != InsetPhantomParams::Phantom; }
-       ///
        void metrics(MetricsInfo &, Dimension &) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
@@ -90,7 +86,7 @@ private:
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
        ///
-       Inset * clone() const { return new InsetPhantom(*this); }
+       docstring toolTip(BufferView const & bv, int x, int y) const;
        /// used by the constructors
        void init();
        ///