Blob Blame History Raw
diff -r 34e37068b6c7 -r 47f4a1712c25 changelog.txt
--- a/changelog.txt	Thu Apr 17 22:17:56 2014 +0100
+++ b/changelog.txt	Thu Apr 24 00:06:18 2014 +0100
@@ -1,3 +1,90 @@
+* 01 Mar 2014 : 0.0.16
+	Features:
+	- Added experimental LAWATAP (ATO) file support
+		- Please send sample files!
+
+	User Visible Changes:
+	- Animation state now saved/restored	
+	- Plot interaction should be much faster
+	- Minor UI improvements
+		- Filter tree now persistent when interacting, where possible
+		- Mouse hover shows name on plot regions (ranges)
+		- Show user prompt when no filters present
+		- Nicer text fonts
+		- Clustering filter properties simplified
+		- Nicer looking logarithmic plots
+		- Left plot panel now remembers size correctly
+	- Minor 3D drawing fixes
+		- Fixed inside-out cones on bounding box Z-axis
+		- Fixed line-overlap-arrow with large annotation arrow linewidths
+	- Allow loading text files with 3 columns
+	- Fixed random_shuffle not being seeded in transform relabel
+	- Composition profiles now have "min count" mode
+	- Rotating camera image output was broken in version 0.0.15 - fixed
+	- Prevent creation of "stretched" image output
+	
+	Technical bugfixes/changes:
+	- Linux automated UI checking, based on dogtail
+	- Bugfix for caching errors in 0.0.15 tarball (already fixed in binary releases, and in repo)
+		- many filters would incorrectly emit input data after caching
+	- Many minor memory leaks and bugs fixed, due to Coverity scan
+	- No longer launch 3Depict from windows installer
+		- Windows UAC bug : no API for launching unprivileged processes from privileged ones
+	- Fix crash with some tree configurations
+	- Unit tests now check for installed files presence
+	- Fix crash when linked against some mathgl-2 versions
+	- Fixed SVG saving under non-english locales
+	- Add support for qhull2012
+	- Fixed caching parameter ineffective, due to fraction->percent bug 
+	- Fixed packages with anaglyph effect not loading
+
+* 01 Dec 2013 : 0.0.15
+	Features
+	- Range editing dialog : Rangefiles can be modified via a dialog available from the "edit" menu
+		- A Range filter and a spectra filter must be present first
+		- "Overlays" can be used to generate isotopic distributions for comparison
+	- "Binomial analysis" algorithm, (Moody et al, 2011) for data randomness testing
+	
+	User Visible Changes:
+	- Middle double click to zoomout on plots
+	- Improved user feedback in transform filter
+	- Better console output, messages now persistent
+	- Progress dialog for animation
+	- Colour bar auto-changes colour on light backgrounds
+	- Colour maps now reversible
+	- Orthogonal camera can be selected by default
+	- Improved RRNG and ENV support
+		- ENV 0.3 supported
+	
+	User Visible Bugfixes:
+	- Image export fixed wrong aspect ratio ion output images
+	- Fix plot export dialog when (png/svg) extension given
+	- Fix tree/property grid not always synchronised
+	- Fix "jumping" of movable objects after interaction
+	- Fix custom filter names not being saved correctly 
+	- Fix undo not recorded after tree copy 
+	- Fix axial dist aborting problem
+	- Fix loading of .xy files from external program filter
+	- Fix hang when disabling weak/fast randomisation
+	- Fix intermittent problems with spatial analysis filter aborting
+	- Fix incorrect parsing of external program commands
+	- Fix state file loading in downsample filter, fixed count mode
+	- Fix camera animation continually asking if you want to save,
+	  after animation completion
+	- Fix colour interpolation in animate dialog
+
+	Technical bugfixes/changes:
+	- Fix hang when filters given directories as input (linux)
+	- Fix bug in extern filter where data would be output even on empty command
+	- Better out-of-memory exception handling at refresh level
+	- Various memory leak fixes
+	- Refactoring
+		- filter caching 
+		- unit testing 
+		- scene opengl init
+	- More unit testing 
+	- Remove plot pane polling for region change
+
 * 20 Jul 2013 : 0.0.14
 	Features:
 	- 2D slice render mode for voxels. Can now visualise voxel data
@@ -130,7 +217,7 @@
 	  callback re-entrancy, which caused some crashes.
 	- Fixed several small memory leaks
 	- More unit testing, and fix some non-working unit tests,
-	  eg transform shuffle, which wansn't checking shuffled state
+	  eg transform shuffle, which wasn't checking shuffled state
 	  correctly, and hence did very little
 	- Minor openMP fixes
 	- Many cppcheck fixes - mostly stylistic, or minor performance improvements
diff -r 34e37068b6c7 -r 47f4a1712c25 configure
--- a/configure	Thu Apr 17 22:17:56 2014 +0100
+++ b/configure	Thu Apr 24 00:06:18 2014 +0100
@@ -5547,16 +5547,22 @@
 
 WANT_WINDRES="no"
 case "${host_os}" in
-	*w64_mingw*)
+	*mingw*)
 		#wx-config is a little unreliable in cross-compile mode
 		# Manually append -DUNICODE to cppflags/cxxflags
 		WX_CXXFLAGS="$WX_CXXFLAGS -DUNICODE"
 		WX_CPPFLAGS="$WX_CPPFLAGS -DUNICODE"
-		WANT_WINDRES="true"
+		WANT_WINDRES="yes"
+		;;
+	*)
+		as_fn_error $? " Windres check is screwed" "$LINENO" 5
 		;;
 esac
 
- if  test x$WANT_WINDRES= xtrue  ; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $WANT_WINDRES" >&5
+$as_echo "$WANT_WINDRES" >&6; }
+
+ if  test x$WANT_WINDRES==xyes ; then
   HAVE_WINDRES_TRUE=
   HAVE_WINDRES_FALSE='#'
 else
diff -r 34e37068b6c7 -r 47f4a1712c25 configure.ac
--- a/configure.ac	Thu Apr 17 22:17:56 2014 +0100
+++ b/configure.ac	Thu Apr 24 00:06:18 2014 +0100
@@ -38,16 +38,18 @@
 
 WANT_WINDRES="no"
 case "${host_os}" in 
-	*w64_mingw*)
+	*mingw*)
 		#wx-config is a little unreliable in cross-compile mode
 		# Manually append -DUNICODE to cppflags/cxxflags
 		WX_CXXFLAGS="$WX_CXXFLAGS -DUNICODE"
 		WX_CPPFLAGS="$WX_CPPFLAGS -DUNICODE"
-		WANT_WINDRES="true"
+		WANT_WINDRES="yes"
 		;;
 esac
 
-AM_CONDITIONAL([HAVE_WINDRES], [ test x$WANT_WINDRES= xtrue ] )
+AC_MSG_RESULT([$WANT_WINDRES])
+
+AM_CONDITIONAL([HAVE_WINDRES], [ test x$WANT_WINDRES==xyes] )
 
 
 AC_SUBST(WX_LIBS)
diff -r 34e37068b6c7 -r 47f4a1712c25 packaging/mingw-debian-cross/bootstrap.sh
--- a/packaging/mingw-debian-cross/bootstrap.sh	Thu Apr 17 22:17:56 2014 +0100
+++ b/packaging/mingw-debian-cross/bootstrap.sh	Thu Apr 24 00:06:18 2014 +0100
@@ -36,6 +36,19 @@
 if [ $HOST_VAL != "x86_64-w64-mingw32" ] && [ $HOST_VAL != i686-w64-mingw32 ] ; then
 	echo "Unknown HOST_VAL"
 	exit 1
+else 
+	case $HOST_VAL in
+		x86_64-w64-mingw32)
+			BITS_VAL=64
+			;;
+		i686-w64-mingw32)
+			BITS_VAL=32
+			;;
+		*)
+			echo "Should not have got here - bug!"
+			exit 1
+			;;
+	esac
 fi
 
 #----
