]> git.lyx.org Git - features.git/commitdiff
John's TabularCreate patch. I think I'm now up to date. Have a great Easter!
authorAngus Leeming <leeming@lyx.org>
Wed, 11 Apr 2001 17:59:08 +0000 (17:59 +0000)
committerAngus Leeming <leeming@lyx.org>
Wed, 11 Apr 2001 17:59:08 +0000 (17:59 +0000)
Angus

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

src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlTabularCreate.C
src/frontends/controllers/ControlTabularCreate.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormTabularCreate.C

index 7cc6915d08cb09f3f7275ecf1f73f6c357253226..bde59e42e2ae00b9294302cccb0120049e564276 100644 (file)
@@ -1,11 +1,13 @@
 2001-04-06  John Levon  <moz@compsoc.man.ac.uk>
 
+       * ControlTabularCreate.h:
+       * ControlTabularCreate.C: make dialogs use a pair of uints
+         instead of a string
+
        * ControlVCLog.h:
        * ControlVCLog.C: fill a stringstream with the log contents
        and then delete it
 
-2001-04-06  John Levon  <moz@compsoc.man.ac.uk>
-
        * ControlExternal.C: from Angus, clone the new InsetExternal
          before acting on it
 
index 1d2db58b01592d3d9c9413a9843dd25a3582751e..445bb9b4014d962047eb8f22833cca213a0e83e4 100644 (file)
@@ -21,6 +21,7 @@
 #include "Dialogs.h"
 #include "LyXView.h"
 #include "lyxfunc.h"
+#include "support/lstrings.h"
 
 ControlTabularCreate::ControlTabularCreate(LyXView & lv, Dialogs & d)
        : ControlDialog<ControlConnectBD>(lv, d)
@@ -30,31 +31,18 @@ ControlTabularCreate::ControlTabularCreate(LyXView & lv, Dialogs & d)
 }
 
 
-string & ControlTabularCreate::params() const
+ControlTabularCreate::rowsCols & ControlTabularCreate::params()
 {
-       Assert(params_);
-       return *params_;
+               return params_;
 }
 
 
 void ControlTabularCreate::setParams()
 {
-       if (params_) delete params_;
-       params_ = new string;
-
        bc().valid(); // so that the user can press Ok
 }
 
 
-void ControlTabularCreate::clearParams()
-{
-       if (params_) {
-               delete params_;
-               params_ = 0;
-       }
-}
-
-
 void ControlTabularCreate::apply()
 {
        if (!lv_.view()->available())
@@ -62,5 +50,7 @@ void ControlTabularCreate::apply()
    
        view().apply();
 
-       lv_.getLyXFunc()->Dispatch(LFUN_INSET_TABULAR, params());
+       string const val(tostr(params().first) + " " + tostr(params().second)); 
+       lv_.getLyXFunc()->Dispatch(LFUN_INSET_TABULAR, val);
 }
index b7b0e38267b1ac0346f30ff18b514fd98d098915..7f9ee592de8bbb6f3561c8f0a163b61662c62d3d 100644 (file)
@@ -17,6 +17,8 @@
 #pragma interface
 #endif
 
+#include <utility>
 #include "ControlDialogs.h"
 
 /** A controller for the TabularCreate Dialog.
@@ -25,8 +27,11 @@ class ControlTabularCreate : public ControlDialog<ControlConnectBD> {
 public:
        /// 
        ControlTabularCreate(LyXView &, Dialogs &);
+       typedef std::pair<unsigned int, unsigned int> rowsCols;
+
        ///
-       string & params() const;
+       rowsCols & params();
 
 private:
        /// Apply from dialog
@@ -34,11 +39,9 @@ private:
 
        /// set the params before show or update
        virtual void setParams();
-       /// clean-up on hide.
-       virtual void clearParams();
     
-       ///
-       string * params_;
+       /// rows, cols params
+       rowsCols params_;
 };
 
 #endif // CONTROLTABULARCREATE_H
index 43d1fe71040a03c08a7f91315662f6c0f5911d16..3d3b44cbc3a6aa1d1c7d304a003783f3db530861 100644 (file)
@@ -1,8 +1,8 @@
 2001-04-06  John Levon  <moz@compsoc.man.ac.uk>
 
-       * FormVCLog.C: the log appears as a stringstream now
+       * FormTabularCreate.C: pass a pair of uints to the controller
 
-2001-04-06  John Levon  <moz@compsoc.man.ac.uk>
+       * FormVCLog.C: the log appears as a stringstream now
 
        * forms/form_external.fd: make params update state (from Angus)
 
index 5ba8c441f51d64867a5736690cb161def25772b3..2ec372345c2f6a924f83a3a9e16833f32861ac1b 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <config.h>
+#include <utility>
 
 #ifdef __GNUG__
 #pragma implementation
@@ -49,8 +50,8 @@ void FormTabularCreate::build()
 
 void FormTabularCreate::apply()
 {
-       int ysize = int(fl_get_slider_value(dialog_->slider_columns) + 0.5);
-       int xsize = int(fl_get_slider_value(dialog_->slider_rows) + 0.5);
+       unsigned int ysize = (unsigned int)(fl_get_slider_value(dialog_->slider_columns) + 0.5);
+       unsigned int xsize = (unsigned int)(fl_get_slider_value(dialog_->slider_rows) + 0.5);
 
-       controller().params() = tostr(xsize) + " " + tostr(ysize);
+       controller().params() = std::make_pair(xsize, ysize);
 }