X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2FFormError.C;h=9bdf9dfb69b3977bcb717bf8831f433ebca3b912;hb=8effd3eec4f9f143572875416ed8815e2a26cd12;hp=9a88be148d6f17790829cfc53648f026b8ed6649;hpb=ebfcf1c0e72288b7131607af0330500c8739cead;p=lyx.git diff --git a/src/frontends/xforms/FormError.C b/src/frontends/xforms/FormError.C index 9a88be148d..9bdf9dfb69 100644 --- a/src/frontends/xforms/FormError.C +++ b/src/frontends/xforms/FormError.C @@ -20,11 +20,9 @@ #include "form_error.h" #include "insets/inseterror.h" -static int minh, minw; - FormError::FormError( LyXView * lv, Dialogs * d ) - : FormBase( lv, d, BUFFER_DEPENDENT, _("LaTeX Error") ), - dialog_(0), ih_(0), message_("") + : FormInset( lv, d, _("LaTeX Error") ), + dialog_(0), inset_(0), message_("") { // let the dialog be shown // This is a permanent connection so we won't bother @@ -46,27 +44,35 @@ FL_FORM * FormError::form() const } -void FormError::clearStore() +void FormError::disconnect() { - ih_.disconnect(); + inset_ = 0; message_.empty(); + FormInset::disconnect(); } void FormError::showInset( InsetError * inset ) { - if ( dialogIsOpen || inset == 0 ) return; + if (inset == 0) return; - ih_ = inset->hide.connect(slot(this, &FormError::hide)); + // If connected to another inset, disconnect from it. + if (inset_) + ih_.disconnect(); - message_ = inset->getContents(); + inset_ = inset; + message_ = inset->getContents(); show(); } -void FormError::update() +void FormError::update(bool switched) { - fl_set_form_minsize(form(), minw, minh); + if (switched) { + hide(); + return; + } + fl_set_object_label(dialog_->message, message_.c_str()); } @@ -75,7 +81,7 @@ void FormError::build() { dialog_ = build_error(); - // XFORMS bug workaround - // Define the min/max dimensions. Actually applied in update() - minw = form()->w; minh = form()->h; + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; }