]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormError.C
More pref work from Angus
[lyx.git] / src / frontends / xforms / FormError.C
index 2a73930985842d0cf4ecc22eef06ab9005f2d439..bdc2110f9055b84ce5a502688c8d4f5c2f069c75 100644 (file)
 #include "form_error.h"
 #include "insets/inseterror.h"
 
-static int minh, minw;
-
 FormError::FormError( LyXView * lv, Dialogs * d )
-       : FormBase( lv, d, _("LaTeX Error"), BUFFER_DEPENDENT, HIDE ),
-         dialog_(0), ih_(0), message_("")
+       : FormInset( lv, d, _("LaTeX Error") ),
+         dialog_(0), inset_(0)
 {
        // let the dialog be shown
        // This is a permanent connection so we won't bother
@@ -46,27 +44,31 @@ FL_FORM * FormError::form() const
 }
 
 
-void FormError::clearStore()
+void FormError::disconnect()
 {
-       ih_.disconnect();
-       message_.empty();
+       inset_ = 0;
+       message_.erase();
+       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();
 
+       inset_ = inset;
        message_ = inset->getContents();
+       ih_ = inset->hide.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());
 }
 
@@ -75,7 +77,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;
 }