]> git.lyx.org Git - lyx.git/commitdiff
Set layout informations on newly created paragraphs and don't resize InsetTexts
authorJürgen Vigna <jug@sad.it>
Tue, 12 Mar 2002 13:27:51 +0000 (13:27 +0000)
committerJürgen Vigna <jug@sad.it>
Tue, 12 Mar 2002 13:27:51 +0000 (13:27 +0000)
LyXText if we didn't create a new LyXText as it is not needed then.

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

src/BufferView_pimpl.C
src/ChangeLog
src/buffer.C
src/tabular.C

index ee132148100d2e7969fd82fa96ccc8c4c58ca626..af028664e5c354ff0b6f4220653ffbfd55072a87 100644 (file)
@@ -311,6 +311,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
        pos_type selendpos = 0;
        bool selection = false;
        bool mark_set  = false;
+       bool text_found = false;
 
        owner_->prohibitInput();
 
@@ -334,6 +335,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
                // the new buffer_ with the correct width.
                bv_->text = textcache.findFit(buffer_, workarea_.workWidth());
                if (bv_->text) {
+                       text_found = true;
                        if (lyxerr.debugging()) {
                                lyxerr << "Found a LyXText that fits:\n";
                                textcache.show(lyxerr, make_pair(buffer_, make_pair(workarea_.workWidth(), bv_->text)));
@@ -372,7 +374,8 @@ int BufferView::Pimpl::resizeCurrentBuffer()
        // please tell me WHY the heck you deactivated this code, whoever
        // 'you' are (Jug 20020311)
 #if 1
-       buffer_->resizeInsets(bv_);
+       if (!text_found)
+               buffer_->resizeInsets(bv_);
 #endif
        // this will scroll the screen such that the cursor becomes visible
        updateScrollbar();
index be41a945313d13a3205bbc24d84a25d8985af85c..2c7b08f6638695a0e87c8773810ed13755780bbb 100644 (file)
@@ -1,3 +1,13 @@
+2002-03-12  Juergen Vigna  <jug@sad.it>
+
+       * BufferView_pimpl.C (resizeCurrentBuffer): only resize insets if we
+       did resize the LyXText too.
+
+       * buffer.C (readLyXformat2): set layout information on newly allocated
+       paragraphs.
+
+       * tabular.C (OldFormatRead): set layout information on the paragraph.
+
 2002-03-12  José Abílio Oliveira Matos  <jamatos@novalis.fc.up.pt>
 
        * buffer.C (simpleDocBookOnePar): fix empty definition case for now.
index a0b13320030e3981458cc90cb9fcfa1e93b3d006..1afe9c8d78cca04a004ed8fb34e7d1c301ad3eb3 100644 (file)
@@ -333,6 +333,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
 
        if (!par) {
                par = new Paragraph;
+               par->layout(textclasslist[params.textclass].defaultLayoutName());
        } else {
                // We are inserting into an existing document
                users->text->breakParagraph(users);
@@ -544,6 +545,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                                first_par = par;
                        else {
                                par = new Paragraph(par);
+                               par->layout(textclasslist[params.textclass].defaultLayoutName());
                        }
                        pos = 0;
                        par->layout(layoutname);
index 9ca78ad16ff3f7a9c1d025165dda9bf508d9e7ab..abb382168577d9165bb522675e81536b90d0cfea 100644 (file)
@@ -35,6 +35,7 @@
 #include "frontends/Alert.h"
 #include "gettext.h"
 #include "tabular_funcs.h"
+#include "lyxtextclasslist.h"
 
 #include <algorithm>
 #include <cstdlib>
@@ -197,7 +198,7 @@ LyXTabular * LyXTabular::clone(BufferParams const & bp,
 
 /* activates all lines and sets all widths to 0 */ 
 void LyXTabular::Init(BufferParams const & bp,
-                     int rows_arg, int columns_arg, LyXTabular const * lt)
+                      int rows_arg, int columns_arg, LyXTabular const * lt)
 {
        rows_ = rows_arg;
        columns_ = columns_arg;
@@ -1309,7 +1310,7 @@ void LyXTabular::ReadNew(Buffer const * buf, istream & is,
 
 
 void LyXTabular::OldFormatRead(BufferParams const & bp,
-                              LyXLex & lex, string const & fl)
+                               LyXLex & lex, string const & fl)
 {
        int version;
        int i;
@@ -1443,6 +1444,7 @@ void LyXTabular::OldFormatRead(BufferParams const & bp,
        Paragraph * par = new Paragraph;
        Paragraph * return_par = 0;
 
+       par->layout(textclasslist[bp.textclass].defaultLayoutName());
        string tmptok;
        int pos = 0;
        Paragraph::depth_type depth = 0;