]> git.lyx.org Git - lyx.git/blobdiff - src/TableLayout.C
small changes to ButtonController usage
[lyx.git] / src / TableLayout.C
index 4e02f2427ebb3fecf4e58f3655ade026bc840918..06f3f138fc89c281ade81a961079183c8698a47e 100644 (file)
 #include "layout.h"
 #include "insets/lyxinset.h"
 
-
 // Prototypes
 extern FD_form_table_options * fd_form_table_options;
 extern FD_form_table_extra * fd_form_table_extra;
 extern BufferView * current_view;
 
-extern bool UpdateLayoutTabular(int);
-extern void TabularOptionsCB(FL_OBJECT * ob, long l);
-extern void SetPWidthTabularCB(FL_OBJECT * ob, long l);
-
-
+#ifndef NEW_TABULAR
 static int Confirmed = false;
 static int ActCell;
 
@@ -39,17 +34,17 @@ static int ActCell;
 // in 1.1 anyway)
 static int extra_col_cursor_x; // need no y's, one-line input fields
 static int extra_multicol_cursor_x;
+#endif
 // Joacim
 
-#define IS_TABULAR  (current_view->the_locking_inset && \
-                    current_view->the_locking_inset->GetFirstLockingInsetOfType(Inset::TABULAR_CODE))
 
 bool UpdateLayoutTable(int flag)
 {
     bool update = true;
     if (!current_view->available())
         update = false;
-    
+
+#ifndef NEW_TABULAR
     if (update && current_view->text->cursor.par()->table) {
         char buf[12];
         string pwidth, special;
@@ -219,7 +214,9 @@ bool UpdateLayoutTable(int flag)
                      table->RotateTable());
        fl_set_focus_object(fd_form_table_options->form_table_options,
                            fd_form_table_options->button_table_delete);
-    } else if (fd_form_table_options->form_table_options->visible) {
+    } else
+#endif
+           if (fd_form_table_options->form_table_options->visible) {
        fl_set_focus_object(fd_form_table_options->form_table_options,
                            fd_form_table_options->button_table_delete);
         fl_hide_form(fd_form_table_options->form_table_options);
@@ -262,13 +259,9 @@ void MenuLayoutTable(int flag)
 }
 
 
-void TableOptionsCB(FL_OBJECT * ob, long l)
+void TableOptionsCB(FL_OBJECT * ob, long)
 {
-    if (IS_TABULAR) {
-       TabularOptionsCB(ob, l);
-       return;
-    }
-
+#ifndef NEW_TABULAR
     LyXTable * table = 0;
     int s, num = 0;
     string special, str;
@@ -434,14 +427,14 @@ void TableOptionsCB(FL_OBJECT * ob, long l)
         current_view->hideCursor();
         if (!current_view->text->selection){
             current_view->beforeChange();
-            current_view->update(-2);
+            current_view->update(BufferView::SELECT|BufferView::FITCUR);
         }
         if ((num == LyXTable::SET_SPECIAL_COLUMN) ||
             (num == LyXTable::SET_SPECIAL_MULTI))
-            current_view->text->TableFeatures(num, special);
+            current_view->text->TableFeatures(current_view, num, special);
         else
-            current_view->text->TableFeatures(num);
-        current_view->update(1);
+            current_view->text->TableFeatures(current_view, num);
+        current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
     }
     if (num == LyXTable::DELETE_TABLE) {
        fl_set_focus_object(fd_form_table_options->form_table_options,
@@ -450,6 +443,7 @@ void TableOptionsCB(FL_OBJECT * ob, long l)
     } else
         UpdateLayoutTable(true);
     return;
+#endif
 }
 
 
@@ -469,13 +463,9 @@ void TableSpeCloseCB(FL_OBJECT *, long)
     return;
 }
 
-void SetPWidthCB(FL_OBJECT * ob, long l)
+void SetPWidthCB(FL_OBJECT * ob, long)
 {
-    if (IS_TABULAR) {
-       SetPWidthTabularCB(ob, l);
-       return;
-    }
-
+#ifndef NEW_TABULAR
     fl_set_object_label(fd_form_table_options->text_warning, "");
     Confirmed = false;
     if (ob == fd_form_table_options->input_column_width) {
@@ -490,11 +480,12 @@ void SetPWidthCB(FL_OBJECT * ob, long l)
             current_view->hideCursor();
             if (!current_view->text->selection) {
                 current_view->beforeChange(); 
-                current_view->update(-2);
+                current_view->update(BufferView::SELECT|BufferView::FITCUR);
             }
-            current_view->text->TableFeatures(LyXTable::SET_PWIDTH, str);
-            current_view->update(1);
+            current_view->text->TableFeatures(current_view, LyXTable::SET_PWIDTH, str);
+            current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
         }
         MenuLayoutTable(0); // update for alignment
     }
+#endif
 }