1acbe16
diff -r 34e37068b6c7 -r 47f4a1712c25 src/backend/plot.cpp
540406b
--- src/backend/plot.cpp	Thu Apr 17 22:17:56 2014 +0100
540406b
+++ src/backend/plot.cpp	Thu Apr 24 00:06:18 2014 +0100
1acbe16
@@ -47,118 +47,8 @@
1acbe16
 // perform a little "push off" by this fudge factor
1acbe16
 const float AXIS_MIN_TOLERANCE=10*sqrtf(std::numeric_limits<float>::epsilon());
1acbe16
 
1acbe16
-int MGLColourFixer::maxCols=-1;
1acbe16
+const unsigned int MGL_RESERVED_COLOURS=2;
1acbe16
 
1acbe16
-void MGLColourFixer::reset()
1acbe16
-{
1acbe16
-	rs.clear();
1acbe16
-	gs.clear();
1acbe16
-	bs.clear();
1acbe16
-}
1acbe16
-
1acbe16
-char MGLColourFixer::haveExactColour(float r, float g, float b) const
1acbe16
-{
1acbe16
-	ASSERT(rs.size() == gs.size())
1acbe16
-	ASSERT(gs.size() == bs.size())
1acbe16
-
1acbe16
-	ASSERT(rs.size() <=getMaxColours());
1acbe16
-
1acbe16
-	for(unsigned int ui=0; ui
1acbe16
-	{
1acbe16
-		if( fabs(r-rs[ui]) <std::numeric_limits<float>::epsilon()
1acbe16
-			&& fabs(g-gs[ui]) <std::numeric_limits<float>::epsilon()
1acbe16
-			&& fabs(b-bs[ui]) <std::numeric_limits<float>::epsilon())
1acbe16
-			return mglColorIds[ui+1].id; //Add one to offset to avoid the reserved "k" 
1acbe16
-	}
1acbe16
-
1acbe16
-	return 0;
1acbe16
-}
1acbe16
-
1acbe16
-unsigned int MGLColourFixer::getMaxColours() 
1acbe16
-{
1acbe16
-	//Used cached value if available
1acbe16
-	if(maxCols!=-1)
1acbe16
-		return maxCols;
1acbe16
-
1acbe16
-	//The array is statically defined in
1acbe16
-	//mgl/mgl_main.cpp, and must end with an id of zero.
1acbe16
-	//
1acbe16
-	//this is not documented at all.
1acbe16
-	maxCols=0;
1acbe16
-	while(mglColorIds[maxCols].id)
1acbe16
-		maxCols++;
1acbe16
-
1acbe16
-	return maxCols;
1acbe16
-}
1acbe16
-
1acbe16
-char MGLColourFixer::getNextBestColour(float r, float g, float b) 
1acbe16
-{
1acbe16
-	ASSERT(rs.size() == gs.size());
1acbe16
-	ASSERT(gs.size() == bs.size());
1acbe16
-	
1acbe16
-
1acbe16
-	//As a special case, mgl has its own black
1acbe16
-	if(r == 0.0f && g == 0.0f && b == 0.0f)
1acbe16
-		return mglColorIds[0].id;
1acbe16
-
1acbe16
-
1acbe16
-	unsigned int best=0;
1acbe16
-	if(rs.size() == getMaxColours())
1acbe16
-	{
1acbe16
-		ASSERT(getMaxColours());
1acbe16
-		//Looks like we ran out of palette colours.
1acbe16
-		//lets just give up and try to match this against our existing colours
1acbe16
-
1acbe16
-		//TODO: let this modify the existing palette
1acbe16
-		// to find a better match.
1acbe16
-		float distanceSqr=std::numeric_limits<float>::max();
1acbe16
-		for(unsigned int ui=0; ui
1acbe16
-		{
1acbe16
-			float distanceTmp;
1acbe16
-			if(r <= 0.5)
1acbe16
-			{
1acbe16
-				//3,4,2 weighted euclidean distance. Weights allow for closer human perception
1acbe16
-				distanceTmp= 3.0*(rs[ui] - r )*(rs[ui] - r ) +4.0*(gs[ui] - g )*(gs[ui] - g )
1acbe16
-					     + 2.0*(bs[ui] - b )*(bs[ui] - b );
1acbe16
-			}
1acbe16
-			else
1acbe16
-			{
1acbe16
-				//use alternate weighting for closer colour perception in "non-red" half of colour cube
1acbe16
-				distanceTmp= 2.0*(rs[ui] - r )*(rs[ui] - r ) +4.0*(gs[ui] - g )*(gs[ui] - g )
1acbe16
-					     + 3.0*(bs[ui] - b )*(bs[ui] - b );
1acbe16
-			}
1acbe16
-
1acbe16
-			if(distanceTmp < distanceSqr)
1acbe16
-			{
1acbe16
-				distanceSqr = (distanceTmp);
1acbe16
-				best=ui+1; //offset by 1 because mathgl colour 0 is special
1acbe16
-			}
1acbe16
-
1acbe16
-		}
1acbe16
-	}
1acbe16
-	else
1acbe16
-	{
1acbe16
-		char exactMatch;
1acbe16
-		//Check to see if we don't already have this
1acbe16
-		// no use wasting palette positions on existing
1acbe16
-		// colours
1acbe16
-		exactMatch=haveExactColour(r,g,b);
1acbe16
-
1acbe16
-		if(exactMatch)
1acbe16
-			return exactMatch;
1acbe16
-
1acbe16
-		//Offset zero is special, for black things, like axes
1acbe16
-		best=rs.size()+1;
1acbe16
-		mglColorIds[best].col = mglColor(r,g,b);
1acbe16
-		
1acbe16
-		rs.push_back(r);
1acbe16
-		gs.push_back(g);
1acbe16
-		bs.push_back(b);
1acbe16
-	}
1acbe16
-
1acbe16
-	ASSERT(mglColorIds[best].id != 'k');
1acbe16
-	return mglColorIds[best].id;
1acbe16
-}
1acbe16
 
1acbe16
 //Mathgl uses some internal for(float=...) constructions, 
1acbe16
 // which are just generally a bad idea, as they often won't terminate
1acbe16
@@ -209,6 +99,18 @@
1acbe16
 }
1acbe16
 
1acbe16
 
1acbe16
+std::string mglColourCode(float r, float g, float b)
1acbe16
+{
1acbe16
+	ASSERT(r >=0.0f && g >=0.0f && b >=0.0f)
1acbe16
+	ASSERT(r <=255.0f && g <=255.0f && b <=255.0f)
1acbe16
+	std::string s;
1acbe16
+	genColString((unsigned char)(r*255),
1acbe16
+		(unsigned char)(g*255),(unsigned char)(b*255),s);
1acbe16
+	s=s.substr(1);
1acbe16
+
1acbe16
+	return string("{x") + uppercase(s) + string("}");
1acbe16
+}
1acbe16
+
1acbe16
 //TODO: Refactor these functions to use a common string map
1acbe16
 //-----------
1acbe16
 string plotString(unsigned int traceType)
1acbe16
@@ -806,7 +708,6 @@
1acbe16
 	}
