// -*- C++ -*-
-/* form_document.h
- * FormDocument Interface Class
+/**
+ * \file FormDocument.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Jürgen Vigna
+ *
+ * Full author contact details are available in file CREDITS.
*/
#ifndef FORM_DOCUMENT_H
#define FORM_DOCUMENT_H
-#include "DialogBase.h"
-#include "support/utility.hpp"
-#include <vector>
+#include "FormDialogView.h"
+#include "BranchList.h"
-#ifdef __GNUG_
-#pragma interface
-#endif
+#include <boost/scoped_ptr.hpp>
-class LyXView;
-class Dialogs;
-class Combox;
+#include "lyx_forms.h"
+#include <vector>
-struct FD_form_tabbed_document;
-struct FD_form_doc_paper;
-struct FD_form_doc_class;
-struct FD_form_doc_language;
-struct FD_form_doc_options;
-struct FD_form_doc_bullet;
+class BufferParams;
-#ifdef SIGC_CXX_NAMESPACES
-using SigC::Connection;
-#endif
+namespace lyx {
+namespace frontend {
+
+class ControlDocument;
+class FormColorpicker;
+struct FD_document;
+struct FD_document_paper;
+struct FD_document_class;
+struct FD_document_language;
+struct FD_document_options;
+struct FD_document_bullet;
+struct FD_document_branch;
-/** This class provides an XForms implementation of the FormDocument Popup.
- The table-layout-form here changes values for latex-tabulars
+/** This class provides an XForms implementation of the FormDocument dialog.
+ * The table-layout-form here changes values for latex-tabulars
*/
-class FormDocument : public DialogBase, public noncopyable {
+class FormDocument
+ : public FormController<ControlDocument, FormView<FD_document> > {
public:
- /**@name Constructors and Destructors */
- //@{
- /// #FormDocument x(Communicator ..., Popups ...);#
- FormDocument(LyXView *, Dialogs *);
- ///
- ~FormDocument();
- void SetDocumentClassChoice(vector<string> const & choices);
- //@}
-
- /**@name Real per-instance Callback Methods */
- //@{
- static int WMHideCB(FL_FORM *, void *);
- static void OKCB(FL_OBJECT *, long);
- static void CancelCB(FL_OBJECT *, long);
- static void ApplyCB(FL_OBJECT *, long);
- static void InputCB(FL_OBJECT *, long);
- //@}
+ FormDocument(Dialog &);
+private:
+ /** Redraw the form (on receipt of a Signal indicating, for example,
+ that the xforms colours have been re-mapped). */
+ virtual void redraw();
+ /// Build the dialog
+ virtual void build();
+ /// Filter the inputs
+ virtual ButtonPolicy::SMInput input( FL_OBJECT *, long);
+ /// Update the dialog.
+ virtual void update();
+ /// Apply from dialog
+ virtual void apply();
- enum EnumPopupStatus {
- POPUP_UNMODIFIED,
- POPUP_MODIFIED,
- POPUP_READONLY
- };
+ ///
+ void branch_input(FL_OBJECT *);
+ ///
+ void ChoiceBulletSize(FL_OBJECT * ob, long);
+ ///
+ void InputBulletLaTeX(FL_OBJECT * ob, long);
+ ///
+ void BulletDepth(FL_OBJECT * ob);
+ ///
+ void BulletPanel(FL_OBJECT * ob);
+ ///
+ void BulletBMTable(FL_OBJECT * ob, long);
+ ///
+ void checkReadOnly();
+ ///
+ void CheckChoiceClass();
+ ///
+ void UpdateLayoutDocument(BufferParams const & params);
+ ///
+ void UpdateClassParams(BufferParams const & params);
-private:
- void DeactivateDocumentButtons();
- void ActivateDocumentButtons();
- void EnableDocumentLayout();
- void DisableDocumentLayout();
- void CheckDocumentInput(FL_OBJECT * ob, long);
- void ChoiceBulletSize(FL_OBJECT * ob, long);
- void InputBulletLaTeX(FL_OBJECT * ob, long);
- void BulletDepth(FL_OBJECT * ob, long);
- void BulletPanel(FL_OBJECT * ob, long);
- void BulletBMTable(FL_OBJECT * ob, long);
- void checkMarginValues();
+ ///
+ void paper_update(BufferParams const &);
+ ///
+ void class_update(BufferParams const &);
+ ///
+ void language_update(BufferParams const &);
+ ///
+ void options_update(BufferParams const &);
+ ///
+ void bullets_update(BufferParams const &);
+ ///
+ void branch_update(BufferParams const &);
- /**@name Real per-instance Callback Methods */
- //@{
- static void DocumentInputCB(FL_OBJECT * ob, long);
- static void ChoiceBulletSizeCB(FL_OBJECT * ob, long);
- static void InputBulletLaTeXCB(FL_OBJECT * ob, long);
- static void BulletDepthCB(FL_OBJECT * ob, long);
- static void BulletPanelCB(FL_OBJECT * ob, long);
- static void BulletBMTableCB(FL_OBJECT * ob, long);
- //@}
-
- /**@name Slot Methods */
- //@{
- /// Create the popup if necessary, update it and display it.
- void show();
- /// Hide the popup.
- void hide();
- /// Update the popup.
- void update();
- void paper_update();
- void class_update();
- void language_update();
- void options_update();
- void bullets_update();
- /// Apply from popup
- void apply();
- void paper_apply();
- bool class_apply();
- bool language_apply();
- bool options_apply();
- void bullets_apply();
- /// Cancel from popup
- void cancel();
- //@}
- /// Build the popup
- void build();
- ///
- /// Explicitly free the popup.
- void free();
+ ///
+ void paper_apply(BufferParams &);
+ ///
+ bool class_apply(BufferParams &);
+ ///
+ bool language_apply(BufferParams &);
+ ///
+ void options_apply(BufferParams &);
+ ///
+ void bullets_apply(BufferParams &);
+ ///
+ void branch_apply(BufferParams &);
- /// Typedefinitions from the fdesign produced Header file
- FD_form_tabbed_document * build_tabbed_document();
- FD_form_doc_paper * build_doc_paper();
- FD_form_doc_class * build_doc_class();
- FD_form_doc_language * build_doc_language();
- FD_form_doc_options * build_doc_options();
- FD_form_doc_bullet * build_doc_bullet();
+ void rebuild_all_branches_browser();
+ void rebuild_selected_branches_browser();
- /**@name Private Data */
- //@{
- /// Real GUI implementation.
- FD_form_tabbed_document * dialog_;
- FD_form_doc_paper * paper_;
- FD_form_doc_class * class_;
- FD_form_doc_language * language_;
- FD_form_doc_options * options_;
- FD_form_doc_bullet * bullets_;
- /// Which LyXView do we belong to?
- LyXView * lv_;
- Dialogs * d_;
- /// Update connection.
- Connection u_;
- /// Hide connection.
- Connection h_;
- /// has form contents changed? Used to control OK/Apply
- EnumPopupStatus status;
- //@}
- int
- ActCell, Confirmed,
- current_bullet_panel, current_bullet_depth;
- ///
- FL_OBJECT * fbullet;
- ///
- Combox * combo_language;
+ /// Real GUI implementation.
+ boost::scoped_ptr<FD_document_paper> paper_;
+ ///
+ boost::scoped_ptr<FD_document_class> class_;
+ ///
+ boost::scoped_ptr<FD_document_language> language_;
+ ///
+ boost::scoped_ptr<FD_document_options> options_;
+ ///
+ boost::scoped_ptr<FD_document_bullet> bullets_;
+ ///
+ boost::scoped_ptr<FD_document_branch> branch_;
+ ///
+ boost::scoped_ptr<FormColorpicker> picker_;
+ ///
+ int ActCell;
+ ///
+ int Confirmed;
+ ///
+ int current_bullet_panel;
+ ///
+ int current_bullet_depth;
+ ///
+ FL_OBJECT * fbullet;
+ ///
+ std::vector<std::string> lang_;
+ /// Contains all legal branches for this doc
+ BranchList branchlist_;
};
+} // namespace frontend
+} // namespace lyx
+
#endif