2000-09-22 15:09:51 +00:00
|
|
|
// -*- 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"
|
2000-09-27 05:40:29 +00:00
|
|
|
#include "insets/inseterror.h"
|
2000-11-08 09:39:46 +00:00
|
|
|
#include "support/LAssert.h"
|
2000-09-22 15:09:51 +00:00
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
using SigC::slot;
|
2000-11-08 09:39:46 +00:00
|
|
|
|
|
|
|
FormError::FormError(LyXView * lv, Dialogs * d)
|
2001-03-15 13:37:04 +00:00
|
|
|
: FormInset( lv, d, _("LaTeX Error")),
|
|
|
|
inset_(0)
|
2000-09-22 15:09:51 +00:00
|
|
|
{
|
2000-11-08 09:39:46 +00:00
|
|
|
Assert(lv && d);
|
2000-09-22 15:09:51 +00:00
|
|
|
// 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));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-03 05:53:25 +00:00
|
|
|
FL_FORM * FormError::form() const
|
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
if (dialog_.get()) return dialog_->form;
|
2000-10-03 05:53:25 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-13 05:57:05 +00:00
|
|
|
void FormError::disconnect()
|
2000-10-03 05:53:25 +00:00
|
|
|
{
|
2000-10-13 05:57:05 +00:00
|
|
|
inset_ = 0;
|
2000-10-24 17:54:10 +00:00
|
|
|
message_.erase();
|
2000-10-13 05:57:05 +00:00
|
|
|
FormInset::disconnect();
|
2000-10-03 05:53:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-08 09:39:46 +00:00
|
|
|
void FormError::showInset(InsetError * inset)
|
2000-09-22 15:09:51 +00:00
|
|
|
{
|
2000-11-08 09:39:46 +00:00
|
|
|
if (inset == 0) return; // Is this _really_ allowed? (Lgb)
|
2000-09-22 15:09:51 +00:00
|
|
|
|
2000-10-13 05:57:05 +00:00
|
|
|
// If connected to another inset, disconnect from it.
|
|
|
|
if (inset_)
|
|
|
|
ih_.disconnect();
|
2000-09-22 15:09:51 +00:00
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
inset_ = inset;
|
|
|
|
message_ = inset->getContents();
|
2001-02-19 16:01:31 +00:00
|
|
|
ih_ = inset->hideDialog.connect(slot(this, &FormError::hide));
|
2000-09-22 15:09:51 +00:00
|
|
|
show();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
void FormError::update()
|
2000-09-22 15:09:51 +00:00
|
|
|
{
|
|
|
|
fl_set_object_label(dialog_->message, message_.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormError::build()
|
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
dialog_.reset(build_error());
|
2000-09-22 15:09:51 +00:00
|
|
|
|
2000-11-28 06:46:06 +00:00
|
|
|
// Manage the cancel/close button
|
2001-03-15 13:37:04 +00:00
|
|
|
bc().setCancel(dialog_->button_cancel);
|
|
|
|
bc().refresh();
|
2000-09-22 15:09:51 +00:00
|
|
|
}
|