Alfredo Braunstein wrote: Index: lyxtext.h + struct Pos { + int x; + int y; +}; No default constructor to initialize these two? Brave man!
+ Pos pos_; If it's public, you can get rid of the trailing underscore. Tell the world what 'pos_' is. Give it a nice little comment. Index: text2.C +{ + pos_.x = 0; + pos_.y = 0; +} Ah-haa! struct Pos does indeed need a default constructor! Do you plan to go to absolute coordinates for everything? The stuff below is a horrible mix of the two... Index: insets/insettext.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v retrieving revision 1.546 diff -u -p -u -r1.546 insettext.C --- insets/insettext.C 17 Nov 2003 20:28:10 -0000 1.546 +++ insets/insettext.C 18 Nov 2003 22:39:28 -0000 @@ -257,6 +257,9 @@ void InsetText::draw(PainterInfo & pi, i x += TEXT_TO_INSET_OFFSET; + text_.pos_.x = x; + text_.pos_.y = y + bv->top_y(); + paintTextInset(*bv, text_, x, y); if (drawFrame_ == ALWAYS || drawFrame_ == LOCKED) @@ -340,10 +343,8 @@ void InsetText::edit(BufferView * bv, in lyxerr << "InsetText::edit xy" << endl; old_par = -1; sanitizeEmptyText(bv); - text_.setCursorFromCoordinates(x, y + dim_.asc); - text_.cursor.x(text_.cursor.x()); - bv->x_target(text_.cursor.x()); - + text_.setCursorFromCoordinates(x - text_.pos_.x, y + bv->top_y() + - text_.pos_.y); text_.clearSelection(); finishUndo(); -- Angus