2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2000 The LyX Team.
9 * ======================================================
15 #pragma implementation
19 #include "FormError.h"
20 #include "form_error.h"
21 #include "insets/inseterror.h"
23 static int minh, minw;
25 FormError::FormError( LyXView * lv, Dialogs * d )
26 : FormBase( lv, d, BUFFER_DEPENDENT, _("LaTeX Error") ),
27 dialog_(0), ih_(0), message_("")
29 // let the dialog be shown
30 // This is a permanent connection so we won't bother
31 // storing a copy because we won't be disconnecting.
32 d->showError.connect(slot(this, &FormError::showInset));
36 FormError::~FormError()
42 FL_FORM * FormError::form() const
44 if ( dialog_ ) return dialog_->form;
49 void FormError::clearStore()
56 void FormError::showInset( InsetError * inset )
58 if ( dialogIsOpen || inset == 0 ) return;
60 ih_ = inset->hide.connect(slot(this, &FormError::hide));
62 message_ = inset->getContents();
67 void FormError::update()
69 fl_set_form_minsize(form(), minw, minh);
70 fl_set_object_label(dialog_->message, message_.c_str());
74 void FormError::build()
76 dialog_ = build_error();
78 // XFORMS bug workaround
79 // Define the min/max dimensions. Actually applied in update()
80 minw = form()->w; minh = form()->h;