@@ -75,8 +88,7 @@
 
 PATCHES_GLEW="glew-makefile.base"
 
-#Disable broken build for "widgets" directory, which we don't need
-PATCHES_MATHGL="mathgl-disable-widgets"
+PATCHES_MATHGL="mathgl-cmake"
 
 PATCH_LIST="$PATCHES_WXWIDGETS_PRE $PATCHES_WXWIDGETS_POST $PATCHES_GSL $PATCHES_ZLIB $PATCHES_LIBPNG $PATCHES_GETTEXT $PATCHES_FTGL $PATCHES_GLEW $PATCHES_MATHGL $PATCHES_FTGL_POSTCONF"
 
@@ -123,7 +135,7 @@
 	GET_PACKAGES="";
 	for i in $MINGW_PACKAGES
 	do
-		if [ x`apt-cache pkgnames --installed $i` != x"$i" ] ; then
+		if [ x`dpkg --get-selections | grep ^$i | awk '{print $1}'  ` != x"$i" ] ; then
 			GET_PACKAGES="$GET_PACKAGES $i";
 		fi
 	done
@@ -163,6 +175,13 @@
 	if [ x"$GET_PACKAGES" != x"" ] ; then
 		apt-get source $GET_PACKAGES
 
+		if [ $? -ne 0 ] ; then
+			echo "Package retrieval failed"
+			echo "apt-get source failed... Maybe check internet connection, then try updating package database, then re-run?"
+			echo " other possibilities could include, eg, that the required package is not available in the debian archive.."
+			exit 1
+		fi
+
 		for i in $GET_PACKAGES
 		do
 			grep -v $i ../build-status > tmp
@@ -174,11 +193,7 @@
 
 		done
 	fi
-	
-	if [ $? -ne 0 ] ; then
-		echo "apt-get source failed... Maybe check internet connection, then try updating package database, then re-run?"
-		exit 1
-	fi
+
 
 	#Move debian stuff into packages folder
 	if [ x"$GET_PACKAGES" != x"" ] ; then
@@ -350,7 +365,7 @@
 	fi
 
 	#Perform dynamic modification of patch
-	if [ x`grep patches/glew-makefile.base HOST_VAL` == x""   ||  x`grep patches/glew-makefile.base BASEDIR` == x"" ] ; then
+	if [ x"`grep HOST_VAL patches/glew-makefile.base`" == x""  -o   x"`grep BASEDIR patches/glew-makefile.base`" == x"" ] ; then
 		echo "patches/glew-makefile did not contain replacement keywords"
 		exit 1
 	fi
@@ -596,14 +611,18 @@
 
 	make clean
 
-	./configure --host=$HOST_VAL --enable-shared --disable-static --prefix=/ || { echo "qhull configure failed"; exit 1; } 
+	sed -i "s/ gcc$/${HOST_VAL}-gcc/" Makefile
+	sed -i "s/ g++$/${HOST_VAL}-g++/" Makefile
 
-	make -j $NUM_PROCS || { echo "qhull build failed"; exit 1; } 
-	
+	make SO="dll" -j $NUM_PROCS 
+	find ./ -name \*dll -exec cp {} ${BASE}/bin/	
+	make SO="dll" -j $NUM_PROCS || { echo "qhull build failed"; exit 1; } 
 	make install DESTDIR="$BASE"|| { echo "qhull install failed"; exit 1; } 
 
 	popd >/dev/null
 	popd >/dev/null
+
+	ln -s ${BASE}/include/libqhull ${BASE}/include/qhull
 	
 	FIX_LA_FILE_ARG=libqhull
 	fix_la_file
@@ -729,7 +748,7 @@
 
 	pushd ./bin/
 	unlink wx-config
-	ln -s `find ${BASE}/lib/wx/config/ -name \*release-2.8` wx-config
+	cp `find ${BASE}/lib/wx/config/ -name \*release-2.8` wx-config
 	APPLY_PATCH_ARG=$PATCHES_WXWIDGETS_POST
 	PATCH_LEVEL=0
 	applyPatches
@@ -766,7 +785,7 @@
 
 	pushd freetype-[0-9]*
 	make clean
-	./configure --host=$HOST_VAL --enable-shared --disable-static --prefix=/ || { echo "freetype configure failed"; exit 1; } 
+	./configure --host=$HOST_VAL --enable-shared --disable-static --without-png --prefix=/ || { echo "freetype configure failed"; exit 1; } 
 
 	make -j $NUM_PROCS || { echo "freetype build failed"; exit 1; } 
 	
@@ -882,27 +901,21 @@
 	APPLY_PATCH_ARG=$PATCHES_MATHGL
 	applyPatches
 
-	libtoolize --copy --force
-	aclocal
-	automake --add-missing
+	rm CMakeCache.txt
+	cmake -DCMAKE_TOOLCHAIN_FILE=../../patches/cmake-toolchain$BITS_VAL
+	cmake -DCMAKE_TOOLCHAIN_FILE=../../patches/cmake-toolchain$BITS_VAL
 
-	autoreconf
-	LIBS="${LIBS} -lz" ./configure --host=$HOST_VAL --disable-gsl --disable-pthread --enable-shared --disable-static --prefix=/ || { echo "mathgl configure failed"; exit 1; } 
+	make -j $NUM_PROCS
 
-	#RPATH disable hack
-	sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
-	sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
-
-	#Hack to fix mathgl's libpng dll search
-	mkdir -p $BASE/lib/.libs/
-	ln -s $BASE/lib/libpng.dll $BASE/lib/.libs/libpng.dll.a 
-
-	make -j $NUM_PROCS || { echo "mathgl build failed"; exit 1; } 
+	if [ x"`find ./ -name \*dll`" == x"" ] ; then
+		echo Did cmake fail to make a DLL. Cmake rarely builds cleanly, but I should be able to find the DLL...
+		exit 1
+	fi
+		
+	cp -p .libs/${NAME}-[0-9]*.dll $BASE/lib/ 
 	
-	make install DESTDIR="$BASE"|| { echo "mathgl install failed"; exit 1; } 
-	
-	#DLL needs to be copied into lib manually
-	cp -p .libs/${NAME}-[0-9]*.dll $BASE/lib/ 
+	cp -R include/mgl2 ${BASE}/include
+	ln -s ${BASE}/include/mgl2 ${BASE}/include/mgl
 
 	popd >/dev/null
 	popd >/dev/null
@@ -956,6 +969,12 @@
 
 	#MAkefile refers to ECHO variable for reporting completion, which does not exist
 	sed -i 's/ECHO_C =/ECHO=echo/' Makefile
+	sed -i "s@-I//@-I${BASE}/@" Makefile
+	sed -i 's/ECHO_C =/ECHO=echo/' Makefile
+	
+	#HACK - find all -I// and -L// and replace them with something sane
+	find ./ -name Makefile -exec sed -i "s@-I//@-I${BASE}/@" {} \;
+	find ./ -name Makefile -exec sed -i "s@-L//@-L${BASE}/@" {} \;
 
 	make -j $NUM_PROCS || { echo "ftgl build failed"; exit 1; } 
 	
@@ -1058,20 +1077,58 @@
 
 	CONF_FLAG="--host=$HOST_VAL"
 	if [ $IS_RELEASE -ne 0 ] ; then
-		CONF_FLAG="$CONF_FLAG --disable-debug-checks"
+		CONF_FLAG="$CONF_FLAG --disable-debug-checks --enable-openmp-parallel"
 	fi
 
