I hope that the bloat is more acceptable to gcc 2.96 users now.
With GCC 3.1 it seems better than ever:

   text    data     bss     dec     hex filename
2804979  112728   48684 2966391  2d4377 src/lyx
2800035  112760   49612 2962407  2d33e7 src/lyx (after some dialog/gui changes)

This patch show the direction I am working on.
Feel free to try it out.


Index: src/frontends/Dialogs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Dialogs.C,v
retrieving revision 1.6
diff -u -p -r1.6 Dialogs.C
--- src/frontends/Dialogs.C     29 May 2002 16:20:59 -0000      1.6
+++ src/frontends/Dialogs.C     10 Jun 2002 22:31:57 -0000
@@ -21,15 +21,55 @@
 #endif
 
 #include "Dialogs.h"
+
 #include "support/LAssert.h"
 
+#include "guiapi.h"
+
 // Signal enabling all visible dialogs to be redrawn if so desired.
 // E.g., when the GUI colours have been remapped.
 boost::signal0<void> Dialogs::redrawGUI;
 
+extern LyXView * dialogs_lyxview;
+
 
 // toggle tooltips on/off in all dialogs.
 boost::signal0<void> Dialogs::toggleTooltips;
+
+void Dialogs::showAboutlyx()
+{
+       gui_ShowAboutlyx(*dialogs_lyxview, *this);
+}
+
+
+void Dialogs::showBibitem(InsetCommand * ic)
+{
+       gui_ShowBibitem(ic, *dialogs_lyxview, *this);
+}
+
+
+void Dialogs::showBibtex(InsetCommand * ic)
+{
+       gui_ShowBibtex(ic, *dialogs_lyxview, *this);
+}
+
+
+void Dialogs::showCharacter()
+{
+       gui_ShowCharacter(*dialogs_lyxview, *this);
+}
+
+
+void Dialogs::showDocument()
+{
+       gui_ShowDocument(*dialogs_lyxview, *this);
+}
+
+
+void Dialogs::showError(InsetError * ie)
+{
+       gui_ShowError(ie, *dialogs_lyxview, *this);
+}
 
 void Dialogs::add(DialogBase * ptr)
 {
Index: src/frontends/Dialogs.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Dialogs.h,v
retrieving revision 1.54
diff -u -p -r1.54 Dialogs.h
--- src/frontends/Dialogs.h     29 May 2002 16:21:00 -0000      1.54
+++ src/frontends/Dialogs.h     10 Jun 2002 22:31:57 -0000
@@ -24,8 +24,8 @@
 #include <boost/shared_ptr.hpp>
 #include <boost/signals/signal0.hpp>
 #include <boost/signals/signal1.hpp>
-#include <boost/function.hpp>
-
+#include <boost/function/function0.hpp>
+#include <boost/function/function1.hpp>
 #include <vector>
 
 #ifdef __GNUG__
@@ -94,96 +94,126 @@ public:
        /**@name Dialog Access Signals.
           Put into some sort of alphabetical order */
        //@{
+#if 0
+       ///
+       boost::function0<void> showAboutlyx;
+#else
        ///
-       boost::function<void> showAboutlyx;
+       void showAboutlyx();
+#endif
+#if 0
+       /// show the key and label of a bibliography entry
+       boost::function1<void, InsetCommand *> showBibitem;
+#else
        /// show the key and label of a bibliography entry
-       boost::function<void, InsetCommand *> showBibitem;
+       void showBibitem(InsetCommand * ic);
+#endif
+#if 0
+       /// show the bibtex dialog
+       boost::function1<void, InsetCommand *> showBibtex;
+#else
        /// show the bibtex dialog
-       boost::function<void, InsetCommand *> showBibtex;
+       void showBibtex(InsetCommand * ic);
+#endif
+#if 0
        ///
-       boost::function<void> showCharacter;
+       boost::function0<void> showCharacter;
+#else
+       ///
+       void showCharacter();
+#endif
        /// connected to the character dialog also
-       boost::function<void> setUserFreeFont;
+       boost::function0<void> setUserFreeFont;
+       ///
+       boost::function1<void, InsetCommand *> showCitation;
        ///
-       boost::function<void, InsetCommand *> showCitation;
+       boost::function1<void, string const &> createCitation;
+#if 0
        ///
-       boost::function<void, string const &> createCitation;
+       boost::function0<void> showDocument;
+#else
        ///
-       boost::function<void> showDocument;
+       void showDocument();
+#endif
+#if 0
+       ///
+       boost::function1<void, InsetError *> showError;
+#else
        ///
-       boost::function<void, InsetError *> showError;
+       void showError(InsetError *);
+#endif
        /// show the external inset dialog
-       boost::function<void, InsetExternal *> showExternal;
+       boost::function1<void, InsetExternal *> showExternal;
        /// show the contents of a file.
-       boost::function<void, string const &> showFile;
+       boost::function1<void, string const &> showFile;
        /// show all forked child processes
-       boost::function<void> showForks;
+       boost::function0<void> showForks;
        ///
-       boost::function<void, InsetGraphics *> showGraphics;
+       boost::function1<void, InsetGraphics *> showGraphics;
        /// show the details of a LyX file include inset
-       boost::function<void, InsetInclude *> showInclude;
+       boost::function1<void, InsetInclude *> showInclude;
        ///
-       boost::function<void, InsetCommand *> showIndex;
+       boost::function1<void, InsetCommand *> showIndex;
        ///
-       boost::function<void, string const &> createIndex;
+       boost::function1<void, string const &> createIndex;
        ///
-       boost::function<void, InsetInfo *> showInfo;
+       boost::function1<void, InsetInfo *> showInfo;
        /// show the LaTeX log or build file
-       boost::function<void> showLogFile;
+       boost::function0<void> showLogFile;
        /// display the top-level maths panel
-       boost::function<void> showMathPanel;
+       boost::function0<void> showMathPanel;
        ///
-       boost::function<void, InsetMinipage *> showMinipage;
+       boost::function1<void, InsetMinipage *> showMinipage;
        ///
-       boost::function<void, InsetMinipage *> updateMinipage;
+       boost::function1<void, InsetMinipage *> updateMinipage;
        ///
-       boost::function<void, InsetERT *> showERT;
+       boost::function1<void, InsetERT *> showERT;
        ///
-       boost::function<void, InsetERT *> updateERT;
+       boost::function1<void, InsetERT *> updateERT;
        ///
-       boost::function<void, InsetFloat *> showFloat;
+       boost::function1<void, InsetFloat *> showFloat;
        ///
-       boost::function<void> showParagraph;
+       boost::function0<void> showParagraph;
        ///
        boost::signal0<void> updateParagraph;
        ///
-       boost::function<void> showPreamble;
+       boost::function0<void> showPreamble;
        ///
-       boost::function<void> showPreferences;
+       boost::function0<void> showPreferences;
        ///
-       boost::function<void> showPrint;
+       boost::function0<void> showPrint;
        ///
-       boost::function<void, InsetCommand *> showRef;
+       boost::function1<void, InsetCommand *> showRef;
        ///
-       boost::function<void, string const &> createRef;
+       boost::function1<void, string const &> createRef;
        ///
-       boost::function<void> showSearch;
+       boost::function0<void> showSearch;
        ///
-       boost::function<void> showSendto;
+       boost::function0<void> showSendto;
        /// bring up the spellchecker
-       boost::function<void> showSpellchecker;
+       boost::function0<void> showSpellchecker;
        /// bring up the spellchecker tab in preferences
-       boost::function<void> showSpellcheckerPreferences;
+       boost::function0<void> showSpellcheckerPreferences;
        ///
-       boost::function<void, InsetTabular *> showTabular;
+       boost::function1<void, InsetTabular *> showTabular;
        ///
-       boost::function<void, InsetTabular *> updateTabular;
+       boost::function1<void, InsetTabular *> updateTabular;
        ///
-       boost::function<void> showTabularCreate;
+       boost::function0<void> showTabularCreate;
        /// show the TexInfo
-       boost::function<void> showTexinfo;
+       boost::function0<void> showTexinfo;
        /// show the thesaurus dialog
-       boost::function<void, string const &> showThesaurus;
+       boost::function1<void, string const &> showThesaurus;
        ///
-       boost::function<void, InsetCommand *> showTOC;
+       boost::function1<void, InsetCommand *> showTOC;
        ///
-       boost::function<void, string const &> createTOC;
+       boost::function1<void, string const &> createTOC;
        ///
-       boost::function<void, InsetCommand *> showUrl;
+       boost::function1<void, InsetCommand *> showUrl;
        ///
-       boost::function<void, string const &> createUrl;
+       boost::function1<void, string const &> createUrl;
        /// show the version control log
-       boost::function<void> showVCLogFile;
+       boost::function0<void> showVCLogFile;
        //@}
 private:
        /// Add a dialog to the vector of dialogs.
Index: src/frontends/guiapi.h
===================================================================
RCS file: src/frontends/guiapi.h
diff -N src/frontends/guiapi.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ src/frontends/guiapi.h      10 Jun 2002 22:31:57 -0000
@@ -0,0 +1,17 @@
+// -*- C++ -*-
+
+class LyXView;
+class Dialogs;
+class InsetCommand;
+class InsetError;
+
+extern "C" {
+
+       void gui_ShowAboutlyx(LyXView &, Dialogs &);
+       void gui_ShowBibitem(InsetCommand * ic, LyXView & lv, Dialogs & d);
+       void gui_ShowBibtex(InsetCommand * ic, LyXView & lv, Dialogs & d);
+       void gui_ShowCharacter(LyXView & lv, Dialogs & d);
+       void gui_ShowDocument(LyXView & lv, Dialogs & d);
+       void gui_ShowError(InsetError * ie, LyXView & lv, Dialogs & d);
+
+} // extern "C"
Index: src/frontends/controllers/ControlAboutlyx.C
===================================================================
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlAboutlyx.C,v
retrieving revision 1.7
diff -u -p -r1.7 ControlAboutlyx.C
--- src/frontends/controllers/ControlAboutlyx.C 29 May 2002 16:21:00 -0000      1.7
+++ src/frontends/controllers/ControlAboutlyx.C 10 Jun 2002 22:31:57 -0000
@@ -34,7 +34,9 @@ extern string user_lyxdir;
 ControlAboutlyx::ControlAboutlyx(LyXView & lv, Dialogs & d)
        : ControlDialogBI(lv, d)
 {
-       d_.showAboutlyx = boost::bind(&ControlAboutlyx::show, this);
+#if 0
+       d_.showAboutlyx_fun = boost::bind(&ControlAboutlyx::show, this);
+#endif
 }
 
 
Index: src/frontends/controllers/ControlBibitem.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlBibitem.C,v
retrieving revision 1.15
diff -u -p -r1.15 ControlBibitem.C
--- src/frontends/controllers/ControlBibitem.C  29 May 2002 16:21:00 -0000      1.15
+++ src/frontends/controllers/ControlBibitem.C  10 Jun 2002 22:31:57 -0000
@@ -34,7 +34,9 @@
 ControlBibitem::ControlBibitem(LyXView & lv, Dialogs & d)
        : ControlCommand(lv, d)
 {
-       d_.showBibitem = boost::bind(&ControlBibitem::showInset, this, _1);
+#if 0
+       d_.showBibitem_fun = boost::bind(&ControlBibitem::showInset, this, _1);
+#endif
 }
 
 
Index: src/frontends/controllers/ControlBibtex.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlBibtex.C,v
retrieving revision 1.14
diff -u -p -r1.14 ControlBibtex.C
--- src/frontends/controllers/ControlBibtex.C   29 May 2002 16:21:00 -0000      1.14
+++ src/frontends/controllers/ControlBibtex.C   10 Jun 2002 22:31:57 -0000
@@ -41,7 +41,9 @@ using std::make_pair;
 ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
        : ControlCommand(lv, d)
 {
-       d_.showBibtex = boost::bind(&ControlBibtex::showInset, this, _1);
+#if 0
+       d_.showBibtex_fun = boost::bind(&ControlBibtex::showInset, this, _1);
+#endif
 }
 
 void ControlBibtex::applyParamsToInset()
Index: src/frontends/controllers/ControlCharacter.C
===================================================================
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlCharacter.C,v
retrieving revision 1.24
diff -u -p -r1.24 ControlCharacter.C
--- src/frontends/controllers/ControlCharacter.C        29 May 2002 16:21:00 -0000     
 1.24
+++ src/frontends/controllers/ControlCharacter.C        10 Jun 2002 22:31:57 -0000
@@ -37,7 +37,9 @@ ControlCharacter::ControlCharacter(LyXVi
        : ControlDialogBD(lv, d),
          font_(0), toggleall_(false)
 {
+#if 0
        d_.showCharacter = boost::bind(&ControlCharacter::show, this);
+#endif
        d_.setUserFreeFont = boost::bind(&ControlCharacter::apply, this);
 }
 
Index: src/frontends/controllers/ControlDialog.tmpl
===================================================================
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlDialog.tmpl,v
retrieving revision 1.3
diff -u -p -r1.3 ControlDialog.tmpl
--- src/frontends/controllers/ControlDialog.tmpl        10 Jun 2002 16:49:41 -0000     
 1.3
+++ src/frontends/controllers/ControlDialog.tmpl        10 Jun 2002 22:31:57 -0000
@@ -72,4 +72,3 @@ void ControlDialog<Base>::hide()
        disconnect();
        view().hide();
 }
-
Index: src/frontends/controllers/ControlError.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlError.C,v
retrieving revision 1.11
diff -u -p -r1.11 ControlError.C
--- src/frontends/controllers/ControlError.C    10 Jun 2002 17:33:04 -0000      1.11
+++ src/frontends/controllers/ControlError.C    10 Jun 2002 22:31:57 -0000
@@ -31,7 +31,9 @@
 ControlError::ControlError(LyXView & lv, Dialogs & d)
        : ControlInset<InsetError, string>(lv, d)
 {
+#if 0
        d_.showError = boost::bind(&ControlError::showInset, this, _1);
+#endif
 }
 
 
Index: src/frontends/controllers/GUI.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/GUI.h,v
retrieving revision 1.30
diff -u -p -r1.30 GUI.h
--- src/frontends/controllers/GUI.h     10 Jun 2002 17:33:04 -0000      1.30
+++ src/frontends/controllers/GUI.h     10 Jun 2002 22:31:58 -0000
@@ -56,6 +56,12 @@ public:
        ///
        virtual ViewBase & view() { return view_; }
 
+       friend void gui_ShowAboutlyx(LyXView &, Dialogs &);
+       friend void gui_ShowBibitem(InsetCommand *, LyXView &, Dialogs &);
+       friend void gui_ShowBibtex(InsetCommand *, LyXView &, Dialogs &);
+       friend void gui_ShowCharacter(LyXView &, Dialogs &);
+       friend void gui_ShowDocument(LyXView &, Dialogs &);
+       friend void gui_ShowError(InsetError *, LyXView &, Dialogs &);
 private:
        ///
        ButtonController<Policy, GUIbc> bc_;
Index: src/frontends/xforms/Dialogs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/Dialogs.C,v
retrieving revision 1.72
diff -u -p -r1.72 Dialogs.C
--- src/frontends/xforms/Dialogs.C      29 May 2002 16:21:01 -0000      1.72
+++ src/frontends/xforms/Dialogs.C      10 Jun 2002 22:31:58 -0000
@@ -83,6 +83,10 @@
 
 #include "Tooltips.h"
 
+#include <boost/bind.hpp>
+
+LyXView * dialogs_lyxview;
+
 /// Are the tooltips on or off?
 bool Dialogs::tooltipsEnabled()
 {
@@ -92,18 +96,31 @@ bool Dialogs::tooltipsEnabled()
 
 Dialogs::Dialogs(LyXView * lv)
 {
+#if 1
+       dialogs_lyxview = lv;
+#endif
+#if 0
        add(new GUI<ControlAboutlyx, FormAboutlyx,
                    OkCancelPolicy, xformsBC>(*lv, *this));
+#endif
+#if 0
        add(new GUI<ControlBibitem, FormBibitem,
                    OkCancelReadOnlyPolicy, xformsBC>(*lv, *this));
+#endif
+#if 0
        add(new GUI<ControlBibtex, FormBibtex,
                    OkCancelReadOnlyPolicy, xformsBC>(*lv, *this));
+#endif
+#if 0
        add(new GUI<ControlCharacter, FormCharacter,
                    OkApplyCancelReadOnlyPolicy, xformsBC>(*lv, *this));
+#endif
        add(new GUI<ControlCitation, FormCitation,
                    NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
+#if 0
        add(new GUI<ControlError, FormError,
                    OkCancelPolicy, xformsBC>(*lv, *this));
+#endif
        add(new GUI<ControlERT, FormERT,
                    NoRepeatedApplyReadOnlyPolicy, xformsBC>(*lv, *this));
        add(new GUI<ControlExternal, FormExternal,
@@ -151,7 +168,9 @@ Dialogs::Dialogs(LyXView * lv)
        add(new GUI<ControlVCLog, FormVCLog,
                    OkCancelPolicy, xformsBC>(*lv, *this));
 
+#if 0
        add(new FormDocument(lv, this));
+#endif
        add(new FormMathsPanel(lv, this));
        add(new FormParagraph(lv, this));
        add(new FormPreferences(lv, this));
Index: src/frontends/xforms/FormAboutlyx.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormAboutlyx.h,v
retrieving revision 1.5
diff -u -p -r1.5 FormAboutlyx.h
--- src/frontends/xforms/FormAboutlyx.h 22 May 2002 01:16:36 -0000      1.5
+++ src/frontends/xforms/FormAboutlyx.h 10 Jun 2002 22:31:58 -0000
@@ -59,4 +59,5 @@ private:
        boost::scoped_ptr<FD_form_tab_license> license_;
 };
 
+
 #endif // FORMABOUTLYX_H
Index: src/frontends/xforms/FormBaseDeprecated.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormBaseDeprecated.h,v
retrieving revision 1.13
diff -u -p -r1.13 FormBaseDeprecated.h
--- src/frontends/xforms/FormBaseDeprecated.h   29 May 2002 16:21:01 -0000      1.13
+++ src/frontends/xforms/FormBaseDeprecated.h   10 Jun 2002 22:31:58 -0000
@@ -57,6 +57,8 @@ public:
 
        Tooltips & tooltips();
 
+       friend void gui_ShowDocument(LyXView &, Dialogs &);
+
 protected: // methods
 
        /// Pointer to the actual instantiation of the ButtonController.
Index: src/frontends/xforms/FormDocument.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormDocument.C,v
retrieving revision 1.104
diff -u -p -r1.104 FormDocument.C
--- src/frontends/xforms/FormDocument.C 29 May 2002 16:21:01 -0000      1.104
+++ src/frontends/xforms/FormDocument.C 10 Jun 2002 22:31:59 -0000
@@ -60,10 +60,12 @@ FormDocument::FormDocument(LyXView * lv,
          ActCell(0), Confirmed(0),
          current_bullet_panel(0), current_bullet_depth(0), fbullet(0)
 {
+#if 0
        // let the dialog be shown
        // This is a permanent connection so we won't bother
        // storing a copy because we won't be disconnecting.
        d->showDocument = boost::bind(&FormDocument::show, this);
+#endif
 }
 
 
Index: src/frontends/xforms/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/Makefile.am,v
retrieving revision 1.70
diff -u -p -r1.70 Makefile.am
--- src/frontends/xforms/Makefile.am    26 May 2002 18:30:34 -0000      1.70
+++ src/frontends/xforms/Makefile.am    10 Jun 2002 22:31:59 -0000
@@ -197,6 +197,8 @@ libxforms_la_SOURCES = \
        form_url.h \
        FormVCLog.C \
        FormVCLog.h \
+       guiapi.C \
+       guiapi.h \
        GUIRunTime.C \
        input_validators.C \
        input_validators.h \
Index: src/frontends/xforms/guiapi.C
===================================================================
RCS file: src/frontends/xforms/guiapi.C
diff -N src/frontends/xforms/guiapi.C
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ src/frontends/xforms/guiapi.C       10 Jun 2002 22:31:59 -0000
@@ -0,0 +1,76 @@
+#include <config.h>
+
+#include "guiapi.h"
+
+#include "FormAboutlyx.h"
+#include "form_aboutlyx.h"
+
+#include "FormBibitem.h"
+#include "form_bibitem.h"
+
+#include "FormBibtex.h"
+#include "form_bibtex.h"
+
+#include "FormCharacter.h"
+#include "form_character.h"
+
+#include "FormDocument.h"
+#include "form_document.h"
+
+#include "FormError.h"
+#include "form_error.h"
+
+#include "xformsBC.h"
+#include "combox.h"
+
+#include "controllers/GUI.h"
+#include "insets/inseterror.h"
+
+#include "LyXView.h"
+
+extern "C" {
+
+       void gui_ShowAboutlyx(LyXView & lv, Dialogs & d)
+       {
+               static GUI<ControlAboutlyx, FormAboutlyx,
+                       OkCancelPolicy, xformsBC> cal(lv, d);
+               cal.show();
+       }
+
+
+       void gui_ShowBibitem(InsetCommand * ic, LyXView & lv, Dialogs & d)
+       {
+               static GUI<ControlBibitem, FormBibitem,
+                       OkCancelReadOnlyPolicy, xformsBC> cbi(lv, d);
+               cbi.showInset(ic);
+       }
+
+       void gui_ShowBibtex(InsetCommand * ic, LyXView & lv, Dialogs & d)
+       {
+               static GUI<ControlBibtex, FormBibtex,
+                       OkCancelReadOnlyPolicy, xformsBC> cbt(lv, d);
+               cbt.showInset(ic);
+       }
+
+       void gui_ShowCharacter(LyXView & lv, Dialogs & d)
+       {
+               static GUI<ControlCharacter, FormCharacter,
+                       OkApplyCancelReadOnlyPolicy, xformsBC> cc(lv, d);
+               cc.show();
+       }
+
+       void gui_ShowDocument(LyXView & lv, Dialogs & d)
+       {
+               static FormDocument fd(&lv, &d);
+               fd.show();
+       }
+
+       void gui_ShowError(InsetError * ie, LyXView & lv, Dialogs & d)
+       {
+               static GUI<ControlError, FormError,
+                       OkCancelPolicy, xformsBC> ce(lv, d);
+               ce.showInset(ie);
+       }
+
+
+} // extern "C"

-- 
        Lgb


Reply via email to