-// -*- C++ -*-
-/* This file is part of
- * ======================================================
+/**
+ * \file FormInset.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>
#pragma implementation
#endif
-
-#include "Dialogs.h"
-#include "LyXView.h"
#include "FormInset.h"
-FormInset::FormInset(LyXView * lv, Dialogs * d, string const & t,
- ButtonPolicy * bp,
- char const * close, char const * cancel)
- : FormBaseBD( lv, d, t, bp, close, cancel ), ih_(0)
+#include "frontends/Dialogs.h"
+
+#include <boost/bind.hpp>
+
+FormInset::FormInset(LyXView & lv, Dialogs & d, string const & t)
+ : FormBaseBD(lv, d, t)
{}
+void FormInset::connect()
+{
+ u_ = d_.updateBufferDependent.
+ connect(boost::bind(&FormInset::updateSlot, this, _1));
+ h_ = d_.hideBufferDependent.
+ connect(boost::bind(&FormInset::hide, this));
+ FormBaseDeprecated::connect();
+}
+
+
void FormInset::disconnect()
{
ih_.disconnect();
}
-void FormInset::updateSlot( bool switched )
+void FormInset::updateSlot(bool switched)
{
if (switched)
hide();
else
update();
}
-
-
-FormCommand::FormCommand( LyXView * lv, Dialogs * d, string const & t,
- ButtonPolicy * bp,
- char const * close, char const * cancel)
- : FormInset( lv, d, t, bp, close, cancel ),
- inset_(0)
-{}
-
-
-void FormCommand::disconnect()
-{
- inset_ = 0;
- params = InsetCommandParams( string() );
- FormInset::disconnect();
-}
-
-
-void FormCommand::showInset( InsetCommand * inset )
-{
- if (inset == 0) return; // maybe we should Assert this?
-
- // If connected to another inset, disconnect from it.
- if (inset_)
- ih_.disconnect();
-
- inset_ = inset;
- params = inset->params();
- ih_ = inset->hide.connect(slot(this, &FormCommand::hide));
- show();
-}
-
-
-void FormCommand::createInset( string const & arg )
-{
- if (inset_) {
- ih_.disconnect();
- inset_ = 0;
- }
-
- params.setFromString( arg );
- show();
-}