Anybody ever understood this? Don't worry...
Index: insetert.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v retrieving revision 1.138 diff -u -p -r1.138 insetert.C --- insetert.C 18 Jul 2003 07:47:05 -0000 1.138 +++ insetert.C 18 Jul 2003 15:27:30 -0000 @@ -647,22 +647,6 @@ void InsetERT::getDrawFont(LyXFont & fon } -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: insetert.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.h,v retrieving revision 1.77 diff -u -p -r1.77 insetert.h --- insetert.h 17 Jul 2003 07:32:00 -0000 1.77 +++ insetert.h 18 Jul 2003 15:27:30 -0000 @@ -112,8 +112,6 @@ public: bool forceDefaultParagraphs(Inset const *) const { return true; } - /// - int getMaxWidth(BufferView *, UpdatableInset const *) const; private: /// Index: insetminipage.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetminipage.C,v retrieving revision 1.81 diff -u -p -r1.81 insetminipage.C --- insetminipage.C 18 Jul 2003 07:47:05 -0000 1.81 +++ insetminipage.C 18 Jul 2003 15:27:30 -0000 @@ -296,26 +296,6 @@ bool InsetMinipage::showInsetDialog(Buff } -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: insetminipage.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetminipage.h,v retrieving revision 1.46 diff -u -p -r1.46 insetminipage.h --- insetminipage.h 16 Jun 2003 11:49:32 -0000 1.46 +++ insetminipage.h 18 Jul 2003 15:27:30 -0000 @@ -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: insettabular.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v retrieving revision 1.305 diff -u -p -r1.305 insettabular.C --- insettabular.C 18 Jul 2003 07:47:05 -0000 1.305 +++ insettabular.C 18 Jul 2003 15:27:30 -0000 @@ -2073,39 +2073,6 @@ bool InsetTabular::insetHit(BufferView * } -// 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: insettabular.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.h,v retrieving revision 1.133 diff -u -p -r1.133 insettabular.h --- insettabular.h 18 Jul 2003 07:47:07 -0000 1.133 +++ insettabular.h 18 Jul 2003 15:27:30 -0000 @@ -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; /// @@ -288,8 +286,6 @@ private: mouse_button::state button = mouse_button::none); /// bool insetHit(BufferView * bv, int x, int y) const; - /// - int getMaxWidthOfCell(BufferView * bv, int cell) const; /// bool hasPasteBuffer() const; /// Index: insettext.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v retrieving revision 1.438 diff -u -p -r1.438 insettext.C --- insettext.C 18 Jul 2003 12:05:50 -0000 1.438 +++ insettext.C 18 Jul 2003 15:27:30 -0000 @@ -1758,25 +1758,6 @@ bool InsetText::checkAndActivateInset(Bu } -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 @@ -1961,10 +1942,6 @@ void InsetText::resizeLyXText(BufferView Assert(bv); setViewCache(bv); - - // one endless line, resize normally not necessary - if (!force && getMaxWidth(bv, this) < 0) - return; saveLyXTextState(); Index: insettext.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.h,v retrieving revision 1.181 diff -u -p -r1.181 insettext.h --- insettext.h 18 Jul 2003 12:05:50 -0000 1.181 +++ insettext.h 18 Jul 2003 15:27:30 -0000 @@ -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: insetwrap.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetwrap.C,v retrieving revision 1.28 diff -u -p -r1.28 insetwrap.C --- insetwrap.C 16 Jun 2003 11:49:34 -0000 1.28 +++ insetwrap.C 18 Jul 2003 15:27:30 -0000 @@ -218,26 +218,6 @@ bool InsetWrap::insetAllowed(Inset::Code } -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: insetwrap.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetwrap.h,v retrieving revision 1.16 diff -u -p -r1.16 insetwrap.h --- insetwrap.h 16 Jun 2003 11:49:34 -0000 1.16 +++ insetwrap.h 18 Jul 2003 15:27:30 -0000 @@ -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: updatableinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/updatableinset.C,v retrieving revision 1.15 diff -u -p -r1.15 updatableinset.C --- updatableinset.C 18 Jul 2003 07:47:07 -0000 1.15 +++ updatableinset.C 18 Jul 2003 15:27:30 -0000 @@ -133,36 +133,6 @@ Inset::RESULT UpdatableInset::localDispa } -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: updatableinset.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/updatableinset.h,v retrieving revision 1.9 diff -u -p -r1.9 updatableinset.h --- updatableinset.h 30 May 2003 06:48:23 -0000 1.9 +++ updatableinset.h 18 Jul 2003 15:27:30 -0000 @@ -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);