X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2FFormError.C;h=0a6b5b2d1a583f3e926ddb05de99f861742dd32a;hb=9f29ab3aa5fb11baca9bc28dc3710076cb3a2645;hp=861c87080278ff4df5a0cfae53d4f89281bb8362;hpb=52d76611c398120eee929d503fa09900c553b3a6;p=lyx.git diff --git a/src/frontends/xforms/FormError.C b/src/frontends/xforms/FormError.C index 861c870802..0a6b5b2d1a 100644 --- a/src/frontends/xforms/FormError.C +++ b/src/frontends/xforms/FormError.C @@ -19,13 +19,15 @@ #include "FormError.h" #include "form_error.h" #include "insets/inseterror.h" +#include "support/LAssert.h" -static int minh, minw; +using SigC::slot; -FormError::FormError( LyXView * lv, Dialogs * d ) - : FormBase( lv, d, BUFFER_DEPENDENT, _("LaTeX Error") ), - dialog_(0), ih_(0), message_("") +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. @@ -33,51 +35,47 @@ FormError::FormError( LyXView * lv, Dialogs * d ) } -FormError::~FormError() +FL_FORM * FormError::form() const { - delete dialog_; + if (dialog_.get()) return dialog_->form; + return 0; } -void FormError::showInset( InsetError * const inset ) +void FormError::disconnect() { - if( dialogIsOpen || inset == 0 ) return; + inset_ = 0; + message_.erase(); + FormInset::disconnect(); +} + + +void FormError::showInset(InsetError * inset) +{ + if (inset == 0) return; // Is this _really_ allowed? (Lgb) - ih_ = inset->hide.connect(slot(this, &FormError::hide)); + // If connected to another inset, disconnect from it. + if (inset_) + ih_.disconnect(); + inset_ = inset; message_ = inset->getContents(); + ih_ = inset->hideDialog.connect(slot(this, &FormError::hide)); show(); } void FormError::update() { - fl_set_form_minsize(form(), minw, minh); fl_set_object_label(dialog_->message, message_.c_str()); } void FormError::build() { - dialog_ = build_error(); - - // XFORMS bug workaround - // Define the min/max dimensions. Actually applied in update() - minw = form()->w; minh = form()->h; -} - - -void FormError::clearStore() -{ - ih_.disconnect(); - message_.empty(); -} - + dialog_.reset(build_error()); -FL_FORM * const FormError::form() const -{ - if( dialog_ ) // no need to test for dialog_->form - return dialog_->form; - else - return 0; + // Manage the cancel/close button + bc().setCancel(dialog_->button_cancel); + bc().refresh(); }