X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2FFormTabularCreate.C;h=2b8a0f57d28df39235ea604ae28f1982e44bc740;hb=14c60d0aaeff364a78f77e163e6eae5fc3dab8c0;hp=dc37c2b50b27703afba9517e464178dc3ff5e447;hpb=c9dbe4fd82bf88c1b8c8abb7be24f86c6ec25e3f;p=lyx.git diff --git a/src/frontends/xforms/FormTabularCreate.C b/src/frontends/xforms/FormTabularCreate.C index dc37c2b50b..2b8a0f57d2 100644 --- a/src/frontends/xforms/FormTabularCreate.C +++ b/src/frontends/xforms/FormTabularCreate.C @@ -14,17 +14,23 @@ #include +#ifdef __GNUG__ +#pragma implementation +#endif + #include "FormTabularCreate.h" #include "form_tabular_create.h" +#include "buffer.h" #include "BufferView.h" #include "Dialogs.h" #include "LyXView.h" #include "insets/insettabular.h" +#include "support/lstrings.h" +using SigC::slot; FormTabularCreate::FormTabularCreate(LyXView * lv, Dialogs * d) - : FormBaseBD(lv, d, _("Insert Tabular")), - dialog_(0) + : FormBaseBD(lv, d, _("Insert Tabular")) { // let the dialog be shown // This is a permanent connection so we won't bother @@ -33,33 +39,24 @@ FormTabularCreate::FormTabularCreate(LyXView * lv, Dialogs * d) } -FormTabularCreate::~FormTabularCreate() -{ - delete dialog_; -} - - FL_FORM * FormTabularCreate::form() const { - if ( dialog_ ) return dialog_->form; + if (dialog_.get()) + return dialog_->form; return 0; } void FormTabularCreate::connect() { - bc_.valid(true); + bc().valid(true); FormBaseBD::connect(); } void FormTabularCreate::build() { - dialog_ = build_tabular_create(); - - // Workaround dumb xforms sizing bug - minw_ = form()->w; - minh_ = form()->h; + dialog_.reset(build_tabular_create()); fl_set_slider_bounds(dialog_->slider_rows, 1, 50); fl_set_slider_bounds(dialog_->slider_columns, 1, 50); @@ -68,11 +65,11 @@ void FormTabularCreate::build() fl_set_slider_precision(dialog_->slider_rows, 0); fl_set_slider_precision(dialog_->slider_columns, 0); - // manage the ok, apply and cancel/close buttons - bc_.setOK(dialog_->button_ok); - bc_.setApply(dialog_->button_apply); - bc_.setCancel(dialog_->button_cancel); - bc_.refresh(); + // Manage the ok, apply and cancel/close buttons + bc().setOK(dialog_->button_ok); + bc().setApply(dialog_->button_apply); + bc().setCancel(dialog_->button_cancel); + bc().refresh(); } @@ -81,8 +78,12 @@ 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); - InsetTabular * in = new InsetTabular( *lv_->buffer(), xsize, ysize ); - if (!lv_->view()->open_new_inset(in)) { - delete in; - } + string tmp = tostr(xsize) + " " + tostr(ysize); + lv_->getLyXFunc()->Dispatch(LFUN_INSET_TABULAR, tmp); +} + + +void FormTabularCreate::update() +{ + bc().readOnly(lv_->buffer()->isReadonly()); }