]> git.lyx.org Git - lyx.git/commitdiff
remove unneeded Inset::getMaxWidth(
authorAndré Pönitz <poenitz@gmx.net>
Fri, 18 Jul 2003 15:30:20 +0000 (15:30 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 18 Jul 2003 15:30:20 +0000 (15:30 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7319 a592a061-630c-0410-9148-cb99ea01b6c8

13 files changed:
src/insets/ChangeLog
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetminipage.C
src/insets/insetminipage.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/insets/insetwrap.C
src/insets/insetwrap.h
src/insets/updatableinset.C
src/insets/updatableinset.h

index b1f6fce049b9103799df939828c6efb24acef157..444c1140dc8a65fc0c87969059fe5c3c52e49e09 100644 (file)
@@ -1,4 +1,13 @@
 
+2003-07-18  André Pönitz  <poenitz@gmx.net>
+
+       * insetert.[Ch]:
+       * insetminipage.[Ch]:
+       * insettabular.[Ch]:
+       * insettext.[Ch]:
+       * insetwrap.[Ch]:
+       * updatableinset.[Ch]: remove unneeded Inset::getMaxWidth()
+
 2003-07-18  André Pönitz  <poenitz@gmx.net>
 
        * inset.[Ch]:
index 0a635c911dbd32905bff99abf6ebcda482751f7f..e24c5c2a71fccb18ab9deb67951049cc7932572b 100644 (file)
@@ -647,22 +647,6 @@ void InsetERT::getDrawFont(LyXFont & font) const
 }
 
 
-int InsetERT::getMaxWidth(BufferView * bv, UpdatableInset const * in) const
-{
-       int w = InsetCollapsable::getMaxWidth(bv, in);
-       if (status_ != Inlined || w < 0)
-               return w;
-       LyXText * text = inset.getLyXText(bv);
-       int rw = text->rows().begin()->width();
-       if (!rw)
-               rw = w;
-       rw += 40;
-       if (text->rows().size() == 1 && rw < w)
-               return -1;
-       return w;
-}
-
-
 string const InsetERTMailer::name_("ert");
 
 InsetERTMailer::InsetERTMailer(InsetERT & inset)
index a6ed08548bc0af8387937bc0d59e95ac9311ed74..b883a1eb3658397e66773bb1ff8e477d3a1b49a5 100644 (file)
@@ -112,8 +112,6 @@ public:
        bool forceDefaultParagraphs(Inset const *) const {
                return true;
        }
-       ///
-       int getMaxWidth(BufferView *, UpdatableInset const *) const;
 
 private:
        ///
index cc8a22cce4691c3cf4b1035dca6e094ad17a3b24..f0d38863ff5369850e431e48f190b56216de8a7a 100644 (file)
@@ -296,26 +296,6 @@ bool InsetMinipage::showInsetDialog(BufferView * bv) const
 }
 
 
-int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
-       const
-{
-       if (owner() &&
-           static_cast<UpdatableInset*>(owner())->getMaxWidth(bv, inset) < 0) {
-               return -1;
-       }
-       if (!params_.width.zero()) {
-               int ww1 = latexTextWidth(bv);
-               int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
-               if (ww2 > 0 && ww2 < ww1) {
-                       return ww2;
-               }
-               return ww1;
-       }
-       // this should not happen!
-       return InsetCollapsable::getMaxWidth(bv, inset);
-}
-
-
 int InsetMinipage::latexTextWidth(BufferView * bv) const
 {
        return params_.width.inPixels(InsetCollapsable::latexTextWidth(bv));
index b4665cc3dc3835e2bed1fe0a6a052c59fc52f1ae..dafcc0b1a677423afce2e8700994c52fc52b51f6 100644 (file)
@@ -79,8 +79,6 @@ public:
        ///
        bool insetAllowed(Inset::Code) const;
        ///
-       int getMaxWidth(BufferView *, UpdatableInset const *) const;
-       ///
        bool needFullRow() const { return false; }
        /** returns true if, when outputing LaTeX, font changes should
            be closed before generating this inset. This is needed for
index 25bd89c1f80b47c26b847e8311c2277ec2f86ba6..a8104e8f859b70108e98608f9dbad271d62b00cc 100644 (file)
@@ -2073,39 +2073,6 @@ bool InsetTabular::insetHit(BufferView *, int x, int) const
 }
 
 
-// This returns paperWidth() if the cell-width is unlimited or the width
-// in pixels if we have a pwidth for this cell.
-int InsetTabular::getMaxWidthOfCell(BufferView * bv, int cell) const
-{
-       LyXLength const len = tabular.getPWidth(cell);
-
-       if (len.zero())
-               return -1;
-       return len.inPixels(latexTextWidth(bv));
-}
-
-
-int InsetTabular::getMaxWidth(BufferView * bv,
-                             UpdatableInset const * inset) const
-{
-       int cell = tabular.getCellFromInset(inset, actcell);
-
-       if (cell == -1) {
-               lyxerr << "Own inset not found, shouldn't really happen!"
-                      << endl;
-               return -1;
-       }
-
-       int w = getMaxWidthOfCell(bv, cell);
-       if (w > 0) {
-               // because the inset then subtracts it's top_x and owner->x()
-               w += (inset->x() - top_x);
-       }
-
-       return w;
-}
-
-
 void InsetTabular::deleteLyXText(BufferView * bv, bool recursive) const
 {
        resizeLyXText(bv, recursive);
index 6b4e735aef68b3adb2e2a3f38e8bfced5db0cfd2..ba279a30b29a09975b21c85b1e593bf12bcb93b8 100644 (file)
@@ -146,8 +146,6 @@ public:
        void setFont(BufferView *, LyXFont const &, bool toggleall = false,
                     bool selectall = false);
        ///
-       int getMaxWidth(BufferView *, UpdatableInset const *) const;
-       ///
        LyXText * getLyXText(BufferView const *,
                             bool const recursive = false) const;
        ///
@@ -289,8 +287,6 @@ private:
        ///
        bool insetHit(BufferView * bv, int x, int y) const;
        ///
-       int getMaxWidthOfCell(BufferView * bv, int cell) const;
-       ///
        bool hasPasteBuffer() const;
        ///
        bool copySelection(BufferView *);
index e8303eadefe8d9375fbe6e7e1eae85f6751ad0b5..c43efa70a5b08c27144442ccc400c09de8eb8076 100644 (file)
@@ -1758,25 +1758,6 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
 }
 
 
-int InsetText::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const
-{
-#if 0
-       int w = UpdatableInset::getMaxWidth(bv, inset);
-       if (w < 0) {
-               return -1;
-       }
-       if (owner()) {
-               w = w - top_x + owner()->x();
-               return w;
-       }
-       w -= (2 * TEXT_TO_INSET_OFFSET);
-       return w - top_x;
-#else
-       return UpdatableInset::getMaxWidth(bv, inset);
-#endif
-}
-
-
 void InsetText::setParagraphData(ParagraphList const & plist)
 {
        // we have to unlock any locked inset otherwise we're in troubles
@@ -1962,10 +1943,6 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
        Assert(bv);
        setViewCache(bv);
 
-       // one endless line, resize normally not necessary
-       if (!force && getMaxWidth(bv, this) < 0)
-               return;
-
        saveLyXTextState();
 
        for_each(const_cast<ParagraphList&>(paragraphs).begin(),
index 70325f65309be633a927fa705d4c337ed7633fdf..987856b5b76242912ceb7e3aaa670ac1cf5818bd 100644 (file)
@@ -142,8 +142,6 @@ public:
                     bool toggleall = false,
                     bool selectall = false);
        ///
-       int getMaxWidth(BufferView *, UpdatableInset const *) const;
-       ///
        void init(InsetText const * ins);
        ///
        void writeParagraphData(Buffer const *, std::ostream &) const;
index 2e0140ba28722900a811bc05162d25a1a42b238c..26d532c9313b0ed7504473ca11091ec904ffc8bc 100644 (file)
@@ -218,26 +218,6 @@ bool InsetWrap::insetAllowed(Inset::Code code) const
 }
 
 
-int InsetWrap::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
-       const
-{
-       if (owner() &&
-           static_cast<UpdatableInset*>(owner())->getMaxWidth(bv, inset) < 0) {
-               return -1;
-       }
-       if (!params_.width.zero()) {
-               int const ww1 = latexTextWidth(bv);
-               int const ww2 = InsetCollapsable::getMaxWidth(bv, inset);
-               if (ww2 > 0 && ww2 < ww1) {
-                       return ww2;
-               }
-               return ww1;
-       }
-       // this should not happen!
-       return InsetCollapsable::getMaxWidth(bv, inset);
-}
-
-
 int InsetWrap::latexTextWidth(BufferView * bv) const
 {
        return params_.width.inPixels(InsetCollapsable::latexTextWidth(bv));
index ab6721bde397f678c934ea25a53a0a281a935790..a49aa849307b7ddd40f9e9de1f988ea70c3d4c01 100644 (file)
@@ -62,8 +62,6 @@ public:
        ///
        bool insetAllowed(Inset::Code) const;
        ///
-       int getMaxWidth(BufferView *, UpdatableInset const *) const;
-       ///
        void addToToc(toc::TocList &, Buffer const *) const;
        ///
        bool  showInsetDialog(BufferView *) const;
index d9ad5d2d105d89a14b437a83e98442ee739c035f..c7c5a60a844b05cf3a9ed09c2edd662d49f80fca 100644 (file)
@@ -133,36 +133,6 @@ Inset::RESULT UpdatableInset::localDispatch(FuncRequest const & ev)
 }
 
 
-int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
-{
-       int w;
-
-       if (owner()) {
-               w = owner()->getMaxWidth(bv, this);
-       } else {
-               w = bv->text->workWidth(this);
-       }
-       if (w < 0) {
-               return -1;
-       }
-       // check for margins left/right and extra right margin "const 5"
-       if ((w - (2 * TEXT_TO_INSET_OFFSET + 5)) >= 0)
-               w -= 2 * TEXT_TO_INSET_OFFSET + 5;
-
-       // Deep magic. I don't understand this either.
-       if (owner() && owner()->owner()) {
-               // add the right paper margin
-               w -= 20;
-       }
-
-       // FIXME: why ?
-       if (w < 10) {
-               w = 10;
-       }
-       return w;
-}
-
-
 LyXCursor const & Inset::cursor(BufferView * bv) const
 {
        if (owner())
index 77046dc1df0568f1a5024c7296555d6f5441de31..5209585afefde130e3cbfde246e95b8330009f6a 100644 (file)
@@ -91,8 +91,6 @@ public:
        ///  An updatable inset could handle lyx editing commands
        virtual RESULT localDispatch(FuncRequest const & cmd);
        ///
-       virtual int getMaxWidth(BufferView * bv, UpdatableInset const *) const;
-       ///
        int scroll(bool recursive = true) const {
                // We need this method to not clobber the real method in Inset
                return Inset::scroll(recursive);