From 63a2dbaf640cf20c006f6eb35bdd5fb3e1363d12 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 21 Jun 2018 13:46:12 +1200 Subject: [PATCH] Use XPM for toolbar bitmaps on Microsoft Windows We were using PNGs via RCDATA, but that seems to be buggy and some of the toolbar buttons end up showing the wrong icon. --- .gitignore | 1 - lib/icons/Makefile.am | 17 +---------------- src/aven.rc | 1 - src/mainfrm.cc | 10 ++++++---- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 0538c8ec..3f47099e 100644 --- a/.gitignore +++ b/.gitignore @@ -60,7 +60,6 @@ lib/icons/Makefile.in lib/icons/*.ico lib/icons/*.iconset.zip lib/icons/*.rcdata -lib/icons/aven-icons.rc missing src/*.o src/.deps/ diff --git a/lib/icons/Makefile.am b/lib/icons/Makefile.am index cca54f74..e69d97fb 100644 --- a/lib/icons/Makefile.am +++ b/lib/icons/Makefile.am @@ -31,14 +31,6 @@ xpm_files = \ survey_tree.xpm \ pres_tree.xpm -# These ".rcdata" files are PNGs, but we end up with a loop of implicit rules -# if we call them ".png", and the .rc file doesn't care about the extension. -rcdata_files = $(xpm_files:.xpm=.rcdata) - -aven-icons.rc: Makefile.am - perl -e 'for (@ARGV) { /(.*)\.rcdata$$/ and $$1 ne "aven" and print "$$1 RCDATA $$_\n" }' \ - $(rcdata_files) > aven-icons.rc - EXTRA_DIST = \ 3d.svg err.svg plt.svg pos.svg svx.svg \ 3d.png err.png plt.png pos.png svx.png @@ -86,21 +78,14 @@ SUFFIXES = .ico .png .svg .iconset.zip .xpm .xpm.ico: $(SHELL) $(srcdir)/xpm2winicon $< $@ -.xpm.rcdata: - $(SHELL) $(srcdir)/xpm2png $< $@ - iconsets = Aven.iconset.zip\ 3d.iconset.zip err.iconset.zip plt.iconset.zip pos.iconset.zip\ svx.iconset.zip -MAINTAINERCLEANFILES = $(iconsets) $(rcdata_files) - -BUILT_SOURCES = aven-icons.rc $(rcdata_files) +MAINTAINERCLEANFILES = $(iconsets) EXTRA_DIST += png2winicon png2iconsetzip svg2iconsetzip\ - aven-icons.rc\ $(xpm_files)\ - $(rcdata_files)\ aven.ico\ 3d.ico err.ico plt.ico pos.ico svx.ico\ $(iconsets) diff --git a/src/aven.rc b/src/aven.rc index c286fd24..d836d9f7 100644 --- a/src/aven.rc +++ b/src/aven.rc @@ -1,3 +1,2 @@ AAA_aven ICON aven.ico -#include "../lib/icons/aven-icons.rc" #include "wx/msw/wx.rc" diff --git a/src/mainfrm.cc b/src/mainfrm.cc index 0298d090..129f497b 100644 --- a/src/mainfrm.cc +++ b/src/mainfrm.cc @@ -57,14 +57,13 @@ #include #include -#ifdef __WXMSW__ -#define TOOL(x) wxBitmap(wxT(#x), wxBITMAP_TYPE_PNG_RESOURCE) -#else // XPM files declare the array as static, but we also want it to be const too. // This avoids a compiler warning, and also means the data can go in a // read-only page and be shared between processes. #define static static const +#ifndef __WXMSW__ #include "../lib/icons/aven.xpm" +#endif #include "../lib/icons/log.xpm" #include "../lib/icons/open.xpm" #include "../lib/icons/open_pres.xpm" @@ -94,7 +93,10 @@ #include "../lib/icons/survey_tree.xpm" #include "../lib/icons/pres_tree.xpm" #undef static -#define TOOL(x) wxBITMAP(x) +#ifdef __WXMSW__ +# define TOOL(x) wxBitmap(x##_xpm) +#else +# define TOOL(x) wxBITMAP(x) #endif using namespace std; -- 2.11.4.GIT