]> git.lyx.org Git - features.git/commitdiff
Angus's xforms patch -- I don't like some of it but overall we need it...
authorAllan Rae <rae@lyx.org>
Tue, 10 Oct 2000 01:33:42 +0000 (01:33 +0000)
committerAllan Rae <rae@lyx.org>
Tue, 10 Oct 2000 01:33:42 +0000 (01:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1090 a592a061-630c-0410-9148-cb99ea01b6c8

19 files changed:
ChangeLog
src/BufferView_pimpl.C
src/frontends/xforms/FormBase.C
src/frontends/xforms/FormBase.h
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormCommand.C
src/frontends/xforms/FormCommand.h
src/frontends/xforms/FormCopyright.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormError.C
src/frontends/xforms/FormIndex.C
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/FormParagraph.h
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/FormPrint.C
src/frontends/xforms/FormRef.C
src/frontends/xforms/FormToc.C
src/frontends/xforms/FormUrl.C
src/frontends/xforms/forms/form_paragraph.fd

index 77898c7964fd9ed9342e09eff09fed7cbada4548..0f9bac4c9ecceca9618e7082733c81687e398f08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2000-10-05  Angus Leeming <a.leeming@ic.ac.uk>
+
+       * src/BufferView_pimpl.C (buffer): only need one the
+       updateBufferDependent signal to be emitted once! Moved to the end of
+       the method to allow bv_->text to be updated first.
+
+       * src/frontends/xforms/FormBase.[Ch]: replaced the two signals uSignal_
+       and hSignal_ with Dialogs * and BufferDependency variables.
+       New Buffer * parent_, initialised when the dialog is launched. Used to
+       check whether to update() or hide() dialog in the new, private
+       updateOrHide() method that is connected to the updateBufferDependent
+       signal. Daughter classes dictate what to do using the
+       ChangedBufferAction enum, passed to the c-tor.
+
+       * src/frontends/xforms/FormCitation.C:
+       * src/frontends/xforms/FormCommand.C:
+       * src/frontends/xforms/FormCopyright.C:
+       * src/frontends/xforms/FormDocument.C:
+       * src/frontends/xforms/FormError.C:
+       * src/frontends/xforms/FormIndex.C:
+       * src/frontends/xforms/FormPreferences.C:
+       * src/frontends/xforms/FormPrint.C:
+       * src/frontends/xforms/FormRef.C:
+       * src/frontends/xforms/FormToc.C:
+       * src/frontends/xforms/FormUrl.C (c-tor): modified call to FormBase
+       c-tor.
+
+       * src/frontends/xforms/FormCommand.[Ch] (c-tor) passed a
+       ChangedBufferAction enum.
+
+       * src/frontends/xforms/FormParagraph.[Ch]
+       * src/frontends/xforms/forms/form_paragraph.fd: now derived from
+       FormBase.
+       
+       * src/frontends/xforms/FormToc.h (updateOrHide): override default
+       behaviour. Calls update() only.
+
 2000-10-06  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * lib/bind/cua.bind: fix a bit.
index ef4440c807e46e2537ce2301e47e2b9670e69ac5..4ed24019110fc763ca8f6dd854f96d0459227b03 100644 (file)
@@ -143,9 +143,6 @@ void BufferView::Pimpl::buffer(Buffer * b)
        delete screen_;
        screen_ = 0;
 
-       // Similarly, buffer-dependent dialogs should be updated.
-       owner_->getDialogs()->updateBufferDependent();
-
        // If we are closing the buffer, use the first buffer as current
        if (!buffer_) {
                buffer_ = bufferlist.first();
@@ -165,7 +162,6 @@ void BufferView::Pimpl::buffer(Buffer * b)
                owner_->updateMenubar();
                owner_->updateToolbar();
                redraw();
-               owner_->getDialogs()->updateBufferDependent();
                bv_->insetWakeup();
        } else {
                lyxerr[Debug::INFO] << "  No Buffer!" << endl;
@@ -185,6 +181,9 @@ void BufferView::Pimpl::buffer(Buffer * b)
        owner_->updateLayoutChoice();
        owner_->getMiniBuffer()->Init();
        owner_->updateWindowTitle();
+       // Similarly, buffer-dependent dialogs should be updated or hidden.
+       // This should go here because some dialogs (ToC) require bv_->text.
+       owner_->getDialogs()->updateBufferDependent();
 }
 
 
index 301d34f121fe7a3492a446daef66a3ae7eabebc6..f867da3c9ed4f1ce856939ad7c6bada19d70ad63 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "Dialogs.h"
 #include "FormBase.h"
+#include "LyXView.h"
 #include "xform_macros.h"
 
 C_RETURNCB (FormBase, WMHideCB)
@@ -29,22 +30,12 @@ C_GENERICCB(FormBase, InputCB)
 C_GENERICCB(FormBase, RestoreCB)
 
 
-FormBase::FormBase(LyXView * lv, Dialogs * d, BufferDependency bd, string const & t,
+FormBase::FormBase(LyXView * lv, Dialogs * d, string const & t,
+                  BufferDependency bd, ChangedBufferAction cba, 
                   ButtonPolicy * bp, char const * close, char const * cancel)
        : dialogIsOpen(false), lv_(lv), bc_(bp, cancel, close),
-         u_(0), h_(0), title(t), bp_(bp)
-{
-       switch( bd ) {
-       case BUFFER_DEPENDENT:
-               hSignal_ = &d->hideBufferDependent;
-               uSignal_ = &d->updateBufferDependent;
-               break;
-       case BUFFER_INDEPENDENT:
-               hSignal_ = &d->hideAll;
-               uSignal_ = 0;
-               break;
-       }
-}
+         d_(d), bd_(bd), cba_(cba), parent_(0), u_(0), h_(0), title(t), bp_(bp)
+{}
 
 
 FormBase::~FormBase()
@@ -61,6 +52,8 @@ void FormBase::show()
                                    C_FormBaseWMHideCB, 0);
        }
 
