]> git.lyx.org Git - features.git/commitdiff
some cleanups to the phantom inset. Undo still broken for unknown reasons
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 4 Feb 2009 16:18:43 +0000 (16:18 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 4 Feb 2009 16:18:43 +0000 (16:18 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28350 a592a061-630c-0410-9148-cb99ea01b6c8

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

index 9790e82e1d9c4d1e87f8487aa6a6f6e0b5ae91e5..3a2003788771ba7318a8f6465f769ff081100e17 100644 (file)
@@ -137,15 +137,9 @@ docstring InsetPhantom::name() const
 }
 
 
-Inset::DisplayType InsetPhantom::display() const
-{
-       return Inline;
-}
-
-
 void InsetPhantom::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       InsetText::metrics(mi, dim);
+       InsetCollapsable::metrics(mi, dim);
 
        // cache the inset dimension
        setDimCache(mi, dim);
@@ -155,7 +149,7 @@ void InsetPhantom::metrics(MetricsInfo & mi, Dimension & dim) const
 void InsetPhantom::draw(PainterInfo & pi, int x, int y) const
 {
        // draw the text
-       InsetText::draw(pi, x, y);
+       InsetCollapsable::draw(pi, x, y);
 
        // draw the inset marker
        drawMarkers(pi, x, y);
@@ -308,7 +302,7 @@ docstring InsetPhantom::toolTip(BufferView const &, int, int) const
 {
        OutputParams rp(&buffer().params().encoding());
        odocstringstream ods;
-       InsetText::plaintext(ods, rp);
+       InsetCollapsable::plaintext(ods, rp);
        docstring content_tip = ods.str();
        // shorten it if necessary
        if (content_tip.size() > 200)
@@ -320,43 +314,39 @@ docstring InsetPhantom::toolTip(BufferView const &, int, int) const
 }
 
 
-int InsetPhantom::latex(odocstream & os, OutputParams const & runparams_in) const
+int InsetPhantom::latex(odocstream & os, OutputParams const & runparams) const
 {
-       OutputParams runparams(runparams_in);
        if (params_.type == InsetPhantomParams::Phantom)
                os << "\\phantom{";
        else if (params_.type == InsetPhantomParams::HPhantom)
                os << "\\hphantom{";
        else if (params_.type == InsetPhantomParams::VPhantom)
                os << "\\vphantom{";
-       int const i = InsetText::latex(os, runparams);
+       int const i = InsetCollapsable::latex(os, runparams);
        os << "}";
-       runparams_in.encoding = runparams.encoding;
 
-       return i + 2;
+       return i;
 }
 
 
 int InsetPhantom::plaintext(odocstream & os,
-                        OutputParams const & runparams_in) const
+                           OutputParams const & runparams) const
 {
-       OutputParams runparams(runparams_in);
        if (params_.type == InsetPhantomParams::Phantom)
                os << '[' << buffer().B_("phantom") << ":";
        else if (params_.type == InsetPhantomParams::HPhantom)
                os << '[' << buffer().B_("hphantom") << ":";
        else if (params_.type == InsetPhantomParams::VPhantom)
                os << '[' << buffer().B_("vphantom") << ":";
-       InsetText::plaintext(os, runparams);
+       InsetCollapsable::plaintext(os, runparams);
        os << "]";
 
        return PLAINTEXT_NEWLINE;
 }
 
 
-int InsetPhantom::docbook(odocstream & os, OutputParams const & runparams_in) const
+int InsetPhantom::docbook(odocstream & os, OutputParams const & runparams) const
 {
-       OutputParams runparams(runparams_in);
        string cmdname;
        if (params_.type == InsetPhantomParams::Phantom)
                cmdname = "phantom";
@@ -365,7 +355,7 @@ int InsetPhantom::docbook(odocstream & os, OutputParams const & runparams_in) co
        else if (params_.type == InsetPhantomParams::VPhantom)
                cmdname = "phantom";
        os << "<" + cmdname + ">";
-       int const i = InsetText::docbook(os, runparams);
+       int const i = InsetCollapsable::docbook(os, runparams);
        os << "</" + cmdname + ">";
 
        return i;
index 4e3c663f17f34000ebfbf4009d126d86cd087f97..0f3ceaa9077f4f6f7201892d2c2c1ed27fc07803 100644 (file)
@@ -60,9 +60,9 @@ private:
        ///
        docstring editMessage() const;
        ///
-       docstring name() const;
+       InsetCode lyxCode() const { return PHANTOM_CODE; }
        ///
-       DisplayType display() const;
+       docstring name() const;
        ///
        void metrics(MetricsInfo &, Dimension &) const;
        ///