mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
ba01a232ea
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1110 a592a061-630c-0410-9148-cb99ea01b6c8
91 lines
1.6 KiB
C
91 lines
1.6 KiB
C
// -*- C++ -*-
|
|
/* This file is part of
|
|
* ======================================================
|
|
*
|
|
* LyX, The Document Processor
|
|
*
|
|
* Copyright 2000 The LyX Team.
|
|
*
|
|
* ======================================================
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#ifdef __GNUG__
|
|
#pragma implementation
|
|
#endif
|
|
|
|
#include "Dialogs.h"
|
|
#include "FormError.h"
|
|
#include "form_error.h"
|
|
#include "insets/inseterror.h"
|
|
|
|
static int minh, minw;
|
|
|
|
FormError::FormError( LyXView * lv, Dialogs * d )
|
|
: 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
|
|
// storing a copy because we won't be disconnecting.
|
|
d->showError.connect(slot(this, &FormError::showInset));
|
|
}
|
|
|
|
|
|
FormError::~FormError()
|
|
{
|
|
delete dialog_;
|
|
}
|
|
|
|
|
|
FL_FORM * FormError::form() const
|
|
{
|
|
if ( dialog_ ) return dialog_->form;
|
|
return 0;
|
|
}
|
|
|
|
|
|
void FormError::disconnect()
|
|
{
|
|
inset_ = 0;
|
|
message_.empty();
|
|
FormInset::disconnect();
|
|
}
|
|
|
|
|
|
void FormError::showInset( InsetError * inset )
|
|
{
|
|
if (inset == 0) return;
|
|
|
|
// If connected to another inset, disconnect from it.
|
|
if (inset_)
|
|
ih_.disconnect();
|
|
|
|
inset_ = inset;
|
|
message_ = inset->getContents();
|
|
show();
|
|
}
|
|
|
|
|
|
void FormError::update(bool switched)
|
|
{
|
|
if (switched) {
|
|
hide();
|
|
return;
|
|
}
|
|
|
|
fl_set_form_minsize(form(), minw, minh);
|
|
fl_set_object_label(dialog_->message, message_.c_str());
|
|
}
|
|
|
|
|
|
void FormError::build()
|
|
{
|
|
dialog_ = build_error();
|
|
|
|
// XFORMS bug workaround
|
|
// Define the min/max dimensions. Actually applied in update()
|
|
minw = form()->w; minh = form()->h;
|
|
}
|