]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormExternal.h
Introduce LFUN_PRINT.
[lyx.git] / src / frontends / xforms / FormExternal.h
index 8e3e7762532ddd7cb7cf667f67775c54c81cfe9a..80296f3c3b6e252e98f0577bb7a5c7ef402ac6ae 100644 (file)
+// -*- C++ -*-
 /**
  * \file FormExternal.h
- * Copyright 2001 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author unknown
+ * \author Asger Alstrup Nielsen
  * \author John Levon
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
  */
 
 #ifndef FORMEXTERNAL_H
 #define FORMEXTERNAL_H
 
-#include <boost/smart_ptr.hpp>
-
-#ifdef __GNUG__
-#pragma interface
-#endif
 
-#include "FormBaseDeprecated.h"
-#include "insets/insetexternal.h"
-#include "xformsBC.h"
+#include "FormDialogView.h"
+#include <map>
 
-struct FD_form_external;
+class ControlExternal;
+struct FD_external;
+struct FD_external_file;
+struct FD_external_lyxview;
+struct FD_external_rotate;
+struct FD_external_scale;
+struct FD_external_crop;
+struct FD_external_options;
 
 /// The class for editing External insets via a dialog
-class FormExternal : public FormBaseBD {
+class FormExternal
+       : public FormController<ControlExternal, FormView<FD_external> > {
 public:
        ///
-       FormExternal(LyXView *, Dialogs *);
-
-       /// Connect signals. Also perform any necessary initialisation.
-       virtual void connect();
-
-       /// Disconnect signals. Also perform any necessary housekeeping.
-       virtual void disconnect();
-
-       /// Slot launching dialog to an existing inset
-       void showInset(InsetExternal *);
-
-       /// bool indicates if a buffer switch took place
-       virtual void updateSlot(bool);
+       FormExternal(Dialog &);
 
-       /// Callback function for the template drop-down
-       static void templateCB(FL_OBJECT *, long);
+       typedef std::map<std::string, std::string> MapType;
 
-       /// Callback function for the browse button
-       static void browseCB(FL_OBJECT *, long);
+       enum Tabs {
+               FILETAB,
+               LYXVIEWTAB,
+               ROTATETAB,
+               SCALETAB,
+               CROPTAB,
+               OPTIONSTAB
+       };
 
-       /// Callback function for the edit button
-       static void editCB(FL_OBJECT *, long);
-
-       /// Callback function for the view button
-       static void viewCB(FL_OBJECT *, long);
-
-       /// Callback function for the update production button
-       static void updateCB(FL_OBJECT *, long);
-
-       /// Pointer to the actual instantiation of the xform's form
-       virtual FL_FORM * form() const;
+       typedef std::map<Tabs, FL_OBJECT *> TabMap;
 
 private:
-       /// calculate the string to set the combo box
-       string const getTemplatesComboString() const;
-
-       /// get the position in the combo for a given name
-       int getTemplateComboNumber(string const & name) const;
-
-       /// get a template given its combo position
-       ExternalTemplate getTemplate(int i) const;
+       /// apply changes
+       virtual void apply();
 
-       /// change widgets on change of chosen template
-       void updateComboChange();
        /// build the dialog
-       void build();
-
-       /// the inset we're modifying
-       InsetExternal * inset_;
-
-       /// the parameters
-       InsetExternal::InsetExternalParams params_;
+       virtual void build();
 
        /// update the dialog
-       void update();
-
-       /// apply changes
-       void apply();
+       virtual void update();
 
-       bool input(FL_OBJECT * obj, long data);
+       /// Filter the inputs on callback from xforms
+       virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
 
-       /// inset::hide connection.
-       Connection ih_;
-
-       /// build the dialog
-       FD_form_external * build_external();
+       bool activateAspectratio() const;
+       void getBB();
+       void updateComboChange();
+       void widthUnitChanged();
 
-       /// Pointer to the actual instantiation of the ButtonController.
-       virtual xformsBC & bc();
+       MapType extra_;
 
-       /// the dialog implementation
-       boost::scoped_ptr<FD_form_external> dialog_;
+       TabMap tabmap_;
 
-       /// The ButtonController
-       ButtonController<OkCancelReadOnlyPolicy, xformsBC> bc_;
+       /// Real GUI implementation.
+       boost::scoped_ptr<FD_external_file>    file_;
+       boost::scoped_ptr<FD_external_lyxview> lyxview_;
+       boost::scoped_ptr<FD_external_rotate>  rotate_;
+       boost::scoped_ptr<FD_external_scale>   scale_;
+       boost::scoped_ptr<FD_external_crop>    crop_;
+       boost::scoped_ptr<FD_external_options> options_;
 };
 
-
-inline
-xformsBC & FormExternal::bc()
-{
-       return bc_;
-}
-
 #endif // FORMEXTERNAL_H