-	CFLAGS="$CFLAGS -DUNICODE" CPPFLAGS="${CPPFLAGS} -DUNICODE" ./configure  $CONF_FLAG
+	FTGL_CFLAGS="-I${BASE}/include/freetype/" CFLAGS="$CFLAGS -DUNICODE" CPPFLAGS="${CPPFLAGS} -DUNICODE" ./configure  $CONF_FLAG
 
 	if [ $? -ne 0 ] ; then
 		echo "Failed 3Depict configure"
 		exit 1
 	fi
 
-	#HACK - strip all makefiles of -D_GLIBCXX_DEBUG
-	#	mingw & GLIBCXX_DEBG don't play nice
+	#sanity check that windres is activated
+	if [ x`grep HAVE_WINDRES_TRUE config.log | grep '#' ` != x"" ] ; then
+		echo "Windres appears to be commented out. Shouldn't be for windows builds"
+		exit 1
+	fi
+
+	#Check that wx's manifest matches our arch
+	MANIFEST=`find ../../include/ -name wx.manifest`
+	if [ x"$MANIFEST" == x"" ] ; then
+		echo "Didnt' find manifest!"
+		exit 1
+	fi
+	case $BITS_VAL in
+		32)
+			MANIFEST_TARG=x86
+			MANIFEST_NOT=amd64
+			;;
+		64)
+			MANIFEST_TARG=amd64
+			MANIFEST_NOT=x86
+			;;
+	esac
+
+	if [  x"`grep -i $MANIFEST_TARG $MANIFEST`" == x"" ] ; then
+		echo "Manifest arch does not match!"	
+		echo " file examined: $MANIFEST"
+		exit 1
+	fi
+
+	if [  x"`grep -i $MANIFEST_NOT $MANIFEST`" != x"" ] ; then
+		echo "Manifest arch does not match!"	
+		echo " file examined: $MANIFEST"
+		exit 1
+	fi
+
+       #HACK - strip all makefiles of -D_GLIBCXX_DEBUG
+       #	mingw & GLIBCXX_DEBG don't play nice
 	find ./ -name Makefile -exec sed -i 's/-D_GLIBCXX_DEBUG//g' {} \;
-
+	#HACK - find all -I// and -L// and replace them with something sane
+	find ./ -name Makefile -exec sed -i "s@-I//@-I${BASE}/@" {} \;
+	find ./ -name Makefile -exec sed -i "s@-L//@-L${BASE}/@" {} \;
+	
 	make -j$NUM_PROCS
 	if [ $? -ne 0 ] ; then
 		echo "Failed 3Depict build"
@@ -1117,10 +1174,6 @@
 	pushd ./code/3Depict 2> /dev/null
 
 	NSI_FILE=./windows-installer.nsi
-	if [ ! -f $NSI_FILE ] ; then
-		echo "NSI file missing whilst trying to build package"
-		exit 1;
-	fi
 
 	#copy as needed
 	# Due to debian bug : #704828, makensis cannot correctly handle symlinks,
@@ -1129,9 +1182,28 @@
 		cp ./packaging/mingw-debian-cross/windows-installer.nsi .
 	fi
 
+	
+	if [ ! -f $NSI_FILE ] ; then
+		echo "NSI file missing whilst trying to build package"
+		exit 1;
+	fi
+
+	#Check NSI file has PROGRAMFILES / PROGRAMFILES64 set
+	if [ x"`grep PROGRAMFILES64 $NSI_FILE`" == x"" -a $BITS_VAL == 64 ] ; then
+		echo "NSI file should contain PROGRAMFILES64 output path."
+		exit 1;
+	else
+		if [ x"`grep PROGRAMFILES64 $NSI_FILE`" != x"" -a $BITS_VAL == 32 ] ; then
+			echo "NSI file contained 64 bit install dir, but this is 32"
+			exit 1;
+		fi
+	fi
+	
+	
+	 
 
 	echo -n " Copying dll files... "
-	SYSTEM_DLLS="(ADVAPI32.dll|COMCTL32.DLL|COMDLG32.DLL|GDI32.dll|KERNEL32.dll|ole32.dll|OLEAUT32.dll|RPCRT4.dll|SHELL32.DLL|USER32.dll|WINMM.DLL|WINSPOOL.DRV|WSOCK32.DLL|GLU32.dll|OPENGL32.dll|msvcrt.dll)"
+	SYSTEM_DLLS="(ADVAPI32.dll|COMCTL32.DLL|COMDLG32.DLL|GDI32.dll|KERNEL32.dll|ole32.dll|OLEAUT32.dll|RPCRT4.dll|SHELL32.DLL|USER32.dll|WINMM.DLL|WINSPOOL.DRV|WSOCK32.DLL|GLU32.dll|OPENGL32.dll|msvcrt.dll|WS2_32.dll)"
 
 	DLL_FILES=`${HOST_VAL}-objdump -x src/3Depict.exe | grep 'DLL Name:' | awk '{print $3}' | egrep -i -v ${SYSTEM_DLLS}`
 	FOUND_DLLS=""
@@ -1152,7 +1224,7 @@
 		for i in $DLL_FILES
 		do
 			HAVE_DLL=0
-			for j in ${BASE}/lib/ ${BASE}/bin/ $SYS_DIR
+			for j in ${BASE}/lib/ ${BASE}/bin/ $SYS_DIR /usr/${HOST_VAL}/lib/
 			do
 				FIND_RES=`find $j -name $i | head -n 1`
 				if [ x$FIND_RES != x"" ] ; then
@@ -1190,22 +1262,6 @@
 		exit 1
 	fi
 