1acbe16
 
1acbe16
 	//Un-fudger for mathgl plots
1acbe16
-	MGLColourFixer colourFixer;
1acbe16
 
1acbe16
 	bool haveMultiTitles=false;
1acbe16
 	float minX,maxX,minY,maxY;
1acbe16
@@ -994,17 +895,15 @@
1acbe16
 				if(!curPlot->visible)
1acbe16
 					continue;
1acbe16
 
1acbe16
-				curPlot->drawRegions(gr,colourFixer,min,max);
1acbe16
-				curPlot->drawPlot(gr,colourFixer);
1acbe16
+				curPlot->drawRegions(gr,min,max);
1acbe16
+				curPlot->drawPlot(gr);
1acbe16
 				
1acbe16
 				if(drawLegend)
1acbe16
 				{
1acbe16
 					//Fake an mgl colour code
1acbe16
-					char colourCode[2];
1acbe16
-					colourCode[0]=colourFixer.getNextBestColour(
1acbe16
-							curPlot->r,curPlot->g,curPlot->b);
1acbe16
-					colourCode[1]='\0';
1acbe16
-					gr->AddLegend(curPlot->title.c_str(),colourCode);
1acbe16
+					std::string mglColStr;
1acbe16
+					mglColStr= mglColourCode(curPlot->r,curPlot->g,curPlot->b);
1acbe16
+					gr->AddLegend(curPlot->title.c_str(),mglColStr.c_str());
1acbe16
 				}
