From: Jürgen Vigna Date: Mon, 7 Jan 2002 09:50:19 +0000 (+0000) Subject: John's Layout Tabular UI improvements and Martins fixes to clearing the X-Git-Tag: 1.6.10~20087 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=53cea4fb837013ded97e3bed35a6291263a6bf6c;p=lyx.git John's Layout Tabular UI improvements and Martins fixes to clearing the cell around the InsetText inside InsetTabular. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3298 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index d5bccea896..a7d0c79ba5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2002-01-07 Juergen Vigna + + * text.C (nextBreakPoint): removed debug output not needed anymore. + 2002-01-06 Juergen Vigna * text.C (nextBreakPoint): fixed up this function we had this bug diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 0237f376e5..931880984b 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,12 @@ +2002-01-07 John Levon + + * FormTabular.h: + * FormTabular.C: + * form_tabular.h: + * form_tabular.C: + * forms/form_tabular.fd: ugly fix to get around + some of the UI problems (bug #110). + 2002-01-04 Jürgen Spitzmüller * FormDocument.C: Recognize the default paper settings too diff --git a/src/frontends/xforms/FormTabular.C b/src/frontends/xforms/FormTabular.C index f67fef0e27..14676f75dc 100644 --- a/src/frontends/xforms/FormTabular.C +++ b/src/frontends/xforms/FormTabular.C @@ -153,6 +153,9 @@ void FormTabular::build() void FormTabular::update() { + if (closing_) + return; + if (!inset_ || !inset_->tabular.get()) return; @@ -479,7 +482,20 @@ bool FormTabular::input(FL_OBJECT * ob, long) string special;; int cell = inset_->getActCell(); - + + // ugly hack to auto-apply the stuff that hasn't been + // yet. don't let this continue to exist ... + if (ob == dialog_->button_close) { + closing_ = true; + input(column_options_->input_column_width, 0); + input(cell_options_->input_mcolumn_width, 0); + input(column_options_->input_special_alignment, 0); + input(cell_options_->input_special_multialign, 0); + closing_ = false; + ok(); + return true; + } + if (actCell_ != cell) { update(); fl_set_object_label(dialog_->text_warning, diff --git a/src/frontends/xforms/FormTabular.h b/src/frontends/xforms/FormTabular.h index 509a4f6b5a..08002a16b1 100644 --- a/src/frontends/xforms/FormTabular.h +++ b/src/frontends/xforms/FormTabular.h @@ -90,6 +90,8 @@ private: int actCell_; /// The ButtonController ButtonController bc_; + /// if we are applying stuff during a close of the dialog + bool closing_; }; diff --git a/src/frontends/xforms/form_tabular.C b/src/frontends/xforms/form_tabular.C index c88fd757f3..a7cafb3c82 100644 --- a/src/frontends/xforms/form_tabular.C +++ b/src/frontends/xforms/form_tabular.C @@ -33,7 +33,7 @@ FD_form_tabular * FormTabular::build_tabular() fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseDeprecatedCancelCB, 0); + fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0); fdui->input_tabular_column = obj = fl_add_input(FL_NORMAL_INPUT, 65, 260, 60, 30, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); diff --git a/src/frontends/xforms/form_tabular.h b/src/frontends/xforms/form_tabular.h index ce68e24874..ca056ba46c 100644 --- a/src/frontends/xforms/form_tabular.h +++ b/src/frontends/xforms/form_tabular.h @@ -5,7 +5,7 @@ #define FD_form_tabular_h_ /** Callbacks, globals and object handlers **/ -extern "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT *, long); +extern "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT *, long); extern "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT *, long); diff --git a/src/frontends/xforms/forms/form_tabular.fd b/src/frontends/xforms/forms/form_tabular.fd index a11b6fd70c..b1c9981a69 100644 --- a/src/frontends/xforms/forms/form_tabular.fd +++ b/src/frontends/xforms/forms/form_tabular.fd @@ -64,7 +64,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_close -callback: C_FormBaseDeprecatedCancelCB +callback: C_FormBaseDeprecatedInputCB argument: 0 -------------------- diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 2754b22c7b..0778ecea6e 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2002-01-07 Juergen Vigna + + * insettabular.C (draw): fixed clearing of cell around inset. + 2002-01-05 Juergen Vigna * insettext.C (draw): move the calls so that insetWidth/Asc/Desc diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 6556375640..37c8139131 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -362,39 +362,45 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline, float dx = nx + tabular->GetBeginningOfTextInCell(cell); float cx = dx; tabular->GetCellInset(cell)->draw(bv, font, baseline, dx, false); + // + // Here we use rectangular backgroundColor patches to clean up + // within a cell around the cell's red inset box. As follows: + // + // +---+ +---+ + // | | | | The rectangles are A, B and C + // | A |------------| B | below, origin top left (tx, ty), + // | | inset box | | dimensions w(idth), h(eight). + // +---+------------+---+ x grows rightward, y downward + // | D | + // +--------------------+ + // // clear only if we didn't have a change if (bv->text->status() != LyXText::CHANGED_IN_DRAW) { // clear before the inset - pain.fillRectangle( - nx + 1, - baseline - tabular->GetAscentOfRow(i) + 1, - int(cx - nx - 1), - tabular->GetAscentOfRow(i) + - tabular->GetDescentOfRow(i) - 1, - backgroundColor()); + int tx, ty, w, h; + tx = nx + 1; + ty = baseline - tabular->GetAscentOfRow(i) + 1; + w = int(cx - nx - 1); + h = tabular->GetAscentOfRow(i) + + tabular->GetDescentOfRow(i) - 1; + pain.fillRectangle(tx, ty, w, h, backgroundColor()); // clear behind the inset - pain.fillRectangle( - int(cx + the_locking_inset->width(bv,font) + 1), - baseline - tabular->GetAscentOfRow(i) + 1, - tabular->GetWidthOfColumn(cell) - + tx = int(cx + the_locking_inset->width(bv,font) + 1); + ty = baseline - tabular->GetAscentOfRow(i) + 1; + w = tabular->GetWidthOfColumn(cell) - tabular->GetBeginningOfTextInCell(cell) - the_locking_inset->width(bv,font) - - tabular->GetAdditionalWidth(cell) - 1, - tabular->GetAscentOfRow(i) + - tabular->GetDescentOfRow(i) - 1, - backgroundColor()); + tabular->GetAdditionalWidth(cell) - 1; + h = tabular->GetAscentOfRow(i) + tabular->GetDescentOfRow(i) - 1; + pain.fillRectangle(tx, ty, w, h, backgroundColor()); // clear below the inset - pain.fillRectangle( - nx + 1, - baseline + the_locking_inset->descent(bv, font) + 1, - tabular->GetWidthOfColumn(cell) - - tabular->GetAdditionalWidth(cell) - 1, - tabular->GetAscentOfRow(i) + - tabular->GetDescentOfRow(i) - - the_locking_inset->ascent(bv, font) - - the_locking_inset->descent(bv, font) - - TEXT_TO_INSET_OFFSET - 1, - backgroundColor()); + tx = nx + 1; + ty = baseline + the_locking_inset->descent(bv, font) + 1; + w = tabular->GetWidthOfColumn(cell) - + tabular->GetAdditionalWidth(cell) - 1; + h = tabular->GetDescentOfRow(i) - + the_locking_inset->descent(bv, font) - 1; + pain.fillRectangle(tx, ty, w, h, backgroundColor()); } } x -= ADD_TO_TABULAR_WIDTH; diff --git a/src/text.C b/src/text.C index 2d7197b770..e546e32316 100644 --- a/src/text.C +++ b/src/text.C @@ -1034,7 +1034,6 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const if (main_body && last_separator < main_body) last_separator = main_body - 1; - lyxerr << last_separator << ":" << pos << endl; return last_separator; }