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 : FormInset( lv, d, _("LaTeX Error") ),
27 dialog_(0), inset_(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::disconnect()
53 FormInset::disconnect();
57 void FormError::showInset( InsetError * inset )
59 if (inset == 0) return;
61 // If connected to another inset, disconnect from it.
66 message_ = inset->getContents();
71 void FormError::update(bool switched)
78 fl_set_form_minsize(form(), minw, minh);
79 fl_set_object_label(dialog_->message, message_.c_str());
83 void FormError::build()
85 dialog_ = build_error();
87 // XFORMS bug workaround
88 // Define the min/max dimensions. Actually applied in update()
89 minw = form()->w; minh = form()->h;