]> git.lyx.org Git - features.git/commitdiff
Angus's FormInset work; Dekel's languages patch; my reworking of Angus's stuff +...
authorAllan Rae <rae@lyx.org>
Fri, 13 Oct 2000 05:57:05 +0000 (05:57 +0000)
committerAllan Rae <rae@lyx.org>
Fri, 13 Oct 2000 05:57:05 +0000 (05:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1110 a592a061-630c-0410-9148-cb99ea01b6c8

75 files changed:
ChangeLog
lib/lyxrc.example
po/Makefile.in.in
po/POTFILES.in
src/BufferView_pimpl.C
src/buffer.C
src/encoding.C
src/frontends/ButtonPolicies.h
src/frontends/DialogBase.h
src/frontends/Dialogs.h
src/frontends/gnome/FormCitation.C
src/frontends/gnome/FormCitation.h
src/frontends/gnome/FormCopyright.h
src/frontends/gnome/FormError.C
src/frontends/gnome/FormError.h
src/frontends/gnome/FormIndex.C
src/frontends/gnome/FormIndex.h
src/frontends/gnome/FormPrint.C
src/frontends/gnome/FormPrint.h
src/frontends/gnome/FormRef.h
src/frontends/gnome/FormToc.C
src/frontends/gnome/FormToc.h
src/frontends/gnome/FormUrl.C
src/frontends/gnome/FormUrl.h
src/frontends/kde/FormCitation.C
src/frontends/kde/FormCitation.h
src/frontends/kde/FormCopyright.h
src/frontends/kde/FormIndex.C
src/frontends/kde/FormIndex.h
src/frontends/kde/FormPrint.C
src/frontends/kde/FormPrint.h
src/frontends/kde/FormRef.C
src/frontends/kde/FormRef.h
src/frontends/kde/FormToc.C
src/frontends/kde/FormToc.h
src/frontends/kde/FormUrl.C
src/frontends/kde/FormUrl.h
src/frontends/xforms/FormBase.C
src/frontends/xforms/FormBase.h
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormCitation.h
src/frontends/xforms/FormCommand.C [deleted file]
src/frontends/xforms/FormCommand.h [deleted file]
src/frontends/xforms/FormCopyright.C
src/frontends/xforms/FormCopyright.h
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormDocument.h
src/frontends/xforms/FormError.C
src/frontends/xforms/FormError.h
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/FormGraphics.h
src/frontends/xforms/FormIndex.C
src/frontends/xforms/FormIndex.h
src/frontends/xforms/FormInset.C [new file with mode: 0644]
src/frontends/xforms/FormInset.h [new file with mode: 0644]
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/FormParagraph.h
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/FormPreferences.h
src/frontends/xforms/FormPrint.C
src/frontends/xforms/FormPrint.h
src/frontends/xforms/FormRef.C
src/frontends/xforms/FormRef.h
src/frontends/xforms/FormTabular.C
src/frontends/xforms/FormTabular.h
src/frontends/xforms/FormToc.C
src/frontends/xforms/FormToc.h
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormUrl.h
src/frontends/xforms/Makefile.am
src/frontends/xforms/form_preferences.C
src/frontends/xforms/form_preferences.h
src/frontends/xforms/forms/form_preferences.fd
src/lyx_gui_misc.C
src/lyx_gui_misc.h

index ddb68201131145585481f7ee7c8577241b125fae..c160990810f78a819e43b277198efa91290edc70 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,129 @@
+2000-10-12  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * src/encoding.C (read): Fixed bug that caused an error message at 
+       the end of the file.
+
+       * po/Makefile.in.in: Fixed rule for ext_l10n.h
+
+       * lib/lyxrc.example: Fixed hebrew example.
+
+2000-10-13  Allan Rae  <rae@lyx.org>
+
+       * src/frontends/xforms/FormPreferences.C (input): reworking the checking
+       (build, update, apply): New inputs in various tabfolders
+
+       * src/frontends/xforms/FormToc.C: use new button policy.
+       * src/frontends/ButtonPolicies.h (class IgnorantPolicy): for dialogs that
+       either can't use any existing policy or where it just doesn't care.
+
+       * src/frontends/xforms/FormTabular.h: removed copyright notice that
+       said it was mine.
+
+       * src/lyx_gui_misc.[Ch] (updateAllVisibleBufferRelatedDialogs): added a
+       bool parameter which is ignored.
+
+       * src/buffer.C (setReadonly):
+       * src/BufferView_pimpl.C (buffer): 
+       * src/frontends/kde/FormCopyright.h (update): 
+       * src/frontends/kde/FormCitation.[Ch] (update): 
+       * src/frontends/kde/FormIndex.[Ch] (update): 
+       * src/frontends/kde/FormPrint.[Ch] (update): 
+       * src/frontends/kde/FormRef.[Ch] (update): 
+       * src/frontends/kde/FormToc.[Ch] (update): 
+       * src/frontends/kde/FormUrl.[Ch] (update): 
+       * src/frontends/gnome/FormCopyright.h (update): 
+       * src/frontends/gnome/FormCitation.[Ch] (update): 
+       * src/frontends/gnome/FormError.[Ch] (update): 
+       * src/frontends/gnome/FormIndex.[Ch] (update): 
+       * src/frontends/gnome/FormPrint.[Ch] (update): 
+       * src/frontends/gnome/FormRef.h (update): 
+       * src/frontends/gnome/FormToc.[Ch] (update): 
+       * src/frontends/gnome/FormUrl.[Ch] (update): 
+       * src/frontends/xforms/FormGraphics.[Ch] (update): reflect new changes
+       to updateBufferDependent and DialogBase
+
+       * src/frontends/xforms/FormCitation.[hC]: 
+       * src/frontends/xforms/FormDocument.[hC]: also removed restore()
+       * src/frontends/xforms/FormError.[Ch]: 
+       * src/frontends/xforms/FormGraphics.[Ch]: 
+       * src/frontends/xforms/FormIndex.[Ch]: 
+       * src/frontends/xforms/FormParagraph.[Ch]: also added missing "virtual"s
+       and fixed readOnly handling.
+       * src/frontends/xforms/FormPrint.[Ch]: 
+       * src/frontends/xforms/FormRef.[Ch]: 
+       * src/frontends/xforms/FormTabular.[Ch]:
+       * src/frontends/xforms/FormToc.[Ch]:
+       * src/frontends/xforms/FormUrl.[Ch]: 
+       * src/frontends/xforms/FormInset.[Ch]:
+       * src/frontends/xforms/FormBase.[hC]: modifications to use the new
+       form of updateBufferDependent.
+
+       * src/frontends/xforms/FormBase.C (hide): only call disconnect()
+       if form()->visible just in case someone does stuff to the form in a
+       derived class.
+
+       * src/frontends/DialogBase.h (enum): removed enum since we can now use
+       the buttoncontroller for everything the enum used to be used for.
+       (update) It would seem we need to force all dialogs to use a bool
+       parameter or have two update functions.  I chose to go with one.
+       I did try removing update() from here and FormBase and defining the
+       appropriate update signatures in FormBaseB[DI] but then ran into the
+       problem of the update() call in FormBase::show().  Whatever I did to get
+       around that would require another function and that just got more
+       confusing.  Hence the decision to make everyone have an update(bool).
+       An alternative might have been to override show() in FormBaseB[DI] and
+       that would allow the different and appropriate update signatures.
+
+       * src/frontends/Dialogs.h (updateBufferDependent): now takes a bool.
+       true == buffer change occurred.  I decided against using a default
+       template parameter since not all compilers support that at present.
+
+2000-10-11  Angus Leeming <a.leeming@ic.ac.uk>
+
+       * src/frontends/xforms/FormBase.[Ch] (FormBase) : made less of a "swiss
+       army knife" by removing functionality.
+       (clearStore): removed. All such housekeeping on hide()ing the dialog
+       is to be carried out by overloaded disconnect() methods.
+       (dialogIsOpen): removed. Relevant only to Inset dialogs anyway, but
+       superceded by Baruch's neat test (FormGraphics) to update an existing
+       dialog if a new signal is recieved rather than block all new signals
+       until it is closed.
+       (cba_, parent_, updateOrHide): removed to new FormInset class. Relevant
+       only to Inset dialogs.
+       (FormBaseBI, FormBaseBD): new classes derived from FormBase for
+       "Buffer Independent" and "Buffer Dependent" dialogs respectively.
+
+       * src/frontends/xforms/FormCommand.[Ch]: renamed as FormInset.[Ch]
+
+       * src/frontends/xforms/FormInset.[Ch] (FormInset): New class, defined
+       as a base class to all inset dialogs. Used solely to connect/disconnect
+       the Inset::hide signal and to define what action to take on receipt of
+       a UpdateBufferDependent signal.
+       (FormCommand): now derived from FormInset.
+
+       * src/frontends/xforms/FormCitation.[Ch] (clearStore): reworked as
+       disconnect().
+
+       * src/frontends/xforms/FormCopyright.[Ch]:
+       * src/frontends/xforms/FormPreferences.[Ch]:
+       now derived from FormBaseBI.
+
+       * src/frontends/xforms/FormDocument.[Ch]:
+       * src/frontends/xforms/FormParagraph.[Ch]:
+       * src/frontends/xforms/FormPrint.[Ch]:
+       now derived from FormBaseBD.
+
+       * src/frontends/xforms/FormError.[Ch]: now derived from FormInset.
+
+       * src/frontends/xforms/FormCitation.[Ch]:
+       * src/frontends/xforms/FormError.[Ch]:
+       * src/frontends/xforms/FormRef.[Ch]:
+       * src/frontends/xforms/FormToc.[Ch]:
+       (clearStore): reworked as disconnect().
+
+       * src/frontends/xforms/Makefile.am: removed FormCommand.[Ch], adding
+       FormInset.[Ch].
+
 2000-10-12  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * src/converter.C (runLaTeX): constify buffer argument
index 0671b21f7706a5cb95b3feb699903735be457a3b..e30863e900aa283f427dc3f227a9267c4c7984fc 100644 (file)
 #\kbmap true
 #\kbmap_primary null
 #\kbmap_secondary hebrew
-#\converter tex dvi elatex
-#\converter tex pdf pdfelatex
+#\converter tex dvi elatex ""
+#\converter tex pdf pdfelatex ""
 #\font_encoding default
 
 # You also need to bind a key for switching between Hebrew and English.
index 6748cd12356238973f0715d85b59fb81a6cb658a..79c9539b8b990fea4a60980606abb15f2851bc26 100644 (file)
@@ -109,12 +109,12 @@ $(srcdir)/stamp-cat-id: $(PACKAGE).pot
        fi
        cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
 
-$(top_srcdir)/src/ext_l10n.h: $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc $(top_srcdir)/lib/ui/default.ui
+$(top_srcdir)/src/ext_l10n.h: $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc $(top_srcdir)/lib/ui/default.ui $(top_srcdir)/lib/languages
        grep -i -E "submenu|item|optitem" < $(top_srcdir)/lib/ui/default.ui | cut -d '"' -f 2 | \
                awk '{printf "_(\"%s\");\n", $$0}' > $@
        cat $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc | grep -i -E "[ ]*style .+$$" | \
                cut -d ' ' -f 2 | sort | uniq | awk '{printf "_(\"%s\");\n", $$0}' >> $@
-       awk -F '"' '$2 {printf "_(\"%s\");\n", $2}' < $(top_srcdir)/lib/languages >> $@
+       awk -F '"' '$$2 {printf "_(\"%s\");\n", $$2}' < $(top_srcdir)/lib/languages >> $@
 
 install: install-exec install-data
 install-exec:
index 48d0764b7ff2a14104889a093fa3a7e6a7cc396f..53b1e41fe9e126876d24b2fad355065cbce4c883 100644 (file)
@@ -48,6 +48,7 @@ src/frontends/xforms/FormGraphics.C
 src/frontends/xforms/form_graphics.C
 src/frontends/xforms/FormIndex.C
 src/frontends/xforms/form_index.C
+src/frontends/xforms/FormInset.h
 src/frontends/xforms/FormParagraph.C
 src/frontends/xforms/form_paragraph.C
 src/frontends/xforms/FormPreferences.C
index 993db847162302b2fd132335453cbb49a34305d4..8469d5a227a69be2f1a87e4bd78625616b7a98c8 100644 (file)
@@ -164,7 +164,7 @@ void BufferView::Pimpl::buffer(Buffer * b)
                // Similarly, buffer-dependent dialogs should be updated or
                // hidden. This should go here because some dialogs (eg ToC)
                // require bv_->text.
-               owner_->getDialogs()->updateBufferDependent();
+               owner_->getDialogs()->updateBufferDependent(true);
                redraw();
                bv_->insetWakeup();
        } else {
index ce8236d8a9a519c3f95e8be8042904ab644d3724..512fa58591cab78dbfe62e305ba0f47a5aa18777 100644 (file)
@@ -179,7 +179,7 @@ void Buffer::setReadonly(bool flag)
        if (read_only != flag) {
                read_only = flag; 
                updateTitles();
-               users->owner()->getDialogs()->updateBufferDependent();
+               users->owner()->getDialogs()->updateBufferDependent(false);
        }
        if (read_only) {
                WarnReadonly(filename);
index ff31f0f04776f95f48aa9b726700a325378bc8d2..d875235781387369c7222ec144eba5c8037aa044 100644 (file)
@@ -333,6 +333,8 @@ void Encodings::read(string const & filename)
                case et_end:
                        lex.printError("Encodings::read: Misplaced end");
                        break;
+               case LyXLex::LEX_FEOF:
+                       break;
                default:
                        lex.printError("Encodings::read: "
                                       "Unknown tag: `$$Token'");
index 4c2c118e29d8da3660aba5a688da852683c69e18..d4d48534bdda89bb0841318ef4bb3690033b1249 100644 (file)
@@ -38,6 +38,7 @@
     NoRepeatedApply            |       N  |    Y         |     N
     NoRepeatedApplyReadOnly    |       Y  |    Y         |     N
     Preferences                        |       N  |    Y         | No (Ok-Close)
+    Ignorant                   |      N/A |    N/A       |    N/A
     ========================================================================
 
     Policy
@@ -61,6 +62,8 @@
        has its own special version of repeated apply handling because its Ok
        button is actually a Save button -- its always reasonable to Save the
        preferences if the dialog has changed since the last save.
+
+    The IgnorantPolicy is a special case that allows anything.
  */
 class ButtonPolicy : public noncopyable {
 public:
@@ -417,4 +420,27 @@ private:
        StateMachine state_machine_;
 };
 
+
+/** Defines the policy used by dialogs that are forced to support a button
+    controller when they either don't have a use for one or are not ready to
+    use one.  This may be useful when testing a new button policy but wishing
+    to minimise problems to users by supplying an anything-goes policy via a
+    preprocessor directive.
+ */
+class IgnorantPolicy : public ButtonPolicy {
+public:
+       virtual ~IgnorantPolicy() {}
+       
+       /// Trigger a transition with this input.
+       virtual void input(SMInput) {}
+       /// Activation status of a button.
+       virtual bool buttonStatus(Button) const {
+               return true;
+       }
+       /// Are we in a read-only state?
+       virtual bool isReadOnly() const {
+               return false;
+       }
+};
+
 #endif
index f25f738f1fb67b9108348e941f2114df67e92cb6..650df6a3989995a30c4aad84e28e31c011edccce 100644 (file)
@@ -50,19 +50,9 @@ public:
        virtual void show() = 0;
        ///
        virtual void hide() = 0;
-       ///
-       virtual void update() = 0;
+       /// Parameter defines if a buffer switch occurred
+       virtual void update(bool = false) = 0;
        //@}
-
-       ///
-       enum EnumDialogStatus {
-               ///
-               DIALOG_UNMODIFIED,
-               ///
-               DIALOG_MODIFIED,
-               ///
-               DIALOG_READONLY
-       };
 };
 
 #endif // DIALOGBASE_H
index 296e552e10f7d52dd8ee2fe5e0d8ad2ab59a8b2c..2e459d073a204237e9ab4cfa3edb1b6bae793e1e 100644 (file)
@@ -65,11 +65,14 @@ public:
        /// Hide all visible popups
        Signal0<void> hideAll;
        
-       /// Hide any popups that require a buffer for them to operate
+       /// Hide any dialogs that require a buffer for them to operate
        Signal0<void> hideBufferDependent;
        
-       /// Update visible, buffer-dependent popups
-       Signal0<void> updateBufferDependent;
+       /** Update visible, buffer-dependent dialogs
+           If the bool is true then a buffer change has occurred
+           else its still the same buffer.
+        */
+       Signal1<void, bool> updateBufferDependent;
        //@}
 
        /**@name Dialog Access Signals.
index d1eb4b567a81e3716297faa0b979803cfd032253..82ab4be9df039c2a1285d738216d53eee0b6ae15 100644 (file)
@@ -94,6 +94,9 @@ void FormCitation::showInset( InsetCommand * const inset )
   inset_ = inset;
   ih_ = inset_->hide.connect(slot(this, &FormCitation::hide));
 
+#ifdef WITH_WARNINGS
+#warning This connection to update will do nothing!
+#endif
   u_ = d_->updateBufferDependent.connect(slot(this, &FormCitation::update));
   h_ = d_->hideBufferDependent.connect(slot(this, &FormCitation::hide));
   
index 1335c2e361dfba218f324e53d694915044aad380..fea9e546fe63a656b377e307999a98cf58832b26 100644 (file)
@@ -46,7 +46,7 @@ private:
   void showInset( InsetCommand * const );
 
   /// The following three methods do nothing in this implementation
-  virtual void update() { }
+  virtual void update(bool = false) { }
   virtual void apply() { }
   void show() { }
 
index 216fbd70bcd52eb910781f11cf0d537eb08e38d3..62d2efb8678d03c2296d842958fdab735b30185c 100644 (file)
@@ -36,7 +36,7 @@ private:
        /// Hide the dialog.
        void hide();
        /// Not used but we've got to implement it.
-       void update() {}
+       void update(bool) {}
 
        /// Real GUI implementation.
         Gnome::About * dialog_;
index 18e04ce414791df7741c5d533ba49b24783c6913..0e6f8d999c98d2a99a0870d0580eb8eaab35a040 100644 (file)
@@ -102,7 +102,7 @@ void FormError::show()
     }
 }
       
-void FormError::update()
+void FormError::update(bool)
 {
 }
 
index 66f8b405d4c78f41b4ef8057eba707864d984957..ba2d2ab5b5e0e074a0c330ad41c69ef2ee87fc91 100644 (file)
@@ -36,7 +36,7 @@ private:
   void showInset( InsetError * const );
   
   /// Update dialog before showing it
-  virtual void update();
+  virtual void update(bool = false);
   /// Apply from dialog (modify or create inset)
   virtual void apply();
   /// Explicitly free the dialog.
index d0749801f23979f392bd4123e82c4338f678048f..50fefe63c1fbf42d9e91653844628802e4c06056 100644 (file)
@@ -138,8 +138,13 @@ void FormIndex::show()
     }
 }
       
-void FormIndex::update()
+void FormIndex::update(bool switched)
 {
+  if (switched) {
+      hide();
+      return;
+  }
+
   if (dialog_ != NULL &&
       lv_->view()->available())
     {
index c79f405eeee23a06476276187f81897568c7b66c..b31244c7b94d90376dcee8866873281887b1ea3c 100644 (file)
@@ -40,7 +40,7 @@ private:
   void showInset( InsetCommand * const );
   
   /// Update dialog before showing it
-  virtual void update();
+  virtual void update(bool = false);
   /// Apply from dialog (modify or create inset)
   virtual void apply();
   /// Explicitly free the dialog.
index 0a2551083cffc8d1fab1462c8a56e895f26ef218..4af90ad48f66d2a3bf30db2cd89d32578b5e9c45 100644 (file)
@@ -169,7 +169,8 @@ void FormPrint::apply()
 }
 
 
-void FormPrint::update()
+// we can safely ignore the parameter because we can always update
+void FormPrint::update(bool)
 {
   if (dialog_ != NULL &&
       lv_->view()->available())
index b332ccaa41d9d8d6c4bc496846b512ba556862e1..3c82c1150acf1de873416e874b1348e66f6eea70 100644 (file)
@@ -58,7 +58,7 @@ private:
   /// Hide the dialog.
   void hide();
   /// Update the dialog.
-  void update();
+  void update(bool = false);
   /// Free memory
   void free();
   //@}
index e3aa8ee760e6cc75990b8e2e1067d613324e1496..f02b6fe6ec319e8b71a659cbb29296e452af4f05 100644 (file)
@@ -72,7 +72,7 @@ private:
   void showInset( InsetCommand * const );
   
   /// Update dialog before showing it (not used in this implementation)
-  virtual void update() { hide(); }
+  virtual void update(bool = false) { hide(); }
   /// Apply from dialog (modify or create inset)
   virtual void apply();
   /// Explicitly free the dialog.
index 6adbee8497b7b496e03e35633afe343d4cc6257e..0779e6eec4e5d9c022e9d47ad09de99690ba5f94 100644 (file)
@@ -136,7 +136,8 @@ void FormToc::show()
 }
 
 
-void FormToc::update()
+// we can safely ignore the parameter because we can always update
+void FormToc::update(bool)
 {
   Buffer::TocType type;
   string wintitle;
index cd472ef6e60d5d5ecdad405410b1809e6046a21b..f7d541a332c3aedeb1cda9cdc14c34d41372d67e 100644 (file)
@@ -41,7 +41,7 @@ private:
   void showInset( InsetCommand * const );
   
   /// Update dialog before showing it
-  virtual void update();
+  virtual void update(bool = false);
   /// Explicitly free the dialog.
   void free();
   /// Create the dialog if necessary, update it and display it.
index fff6d58fb16b3003aaee032748081b555e6895f8..bba80737b5b1e34cd8baf4d2da122d4578d4d884 100644 (file)
@@ -150,8 +150,13 @@ void FormUrl::show()
     }
 }
 
-void FormUrl::update()
+void FormUrl::update(bool switched)
 {
+  if (switched) {
+      hide();
+      return;
+  }
+
   if (dialog_ != NULL &&
       lv_->view()->available())
     {
index 08607d629e3e6f84f03789329b16bb94f5e3c8e7..ea16dd83e064c344cf2653a5c44661f3012a78a4 100644 (file)
@@ -45,7 +45,7 @@ private:
   void showInset( InsetCommand * const );
   
   /// Update dialog before showing it
-  virtual void update();
+  virtual void update(bool = false);
   /// Apply from dialog (modify or create inset)
   virtual void apply();
   /// Explicitly free the dialog.
index 609f88727a6032819ff667774ba385fd771423b3..3204745bbc5dd01a846efafc2790e9a773d19d20 100644 (file)
@@ -109,7 +109,9 @@ void FormCitation::updateAvailableList()
        dialog_->keys->update();
 }
  
-void FormCitation::update()
+
+// we can safely ignore the parameter because we can always update
+void FormCitation::update(bool)
 {
        keys.clear();
  
index 50ea6ccf956a17a0a6e0ce45ce7b3fd123cbf24e..6d8bd5a34508cd6b922b4e25932971357bcdf81d 100644 (file)
@@ -61,7 +61,7 @@ private:
        /// Hide the dialog.
        void hide();
        /// Update the dialog.
-       void update();
+       void update(bool switched = false);
 
        /// create a Citation inset
        void createCitation(string const &);
index f443f6e4d221fde9dfc6aa96888ebbd62a101533..0b3b7a6ce97eb6f1ff54a0e637665b28871e0c0a 100644 (file)
@@ -39,7 +39,7 @@ private:
        /// Hide the dialog.
        void hide();
        /// Not used but we've got to implement it.
-       void update() {}
+       void update(bool) {}
 
        /// Real GUI implementation.
        FormCopyrightDialog * dialog_;
index 790e655734a5f4ada2623d3e1feb5d187d67a15a..3fbde1cbefb830286910dc4db0d20c01acfb8573 100644 (file)
@@ -63,8 +63,13 @@ void FormIndex::createIndex(string const & arg)
        show();
 }
  
-void FormIndex::update()
+void FormIndex::update(bool switched)
 {
+       if (switched) {
+               hide();
+               return;
+       }
+
        dialog_->setIndexText(params.getContents().c_str());
 //     dialog_->setReadOnly(readonly);
 }
index 09d4b7b5952965ae3e3a35e6d123dbd9ec580825..3eb277c712a382e9568badec6c2fe3a79e8ebd03 100644 (file)
@@ -45,7 +45,7 @@ private:
        /// Hide the dialog.
        void hide();
        /// Update the dialog.
-       void update();
+       void update(bool = false);
 
        /// create an Index inset
        void createIndex(string const &);
index bdcf5fc10e8a80d3e14e25d15ee05bc1a69d4459..fd1bcbd17e5d407c203a416ab39307140ea5901e 100644 (file)
@@ -52,7 +52,8 @@ FormPrint::~FormPrint()
        delete dialog_;
 }
 
-void FormPrint::update()
+// we can safely ignore the parameter because we can always update
+void FormPrint::update(bool)
 {
        if (!lv_->view()->available())
               return;
index 12a50a0f0408afc5823fa35391244dfc70a38141..97856befa4f18ec3981409151c27b748d927ff6a 100644 (file)
@@ -43,7 +43,7 @@ private:
        /// Hide the dialog.
        void hide();
        /// Update the dialog.
-       void update();
+       void update(bool = false);
 
        /// Real GUI implementation.
        FormPrintDialog * dialog_;
index ab77dad6769d21521f9d8e2d817c6e54f0455cdd..ea38d8ad4e0bc48dab199736fc6c41a5930d3965 100644 (file)
@@ -154,8 +154,13 @@ void FormRef::do_ref_update()
        updateRefs();
 }
 
-void FormRef::update()
+void FormRef::update(bool switched)
 {
+       if (switched) {
+               hide();
+               return;
+       }
+
        dialog_->reference->setText(params.getContents().c_str());
        dialog_->refname->setText(params.getOptions().c_str());
 
index ffb364c35424fa6c0839058650a5116bb2952b97..264ba94521ddde0b9344286902acb1f2949cffd9 100644 (file)
@@ -43,7 +43,7 @@ public:
        /// goto a ref (or back)
        void goto_ref(); 
        /// update dialog
-       void update(); 
+       void update(bool = false); 
        /// update just the refs
        void do_ref_update();
        /// Apply changes
index bba790ea114a263b41b02ba3f58b0418a399e06f..b805c3407874b49aae313d12b8873678692cf157 100644 (file)
@@ -190,7 +190,8 @@ void FormToc::set_depth(int newdepth)
                updateToc(newdepth);
 }
 
-void FormToc::update()
+// we can safely ignore the parameter because we can always update
+void FormToc::update(bool)
 {
        if (params.getCmdName()=="tableofcontents") {
                setType(Buffer::TOC_TOC);
index d3e30e123612335f135a68b15e0111d62fbb1c64..04ac8d301a00b51665ab8113831c29dc87c46101 100644 (file)
@@ -39,7 +39,7 @@ public:
        /// Choose which type
        void set_type(Buffer::TocType);
        /// Update the dialog.
-       void update();
+       void update(bool = false);
        /// change the depth shown
        void set_depth(int);
        /// close the connections
index 395a14daabe0cb2bb22d2d5e3a79ff92ae2e0818..5b760311a9e386d6b2e72e81c59855b3b011b6ce 100644 (file)
@@ -63,8 +63,14 @@ void FormUrl::createUrl(string const & arg)
        show();
 }
  
-void FormUrl::update()
+void FormUrl::update(bool switched)
 {
+       if (switched) {
+               // I suspect a buffer switch should cause hide() here. ARRae
+               hide();
+               return;
+       }
+
        dialog_->url->setText(params.getContents().c_str());
        dialog_->urlname->setText(params.getOptions().c_str());
 
index f9519e2652736ea880904ffdf66a59cc813e06eb..ae084ceaaf311f5e6b0b41acca940406ddf355dd 100644 (file)
@@ -45,7 +45,7 @@ private:
        /// Hide the dialog.
        void hide();
        /// Update the dialog.
-       void update();
+       void update(bool switched = false);
 
        /// create a URL inset
        void createUrl(string const &);
index f867da3c9ed4f1ce856939ad7c6bada19d70ad63..b0ebbc3f18bdd5371dbcc8628438e63e81dc63fc 100644 (file)
@@ -31,10 +31,8 @@ C_GENERICCB(FormBase, RestoreCB)
 
 
 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),
-         d_(d), bd_(bd), cba_(cba), parent_(0), u_(0), h_(0), title(t), bp_(bp)
+       : lv_(lv), bc_(bp, cancel, close), d_(d), h_(0), title(t), bp_(bp)
 {}
 
 
@@ -52,13 +50,10 @@ void FormBase::show()
                                    C_FormBaseWMHideCB, 0);
        }
 
-       parent_ = lv_->buffer();
-       
        fl_freeze_form( form() );
        update();  // make sure its up-to-date
        fl_unfreeze_form( form() );
 
-       dialogIsOpen = true;
        if (form()->visible) {
                fl_raise_form(form());
        } else {
@@ -74,48 +69,11 @@ void FormBase::show()
 void FormBase::hide()
 {
        if (form() && form()->visible) {
-               fl_hide_form(form());
+               // some dialogs might do things to the form first
+               // such as the nested tabfolder problem in Preferences
                disconnect();
+               fl_hide_form(form());
        }
-
-       // free up the dialog for another inset
-       dialogIsOpen = false;
-       parent_ = 0;
-       clearStore();
-}
-
-
-void FormBase::connect()
-{
-       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;
-       }
-}
-
-
-void FormBase::disconnect()
-{
-       u_.disconnect();
-       h_.disconnect();
-}
-
-
-void FormBase::updateOrHide()
-{
-       if( cba_ == UPDATE )
-               update();
-       else if( parent_ == lv_->buffer() )
-               update();
-       else
-               hide();
 }
 
 
@@ -167,3 +125,46 @@ void FormBase::RestoreCB(FL_OBJECT * ob, long)
        pre->restore();
        pre->bc_.undoAll();
 }
+
+
+FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t,
+                      ButtonPolicy * bp,
+                      char const * close, char const * cancel)
+       : FormBase( lv, d, t, bp, close, cancel )
+{}
+
+
+void FormBaseBI::connect()
+{
+       h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide));
+}
+
+
+void FormBaseBI::disconnect()
+{
+       h_.disconnect();
+}
+
+
+FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t,
+                      ButtonPolicy * bp,
+                      char const * close, char const * cancel)
+       : FormBase( lv, d, t, bp, close, cancel ),
+         u_(0)
+{}
+
+
+void FormBaseBD::connect()
+{
+       u_ = d_->updateBufferDependent.
+                connect(slot(this, &FormBaseBD::update));
+       h_ = d_->hideBufferDependent.
+                connect(slot(this, &FormBaseBD::hide));
+}
+
+
+void FormBaseBD::disconnect()
+{
+       u_.disconnect();
+       h_.disconnect();
+}
index 4a29d9e2dff45009f97d4ccf36af1214b43e2a7e..87f37fd1e586d60b763c2507a06b88a16d7146dd 100644 (file)
@@ -27,34 +27,17 @@ class LyXView;
 #pragma interface
 #endif
 
-/** This class is an XForms GUI base class
+/** This class is an XForms GUI base class.
+    It is meant to be used solely as the parent class to FormBaseBI and FormBaseBD
     @author Angus Leeming
  */
 class FormBase : public DialogBase, public noncopyable {
 public:
-       ///
-       enum BufferDependency {
-               ///
-               BUFFER_DEPENDENT,
-               ///
-               BUFFER_INDEPENDENT
-       };
-       ///
-       enum ChangedBufferAction {
-               ///
-               UPDATE,
-               ///
-               HIDE
-       };
-
        /** Constructor.
            #FormBase(lv, d, _("DialogName"), BUFFER_DEPENDENT, new ButtonPolicy)#
         */
        FormBase(LyXView *, Dialogs *, string const &,
-                BufferDependency, ChangedBufferAction,
-                ButtonPolicy * bp = new OkApplyCancelReadOnlyPolicy,
-                char const * close = N_("Close"),
-                char const * cancel = N_("Cancel"));
+                ButtonPolicy *, char const *, char const *);
        ///
        virtual ~FormBase();
 
@@ -76,10 +59,12 @@ protected: // methods
        void show();
        /// Hide the dialog.
        virtual void hide();
-       /// Connect signals
-       virtual void connect();
-       /// Disconnect signals
-       virtual void disconnect();
+       /// bool indicates if a buffer switch took place
+       virtual void update(bool = false) {}
+       /// Connect signals. Also perform any necessary initialisation.
+       virtual void connect() = 0;
+       /// Disconnect signals. Also perform any necessary housekeeping.
+       virtual void disconnect() = 0;
        /// Build the dialog
        virtual void build() = 0;
        /** Filter the inputs on callback from xforms
@@ -88,8 +73,6 @@ protected: // methods
        virtual bool input( FL_OBJECT *, long ) {
                return true;
        }
-       /// Update dialog before showing it
-       virtual void update() {}
        /// Apply from dialog (modify or create inset)
        virtual void apply() {}
        /// OK from dialog
@@ -105,18 +88,10 @@ protected: // methods
        virtual void restore() {
                update();
        }
-       /// delete derived class variables when hide()ing
-       virtual void clearStore() {}
        /// Pointer to the actual instantiation of xform's form
        virtual FL_FORM * form() const = 0;
 
-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.
@@ -124,18 +99,8 @@ protected: // data
        LyXView * lv_;
        /// Useable even in derived-class's const functions.
        mutable ButtonController bc_;
-
-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.
        Connection h_;
        /// dialog title, displayed by WM.
@@ -144,4 +109,46 @@ private: // data
        ButtonPolicy * bp_;
 };
 
+
+/** This class is an XForms GUI base class for Buffer Independent dialogs.
+    Such dialogs do not require an update Connection although they may use
+    an update() function which is also supported by restore().
+ */
+class FormBaseBI : public FormBase {
+public:
+       /// Constructor
+       FormBaseBI(LyXView *, Dialogs *, string const &,
+                  ButtonPolicy * bp = new OkApplyCancelPolicy,
+                  char const * close = N_("Close"),
+                  char const * cancel = N_("Cancel"));
+
+protected:
+       /// Connect signals
+       virtual void connect();
+       /// Disconnect signals
+       virtual void disconnect();
+};
+
+
+/** This class is an XForms GUI base class for Buffer Dependent dialogs
+ */
+class FormBaseBD : public FormBase {
+public:
+       /// Constructor
+       FormBaseBD(LyXView *, Dialogs *, string const &,
+                  ButtonPolicy * bp = new OkApplyCancelReadOnlyPolicy,
+                  char const * close = N_("Close"),
+                  char const * cancel = N_("Cancel"));
+
+protected:
+       /// Connect signals
+       virtual void connect();
+       /// Disconnect signals
+       virtual void disconnect();
+
+       /// Update connection.
+       Connection u_;
+};
+
+
 #endif
index c3a0ab4b62bc911870754cd651c0e23c1d8d91ac..a79c6772b50069c3ddf4f72a6812cb2b883c35ba 100644 (file)
@@ -37,7 +37,7 @@ using std::find;
 static int min_wform;
 
 FormCitation::FormCitation(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Citation"), HIDE), dialog_(0)
+       : FormCommand(lv, d, _("Citation")), dialog_(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
@@ -60,11 +60,13 @@ FL_FORM * FormCitation::form() const
 }
 
 
-void FormCitation::clearStore()
+void FormCitation::disconnect()
 {
        citekeys.clear();
        bibkeys.clear();
        bibkeysInfo.clear();
+
+       FormCommand::disconnect();
 }
 
 
@@ -75,8 +77,13 @@ void FormCitation::build()
 }
 
 
-void FormCitation::update()
+void FormCitation::update(bool switched)
 {
+       if (switched) {
+               hide();
+               return;
+       }
+
        bibkeys.clear();
        bibkeysInfo.clear();
 
index 608e4975b22d0147a4516a2e5f09c33c11fcd95e..ca49a7973a273ac7cb3ca1d3cc0fe9ef9fccb620 100644 (file)
@@ -16,7 +16,7 @@
 #pragma interface
 #endif
 
-#include "FormCommand.h"
+#include "FormInset.h"
 struct FD_form_citation;
 
 /** This class provides an XForms implementation of the FormCitation Dialog.
@@ -47,16 +47,17 @@ private:
                ///
                OFF
        };
+       /// Disconnect signals. Also perform any necessary housekeeping.
+       virtual void disconnect();
+
        /// Build the dialog
        virtual void build();
        /// Filter the inputs
        virtual bool input( FL_OBJECT *, long );
        /// Update dialog before showing it
-       virtual void update();
+       virtual void update(bool switched = false);
        /// Apply from dialog (modify or create inset)
        virtual void apply();
-       /// delete derived class variables from hide()
-       virtual void clearStore();
        /// Pointer to the actual instantiation of the xform's form
        virtual FL_FORM * form() const;
 
diff --git a/src/frontends/xforms/FormCommand.C b/src/frontends/xforms/FormCommand.C
deleted file mode 100644 (file)
index 25e9b2d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// -*- C++ -*-
-/* This file is part of
- * ====================================================== 
- *
- *           LyX, The Document Processor
- *
- *           Copyright 2000 The LyX Team.
- *
- * ======================================================
- */
-
-#include <config.h>
-
-#include FORMS_H_LOCATION
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-
-#include "Dialogs.h"
-#include "FormCommand.h"
-
-FormCommand::FormCommand( LyXView * lv, Dialogs * d, string const & t,
-                         ChangedBufferAction cba, ButtonPolicy * bp )
-       : FormBase( lv, d, t, BUFFER_DEPENDENT, cba, bp ),
-         inset_(0), ih_(0)
-{}
-
-
-void FormCommand::showInset( InsetCommand * inset )
-{
-       if ( dialogIsOpen || inset == 0 ) return;
-
-       inset_ = inset;
-       ih_ = inset_->hide.connect(slot(this, &FormCommand::hide));
-
-       params = inset->params();
-       show();
-}
-
-
-void FormCommand::createInset( string const & arg )
-{
-       if ( dialogIsOpen ) return;
-
-       params.setFromString( arg );
-       show();
-}
diff --git a/src/frontends/xforms/FormCommand.h b/src/frontends/xforms/FormCommand.h
deleted file mode 100644 (file)
index ceca612..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-// -*- C++ -*-
-/* This file is part of
- * ====================================================== 
- *
- *           LyX, The Document Processor
- *
- *           Copyright 2000 The LyX Team.
- *
- * ======================================================
- */
-
-#ifndef FORMCOMMAND_H
-#define FORMCOMMAND_H
-
-#include "FormBase.h"
-#include "insets/insetcommand.h"
-
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-/** This class is an XForms GUI base class to insets derived from
-    InsetCommand
- */
-class FormCommand : public FormBase {
-public:
-       /// Constructor
-       FormCommand( LyXView *, Dialogs *, string const &,
-                    ChangedBufferAction, 
-                    ButtonPolicy * bp = new OkCancelReadOnlyPolicy );
-
-protected:
-       /// Slot launching dialog to (possibly) create a new inset
-       void createInset( string const & );
-       /// Slot launching dialog to an existing inset
-       void showInset( InsetCommand * );
-
-       /// pointer to the inset passed through showInset (if any)
-       InsetCommand * inset_;
-       /// the nitty-griity. What is modified and passed back
-       InsetCommandParams params;
-       /// inset::hide connection.
-       Connection ih_;
-};
-
-#endif
index 383b9e72bad662882313d7d8327b42fd76527e96..345335252245203098a6a8926a3095eabc424709 100644 (file)
@@ -16,8 +16,7 @@
 #include "FormCopyright.h"
 
 FormCopyright::FormCopyright( LyXView * lv, Dialogs * d        )
-       : FormBase( lv, d, _("Copyright and Warranty"),
-                   BUFFER_INDEPENDENT, HIDE ),
+       : FormBaseBI( lv, d, _("Copyright and Warranty") ),
          dialog_(0)
 {
        // let the dialog be shown
index 16721da9daaa7b8952ff6dc40ea24f8373c5c93a..8a0cf83aef066c55cc52ad0ebe29d53ff7b32982 100644 (file)
@@ -27,7 +27,7 @@ struct FD_form_copyright;
 
 /** This class provides an XForms implementation of the FormCopyright Dialog.
  */
-class FormCopyright : public FormBase {
+class FormCopyright : public FormBaseBI {
 public:
        /// #FormCopyright x(LyXFunc ..., Dialogs ...);#
        FormCopyright(LyXView *, Dialogs *);
index 4d3ee7412d708599c3bddc29196fcd9d6b22f4ab..b790ff2e5fa10cd69864bda7c857ca946f19cc47 100644 (file)
@@ -45,8 +45,8 @@ using Liason::setMinibuffer;
 #define USE_CLASS_COMBO 1
 
 FormDocument::FormDocument(LyXView * lv, Dialogs * d)
-       : FormBase(lv, d, _("Document Layout"), BUFFER_DEPENDENT, UPDATE,
-                  new NoRepeatedApplyReadOnlyPolicy),
+       : FormBaseBD(lv, d, _("Document Layout"),
+                    new NoRepeatedApplyReadOnlyPolicy),
          dialog_(0), paper_(0), class_(0), language_(0), options_(0),
          bullets_(0), current_bullet_panel(0), current_bullet_depth(0),
          fbullet(0), combo_language(0), combo_doc_class(0)
@@ -299,7 +299,8 @@ void FormDocument::cancel()
 }
 
 
-void FormDocument::update()
+// we can safely ignore the parameter because we can always update
+void FormDocument::update(bool)
 {
     if (!dialog_)
         return;
index ae5d51bd008c34d144c1cf09ba6d33669949262a..76a413c950c303c236720053e4b5b3a99aac8094 100644 (file)
@@ -34,8 +34,9 @@ struct FD_form_doc_bullet;
 
 /** This class provides an XForms implementation of the FormDocument Popup.
     The table-layout-form here changes values for latex-tabulars
+    @author Jürgen Vigna
  */
-class FormDocument : public FormBase {
+class FormDocument : public FormBaseBD {
 public:
        /// #FormDocument x(Communicator ..., Popups ...);#
        FormDocument(LyXView *, Dialogs *);
@@ -83,15 +84,11 @@ private:
        /// Filter the inputs
        virtual bool input( FL_OBJECT *, long );
        /// Update the popup.
-       virtual void update();
+       virtual void update(bool switched = false);
        /// Apply from popup
        virtual void apply();
        /// Cancel from popup
        virtual void cancel();
-       ///
-       virtual void restore() {
-               update();
-       }
 
        ///
        virtual FL_FORM * form() const;
index 2a73930985842d0cf4ecc22eef06ab9005f2d439..9033ff487386cfde0dfef9c3a28e280be7218695 100644 (file)
@@ -23,8 +23,8 @@
 static int minh, minw;
 
 FormError::FormError( LyXView * lv, Dialogs * d )
-       : FormBase( lv, d, _("LaTeX Error"), BUFFER_DEPENDENT, HIDE ),
-         dialog_(0), ih_(0), message_("")
+       : FormInset( lv, d, _("LaTeX Error") ),
+         dialog_(0), inset_(0), message_("")
 {
        // let the dialog be shown
        // This is a permanent connection so we won't bother
@@ -46,26 +46,35 @@ FL_FORM * FormError::form() const
 }
 
 
-void FormError::clearStore()
+void FormError::disconnect()
 {
-       ih_.disconnect();
+       inset_ = 0;
        message_.empty();
+       FormInset::disconnect();
 }
 
 
 void FormError::showInset( InsetError * inset )
 {
-       if ( dialogIsOpen || inset == 0 ) return;
+       if (inset == 0) return;
 
-       ih_ = inset->hide.connect(slot(this, &FormError::hide));
+       // If connected to another inset, disconnect from it.
+       if (inset_)
+               ih_.disconnect();
 
-       message_ = inset->getContents();
+       inset_    = inset;
+       message_  = inset->getContents();
        show();
 }
 
 
-void FormError::update()
+void FormError::update(bool switched)
 {
+       if (switched) {
+               hide();
+               return;
+       }
+
        fl_set_form_minsize(form(), minw, minh);
        fl_set_object_label(dialog_->message, message_.c_str());
 }
index cfb300596792bf5b6816f08eee3615ddb91d14c6..5ce6f6d3ead7a97cefce1cfdae090c484fa0b4f3 100644 (file)
 #pragma interface
 #endif
 
-#include "FormBase.h"
+#include "FormInset.h"
 
 class InsetError;
 struct FD_form_error;
 
 /** This class provides an XForms implementation of the FormError Dialog.
  */
-class FormError : public FormBase {
+class FormError : public FormInset {
 public:
        /// Constructor
        FormError(LyXView *, Dialogs *);
        ///
        ~FormError();
 private:
+       /// Disconnect signals. Also perform any necessary housekeeping.
+       virtual void disconnect();
+
        /// Slot launching dialog to an existing inset
        void showInset( InsetError * );
        /// Update dialog before showing it
-       virtual void update();
+       virtual void update(bool switched = false);
        /// Build the dialog
        virtual void build();
-       /// Reset data when hide() is called
-       virtual void clearStore();
        /// Pointer to the actual instantiation of the xform's form
        virtual FL_FORM * form() const;
        /// Fdesign generated method
@@ -45,8 +46,8 @@ private:
 
        /// Real GUI implementation.
        FD_form_error * dialog_;
-       /// inset::hide connection.
-       Connection ih_;
+       /// pointer to the inset passed through showInset
+       InsetError * inset_;
        /// the error message
        string message_;
 };
index d3501d5df83af08caa661b48e055a25d22652b7b..d04ebfddbd198c0447f0392e3b5bdcd353025568 100644 (file)
@@ -288,8 +288,17 @@ void FormGraphics::apply()
        lv_->view()->updateInset(inset_, changed);
 }
 
-void FormGraphics::update()
+
+// it doesn't look this is capable of updating on a buffer switch
+// inset_ would be accessible but it's not in the new buffer so
+// ok or apply will call something that won't like it. ARRae.
+void FormGraphics::update(bool switched)
 {
+       if (switched) {
+               hide();
+               return;
+       }
+
        Assert(inset_ != 0);
 
        // Update dialog with details from inset
index 8bc15e66d4291b4165a8d8115f3b743202818ef2..bad8f822322928213189d00864aa15fc3442f831 100644 (file)
@@ -88,7 +88,7 @@ private:
        /// Hide the dialog.
        void hide();
        /// Update the dialog
-       void update();
+       void update(bool switched = false);
 
        /// Apply the changes to the inset.
        void apply();
index ef5b92919e6912c64a3cac2e493b6e17691dcef7..8e718e46d111f091a56152180ab02815f0364f78 100644 (file)
@@ -26,7 +26,7 @@
 #include "lyxfunc.h"
 
 FormIndex::FormIndex(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Index"), HIDE), minh(0), minw(0), dialog_(0)
+       : FormCommand(lv, d, _("Index")), minh(0), minw(0), dialog_(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
@@ -53,14 +53,22 @@ void FormIndex::build()
 {
        dialog_ = build_index();
 
+#ifdef WITH_WARNINGS
+#warning use the buttoncontroller
+#endif
        // XFORMS bug workaround
        // Define the min/max dimensions. Actually applied in update()
        minw = form()->w; minh = form()->h;
 }
 
 
-void FormIndex::update()
+void FormIndex::update(bool switched)
 {
+       if (switched) {
+               hide();
+               return;
+       }
+
        fl_set_form_minsize(form(), minw, minh);
        fl_set_form_maxsize(form(), 2*minw, minh);
 
index b47d48edb6cd3220de883cc1baf320cf9bbfea0d..7c3207391ff085b26f6d40a8e9c0fc96ad112b33 100644 (file)
@@ -16,7 +16,7 @@
 #pragma interface
 #endif
 
-#include "FormCommand.h"
+#include "FormInset.h"
 struct FD_form_index;
 
 /** This class provides an XForms implementation of the FormIndex Dialog.
@@ -31,7 +31,7 @@ private:
        /// Build the dialog
        virtual void build();
        /// Update dialog before showing it
-       virtual void update();
+       virtual void update(bool switched = false);
        /// Apply from dialog (modify or create inset)
        virtual void apply();
        /// Pointer to the actual instantiation of the xform's form
diff --git a/src/frontends/xforms/FormInset.C b/src/frontends/xforms/FormInset.C
new file mode 100644 (file)
index 0000000..2823d16
--- /dev/null
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#include <config.h>
+
+#include FORMS_H_LOCATION
+
+#ifdef __GNUG__
+#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)
+{}
+
+
+void FormInset::connect()
+{
+       u_ = d_->updateBufferDependent.
+                connect(slot(this, &FormInset::update));
+       h_ = d_->hideBufferDependent.
+                connect(slot(this, &FormInset::hide));
+}
+
+
+void FormInset::disconnect()
+{
+       ih_.disconnect();
+       FormBaseBD::disconnect();
+}
+
+
+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, &FormInset::hide));
+       show();
+}
+
+
+void FormCommand::createInset( string const & arg )
+{
+       if (inset_) {
+               ih_.disconnect();
+               inset_ = 0;
+       }
+
+       params.setFromString( arg );
+       show();
+}
diff --git a/src/frontends/xforms/FormInset.h b/src/frontends/xforms/FormInset.h
new file mode 100644 (file)
index 0000000..865cb45
--- /dev/null
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#ifndef FORMCOMMAND_H
+#define FORMCOMMAND_H
+
+#include "FormBase.h"
+#include "insets/insetcommand.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+
+/** This class is an XForms GUI base class to insets
+ */
+class FormInset : public FormBaseBD {
+public:
+       /// Constructor
+       FormInset( LyXView *, Dialogs *, string const &,
+                  ButtonPolicy * bp = new OkCancelReadOnlyPolicy,
+                  char const * close = N_("Close"),
+                  char const * cancel = N_("Cancel"));
+
+protected: // methods
+       /// Connect signals. Also perform any necessary initialisation.
+       virtual void connect();
+       /// Disconnect signals. Also perform any necessary housekeeping.
+       virtual void disconnect();
+
+protected: // data
+       /// inset::hide connection.
+       Connection ih_;
+};
+
+
+/** This class is an XForms GUI base class to insets derived from
+    InsetCommand
+ */
+class FormCommand : public FormInset {
+public:
+       /// Constructor
+       FormCommand( LyXView *, Dialogs *, string const &,
+                    ButtonPolicy * = new OkCancelReadOnlyPolicy,
+                    char const * close = N_("Close"),
+                    char const * cancel = N_("Cancel"));
+
+protected:
+       /// Disconnect signals. Also perform any necessary housekeeping.
+       virtual void disconnect();
+
+       /// Slot launching dialog to (possibly) create a new inset
+       void createInset( string const & );
+       /// Slot launching dialog to an existing inset
+       void showInset( InsetCommand * );
+
+       /// pointer to the inset passed through showInset
+       InsetCommand * inset_;
+       /// the nitty-griity. What is modified and passed back
+       InsetCommandParams params;
+};
+
+#endif
index 1adfec0e3f2bf1e870c54ee2bb0c851d335870dc..8413b0dd7e8bee691201a05e9fd855dc29473e5e 100644 (file)
@@ -30,8 +30,8 @@ using Liason::setMinibuffer;
 #endif
 
 FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
-       : FormBase(lv, d, _("Paragraph Layout"), BUFFER_DEPENDENT, UPDATE,
-                  new NoRepeatedApplyReadOnlyPolicy),
+       : FormBaseBD(lv, d, _("Paragraph Layout"),
+                    new NoRepeatedApplyReadOnlyPolicy),
        dialog_(0), general_(0), extra_(0)
 {
     // let the popup be shown
@@ -88,6 +88,8 @@ void FormParagraph::build()
     bc_.addReadOnly (general_->radio_align_center);
     bc_.addReadOnly (general_->check_lines_top);
     bc_.addReadOnly (general_->check_lines_bottom);
+    bc_.addReadOnly (general_->check_pagebreaks_top);
+    bc_.addReadOnly (general_->check_pagebreaks_bottom);
     bc_.addReadOnly (general_->choice_space_above);
     bc_.addReadOnly (general_->input_space_above);
     bc_.addReadOnly (general_->check_space_above);
@@ -106,6 +108,8 @@ void FormParagraph::build()
     bc_.addReadOnly (extra_->radio_pextra_indent);
     bc_.addReadOnly (extra_->radio_pextra_minipage);
     bc_.addReadOnly (extra_->radio_pextra_floatflt);
+    bc_.addReadOnly (extra_->radio_pextra_hfill);
+    bc_.addReadOnly (extra_->radio_pextra_startmp);
 
     // now make them fit together
     fl_addto_tabfolder(dialog_->tabbed_folder,_("General"), general_->form);
@@ -128,13 +132,15 @@ void FormParagraph::apply()
 }
 
 
-void FormParagraph::update()
+// we can safely ignore the parameter because we can always update
+void FormParagraph::update(bool)
 {
     if (!dialog_)
         return;
 
     general_update();
     extra_update();
+    bc_.readOnly(lv_->buffer()->isReadonly());
 }
 
 
@@ -183,7 +189,8 @@ void FormParagraph::general_apply()
        space_top = VSpace(VSpace::VFILL);
        break;
     case 7:
-       space_top = VSpace(LyXGlueLength(fl_get_input(general_->input_space_above)));
+       space_top =
+               VSpace(LyXGlueLength(fl_get_input(general_->input_space_above)));
        break;
     }
     if (fl_get_button (general_->check_space_above))
@@ -208,7 +215,8 @@ void FormParagraph::general_apply()
        space_bottom = VSpace(VSpace::VFILL);
        break;
     case 7:
-       space_bottom = VSpace(LyXGlueLength(fl_get_input(general_->input_space_below)));
+       space_bottom =
+               VSpace(LyXGlueLength(fl_get_input(general_->input_space_below)));
        break;
     }
     if (fl_get_button (general_->check_space_below))
index 7dc7633316693cee791dd541068333d5d7773989..4870989da87c12ae251794d09f8a74d51d534d5c 100644 (file)
@@ -25,8 +25,9 @@ struct FD_form_paragraph_general;
 struct FD_form_paragraph_extra;
 
 /** This class provides an XForms implementation of the FormParagraph Popup.
+ *           @author Jürgen Vigna
  */
-class FormParagraph : public FormBase {
+class FormParagraph : public FormBaseBD {
 public:
        ///
        FormParagraph(LyXView *, Dialogs *);
@@ -35,11 +36,11 @@ public:
 
 private:
        /// Build the popup
-       void build();
+       virtual void build();
        /// Apply from popup
-       void apply();
+       virtual void apply();
        /// Update the popup.
-       void update();
+       virtual void update(bool);
        /// Filter the inputs on callback from xforms
        virtual bool input(FL_OBJECT * ob, long);
 
index a6f5a5697ad7988c775d13ca0cbe916d40b4e833..9bf62d3a0ed314567eca71204121e9e9a511e5b1 100644 (file)
@@ -28,8 +28,7 @@ using SigC::slot;
 
 
 FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
-       : FormBase(lv, d, _("Preferences"),
-                  BUFFER_INDEPENDENT, HIDE, new PreferencesPolicy),
+       : FormBaseBI(lv, d, _("Preferences"), new PreferencesPolicy),
          dialog_(0), outputs_tab_(0), look_n_feel_tab_(0), inputs_tab_(0),
          lnf_general_(0), screen_fonts_(0), interface_(0),
          printer_(0), paths_(0), outputs_general_(0), minw_(0), minh_(0)
@@ -156,6 +155,7 @@ void FormPreferences::build()
        fl_set_input_return(paths_->input_lastfiles, FL_RETURN_CHANGED);
        fl_set_input_return(paths_->input_backup_path, FL_RETURN_CHANGED);
        fl_set_counter_return(paths_->counter_lastfiles, FL_RETURN_CHANGED);
+       fl_set_input_return(paths_->input_serverpipe, FL_RETURN_CHANGED);
        // outputs general
        fl_set_counter_return(outputs_general_->counter_line_len,
                              FL_RETURN_CHANGED);
@@ -206,6 +206,7 @@ void FormPreferences::build()
        fl_deactivate_object(paths_->button_temp_dir_browse);
        fl_deactivate_object(paths_->button_lastfiles_browse);
        fl_deactivate_object(paths_->button_backup_path_browse);
+       fl_deactivate_object(paths_->button_serverpipe_browse);
        fl_set_object_lcol(interface_->button_bind_file_browse, FL_INACTIVE);
        fl_set_object_lcol(interface_->button_ui_file_browse, FL_INACTIVE);
        fl_set_object_lcol(paths_->button_document_browse, FL_INACTIVE);
@@ -213,6 +214,7 @@ void FormPreferences::build()
        fl_set_object_lcol(paths_->button_temp_dir_browse, FL_INACTIVE);
        fl_set_object_lcol(paths_->button_lastfiles_browse, FL_INACTIVE);
        fl_set_object_lcol(paths_->button_backup_path_browse, FL_INACTIVE);
+       fl_set_object_lcol(paths_->button_serverpipe_browse, FL_INACTIVE);
 }
 
 
@@ -225,7 +227,7 @@ FL_FORM * FormPreferences::form() const
 
 void FormPreferences::connect()
 {
-       FormBase::connect();
+       FormBaseBI::connect();
        fl_set_form_minsize(dialog_->form,
                            minw_,
                            minh_);
@@ -266,6 +268,8 @@ void FormPreferences::apply()
                fl_get_input(interface_->input_popup_encoding);
        lyxrc.bind_file = fl_get_input(interface_->input_bind_file);
        lyxrc.ui_file = fl_get_input(interface_->input_ui_file);
+       lyxrc.override_x_deadkeys =
+               fl_get_button(interface_->check_override_x_dead_keys);
        // Screen fonts
        if (lyxrc.roman_font_name !=
            fl_get_input(screen_fonts_->input_roman) ||
@@ -370,13 +374,15 @@ void FormPreferences::apply()
        lyxrc.make_backup = fl_get_button(paths_->check_make_backups);
        lyxrc.num_lastfiles = static_cast<unsigned int>
                (fl_get_counter_value(paths_->counter_lastfiles));
+       lyxrc.lyxpipes = fl_get_input(paths_->input_serverpipe);
        // outputs general
        lyxrc.ascii_linelen = static_cast<unsigned int>
                (fl_get_counter_value(outputs_general_->counter_line_len));
 }
 
 
-void FormPreferences::update()
+// we can safely ignore the parameter because we can always update
+void FormPreferences::update(bool)
 {
        if (dialog_) {
                // read lyxrc entries
@@ -441,6 +447,8 @@ void FormPreferences::update()
                             lyxrc.bind_file.c_str());
                fl_set_input(interface_->input_ui_file,
                             lyxrc.ui_file.c_str());
+               fl_set_button(interface_->check_override_x_dead_keys,
+                             lyxrc.override_x_deadkeys);
                // printer
                fl_set_button(printer_->check_adapt_output,
                              lyxrc.print_adapt_output);
@@ -497,6 +505,7 @@ void FormPreferences::update()
                              lyxrc.make_backup);
                fl_set_counter_value(paths_->counter_lastfiles,
                                     lyxrc.num_lastfiles);
+               fl_set_input(paths_->input_serverpipe, lyxrc.lyxpipes.c_str());
                // outputs general
                fl_set_counter_value(outputs_general_->counter_line_len,
                                     lyxrc.ascii_linelen);
@@ -511,37 +520,86 @@ bool FormPreferences::input(FL_OBJECT *, long)
        //
        // whatever checks you need to ensure the user hasn't entered
        // some totally ridiculous value somewhere.  Change activate to suit.
-       //
-       // Examples:
-       //  paths -- all dirs in the path should exist, be writable & absolute
+       // comments before each test describe what is _valid_
+
+       // input path -- dir should exist, be writable & absolute
        if (!AbsolutePath(fl_get_input(paths_->input_default_path))
-           || 1 != IsDirWriteable(fl_get_input(paths_->input_default_path))
-           // template_path should be a readable directory
-           || !AbsolutePath(fl_get_input(paths_->input_template_path))
-           || 1 != FileInfo(fl_get_input(paths_->input_template_path)).isDir()
-           || 1 != FileInfo(fl_get_input(paths_->input_template_path)).readable()
-           // lastfiles: exists && writeable || non-existent && isn't a dir
-           // NOTE: assumes IsFileWriteable == -1 means non-existent hence
-           //       the extra check to see if its a directory
-           || !AbsolutePath(fl_get_input(paths_->input_lastfiles))
-           || 1 != IsDirWriteable(OnlyPath(fl_get_input(paths_->
-                                                        input_lastfiles)))
-           || 0 == IsFileWriteable(OnlyPath(fl_get_input(paths_->
-                                                         input_lastfiles)))
-           || FileInfo(fl_get_input(paths_->input_lastfiles)).isDir()
-           // tmpdir: only check if we are using it
-           || (fl_get_button(paths_->check_use_temp_dir)
-               && (1 != IsDirWriteable(fl_get_input(paths_->input_temp_dir))
-                   || !AbsolutePath(fl_get_input(paths_->input_temp_dir))))
-           // backupdir: can safely be left empty
-           || (fl_get_button(paths_->check_make_backups)
-               && (!string(fl_get_input(paths_->input_backup_path)).empty()
-                   && (1 != IsDirWriteable(fl_get_input(paths_->
-                                                       input_backup_path))
-                       || !AbsolutePath(fl_get_input(paths_->
-                                                     input_backup_path)))))) {
+           || 1 != IsDirWriteable(fl_get_input(paths_->input_default_path))) {
+               activate = false;
+               lyxerr[Debug::GUI] << "Preferences: input path is wrong\n";
+       }
+
+       {
+               // template_path should be a readable directory
+               string temp(fl_get_input(paths_->input_template_path));
+               FileInfo tp(temp);
+               if (!AbsolutePath(temp)
+                   || !tp.isDir()
+                   || !tp.readable()) {
+                       activate = false;
+                       lyxerr[Debug::GUI] << "Preferences: template path is wrong\n";
+               }
+       }
+
+       // tmpdir:  not used
+       //          || writable directory
+       if (fl_get_button(paths_->check_use_temp_dir)
+           && (1 != IsDirWriteable(fl_get_input(paths_->input_temp_dir))
+               || !AbsolutePath(fl_get_input(paths_->input_temp_dir)))) {
                activate = false;
-               lyxerr[Debug::GUI] << "Preferences: Path is wrong\n";
+               lyxerr[Debug::GUI] << "Preferences: tmpdir is wrong\n";
+       }
+
+       // backupdir: not used
+       //            || empty
+       //            || writable dir
+       if (fl_get_button(paths_->check_make_backups)
+           && (!string(fl_get_input(paths_->input_backup_path)).empty()
+               && (1 != IsDirWriteable(fl_get_input(paths_->
+                                                    input_backup_path))
+                   || !AbsolutePath(fl_get_input(paths_->
+                                                 input_backup_path))))) {
+               activate = false;
+               lyxerr[Debug::GUI] << "Preferences: backupdir is wrong\n";
+       }
+
+       // lastfiles: exists && writeable
+       //            || non-existent && isn't a dir
+#ifdef WITH_WARNINGS
+#warning incorrectly allows files in /, other tests might also do this
+#endif
+       {
+               string lastfiles(fl_get_input(paths_->input_lastfiles));
+               FileInfo lf(lastfiles);
+               if (!AbsolutePath(lastfiles)
+                   || 1 != IsDirWriteable(OnlyPath(lastfiles))
+                   || (lf.exist()
+                       && (lf.isDir()
+                           || !lf.writable()))) {
+                       activate = false;
+                       lyxerr[Debug::GUI] << "Preferences: lastfiles is wrong\n";
+               }
+       }
+
+       // serverpipe:  empty
+       //              || non-existent && isn't a dir
+       //              || exists && writeable
+       // remember we append .in and .out later
+       if (!string(fl_get_input(paths_->input_serverpipe)).empty()) {
+               string pipe(fl_get_input(paths_->input_serverpipe));
+               FileInfo sp_in(pipe + ".in");
+               FileInfo sp_out(pipe + ".out");
+               if (!AbsolutePath(pipe)
+                   || 1 != IsDirWriteable(OnlyPath(pipe))
+                   || (sp_in.exist()
+                       && (!sp_in.writable()
+                           || sp_in.isDir()))
+                   || (sp_out.exist()
+                       && (!sp_out.writable()
+                           || sp_out.isDir()))) {
+                       activate = false;
+                       lyxerr[Debug::GUI] << "Preferences: Serverpipe is wrong\n";
+               }
        }
 
        //  fontsizes -- tiny < script < footnote etc.
index 3c235cf5e798f36c43380b37e989deb9cb00748c..501524011951e664924d7d5ee0d6d015c8b5ca31 100644 (file)
@@ -38,7 +38,7 @@ struct FD_form_outputs_general;
 /** This class provides an XForms implementation of the FormPreferences Dialog.
     The preferences dialog allows users to set/save their preferences.
  */
-class FormPreferences : public FormBase {
+class FormPreferences : public FormBaseBI {
 public:
        /// #FormPreferences x(LyXFunc ..., Dialogs ...);#
        FormPreferences(LyXView *, Dialogs *);
@@ -48,7 +48,7 @@ private:
        ///
        virtual void connect();
        /// Update the dialog.
-       virtual void update();
+       virtual void update(bool = false);
        ///
        virtual void hide();
        /// OK from dialog
index 4ae24cd23093dc61d848568b09a8741ce256b329..12147c2e798ca95ba99629bf3eb91104e37c76c5 100644 (file)
@@ -34,8 +34,7 @@ using Liason::getPrinterParams;
 
 
 FormPrint::FormPrint(LyXView * lv, Dialogs * d)
-       : FormBase(lv, d, _("Print"),
-                  BUFFER_DEPENDENT, HIDE, new OkApplyCancelPolicy),
+       : FormBaseBD(lv, d, _("Print"), new OkApplyCancelPolicy),
          dialog_(0), target_(2), order_(2), which_(3)
 {
        // let the dialog be shown
@@ -110,7 +109,7 @@ void FormPrint::build()
 
 void FormPrint::connect()
 {
-       FormBase::connect();
+       FormBaseBD::connect();
        fl_set_form_minsize(dialog_->form,
                            dialog_->form->w,
                            dialog_->form->h);
@@ -164,7 +163,8 @@ void FormPrint::apply()
 }
 
 
-void FormPrint::update()
+// we can safely ignore the parameter because we can always update
+void FormPrint::update(bool)
 {
        if (dialog_
            && lv_->view()->available()) {
index cb976def7261f82dd752afad3e25b465ad468b96..e18837efc9d803da728baf1f9a264f0353ac09f4 100644 (file)
@@ -31,7 +31,7 @@ struct FD_form_print;
 /** This class provides an XForms implementation of the FormPrint Dialog.
     The print dialog allows users to print their documents.
  */
-class FormPrint : public FormBase {
+class FormPrint : public FormBaseBD {
 public:
        /// #FormPrint x(LyXView ..., Dialogs ...);#
        FormPrint(LyXView *, Dialogs *);
@@ -40,7 +40,7 @@ public:
 
 private:
        /// Update the dialog.
-       virtual void update();
+       virtual void update(bool switched = false);
        /// Apply from dialog
        virtual void apply();
        /// Filter the inputs
index 83aa0e928e372ea11221f027c2f467554fee41c8..23070c366109e3a1a0a07ae3389b9a1c94038b25 100644 (file)
@@ -34,7 +34,7 @@ static int formw;
 static int formh;
 
 FormRef::FormRef(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Reference"), HIDE), toggle(GOBACK), dialog_(0)
+       : FormCommand(lv, d, _("Reference")), toggle(GOBACK), dialog_(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
@@ -57,9 +57,10 @@ FL_FORM * FormRef::form() const
 }
 
 
-void FormRef::clearStore()
+void FormRef::disconnect()
 {
        refs.clear();
+       FormCommand::disconnect();
 }
 
 
@@ -90,8 +91,13 @@ void FormRef::build()
 }
 
 
-void FormRef::update()
+void FormRef::update(bool switched)
 {
+       if (switched) {
+               hide();
+               return;
+       }
+
        fl_set_input(dialog_->ref,  params.getContents().c_str());
        fl_set_input(dialog_->name, params.getOptions().c_str());
 
@@ -272,7 +278,8 @@ bool FormRef::input( FL_OBJECT *, long data )
                case GOBACK:
                {
                        lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK);
-                       fl_set_object_label(dialog_->button_go, _("Goto reference"));
+                       fl_set_object_label(dialog_->button_go,
+                                           _("Goto reference"));
                }
                break;
 
@@ -316,7 +323,8 @@ bool FormRef::input( FL_OBJECT *, long data )
        // changed reference type
        case 4:
        {
-               Type type = static_cast<Type>( fl_get_choice(dialog_->type)-1 );
+               Type type = static_cast<Type>( 
+                       fl_get_choice(dialog_->type) - 1 );
                if ( params.getCmdName() == getName( type )
                    && inset_ ) {
                        activate = false;
index 29e022a11e517b25f80be69b7900b2bdd150e3fe..65861a14ee7b9c4327ec8216d4427a206a81bd4f 100644 (file)
@@ -16,7 +16,7 @@
 #pragma interface
 #endif
 
-#include "FormCommand.h"
+#include "FormInset.h"
 struct FD_form_ref;
 
 /** This class provides an XForms implementation of the FormRef Dialog.
@@ -51,16 +51,17 @@ private:
                GOFIRST
        };
 
+       /// Disconnect signals. Also perform any necessary housekeeping.
+       virtual void disconnect();
+
        /// Build the dialog
        virtual void build();
        /// Filter the input
        virtual bool input( FL_OBJECT *, long );
        /// Update dialog before showing it
-       virtual void update();
+       virtual void update(bool switched = false);
        /// Not used but must be instantiated
        virtual void apply();
-       /// delete derived class variables from hide()
-       virtual void clearStore();
        /// Pointer to the actual instantiation of the xform's form
        virtual FL_FORM * form() const;
 
index 4b7a492275d87d602dbc7c908f2f3a91a6dbe4a1..096a7573ca7fc35c1ceec83d2b066ba5a8b5175a 100644 (file)
@@ -150,7 +150,7 @@ void FormTabular::hideInset(InsetTabular * ti)
 }
 
 
-void FormTabular::update()
+void FormTabular::update(bool)
 {
     if (dialog_) {
        local_update(true);
index aa95b0fae1afba36c1d37c4d04fcd0590a78daaf..f21aba995c00e4f22d20663535c9e8cc9e6cfb0b 100644 (file)
@@ -7,8 +7,6 @@
  *         Copyright 1995 Matthias Ettrich
  *          Copyright 1995-2000 The LyX Team.
  *
- *         This file copyright 1999-2000
- *         Allan Rae
  *======================================================*/
 /* FormTabular.h
  * FormTabular Interface Class
@@ -70,7 +68,7 @@ private:
     ///
     void hideInset(InsetTabular *);
     /// Update the dialog.
-    void update();
+    void update(bool = false);
     ///
     void updateInset(InsetTabular *);
     ///
index a1877c6fb79fbfbdb22adb729ff144a5b340540a..2e5111cde5188320429e84f0e2b84d7ffbfb6603 100644 (file)
 #include "lyxfunc.h"
 #include "support/lstrings.h"
 
+// The current code uses the apply() for handling the Update button and the
+// type-of-table selection and cancel() for the close button.  This is a little
+// confusing to the button controller so I've made an IgnorantPolicy to cover
+// this situation since the dialog doesn't care about buttons. ARRae 20001013
 FormToc::FormToc(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Table of Contents"), UPDATE), dialog_(0)
+       : FormCommand(lv, d, _("Table of Contents"), new IgnorantPolicy),
+         dialog_(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
@@ -51,9 +56,10 @@ FL_FORM * FormToc::form() const
 }
 
 
-void FormToc::clearStore()
+void FormToc::disconnect()
 {
        toclist.clear();
+       FormCommand::disconnect();
 }
 
 
@@ -67,7 +73,8 @@ void FormToc::build()
 }
 
 
-void FormToc::update()
+// we can safely ignore the parameter because we can always update
+void FormToc::update(bool)
 {
        Buffer::TocType type;
 
@@ -94,7 +101,8 @@ void FormToc::updateToc()
        if (!lv_->view()->available()) {
                toclist.clear();
                fl_clear_browser( dialog_->browser );
-               fl_add_browser_line( dialog_->browser, _("*** No Document ***"));
+               fl_add_browser_line( dialog_->browser,
+                                    _("*** No Document ***"));
                return;
        }
 
@@ -129,7 +137,8 @@ void FormToc::updateToc()
        for (vector<Buffer::TocItem>::const_iterator it = toclist.begin();
             it != toclist.end(); ++it)
                fl_add_browser_line( dialog_->browser,
-                                    (string(4*(*it).depth,' ')+(*it).str).c_str());
+                                    (string(4 * (*it).depth, ' ')
+                                     + (*it).str).c_str());
 
        fl_set_browser_topline( dialog_->browser, topline );
        fl_select_browser_line( dialog_->browser, line );
index 17a2c8e4cfcfe336aa7c2c81e4cdba921c3bc3d2..906ff7ad78c434c7d2ae5a441861c3c0db2ca7ba 100644 (file)
@@ -16,7 +16,7 @@
 #pragma interface
 #endif
 
-#include "FormCommand.h"
+#include "FormInset.h"
 #include "buffer.h"
 struct FD_form_toc;
 
@@ -29,14 +29,15 @@ public:
        ///
        ~FormToc();
 private:
+       /// Disconnect signals. Also perform any necessary housekeeping.
+       virtual void disconnect();
+
        /// Build the dialog
        virtual void build();
        /// Update dialog before showing it
-       virtual void update();
+       virtual void update(bool switched = false);
        /// Apply from dialog (modify or create inset)
        virtual void apply();
-       /// delete derived class variables from hide()
-       virtual void clearStore();
        /// Pointer to the actual instantiation of the xform's form
        virtual FL_FORM * form() const;
        ///
index 78cf623e0f1fcae560609840c24afc462932ea5b..8d61d8ea02bca49ea8757d4a7e419dbb128618e9 100644 (file)
@@ -26,7 +26,7 @@
 #include "lyxfunc.h"
 
 FormUrl::FormUrl(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Url"), HIDE), minh(0), minw(0), dialog_(0)
+       : FormCommand(lv, d, _("Url")), minh(0), minw(0), dialog_(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
@@ -53,14 +53,23 @@ void FormUrl::build()
 {
        dialog_ = build_url();
 
+#ifdef WITH_WARNINGS
+#warning use the buttoncontroller
+#endif
        // XFORMS bug workaround
        // Define the min/max dimensions. Actually applied in update()
-       minw = form()->w; minh = form()->h;
+       minw = form()->w;
+       minh = form()->h;
 }
 
 
-void FormUrl::update()
+void FormUrl::update(bool switched)
 {
+       if (switched) {
+               hide();
+               return;
+       }
+
        fl_set_form_minsize(form(), minw, minh);
        fl_set_form_maxsize(form(), 2*minw, minh);
 
index 35feadd4fcb7e55538f39c8a911a84a51b78ee36..add9278ce7757805cc4bb700c6cb8086bbce7845 100644 (file)
@@ -16,7 +16,7 @@
 #pragma interface
 #endif
 
-#include "FormCommand.h"
+#include "FormInset.h"
 struct FD_form_url;
 
 /** This class provides an XForms implementation of the FormUrl Dialog.
@@ -31,7 +31,7 @@ private:
        /// Build the dialog
        virtual void build();
        /// Update dialog before showing it
-       virtual void update();
+       virtual void update(bool switched = false);
        /// Apply from dialog (modify or create inset)
        virtual void apply();
        /// Pointer to the actual instantiation of the xform's form
index d8f0430dec9b191f9711e389d5e95037d3bf511a..16f621108a6b13bf9321729cc57b8bd92eb4205e 100644 (file)
@@ -21,8 +21,6 @@ libxforms_la_SOURCES = \
        FormCitation.h \
        form_citation.C \
        form_citation.h \
-       FormCommand.C \
-       FormCommand.h \
        FormCopyright.C \
        FormCopyright.h \
        form_copyright.C \
@@ -43,6 +41,8 @@ libxforms_la_SOURCES = \
        FormIndex.h \
        form_index.C \
        form_index.h \
+       FormInset.C \
+       FormInset.h \
        FormParagraph.C \
        FormParagraph.h \
        form_paragraph.C \
index 5a017484de2de593c0587670ef0d553693e7e9ea..b9f5aec047d728795a775b3bd6e0b29d25896203 100644 (file)
@@ -170,27 +170,32 @@ FD_form_interface * FormPreferences::build_interface()
   fdui->form = fl_bgn_form(FL_NO_BOX, 450, 320);
   fdui->form->u_vdata = this;
   obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 320, "");
-  fdui->input_popup_font = obj = fl_add_input(FL_NORMAL_INPUT, 230, 50, 200, 30, _("Popup Font"));
+  fdui->input_popup_font = obj = fl_add_input(FL_NORMAL_INPUT, 230, 30, 200, 30, _("Popup Font"));
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseInputCB, 0);
-  fdui->input_menu_font = obj = fl_add_input(FL_NORMAL_INPUT, 230, 80, 200, 30, _("Menu Font"));
+  fdui->input_menu_font = obj = fl_add_input(FL_NORMAL_INPUT, 230, 60, 200, 30, _("Menu Font"));
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseInputCB, 0);
-  fdui->input_popup_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 230, 110, 200, 30, _("Popup Encoding"));
+  fdui->input_popup_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 230, 90, 200, 30, _("Popup Encoding"));
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseInputCB, 0);
-  fdui->input_bind_file = obj = fl_add_input(FL_NORMAL_INPUT, 160, 210, 190, 30, idex(_("Bind file|#B")));
+  fdui->input_bind_file = obj = fl_add_input(FL_NORMAL_INPUT, 160, 178, 190, 30, idex(_("Bind file|#B")));
     fl_set_button_shortcut(obj, scex(_("Bind file|#B")), 1);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseInputCB, 0);
-  fdui->button_bind_file_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 210, 80, 30, _("Browse..."));
+  fdui->button_bind_file_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 178, 80, 30, _("Browse..."));
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-  fdui->input_ui_file = obj = fl_add_input(FL_NORMAL_INPUT, 160, 180, 190, 30, idex(_("User Interface file|#U")));
+  fdui->input_ui_file = obj = fl_add_input(FL_NORMAL_INPUT, 160, 148, 190, 30, idex(_("User Interface file|#U")));
     fl_set_button_shortcut(obj, scex(_("User Interface file|#U")), 1);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseInputCB, 0);
-  fdui->button_ui_file_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 180, 80, 30, _("Browse..."));
+  fdui->button_ui_file_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 148, 80, 30, _("Browse..."));
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+  fdui->check_override_x_dead_keys = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 24, 230, 310, 30, idex(_("Override X-Windows dead-keys|#O")));
+    fl_set_button_shortcut(obj, scex(_("Override X-Windows dead-keys|#O")), 1);
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+    fl_set_button(obj, 1);
   fl_end_form();
 
   fdui->form->fdui = fdui;
@@ -339,6 +344,11 @@ FD_form_paths * FormPreferences::build_paths()
     fl_set_object_callback(obj, C_FormBaseInputCB, 0);
   fdui->button_backup_path_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 170, 90, 30, _("Browse..."));
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+  fdui->input_serverpipe = obj = fl_add_input(FL_NORMAL_INPUT, 169, 217, 170, 30, _("LyXServer pipe"));
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+  fdui->button_serverpipe_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 339, 217, 90, 30, _("Browse..."));
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
   fl_end_form();
 
   fdui->form->fdui = fdui;
@@ -427,9 +437,9 @@ FD_form_outputs_general * FormPreferences::build_outputs_general()
   FL_OBJECT *obj;
   FD_form_outputs_general *fdui = new FD_form_outputs_general;
 
-  fdui->form = fl_bgn_form(FL_NO_BOX, 450, 320);
+  fdui->form = fl_bgn_form(FL_NO_BOX, 455, 345);
   fdui->form->u_vdata = this;
-  obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 320, "");
+  obj = fl_add_box(FL_FLAT_BOX, 0, 0, 455, 345, "");
   fdui->counter_line_len = obj = fl_add_counter(FL_SIMPLE_COUNTER, 295, 50, 120, 30, idex(_("Ascii line length|#A")));
     fl_set_button_shortcut(obj, scex(_("Ascii line length|#A")), 1);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
index d3d620b0ab50a1c60a691d29ff7f35802d00b46f..4fee00364ee6244099a398b749d5685a8b0751af 100644 (file)
@@ -70,6 +70,7 @@ struct FD_form_interface {
        FL_OBJECT *button_bind_file_browse;
        FL_OBJECT *input_ui_file;
        FL_OBJECT *button_ui_file_browse;
+       FL_OBJECT *check_override_x_dead_keys;
 };
 struct FD_form_printer {
        ~FD_form_printer();
@@ -112,6 +113,8 @@ struct FD_form_paths {
        FL_OBJECT *check_make_backups;
        FL_OBJECT *input_backup_path;
        FL_OBJECT *button_backup_path_browse;
+       FL_OBJECT *input_serverpipe;
+       FL_OBJECT *button_serverpipe_browse;
 };
 struct FD_form_preferences {
        ~FD_form_preferences();
index 7fdabe5f00b908325f26ee000f5ec163000f8361..ab06f5eef93cdc8a24a36b267a658cd110faf1df 100644 (file)
@@ -510,7 +510,7 @@ argument: 0
 Name: form_interface
 Width: 450
 Height: 320
-Number of Objects: 8
+Number of Objects: 9
 
 --------------------
 class: FL_BOX
@@ -533,7 +533,7 @@ argument:
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 230 50 200 30
+box: 230 30 200 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -551,7 +551,7 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 230 80 200 30
+box: 230 60 200 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -569,7 +569,7 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 230 110 200 30
+box: 230 90 200 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -587,7 +587,7 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 160 210 190 30
+box: 160 178 190 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -605,7 +605,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 350 210 80 30
+box: 350 178 80 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -623,7 +623,7 @@ argument:
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 160 180 190 30
+box: 160 148 190 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -641,7 +641,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 350 180 80 30
+box: 350 148 80 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -656,6 +656,25 @@ name: button_ui_file_browse
 callback: 
 argument: 
 
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 24 230 310 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Override X-Windows dead-keys|#O
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: check_override_x_dead_keys
+callback: C_FormBaseInputCB
+argument: 0
+       value: 1
+
 =============== FORM ===============
 Name: form_printer
 Width: 450
@@ -1026,7 +1045,7 @@ argument:
 Name: form_paths
 Width: 450
 Height: 320
-Number of Objects: 15
+Number of Objects: 17
 
 --------------------
 class: FL_BOX
@@ -1305,6 +1324,42 @@ name: button_backup_path_browse
 callback: 
 argument: 
 
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 169 217 170 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: LyXServer pipe
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_serverpipe
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 339 217 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Browse...
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_serverpipe_browse
+callback: 
+argument: 
+
 =============== FORM ===============
 Name: form_preferences
 Width: 470
@@ -1499,14 +1554,14 @@ argument:
 
 =============== FORM ===============
 Name: form_outputs_general
-Width: 450
-Height: 320
+Width: 455
+Height: 345
 Number of Objects: 2
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 450 320
+box: 0 0 455 345
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
index ec571f60c5eb9e27cf516360417490f5120c3c34..9d1dd98389e0d6343d7be1aed6bffc154833f706 100644 (file)
@@ -143,7 +143,7 @@ void CloseAllBufferRelatedDialogs()
 
 // This is another function we really don't want.
 // Again the Signal/Slot mechanism is tailor made for this task.
-void updateAllVisibleBufferRelatedDialogs()
+void updateAllVisibleBufferRelatedDialogs(bool)
 {
        if (fd_form_preamble->form_preamble->visible) {
                UpdateLayoutPreamble();
index 89e4191b9ffea012dde3efa3d88ce03a9c528853..779167af4196bdeb8170406dc190bbd43719f54d 100644 (file)
@@ -33,7 +33,7 @@ extern "C" int IgnoreCloseBoxCB(FL_FORM *, void *);
 void CloseAllBufferRelatedDialogs();
 
 /// Ensures info in visible popups are always correct.
-void updateAllVisibleBufferRelatedDialogs();
+void updateAllVisibleBufferRelatedDialogs(bool switched = false);
 
 /* These shortcut extractors should be shifted to frontends/xforms/ eventually */