]> git.lyx.org Git - features.git/commitdiff
outerPar
authorAndré Pönitz <poenitz@gmx.net>
Tue, 26 Aug 2003 14:50:16 +0000 (14:50 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 26 Aug 2003 14:50:16 +0000 (14:50 +0000)
"fix" loading problem

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

src/BufferView_pimpl.C
src/ChangeLog
src/buffer.C
src/insets/insetgraphics.C
src/insets/insettext.C
src/lyxrow.C
src/lyxrow.h
src/paragraph.C
src/paragraph.h
src/paragraph_funcs.C
src/paragraph_funcs.h

index 20645f567edac490eca907291642fff0df862e3b..723cbad73c9f41915d70bdbd9f913562ec51142b 100644 (file)
@@ -1377,7 +1377,8 @@ void BufferView::Pimpl::updateInset()
                return;
 
        // this should not be needed, but it is...
-       bv_->text->redoParagraph(bv_->text->cursor.par());
+       //bv_->text->redoParagraph(bv_->text->cursor.par());
+       //bv_->text->fullRebreak();
 
        update();
        updateScrollbar();
index ac3cd42758776382415fdf4ed682e9b0924df9bb..7d40d30ec9a2ed3e69cfa4c25d2126ea67276f91 100644 (file)
@@ -1,4 +1,8 @@
 
+2003-08-26  André Pönitz  <poenitz@gmx.net>
+
+       * paragraph_func.[Ch] (outerPar): new function
+
 2003-08-25  Martin Vermeer  <martin.vermeer@hut.fi>
  
        * lyxrow_funcs.C:
index 59b6562b9cb9d326c41440f470482fbdbd5e3310..60ec4d88c65e8cf6af02d2119658c77807d9038b 100644 (file)
@@ -2190,6 +2190,7 @@ ParIterator Buffer::par_iterator_end()
        return ParIterator(paragraphs.end(), paragraphs);
 }
 