1acbe16
 			}
1acbe16
 
1acbe16
@@ -1017,7 +916,7 @@
1acbe16
 				vector<pair<size_t,size_t> > overlapId;
1acbe16
 				vector<pair<float,float> > overlapXCoords;
1acbe16
 
1acbe16
-				char colourCode=colourFixer.getNextBestColour(1.0f,0.0f,0.0f);
1acbe16
+				string colourCode=mglColourCode(1.0f,0.0f,0.0f);
1acbe16
 				getRegionOverlaps(overlapId,overlapXCoords);
1acbe16
 
1acbe16
 				float rMinY,rMaxY;
1acbe16
@@ -1045,10 +944,10 @@
1acbe16
 
1acbe16
 #ifdef USE_MGL2
1acbe16
 					gr->FaceZ(mglPoint(rMinX,rMinY,-1),rMaxX-rMinX,rMaxY-rMinY,
1acbe16
-							&colourCode);
1acbe16
+							colourCode.c_str());
1acbe16
 #else
1acbe16
 					gr->FaceZ(rMinX,rMinY,-1,rMaxX-rMinX,rMaxY-rMinY,
1acbe16
-							&colourCode);
1acbe16
+							colourCode.c_str());
1acbe16
 #endif
1acbe16
 				}
1acbe16
 
1acbe16
@@ -1082,7 +981,7 @@
1acbe16
 #endif
1acbe16
 	}
1acbe16
 	
1acbe16
-	overlays.draw(gr,colourFixer,min,max,haveUsedLog);
1acbe16
+	overlays.draw(gr,min,max,haveUsedLog);
1acbe16
 }
1acbe16
 
1acbe16
 void PlotWrapper::hideAll()
1acbe16
@@ -1405,7 +1304,7 @@
1acbe16
 	return xValues.empty();
1acbe16
 }
1acbe16
 
