~ubuntu-branches/debian/stretch/3depict/stretch

« back to all changes in this revision

Viewing changes to debian/patches/upstream-patch

  • Committer: Package Import Robot
  • Author(s): D Haley
  • Date: 2015-05-01 23:59:48 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20150501235948-t38obogk535eg2h6
Tags: 0.0.18-1
Update to upstream 0.0.18

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Origin: upstream 
2
 
Forwarded:not-needed
3
 
Index: 3depict-0.0.16/src/backend/plot.cpp
4
 
===================================================================
5
 
--- 3depict-0.0.16.orig/src/backend/plot.cpp    2014-04-25 00:52:47.042185677 +0200
6
 
+++ 3depict-0.0.16/src/backend/plot.cpp 2014-04-25 00:52:47.038185728 +0200
7
 
@@ -47,118 +47,8 @@
8
 
 // perform a little "push off" by this fudge factor
9
 
 const float AXIS_MIN_TOLERANCE=10*sqrtf(std::numeric_limits<float>::epsilon());
10
 
 
11
 
-int MGLColourFixer::maxCols=-1;
12
 
+const unsigned int MGL_RESERVED_COLOURS=2;
13
 
 
14
 
-void MGLColourFixer::reset()
15
 
-{
16
 
-       rs.clear();
17
 
-       gs.clear();
18
 
-       bs.clear();
19
 
-}
20
 
-
21
 
-char MGLColourFixer::haveExactColour(float r, float g, float b) const
22
 
-{
23
 
-       ASSERT(rs.size() == gs.size())
24
 
-       ASSERT(gs.size() == bs.size())
25
 
-
26
 
-       ASSERT(rs.size() <=getMaxColours());
27
 
-
28
 
-       for(unsigned int ui=0; ui<rs.size(); ui++)
29
 
-       {
30
 
-               if( fabs(r-rs[ui]) <std::numeric_limits<float>::epsilon()
31
 
-                       && fabs(g-gs[ui]) <std::numeric_limits<float>::epsilon()
32
 
-                       && fabs(b-bs[ui]) <std::numeric_limits<float>::epsilon())
33
 
-                       return mglColorIds[ui+1].id; //Add one to offset to avoid the reserved "k" 
34
 
-       }
35
 
-
36
 
-       return 0;
37
 
-}
38
 
-
39
 
-unsigned int MGLColourFixer::getMaxColours() 
40
 
-{
41
 
-       //Used cached value if available
42
 
-       if(maxCols!=-1)
43
 
-               return maxCols;
44
 
-
45
 
-       //The array is statically defined in
46
 
-       //mgl/mgl_main.cpp, and must end with an id of zero.
47
 
-       //
48
 
-       //this is not documented at all.
49
 
-       maxCols=0;
50
 
-       while(mglColorIds[maxCols].id)
51
 
-               maxCols++;
52
 
-
53
 
-       return maxCols;
54
 
-}
55
 
-
56
 
-char MGLColourFixer::getNextBestColour(float r, float g, float b) 
57
 
