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 void FormError::showInset( InsetError * const inset )
44 if( dialogIsOpen || inset == 0 ) return;
46 ih_ = inset->hide.connect(slot(this, &FormError::hide));
48 message_ = inset->getContents();
53 void FormError::update()
55 fl_set_form_minsize(form(), minw, minh);
56 fl_set_object_label(dialog_->message, message_.c_str());
60 void FormError::build()
62 dialog_ = build_error();
64 // XFORMS bug workaround
65 // Define the min/max dimensions. Actually applied in update()
66 minw = form()->w; minh = form()->h;
70 void FormError::clearStore()
77 FL_FORM * const FormError::form() const
79 if( dialog_ ) // no need to test for dialog_->form