X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2FFormError.C;h=0a6b5b2d1a583f3e926ddb05de99f861742dd32a;hb=9f29ab3aa5fb11baca9bc28dc3710076cb3a2645;hp=9bdf9dfb69b3977bcb717bf8831f433ebca3b912;hpb=8effd3eec4f9f143572875416ed8815e2a26cd12;p=lyx.git diff --git a/src/frontends/xforms/FormError.C b/src/frontends/xforms/FormError.C index 9bdf9dfb69..0a6b5b2d1a 100644 --- a/src/frontends/xforms/FormError.C +++ b/src/frontends/xforms/FormError.C @@ -19,11 +19,15 @@ #include "FormError.h" #include "form_error.h" #include "insets/inseterror.h" +#include "support/LAssert.h" -FormError::FormError( LyXView * lv, Dialogs * d ) - : FormInset( lv, d, _("LaTeX Error") ), - dialog_(0), inset_(0), message_("") +using SigC::slot; + +FormError::FormError(LyXView * lv, Dialogs * d) + : FormInset( lv, d, _("LaTeX Error")), + inset_(0) { + Assert(lv && d); // let the dialog be shown // This is a permanent connection so we won't bother // storing a copy because we won't be disconnecting. @@ -31,15 +35,9 @@ FormError::FormError( LyXView * lv, Dialogs * d ) } -FormError::~FormError() -{ - delete dialog_; -} - - FL_FORM * FormError::form() const { - if ( dialog_ ) return dialog_->form; + if (dialog_.get()) return dialog_->form; return 0; } @@ -47,41 +45,37 @@ FL_FORM * FormError::form() const void FormError::disconnect() { inset_ = 0; - message_.empty(); + message_.erase(); FormInset::disconnect(); } -void FormError::showInset( InsetError * inset ) +void FormError::showInset(InsetError * inset) { - if (inset == 0) return; + if (inset == 0) return; // Is this _really_ allowed? (Lgb) // If connected to another inset, disconnect from it. if (inset_) ih_.disconnect(); - inset_ = inset; - message_ = inset->getContents(); + inset_ = inset; + message_ = inset->getContents(); + ih_ = inset->hideDialog.connect(slot(this, &FormError::hide)); show(); } -void FormError::update(bool switched) +void FormError::update() { - if (switched) { - hide(); - return; - } - fl_set_object_label(dialog_->message, message_.c_str()); } void FormError::build() { - dialog_ = build_error(); + dialog_.reset(build_error()); - // Workaround dumb xforms sizing bug - minw_ = form()->w; - minh_ = form()->h; + // Manage the cancel/close button + bc().setCancel(dialog_->button_cancel); + bc().refresh(); }