-{
58
 
-       ASSERT(rs.size() == gs.size());
59
 
-       ASSERT(gs.size() == bs.size());
60
 
-       
61
 
-
62
 
-       //As a special case, mgl has its own black
63
 
-       if(r == 0.0f && g == 0.0f && b == 0.0f)
64
 
-               return mglColorIds[0].id;
65
 
-
66
 
-
67
 
-       unsigned int best=0;
68
 
-       if(rs.size() == getMaxColours())
69
 
-       {
70
 
-               ASSERT(getMaxColours());
71
 
-               //Looks like we ran out of palette colours.
72
 
-               //lets just give up and try to match this against our existing colours
73
 
-
74
 
-               //TODO: let this modify the existing palette
75
 
-               // to find a better match.
76
 
-               float distanceSqr=std::numeric_limits<float>::max();
77
 
-               for(unsigned int ui=0; ui<rs.size(); ui++)
78
 
-               {
79
 
-                       float distanceTmp;
80
 
-                       if(r <= 0.5)
81
 
-                       {
82
 
-                               //3,4,2 weighted euclidean distance. Weights allow for closer human perception
83
 
-                               distanceTmp= 3.0*(rs[ui] - r )*(rs[ui] - r ) +4.0*(gs[ui] - g )*(gs[ui] - g )
84
 
-                                            + 2.0*(bs[ui] - b )*(bs[ui] - b );
85
 
-                       }
86
 
-                       else
87
 
-                       {
88
 
-                               //use alternate weighting for closer colour perception in "non-red" half of colour cube
89
 
-                               distanceTmp= 2.0*(rs[ui] - r )*(rs[ui] - r ) +4.0*(gs[ui] - g )*(gs[ui] - g )
90
 
-                                            + 3.0*(bs[ui] - b )*(bs[ui] - b );
91
 
-                       }
92
 
-
93
 
-                       if(distanceTmp < distanceSqr)
94
 
-                       {
95
 
-                               distanceSqr = (distanceTmp);
96
 
-                               best=ui+1; //offset by 1 because mathgl colour 0 is special
97
 
-                       }
98
 
-
99
 
-               }
100
 
-       }
101
 
-       else
102
 
-       {
103
 
-               char exactMatch;
104
 
-               //Check to see if we don't already have this
105
 
-               // no use wasting palette positions on existing
106
 
-               // colours
107
 
-               exactMatch=haveExactColour(r,g,b);
108
 
-
109
 
-               if(exactMatch)
110
 
-                       return exactMatch;
111
 
-
112
 
-               //Offset zero is special, for black things, like axes
113
 
-               best=rs.size()+1;
114
 
-               mglColorIds[best].col = mglColor(r,g,b);
115
 
-               
116
 
-               rs.push_back(r);
117
 
-               gs.push_back(g);
118
 
-               bs.push_back(b);
119
 
-       }
120
 
-
121
 
-       ASSERT(mglColorIds[best].id != 'k');
122
 
-       return mglColorIds[best].id;
123
 
-}
124
 
 
125
 
 //Mathgl uses some internal for(float=...) constructions, 
126
 
 // which are just generally a bad idea, as they often won't terminate
127
 
@@ -209,6 +99,18 @@
128
 
 }
129
 
 
130
 
 
131
 
+std::string mglColourCode(float r, float g, float b)
132
 
+{
133
 
+       ASSERT(r >=0.0f && g >=0.0f && b >=0.0f)
134
 
+       ASSERT(r <=255.0f && g <=255.0f && b <=255.0f)
135
 
+       std::string s;
136
 
+       genColString((unsigned char)(r*255),
137
 
+               (unsigned char)(g*255),(unsigned char)(b*255),s);
138
 
+       s=s.substr(1);
139
 
+
140
 
+       return string("{x") + uppercase(s) + string("}");
141
 
+}
142
 
+
143
 
 //TODO: Refactor these functions to use a common string map
144
 
 //-----------
145
 
 string plotString(unsigned int traceType)
146
 
@@ -806,7 +708,6 @@
147
 
        }
148
 
 
149
 
        //Un-fudger for mathgl plots
150
 
-       MGLColourFixer colourFixer;
151
 
 
152
 
        bool haveMultiTitles=false;
153
 
        float minX,maxX,minY,maxY;
154
 
@@ -994,17 +895,15 @@
155
 
                                if(!curPlot->visible)
156
 
                                        continue;
157
 
 
158
 
-                               curPlot->drawRegions(gr,colourFixer,min,max);
159
 
-                               curPlot->drawPlot(gr,colourFixer);
160
 
+                               curPlot->drawRegions(gr,min,max);
161
 
+                               curPlot->drawPlot(gr);
162
 
                                
163
 
                                if(drawLegend)
164
 
                                {
165
 
                                        //Fake an mgl colour code
166
 
-                                       char colourCode[2];
167
 
-                                       colourCode[0]=colourFixer.getNextBestColour(
168
 
-                                                       curPlot->r,curPlot->g,curPlot->b);
169
 
-                                       colourCode[1]='\0';
170
 
-                                       gr->AddLegend(curPlot->title.c_str(),colourCode);
171
 
+                                       std::string mglColStr;
172
 
+                                       mglColStr= mglColourCode(curPlot->r,curPlot->g,curPlot->b);
173
 
+                                       gr->AddLegend(curPlot->title.c_str(),mglColStr.c_str());
174
 
                                }
