]> git.lyx.org Git - features.git/commitdiff
clean up
authorAndré Pönitz <poenitz@gmx.net>
Sun, 17 Jul 2005 01:13:36 +0000 (01:13 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sun, 17 Jul 2005 01:13:36 +0000 (01:13 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10265 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/insetbase.C
src/insets/insetbase.h
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/mathed/ref_inset.C
src/mathed/ref_inset.h

index d775917a5e82959c534b402581cd9ca157def805..580739f316b86ce12e51def56cc256a967c669b9 100644 (file)
@@ -29,6 +29,7 @@
 #include "frontends/Painter.h"
 
 #include <map>
+#include <typeinfo>
 
 
 namespace {
@@ -114,6 +115,14 @@ InsetBase::InsetBase(InsetBase const &)
 {}
 
 
+std::auto_ptr<InsetBase> InsetBase::clone() const
+{
+       std::auto_ptr<InsetBase> b = doClone();
+       BOOST_ASSERT(typeid(*b) == typeid(*this));
+       return b;
+}
+
+
 InsetBase::Code InsetBase::translate(std::string const & name)
 {
        static TranslatorMap const translator = build_translator();
index d405bfc9ca5609ec7a48eb91b448d4d03e4fce8a..7c496f256b5103b7338e22f5253d110507e796a7 100644 (file)
 #ifndef INSETBASE_H
 #define INSETBASE_H
 
-#include <boost/assert.hpp>
-
+#include <memory>
 #include <string>
-#include <typeinfo>
 #include <vector>
-#include <memory>
 
 class Buffer;
 class BufferView;
 class CursorSlice;
-class DispatchResult;
 class FuncRequest;
 class FuncStatus;
 class LaTeXFeatures;
@@ -34,7 +30,6 @@ class MetricsInfo;
 class Dimension;
 class PainterInfo;
 class OutputParams;
-class UpdatableInset;
 
 namespace lyx { namespace graphics { class PreviewLoader; } }
 
@@ -64,13 +59,7 @@ public:
        /// virtual base class destructor
        virtual ~InsetBase() {}
        /// replicate ourselves
-       std::auto_ptr<InsetBase> clone() const
-       {
-               std::auto_ptr<InsetBase> b = doClone();
-               BOOST_ASSERT(typeid(*b) == typeid(*this));
-               return b;
-       }
-
+       std::auto_ptr<InsetBase> clone() const;
 
        /// identification as math inset
        virtual MathInset * asMathInset() { return 0; }
@@ -338,7 +327,6 @@ public:
        virtual std::string const & getInsetName() const;
        /// used to toggle insets
        /// is the inset open?
-       virtual bool isOpen() const { return false; }
        /// should this inset be handled like a normal charater
        virtual bool isChar() const { return false; }
        /// is this equivalent to a letter?
@@ -397,6 +385,8 @@ public:
        /// pretty arbitrary
        virtual int descent() const { return 10; }
        ///
+       int scroll() const { return 0; }
+       ///
        enum CollapseStatus {
                Collapsed,
                Inlined,
index 5bb7dbed46a9e849aff8cf64eab8a5dde03ef7da..7b8830a47de924b7b90e393bd07feff0a49b5e07 100644 (file)
@@ -148,6 +148,9 @@ protected:
        virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
        ///
        bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
+       ///
+       int scroll() const { return scx_; }
+
 private:
        virtual std::auto_ptr<InsetBase> doClone() const;
 
index 89b01b12d5572a522e43d772187d93b89087517e..97cb7096990a41370732c32c09d853d21a2f7c8d 100644 (file)
@@ -190,43 +190,33 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
        // update our idea of where we are
        setPosCache(pi, x, y);
 
-       BufferView * bv = pi.base.bv;
-       bv->hideCursor();
+       //BufferView * bv = pi.base.bv;
+       ////bv->hideCursor();
 
        text_.draw(pi, x + border_, y);
 
-       if (drawFrame_)
-               drawFrame(pi.pain, x, y);
+       if (drawFrame_) {
+               int const w = text_.width() + 2 * border_;
+               int const a = text_.ascent() + border_;
+               int const h = a + text_.descent() + border_;
+               pi.pain.rectangle(x, y - a, w, h, frameColor());
+       }
 }
 
 
 void InsetText::drawSelection(PainterInfo & pi, int x, int y) const
 {
-       // repaint the background if needed
-       if (backgroundColor() != LColor::background)
-               clearInset(pi.pain, x, y);
+       if (backgroundColor() != LColor::background) {
+               // repaint the background if needed
+               int const w = text_.width() + 2 * border_;
+               int const a = text_.ascent() + border_;
+               int const h = a + text_.descent() + border_;
+               pi.pain.fillRectangle(x, y - a, w, h, backgroundColor());
+       }
        text_.drawSelection(pi, x, y);
 }
 
 
-void InsetText::drawFrame(Painter & pain, int x, int y) const
-{
-       int const w = text_.width() + 2 * border_;
-       int const a = text_.ascent() + border_;
-       int const h = a + text_.descent() + border_;
-       pain.rectangle(x, y - a, w, h, frameColor());
-}
-
-
-void InsetText::clearInset(Painter & pain, int x, int y) const
-{
-       int const w = text_.width() + 2 * border_;
-       int const a = text_.ascent() + border_;
-       int const h = a + text_.descent() + border_;
-       pain.fillRectangle(x, y - a, w, h, backgroundColor());
-}
-
-
 string const InsetText::editMessage() const
 {
        return _("Opened Text Inset");
@@ -289,7 +279,7 @@ int InsetText::plaintext(Buffer const & buf, ostream & os,
                asciiParagraph(buf, *it, os, runparams, ref_printed);
 
        // FIXME: Give the total numbers of lines
-       return 0;
+       return 1;
 }
 
 
@@ -368,11 +358,20 @@ void InsetText::setText(string const & data, LyXFont const & font)
 
 void InsetText::setAutoBreakRows(bool flag)
 {
-       if (flag != text_.autoBreakRows_) {
-               text_.autoBreakRows_ = flag;
-               if (!flag)
-                       removeNewlines();
-       }
+       if (flag == text_.autoBreakRows_)
+               return;
+
+       text_.autoBreakRows_ = flag;
+       if (flag)
+               return;
+
+       // remove previously existing newlines
+       ParagraphList::iterator it = paragraphs().begin();
+       ParagraphList::iterator end = paragraphs().end();
+       for (; it != end; ++it)
+               for (int i = 0; i < it->size(); ++i)
+                       if (it->isNewline(i))
+                               it->erase(i);
 }
 
 
@@ -404,17 +403,6 @@ void InsetText::setViewCache(BufferView const * bv) const
 }
 
 
-void InsetText::removeNewlines()
-{
-       ParagraphList::iterator it = paragraphs().begin();
-       ParagraphList::iterator end = paragraphs().end();
-       for (; it != end; ++it)
-               for (int i = 0; i < it->size(); ++i)
-                       if (it->isNewline(i))
-                               it->erase(i);
-}
-
-
 LyXText * InsetText::getText(int i) const
 {
        return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
index 0d2f18a986dddd7f68ed9da8c70c806a8668e9cf..639591c1fd333d15df650001284b72a0262c7ff8 100644 (file)
@@ -27,9 +27,7 @@ class BufferView;
 class CursorSlice;
 class Dimension;
 class LColor_color;
-class Painter;
 class ParagraphList;
-class Row;
 
 
 /**
@@ -150,14 +148,6 @@ private:
        virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        void init();
-       ///
-       void setCharFont(Buffer const &, int pos, LyXFont const & font);
-       ///
-       void removeNewlines();
-       ///
-       void drawFrame(Painter &, int x, int y) const;
-       ///
-       void clearInset(Painter &, int x, int y) const;
 
        ///
        bool drawFrame_;
index 775ba5d9ac1461a77c0c2bf5cf98d8888f71cf18..47734214dafbf1e52238f8544d7aee0fe763d571 100644 (file)
@@ -156,8 +156,6 @@ int RefInset::docbook(Buffer const & buf, std::ostream & os, OutputParams const
 }
 
 
-
-
 RefInset::ref_type_info RefInset::types[] = {
        { "ref",       N_("Standard"),              N_("Ref: ")},
        { "eqref",     N_("Equation"),              N_("EqRef: ")},
@@ -167,3 +165,4 @@ RefInset::ref_type_info RefInset::types[] = {
        { "prettyref", N_("PrettyRef"),             N_("PrettyRef: ")},
        { "", "", "" }
 };
+
index 5e30a3dfaa0fab0755d4e49e6a08653722b6aea2..7e3c58ce2d006fd8dbde820bd64c3821eec140e5 100644 (file)
@@ -41,9 +41,6 @@ public:
        /// docbook output
        int docbook(Buffer const & buf, std::ostream & os, OutputParams const &) const;
 
-       /// small wrapper for the time being
-       DispatchResult localDispatch(FuncRequest & cmd);
-
        struct ref_type_info {
                ///
                std::string latex_name;