]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormError.C
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / FormError.C
index 9bdf9dfb69b3977bcb717bf8831f433ebca3b912..a99f7cc9488f499bbb588d2802e737650c1f6d8a 100644 (file)
@@ -1,87 +1,42 @@
-// -*- C++ -*-
-/* This file is part of
- * ====================================================== 
+/**
+ * \file FormError.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Angus Leeming
  *
- *           Copyright 2000 The LyX Team.
- *
- * ======================================================
+ * Full author contact details are available in file CREDITS
  */
 
-#include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
+#include <config.h>
 
-#include "Dialogs.h"
+#include "xformsBC.h"
+#include "ControlError.h"
 #include "FormError.h"
-#include "form_error.h"
-#include "insets/inseterror.h"
+#include "forms/form_error.h"
+#include "xforms_helpers.h" // formatted
+#include FORMS_H_LOCATION
 
-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));
-}
+typedef FormController<ControlError, FormView<FD_error> > base_class;
 
+FormError::FormError(Dialog & parent)
+       : base_class(parent, _("LaTeX Error"))
+{}
 
-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)
+void FormError::build()
 {
-       if (switched) {
-               hide();
-               return;
-       }
+       dialog_.reset(build_error(this));
 
-       fl_set_object_label(dialog_->message, message_.c_str());
+       // Manage the cancel/close button
+       bcview().setCancel(dialog_->button_close);
 }
 
 
-void FormError::build()
+void FormError::update()
 {
-       dialog_ = build_error();
-
-       // Workaround dumb xforms sizing bug
-       minw_ = form()->w;
-       minh_ = form()->h;
+       string const txt = formatted(controller().params(),
+                                    dialog_->frame_message->w - 10);
+       fl_set_object_label(dialog_->frame_message, txt.c_str());
 }