1acbe16
-void Plot1D::drawPlot(mglGraph *gr,MGLColourFixer &fixer) const
1acbe16
+void Plot1D::drawPlot(mglGraph *gr) const
1acbe16
 {
1acbe16
 	bool showErrs;
1acbe16
 
1acbe16
@@ -1453,9 +1352,8 @@
1acbe16
 	
1acbe16
 	//Obtain a colour code to use for the plot, based upon
1acbe16
 	// the actual colour we wish to use
1acbe16
-	char colourCode[2];
1acbe16
-	colourCode[0]=fixer.getNextBestColour(r,g,b);
1acbe16
-	colourCode[1]='\0';
1acbe16
+	string colourCode;
1acbe16
+	colourCode=mglColourCode(r,g,b);
1acbe16
 	//---
1acbe16
 
1acbe16
 
1acbe16
@@ -1467,23 +1365,23 @@
1acbe16
 			//rather than linear interpolating them back along their paths. I have emailed the author.
1acbe16
 			//for now, we shall have to put up with missing lines :( Absolute worst case, I may have to draw them myself.
1acbe16
 			gr->SetCut(true);
1acbe16
-			
1acbe16
-			gr->Plot(xDat,yDat,colourCode);
1acbe16
+		
1acbe16
+			gr->Plot(xDat,yDat,colourCode.c_str());
1acbe16
 			if(showErrs)
1acbe16
-				gr->Error(xDat,yDat,eDat,colourCode);
1acbe16
+				gr->Error(xDat,yDat,eDat,colourCode.c_str());
1acbe16
 			gr->SetCut(false);
1acbe16
 			break;
1acbe16
 		case PLOT_TRACE_BARS:
1acbe16
-			gr->Bars(xDat,yDat,colourCode);
1acbe16
+			gr->Bars(xDat,yDat,colourCode.c_str());
1acbe16
 			break;
1acbe16
 		case PLOT_TRACE_STEPS:
1acbe16
 			//Same problem as for line plot. 
1acbe16
 			gr->SetCut(true);
1acbe16
-			gr->Step(xDat,yDat,colourCode);
1acbe16
+			gr->Step(xDat,yDat,colourCode.c_str());
1acbe16
 			gr->SetCut(false);
1acbe16
 			break;
1acbe16
 		case PLOT_TRACE_STEM:
1acbe16
-			gr->Stem(xDat,yDat,colourCode);
1acbe16
+			gr->Stem(xDat,yDat,colourCode.c_str());
1acbe16
 			break;
1acbe16
 
1acbe16
 		case PLOT_TRACE_POINTS:
1acbe16
@@ -1557,13 +1455,11 @@
1acbe16
 	regionGroup.clear();
1acbe16
 }
1acbe16
 