175
 
                        }
176
 
 
177
 
@@ -1017,7 +916,7 @@
178
 
                                vector<pair<size_t,size_t> > overlapId;
179
 
                                vector<pair<float,float> > overlapXCoords;
180
 
 
181
 
-                               char colourCode=colourFixer.getNextBestColour(1.0f,0.0f,0.0f);
182
 
+                               string colourCode=mglColourCode(1.0f,0.0f,0.0f);
183
 
                                getRegionOverlaps(overlapId,overlapXCoords);
184
 
 
185
 
                                float rMinY,rMaxY;
186
 
@@ -1045,10 +944,10 @@
187
 
 
188
 
 #ifdef USE_MGL2
189
 
                                        gr->FaceZ(mglPoint(rMinX,rMinY,-1),rMaxX-rMinX,rMaxY-rMinY,
190
 
-                                                       &colourCode);
191
 
+                                                       colourCode.c_str());
192
 
 #else
193
 
                                        gr->FaceZ(rMinX,rMinY,-1,rMaxX-rMinX,rMaxY-rMinY,
194
 
-                                                       &colourCode);
195
 
+                                                       colourCode.c_str());
196
 
 #endif
197
 
                                }
198
 
 
199
 
@@ -1082,7 +981,7 @@
200
 
 #endif
201
 
        }
202
 
        
203
 
-       overlays.draw(gr,colourFixer,min,max,haveUsedLog);
204
 
+       overlays.draw(gr,min,max,haveUsedLog);
205
 
 }
206
 
 
207
 
 void PlotWrapper::hideAll()
208
 
@@ -1405,7 +1304,7 @@
209
 
        return xValues.empty();
210
 
 }
211
 
 
212
 
-void Plot1D::drawPlot(mglGraph *gr,MGLColourFixer &fixer) const
213
 
+void Plot1D::drawPlot(mglGraph *gr) const
214
 
 {
215
 
        bool showErrs;
216
 
 
217
 
@@ -1453,9 +1352,8 @@
218
 
        
219
 
        //Obtain a colour code to use for the plot, based upon
220
 
        // the actual colour we wish to use
221
 
-       char colourCode[2];
222
 
-       colourCode[0]=fixer.getNextBestColour(r,g,b);
223
 
-       colourCode[1]='\0';
224
 
+       string colourCode;
225
 
+       colourCode=mglColourCode(r,g,b);
226
 
        //---
227
 
 
228
 
 
229
 
@@ -1467,23 +1365,23 @@
230
 
                        //rather than linear interpolating them back along their paths. I have emailed the author.
231
 
                        //for now, we shall have to put up with missing lines :( Absolute worst case, I may have to draw them myself.
232
 
                        gr->SetCut(true);
233
 
-                       
234
 
-                       gr->Plot(xDat,yDat,colourCode);
235
 
+               
236
 
+                       gr->Plot(xDat,yDat,colourCode.c_str());
237
 
                        if(showErrs)
238
 
-                               gr->Error(xDat,yDat,eDat,colourCode);
239
 
+                               gr->Error(xDat,yDat,eDat,colourCode.c_str());
240
 
                        gr->SetCut(false);
241
 
                        break;
242
 
                case PLOT_TRACE_BARS:
243
 
-                       gr->Bars(xDat,yDat,colourCode);
244
 
+                       gr->Bars(xDat,yDat,colourCode.c_str());
245
 
                        break;
246
 
                case PLOT_TRACE_STEPS:
247
 
                        //Same problem as for line plot. 
248
 
                        gr->SetCut(true);
249
 
-                       gr->Step(xDat,yDat,colourCode);
250
 
+                       gr->Step(xDat,yDat,colourCode.c_str());
251
 
                        gr->SetCut(false);
252
 
                        break;
253
 
                case PLOT_TRACE_STEM:
254
 
-                       gr->Stem(xDat,yDat,colourCode);
255
 
+                       gr->Stem(xDat,yDat,colourCode.c_str());
256
 
                        break;
257
 
 
258
 
                case PLOT_TRACE_POINTS:
259
 
@@ -1557,13 +1455,11 @@
260
 
        regionGroup.clear();
261
 
 }
