]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlCommand.h
Move the external dialog to the new scheme.
[lyx.git] / src / frontends / controllers / ControlCommand.h
index 802c422c3eaa7cc2920efa4665c5c646300273e6..4a87e106855e94ab0ae2ec66567ee196297f873d 100644 (file)
@@ -1,73 +1,50 @@
 // -*- C++ -*-
-/* This file is part of
- * ====================================================== 
- *
- *           LyX, The Document Processor
- *
- *           Copyright 2000 The LyX Team.
+/**
+ * \file ControlCommand.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * ======================================================
+ * \author Angus Leeming
  *
- * \file ControlCommand.h
- * \author Angus Leeming <a.leeming@ic.ac.uk>
+ * Full author contact details are available in file CREDITS
  *
- * Defines a Controller class for dialogs that create or modify
+ * ControlCommand is a controller class for dialogs that create or modify
  * an inset derived from InsetCommand.
- * Also defines the abstract base class from which the GUI-dependent Views
- * of this dialog should be derived.
  */
 
 #ifndef CONTROLCOMMAND_H
 #define CONTROLCOMMAND_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
 
-#include "ControlConnections.h"
-#include "insets/insetcommand.h"
-#include "commandtags.h" // kb_action
+#include "Dialog.h"
+#include "insets/insetcommandparams.h"
 
-class Dialogs;
-class LyXView;
 
-/** The Inset dialog controller. Connects/disconnects signals, launches 
-    GUI-dependent View and returns the output from this View to the kernel.
- */
-class ControlCommand : public ControlConnectInset<InsetCommand>
-{
+class ControlCommand : public Dialog::Controller {
 public:
+       /** LFUN_INSET_APPLY requires a name, "citation", "ref" etc so that
+           it knows what to do with the rest of the contents.
+           An empty name indicates that no action will occur on 'Apply'.
+        */
+       ControlCommand(Dialog &, string const & lfun_name = string());
        ///
-       ControlCommand(LyXView &, Dialogs &, kb_action=LFUN_NOACTION);
-
-       /// Allow the View access to the local copy.
-       InsetCommandParams & params() const;
-
-protected:
-       /// Slots connected in the daughter classes c-tor.
-       /// Slot launching dialog to (possibly) create a new inset.
-       void createInset(string const &);
-       /// Slot launching dialog to an existing inset.
-       void showInset(InsetCommand *);
-
-       /// Connect signals and launch View.
-       void show(InsetCommandParams const &);
-
-       /// Instantiation of private ControlBase virtual methods.
-       /// Get changed parameters and Dispatch them to the kernel.
-       virtual void apply();
-       /// Disconnect signals and hide View.
-       virtual void hide();
-       /// Update dialog before showing it.
-       virtual void update();
+       InsetCommandParams & params() { return params_; }
+       ///
+       InsetCommandParams const & params() const { return params_; }
+       ///
+       virtual void initialiseParams(string const & data);
+       /// clean-up on hide.
+       virtual void clearParams();
+       /// clean-up on hide.
+       virtual void dispatchParams();
+       ///
+       virtual bool isBufferDependent() const { return true; }
 
 private:
-       /** A local copy of the inset's params.
-           Memory is allocated only whilst the dialog is visible.
-       */
-       InsetCommandParams * params_;
-       /// Controls what is done in LyXFunc::Dispatch()
-       kb_action const action_;
+       ///
+       InsetCommandParams params_;
+       /// Flags what action is taken by Kernel::dispatch()
+       string const lfun_name_;
 };