From 02e72741bf2c6e868d4ffefe0804dbbd829a6dff Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Vigna?= Date: Thu, 2 Mar 2000 18:30:01 +0000 Subject: [PATCH] Fixed the display bug for text-insets we still had and now ERT-insets do break on LyX-Window width as the rest of the text does. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@583 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 8 ++++++++ src/insets/inset.C | 2 +- src/insets/insetert.C | 1 + src/insets/insettext.C | 8 +++++++- src/insets/insettext.h | 4 +++- src/insets/lyxinset.h | 2 ++ 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1b17ae886..0c3ecbe565 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-03-03 Juergen Vigna + + * src/insets/insetert.C (InsetERT): Now ERT-insets break row + automatically with the width of the LyX-Window + + * src/insets/insettext.C (computeTextRows): fixed update bug in + displaying text-insets (scrollvalues where not initialized!) + 2000-03-02 Lars Gullik Bjønnes * src/mathed/math_utils.C (MathedLookupBOP): using only res->id == diff --git a/src/insets/inset.C b/src/insets/inset.C index dc81e399ac..02b733c9a7 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -112,7 +112,7 @@ void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int) { LyXFont font; -// bview = bv; + scx = 0; mx_scx=abs((width(bv->getPainter(), font) - bv->paperWidth())/2); diff --git a/src/insets/insetert.C b/src/insets/insetert.C index 386dbd26ad..698ff3435a 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -25,6 +25,7 @@ InsetERT::InsetERT(Buffer * bf) { closed = true; nomotion = false; + autoBreakRows = true; } diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 38d2cf1f21..082e2e1048 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -63,6 +63,8 @@ InsetText::InsetText(Buffer * buf) interline_space = 1; no_selection = false; init_inset = true; + maxAscent = maxDescent = insetWidth = 0; + autoBreakRows = false; } @@ -77,6 +79,8 @@ InsetText::InsetText(InsetText const & ins, Buffer * buf) interline_space = 1; no_selection = false; init_inset = true; + maxAscent = maxDescent = insetWidth = 0; + autoBreakRows = false; } @@ -1068,7 +1072,7 @@ void InsetText::computeTextRows(Painter & pain) const row.pos = 0; row.baseline = 0; rows.push_back(row); - if (maxWidth < 0) { + if (!autoBreakRows) { for(p = 0; p < par->Last(); ++p) { insetWidth += SingleWidth(pain, par, p); SingleHeight(pain, par, p, asc, desc); @@ -1084,11 +1088,13 @@ void InsetText::computeTextRows(Painter & pain) const rows.push_back(row); return; } + bool is_first_word_in_row = true; int cw, lastWordWidth = 0; + maxWidth = buffer->getUser()->paperWidth(); for(p = 0; p < par->Last(); ++p) { cw = SingleWidth(pain, par, p); width += cw; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index b1b1ae94dd..f3bfbd8629 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -129,13 +129,15 @@ protected: /// LyXFont real_current_font; /// - int maxWidth; + mutable int maxWidth; /// mutable int maxAscent; /// mutable int maxDescent; /// mutable int insetWidth; + /// + bool autoBreakRows; private: /// diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index 5c3b3ee908..9bcc94243c 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -206,6 +206,8 @@ public: return (b) ? DISPATCHED: FINISHED; } + /// + UpdatableInset() { scx = mx_scx = 0; } /// //virtual ~UpdatableInset() {} /// -- 2.39.2