262
 
 
263
 
-void Plot1D::drawRegions(mglGraph *gr,MGLColourFixer &fixer,
264
 
+void Plot1D::drawRegions(mglGraph *gr,
265
 
                const mglPoint &min,const mglPoint &max) const
266
 
 {
267
 
        //Mathgl palette colour name
268
 
-       char colourCode[2];
269
 
-       colourCode[1]='\0';
270
 
-
271
 
+       string colourCode;
272
 
 
273
 
        for(unsigned int uj=0;uj<regionGroup.regions.size();uj++)
274
 
        {
275
 
@@ -1577,16 +1473,15 @@
276
 
                //Prevent drawing inverted regionGroup.regions
277
 
                if(rMaxX > rMinX && rMaxY > rMinY)
278
 
                {
279
 
-                       colourCode[0] = fixer.getNextBestColour(regionGroup.regions[uj].r,
280
 
+                       colourCode = mglColourCode(regionGroup.regions[uj].r,
281
 
                                                regionGroup.regions[uj].g,
282
 
                                                regionGroup.regions[uj].b);
283
 
-                       colourCode[1] = '\0';
284
 
 #ifdef USE_MGL2
285
 
                        gr->FaceZ(mglPoint(rMinX,rMinY,-1),rMaxX-rMinX,rMaxY-rMinY,
286
 
-                                       colourCode);
287
 
+                                       colourCode.c_str());
288
 
 #else
289
 
                        gr->FaceZ(rMinX,rMinY,-1,rMaxX-rMinX,rMaxY-rMinY,
290
 
-                                       colourCode);
291
 
+                                       colourCode.c_str());
292
 
 #endif
293
 
                                        
294
 
                }
295
 
@@ -1791,18 +1686,17 @@
296
 
 }
297
 
 
298
 
 
299
 
-void PlotOverlays::draw(mglGraph *gr,MGLColourFixer &fixer, 
300
 
+void PlotOverlays::draw(mglGraph *gr,
301
 
                const mglPoint &boundMin, const mglPoint &boundMax,bool logMode ) const
302
 
 {
303
 
 
304
 
        if(!isEnabled)
305
 
                return;
306
 
 
307
 
-       char colourCode[2];
308
 
+       string colourCode;
309
 
 
310
 
        //Draw the overlays in black
311
 
-       colourCode[0] = fixer.getNextBestColour(0.0,0.0,0.0);
312
 
-       colourCode[1]='\0';
313
 
+       colourCode = mglColourCode(0.0,0.0,0.0);
314
 
        
315
 
        for(size_t ui=0;ui<overlayData.size();ui++)
316
 
        {
317
 
@@ -1841,6 +1735,7 @@
318
 
                        }
319
 
                }
320
 
 
321
 
+               //TODO: Deprecate me. Upstream now allows single stems
322
 
                //Draw stems. can't use stem plot due to mathgl bug whereby single stems
323
 
                // will not be drawn
324
 
                for(size_t uj=0;uj<overlayData[ui].coordData.size();uj++)
325
 
@@ -1849,7 +1744,7 @@
326
 
                                        boundMin.y < bufY[uj])
327
 
                        {
328
 
                                gr->Line (mglPoint(bufX[uj],std::max(0.0f,(float)boundMin.y)),
329
 
-                                       mglPoint(bufX[uj],bufY[uj]),colourCode,100);
330
 
+                                       mglPoint(bufX[uj],bufY[uj]),colourCode.c_str(),100);
331
 
 
332
 
                                //Print labels near to the text
333
 
                                const float STANDOFF_FACTOR=1.05;
334
 
Index: 3depict-0.0.16/src/backend/plot.h
335
 
===================================================================
336
 
--- 3depict-0.0.16.orig/src/backend/plot.h      2014-04-25 00:52:47.042185677 +0200
337
 
+++ 3depict-0.0.16/src/backend/plot.h   2014-04-25 00:52:47.038185728 +0200
338
 
@@ -64,26 +64,6 @@
339
 
 //!Return the error mode type, given the human readable string
340
 
 unsigned int plotErrmodeID(const std::string &s);
341
 
                
342
 
-//!Nasty hack class to change mathgl API from named char palette to rgb specification
343
 
-class MGLColourFixer
344
 
-{
345
 
-       private:
346
 
-               vector<float> rs,gs,bs;
347
 
-               static int maxCols;
348
 
-       public:
349
 
-               //Restore the MGL colour strings
350
 
-               void reset();
351
 
-               //Return the exact colour, if there is one
352
 
-               char haveExactColour(float r, float g, float b) const;
353
 
-               //Get the best colour that is available
354
 
-               // returns the char to give to mathgl; may be exact,
355
 
-               // maybe nearest match, depending upon number of colours used
356
 
-               // and mgl palette size
357
 
-               char getNextBestColour(float r, float g, float b);
358
 
-
359
 
-               static unsigned int getMaxColours();
360
 
-};
361
 
-
362
 
 
363
 
 //!Data class  for holding info about non-overlapping 
364
 
 // interactive rectilinear "zones" overlaid on plots 
365
 
@@ -199,7 +179,7 @@
366
 
                //Add a new overlay to the plot
367
 
                void add(const OVERLAY_DATA &overlay) {overlayData.push_back(overlay);}
368
 
                //Draw the overlay on the current plot
369
 
-               void draw(mglGraph *g,MGLColourFixer &fixer, 
370
 
+               void draw(mglGraph *g,
371
 
                        const mglPoint &boundMin, const mglPoint &boundMax,bool logMode) const;
372
 
                //Enable the specified overlay
373
 
                void setEnabled(size_t offset,bool isEnabled) 
374
 
@@ -262,7 +242,7 @@
375
 
                virtual bool empty() const=0;
376
 
 
377
 
                //Draw the plot onto a given MGL graph
378
 
-               virtual void drawPlot(mglGraph *graph, MGLColourFixer &fixer) const=0;
379
 
+               virtual void drawPlot(mglGraph *graph) const=0;
380
 
 
381
 
                //!Scan for the data bounds.
382
 
                virtual void getBounds(float &xMin,float &xMax,
383
 
@@ -309,11 +289,10 @@
384
 
                
385
 
                
386
 
                //Draw the plot onto a given MGL graph
387
 
-               virtual void drawPlot(mglGraph *graph,MGLColourFixer &fixer) const;
388
 
+               virtual void drawPlot(mglGraph *graph) const;
389
 
 
390
 
                //Draw the associated regions           
391
 
-               void drawRegions(mglGraph *graph, MGLColourFixer &fixer,
392
 
-                               const mglPoint &min, const mglPoint &max) const;
393
 
+               void drawRegions(mglGraph *graph,const mglPoint &min, const mglPoint &max) const;
394
 
 
395
 
 
396
 
                //!Retrieve the raw data associated with the currently visible plots. 
397
 
Index: 3depict-0.0.16/src/common/stringFuncs.cpp
398
 
===================================================================
399
 
--- 3depict-0.0.16.orig/src/common/stringFuncs.cpp      2014-04-25 00:52:47.042185677 +0200
400
 
+++ 3depict-0.0.16/src/common/stringFuncs.cpp   2014-04-25 00:52:47.038185728 +0200
401
 
@@ -457,6 +457,16 @@
402
 
        return s;
403
 
 }
404
 
 
405
 
+std::string uppercase(std::string s)
406
 
+{
407
 
+       for(unsigned int ui=0;ui<s.size();ui++)
408
 
+       {
409
 
+               if(isascii(s[ui]) && islower(s[ui]))
410
 
+                       s[ui] = toupper(s[ui]);
411
 
+       }
412
 
+       return s;
413
 
+}
414
 
+
415
 
 //Split strings around a delimiter
416
 
 void splitStrsRef(const char *cpStr, const char delim,std::vector<string> &v )
417
 
 {
418
 
Index: 3depict-0.0.16/src/common/stringFuncs.h
419
 
===================================================================
420
 
--- 3depict-0.0.16.orig/src/common/stringFuncs.h        2014-04-25 00:52:47.042185677 +0200
421
 
+++ 3depict-0.0.16/src/common/stringFuncs.h     2014-04-25 00:52:47.038185728 +0200
422
 
@@ -61,6 +61,8 @@
423
 
 std::string stripChars(const std::string &Str, const char *chars);
424
 
 //!Return a lowercase version for a given string
425
 
 std::string lowercase(std::string s);
426
 
+//!Return a uppercase version for a given string
427
 
+std::string uppercase(std::string s);
428
 
 
429
 
 //Drop empty entries from a string of vector
430
 
 void stripZeroEntries(std::vector<std::string> &s);
431
 
@@ -71,9 +73,11 @@
432
 
        unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a);
433
 
 
434
 
 //Convert an RGBA 8-bit/channel quadruplet into its hexadecimal colour string
435
 
+// format is "#rrggbbaa" such as "#11ee00aa"
436
 
 void genColString(unsigned char r, unsigned char g, 
437
 
                        unsigned char b, unsigned char a, std::string &s);
438
 
 //Convert an RGB 8-bit/channel quadruplet into its hexadecimal colour string
439
 
+// format is "#rrggbb" such as "#11ee00"
440
 
 void genColString(unsigned char r, unsigned char g, 
441
 
                        unsigned char b, std::string &s);
442
 
 
443
 
Index: 3depict-0.0.16/src/gui/dialogs/rangeEditDialog.cpp
444
 
===================================================================
445
 
--- 3depict-0.0.16.orig/src/gui/dialogs/rangeEditDialog.cpp     2014-04-25 00:52:47.042185677 +0200
446
 
+++ 3depict-0.0.16/src/gui/dialogs/rangeEditDialog.cpp  2014-04-25 00:52:47.038185728 +0200
447
 
@@ -288,7 +288,7 @@
448
 
     EVT_CHECKLISTBOX(ID_LIST_OVERLAY, RangeEditorDialog::OnListOverlayCheck)
449
 
     EVT_BUTTON(wxID_OK, RangeEditorDialog::OnBtnOK)
450
 
     EVT_BUTTON(wxID_CANCEL, RangeEditorDialog::OnBtnCancel)
451
 
-    EVT_SPLITTER_UNSPLIT(ID_SPLIT_LEFTRIGHT, RangeEditorDialog::OnSashVerticalUnsplit)
452
 
+    EVT_SPLITTER_DCLICK(ID_SPLIT_LEFTRIGHT, RangeEditorDialog::OnSashVerticalDClick)
453
 
     // end wxGlade
454
 
 END_EVENT_TABLE();
455
 
 
456
 
@@ -1438,7 +1438,7 @@
457
 
        plotPanel->Refresh();
458
 
 }
459
 
 
460
 
-void RangeEditorDialog::OnSashVerticalUnsplit(wxSplitterEvent &event)
461
 
+void RangeEditorDialog::OnSashVerticalDClick(wxSplitterEvent &event)
462
 
 {
463
 
        event.Veto();
464
 
 }
465
 
Index: 3depict-0.0.16/src/gui/dialogs/rangeEditDialog.h
466
 
===================================================================
467
 
--- 3depict-0.0.16.orig/src/gui/dialogs/rangeEditDialog.h       2014-04-25 00:52:47.042185677 +0200
468
 
+++ 3depict-0.0.16/src/gui/dialogs/rangeEditDialog.h    2014-04-25 00:52:47.038185728 +0200
469
 
@@ -210,7 +210,7 @@
470
 
     virtual void OnCheckShowOverlay(wxCommandEvent &event); // wxGlade: <event_handler>
471
 
     virtual void OnBtnOK(wxCommandEvent &event); // wxGlade: <event_handler>
472
 
     virtual void OnBtnCancel(wxCommandEvent &event); // wxGlade: <event_handler>
473
 
-    virtual void OnSashVerticalUnsplit(wxSplitterEvent &event); // wxGlade: <event_handler>
474
 
+    virtual void OnSashVerticalDClick(wxSplitterEvent &event); // wxGlade: <event_handler>
475
 
     virtual void OnListOverlayCheck(wxCommandEvent &event);
476
 
     virtual void OnListOverlayKeyDown(wxListEvent &event);
477
 
     virtual void OnTextOverlay(wxCommandEvent &event);
478
 
Index: 3depict-0.0.16/src/gui/mainFrame.cpp
479
 
===================================================================
480
 
--- 3depict-0.0.16.orig/src/gui/mainFrame.cpp   2014-04-25 00:52:47.042185677 +0200
481
 
+++ 3depict-0.0.16/src/gui/mainFrame.cpp        2014-04-25 00:52:47.038185728 +0200
482
 
@@ -1143,9 +1143,12 @@
483
 
                                        f->setRangeData(rng);
484
 
                                        f->setRangeFilename(s.c_str());
485
 
 
486
 
-                                       //Get the parent filter pointer 
487
 
+                                       //Add the filter, using the seelcted
488
 
+                                       // item as the parent
489
 
                                        visControl.addFilter(f,false,filterId);
490
 
 
491
 
+                                       //update the tree control
492
 
+                                       visControl.updateWxTreeCtrl(treeFilters);
493
 
                                }