+       parent_ = lv_->buffer();
+       
        fl_freeze_form( form() );
        update();  // make sure its up-to-date
        fl_unfreeze_form( form() );
@@ -87,16 +80,24 @@ void FormBase::hide()
 
        // free up the dialog for another inset
        dialogIsOpen = false;
+       parent_ = 0;
        clearStore();
 }
 
 
 void FormBase::connect()
 {
-       if ( uSignal_ ) {
-               u_ = uSignal_->connect(slot(this, &FormBase::update));
+       switch( bd_ ) {
+       case BUFFER_DEPENDENT:
+               u_ = d_->updateBufferDependent.
+                       connect(slot(this, &FormBase::updateOrHide));
+               h_ = d_->hideBufferDependent.
+                       connect(slot(this, &FormBase::hide));
+               break;
+       case BUFFER_INDEPENDENT:
+               h_ = d_->hideAll.connect(slot(this, &FormBase::hide));
+               break;
        }
-       h_ = hSignal_->connect(slot(this, &FormBase::hide));
 }
 
 
@@ -107,6 +108,17 @@ void FormBase::disconnect()
 }
 
 
+void FormBase::updateOrHide()
+{
+       if( cba_ == UPDATE )
+               update();
+       else if( parent_ == lv_->buffer() )
+               update();
+       else
+               hide();
+}
+
+
 int FormBase::WMHideCB(FL_FORM * form, void *)
 {
        // Ensure that the signals (u and h) are disconnected even if the
index 85c277b68c83b0308cfd54531ed2f5bfc33c716b..4a29d9e2dff45009f97d4ccf36af1214b43e2a7e 100644 (file)
@@ -19,6 +19,7 @@
 #include "ButtonController.h"
 #include "gettext.h"
 
+class Buffer;
 class Dialogs;
 class LyXView;
 
@@ -26,10 +27,6 @@ class LyXView;
 #pragma interface
 #endif
 
-#ifdef SIGC_CXX_NAMESPACES
-using SigC::Signal0;
-#endif
-
 /** This class is an XForms GUI base class
     @author Angus Leeming
  */
@@ -42,11 +39,19 @@ public:
                ///
                BUFFER_INDEPENDENT
        };
+       ///
+       enum ChangedBufferAction {
+               ///
+               UPDATE,
+               ///
+               HIDE
+       };
 
        /** Constructor.
-           #FormBase(lv, d, BUFFER_DEPENDENT, _("DialogName"), new ButtonPolicy)#
+           #FormBase(lv, d, _("DialogName"), BUFFER_DEPENDENT, new ButtonPolicy)#
         */