+
 ParConstIterator Buffer::par_iterator_begin() const
 {
        return ParConstIterator(const_cast<ParagraphList&>(paragraphs).begin(), paragraphs);
index 23593f85d70ddfe4775769083ba3eb307c1ef745..21162b67bd032135d4fcf36db2a9052fac726bcb 100644 (file)
@@ -68,6 +68,8 @@ TODO
 #include "Lsstream.h"
 #include "lyxlex.h"
 #include "lyxrc.h"
+#include "paragraph_funcs.h"
+#include "lyxtext.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
@@ -168,8 +170,10 @@ InsetGraphics::~InsetGraphics()
 void InsetGraphics::statusChanged()
 {
        BufferView * bv = graphic_->view();
-       if (bv)
+       if (bv) {
+               bv->text->redoParagraph(outerPar(*bv->buffer(), this));
                bv->updateInset();
+       }
 }
 
 
index b88b744f87949f65e15cdb081bd2462aed0557a7..e184d8b893baf332a99ae7ba398f2586a3f92ee5 100644 (file)
@@ -247,7 +247,7 @@ void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
 
 int InsetText::textWidth() const
 {
-               return textwidth_;
+       return textwidth_;
 }
 
 
index 67e8a777f19fbeb11228e6c666bf39b3c7399888..a93192a5fb83a990ac3b8b3c1cf7a22d90d369c5 100644 (file)
@@ -38,24 +38,6 @@ Row::Row(pos_type pos)
 {}
 
 
-void Row::y(unsigned int newy)
-{
-       y_ = newy;
-}
-
-
-unsigned int Row::y() const
-{
-       return y_;
-}
-
-
-unsigned short Row::height() const
-{
-       return height_;
-}
-
-
 void Row::pos(pos_type p)
 {
        pos_ = p;
@@ -92,12 +74,6 @@ int Row::fill() const
 }
 
 
-void Row::height(unsigned short h)
-{
-       height_ = h;
-}
-
-
 void Row::width(unsigned int w)
 {
        width_ = w;
@@ -110,13 +86,13 @@ unsigned int Row::width() const
 }
 
 
-void Row::ascent_of_text(unsigned short a)
+void Row::ascent_of_text(unsigned int a)
 {
        ascent_of_text_ = a;
 }
 
 
-unsigned short Row::ascent_of_text() const
+unsigned int Row::ascent_of_text() const
 {
        return ascent_of_text_;
 }
index b68b91b0764570aa23b21ad454a037fd168cd804..2b21b3265c6f3e7c6b2bbbc606a12ea22f9f942e 100644 (file)
@@ -37,17 +37,17 @@ public:
        ///
        int fill() const;
        ///
-       void height(unsigned short h);
+       void height(unsigned int h) { height_ = h; }
        ///
-       unsigned short height() const;
+       unsigned int height() const { return height_; }
        ///
        void width(unsigned int w);
        ///
        unsigned int width() const;
        ///
-       void ascent_of_text(unsigned short a);
+       void ascent_of_text(unsigned int a);
        ///
-       unsigned short ascent_of_text() const;
+       unsigned int ascent_of_text() const;
        ///
        void top_of_text(unsigned int top);
        ///
@@ -59,9 +59,9 @@ public:
        /// return true if this row is the start of a paragraph
        bool isParStart() const;
        /// return the cached y position
-       unsigned int y() const;
+       unsigned int y() const { return y_; }
        /// cache the y position
-       void y(unsigned int newy);
+       void y(unsigned int newy) { y_ = newy; }
        ///
        float x() const;
        ///
@@ -89,7 +89,7 @@ private:
          Needed for hfills, flushright, block etc. */
        mutable int fill_;
        ///
-       unsigned short height_;
+       unsigned int height_;
        ///
        unsigned int width_;
        /// cached y position
index 2e22229df00bad7a7b6d56630760d2a9a41c9750..cf68c0e7efa0b353e2dcf37de52d62a9ec1d75f6 100644 (file)
@@ -66,7 +66,7 @@ using lyx::pos_type;
 
 
 Paragraph::Paragraph()
-       : pimpl_(new Paragraph::Pimpl(this))
+       : pimpl_(new Paragraph::Pimpl(this)), y(0)
 {
        enumdepth = 0;
        itemdepth = 0;
@@ -75,7 +75,7 @@ Paragraph::Paragraph()
 
 
 Paragraph::Paragraph(Paragraph const & lp)
-       : pimpl_(new Paragraph::Pimpl(*lp.pimpl_, this))
+       : pimpl_(new Paragraph::Pimpl(*lp.pimpl_, this)), y(0)
 {
        enumdepth = 0;
        itemdepth = 0;
index 68de3902ba726283c4c95e5ed7fe1d856d77d01e..f668965f1bd31cfa6af515cec0beb8ee0d6be54c 100644 (file)
@@ -303,6 +303,8 @@ public:
 
        ///
        mutable RowList rows;
+       /// last draw y position (baseline of top row)
+       int y;
 
 private:
        ///
index 8f7a1986a1412b26dafc9dae1888618760ba374d..e50cf74fbf63d3f16be0cd9bd5735f8d6d9c709b 100644 (file)
@@ -25,6 +25,7 @@
 #include "Lsstream.h"
 
 #include "support/lstrings.h"
+#include "support/LAssert.h"
 
 #include "insets/insetoptarg.h"
 #include "insets/insetcommandparams.h"
@@ -1045,3 +1046,21 @@ LyXFont const outerFont(ParagraphList::iterator pit,
 
        return tmpfont;
 }
+
+
+ParagraphList::iterator outerPar(Buffer & buf, InsetOld * inset)
+{
+       ParIterator pit = buf.par_iterator_begin();
+       ParIterator end = buf.par_iterator_end();
+       for ( ; pit != end; ++pit) {
+               InsetList::iterator ii = pit->insetlist.begin();
+               InsetList::iterator iend = pit->insetlist.end();
+               for ( ; ii != iend; ++ii)
+                       if (ii->inset == inset)
+                               return pit.outerPar();
+       }
+       lyxerr << "outerPar: should not happen\n";
+       Assert(false);
+       return end.pit(); // shut up compiler
+}
+
index 1d9190fc7b8b7a310589ebb7342e074440160109..e4f003327953b300295f7e25f9f358810c6999b0 100644 (file)
@@ -20,6 +20,7 @@ class BufferParams;
 class TexRow;
 class LatexRunParams;
 class LyXLex;
+class InsetOld;
 
 ///
 void breakParagraph(BufferParams const & bparams,
@@ -74,4 +75,8 @@ int readParagraph(Buffer & buf, Paragraph & par, LyXLex & lex);
 LyXFont const outerFont(ParagraphList::iterator pit,
                        ParagraphList const & plist);
 
+/// find outermost paragraph containing an inset
+ParagraphList::iterator outerPar(Buffer & buf, InsetOld * inset);
+
+
 #endif // PARAGRAPH_FUNCS_H