]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gnome/FormTabularCreate.C
ws cleanup
[lyx.git] / src / frontends / gnome / FormTabularCreate.C
index a5e20f0134d154b76068cf6570c0d5855a6481cb..8c2a97a3ef0c578449d6a242ce045e2275332d2f 100644 (file)
@@ -1,11 +1,10 @@
-// -*- C++ -*-
 /* This file is part of
  * =================================================
- * 
+ *
  *          LyX, The Document Processor
  *          Copyright 1995-2000 The LyX Team.
  *
- * ================================================= 
+ * =================================================
  *
  * \author Michael Koziarski <michael@koziarski.org>
  */
@@ -24,8 +23,7 @@
 #include <gtk--/button.h>
 
 FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
-       : FormCB<ControlTabularCreate>(c, "diainserttabular.glade", 
-                                      "DiaInsertTabular")
+       : FormCB<ControlTabularCreate>(c, "FormTabularCreate")
 {}
 
 
@@ -41,13 +39,13 @@ FormTabularCreate::~FormTabularCreate()
 void FormTabularCreate::build()
 {
        // Connect the buttons.
-       ok_btn()->clicked.connect(SigC::slot(this, 
-                                        &FormTabularCreate::OKClicked));
-       cancel_btn()->clicked.connect(SigC::slot(this, 
-                                        &FormTabularCreate::CancelClicked));
-       apply_btn()->clicked.connect(SigC::slot(this, 
-                                     &FormTabularCreate::ApplyClicked));
-       
+       ok_btn()->clicked.connect(SigC::slot(this,
+                                        &FormTabularCreate::OKClicked));
+       cancel_btn()->clicked.connect(SigC::slot(this,
+                                        &FormTabularCreate::CancelClicked));
+       apply_btn()->clicked.connect(SigC::slot(this,
+                                    &FormTabularCreate::ApplyClicked));
+
        // Manage the buttons state
        bc().setOK(ok_btn());
        bc().setCancel(cancel_btn());
@@ -60,50 +58,41 @@ void FormTabularCreate::build()
 
 void FormTabularCreate::apply()
 {
-       unsigned int ysize = (unsigned int)(rows_spin()->get_value_as_int());
-       unsigned int xsize = (unsigned int)(columns_spin()->get_value_as_int());
+       unsigned int ysize = (unsigned int)(rows()->get_value_as_int());
+       unsigned int xsize = (unsigned int)(cols()->get_value_as_int());
 
        controller().params() = std::make_pair(xsize, ysize);
 }
 
 
 void FormTabularCreate::update()
-{
-}
+{}
 
 
 bool FormTabularCreate::validate() const
 {
-       // Always valid! (not really so, needs fixing).
-       return true;
+       return ( rows()->get_value_as_int() > 0 ) &&
+              ( cols()->get_value_as_int() > 0 );
 }
 
 
-Gtk::SpinButton * FormTabularCreate::rows_spin() const
+Gtk::Button * FormTabularCreate::ok_btn() const
 {
-       return getWidget<Gtk::SpinButton>("tabular_spin_rows");
+       return getWidget<Gtk::Button>("r_ok_btn");
 }
-
-
-Gtk::SpinButton * FormTabularCreate::columns_spin() const
+Gtk::Button * FormTabularCreate::apply_btn() const
 {
-       return getWidget<Gtk::SpinButton>("tabular_spin_columns");
+       return getWidget<Gtk::Button>("r_apply_btn");
 }
-
-
-Gtk::Button * FormTabularCreate::ok_btn() const
+Gtk::Button * FormTabularCreate::cancel_btn() const
 {
-       return getWidget<Gtk::Button>("button_ok");
+       return getWidget<Gtk::Button>("r_cancel_btn");
 }
-
-
-Gtk::Button * FormTabularCreate::cancel_btn() const
+Gtk::SpinButton * FormTabularCreate::rows() const
 {
-       return getWidget<Gtk::Button>("button_cancel");
+       return getWidget<Gtk::SpinButton>("r_rows");
 }
-
-
-Gtk::Button * FormTabularCreate::apply_btn() const
+Gtk::SpinButton * FormTabularCreate::cols() const
 {
-       return getWidget<Gtk::Button>("button_apply");
+       return getWidget<Gtk::SpinButton>("r_cols");
 }