diff --git a/ChangeLog b/ChangeLog index a93449706d..5e4db5cf58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2000-07-27 Lars Gullik Bjønnes + + * src/frontends/xforms/FormUrl.h: ditto + + * src/frontends/xforms/FormPrint.h: ditto + + * src/frontends/xforms/FormPreferences.h: ditto + + * src/frontends/xforms/FormCopyright.h: ditto + + * src/frontends/xforms/FormCitation.C: ditto + + * src/frontends/Dialogs.h (class Dialogs): use noncopyable, remove + private copyconstructor and private default contructor + + * src/support/Makefile.am: add utility.hpp + + * src/support/utility.hpp: new file from boost + + * src/insets/insetbib.h: set owner in clone + + * src/frontends/xforms/FormCitation.C: added missing include + algorithm + + * src/insets/form_url.[Ch]: removed + 2000-07-26 Kayvan A. Sylvan * development/lyx.spec.in diff --git a/po/POTFILES.in b/po/POTFILES.in index db7f810105..e9d20613e4 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -41,7 +41,6 @@ src/frontends/xforms/Menubar_pimpl.C src/gettext.h src/insets/figinset.C src/insets/form_graphics.C -src/insets/form_url.C src/insets/insetbib.C src/insets/inset.C src/insets/inseterror.C diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index 5188557700..60e60b10fc 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -21,14 +21,8 @@ #include #include -using std::vector; - -#ifdef SIGC_CXX_NAMESPACES -using SigC::Signal0; -using SigC::Signal1; -#endif - #include "LString.h" +#include "support/utility.hpp" class DialogBase; @@ -44,11 +38,18 @@ class InsetInfo; class InsetTabular; class InsetUrl; +using std::vector; + +#ifdef SIGC_CXX_NAMESPACES +using SigC::Signal0; +using SigC::Signal1; +#endif + /** Container of all dialogs and signals a LyXView needs or uses to access them The list of dialog signals isn't comprehensive but should be a good guide for any future additions. Remember don't go overboard -- think minimal. */ -class Dialogs +class Dialogs : public noncopyable { public: /**@name Constructors and Deconstructors */ @@ -123,10 +124,6 @@ public: Signal1 showInfo; //@} private: - /// Disallow default constructor - Dialogs() {} - /// Disallow copy constructor - Dialogs(Dialogs &) {} /// vector dialogs_; }; diff --git a/src/frontends/xforms/FormCitation.C b/src/frontends/xforms/FormCitation.C index bd77914b85..0443068dc7 100644 --- a/src/frontends/xforms/FormCitation.C +++ b/src/frontends/xforms/FormCitation.C @@ -10,8 +10,17 @@ */ #include -#include "gettext.h" + +#include + #include FORMS_H_LOCATION + +#ifdef __GNUG__ +#pragma implementation +#endif + + +#include "gettext.h" #include "BufferView.h" #include "Dialogs.h" #include "FormCitation.h" @@ -23,10 +32,6 @@ #include "insets/insetcite.h" #include "support/filetools.h" -#ifdef __GNUG__ -#pragma implementation -#endif - using std::vector; using std::pair; using std::max; diff --git a/src/frontends/xforms/FormCitation.h b/src/frontends/xforms/FormCitation.h index 3047dca4d3..d362bc6be7 100644 --- a/src/frontends/xforms/FormCitation.h +++ b/src/frontends/xforms/FormCitation.h @@ -12,9 +12,15 @@ #ifndef FORMCITATION_H #define FORMCITATION_H +#include + #include "DialogBase.h" #include "LString.h" -#include +#include "support/utility.hpp" + +#ifndef __GNUG__ +#pragma interface +#endif class Dialogs; // same arguement as in Dialogs.h s/LyX/UI/ @@ -24,7 +30,7 @@ struct FD_form_citation; /** This class provides an XForms implementation of the FormCitation Dialog. */ -class FormCitation : public DialogBase { +class FormCitation : public DialogBase, public noncopyable { public: /// enum State { @@ -54,9 +60,6 @@ public: //@} private: - FormCitation() {} - FormCitation(FormCitation &) : DialogBase() {} - /**@name Slot Methods */ //@{ /// Create the dialog if necessary, update it and display it. diff --git a/src/frontends/xforms/FormCopyright.C b/src/frontends/xforms/FormCopyright.C index 4a0093fdcf..6406d8483b 100644 --- a/src/frontends/xforms/FormCopyright.C +++ b/src/frontends/xforms/FormCopyright.C @@ -3,18 +3,19 @@ */ #include -#include "lyx_gui_misc.h" -#include "gettext.h" + #include FORMS_H_LOCATION +#ifdef __GNUG__ +#pragma implementation +#endif + #include "xform_macros.h" #include "FormCopyright.h" #include "Dialogs.h" #include "LyXView.h" - -#ifdef __GNUG__ -#pragma implementation -#endif +#include "lyx_gui_misc.h" +#include "gettext.h" C_RETURNCB(FormCopyright, WMHideCB) C_GENERICCB(FormCopyright, OKCB) diff --git a/src/frontends/xforms/FormCopyright.h b/src/frontends/xforms/FormCopyright.h index ee99a2c619..5647a40494 100644 --- a/src/frontends/xforms/FormCopyright.h +++ b/src/frontends/xforms/FormCopyright.h @@ -19,6 +19,11 @@ #include "DialogBase.h" #include "form_copyright.h" +#include "support/utility.hpp" + +#ifdef __GNUG__ +#pragma interface +#endif class Dialogs; // same arguement as in Dialogs.h s/LyX/UI/ @@ -26,7 +31,7 @@ class LyXView; /** This class provides an XForms implementation of the FormCopyright Dialog. */ -class FormCopyright : public DialogBase { +class FormCopyright : public DialogBase, public noncopyable { public: /**@name Constructors and Destructors */ //@{ @@ -43,9 +48,6 @@ public: //@} private: - FormCopyright() {} - FormCopyright(FormCopyright &) : DialogBase() {} - /**@name Slot Methods */ //@{ /// Create the dialog if necessary, update it and display it. diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index f16d0244dd..92fa4acdba 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -3,10 +3,13 @@ */ #include -#include "lyx_gui_misc.h" -#include "gettext.h" + #include FORMS_H_LOCATION +#ifdef __GNUG_ +#pragma implementation +#endif + #include "FormPreferences.h" #include "form_preferences.h" #include "xform_macros.h" @@ -16,7 +19,8 @@ #include "Dialogs.h" #include "lyxrc.h" #include "debug.h" - +#include "lyx_gui_misc.h" +#include "gettext.h" #ifdef SIGC_CXX_NAMESPACES using SigC::slot; diff --git a/src/frontends/xforms/FormPreferences.h b/src/frontends/xforms/FormPreferences.h index 6014914cb0..b53dddd99f 100644 --- a/src/frontends/xforms/FormPreferences.h +++ b/src/frontends/xforms/FormPreferences.h @@ -18,8 +18,10 @@ #define FORMPREFERENCES_H #include "DialogBase.h" -#ifdef SIGC_CXX_NAMESPACES -using SigC::Connection; +#include "support/utility.hpp" + +#ifdef __GNUG_ +#pragma interface #endif class LyXView; @@ -32,10 +34,14 @@ struct FD_form_interface_fonts; struct FD_form_printer; struct FD_form_paths; +#ifdef SIGC_CXX_NAMESPACES +using SigC::Connection; +#endif + /** This class provides an XForms implementation of the FormPreferences Dialog. The preferences dialog allows users to set/save their preferences. */ -class FormPreferences : public DialogBase { +class FormPreferences : public DialogBase, public noncopyable { public: /**@name Constructors and Destructors */ //@{ @@ -55,9 +61,6 @@ public: //@} private: - FormPreferences() {} - FormPreferences(FormPreferences &) : DialogBase() {} - /**@name Slot Methods */ //@{ /// Create the dialog if necessary, update it and display it. diff --git a/src/frontends/xforms/FormPrint.C b/src/frontends/xforms/FormPrint.C index 70894485c5..617e31d150 100644 --- a/src/frontends/xforms/FormPrint.C +++ b/src/frontends/xforms/FormPrint.C @@ -3,10 +3,13 @@ */ #include -#include "lyx_gui_misc.h" -#include "gettext.h" + #include FORMS_H_LOCATION +#ifdef __GNUG__ +#pragma implementation +#endif + #include "FormPrint.h" #include "form_print.h" #include "xform_macros.h" @@ -19,6 +22,8 @@ #include "Liason.h" #include "debug.h" #include "BufferView.h" +#include "lyx_gui_misc.h" +#include "gettext.h" #ifdef SIGC_CXX_NAMESPACES diff --git a/src/frontends/xforms/FormPrint.h b/src/frontends/xforms/FormPrint.h index f9e2d7b27c..5d96a93304 100644 --- a/src/frontends/xforms/FormPrint.h +++ b/src/frontends/xforms/FormPrint.h @@ -18,18 +18,24 @@ #define FORMPRINT_H #include "DialogBase.h" -#ifdef SIGC_CXX_NAMESPACES -using SigC::Connection; +#include "support/utility.hpp" + +#ifdef __GNUG__ +#pragma interface #endif class LyXView; class Dialogs; struct FD_form_print; +#ifdef SIGC_CXX_NAMESPACES +using SigC::Connection; +#endif + /** This class provides an XForms implementation of the FormPrint Dialog. The print dialog allows users to print their documents. */ -class FormPrint : public DialogBase { +class FormPrint : public DialogBase, public noncopyable { public: /**@name Constructors and Destructors */ //@{ @@ -49,9 +55,6 @@ public: //@} private: - FormPrint() {} - FormPrint(FormPrint &) : DialogBase() {} - /**@name Slot Methods */ //@{ /// Create the dialog if necessary, update it and display it. diff --git a/src/frontends/xforms/FormUrl.C b/src/frontends/xforms/FormUrl.C index bceee127ed..5085e68cef 100644 --- a/src/frontends/xforms/FormUrl.C +++ b/src/frontends/xforms/FormUrl.C @@ -10,8 +10,15 @@ */ #include -#include "gettext.h" + #include FORMS_H_LOCATION + +#ifdef __GNUG__ +#pragma implementation +#endif + + +#include "gettext.h" #include "BufferView.h" #include "Dialogs.h" #include "FormUrl.h" @@ -24,10 +31,6 @@ #include "insets/inseturl.h" #include "support/filetools.h" -#ifdef __GNUG__ -#pragma implementation -#endif - C_RETURNCB(FormUrl, WMHideCB) C_GENERICCB(FormUrl, OKCB) C_GENERICCB(FormUrl, CancelCB) diff --git a/src/frontends/xforms/FormUrl.h b/src/frontends/xforms/FormUrl.h index b4a804da2f..c82f4f9025 100644 --- a/src/frontends/xforms/FormUrl.h +++ b/src/frontends/xforms/FormUrl.h @@ -15,15 +15,21 @@ #include "DialogBase.h" #include "LString.h" +#include "support/utility.hpp" + class Dialogs; class LyXView; class InsetCommandParams; class InsetUrl; struct FD_form_url; +#ifdef __GNUG__ +#pragma interface +#endif + /** This class provides an XForms implementation of the FormUrl Dialog. */ -class FormUrl : public DialogBase { +class FormUrl : public DialogBase, public noncopyable { public: /**@name Constructors and Destructors */ //@{ @@ -41,9 +47,6 @@ public: //@} private: - FormUrl() {} - FormUrl(FormUrl &) : DialogBase() {} - /**@name Slot Methods */ //@{ /// Create the dialog if necessary, update it and display it. diff --git a/src/frontends/xforms/Makefile.am b/src/frontends/xforms/Makefile.am index 8d3cd47456..594dfd35b1 100644 --- a/src/frontends/xforms/Makefile.am +++ b/src/frontends/xforms/Makefile.am @@ -31,6 +31,10 @@ libxforms_la_SOURCES = \ FormTabular.h \ form_tabular.C \ form_tabular.h \ + FormUrl.C \ + FormUrl.h \ + form_url.C \ + form_url.h \ Toolbar_pimpl.C \ Toolbar_pimpl.h \ Menubar_pimpl.C \ diff --git a/src/insets/form_url.C b/src/insets/form_url.C deleted file mode 100644 index cffbd71d6a..0000000000 --- a/src/insets/form_url.C +++ /dev/null @@ -1,41 +0,0 @@ -// File modified by fdfix.sh for use by lyx (with xforms 0.81) and gettext -#include -#include "lyx_gui_misc.h" -#include "gettext.h" - -/* Form definition file generated with fdesign. */ - -#include FORMS_H_LOCATION -#include -#include "form_url.h" - -FD_form_url *create_form_form_url(void) -{ - FL_OBJECT *obj; - FD_form_url *fdui = (FD_form_url *) fl_calloc(1, sizeof(FD_form_url)); - - fdui->form_url = fl_bgn_form(FL_NO_BOX, 530, 150); - obj = fl_add_box(FL_UP_BOX, 0, 0, 530, 150, ""); - fdui->url_name = obj = fl_add_input(FL_NORMAL_INPUT, 50, 20, 460, 30, _("Url")); - fl_set_input_shortcut(obj, scex(_("Url|#U")), 1); - fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); - fl_set_object_resize(obj, FL_RESIZE_X); - fdui->name_name = obj = fl_add_input(FL_NORMAL_INPUT, 50, 60, 460, 30, _("Name")); - fl_set_input_shortcut(obj, scex(_("Name|#N")), 1); - fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); - fl_set_object_resize(obj, FL_RESIZE_X); - fdui->radio_html = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 50, 110, 250, 30, _("HTML type")); - fl_set_button_shortcut(obj, scex(_("HTML type|#H")), 1); - fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); - fl_set_object_resize(obj, FL_RESIZE_X); - fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 410, 110, 100, 30, _("Close")); - fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, C_InsetUrl_CloseUrlCB, 0); - fl_end_form(); - - //fdui->form_url->fdui = fdui; - - return fdui; -} -/*---------------------------------------*/ - diff --git a/src/insets/form_url.h b/src/insets/form_url.h deleted file mode 100644 index b212c08c7c..0000000000 --- a/src/insets/form_url.h +++ /dev/null @@ -1,24 +0,0 @@ -/** Header file generated with fdesign on Mon Oct 25 15:21:02 1999.**/ - -#ifndef FD_form_url_h_ -#define FD_form_url_h_ - -/** Callbacks, globals and object handlers **/ -extern "C" void C_InsetUrl_CloseUrlCB(FL_OBJECT *, long); - - -/**** Forms and Objects ****/ -typedef struct { - FL_FORM *form_url; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *url_name; - FL_OBJECT *name_name; - FL_OBJECT *radio_html; - FL_OBJECT *button_close; -} FD_form_url; - -extern FD_form_url * create_form_form_url(void); - -#endif /* FD_form_url_h_ */ diff --git a/src/insets/insetbib.h b/src/insets/insetbib.h index f0b302ab77..52893fb97f 100644 --- a/src/insets/insetbib.h +++ b/src/insets/insetbib.h @@ -93,7 +93,7 @@ public: /// Inset * Clone() const { - return new InsetBibtex(getCmdName(), getOptions(), 0); + return new InsetBibtex(getCmdName(), getOptions(), owner); } /// Inset::Code LyxCode() const diff --git a/src/support/Makefile.am b/src/support/Makefile.am index 96d51d3786..a7a038facc 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -55,4 +55,5 @@ libsupport_la_SOURCES = \ syscontr.C \ syscontr.h \ syssingleton.C \ - textutils.h + textutils.h \ + utility.hpp diff --git a/src/support/utility.hpp b/src/support/utility.hpp new file mode 100644 index 0000000000..cdbcb3529e --- /dev/null +++ b/src/support/utility.hpp @@ -0,0 +1,66 @@ +// boost utility.hpp header file ----------------------------------------// + +// (C) Copyright boost.org 1999. Permission to copy, use, modify, sell +// and distribute this software is granted provided this copyright +// notice appears in all copies. This software is provided "as is" without +// express or implied warranty, and with no claim as to its suitability for +// any purpose. + +// See http://www.boost.org for most recent version including documentation. + +// Classes appear in alphabetical order + +// Revision History +// 10 Dec 99 next() and prior() templates added. +// 30 Aug 99 moved cast templates to cast.hpp +// 3 Aug 99 cast templates added +// 20 Jul 99 name changed to utility.hpp +// 9 Jun 99 protected noncopyable default ctor +// 2 Jun 99 Initial Version. Class noncopyable only contents. + +#ifndef BOOST_UTILITY_HPP +#define BOOST_UTILITY_HPP + +//#include +//#include // for size_t + +//namespace boost +//{ + +// next() and prior() template functions -----------------------------------// + + // Helper functions for classes like bidirectional iterators not supporting + // operator+ and operator-. + // + // Usage: + // const std::list::iterator p = get_some_iterator(); + // const std::list::iterator prev = boost::prior(p); + + // Contributed by Dave Abrahams + + template + T next(T x) { return ++x; } + + template + T prior(T x) { return --x; } + + +// class noncopyable -------------------------------------------------------// + + // Private copy constructor and copy assignment ensure classes derived from + // class noncopyable cannot be copied. + + // Contributed by Dave Abrahams + + class noncopyable + { + protected: + noncopyable(){} + private: // emphasize the following members are private + noncopyable( const noncopyable& ); + const noncopyable& operator=( const noncopyable& ); + }; // noncopyable + +//} // namespace boost + +#endif // BOOST_UTILITY_HPP