John's TabularCreate patch. I think I'm now up to date. Have a great Easter!

Angus


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1911 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-04-11 17:59:08 +00:00
parent aba7831f62
commit 3775940eed
5 changed files with 24 additions and 28 deletions

View 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

View 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);
}

View 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

View File

@ -1,9 +1,9 @@
2001-04-06 John Levon <moz@compsoc.man.ac.uk>
* FormTabularCreate.C: pass a pair of uints to the controller
* FormVCLog.C: the log appears as a stringstream now
2001-04-06 John Levon <moz@compsoc.man.ac.uk>
* forms/form_external.fd: make params update state (from Angus)
2001-04-05 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>

View 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);
}