494
 
                                else
495
 
                                {
496
 
@@ -1398,6 +1401,10 @@
497
 
                }
498
 
                
499
 
                setSaveStatus();
500
 
+
501
 
+               //make sure camera is properly centred
502
 
+               if(visControl.numCams() == 1)
503
 
+                       visControl.ensureSceneVisible(3);
504
 
        }
505
 
 
506
 
 }
507
 
--- 3depict-0.0.16.orig/src/common/basics.cpp
508
 
+++ 3depict-0.0.16/src/common/basics.cpp
509
 
@@ -1115,6 +1115,28 @@ unsigned int loadTextStringData(const ch
510
 
        return 0;
511
 
 }
512
 
 
513
 
+//FIXME: Why negative?
514
 
+bool isNotDirectory(const char *filename)
515
 
+{
516
 
+#if !defined(__WIN32__) && !defined(__WIN64__)
517
 
+       struct stat statbuf;
518
 
+
519
 
+       if(stat(filename,&statbuf) == -1)
520
 
+               return false;
521
 
+
522
 
+       return (statbuf.st_mode !=S_IFDIR);
523
 
+#else
524
 
+
525
 
+       WARN(false, "Untested function. calling win api");
526
 
+       DWORD fileAttribs;
527
 
+       fileAttribs=GetFileAttributes((LPCWSTR)filename);
528
 
+       if(fileAttribs == INVALID_FILE_ATTRIBUTES)
529
 
+               return false;
530
 
+
531
 
+       return !(fileAttribs & FILE_ATTRIBUTE_DIRECTORY);
532
 
+#endif
533
 
+}
534
 
