From 2e9b5717cdd0e824dbccdb9d60e2d6db095d13b8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 31 Dec 2010 17:39:37 +0000 Subject: [PATCH] Add wxUSE_ARTPROVIDER_STD build option. Make it possible to exclude wxDefaultArtProvider from build. Now that a Tango-based provider exists, it may make sense to disable the standard bitmaps if the program doesn't need the few of them not provided by Tango anyhow. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 52 +++++++++++++++++++++++++ configure.in | 5 +++ docs/doxygen/mainpages/const_wxusedef.h | 1 + include/wx/artprov.h | 2 + include/wx/chkconf.h | 8 ++++ include/wx/motif/setup0.h | 16 +++++++- include/wx/msw/setup0.h | 16 +++++++- include/wx/msw/wince/setup.h | 16 +++++++- include/wx/os2/setup0.h | 16 +++++++- include/wx/osx/setup0.h | 18 ++++++++- include/wx/palmos/setup0.h | 16 +++++++- include/wx/setup_inc.h | 13 +++++++ include/wx/univ/setup0.h | 16 +++++++- setup.h.in | 2 + src/common/artprov.cpp | 2 + src/common/artstd.cpp | 4 ++ 16 files changed, 195 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 9be6e6156f..643ad0d725 100755 --- a/configure +++ b/configure @@ -1806,6 +1806,7 @@ Optional Features: --disable-controls disable compilation of all standard controls --enable-accel use accelerators --enable-animatectrl use wxAnimationCtrl class + --enable-artstd use standard XPM icons in wxArtProvider --enable-arttango use Tango icons in wxArtProvider --enable-bmpbutton use wxBitmapButton class --enable-bmpcombobox use wxBitmapComboBox class @@ -9899,6 +9900,50 @@ fi echo "${ECHO_T}$result" >&6; } + enablestring= + defaultval=$wxUSE_ALL_FEATURES + if test -z "$defaultval"; then + if test x"$enablestring" = xdisable; then + defaultval=yes + else + defaultval=no + fi + fi + + { echo "$as_me:$LINENO: checking for --${enablestring:-enable}-artstd" >&5 +echo $ECHO_N "checking for --${enablestring:-enable}-artstd... $ECHO_C" >&6; } + # Check whether --enable-artstd was given. +if test "${enable_artstd+set}" = set; then + enableval=$enable_artstd; + if test "$enableval" = yes; then + wx_cv_use_artstd='wxUSE_ARTPROVIDER_STD=yes' + else + wx_cv_use_artstd='wxUSE_ARTPROVIDER_STD=no' + fi + +else + + wx_cv_use_artstd='wxUSE_ARTPROVIDER_STD=${'DEFAULT_wxUSE_ARTPROVIDER_STD":-$defaultval}" + +fi + + + eval "$wx_cv_use_artstd" + + if test x"$enablestring" = xdisable; then + if test $wxUSE_ARTPROVIDER_STD = no; then + result=yes + else + result=no + fi + else + result=$wxUSE_ARTPROVIDER_STD + fi + + { echo "$as_me:$LINENO: result: $result" >&5 +echo "${ECHO_T}$result" >&6; } + + enablestring= defaultval=$wxUSE_ALL_FEATURES if test -z "$defaultval"; then @@ -47575,6 +47620,13 @@ _ACEOF SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS access" fi +if test "$wxUSE_ARTPROVIDER_STD" = "yes"; then + cat >>confdefs.h <<\_ACEOF +#define wxUSE_ARTPROVIDER_STD 1 +_ACEOF + +fi + if test "$wxUSE_ARTPROVIDER_TANGO" = "auto"; then if test "$wxUSE_GTK" != 1; then if test "$wxUSE_LIBPNG" != no -a \ diff --git a/configure.in b/configure.in index 214c7034ba..a9f6d3b791 100644 --- a/configure.in +++ b/configure.in @@ -928,6 +928,7 @@ fi dnl please keep the settings below in alphabetical order WX_ARG_FEATURE(accel, [ --enable-accel use accelerators], wxUSE_ACCEL) WX_ARG_FEATURE(animatectrl, [ --enable-animatectrl use wxAnimationCtrl class], wxUSE_ANIMATIONCTRL) +WX_ARG_FEATURE(artstd, [ --enable-artstd use standard XPM icons in wxArtProvider], wxUSE_ARTPROVIDER_STD) WX_ARG_FEATURE(arttango, [ --enable-arttango use Tango icons in wxArtProvider], wxUSE_ARTPROVIDER_TANGO) WX_ARG_FEATURE(bmpbutton, [ --enable-bmpbutton use wxBitmapButton class], wxUSE_BMPBUTTON) WX_ARG_FEATURE(bmpcombobox, [ --enable-bmpcombobox use wxBitmapComboBox class], wxUSE_BITMAPCOMBOBOX) @@ -7147,6 +7148,10 @@ if test "$wxUSE_ACCESSIBILITY" = "yes"; then SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS access" fi +if test "$wxUSE_ARTPROVIDER_STD" = "yes"; then + AC_DEFINE(wxUSE_ARTPROVIDER_STD) +fi + if test "$wxUSE_ARTPROVIDER_TANGO" = "auto"; then dnl Tango-based art provider is not needed in GTK-based ports as the dnl native art provider completely replaces it. diff --git a/docs/doxygen/mainpages/const_wxusedef.h b/docs/doxygen/mainpages/const_wxusedef.h index e20ac867b5..693bce4a13 100644 --- a/docs/doxygen/mainpages/const_wxusedef.h +++ b/docs/doxygen/mainpages/const_wxusedef.h @@ -67,6 +67,7 @@ library: @itemdef{wxUSE_ACCEL, Use wxAcceleratorTable/Entry classes and support for them in wxMenu, wxMenuBar.} @itemdef{wxUSE_AFM_FOR_POSTSCRIPT, In wxPostScriptDC class use AFM (adobe font metrics) file for character widths.} @itemdef{wxUSE_ANIMATIONCTRL, Use wxAnimationCtrl class.} +@itemdef{wxUSE_ARTPROVIDER_STD, Use standard low quality icons in wxArtProvider.} @itemdef{wxUSE_ARTPROVIDER_TANGO, Use Tango icons in wxArtProvider.} @itemdef{wxUSE_ANY, Use wxAny class.} @itemdef{wxUSE_APPLE_IEEE, IEEE Extended to/from double routines; see src/common/extended.c file.} diff --git a/include/wx/artprov.h b/include/wx/artprov.h index f62ef93e93..fcc93518f6 100644 --- a/include/wx/artprov.h +++ b/include/wx/artprov.h @@ -201,8 +201,10 @@ public: protected: friend class wxArtProviderModule; +#if wxUSE_ARTPROVIDER_STD // Initializes default provider static void InitStdProvider(); +#endif // wxUSE_ARTPROVIDER_STD // Initializes Tango-based icon provider #if wxUSE_ARTPROVIDER_TANGO static void InitTangoProvider(); diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index 78e125919b..10c79baad6 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -407,6 +407,14 @@ # endif #endif /* !defined(wxUSE_ANIMATIONCTRL) */ +#ifndef wxUSE_ARTPROVIDER_STD +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ARTPROVIDER_STD must be defined, please read comment near the top of this file." +# else +# define wxUSE_ARTPROVIDER_STD 0 +# endif +#endif /* !defined(wxUSE_ARTPROVIDER_STD) */ + #ifndef wxUSE_ARTPROVIDER_TANGO # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_ARTPROVIDER_TANGO must be defined, please read comment near the top of this file." diff --git a/include/wx/motif/setup0.h b/include/wx/motif/setup0.h index ab0c073228..4fc403229b 100644 --- a/include/wx/motif/setup0.h +++ b/include/wx/motif/setup0.h @@ -912,11 +912,25 @@ // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + // Use art provider providing Tango icons: this art provider has higher quality // icons than the default ones using smaller size XPM icons without // transparency but the embedded PNG icons add to the library size. // -// Default is 1. +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. // // Recommended setting: 1 but can be turned off to reduce the library size. #define wxUSE_ARTPROVIDER_TANGO 1 diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 5b9ee87ddb..703e872ad9 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -912,11 +912,25 @@ // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + // Use art provider providing Tango icons: this art provider has higher quality // icons than the default ones using smaller size XPM icons without // transparency but the embedded PNG icons add to the library size. // -// Default is 1. +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. // // Recommended setting: 1 but can be turned off to reduce the library size. #define wxUSE_ARTPROVIDER_TANGO 1 diff --git a/include/wx/msw/wince/setup.h b/include/wx/msw/wince/setup.h index 1e23c01235..d01ee02635 100644 --- a/include/wx/msw/wince/setup.h +++ b/include/wx/msw/wince/setup.h @@ -912,11 +912,25 @@ // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + // Use art provider providing Tango icons: this art provider has higher quality // icons than the default ones using smaller size XPM icons without // transparency but the embedded PNG icons add to the library size. // -// Default is 1. +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. // // Recommended setting: 1 but can be turned off to reduce the library size. #define wxUSE_ARTPROVIDER_TANGO 1 diff --git a/include/wx/os2/setup0.h b/include/wx/os2/setup0.h index baf55dae1c..cf5b66fbaa 100644 --- a/include/wx/os2/setup0.h +++ b/include/wx/os2/setup0.h @@ -912,11 +912,25 @@ // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + // Use art provider providing Tango icons: this art provider has higher quality // icons than the default ones using smaller size XPM icons without // transparency but the embedded PNG icons add to the library size. // -// Default is 1. +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. // // Recommended setting: 1 but can be turned off to reduce the library size. #define wxUSE_ARTPROVIDER_TANGO 1 diff --git a/include/wx/osx/setup0.h b/include/wx/osx/setup0.h index 9cda8cd666..812597c67e 100644 --- a/include/wx/osx/setup0.h +++ b/include/wx/osx/setup0.h @@ -913,11 +913,25 @@ // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + // Use art provider providing Tango icons: this art provider has higher quality // icons than the default ones using smaller size XPM icons without // transparency but the embedded PNG icons add to the library size. // -// Default is 1. +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. // // Recommended setting: 1 but can be turned off to reduce the library size. #define wxUSE_ARTPROVIDER_TANGO 1 @@ -1133,7 +1147,7 @@ // // Recommended setting: default or 0 for everything for portable programs. #define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 0 +#define wxUSE_ENH_METAFILE 1 #define wxUSE_WIN_METAFILES_ALWAYS 0 // ---------------------------------------------------------------------------- diff --git a/include/wx/palmos/setup0.h b/include/wx/palmos/setup0.h index 46bad4cd06..9b7f64783d 100644 --- a/include/wx/palmos/setup0.h +++ b/include/wx/palmos/setup0.h @@ -912,11 +912,25 @@ // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + // Use art provider providing Tango icons: this art provider has higher quality // icons than the default ones using smaller size XPM icons without // transparency but the embedded PNG icons add to the library size. // -// Default is 1. +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. // // Recommended setting: 1 but can be turned off to reduce the library size. #define wxUSE_ARTPROVIDER_TANGO 1 diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index 3d99d6c155..8b917569bc 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -908,6 +908,19 @@ // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + // Use art provider providing Tango icons: this art provider has higher quality // icons than the default ones using smaller size XPM icons without // transparency but the embedded PNG icons add to the library size. diff --git a/include/wx/univ/setup0.h b/include/wx/univ/setup0.h index badd59bd65..d07c861209 100644 --- a/include/wx/univ/setup0.h +++ b/include/wx/univ/setup0.h @@ -911,11 +911,25 @@ // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + // Use art provider providing Tango icons: this art provider has higher quality // icons than the default ones using smaller size XPM icons without // transparency but the embedded PNG icons add to the library size. // -// Default is 1. +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. // // Recommended setting: 1 but can be turned off to reduce the library size. #define wxUSE_ARTPROVIDER_TANGO 1 diff --git a/setup.h.in b/setup.h.in index e8d30e4134..b1f8916a9f 100644 --- a/setup.h.in +++ b/setup.h.in @@ -426,6 +426,8 @@ #define wxUSE_ACCEL 0 +#define wxUSE_ARTPROVIDER_STD 0 + #define wxUSE_ARTPROVIDER_TANGO 0 #define wxUSE_HOTKEY 0 diff --git a/src/common/artprov.cpp b/src/common/artprov.cpp index acf173b8b3..dac5bd30b7 100644 --- a/src/common/artprov.cpp +++ b/src/common/artprov.cpp @@ -440,7 +440,9 @@ class wxArtProviderModule: public wxModule public: bool OnInit() { +#if wxUSE_ARTPROVIDER_STD wxArtProvider::InitStdProvider(); +#endif // wxUSE_ARTPROVIDER_STD #if wxUSE_ARTPROVIDER_TANGO wxArtProvider::InitTangoProvider(); #endif // wxUSE_ARTPROVIDER_TANGO diff --git a/src/common/artstd.cpp b/src/common/artstd.cpp index c12a849c9d..49fbe51d33 100644 --- a/src/common/artstd.cpp +++ b/src/common/artstd.cpp @@ -20,6 +20,8 @@ #pragma hdrstop #endif +#if wxUSE_ARTPROVIDER_STD + #ifndef WX_PRECOMP #include "wx/image.h" #endif @@ -246,3 +248,5 @@ wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id, return bmp; } + +#endif // wxUSE_ARTPROVIDER_STD -- 2.47.2