1acbe16
-void Plot1D::drawRegions(mglGraph *gr,MGLColourFixer &fixer,
1acbe16
+void Plot1D::drawRegions(mglGraph *gr,
1acbe16
 		const mglPoint &min,const mglPoint &max) const
1acbe16
 {
1acbe16
 	//Mathgl palette colour name
1acbe16
-	char colourCode[2];
1acbe16
-	colourCode[1]='\0';
1acbe16
-
1acbe16
+	string colourCode;
1acbe16
 
1acbe16
 	for(unsigned int uj=0;uj
1acbe16
 	{
1acbe16
@@ -1577,16 +1473,15 @@
1acbe16
 		//Prevent drawing inverted regionGroup.regions
1acbe16
 		if(rMaxX > rMinX && rMaxY > rMinY)
1acbe16
 		{
1acbe16
-			colourCode[0] = fixer.getNextBestColour(regionGroup.regions[uj].r,
1acbe16
+			colourCode = mglColourCode(regionGroup.regions[uj].r,
1acbe16
 						regionGroup.regions[uj].g,
1acbe16
 						regionGroup.regions[uj].b);
1acbe16
-			colourCode[1] = '\0';
1acbe16
 #ifdef USE_MGL2
1acbe16
 			gr->FaceZ(mglPoint(rMinX,rMinY,-1),rMaxX-rMinX,rMaxY-rMinY,
1acbe16
-					colourCode);
1acbe16
+					colourCode.c_str());
1acbe16
 #else
1acbe16
 			gr->FaceZ(rMinX,rMinY,-1,rMaxX-rMinX,rMaxY-rMinY,
1acbe16
-					colourCode);
1acbe16
+					colourCode.c_str());
1acbe16
 #endif
1acbe16
 					
1acbe16
 		}
1acbe16
@@ -1791,18 +1686,17 @@
1acbe16
 }
1acbe16
 
1acbe16
 
1acbe16
-void PlotOverlays::draw(mglGraph *gr,MGLColourFixer &fixer, 
1acbe16
+void PlotOverlays::draw(mglGraph *gr,
1acbe16
 		const mglPoint &boundMin, const mglPoint &boundMax,bool logMode ) const
1acbe16
 {
1acbe16
 
1acbe16
 	if(!isEnabled)
1acbe16
 		return;
1acbe16
 
1acbe16
-	char colourCode[2];
1acbe16
+	string colourCode;
1acbe16
 
1acbe16
 	//Draw the overlays in black
1acbe16
-	colourCode[0] = fixer.getNextBestColour(0.0,0.0,0.0);
1acbe16
-	colourCode[1]='\0';
1acbe16
+	colourCode = mglColourCode(0.0,0.0,0.0);
1acbe16
 	
1acbe16
 	for(size_t ui=0;ui
1acbe16
 	{
1acbe16
@@ -1841,6 +1735,7 @@
1acbe16
 			}
1acbe16
 		}
1acbe16
 
1acbe16
+		//TODO: Deprecate me. Upstream now allows single stems
1acbe16
 		//Draw stems. can't use stem plot due to mathgl bug whereby single stems
1acbe16
 		// will not be drawn
1acbe16
 		for(size_t uj=0;uj
1acbe16
@@ -1849,7 +1744,7 @@
1acbe16
 					boundMin.y < bufY[uj])
1acbe16
 			{
1acbe16
 				gr->Line (mglPoint(bufX[uj],std::max(0.0f,(float)boundMin.y)),
1acbe16
-					mglPoint(bufX[uj],bufY[uj]),colourCode,100);
1acbe16
+					mglPoint(bufX[uj],bufY[uj]),colourCode.c_str(),100);
1acbe16
 
1acbe16
 				//Print labels near to the text
1acbe16
 				const float STANDOFF_FACTOR=1.05;
1acbe16
diff -r 34e37068b6c7 -r 47f4a1712c25 src/backend/plot.h
540406b
--- src/backend/plot.h	Thu Apr 17 22:17:56 2014 +0100
540406b
+++ src/backend/plot.h	Thu Apr 24 00:06:18 2014 +0100
1acbe16
@@ -64,26 +64,6 @@
1acbe16
 //!Return the error mode type, given the human readable string
1acbe16
 unsigned int plotErrmodeID(const std::string &s);
1acbe16
 		
1acbe16
-//!Nasty hack class to change mathgl API from named char palette to rgb specification
1acbe16
-class MGLColourFixer
1acbe16
-{
1acbe16
-	private:
1acbe16
-		vector<float> rs,gs,bs;
1acbe16
-		static int maxCols;
1acbe16
-	public:
1acbe16
-		//Restore the MGL colour strings
1acbe16
-		void reset();
1acbe16
-		//Return the exact colour, if there is one
1acbe16
-		char haveExactColour(float r, float g, float b) const;
1acbe16
-		//Get the best colour that is available
1acbe16
-		// returns the char to give to mathgl; may be exact,
1acbe16
-		// maybe nearest match, depending upon number of colours used
1acbe16
-		// and mgl palette size
1acbe16
-		char getNextBestColour(float r, float g, float b);
1acbe16
-
1acbe16
-		static unsigned int getMaxColours();
1acbe16
-};
1acbe16
-
1acbe16
 
1acbe16
 //!Data class  for holding info about non-overlapping 
1acbe16
 // interactive rectilinear "zones" overlaid on plots 
1acbe16
@@ -199,7 +179,7 @@
1acbe16
 		//Add a new overlay to the plot
1acbe16
 		void add(const OVERLAY_DATA &overlay) {overlayData.push_back(overlay);}
1acbe16
 		//Draw the overlay on the current plot
1acbe16
-		void draw(mglGraph *g,MGLColourFixer &fixer, 
1acbe16
+		void draw(mglGraph *g,
1acbe16
 			const mglPoint &boundMin, const mglPoint &boundMax,bool logMode) const;
1acbe16
 		//Enable the specified overlay
1acbe16
 		void setEnabled(size_t offset,bool isEnabled) 
1acbe16
@@ -262,7 +242,7 @@
1acbe16
 		virtual bool empty() const=0;
1acbe16
 
1acbe16
 		//Draw the plot onto a given MGL graph
1acbe16
-		virtual void drawPlot(mglGraph *graph, MGLColourFixer &fixer) const=0;
1acbe16
+		virtual void drawPlot(mglGraph *graph) const=0;
1acbe16
 
1acbe16
 		//!Scan for the data bounds.
1acbe16
 		virtual void getBounds(float &xMin,float &xMax,
1acbe16
@@ -309,11 +289,10 @@
1acbe16
 		
1acbe16
 		
1acbe16
 		//Draw the plot onto a given MGL graph
1acbe16
-		virtual void drawPlot(mglGraph *graph,MGLColourFixer &fixer) const;
1acbe16
+		virtual void drawPlot(mglGraph *graph) const;
1acbe16
 
1acbe16
 		//Draw the associated regions		
1acbe16
-		void drawRegions(mglGraph *graph, MGLColourFixer &fixer,
1acbe16
-				const mglPoint &min, const mglPoint &max) const;
1acbe16
+		void drawRegions(mglGraph *graph,const mglPoint &min, const mglPoint &max) const;
1acbe16
 
1acbe16
 
1acbe16
 		//!Retrieve the raw data associated with the currently visible plots. 
1acbe16
diff -r 34e37068b6c7 -r 47f4a1712c25 src/common/stringFuncs.cpp
540406b
--- src/common/stringFuncs.cpp	Thu Apr 17 22:17:56 2014 +0100
540406b
+++ src/common/stringFuncs.cpp	Thu Apr 24 00:06:18 2014 +0100
1acbe16
@@ -457,6 +457,16 @@
1acbe16
 	return s;
1acbe16
 }
1acbe16
 
1acbe16
+std::string uppercase(std::string s)
1acbe16
+{
1acbe16
+	for(unsigned int ui=0;ui
1acbe16
+	{
1acbe16
+		if(isascii(s[ui]) && islower(s[ui]))
1acbe16
+			s[ui] = toupper(s[ui]);
1acbe16
+	}
1acbe16
+	return s;
1acbe16
+}
1acbe16
+
1acbe16
 //Split strings around a delimiter
1acbe16
 void splitStrsRef(const char *cpStr, const char delim,std::vector<string> &v )
1acbe16
 {
1acbe16
diff -r 34e37068b6c7 -r 47f4a1712c25 src/common/stringFuncs.h
540406b
--- src/common/stringFuncs.h	Thu Apr 17 22:17:56 2014 +0100
540406b
+++ src/common/stringFuncs.h	Thu Apr 24 00:06:18 2014 +0100
1acbe16
@@ -61,6 +61,8 @@
1acbe16
 std::string stripChars(const std::string &Str, const char *chars);
1acbe16
 //!Return a lowercase version for a given string
1acbe16
 std::string lowercase(std::string s);
1acbe16
+//!Return a uppercase version for a given string
1acbe16
+std::string uppercase(std::string s);
1acbe16
 
1acbe16
 //Drop empty entries from a string of vector
1acbe16
 void stripZeroEntries(std::vector<std::string> &s);
1acbe16
@@ -71,9 +73,11 @@
1acbe16
 	unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a);
1acbe16
 
1acbe16
 //Convert an RGBA 8-bit/channel quadruplet into its hexadecimal colour string
1acbe16
+// format is "#rrggbbaa" such as "#11ee00aa"
1acbe16
 void genColString(unsigned char r, unsigned char g, 
1acbe16
 			unsigned char b, unsigned char a, std::string &s);
1acbe16
 //Convert an RGB 8-bit/channel quadruplet into its hexadecimal colour string
1acbe16
+// format is "#rrggbb" such as "#11ee00"
1acbe16
 void genColString(unsigned char r, unsigned char g, 
1acbe16
 			unsigned char b, std::string &s);
1acbe16
 
1acbe16
diff -r 34e37068b6c7 -r 47f4a1712c25 src/gui/dialogs/rangeEditDialog.cpp
540406b
--- src/gui/dialogs/rangeEditDialog.cpp	Thu Apr 17 22:17:56 2014 +0100
540406b
+++ src/gui/dialogs/rangeEditDialog.cpp	Thu Apr 24 00:06:18 2014 +0100
1acbe16
@@ -288,7 +288,7 @@
1acbe16
     EVT_CHECKLISTBOX(ID_LIST_OVERLAY, RangeEditorDialog::OnListOverlayCheck)
1acbe16
     EVT_BUTTON(wxID_OK, RangeEditorDialog::OnBtnOK)
1acbe16
     EVT_BUTTON(wxID_CANCEL, RangeEditorDialog::OnBtnCancel)
1acbe16
-    EVT_SPLITTER_UNSPLIT(ID_SPLIT_LEFTRIGHT, RangeEditorDialog::OnSashVerticalUnsplit)
1acbe16
+    EVT_SPLITTER_DCLICK(ID_SPLIT_LEFTRIGHT, RangeEditorDialog::OnSashVerticalDClick)
1acbe16
     // end wxGlade
1acbe16
 END_EVENT_TABLE();
1acbe16
 
1acbe16
@@ -1438,7 +1438,7 @@
1acbe16
 	plotPanel->Refresh();
1acbe16
 }
1acbe16
 
1acbe16
-void RangeEditorDialog::OnSashVerticalUnsplit(wxSplitterEvent &event)
1acbe16
+void RangeEditorDialog::OnSashVerticalDClick(wxSplitterEvent &event)
1acbe16
 {
1acbe16
 	event.Veto();
1acbe16
 }
1acbe16
diff -r 34e37068b6c7 -r 47f4a1712c25 src/gui/dialogs/rangeEditDialog.h
540406b
--- src/gui/dialogs/rangeEditDialog.h	Thu Apr 17 22:17:56 2014 +0100
540406b
+++ src/gui/dialogs/rangeEditDialog.h	Thu Apr 24 00:06:18 2014 +0100
1acbe16
@@ -210,7 +210,7 @@
1acbe16
     virtual void OnCheckShowOverlay(wxCommandEvent &event); // wxGlade: <event_handler>
1acbe16
     virtual void OnBtnOK(wxCommandEvent &event); // wxGlade: <event_handler>
1acbe16
     virtual void OnBtnCancel(wxCommandEvent &event); // wxGlade: <event_handler>
1acbe16
-    virtual void OnSashVerticalUnsplit(wxSplitterEvent &event); // wxGlade: <event_handler>
1acbe16
+    virtual void OnSashVerticalDClick(wxSplitterEvent &event); // wxGlade: <event_handler>
1acbe16
     virtual void OnListOverlayCheck(wxCommandEvent &event);
1acbe16
     virtual void OnListOverlayKeyDown(wxListEvent &event);
1acbe16
     virtual void OnTextOverlay(wxCommandEvent &event);
1acbe16
diff -r 34e37068b6c7 -r 47f4a1712c25 src/gui/mainFrame.cpp
540406b
--- src/gui/mainFrame.cpp	Thu Apr 17 22:17:56 2014 +0100
540406b
+++ src/gui/mainFrame.cpp	Thu Apr 24 00:06:18 2014 +0100
1acbe16
@@ -1143,9 +1143,12 @@
1acbe16
 					f->setRangeData(rng);
1acbe16
 					f->setRangeFilename(s.c_str());
1acbe16
 
1acbe16
-					//Get the parent filter pointer	
1acbe16
+					//Add the filter, using the seelcted
1acbe16
+					// item as the parent
1acbe16
 					visControl.addFilter(f,false,filterId);
1acbe16
 
1acbe16
+					//update the tree control
1acbe16
+					visControl.updateWxTreeCtrl(treeFilters);
1acbe16
 				}
1acbe16
 				else
1acbe16
 				{
1acbe16
@@ -1398,6 +1401,10 @@
1acbe16
 		}
1acbe16
 		
1acbe16
 		setSaveStatus();
1acbe16
+
1acbe16
+		//make sure camera is properly centred
1acbe16
+		if(visControl.numCams() == 1)
1acbe16
+			visControl.ensureSceneVisible(3);
1acbe16
 	}
1acbe16
 
1acbe16
 }