-       FormBase(LyXView *, Dialogs *, BufferDependency, string const &,
+       FormBase(LyXView *, Dialogs *, string const &,
+                BufferDependency, ChangedBufferAction,
                 ButtonPolicy * bp = new OkApplyCancelReadOnlyPolicy,
                 char const * close = N_("Close"),
                 char const * cancel = N_("Cancel"));
@@ -66,7 +71,7 @@ public:
        ///
        static void RestoreCB(FL_OBJECT *, long);
 
-protected:
+protected: // methods
        /// Create the dialog if necessary, update it and display it.
        void show();
        /// Hide the dialog.
@@ -105,21 +110,30 @@ protected:
        /// Pointer to the actual instantiation of xform's form
        virtual FL_FORM * form() const = 0;
 
-       /// block opening of form twice at the same time
+private: // methods
+       /// method connected to updateBufferDependent signal.
+       void updateOrHide();
+
+protected: // data
+       /// block opening of form twice at the same time.
        bool dialogIsOpen;
        /** Which LyXFunc do we use?
            We could modify Dialogs to have a visible LyXFunc* instead and
            save a couple of bytes per dialog.
        */
        LyXView * lv_;
-       /// Useable even in derived-class's const functions
+       /// Useable even in derived-class's const functions.
        mutable ButtonController bc_;
 
-private:
-       /// Hide signal
-       Signal0<void> * hSignal_;
-       /// Update signal
-       Signal0<void> * uSignal_;
+private: // data
+       /// Used so we can get at the signals we have to connect to.
+       Dialogs * d_;
+       /// flag whether dialog is buffer dependent or not.
+       BufferDependency const bd_;
+       /// flag whether to hide or update on updateBufferDependent signal.
+       ChangedBufferAction const cba_;
+       /// stores parent buffer when popup was launched.
+       Buffer * parent_;
        /// Update connection.
        Connection u_;
        /// Hide connection.
index 082d4af5ebc76b5e8c94db01ff177881d8a3ba40..8a52b4e9bef4dc2c7ec6ef844f3f2da3ce3a4c57 100644 (file)
@@ -37,7 +37,7 @@ using std::find;
 static int min_wform;
 
 FormCitation::FormCitation(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Citation")), dialog_(0)
+       : FormCommand(lv, d, _("Citation"), HIDE), dialog_(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
index 81296f39c84dbe1d368a27d278aee6ef3eb2961b..25e9b2d18ff596a158cb4a3bbebea94dafcbd40c 100644 (file)
@@ -22,8 +22,8 @@
 #include "FormCommand.h"
 
 FormCommand::FormCommand( LyXView * lv, Dialogs * d, string const & t,
-                         ButtonPolicy * bp )
-       : FormBase( lv, d, BUFFER_DEPENDENT, t, bp ),
+                         ChangedBufferAction cba, ButtonPolicy * bp )
+       : FormBase( lv, d, t, BUFFER_DEPENDENT, cba, bp ),
          inset_(0), ih_(0)
 {}
 
index ac365ffbc958426ad6cf99849cc7c95a72330820..ceca612757dde4209a7dfd9e2435a8df29777e09 100644 (file)
@@ -26,6 +26,7 @@ class FormCommand : public FormBase {
 public:
        /// Constructor
        FormCommand( LyXView *, Dialogs *, string const &,
+                    ChangedBufferAction, 
                     ButtonPolicy * bp = new OkCancelReadOnlyPolicy );
 
 protected:
index eb0251e0bfd408985d13671b85abdef09790d96b..383b9e72bad662882313d7d8327b42fd76527e96 100644 (file)
@@ -16,7 +16,8 @@
 #include "FormCopyright.h"
 
 FormCopyright::FormCopyright( LyXView * lv, Dialogs * d        )
-       : FormBase( lv, d, BUFFER_INDEPENDENT, _("Copyright and Warranty") ),
+       : FormBase( lv, d, _("Copyright and Warranty"),
+                   BUFFER_INDEPENDENT, HIDE ),
          dialog_(0)
 {
        // let the dialog be shown
index 7d89cf98ecd68aa530a9e54cc4bc4e3e56e506c4..bc4b542485da85064293646b6d5181a7ef229ded 100644 (file)
@@ -45,7 +45,7 @@ using Liason::setMinibuffer;
 #define USE_CLASS_COMBO 1
 
 FormDocument::FormDocument(LyXView * lv, Dialogs * d)
-       : FormBase(lv, d, BUFFER_DEPENDENT, _("Document Layout"),
+       : FormBase(lv, d, _("Document Layout"), BUFFER_DEPENDENT, UPDATE,
                   new NoRepeatedApplyReadOnlyPolicy),
          dialog_(0), paper_(0), class_(0), language_(0), options_(0),
          bullets_(0), current_bullet_panel(0), current_bullet_depth(0),
index 9a88be148d6f17790829cfc53648f026b8ed6649..2a73930985842d0cf4ecc22eef06ab9005f2d439 100644 (file)
@@ -23,7 +23,7 @@
 static int minh, minw;
 
 FormError::FormError( LyXView * lv, Dialogs * d )
-       : FormBase( lv, d, BUFFER_DEPENDENT, _("LaTeX Error") ),
+       : FormBase( lv, d, _("LaTeX Error"), BUFFER_DEPENDENT, HIDE ),
          dialog_(0), ih_(0), message_("")
 {
        // let the dialog be shown
index 7359615c2768d0438d37c9f7564134323572a6f2..ef5b92919e6912c64a3cac2e493b6e17691dcef7 100644 (file)
@@ -26,7 +26,7 @@
 #include "lyxfunc.h"
 
 FormIndex::FormIndex(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Index")), minh(0), minw(0), dialog_(0)
+       : FormCommand(lv, d, _("Index"), HIDE), minh(0), minw(0), dialog_(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
index 4395c61125c8dd4c5245060a1ff5d82c5e1a032a..b1597edcfebaa44ce919f7f8149763e39a606b7c 100644 (file)
 #pragma implementation
 #endif
 
-#include "lyx_gui_misc.h"
-#include "gettext.h"
 #include FORMS_H_LOCATION
-#include XPM_H_LOCATION
 
 #include "FormParagraph.h"
 #include "form_paragraph.h"
-#include "xform_macros.h"
 #include "Dialogs.h"
-#include "ButtonController.h"
 #include "Liason.h"
 #include "LyXView.h"
-#include "BufferView.h"
 #include "buffer.h"
 #include "lyxtext.h"
 
-#ifdef SIGC_CXX_NAMESPACES
-using SigC::slot;
-#endif
-
 #ifdef CXX_WORKING_NAMESPACES
 using Liason::setMinibuffer;
 #endif
 
-C_RETURNCB(FormParagraph,  WMHideCB)
-C_GENERICCB(FormParagraph, InputCB)
-C_GENERICCB(FormParagraph, OKCB)
-C_GENERICCB(FormParagraph, ApplyCB)
-C_GENERICCB(FormParagraph, CancelCB)
-C_GENERICCB(FormParagraph, RestoreCB)
-C_GENERICCB(FormParagraph, VSpaceCB)
-       
 FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
-       : dialog_(0), general_(0), extra_(0),
-         lv_(lv), d_(d), u_(0), h_(0),
-         status(POPUP_UNMODIFIED),
-// this will leak till converted to use FormBase
-         bc_(new ButtonController(new NoRepeatedApplyReadOnlyPolicy,
-                                  _("Cancel"),
-                                  _("Close")))
+       : FormBase(lv, d, _("Paragraph Layout"), BUFFER_DEPENDENT, UPDATE,
+                  new NoRepeatedApplyReadOnlyPolicy),
+       dialog_(0), general_(0), extra_(0)
 {
     // let the popup be shown
     // This is a permanent connection so we won't bother
@@ -65,8 +43,16 @@ FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
 
 FormParagraph::~FormParagraph()
 {
-    free();
-    delete bc_;
+    delete general_;
+    delete extra_;
+    delete dialog_;
+}
+
+
+FL_FORM * FormParagraph::form() const
+{
+    if (dialog_) return dialog_->form;
+    return 0;
 }
 
 
@@ -76,11 +62,11 @@ void FormParagraph::build()
     dialog_ = build_tabbed_paragraph();
 
     // manage the restore, ok, apply and cancel/close buttons
-    bc_->setOK(dialog_->button_ok);
-    bc_->setApply(dialog_->button_apply);
-    bc_->setCancel(dialog_->button_cancel);
-    bc_->setUndoAll(dialog_->button_restore);
-    bc_->refresh();
+    bc_.setOK(dialog_->button_ok);
+    bc_.setApply(dialog_->button_apply);
+    bc_.setCancel(dialog_->button_cancel);
+    bc_.setUndoAll(dialog_->button_restore);
+    bc_.refresh();
 
     // the general paragraph data form
     general_ = build_paragraph_general();
@@ -96,20 +82,20 @@ void FormParagraph::build()
     fl_set_input_return(general_->input_space_below, FL_RETURN_CHANGED);
     fl_set_input_return(general_->input_labelwidth, FL_RETURN_CHANGED);
 
-    bc_->addReadOnly (general_->radio_align_right);
-    bc_->addReadOnly (general_->radio_align_left);
-    bc_->addReadOnly (general_->radio_align_block);
-    bc_->addReadOnly (general_->radio_align_center);
-    bc_->addReadOnly (general_->check_lines_top);
-    bc_->addReadOnly (general_->check_lines_bottom);
-    bc_->addReadOnly (general_->choice_space_above);
-    bc_->addReadOnly (general_->input_space_above);
-    bc_->addReadOnly (general_->check_space_above);
-    bc_->addReadOnly (general_->choice_space_below);
-    bc_->addReadOnly (general_->input_space_below);
-    bc_->addReadOnly (general_->check_space_below);
-    bc_->addReadOnly (general_->check_noindent);
-    bc_->addReadOnly (general_->input_labelwidth);
+    bc_.addReadOnly (general_->radio_align_right);
+    bc_.addReadOnly (general_->radio_align_left);
+    bc_.addReadOnly (general_->radio_align_block);
+    bc_.addReadOnly (general_->radio_align_center);
+    bc_.addReadOnly (general_->check_lines_top);
+    bc_.addReadOnly (general_->check_lines_bottom);
+    bc_.addReadOnly (general_->choice_space_above);
+    bc_.addReadOnly (general_->input_space_above);
+    bc_.addReadOnly (general_->check_space_above);
+    bc_.addReadOnly (general_->choice_space_below);
+    bc_.addReadOnly (general_->input_space_below);
+    bc_.addReadOnly (general_->check_space_below);
+    bc_.addReadOnly (general_->check_noindent);
+    bc_.addReadOnly (general_->input_labelwidth);
 
     // the document class form
     extra_ = build_paragraph_extra();
@@ -117,46 +103,16 @@ void FormParagraph::build()
     fl_set_input_return(extra_->input_pextra_width, FL_RETURN_CHANGED);
     fl_set_input_return(extra_->input_pextra_widthp, FL_RETURN_CHANGED);
 
-    bc_->addReadOnly (extra_->radio_pextra_indent);
-    bc_->addReadOnly (extra_->radio_pextra_minipage);
-    bc_->addReadOnly (extra_->radio_pextra_floatflt);
+    bc_.addReadOnly (extra_->radio_pextra_indent);
+    bc_.addReadOnly (extra_->radio_pextra_minipage);
+    bc_.addReadOnly (extra_->radio_pextra_floatflt);
 
     // now make them fit together
-    fl_set_form_atclose(dialog_->form, C_FormParagraphWMHideCB, 0);
     fl_addto_tabfolder(dialog_->tabbed_folder,_("General"), general_->form);
     fl_addto_tabfolder(dialog_->tabbed_folder,_("Extra"), extra_->form);
 }
 
 
-void FormParagraph::show()
-{
-    if (!dialog_)
-       build();
-
-    update();  // make sure its up-to-date
-    if (dialog_->form->visible) {
-        fl_raise_form(dialog_->form);
-    } else {
-        fl_show_form(dialog_->form, FL_PLACE_MOUSE | FL_FREE_SIZE,
-                     FL_TRANSIENT, _("Paragraph Layout"));
-       u_ = d_->updateBufferDependent.connect(
-           slot(this, &FormParagraph::update));
-       h_ = d_->hideBufferDependent.connect(
-           slot(this, &FormParagraph::hide));
-    }
-}
-
-
-void FormParagraph::hide()
-{
-    if (dialog_->form->visible) {
-        fl_hide_form(dialog_->form);
-        u_.disconnect();
-        h_.disconnect();
-    }
-}
-
-
 void FormParagraph::apply()
 {
     if (!lv_->view()->available() || !dialog_)
@@ -172,6 +128,16 @@ void FormParagraph::apply()
 }
 
 
+void FormParagraph::update()
+{
+    if (!dialog_)
+        return;
+
+    general_update();
+    extra_update();
+}
+
+
 void FormParagraph::general_apply()
 {
     VSpace space_top, space_bottom;
@@ -303,21 +269,6 @@ void FormParagraph::extra_apply()
 }
 
 
-void FormParagraph::cancel()
-{
-}
-
-
-void FormParagraph::update()
-{
-    if (!dialog_)
-        return;
-
-    general_update();
-    extra_update();
-}
-
-
 void FormParagraph::general_update()
 {
     if (!general_)
@@ -532,7 +483,7 @@ void FormParagraph::extra_update()
        fl_set_object_lcol(extra_->radio_pextra_middle, FL_INACTIVE);
        fl_deactivate_object(extra_->radio_pextra_bottom);
        fl_set_object_lcol(extra_->radio_pextra_bottom, FL_INACTIVE);
-       CheckParagraphInput(extra_->radio_pextra_indent, 0);
+       input(extra_->radio_pextra_indent, 0);
     } else if (par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) {
        fl_set_button(extra_->radio_pextra_indent, 0);
        fl_set_button(extra_->radio_pextra_minipage, 1);
@@ -543,7 +494,7 @@ void FormParagraph::extra_update()
        fl_set_object_lcol(extra_->radio_pextra_middle, FL_BLACK);
        fl_activate_object(extra_->radio_pextra_bottom);
        fl_set_object_lcol(extra_->radio_pextra_bottom, FL_BLACK);
-       CheckParagraphInput(extra_->radio_pextra_minipage, 0);
+       input(extra_->radio_pextra_minipage, 0);
     } else if (par->pextra_type == LyXParagraph::PEXTRA_FLOATFLT) {
        fl_set_button(extra_->radio_pextra_indent, 0);
        fl_set_button(extra_->radio_pextra_minipage, 0);
@@ -554,7 +505,7 @@ void FormParagraph::extra_update()
        fl_set_object_lcol(extra_->radio_pextra_middle, FL_INACTIVE);
        fl_deactivate_object(extra_->radio_pextra_bottom);
        fl_set_object_lcol(extra_->radio_pextra_bottom, FL_INACTIVE);
-       CheckParagraphInput(extra_->radio_pextra_floatflt, 0);
+       input(extra_->radio_pextra_floatflt, 0);
     } else {
        fl_set_button(extra_->radio_pextra_indent, 0);
        fl_set_button(extra_->radio_pextra_minipage, 0);
@@ -569,93 +520,13 @@ void FormParagraph::extra_update()
        fl_set_object_lcol(extra_->radio_pextra_middle, FL_INACTIVE);
        fl_deactivate_object(extra_->radio_pextra_bottom);
        fl_set_object_lcol(extra_->radio_pextra_bottom, FL_INACTIVE);
-       CheckParagraphInput(0, 0);
+       input(0, 0);
     }
     fl_hide_object(dialog_->text_warning);
 }
 
 
-void FormParagraph::free()
-{
-    if (dialog_) {
-        hide();
-        if (general_) {
-//            fl_free_form(general_->form);
-            delete general_;
-            general_ = 0;
-        }
-        if (extra_) {
-//            fl_free_form(extra_->form);
-            delete extra_;
-            extra_ = 0;
-        }
-//        fl_free_form(dialog_->form);
-        delete dialog_;
-        dialog_ = 0;
-    }
-}
-
-
-int FormParagraph::WMHideCB(FL_FORM * form, void *)
-{
-    // Ensure that the signals (u and h) are disconnected even if the
-    // window manager is used to close the popup.
-    FormParagraph * pre = static_cast<FormParagraph*>(form->u_vdata);
-    pre->hide();
-    pre->bc_->hide();
-    return FL_CANCEL;
-}
-
-
-void FormParagraph::OKCB(FL_OBJECT * ob, long)
-{
-    FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
-    pre->apply();
-    pre->hide();
-    pre->bc_->ok();
-}
-
-
-void FormParagraph::ApplyCB(FL_OBJECT * ob, long)
-{
-    FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
-    pre->apply();
-    pre->bc_->apply();
-}
-
-
-void FormParagraph::CancelCB(FL_OBJECT * ob, long)
-{
-    FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
-    pre->cancel();
-    pre->hide();
-    pre->bc_->cancel();
-}
-
-
-void FormParagraph::RestoreCB(FL_OBJECT * ob, long)
-{
-    FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
-    pre->update();
-    pre->bc_->undoAll();
-}
-
-
-void FormParagraph::InputCB(FL_OBJECT * ob, long)
-{
-    FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
-    pre->bc_->valid(pre->CheckParagraphInput(ob,0));
-}
-
-
-void FormParagraph::VSpaceCB(FL_OBJECT * ob, long)
-{
-    FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
-    pre->bc_->valid(pre->CheckParagraphInput(ob,0));
-}
-
-
-bool FormParagraph::CheckParagraphInput(FL_OBJECT * ob, long)
+bool FormParagraph::input(FL_OBJECT * ob, long)
 {
     bool ret = true;
 
@@ -841,3 +712,4 @@ bool FormParagraph::CheckParagraphInput(FL_OBJECT * ob, long)
     }
     return ret;
 }
+
index b34a1e23d435a5b56181da6604064d54d4f67f45..7dc7633316693cee791dd541068333d5d7773989 100644 (file)
 #ifndef FORM_PARAGRAPH_H
 #define FORM_PARAGRAPH_H
 
-#include "DialogBase.h"
-#include <boost/utility.hpp>
-#include <vector>
+#include "FormBase.h"
 
 #ifdef __GNUG_
 #pragma interface
 #endif
 
-class LyXView;
-class Dialogs;
-class NoRepeatedApplyReadOnlyPolicy;
-//template <class x> class ButtonController;
-class ButtonController;
 
 struct FD_form_tabbed_paragraph;
 struct FD_form_paragraph_general;
 struct FD_form_paragraph_extra;
 
-#ifdef SIGC_CXX_NAMESPACES
-using SigC::Connection;
-#endif
-
 /** This class provides an XForms implementation of the FormParagraph Popup.
-    The table-layout-form here changes values for latex-tabulars
  */
-class FormParagraph : public DialogBase, public noncopyable {
+class FormParagraph : public FormBase {
 public:
-    FormParagraph(LyXView *, Dialogs *);
-    ~FormParagraph();
-    ///
-    static  int WMHideCB(FL_FORM *, void *);
-    static void OKCB(FL_OBJECT *, long);
-    static void ApplyCB(FL_OBJECT *, long);
-    static void CancelCB(FL_OBJECT *, long);
-    static void RestoreCB(FL_OBJECT *, long);
-    static void InputCB(FL_OBJECT *, long);
-    static void VSpaceCB(FL_OBJECT *, long);
-    ///
-    enum EnumPopupStatus {
-       ///
-        POPUP_UNMODIFIED,
        ///
-        POPUP_MODIFIED,
+       FormParagraph(LyXView *, Dialogs *);
        ///
-        POPUP_READONLY
-    };
+       ~FormParagraph();
 
 private:
-    /// Create the popup if necessary, update it and display it.
-    void show();
-    /// Hide the popup.
-    void hide();
-    /// Update the popup.
-    void update();
-    ///
-    void general_update();
-    ///
-    void extra_update();
-    /// Apply from popup
-    void apply();
-    ///
-    void general_apply();
-    ///
-    void extra_apply();
-    /// Cancel from popup
-    void cancel();
-    /// Build the popup
-    void build();
-    /// Explicitly free the popup.
-    void free();
-    ///
-    bool CheckParagraphInput(FL_OBJECT * ob, long);
+       /// Build the popup
+       void build();
+       /// Apply from popup
+       void apply();
+       /// Update the popup.
+       void update();
+       /// Filter the inputs on callback from xforms
+       virtual bool input(FL_OBJECT * ob, long);
 
+       ///
+       virtual FL_FORM * form() const;
+       
+       ///
+       void general_update();
+       ///
+       void extra_update();
+       ///
+       void general_apply();
+       ///
+       void extra_apply();
 
-    /// Typedefinitions from the fdesign produced Header file
-    FD_form_tabbed_paragraph * build_tabbed_paragraph();
-    ///
-    FD_form_paragraph_general * build_paragraph_general();
-    ///
-    FD_form_paragraph_extra * build_paragraph_extra();
+       /// Typedefinitions from the fdesign produced Header file
+       FD_form_tabbed_paragraph * build_tabbed_paragraph();
+       ///
+       FD_form_paragraph_general * build_paragraph_general();
+       ///
+       FD_form_paragraph_extra * build_paragraph_extra();
 
-    /// Real GUI implementation.
-    FD_form_tabbed_paragraph  * dialog_;
-    ///
-    FD_form_paragraph_general * general_;
-    ///
-    FD_form_paragraph_extra   * extra_;
-    /// 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;
-    ///
-       ButtonController/*<NoRepeatedApplyReadOnlyPolicy>*/ * bc_;
+       /// Real GUI implementation.
+       FD_form_tabbed_paragraph  * dialog_;
+       ///
+       FD_form_paragraph_general * general_;
+       ///
+       FD_form_paragraph_extra   * extra_;
 };
 
 #endif
index d072a41950d771129384e77236678d64a93520e9..90e7ccf9385e445f87ddbf3114d25a4050411be8 100644 (file)
@@ -28,7 +28,8 @@ using SigC::slot;
 
 
 FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
-       : FormBase(lv, d, BUFFER_INDEPENDENT, _("Preferences"), new PreferencesPolicy),
+       : FormBase(lv, d, _("Preferences"),
+                  BUFFER_INDEPENDENT, HIDE, new PreferencesPolicy),
          dialog_(0), outputs_tab_(0), look_n_feel_tab_(0), inputs_tab_(0),
          lnf_general_(0), screen_fonts_(0), interface_fonts_(0),
          printer_(0), paths_(0), minw_(0), minh_(0)
index 4e307c010d34b6b997c90008ce53b301900c3bb0..d25649d8a22be605621d01f7de50cf7af2021b06 100644 (file)
@@ -34,7 +34,8 @@ using Liason::getPrinterParams;
 
 
 FormPrint::FormPrint(LyXView * lv, Dialogs * d)
-       : FormBase(lv, d, BUFFER_DEPENDENT, _("Print"), new OkApplyCancelPolicy),
+       : FormBase(lv, d, _("Print"),
+                  BUFFER_DEPENDENT, HIDE, new OkApplyCancelPolicy),
          dialog_(0), target_(2), order_(2), which_(3)
 {
        // let the dialog be shown
index 4f88cc91e2402a62f883d36b224ac17786df1fc6..83aa0e928e372ea11221f027c2f467554fee41c8 100644 (file)
@@ -34,7 +34,7 @@ static int formw;
 static int formh;
 
 FormRef::FormRef(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Reference")), toggle(GOBACK), dialog_(0)
+       : FormCommand(lv, d, _("Reference"), HIDE), toggle(GOBACK), dialog_(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
index 471670889304d7ffb81e8e3e177cbfa8bf91d9f4..a1877c6fb79fbfbdb22adb729ff144a5b340540a 100644 (file)
@@ -28,7 +28,7 @@
 #include "support/lstrings.h"
 
 FormToc::FormToc(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Table of Contents")), dialog_(0)
+       : FormCommand(lv, d, _("Table of Contents"), UPDATE), dialog_(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
index 548141b750d76d2d955ccddfaf890d946ef8f1cb..78cf623e0f1fcae560609840c24afc462932ea5b 100644 (file)
@@ -26,7 +26,7 @@
 #include "lyxfunc.h"
 
 FormUrl::FormUrl(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Url")), minh(0), minw(0), dialog_(0)
+       : FormCommand(lv, d, _("Url"), HIDE), minh(0), minw(0), dialog_(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
index 85848504604c010ee61c54ced8870ef9a1cb0348..6e692984c1f92913e1daa91263fbedd71c1043ab 100644 (file)
@@ -135,7 +135,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_West FL_East
 name: input_labelwidth
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -171,7 +171,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: check_lines_top
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -189,7 +189,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: check_lines_bottom
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -207,7 +207,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: check_pagebreaks_top
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -225,7 +225,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: check_pagebreaks_bottom
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -243,7 +243,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: check_noindent
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -279,7 +279,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_align_right
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -297,7 +297,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_align_left
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -315,7 +315,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_align_block
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -333,7 +333,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_align_center
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -369,7 +369,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: input_space_above
-callback: C_FormParagraphVSpaceCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -387,7 +387,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: input_space_below
-callback: C_FormParagraphVSpaceCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -405,7 +405,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: choice_space_above
-callback: C_FormParagraphVSpaceCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -423,7 +423,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: choice_space_below
-callback: C_FormParagraphVSpaceCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -513,7 +513,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: check_space_above
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -531,7 +531,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: check_space_below
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 =============== FORM ===============
@@ -645,7 +645,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: input_pextra_width
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -663,7 +663,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: input_pextra_widthp
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -735,7 +735,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_pextra_top
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -753,7 +753,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_pextra_middle
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -771,7 +771,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_pextra_bottom
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -807,7 +807,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_pextra_hfill
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -825,7 +825,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_pextra_startmp
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -861,7 +861,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_pextra_indent
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -879,7 +879,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_pextra_minipage
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -897,7 +897,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_pextra_floatflt
-callback: C_FormParagraphInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -975,7 +975,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_cancel
-callback: C_FormParagraphCancelCB
+callback: C_FormBaseCancelCB
 argument: 0
 
 --------------------
@@ -993,7 +993,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_apply
-callback: C_FormParagraphApplyCB
+callback: C_FormBaseApplyCB
 argument: 0
 
 --------------------
@@ -1011,7 +1011,7 @@ shortcut: ^M
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_ok
-callback: C_FormParagraphOKCB
+callback: C_FormBaseOKCB
 argument: 0
 
 --------------------
@@ -1029,7 +1029,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_restore
-callback: C_FormParagraphRestoreCB
+callback: C_FormBaseRestoreCB
 argument: 0
 
 --------------------