-	
-	#Check that each file in the data/textures/ dir is listed in the NSI file
-	FILE_MISSED=0
-	for i in  data/textures/*png
-	do
-		FILE_GREP=`grep "data\\textures\\$i" windows-installer.nsi`
-		if [ x${FILE_GREP} == x"" ] ; then
-			echo "MISSING FILE: " $i
-			FILE_MISSED=1
-		fi
-	done
-
-	if [ $FILE_MISSED -ne 0 ] ; then
-		exit 1
-	fi
-
 	#Insert DLL names automatically
 	cp windows-installer.nsi tmp.nsi
 	echo $FOUND_DLLS | sed 's/ /\n/g' |  sed 's@^@  File \"src\\@' | sed 's/$/\"/' > tmp-insert
@@ -1224,15 +1280,20 @@
 
 	makensis `basename $NSI_FILE` ||  { echo "makensis failed" ; exit 1; }
 
+	echo "-------------------"
+	VERSION=`cat $NSI_FILE | grep "define PRODUCT_VERSION " | awk '{print $3}' | sed s/\"//g | sed s/\s*$//`
 	if [ $IS_RELEASE -ne 0 ] ; then
-		VERSION=`cat $NSI_FILE | grep "define PRODUCT_VERSION " | awk '{print $3}' | sed s/\"//g | sed s/\s*$//`
+		echo "Release mode enabled:"
 		TARGET_FILE=3Depict-$VERSION-$HOST_EXT.exe
-		mv Setup.exe  $TARGET_FILE
-		echo "-------------------"
-		echo "File written to : `pwd`/$TARGET_FILE"
-		echo "-------------------"
+	else
+		echo "Release mode disabled:"
+		TARGET_FILE=3Depict-${VERSION}-${HOST_EXT}-debug.exe
 	fi
 	
+	mv Setup.exe  $TARGET_FILE
+	echo "File written to : `pwd`/$TARGET_FILE"
+	echo "-------------------"
+	
 	popd > /dev/null
 }
 
@@ -1258,7 +1319,7 @@
 		HOST_EXT="win64"
 	;;
 	i686-w64-mingw32)
-		MINGW_PACKAGES="gcc-mingw32"
+		MINGW_PACKAGES="gcc-mingw-w64-i686 g++-mingw-w64-i686"
 		HOST_EXT="win32"
 	;;
 	*)
@@ -1303,9 +1364,10 @@
 build_freetype
 build_libiconv
 build_gettext 
-build_mathgl 
 build_ftgl 
 build_glew
+
+build_mathgl 
 build_wx	# I'm not sure I've done this 100% right. Check wx-config output 
 
 build_3Depict
diff -r 34e37068b6c7 -r 47f4a1712c25 packaging/mingw-debian-cross/patches/cmake-toolchain32
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/packaging/mingw-debian-cross/patches/cmake-toolchain32	Thu Apr 24 00:06:18 2014 +0100
@@ -0,0 +1,24 @@
+# this one is important
+SET(CMAKE_SYSTEM_NAME Windows)
+#this one not so much
+SET(CMAKE_SYSTEM_VERSION 1)
+
+# specify the cross compiler
+#SET(CMAKE_CXX_COMPILER CXX_REPLACE)
+#SET(CMAKE_C_COMPILER   C_REPLACE)
+SET(CMAKE_C_COMPILER   i686-w64-mingw32-gcc)
+SET(CMAKE_CXX_COMPILER   i686-w64-mingw32-g++)
+SET(CMAKE_RC_COMPILER /usr/bin/i686-w64-mingw32-windres)
+# where is the target environment 
+#SET(CMAKE_FIND_ROOT_PATH  PWD_REPLACE)
+SET(CMAKE_FIND_ROOT_PATH  /home/pcuser/mingw64/)
+
+SET(ZLIB_LIBRARY -lz)
+SET(PNG_LIBRARY -lpng)
+
+
+# search for programs in the build host directories
+#SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+# for libraries and headers in the target directories
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff -r 34e37068b6c7 -r 47f4a1712c25 packaging/mingw-debian-cross/patches/cmake-toolchain64
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/packaging/mingw-debian-cross/patches/cmake-toolchain64	Thu Apr 24 00:06:18 2014 +0100
@@ -0,0 +1,24 @@
+# this one is important
+SET(CMAKE_SYSTEM_NAME Windows)
+#this one not so much
+SET(CMAKE_SYSTEM_VERSION 1)
+
+# specify the cross compiler
+#SET(CMAKE_CXX_COMPILER CXX_REPLACE)
+#SET(CMAKE_C_COMPILER   C_REPLACE)
+SET(CMAKE_C_COMPILER   x86_64-w64-mingw32-gcc)
+SET(CMAKE_CXX_COMPILER   x86_64-w64-mingw32-g++)
+SET(CMAKE_RC_COMPILER /usr/bin/x86_64-w64-mingw32-windres)
+# where is the target environment 
+#SET(CMAKE_FIND_ROOT_PATH  PWD_REPLACE)
+SET(CMAKE_FIND_ROOT_PATH  /home/pcuser/mingw64/)
+
+SET(ZLIB_LIBRARY -lz)
+SET(PNG_LIBRARY -lpng)
+
+
+# search for programs in the build host directories
+#SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+# for libraries and headers in the target directories
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff -r 34e37068b6c7 -r 47f4a1712c25 packaging/mingw-debian-cross/patches/mathgl-cmake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/packaging/mingw-debian-cross/patches/mathgl-cmake	Thu Apr 24 00:06:18 2014 +0100
@@ -0,0 +1,123 @@
+diff -r fc3a9b8ba816 CMakeLists.txt
+--- a/CMakeLists.txt	Sun Apr 20 14:13:01 2014 +0100
++++ b/CMakeLists.txt	Mon Apr 21 13:52:22 2014 +0100
+@@ -12,9 +12,9 @@
+ set(MathGL_VERSION_MINOR 2.2)
+ set(MathGL_SOVERSION 7.2.0)
+ 
+-set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,relro")
+-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,relro")
+-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro")
++#set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,relro")
++#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,relro")
++#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro")
+ 
+ MACRO(MGL_DEPENDENT_OPTION option doc default depends1 force1 depends2 force2)
+   IF(${option}_ISSET MATCHES "^${option}_ISSET$")
+@@ -63,51 +63,51 @@
+ 
+ option(enable-double "Enable double precision in MathGL library" ON)
+ option(enable-simple "Slightly increase drawing speed but disable mglDataA class")
+-option(enable-mpi "Enable mpi" ON)
+-option(enable-opengl "Enable OpenGL support" ON)
++option(enable-mpi "Enable mpi" OFF)
++option(enable-opengl "Enable OpenGL support" OFF)
+ option(enable-all-docs "Enable all documentation building")
+ #option(enable-doc "Enable documentation building")
+ option(enable-all "Enable all core features")
+-option(enable-all-widgets "Enable all Widgets")
+-option(enable-all-swig "Enable all SWIG based interfaces")
+-option(enable-pthread "Enable POSIX threads support" ON)
++option(enable-all-widgets "Enable all Widgets" OFF)
++option(enable-all-swig "Enable all SWIG based interfaces" OFF)
++option(enable-pthread "Enable POSIX threads support" OFF)
+ option(enable-openmp "Enable OpenMP support" OFF)
+ option(enable-lgpl "Enable only LGPL part of MathGL")
+ option(enable-mgl2 "Use names 'libmgl2-*' instead of 'libmgl-*'")
+ #option(enable-ltdl "Enable loading modules support")
+-CMAKE_DEPENDENT_OPTION(enable-doc-site "Enable HTML documentation for website" OFF "NOT enable-all-docs" ON)
+-CMAKE_DEPENDENT_OPTION(enable-doc-html "Enable HTML documentation" OFF "NOT enable-all-docs" ON)
+-CMAKE_DEPENDENT_OPTION(enable-doc-info "Enable INFO documentation" OFF "NOT enable-all-docs" ON)
+-CMAKE_DEPENDENT_OPTION(enable-doc-pdf-ru "Enable Russian PDF documentation" OFF "NOT enable-all-docs" ON)
+-CMAKE_DEPENDENT_OPTION(enable-doc-pdf-en "Enable English PDF documentation" OFF "NOT enable-all-docs" ON)
+-CMAKE_DEPENDENT_OPTION(enable-doc-prc "Enable PDF samples for HTML docs" OFF "NOT enable-all-docs" ON)
+-CMAKE_DEPENDENT_OPTION(enable-doc-json "Enable JSON samples for HTML docs" OFF "NOT enable-all-docs" ON)
++CMAKE_DEPENDENT_OPTION(enable-doc-site "Enable HTML documentation for website" OFF "NOT enable-all-docs" OFF)
++CMAKE_DEPENDENT_OPTION(enable-doc-html "Enable HTML documentation" OFF "NOT enable-all-docs" OFF)
++CMAKE_DEPENDENT_OPTION(enable-doc-info "Enable INFO documentation" OFF "NOT enable-all-docs" OFF)
++CMAKE_DEPENDENT_OPTION(enable-doc-pdf-ru "Enable Russian PDF documentation" OFF "NOT enable-all-docs" OFF)
++CMAKE_DEPENDENT_OPTION(enable-doc-pdf-en "Enable English PDF documentation" OFF "NOT enable-all-docs" OFF)
++CMAKE_DEPENDENT_OPTION(enable-doc-prc "Enable PDF samples for HTML docs" OFF "NOT enable-all-docs" OFF)
++CMAKE_DEPENDENT_OPTION(enable-doc-json "Enable JSOFF samples for HTML docs" OFF "NOT enable-all-docs" OFF)
+ option(enable-texi2html "Use texi2html (obsolete package) instead of texi2any" OFF)
+ 
+ CMAKE_DEPENDENT_OPTION(enable-zlib "Enable zlib support" ON "NOT enable-all" ON)
+ CMAKE_DEPENDENT_OPTION(enable-png "Enable png support" ON "NOT enable-all" ON)
+-CMAKE_DEPENDENT_OPTION(enable-jpeg "Enable jpeg support" ON "NOT enable-all" ON)
+-MGL_DEPENDENT_OPTION(enable-gsl "Enable gsl support" ON "NOT enable-lgpl" ON "NOT enable-all" ON)
+-MGL_DEPENDENT_OPTION(enable-hdf4 "Enable hdf4 support" ON "NOT enable-lgpl" ON "NOT enable-all" ON)
+-MGL_DEPENDENT_OPTION(enable-hdf5 "Enable hdf5 support" ON "NOT enable-lgpl" ON "NOT enable-all" ON)
+-CMAKE_DEPENDENT_OPTION(enable-pdf "Enable pdf support" ON "NOT enable-all" ON)
+-CMAKE_DEPENDENT_OPTION(enable-gif "Enable gif support" ON "NOT enable-all" ON)
+-CMAKE_DEPENDENT_OPTION(enable-glut "Enable glut support" ON "NOT enable-all-widgets" ON)
+-CMAKE_DEPENDENT_OPTION(enable-fltk "Enable fltk widget" ON "NOT enable-all-widgets" ON)
+-CMAKE_DEPENDENT_OPTION(enable-wx "Enable wxWidget widget" ON "NOT enable-all-widgets" ON)
+-CMAKE_DEPENDENT_OPTION(enable-qt4 "Enable Qt4 widget" ON "NOT enable-all-widgets" ON)
+-CMAKE_DEPENDENT_OPTION(enable-qt5 "Enable Qt5 widget" OFF "NOT enable-all-widgets" ON)
++CMAKE_DEPENDENT_OPTION(enable-jpeg "Enable jpeg support" OFF  "NOT enable-all" OFF)
++MGL_DEPENDENT_OPTION(enable-gsl "Enable gsl support" OFF "NOT enable-lgpl" ON "NOT enable-all" ON)
++MGL_DEPENDENT_OPTION(enable-hdf4 "Enable hdf4 support" OFF "NOT enable-lgpl" OFF "NOT enable-all" OFF)
++MGL_DEPENDENT_OPTION(enable-hdf5 "Enable hdf5 support" OFF "NOT enable-lgpl" OFF "NOT enable-all" OFF)
++CMAKE_DEPENDENT_OPTION(enable-pdf "Enable pdf support" OFF "NOT enable-all" OFF)
++CMAKE_DEPENDENT_OPTION(enable-gif "Enable gif support" OFF "NOT enable-all" OFF)
++CMAKE_DEPENDENT_OPTION(enable-glut "Enable glut support" OFF "NOT enable-all-widgets" OFF)
++CMAKE_DEPENDENT_OPTION(enable-fltk "Enable fltk widget" OFF "NOT enable-all-widgets" OFF)
++CMAKE_DEPENDENT_OPTION(enable-wx "Enable wxWidget widget" OFF "NOT enable-all-widgets" OFF)
++CMAKE_DEPENDENT_OPTION(enable-qt4 "Enable Qt4 widget" OFF "NOT enable-all-widgets" OFF)
++CMAKE_DEPENDENT_OPTION(enable-qt5 "Enable Qt5 widget" OFF "NOT enable-all-widgets" OFF)
+ CMAKE_DEPENDENT_OPTION(enable-qt5asqt "Set Qt5 as default libmgl-qt" OFF "enable-qt5" OFF)
+ 
+ if(enable-qt4 OR enable-qt5)
+ set(enable-qt ON)
+ endif(enable-qt4 OR enable-qt5)
+ 
+-CMAKE_DEPENDENT_OPTION(enable-json-sample "Enable JSON sample" ON "enable-qt" OFF)
+-MGL_DEPENDENT_OPTION(enable-python "Enable python interface" ON "NOT enable-lgpl" ON "NOT enable-all-swig" ON)
+-MGL_DEPENDENT_OPTION(enable-lua "Enable Lua (v.5.1) interface" OFF "NOT enable-lgpl" ON "NOT enable-all-swig" ON)
+-MGL_DEPENDENT_OPTION(enable-octave "Enable octave interface" OFF "NOT enable-lgpl" ON "NOT enable-all-swig" ON)
+-MGL_DEPENDENT_OPTION(enable-octave-install "Octave interface will install for all users" ON "NOT enable-lgpl" ON "NOT enable-all-swig" ON)
++CMAKE_DEPENDENT_OPTION(enable-json-sample "Enable JSOFF sample" OFF "enable-qt" OFF)
++MGL_DEPENDENT_OPTION(enable-python "Enable python interface" OFF "NOT enable-lgpl" OFF "NOT enable-all-swig" OFF)
++MGL_DEPENDENT_OPTION(enable-lua "Enable Lua (v.5.1) interface" OFF "NOT enable-lgpl" OFF "NOT enable-all-swig" OFF)
++MGL_DEPENDENT_OPTION(enable-octave "Enable octave interface" OFF "NOT enable-lgpl" OFF "NOT enable-all-swig" OFF)
++MGL_DEPENDENT_OPTION(enable-octave-install "Octave interface will install for all users" OFF "NOT enable-lgpl" OFF "NOT enable-all-swig" OFF)
+ 
+ include_directories( ${MathGL_SOURCE_DIR}/include ${MathGL_BINARY_DIR}/include)
+ set(MGL_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/include/mgl2")
+@@ -183,7 +183,7 @@
+ endif(enable-openmp)
+ 
+ if(enable-mpi)
+-	set(MGL_HAVE_MPI 1)
++	set(MGL_HAVE_MPI 0)
+ 	find_package(MPI REQUIRED)
+ 	set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
+ 	set(CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS})
+@@ -193,7 +193,7 @@
+ endif(enable-mpi)
+ 
+ if(enable-pthread)
+-	set(MGL_HAVE_PTHREAD 1)
++	set(MGL_HAVE_PTHREAD 0)
+ 	include(FindThreads)
+ 	if(NOT CMAKE_USE_PTHREADS_INIT)
+ 		message(SEND_ERROR "Couldn't find POSIX threads library.")
+@@ -256,7 +256,7 @@
+ endif(enable-hdf5)
+ 
+ if(enable-jpeg)
+-	set(MGL_HAVE_JPEG 1)
++	set(MGL_HAVE_JPEG 0)
+ 	include(FindJPEG)
+ 	if(NOT JPEG_FOUND)
+ 		message(SEND_ERROR "Couldn't find JPEG library.")
diff -r 34e37068b6c7 -r 47f4a1712c25 packaging/mingw-debian-cross/windows-installer.nsi
--- a/packaging/mingw-debian-cross/windows-installer.nsi	Thu Apr 17 22:17:56 2014 +0100
+++ b/packaging/mingw-debian-cross/windows-installer.nsi	Thu Apr 24 00:06:18 2014 +0100
@@ -124,43 +124,29 @@
 
 Section Uninstall
   Delete "$INSTDIR\${PRODUCT_NAME}.url"
-  Delete "$INSTDIR\textures\uninst.exe"
+  Delete "$INSTDIR\uninst.exe"  
   
-  Delete "$INSTDIR\textures\animProgress0.png"
-  Delete "$INSTDIR\textures\animProgress1.png"
-  Delete "$INSTDIR\textures\animProgress2.png"
-  Delete "$INSTDIR\textures\scroll_wheel_mouse.png"
-  Delete "$INSTDIR\textures\rotateArrow.png"
-  Delete "$INSTDIR\textures\Right_clicked_mouse.png"
-  Delete "$INSTDIR\textures\Right-arrow.png"
-  Delete "$INSTDIR\textures\middle_clicked_mouse.png"
-  Delete "$INSTDIR\textures\Left_clicked_mouse.png"
-  Delete "$INSTDIR\textures\Left-Right-arrow.png"
-  Delete "$INSTDIR\textures\keyboard-tab.png"
-  Delete "$INSTDIR\textures\keyboard-shift.png"
-  Delete "$INSTDIR\textures\keyboard-ctrl.png"
-  Delete "$INSTDIR\textures\keyboard-command.png"
-  Delete "$INSTDIR\textures\keyboard-alt.png"
-  Delete "$INSTDIR\textures\enlarge.png"
+  RMDir /r "$INSTDIR\textures"
+  RMDir "$INSTDIR\textures"
+  RMDir /r "$INSTDIR\locales"
+  RMDir "$INSTDIR\locales"
   
-  Delete "3Depict.xpm"
-  Delete "atomic-mass-table.dtd"
-  Delete "naturalAbundance.xml"
-  Delete "startup-tips.txt"
+  Delete "$INSTDIR\3Depict.xpm"
+  Delete "$INSTDIR\atomic-mass-table.dtd"
+  Delete "$INSTDIR\naturalAbundance.xml"
+  Delete "$INSTDIR\startup-tips.txt"
  
   Delete "$INSTDIR\3Depict.exe"
 
   Delete "$INSTDIR\manual.pdf"
-  RMDir /r "$INSTDIR\locales\*.*"
-  RMDir "$INSTDIR\locales"
 
   ;This is a token that should be replaced with the DLLS to uninstall
   ;INSERT_UNINST_DLLS_HERE
 
-  Delete "$INSTDIR\uninst.exe"  
  
   Delete "$SMPROGRAMS\3Depict\Uninstall.lnk"
   Delete "$SMPROGRAMS\3Depict\Website.lnk"
+  Delete "$SMPROGRAMS\3Depict\manual.pdf"
   Delete "$DESKTOP\3Depict.lnk"
   Delete "$SMPROGRAMS\3Depict\3Depict.lnk"
   RMDir "$SMPROGRAMS\3Depict"
diff -r 34e37068b6c7 -r 47f4a1712c25 src/backend/plot.cpp
--- a/src/backend/plot.cpp	Thu Apr 17 22:17:56 2014 +0100
+++ b/src/backend/plot.cpp	Thu Apr 24 00:06:18 2014 +0100
@@ -47,118 +47,8 @@
 // perform a little "push off" by this fudge factor
 const float AXIS_MIN_TOLERANCE=10*sqrtf(std::numeric_limits<float>::epsilon());
 
-int MGLColourFixer::maxCols=-1;
+const unsigned int MGL_RESERVED_COLOURS=2;
 
-void MGLColourFixer::reset()
-{
-	rs.clear();
-	gs.clear();
-	bs.clear();
-}
-
-char MGLColourFixer::haveExactColour(float r, float g, float b) const
-{
-	ASSERT(rs.size() == gs.size())
-	ASSERT(gs.size() == bs.size())
-
-	ASSERT(rs.size() <=getMaxColours());
-
-	for(unsigned int ui=0; ui<rs.size(); ui++)
-	{
-		if( fabs(r-rs[ui]) <std::numeric_limits<float>::epsilon()
-			&& fabs(g-gs[ui]) <std::numeric_limits<float>::epsilon()
-			&& fabs(b-bs[ui]) <std::numeric_limits<float>::epsilon())
-			return mglColorIds[ui+1].id; //Add one to offset to avoid the reserved "k" 
-	}
-
-	return 0;
-}
-
-unsigned int MGLColourFixer::getMaxColours() 
-{
-	//Used cached value if available
-	if(maxCols!=-1)
-		return maxCols;
-
-	//The array is statically defined in
-	//mgl/mgl_main.cpp, and must end with an id of zero.
-	//
-	//this is not documented at all.
-	maxCols=0;
-	while(mglColorIds[maxCols].id)
-		maxCols++;
-
-	return maxCols;
-}
-
-char MGLColourFixer::getNextBestColour(float r, float g, float b) 
-{
-	ASSERT(rs.size() == gs.size());
-	ASSERT(gs.size() == bs.size());
-	
-
-	//As a special case, mgl has its own black
-	if(r == 0.0f && g == 0.0f && b == 0.0f)
-		return mglColorIds[0].id;
-
-
-	unsigned int best=0;
-	if(rs.size() == getMaxColours())
-	{
-		ASSERT(getMaxColours());
-		//Looks like we ran out of palette colours.
-		//lets just give up and try to match this against our existing colours
-
-		//TODO: let this modify the existing palette
-		// to find a better match.
-		float distanceSqr=std::numeric_limits<float>::max();
-		for(unsigned int ui=0; ui<rs.size(); ui++)
-		{
-			float distanceTmp;
-			if(r <= 0.5)
-			{
-				//3,4,2 weighted euclidean distance. Weights allow for closer human perception
-				distanceTmp= 3.0*(rs[ui] - r )*(rs[ui] - r ) +4.0*(gs[ui] - g )*(gs[ui] - g )
-					     + 2.0*(bs[ui] - b )*(bs[ui] - b );
-			}
-			else
-			{
-				//use alternate weighting for closer colour perception in "non-red" half of colour cube
-				distanceTmp= 2.0*(rs[ui] - r )*(rs[ui] - r ) +4.0*(gs[ui] - g )*(gs[ui] - g )
-					     + 3.0*(bs[ui] - b )*(bs[ui] - b );
-			}
-
-			if(distanceTmp < distanceSqr)
-			{
-				distanceSqr = (distanceTmp);
-				best=ui+1; //offset by 1 because mathgl colour 0 is special
-			}
-
-		}
-	}
-	else
-	{
-		char exactMatch;
-		//Check to see if we don't already have this
-		// no use wasting palette positions on existing
-		// colours
-		exactMatch=haveExactColour(r,g,b);
-
-		if(exactMatch)
-			return exactMatch;
-
-		//Offset zero is special, for black things, like axes
-		best=rs.size()+1;
-		mglColorIds[best].col = mglColor(r,g,b);
-		
-		rs.push_back(r);
-		gs.push_back(g);
-		bs.push_back(b);
-	}
-
-	ASSERT(mglColorIds[best].id != 'k');
-	return mglColorIds[best].id;
-}
 
 //Mathgl uses some internal for(float=...) constructions, 
 // which are just generally a bad idea, as they often won't terminate
@@ -209,6 +99,18 @@
 }
 
 
+std::string mglColourCode(float r, float g, float b)
+{
+	ASSERT(r >=0.0f && g >=0.0f && b >=0.0f)
+	ASSERT(r <=255.0f && g <=255.0f && b <=255.0f)
+	std::string s;
+	genColString((unsigned char)(r*255),
+		(unsigned char)(g*255),(unsigned char)(b*255),s);
+	s=s.substr(1);
+
+	return string("{x") + uppercase(s) + string("}");
+}
+
 //TODO: Refactor these functions to use a common string map
 //-----------
 string plotString(unsigned int traceType)
@@ -806,7 +708,6 @@
 	}
 
 	//Un-fudger for mathgl plots
-	MGLColourFixer colourFixer;
 
 	bool haveMultiTitles=false;
 	float minX,maxX,minY,maxY;
@@ -994,17 +895,15 @@
 				if(!curPlot->visible)
 					continue;
 
-				curPlot->drawRegions(gr,colourFixer,min,max);
-				curPlot->drawPlot(gr,colourFixer);
+				curPlot->drawRegions(gr,min,max);
+				curPlot->drawPlot(gr);
 				
 				if(drawLegend)
 				{
 					//Fake an mgl colour code
-					char colourCode[2];
-					colourCode[0]=colourFixer.getNextBestColour(
-							curPlot->r,curPlot->g,curPlot->b);
-					colourCode[1]='\0';
-					gr->AddLegend(curPlot->title.c_str(),colourCode);
+					std::string mglColStr;
+					mglColStr= mglColourCode(curPlot->r,curPlot->g,curPlot->b);
+					gr->AddLegend(curPlot->title.c_str(),mglColStr.c_str());
 				}
 			}
 
@@ -1017,7 +916,7 @@
 				vector<pair<size_t,size_t> > overlapId;
 				vector<pair<float,float> > overlapXCoords;
 
-				char colourCode=colourFixer.getNextBestColour(1.0f,0.0f,0.0f);
+				string colourCode=mglColourCode(1.0f,0.0f,0.0f);
 				getRegionOverlaps(overlapId,overlapXCoords);
 
 				float rMinY,rMaxY;
@@ -1045,10 +944,10 @@
 
 #ifdef USE_MGL2
 					gr->FaceZ(mglPoint(rMinX,rMinY,-1),rMaxX-rMinX,rMaxY-rMinY,
-							&colourCode);
+							colourCode.c_str());
 #else
 					gr->FaceZ(rMinX,rMinY,-1,rMaxX-rMinX,rMaxY-rMinY,
-							&colourCode);
+							colourCode.c_str());
 #endif
 				}
 
@@ -1082,7 +981,7 @@
 #endif
 	}
 	
-	overlays.draw(gr,colourFixer,min,max,haveUsedLog);
+	overlays.draw(gr,min,max,haveUsedLog);
 }
 
 void PlotWrapper::hideAll()
@@ -1405,7 +1304,7 @@
 	return xValues.empty();
 }
 
-void Plot1D::drawPlot(mglGraph *gr,MGLColourFixer &fixer) const
+void Plot1D::drawPlot(mglGraph *gr) const
 {
 	bool showErrs;
 
@@ -1453,9 +1352,8 @@
 	
 	//Obtain a colour code to use for the plot, based upon
 	// the actual colour we wish to use
-	char colourCode[2];
-	colourCode[0]=fixer.getNextBestColour(r,g,b);
-	colourCode[1]='\0';
+	string colourCode;
+	colourCode=mglColourCode(r,g,b);
 	//---
 
 
@@ -1467,23 +1365,23 @@
 			//rather than linear interpolating them back along their paths. I have emailed the author.
 			//for now, we shall have to put up with missing lines :( Absolute worst case, I may have to draw them myself.
 			gr->SetCut(true);
-			
-			gr->Plot(xDat,yDat,colourCode);
+		
+			gr->Plot(xDat,yDat,colourCode.c_str());
 			if(showErrs)
-				gr->Error(xDat,yDat,eDat,colourCode);
+				gr->Error(xDat,yDat,eDat,colourCode.c_str());
 			gr->SetCut(false);
 			break;
 		case PLOT_TRACE_BARS:
-			gr->Bars(xDat,yDat,colourCode);
+			gr->Bars(xDat,yDat,colourCode.c_str());
 			break;
 		case PLOT_TRACE_STEPS:
 			//Same problem as for line plot. 
 			gr->SetCut(true);
-			gr->Step(xDat,yDat,colourCode);
+			gr->Step(xDat,yDat,colourCode.c_str());
 			gr->SetCut(false);
 			break;
 		case PLOT_TRACE_STEM:
-			gr->Stem(xDat,yDat,colourCode);
+			gr->Stem(xDat,yDat,colourCode.c_str());
 			break;
 
 		case PLOT_TRACE_POINTS:
@@ -1557,13 +1455,11 @@
 	regionGroup.clear();
 }
 
-void Plot1D::drawRegions(mglGraph *gr,MGLColourFixer &fixer,
+void Plot1D::drawRegions(mglGraph *gr,
 		const mglPoint &min,const mglPoint &max) const
 {
 	//Mathgl palette colour name
-	char colourCode[2];
-	colourCode[1]='\0';
-
+	string colourCode;
 
 	for(unsigned int uj=0;uj<regionGroup.regions.size();uj++)
 	{
@@ -1577,16 +1473,15 @@
 		//Prevent drawing inverted regionGroup.regions
 		if(rMaxX > rMinX && rMaxY > rMinY)
 		{
-			colourCode[0] = fixer.getNextBestColour(regionGroup.regions[uj].r,
+			colourCode = mglColourCode(regionGroup.regions[uj].r,
 						regionGroup.regions[uj].g,
 						regionGroup.regions[uj].b);
-			colourCode[1] = '\0';
 #ifdef USE_MGL2
 			gr->FaceZ(mglPoint(rMinX,rMinY,-1),rMaxX-rMinX,rMaxY-rMinY,
-					colourCode);
+					colourCode.c_str());
 #else
 			gr->FaceZ(rMinX,rMinY,-1,rMaxX-rMinX,rMaxY-rMinY,
-					colourCode);
+					colourCode.c_str());
 #endif
 					
 		}
@@ -1791,18 +1686,17 @@
 }
 
 
-void PlotOverlays::draw(mglGraph *gr,MGLColourFixer &fixer, 
+void PlotOverlays::draw(mglGraph *gr,
 		const mglPoint &boundMin, const mglPoint &boundMax,bool logMode ) const
 {
 
 	if(!isEnabled)
 		return;
 
-	char colourCode[2];
+	string colourCode;
 
 	//Draw the overlays in black
-	colourCode[0] = fixer.getNextBestColour(0.0,0.0,0.0);
-	colourCode[1]='\0';
+	colourCode = mglColourCode(0.0,0.0,0.0);
 	
 	for(size_t ui=0;ui<overlayData.size();ui++)
 	{
@@ -1841,6 +1735,7 @@
 			}
 		}
 
+		//TODO: Deprecate me. Upstream now allows single stems
 		//Draw stems. can't use stem plot due to mathgl bug whereby single stems
 		// will not be drawn
 		for(size_t uj=0;uj<overlayData[ui].coordData.size();uj++)
@@ -1849,7 +1744,7 @@
 					boundMin.y < bufY[uj])
 			{
 				gr->Line (mglPoint(bufX[uj],std::max(0.0f,(float)boundMin.y)),
-					mglPoint(bufX[uj],bufY[uj]),colourCode,100);
+					mglPoint(bufX[uj],bufY[uj]),colourCode.c_str(),100);
 
 				//Print labels near to the text
 				const float STANDOFF_FACTOR=1.05;
diff -r 34e37068b6c7 -r 47f4a1712c25 src/backend/plot.h
--- a/src/backend/plot.h	Thu Apr 17 22:17:56 2014 +0100
+++ b/src/backend/plot.h	Thu Apr 24 00:06:18 2014 +0100
@@ -64,26 +64,6 @@
 //!Return the error mode type, given the human readable string
 unsigned int plotErrmodeID(const std::string &s);
 		
-//!Nasty hack class to change mathgl API from named char palette to rgb specification
-class MGLColourFixer
-{
-	private:
-		vector<float> rs,gs,bs;
-		static int maxCols;
-	public:
-		//Restore the MGL colour strings
-		void reset();
-		//Return the exact colour, if there is one
-		char haveExactColour(float r, float g, float b) const;
-		//Get the best colour that is available
-		// returns the char to give to mathgl; may be exact,
-		// maybe nearest match, depending upon number of colours used
-		// and mgl palette size
-		char getNextBestColour(float r, float g, float b);
-
-		static unsigned int getMaxColours();
-};
-
 
 //!Data class  for holding info about non-overlapping 
 // interactive rectilinear "zones" overlaid on plots 
@@ -199,7 +179,7 @@
 		//Add a new overlay to the plot
 		void add(const OVERLAY_DATA &overlay) {overlayData.push_back(overlay);}
 		//Draw the overlay on the current plot
-		void draw(mglGraph *g,MGLColourFixer &fixer, 
+		void draw(mglGraph *g,
 			const mglPoint &boundMin, const mglPoint &boundMax,bool logMode) const;
 		//Enable the specified overlay
 		void setEnabled(size_t offset,bool isEnabled) 
@@ -262,7 +242,7 @@
 		virtual bool empty() const=0;
 
 		//Draw the plot onto a given MGL graph
-		virtual void drawPlot(mglGraph *graph, MGLColourFixer &fixer) const=0;
+		virtual void drawPlot(mglGraph *graph) const=0;
 
 		//!Scan for the data bounds.
 		virtual void getBounds(float &xMin,float &xMax,
@@ -309,11 +289,10 @@
 		
 		
 		//Draw the plot onto a given MGL graph
-		virtual void drawPlot(mglGraph *graph,MGLColourFixer &fixer) const;
+		virtual void drawPlot(mglGraph *graph) const;
 
 		//Draw the associated regions		
-		void drawRegions(mglGraph *graph, MGLColourFixer &fixer,
-				const mglPoint &min, const mglPoint &max) const;
+		void drawRegions(mglGraph *graph,const mglPoint &min, const mglPoint &max) const;
 
 
 		//!Retrieve the raw data associated with the currently visible plots. 
diff -r 34e37068b6c7 -r 47f4a1712c25 src/common/stringFuncs.cpp
--- a/src/common/stringFuncs.cpp	Thu Apr 17 22:17:56 2014 +0100
+++ b/src/common/stringFuncs.cpp	Thu Apr 24 00:06:18 2014 +0100
@@ -457,6 +457,16 @@
 	return s;
 }
 
+std::string uppercase(std::string s)
+{
+	for(unsigned int ui=0;ui<s.size();ui++)
+	{
+		if(isascii(s[ui]) && islower(s[ui]))
+			s[ui] = toupper(s[ui]);
+	}
+	return s;
+}
+
 //Split strings around a delimiter
 void splitStrsRef(const char *cpStr, const char delim,std::vector<string> &v )
 {
diff -r 34e37068b6c7 -r 47f4a1712c25 src/common/stringFuncs.h
--- a/src/common/stringFuncs.h	Thu Apr 17 22:17:56 2014 +0100
+++ b/src/common/stringFuncs.h	Thu Apr 24 00:06:18 2014 +0100
@@ -61,6 +61,8 @@
 std::string stripChars(const std::string &Str, const char *chars);
 //!Return a lowercase version for a given string
 std::string lowercase(std::string s);
+//!Return a uppercase version for a given string
+std::string uppercase(std::string s);
 
 //Drop empty entries from a string of vector
 void stripZeroEntries(std::vector<std::string> &s);
@@ -71,9 +73,11 @@
 	unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a);
 
 //Convert an RGBA 8-bit/channel quadruplet into its hexadecimal colour string
+// format is "#rrggbbaa" such as "#11ee00aa"
 void genColString(unsigned char r, unsigned char g, 
 			unsigned char b, unsigned char a, std::string &s);
 //Convert an RGB 8-bit/channel quadruplet into its hexadecimal colour string
+// format is "#rrggbb" such as "#11ee00"
 void genColString(unsigned char r, unsigned char g, 
 			unsigned char b, std::string &s);
 
diff -r 34e37068b6c7 -r 47f4a1712c25 src/gui/dialogs/rangeEditDialog.cpp
--- a/src/gui/dialogs/rangeEditDialog.cpp	Thu Apr 17 22:17:56 2014 +0100
+++ b/src/gui/dialogs/rangeEditDialog.cpp	Thu Apr 24 00:06:18 2014 +0100
@@ -288,7 +288,7 @@
     EVT_CHECKLISTBOX(ID_LIST_OVERLAY, RangeEditorDialog::OnListOverlayCheck)
     EVT_BUTTON(wxID_OK, RangeEditorDialog::OnBtnOK)
     EVT_BUTTON(wxID_CANCEL, RangeEditorDialog::OnBtnCancel)
-    EVT_SPLITTER_UNSPLIT(ID_SPLIT_LEFTRIGHT, RangeEditorDialog::OnSashVerticalUnsplit)
+    EVT_SPLITTER_DCLICK(ID_SPLIT_LEFTRIGHT, RangeEditorDialog::OnSashVerticalDClick)
     // end wxGlade
 END_EVENT_TABLE();
 
@@ -1438,7 +1438,7 @@
 	plotPanel->Refresh();
 }
 
-void RangeEditorDialog::OnSashVerticalUnsplit(wxSplitterEvent &event)
+void RangeEditorDialog::OnSashVerticalDClick(wxSplitterEvent &event)
 {
 	event.Veto();
 }
diff -r 34e37068b6c7 -r 47f4a1712c25 src/gui/dialogs/rangeEditDialog.h
--- a/src/gui/dialogs/rangeEditDialog.h	Thu Apr 17 22:17:56 2014 +0100
+++ b/src/gui/dialogs/rangeEditDialog.h	Thu Apr 24 00:06:18 2014 +0100
@@ -210,7 +210,7 @@
     virtual void OnCheckShowOverlay(wxCommandEvent &event); // wxGlade: <event_handler>
     virtual void OnBtnOK(wxCommandEvent &event); // wxGlade: <event_handler>
     virtual void OnBtnCancel(wxCommandEvent &event); // wxGlade: <event_handler>
-    virtual void OnSashVerticalUnsplit(wxSplitterEvent &event); // wxGlade: <event_handler>
+    virtual void OnSashVerticalDClick(wxSplitterEvent &event); // wxGlade: <event_handler>
     virtual void OnListOverlayCheck(wxCommandEvent &event);
     virtual void OnListOverlayKeyDown(wxListEvent &event);
     virtual void OnTextOverlay(wxCommandEvent &event);
diff -r 34e37068b6c7 -r 47f4a1712c25 src/gui/mainFrame.cpp
--- a/src/gui/mainFrame.cpp	Thu Apr 17 22:17:56 2014 +0100
+++ b/src/gui/mainFrame.cpp	Thu Apr 24 00:06:18 2014 +0100
@@ -1143,9 +1143,12 @@
 					f->setRangeData(rng);
 					f->setRangeFilename(s.c_str());
 
-					//Get the parent filter pointer	
+					//Add the filter, using the seelcted
+					// item as the parent
 					visControl.addFilter(f,false,filterId);
 
+					//update the tree control
+					visControl.updateWxTreeCtrl(treeFilters);
 				}
 				else
 				{
@@ -1398,6 +1401,10 @@
 		}
 		
 		setSaveStatus();
+
+		//make sure camera is properly centred
+		if(visControl.numCams() == 1)
+			visControl.ensureSceneVisible(3);
 	}
 
 }
@@ -2812,6 +2819,9 @@
 	if(!s.size())
 		s=locateDataFile("3depict-manual.pdf");
 
+	//FIXME: under windows, currently we use "manual.pdf"
+	if(!s.size())
+		s=locateDataFile("manual.pdf");
 
 	//If we found it, use the default program associated with that data file
 	bool launchedOK=false;
@@ -2858,9 +2868,12 @@
 			wxFileType *t;
 				
 			t=m.GetFileTypeFromExtension(wxT("pdf"));
-			command=t->GetOpenCommand(wxStr(s));
-			appPID=wxExecute(command,wxEXEC_ASYNC);
-			launchedOK=(appPID!=0);
+			if(t)
+			{
+				command=t->GetOpenCommand(wxStr(s));
+				appPID=wxExecute(command,wxEXEC_ASYNC);
+				launchedOK=(appPID!=0);
+			}
 		}
 #endif
 	}
diff -r 34e37068b6c7 -r 47f4a1712c25 src/wx/wxcommon.cpp
--- a/src/wx/wxcommon.cpp	Thu Apr 17 22:17:56 2014 +0100
+++ b/src/wx/wxcommon.cpp	Thu Apr 24 00:06:18 2014 +0100
@@ -91,8 +91,14 @@
 				return s;
 		}
 	}
-	else if(wxFileExists(wxStr(s)))
-		return s;
+	
+	std::string s;
+	s =name; 
+	
+	if(s.size() && wxFileExists(wxStr(s)))
+	{
+		return string(name);
+	}
 	else
 		return std::string("");
 #elif defined( __linux__)