]> git.lyx.org Git - lyx.git/commitdiff
John's Layout Tabular UI improvements and Martins fixes to clearing the
authorJürgen Vigna <jug@sad.it>
Mon, 7 Jan 2002 09:50:19 +0000 (09:50 +0000)
committerJürgen Vigna <jug@sad.it>
Mon, 7 Jan 2002 09:50:19 +0000 (09:50 +0000)
cell around the InsetText inside InsetTabular.

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

src/ChangeLog
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormTabular.C
src/frontends/xforms/FormTabular.h
src/frontends/xforms/form_tabular.C
src/frontends/xforms/form_tabular.h
src/frontends/xforms/forms/form_tabular.fd
src/insets/ChangeLog
src/insets/insettabular.C
src/text.C

index d5bccea896a98ba15f769c2d8c04e39a9e6ba6db..a7d0c79ba59f11ed2d6fed15a49da7afc065d298 100644 (file)
@@ -1,3 +1,7 @@
+2002-01-07  Juergen Vigna  <jug@sad.it>
+
+       * text.C (nextBreakPoint): removed debug output not needed anymore.
+
 2002-01-06  Juergen Vigna  <jug@sad.it>
 
        * text.C (nextBreakPoint): fixed up this function we had this bug
index 0237f376e5f9648796f6a4e617dee894f41258c9..931880984b58f837dc3bba3f47738b81165b73d4 100644 (file)
@@ -1,3 +1,12 @@
+2002-01-07  John Levon  <moz@compsoc.man.ac.uk>
+
+       * 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  <j.spitzmueller@gmx.de>
 
        * FormDocument.C: Recognize the default paper settings too
index f67fef0e27c25e9968ce48909e93799cceac30c9..14676f75dce0d9ef3feae71e05ac6fd97b6579d9 100644 (file)
@@ -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,
index 509a4f6b5a33e30349b6cf7762f0184f1e1d915d..08002a16b1df8b86460f3a981471f8ff4af7bdc0 100644 (file)
@@ -90,6 +90,8 @@ private:
        int actCell_;
        /// The ButtonController
        ButtonController<OkCancelReadOnlyPolicy, xformsBC> bc_;
+       /// if we are applying stuff during a close of the dialog
+       bool closing_;
 };
 
 
index c88fd757f3e351c051ca1edb04ea04469d7f74f3..a7cafb3c823b5a91d0f5d9f8b8dddad4b59a0d35 100644 (file)
@@ -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);
index ce68e24874f740c182806dd66d842194ad02d70c..ca056ba46c945a49ab9ee80b1c5ab272d6b2b802 100644 (file)
@@ -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);
 
index a11b6fd70c6c60c9c1acb098f0d0249cd2c3d873..b1c9981a69d1f2ebf3b6fc526374588839752b2b 100644 (file)
@@ -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
 
 --------------------
index 2754b22c7bc470a2fc526ce43f15a41f483f41c6..0778ecea6e8593d7a58d903327e74eebaa7ccb20 100644 (file)
@@ -1,3 +1,7 @@
+2002-01-07  Juergen Vigna  <jug@sad.it>
+
+       * insettabular.C (draw): fixed clearing of cell around inset.
+
 2002-01-05  Juergen Vigna  <jug@sad.it>
 
        * insettext.C (draw): move the calls so that insetWidth/Asc/Desc
index 655637564078a86d2ad8f823d27506975115271f..37c8139131c33197c6fdc10fd9df826b604a01cd 100644 (file)
@@ -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;
index 2d7197b7708110983235eb87f4f934d2f44f443e..e546e323162056e38d1ab286eb4f915d08c041e9 100644 (file)
@@ -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;
 }