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
#include "Dialogs.h"
#include "LyXView.h"
#include "lyxfunc.h"
+#include "support/lstrings.h"
ControlTabularCreate::ControlTabularCreate(LyXView & lv, Dialogs & d)
: ControlDialog<ControlConnectBD>(lv, 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())
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);
}
#pragma interface
#endif
+#include <utility>
+
#include "ControlDialogs.h"
/** A controller for the TabularCreate Dialog.
public:
///
ControlTabularCreate(LyXView &, Dialogs &);
+
+ typedef std::pair<unsigned int, unsigned int> rowsCols;
+
///
- string & params() const;
+ rowsCols & params();
private:
/// Apply from dialog
/// 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
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)
*/
#include <config.h>
+#include <utility>
#ifdef __GNUG__
#pragma implementation
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);
}