+
535
 
 #ifdef DEBUG
536
 
 bool isValidXML(const char *filename)
537
 
 {
538
 
@@ -1147,29 +1169,6 @@ bool isValidXML(const char *filename)
539
 
        return true;
540
 
 }
541
 
 
542
 
-       
543
 
-//FIXME: Why negative?
544
 
-bool isNotDirectory(const char *filename)
545
 
-{
546
 
-#if !defined(__WIN32__) && !defined(__WIN64__)
547
 
-       struct stat statbuf;
548
 
-
549
 
-       if(stat(filename,&statbuf) == -1)
550
 
-               return false;
551
 
-
552
 
-       return (statbuf.st_mode !=S_IFDIR);
553
 
-#else
554
 
-
555
 
-       WARN(false, "Untested function. calling win api");
556
 
-       DWORD fileAttribs;
557
 
-       fileAttribs=GetFileAttributes((LPCWSTR)filename);
558
 
-       if(fileAttribs == INVALID_FILE_ATTRIBUTES)
559
 
-               return false;
560
 
-
561
 
-       return !(fileAttribs & FILE_ATTRIBUTE_DIRECTORY);
562
 
-#endif
563
 
-}
564
 
-
565
 
 bool rmFile(const std::string &filename)
566
 
 {
567
 
 #if !defined(__WIN32__) && !defined(__WIN64__)