1 // -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2 //
3 // Copyright (C) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4 // Copyright (C) 2017-2018 Gunter Königsmann <wxMaxima@physikbuch.de>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // SPDX-License-Identifier: GPL-2.0+
22
23 /*! \file
24 This file contains all the wizards the draw sidepane needs.
25 */
26
27 #include "DrawWiz.h"
28 #include <wx/statbox.h>
29 #include <wx/display.h>
30 #include <wx/persist/toplevel.h>
31 #include <wx/mstream.h>
32 #include <wx/wfstream.h>
33 #include "../art/draw/images.h"
34
ExplicitWiz(wxWindow * parent,Configuration * config,wxString expression,int dimensions)35 ExplicitWiz::ExplicitWiz(wxWindow *parent, Configuration *config, wxString expression, int dimensions) :
36 wxDialog(parent, -1, _("Plot an explicit expression"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
37 {
38 m_dimensions = dimensions;
39 wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
40 vbox->Add(new wxStaticText(this, -1,
41 _("Plot an expression, for example sin(x) or (x+1)^2.")),
42 wxSizerFlags().Expand().Border(wxBOTTOM,16));
43
44 vbox->Add(new wxStaticText(this,-1, _("Expression to plot")), wxSizerFlags());
45 m_expression = new BTextCtrl(this,-1, config, expression);
46 vbox->Add(m_expression, wxSizerFlags().Expand());
47
48 vbox->Add(new wxStaticText(this,-1, _("Variable for the x value")), wxSizerFlags());
49 m_x = new BTextCtrl(this,-1, config, "x");
50 vbox->Add(m_x, wxSizerFlags().Expand());
51
52 vbox->Add(new wxStaticText(this,-1, _("Start of the x value")), wxSizerFlags());
53 m_xStart = new BTextCtrl(this,-1, config, "-2");
54 vbox->Add(m_xStart, wxSizerFlags().Expand());
55
56 vbox->Add(new wxStaticText(this,-1, _("End of the x value")), wxSizerFlags());
57 m_xEnd = new BTextCtrl(this,-1, config, "2");
58 vbox->Add(m_xEnd, wxSizerFlags().Expand());
59
60 if(m_dimensions > 2)
61 {
62 SetName("DrawExplicitWiz3D");
63 vbox->Add(new wxStaticText(this,-1, _("Variable for the y value")), wxSizerFlags());
64 m_y = new BTextCtrl(this,-1, config, "y");
65 vbox->Add(m_y, wxSizerFlags().Expand());
66
67 vbox->Add(new wxStaticText(this,-1, _("Start of the y value")), wxSizerFlags());
68 m_yStart = new BTextCtrl(this,-1, config, "-2");
69 vbox->Add(m_yStart, wxSizerFlags().Expand());
70
71 vbox->Add(new wxStaticText(this,-1, _("End of the y value")), wxSizerFlags());
72 m_yEnd = new BTextCtrl(this,-1, config, "2");
73 vbox->Add(m_yEnd, wxSizerFlags().Expand());
74 }
75 else
76 {
77 SetName("DrawExplicitWiz2D");
78 vbox->Add(new wxStaticText(this,-1, _("Optional: A 2nd expression that defines a region to fill")), wxSizerFlags());
79 m_filledfunc = new BTextCtrl(this,-1, config, "");
80 vbox->Add(m_filledfunc, wxSizerFlags().Expand());
81 }
82
83 wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
84 hbox->Add(
85 new SvgPanel(
86 this,
87 Draw_Explicit_svg_gz,Draw_Explicit_svg_gz_len),
88 wxSizerFlags(20).Center().Border(wxALL,5)
89 );
90 vbox->Add(
91 hbox,
92 wxSizerFlags(20).Expand()
93 );
94
95
96 wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
97
98 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"));
99 wxButton *cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
100 #if defined __WXMSW__
101 buttonSizer->Add(okButton);
102 buttonSizer->Add(cancelButton);
103 #else
104 buttonSizer->Add(cancelButton);
105 buttonSizer->Add(okButton);
106 #endif
107 okButton->SetDefault();
108 vbox->Add(buttonSizer, wxSizerFlags().Right());
109 m_expression ->SetValue(expression);
110 wxPersistenceManager::Get().RegisterAndRestore(this);
111 SetSizerAndFit(vbox);
112 }
113
GetValue()114 wxString ExplicitWiz::GetValue()
115 {
116 wxString retval;
117 if((m_dimensions < 3) && (m_filledfunc->GetValue() != wxEmptyString))
118 retval = "filled_func=" + m_filledfunc->GetValue() + ",\n ";
119
120 retval += wxT("explicit(\n ") + m_expression->GetValue() + ",\n ";
121 retval += m_x->GetValue() + "," + m_xStart->GetValue() + "," + m_xEnd->GetValue();
122 if(m_dimensions > 2)
123 retval += ",\n " + m_y->GetValue() + "," + m_yStart->GetValue() + "," +
124 m_yEnd->GetValue();
125 retval += "\n )";
126
127 if((m_dimensions < 3) && (m_filledfunc->GetValue() != wxEmptyString))
128 retval += ",\n filled_func=false";
129
130 return retval;
131 }
132
ImplicitWiz(wxWindow * parent,Configuration * config,wxString expression,int dimensions)133 ImplicitWiz::ImplicitWiz(wxWindow *parent, Configuration *config, wxString expression, int dimensions) :
134 wxDialog(parent, -1, _("Plot an explicit expression"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
135 {
136 m_dimensions = dimensions;
137 wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
138 vbox->Add(new wxStaticText(this, -1,
139 _("Draw all points where an equation is true.")),
140 wxSizerFlags().Expand().Border(wxBOTTOM,16));
141 vbox->Add(new wxStaticText(this, -1,
142 _("See also the speed <-> accuracy button.")),
143 wxSizerFlags().Expand().Border(wxBOTTOM,16));
144
145 vbox->Add(new wxStaticText(this,-1, _("Equation")), wxSizerFlags());
146 m_expression = new BTextCtrl(this,-1, config, expression);
147 vbox->Add(m_expression, wxSizerFlags().Expand());
148 m_expression->SetToolTip(_("A good example equation would be x^2+y^2=1"));
149
150 vbox->Add(new wxStaticText(this,-1, _("Variable for the x value")), wxSizerFlags());
151 m_x = new BTextCtrl(this,-1, config, "x");
152 vbox->Add(m_x, wxSizerFlags().Expand());
153
154 vbox->Add(new wxStaticText(this,-1, _("Start of the x value")), wxSizerFlags());
155 m_xStart = new BTextCtrl(this,-1, config, "-2");
156 vbox->Add(m_xStart, wxSizerFlags().Expand());
157
158 vbox->Add(new wxStaticText(this,-1, _("End of the x value")), wxSizerFlags());
159 m_xEnd = new BTextCtrl(this,-1, config, "2");
160 vbox->Add(m_xEnd, wxSizerFlags().Expand());
161
162 vbox->Add(new wxStaticText(this,-1, _("Variable for the y value")), wxSizerFlags());
163 m_y = new BTextCtrl(this,-1, config, "y");
164 vbox->Add(m_y, wxSizerFlags().Expand());
165
166 vbox->Add(new wxStaticText(this,-1, _("Start of the y value")), wxSizerFlags());
167 m_yStart = new BTextCtrl(this,-1, config, "-2");
168 vbox->Add(m_yStart, wxSizerFlags().Expand());
169
170 vbox->Add(new wxStaticText(this,-1, _("End of the y value")), wxSizerFlags());
171 m_yEnd = new BTextCtrl(this,-1, config, "2");
172 vbox->Add(m_yEnd, wxSizerFlags().Expand());
173
174 if(m_dimensions > 2)
175 {
176 SetName("DrawImplicitWiz3D");
177 vbox->Add(new wxStaticText(this,-1, _("Variable for the z value")), wxSizerFlags());
178 m_z = new BTextCtrl(this,-1, config, "z");
179 vbox->Add(m_z, wxSizerFlags().Expand());
180
181 vbox->Add(new wxStaticText(this,-1, _("Start of the z value")), wxSizerFlags());
182 m_zStart = new BTextCtrl(this,-1, config, "-2");
183 vbox->Add(m_zStart, wxSizerFlags().Expand());
184
185 vbox->Add(new wxStaticText(this,-1, _("End of the z value")), wxSizerFlags());
186 m_zEnd = new BTextCtrl(this,-1, config, "2");
187 vbox->Add(m_zEnd, wxSizerFlags().Expand());
188 }
189 else
190 SetName("DrawImplicitWiz2D");
191
192 wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
193 hbox->Add(
194 new SvgPanel(
195 this,
196 Draw_Implicit_svg_gz,Draw_Implicit_svg_gz_len),
197 wxSizerFlags(20).Border(wxALL,5).Center()
198 );
199 vbox->Add(
200 hbox,
201 wxSizerFlags(20).Expand()
202 );
203
204 wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
205 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"));
206 wxButton *cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
207 #if defined __WXMSW__
208 buttonSizer->Add(okButton);
209 buttonSizer->Add(cancelButton);
210 #else
211 buttonSizer->Add(cancelButton);
212 buttonSizer->Add(okButton);
213 #endif
214 okButton->SetDefault();
215 vbox->Add(buttonSizer, wxSizerFlags().Right());
216 m_expression ->SetValue(expression);
217 wxPersistenceManager::Get().RegisterAndRestore(this);
218 SetSizerAndFit(vbox);
219 }
220
GetValue()221 wxString ImplicitWiz::GetValue()
222 {
223 wxString retval;
224
225 retval += wxT("implicit(\n ") + m_expression->GetValue() + ",\n ";
226 retval += m_x->GetValue() + "," + m_xStart->GetValue() + "," + m_xEnd->GetValue();
227 retval += ",\n " + m_y->GetValue() + "," + m_yStart->GetValue() + "," +
228 m_yEnd->GetValue();
229 if(m_dimensions > 2)
230 retval += ",\n " + m_z->GetValue() + "," + m_zStart->GetValue() + "," +
231 m_zEnd->GetValue();
232 retval += "\n )";
233
234 return retval;
235 }
236
237
AxisWiz(wxWindow * parent,Configuration * config,int dimensions)238 AxisWiz::AxisWiz(wxWindow *parent, Configuration *config, int dimensions) :
239 wxDialog(parent, -1, _("Plot an explicit expression"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
240 {
241 m_dimensions = dimensions;
242 wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
243
244 vbox->Add(new wxStaticText(this, -1,
245 _("Setup the axis for the current plot.")),
246 wxSizerFlags().Expand().Border(wxBOTTOM,16));
247
248 vbox->Add(new wxStaticText(this,-1, _("x axis label")), wxSizerFlags());
249 m_xLabel = new BTextCtrl(this,-1, config, "");
250 vbox->Add(m_xLabel, wxSizerFlags().Expand());
251 vbox->Add(new wxStaticText(this,-1, _("x range (automatic if incomplete)")), wxSizerFlags());
252 wxBoxSizer *xrangeBox = new wxBoxSizer(wxHORIZONTAL);
253 m_xStart = new BTextCtrl(this,-1, config, "");
254 xrangeBox->Add(m_xStart, wxSizerFlags().Expand());
255 xrangeBox->Add(new wxStaticText(this,-1, _("-")), wxSizerFlags());
256 m_xEnd = new BTextCtrl(this,-1, config, "");
257 xrangeBox->Add(m_xEnd, wxSizerFlags().Expand());
258 vbox->Add(xrangeBox, wxSizerFlags().Expand());
259
260 vbox->Add(new wxStaticText(this,-1, _("y axis label")), wxSizerFlags());
261 m_yLabel = new BTextCtrl(this,-1, config, "");
262 vbox->Add(m_yLabel, wxSizerFlags().Expand());
263 vbox->Add(new wxStaticText(this,-1, _("y range (automatic if incomplete)")), wxSizerFlags());
264 wxBoxSizer *yrangeBox = new wxBoxSizer(wxHORIZONTAL);
265 m_yStart = new BTextCtrl(this,-1, config, "");
266 yrangeBox->Add(m_yStart, wxSizerFlags().Expand());
267 yrangeBox->Add(new wxStaticText(this,-1, _("-")), wxSizerFlags());
268 m_yEnd = new BTextCtrl(this,-1, config, "");
269 yrangeBox->Add(m_yEnd, wxSizerFlags().Expand());
270 vbox->Add(yrangeBox, wxSizerFlags().Expand());
271
272 if(dimensions > 2)
273 {
274 SetName("DrawAxisWiz3D");
275 vbox->Add(new wxStaticText(this,-1, _("z axis label")), wxSizerFlags());
276 m_zLabel = new BTextCtrl(this,-1, config, "");
277 vbox->Add(m_zLabel, wxSizerFlags().Expand());
278 vbox->Add(new wxStaticText(this,-1, _("z range (automatic if incomplete)")), wxSizerFlags());
279 wxBoxSizer *zrangeBox = new wxBoxSizer(wxHORIZONTAL);
280 m_zStart = new BTextCtrl(this,-1, config, "");
281 zrangeBox->Add(m_zStart, wxSizerFlags().Expand());
282 zrangeBox->Add(new wxStaticText(this,-1, _("-")), wxSizerFlags());
283 m_zEnd = new BTextCtrl(this,-1, config, "");
284 zrangeBox->Add(m_zEnd, wxSizerFlags().Expand());
285 vbox->Add(zrangeBox, wxSizerFlags().Expand());
286 }
287 else
288 SetName("DrawAxisWiz2D");
289
290 vbox->Add(new wxStaticText(this,-1, _("secondary x axis label")), wxSizerFlags());
291 m_x2Label = new BTextCtrl(this,-1, config, "");
292 vbox->Add(m_x2Label, wxSizerFlags().Expand());
293 vbox->Add(new wxStaticText(this,-1, _("secondary x range (automatic if incomplete)")), wxSizerFlags());
294 wxBoxSizer *x2rangeBox = new wxBoxSizer(wxHORIZONTAL);
295 m_x2Start = new BTextCtrl(this,-1, config, "");
296 x2rangeBox->Add(m_x2Start, wxSizerFlags().Expand());
297 x2rangeBox->Add(new wxStaticText(this,-1, _("-")), wxSizerFlags());
298 m_x2End = new BTextCtrl(this,-1, config, "");
299 x2rangeBox->Add(m_x2End, wxSizerFlags().Expand());
300 vbox->Add(x2rangeBox, wxSizerFlags().Expand());
301
302 vbox->Add(new wxStaticText(this,-1, _("secondary y axis label")), wxSizerFlags());
303 m_y2Label = new BTextCtrl(this,-1, config, "");
304 vbox->Add(m_y2Label, wxSizerFlags().Expand());
305 vbox->Add(new wxStaticText(this,-1, _("secondary y range (automatic if incomplete)")), wxSizerFlags());
306 wxBoxSizer *y2rangeBox = new wxBoxSizer(wxHORIZONTAL);
307 m_y2Start = new BTextCtrl(this,-1, config, "");
308 y2rangeBox->Add(m_y2Start, wxSizerFlags().Expand());
309 y2rangeBox->Add(new wxStaticText(this,-1, _("-")), wxSizerFlags());
310 m_y2End = new BTextCtrl(this,-1, config, "");
311 y2rangeBox->Add(m_y2End, wxSizerFlags().Expand());
312 vbox->Add(y2rangeBox, wxSizerFlags().Expand());
313
314 m_useSecondaryX = new wxCheckBox(this, -1, _("Following plots use secondary x axis"),
315 wxDefaultPosition, wxDefaultSize, wxCHK_3STATE);
316 m_useSecondaryX -> Set3StateValue(wxCHK_UNDETERMINED);
317 vbox->Add(m_useSecondaryX, wxSizerFlags().Expand());
318
319 m_useSecondaryY = new wxCheckBox(this, -1, _("Following plots use secondary y axis"),
320 wxDefaultPosition, wxDefaultSize, wxCHK_3STATE);
321 m_useSecondaryY -> Set3StateValue(wxCHK_UNDETERMINED);
322 vbox->Add(m_useSecondaryY, wxSizerFlags().Expand());
323
324 wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
325 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"));
326 wxButton *cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
327 #if defined __WXMSW__
328 buttonSizer->Add(okButton);
329 buttonSizer->Add(cancelButton);
330 #else
331 buttonSizer->Add(cancelButton);
332 buttonSizer->Add(okButton);
333 #endif
334 okButton->SetDefault();
335 vbox->Add(buttonSizer, wxSizerFlags().Right());
336 wxPersistenceManager::Get().RegisterAndRestore(this);
337 SetSizerAndFit(vbox);
338 }
339
GetValue()340 wxString AxisWiz::GetValue()
341 {
342 wxString retval;
343 if(m_xLabel->GetValue() != wxEmptyString)
344 {
345 retval = "xlabel=\"" + m_xLabel->GetValue() + "\"";
346 }
347 if(m_yLabel->GetValue() != wxEmptyString)
348 {
349 if(retval != wxEmptyString)
350 retval += ",\n";
351 retval += "ylabel=\"" + m_yLabel->GetValue() + "\"";
352 }
353 if((m_dimensions == 3) && (m_zLabel->GetValue() != wxEmptyString))
354 {
355 if(retval != wxEmptyString)
356 retval += ",\n";
357 retval += "zlabel=\"" + m_zLabel->GetValue() + "\"";
358 }
359
360 if(m_x2Label->GetValue() != wxEmptyString)
361 {
362 if(retval != wxEmptyString)
363 retval += ",\n";
364 retval += "xlabel_secondary=\"" + m_x2Label->GetValue() + "\"";
365 }
366 if(m_y2Label->GetValue() != wxEmptyString)
367 {
368 if(retval != wxEmptyString)
369 retval += ",\n";
370 retval += "ylabel_secondary=\"" + m_y2Label->GetValue() + "\"";
371 }
372
373 if((m_xStart->GetValue() != wxEmptyString) && (m_xEnd->GetValue() != wxEmptyString))
374 {
375 if(retval != wxEmptyString)
376 retval += ",\n";
377 retval += "xrange=[" + m_xStart->GetValue() + "," + m_xEnd->GetValue() + "]";
378 }
379 if((m_yStart->GetValue() != wxEmptyString) && (m_yEnd->GetValue() != wxEmptyString))
380 {
381 if(retval != wxEmptyString)
382 retval += ",\n";
383 retval += "yrange=[" + m_yStart->GetValue() + "," + m_yEnd->GetValue() + "]";
384 }
385 if((m_dimensions == 3) && (m_zStart->GetValue() != wxEmptyString) && (m_zEnd->GetValue() != wxEmptyString))
386 {
387 if(retval != wxEmptyString)
388 retval += ",\n";
389 retval += "zrange=[" + m_zStart->GetValue() + "," + m_zEnd->GetValue() + "]";
390 }
391
392 if((m_x2Start->GetValue() != wxEmptyString) && (m_x2End->GetValue() != wxEmptyString))
393 {
394 if(retval != wxEmptyString)
395 retval += ",\n";
396 retval += "xrange_secondary=[" + m_x2Start->GetValue() + "," + m_x2End->GetValue() + "]";
397 }
398 if((m_y2Start->GetValue() != wxEmptyString) && (m_y2End->GetValue() != wxEmptyString))
399 {
400 if(retval != wxEmptyString)
401 retval += ",\n";
402 retval += "yrange_secondary=[" + m_y2Start->GetValue() + "," + m_y2End->GetValue() + "]";
403 }
404
405 if(m_useSecondaryX->Get3StateValue() == wxCHK_CHECKED)
406 {
407 if(retval != wxEmptyString)
408 retval += ",\n";
409 retval += "xaxis_secondary=true";
410 }
411 if(m_useSecondaryX->Get3StateValue() == wxCHK_UNCHECKED)
412 {
413 if(retval != wxEmptyString)
414 retval += ",\n";
415 retval += "xaxis_secondary=false";
416 }
417
418 if(m_useSecondaryY->Get3StateValue() == wxCHK_CHECKED)
419 {
420 if(retval != wxEmptyString)
421 retval += ",\n";
422 retval += "yaxis_secondary=true";
423 }
424 if(m_useSecondaryY->Get3StateValue() == wxCHK_UNCHECKED)
425 {
426 if(retval != wxEmptyString)
427 retval += ",\n";
428 retval += "yaxis_secondary=false";
429 }
430
431 return retval;
432 }
433
OnParametricFocus(wxFocusEvent & WXUNUSED (event))434 void DrawWiz::OnParametricFocus(wxFocusEvent &WXUNUSED(event))
435 {
436 m_multipleFrames->SetValue(true);
437 }
438
DrawWiz(wxWindow * parent,Configuration * config,int dimensions)439 DrawWiz::DrawWiz(wxWindow *parent, Configuration *config, int dimensions) :
440 wxDialog(parent, -1, wxString::Format(_("Setup a %iD scene"),dimensions), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
441 {
442 m_dimensions = dimensions;
443 wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
444
445 vbox->Add(new wxStaticText(this, -1,
446 wxString::Format(
447 _("This wizard setups a %iD scene."), dimensions)));
448
449 vbox->Add(new wxStaticText(this, -1,
450 wxString::Format(
451 _("It needs to be filled with objects to draw afterwards."))),
452 wxSizerFlags().Border(wxBOTTOM,16));
453 m_singleFrame = new wxRadioButton(this, -1, _("A static plot"), wxDefaultPosition,
454 wxDefaultSize, wxRB_GROUP);
455 vbox->Add(m_singleFrame, wxSizerFlags().Expand().Border(wxALL,5));
456
457 m_multipleFrames = new wxRadioButton(this, -1, _("An animation with multiple frames"));
458 vbox->Add(m_multipleFrames, wxSizerFlags().Expand().Border(wxALL,5));
459 wxPanel *animPanel = new wxPanel(this,-1);
460 wxBoxSizer *animPanelVbox = new wxBoxSizer(wxVERTICAL);
461 animPanelVbox->Add(new wxStaticText(animPanel,-1, _("Frame counter")), wxSizerFlags());
462 m_frameVar = new BTextCtrl(animPanel, -1, config, "t");
463 m_frameVar->Connect(wxEVT_SET_FOCUS,
464 wxFocusEventHandler(DrawWiz::OnParametricFocus),
465 NULL, this);
466
467 animPanelVbox->Add(m_frameVar, wxSizerFlags().Expand().Border(wxALL,5));
468 animPanelVbox->Add(new wxStaticText(animPanel,-1, _("Frame counter start")), wxSizerFlags());
469 m_varStart = new BTextCtrl(animPanel,-1, config, "1");
470 m_varStart->Connect(wxEVT_SET_FOCUS,
471 wxFocusEventHandler(DrawWiz::OnParametricFocus),
472 NULL, this);
473 animPanelVbox->Add(m_varStart, wxSizerFlags().Expand().Border(wxALL,5));
474 animPanelVbox->Add(new wxStaticText(animPanel,-1, _("Frame counter end")), wxSizerFlags());
475 m_varEnd = new BTextCtrl(animPanel,-1, config, "10");
476 m_varEnd->Connect(wxEVT_SET_FOCUS,
477 wxFocusEventHandler(DrawWiz::OnParametricFocus),
478 NULL, this);
479 animPanelVbox->Add(m_varEnd, wxSizerFlags().Expand().Border(wxALL,5));
480 animPanel->SetSizerAndFit(animPanelVbox);
481 vbox->Add(animPanel, wxSizerFlags().Expand().Border(wxALL,5));
482
483 wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
484 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"));
485 wxButton *cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
486 #if defined __WXMSW__
487 buttonSizer->Add(okButton);
488 buttonSizer->Add(cancelButton);
489 #else
490 buttonSizer->Add(cancelButton);
491 buttonSizer->Add(okButton);
492 #endif
493 okButton->SetDefault();
494 vbox->Add(buttonSizer, wxSizerFlags().Right());
495
496 SetName(wxString::Format("Draw_%idWiz", dimensions));
497 wxPersistenceManager::Get().RegisterAndRestore(this);
498 SetSizerAndFit(vbox);
499 }
500
GetValue()501 wxString DrawWiz::GetValue()
502 {
503 if(m_dimensions < 3)
504 {
505 if(m_singleFrame->GetValue())
506 return wxT("wxdraw2d(\n)$");
507 else
508 {
509 return wxString("with_slider_draw(\n") + m_frameVar->GetValue() + ",makelist(i,i," +
510 m_varStart->GetValue() + "," + m_varEnd->GetValue() + ")\n)$";
511 }
512 }
513 else
514 {
515 if(m_singleFrame->GetValue())
516 return wxT("wxdraw3d(\n)$");
517 else
518 {
519 return wxString("with_slider_draw3d(\n") + m_frameVar->GetValue() + ",makelist(i,i," +
520 m_varStart->GetValue() + "," + m_varEnd->GetValue() + ")\n)$";
521 }
522 }
523 }
524
525
Wiz3D(wxWindow * parent,Configuration * WXUNUSED (config))526 Wiz3D::Wiz3D(wxWindow *parent, Configuration *WXUNUSED(config)) :
527 wxDialog(parent, -1, _("Settings for the following 3d plots"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
528 {
529 wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
530
531 vbox->Add(new wxStaticText(this, -1,
532 _("Enhanced 3D settings:")),
533 wxSizerFlags().Expand().Border(wxBOTTOM,16));
534
535 m_hidden3d = new wxCheckBox(this, -1, _("Hide objects behind the surface"),
536 wxDefaultPosition, wxDefaultSize, wxCHK_3STATE);
537 m_hidden3d -> Set3StateValue(wxCHK_UNDETERMINED);
538 vbox->Add(m_hidden3d, wxSizerFlags().Expand());
539
540 m_enhanced3d = new wxCheckBox(this, -1, _("Take surface color from steepness"),
541 wxDefaultPosition, wxDefaultSize, wxCHK_3STATE);
542 m_enhanced3d -> Set3StateValue(wxCHK_UNDETERMINED);
543 vbox->Add(m_enhanced3d, wxSizerFlags().Expand());
544
545 wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
546 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"));
547 wxButton *cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
548 #if defined __WXMSW__
549 buttonSizer->Add(okButton);
550 buttonSizer->Add(cancelButton);
551 #else
552 buttonSizer->Add(cancelButton);
553 buttonSizer->Add(okButton);
554 #endif
555 okButton->SetDefault();
556 vbox->Add(buttonSizer, wxSizerFlags().Right());
557
558 SetName("Draw_Wiz3D");
559 wxPersistenceManager::Get().RegisterAndRestore(this);
560 SetSizerAndFit(vbox);
561 }
562
GetValue()563 wxString Wiz3D::GetValue()
564 {
565 wxString retval;
566 if(m_hidden3d->Get3StateValue() == wxCHK_CHECKED)
567 {
568 if(retval != wxEmptyString)
569 retval += ",\n";
570 retval += "surface_hide=true";
571 }
572 if(m_hidden3d->Get3StateValue() == wxCHK_UNCHECKED)
573 {
574 if(retval != wxEmptyString)
575 retval += ",\n";
576 retval += "surface_hide=false";
577 }
578 if(m_enhanced3d->Get3StateValue() == wxCHK_CHECKED)
579 {
580 if(retval != wxEmptyString)
581 retval += ",\n";
582 retval += "enhanced3d=true";
583 }
584 if(m_enhanced3d->Get3StateValue() == wxCHK_UNCHECKED)
585 {
586 if(retval != wxEmptyString)
587 retval += ",\n";
588 retval += "enhanced3d=false";
589 }
590 return retval;
591 }
592
OnRadioButton(wxCommandEvent & WXUNUSED (dummy))593 void WizContour::OnRadioButton(wxCommandEvent& WXUNUSED(dummy))
594 {
595 if(m_contourNone->GetValue())
596 {
597 m_image->Load(Draw_ContourNone_svg_gz, Draw_ContourNone_svg_gz_len);
598 }
599 if(m_contourBase->GetValue())
600 {
601 m_image->Load(Draw_ContourBase_svg_gz, Draw_ContourBase_svg_gz_len);
602 }
603 if(m_contourBoth->GetValue())
604 {
605 m_image->Load(Draw_ContourBoth_svg_gz, Draw_ContourBoth_svg_gz_len);
606 }
607 if(m_contourSurface->GetValue())
608 {
609 m_image->Load(Draw_ContourSurface_svg_gz, Draw_ContourSurface_svg_gz_len);
610 }
611 if(m_contourOnly->GetValue())
612 {
613 m_image->Load(Draw_ContourMap_svg_gz, Draw_ContourMap_svg_gz_len);
614 }
615 }
616
WizContour(wxWindow * parent,Configuration * WXUNUSED (config))617 WizContour::WizContour(wxWindow *parent, Configuration *WXUNUSED(config)) :
618 wxDialog(parent, -1, _("Contour lines settings for the following 3d plots"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
619 {
620 wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
621
622 m_contourNone = new wxRadioButton(this, -1, _("No contour lines"), wxDefaultPosition,
623 wxDefaultSize, wxRB_GROUP);
624 m_contourNone->Connect(
625 wxEVT_RADIOBUTTON,
626 wxCommandEventHandler(WizContour::OnRadioButton),
627 NULL, this
628 );
629 vbox->Add(m_contourNone, wxSizerFlags().Expand());
630 m_contourSurface = new wxRadioButton(this, -1, _("Contour lines on the Surface"));
631 m_contourSurface->Connect(
632 wxEVT_RADIOBUTTON,
633 wxCommandEventHandler(WizContour::OnRadioButton),
634 NULL, this
635 );
636 vbox->Add(m_contourSurface, wxSizerFlags().Expand());
637 m_contourBase = new wxRadioButton(this, -1, _("Contour lines on the Bottom"));
638 m_contourBase->Connect(
639 wxEVT_RADIOBUTTON,
640 wxCommandEventHandler(WizContour::OnRadioButton),
641 NULL, this
642 );
643 vbox->Add(m_contourBase, wxSizerFlags().Expand());
644 m_contourBoth = new wxRadioButton(this, -1, _("Contour lines on surface and Bottom"));
645 m_contourBoth->Connect(
646 wxEVT_RADIOBUTTON,
647 wxCommandEventHandler(WizContour::OnRadioButton),
648 NULL, this
649 );
650 vbox->Add(m_contourBoth, wxSizerFlags().Expand());
651 m_contourOnly = new wxRadioButton(this, -1, _("No plot, only contour lines"));
652 m_contourOnly->Connect(
653 wxEVT_RADIOBUTTON,
654 wxCommandEventHandler(WizContour::OnRadioButton),
655 NULL, this
656 );
657 vbox->Add(m_contourOnly, wxSizerFlags().Expand());
658
659 m_contourBoth->SetValue(true);
660
661 wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
662 hbox->Add(
663 m_image = new SvgPanel(
664 this,
665 Draw_ContourBoth_svg_gz,Draw_ContourBoth_svg_gz_len),
666 wxSizerFlags(20).Border(wxALL,5).Center()
667 );
668 vbox->Add(
669 hbox,
670 wxSizerFlags(20).Expand()
671 );
672
673
674 wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
675 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"));
676 wxButton *cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
677 #if defined __WXMSW__
678 buttonSizer->Add(okButton);
679 buttonSizer->Add(cancelButton);
680 #else
681 buttonSizer->Add(cancelButton);
682 buttonSizer->Add(okButton);
683 #endif
684 okButton->SetDefault();
685 vbox->Add(buttonSizer, wxSizerFlags().Right());
686
687 SetName("Draw_ContourWiz");
688 wxPersistenceManager::Get().RegisterAndRestore(this);
689 SetSizerAndFit(vbox);
690 }
691
GetValue()692 wxString WizContour::GetValue()
693 {
694 wxString retval;
695 if(m_contourNone->GetValue())
696 {
697 if(retval != wxEmptyString)
698 retval += ",\n";
699 retval += "contour='none";
700 }
701 if(m_contourBase->GetValue())
702 {
703 if(retval != wxEmptyString)
704 retval += ",\n";
705 retval += "contour='base";
706 }
707 if(m_contourBoth->GetValue())
708 {
709 if(retval != wxEmptyString)
710 retval += ",\n";
711 retval += "contour='both";
712 }
713 if(m_contourSurface->GetValue())
714 {
715 if(retval != wxEmptyString)
716 retval += ",\n";
717 retval += "contour='surface";
718 }
719 if(m_contourOnly->GetValue())
720 {
721 if(retval != wxEmptyString)
722 retval += ",\n";
723 retval += "contour='map";
724 }
725 return retval;
726 }
727
ParametricWiz(wxWindow * parent,Configuration * config,int dimensions)728 ParametricWiz::ParametricWiz(wxWindow *parent, Configuration *config, int dimensions) :
729 wxDialog(parent, -1, _("Plot a parametric curve"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
730 {
731 m_dimensions = dimensions;
732 wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
733
734 vbox->Add(new wxStaticText(this, -1,
735 _("Allows to provide separate expressions for calculating")),
736 wxSizerFlags().Expand());
737 if(dimensions < 3)
738 vbox->Add(new wxStaticText(this, -1,
739 _("the x and the y coordinate.")),
740 wxSizerFlags().Expand().Border(wxBOTTOM,16));
741 else
742 vbox->Add(new wxStaticText(this, -1,
743 _("the x, the y and the z coordinate.")),
744 wxSizerFlags().Expand().Border(wxBOTTOM,16));
745
746 vbox->Add(new wxStaticText(this,-1, _("Expression that calculates the x value")), wxSizerFlags());
747 m_expression_x = new BTextCtrl(this,-1, config, "");
748 vbox->Add(m_expression_x, wxSizerFlags().Expand());
749 vbox->Add(new wxStaticText(this,-1, _("Expression that calculates the y value")), wxSizerFlags());
750 m_expression_y = new BTextCtrl(this,-1, config, "");
751 vbox->Add(m_expression_y, wxSizerFlags().Expand());
752 if(dimensions > 2)
753 {
754 vbox->Add(new wxStaticText(this,-1, _("Expression that calculates the z value")), wxSizerFlags());
755 m_expression_z = new BTextCtrl(this,-1, config, "");
756 vbox->Add(m_expression_z, wxSizerFlags().Expand());
757 }
758
759 vbox->Add(new wxStaticText(this,-1, _("Name of the parameter")), wxSizerFlags());
760 vbox->Add(m_parameter = new BTextCtrl(this,-1, config, "t"), wxSizerFlags().Expand());
761
762 vbox->Add(new wxStaticText(this,-1, _("Start value of the parameter")), wxSizerFlags());
763 vbox->Add(m_parameterStart = new BTextCtrl(this,-1, config, "-2"), wxSizerFlags().Expand());
764
765 vbox->Add(new wxStaticText(this,-1, _("End value of the parameter")), wxSizerFlags());
766 vbox->Add(m_parameterEnd = new BTextCtrl(this,-1, config, "2"), wxSizerFlags().Expand());
767
768 wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
769 hbox->Add(
770 new SvgPanel(
771 this,
772 Draw_Parametric_svg_gz,Draw_Parametric_svg_gz_len),
773 wxSizerFlags(20).Border(wxALL,5).Center()
774 );
775 vbox->Add(
776 hbox,
777 wxSizerFlags(20).Expand()
778 );
779
780 wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
781 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"));
782 wxButton *cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
783 #if defined __WXMSW__
784 buttonSizer->Add(okButton);
785 buttonSizer->Add(cancelButton);
786 #else
787 buttonSizer->Add(cancelButton);
788 buttonSizer->Add(okButton);
789 #endif
790 okButton->SetDefault();
791 vbox->Add(buttonSizer, wxSizerFlags().Right());
792 SetName("Draw_%idParametricWiz");
793 wxPersistenceManager::Get().RegisterAndRestore(this);
794 SetSizerAndFit(vbox);
795 }
796
GetValue()797 wxString ParametricWiz::GetValue()
798 {
799 wxString retval;
800 retval += wxT("parametric(\n ") + m_expression_x->GetValue() + ",\n ";
801 retval += m_expression_y->GetValue() + ",\n ";
802 if(m_dimensions > 2)
803 retval += m_expression_z->GetValue() + ",\n ";
804 retval += m_parameter->GetValue() + ",";
805 retval += m_parameterStart->GetValue() + ",";
806 retval += m_parameterEnd->GetValue() + "\n)";
807 return retval;
808 }
809
WizPoints(wxWindow * parent,Configuration * config,int dimensions,wxString expr)810 WizPoints::WizPoints(wxWindow *parent, Configuration *config, int dimensions, wxString expr) :
811 wxDialog(parent,-1, _("Draw points"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
812 {
813 m_dimensions = dimensions;
814 wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
815 vbox->Add(m_data = new BTextCtrl(this,-1, config, expr), wxSizerFlags().Expand());
816
817 wxStaticBox *formatBox = new wxStaticBox(this,-1,_("Data format"));
818 wxStaticBoxSizer *formatSizer = new wxStaticBoxSizer(formatBox, wxVERTICAL);
819 m_formatStd = new wxRadioButton(formatBox, -1,
820 _("[x_1, x_2,...] or [x_1, x_2,...],[y_1, y_2,...] or matrix([x_1,y_1],[x_2,y_2],...)"), wxDefaultPosition,
821 wxDefaultSize, wxRB_GROUP);
822 formatSizer->Add(m_formatStd, wxSizerFlags().Expand());
823 m_formatListOfLists = new wxRadioButton(formatBox, -1,
824 _("[[x_1,x_2,...],[y_1,y_2,...]]"));
825 formatSizer->Add(m_formatListOfLists, wxSizerFlags().Expand());
826 m_transposedMatrix = new wxRadioButton(formatBox, -1,
827 _("matrix([x_1,x_2,...],[y_1,y_2,...])"));
828 formatSizer->Add(m_transposedMatrix, wxSizerFlags().Expand());
829 m_transposedListOfLists = new wxRadioButton(formatBox, -1,
830 _("[[x_1,x_2,...],[y_1,y_2,...]]"));
831 formatSizer->Add(m_transposedListOfLists, wxSizerFlags().Expand());
832 vbox->Add(formatSizer, wxSizerFlags().Expand());
833 m_pointsJoined = new wxCheckBox(this, -1, _("Connect the dots"),
834 wxDefaultPosition, wxDefaultSize, wxCHK_3STATE);
835 m_pointsJoined -> Set3StateValue(wxCHK_UNDETERMINED);
836 vbox->Add(m_pointsJoined, wxSizerFlags().Expand());
837
838 wxBoxSizer *pointTypeSizer = new wxBoxSizer(wxHORIZONTAL);
839 wxArrayString pointTypes;
840 pointTypes.Add(_("Reuse last"));
841 pointTypes.Add(_("No points"));
842 for (int i=0; i<15;i++)
843 pointTypes.Add(wxString::Format("%i",i));
844 m_pointStyle = new wxChoice(this, -1, wxDefaultPosition, wxDefaultSize, pointTypes);
845 pointTypeSizer->Add(new wxStaticText(this,-1,_("Point type:")), wxSizerFlags().Expand());
846 pointTypeSizer->Add(m_pointStyle, wxSizerFlags().Expand());
847 vbox->Add(pointTypeSizer, wxSizerFlags().Expand());
848
849 wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
850 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"));
851 wxButton *cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
852 #if defined __WXMSW__
853 buttonSizer->Add(okButton);
854 buttonSizer->Add(cancelButton);
855 #else
856 buttonSizer->Add(cancelButton);
857 buttonSizer->Add(okButton);
858 #endif
859 okButton->SetDefault();
860 vbox->Add(buttonSizer, wxSizerFlags().Right());
861 SetName(wxString::Format("Draw_%idPointWiz", dimensions));
862 m_data->SetValue(expr);
863 wxPersistenceManager::Get().RegisterAndRestore(this);
864 SetSizerAndFit(vbox);
865 }
866
GetValue()867 wxString WizPoints::GetValue()
868 {
869 wxString retval;
870 if(m_pointStyle->GetSelection() > 0)
871 {
872 if(m_pointStyle->GetSelection() == 1)
873 {
874 if(retval != wxEmptyString)
875 retval += ",\n";
876 retval += "point_type='none";
877 }
878 else
879 {
880 if(retval != wxEmptyString)
881 retval += ",\n";
882 retval += "point_type=" + m_pointStyle->GetStringSelection();
883 }
884 }
885 if(m_pointsJoined->Get3StateValue() == wxCHK_UNCHECKED)
886 {
887 if(retval != wxEmptyString)
888 retval += ",\n";
889 retval += "points_joined=false";
890 }
891 if(m_pointsJoined->Get3StateValue() == wxCHK_CHECKED)
892 {
893 if(retval != wxEmptyString)
894 retval += ",\n";
895 retval += "points_joined=true";
896 }
897
898 wxString data = m_data->GetValue();
899 if(data != wxEmptyString)
900 {
901 if(m_formatStd->GetValue())
902 {
903 if(retval != wxEmptyString)
904 retval += ",\n";
905 retval += "points(" + data +")";
906 }
907 if(m_formatListOfLists->GetValue())
908 {
909 if(retval != wxEmptyString)
910 retval += ",\n";
911 retval += "apply('points," + data +")";
912 }
913 if(m_transposedMatrix->GetValue())
914 {
915 if(retval != wxEmptyString)
916 retval += ",\n";
917 retval += "points(transpose(" + data +"))";
918 }
919 if(m_transposedListOfLists->GetValue())
920 {
921 if(retval != wxEmptyString)
922 retval += ",\n";
923 retval += "points(transpose(apply('matrix," + data +")))";
924 }
925 }
926 return retval;
927 }
928
929
930 //! A wizard that sets the draw accuracy
WizDrawAccuracy(wxWindow * parent,Configuration * config,int dimensions)931 WizDrawAccuracy::WizDrawAccuracy(wxWindow *parent, Configuration *config, int dimensions) :
932 wxDialog(parent,-1, _("Speed versus accuracy"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
933 {
934 m_dimensions = dimensions;
935 wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
936 vbox->Add(new wxStaticText(this,-1, _("Samples on a line:")), wxSizerFlags());
937 wxBoxSizer *nticksBox = new wxBoxSizer(wxHORIZONTAL);
938 nticksBox->Add(m_nticks = new BTextCtrl(this, -1, config, wxT("")), wxSizerFlags().Expand());
939 nticksBox->Add(new wxStaticText(this,-1, _(" samples, on demand split ")), wxSizerFlags());
940 nticksBox->Add(m_adapt_depth = new BTextCtrl(this, -1, config, wxT("")), wxSizerFlags().Expand());
941 nticksBox->Add(new wxStaticText(this,-1, _(" times")), wxSizerFlags());
942 vbox->Add(nticksBox, wxSizerFlags().Expand());
943
944 if(dimensions < 3)
945 {
946 vbox->Add(new wxStaticText(this,-1, _("Samples for implicit plots:")), wxSizerFlags());
947 wxBoxSizer *ipGridBox = new wxBoxSizer(wxHORIZONTAL);
948 ipGridBox->Add(m_ip_grid_x = new BTextCtrl(this,-1, config, wxT("")), wxSizerFlags().Expand());
949 ipGridBox->Add(new wxStaticText(this,-1, _("X")), wxSizerFlags());
950 ipGridBox->Add(m_ip_grid_y = new BTextCtrl(this,-1, config, wxT("")), wxSizerFlags().Expand());
951 ipGridBox->Add(new wxStaticText(this,-1, _(" samples, on demand split ")), wxSizerFlags());
952 ipGridBox->Add(m_ip_grid_in_x = new BTextCtrl(this,-1, config, wxT("")), wxSizerFlags().Expand());
953 ipGridBox->Add(new wxStaticText(this,-1, _("X")), wxSizerFlags());
954 ipGridBox->Add(m_ip_grid_in_y = new BTextCtrl(this,-1, config, wxT("")), wxSizerFlags().Expand());
955 ipGridBox->Add(new wxStaticText(this,-1, _(" times")), wxSizerFlags());
956 vbox->Add(ipGridBox, wxSizerFlags().Expand());
957 }
958 else
959 {
960 vbox->Add(new wxStaticText(this,-1, _("Samples for explicit and parametric plots:")), wxSizerFlags());
961 wxBoxSizer *exp3dGridBox = new wxBoxSizer(wxHORIZONTAL);
962 exp3dGridBox->Add(m_xu_grid = new BTextCtrl(this,-1, config, wxT("")), wxSizerFlags().Expand());
963 exp3dGridBox->Add(new wxStaticText(this,-1, _("X")), wxSizerFlags());
964 exp3dGridBox->Add(m_yv_grid = new BTextCtrl(this,-1, config, wxT("")), wxSizerFlags().Expand());
965 exp3dGridBox->Add(new wxStaticText(this,-1, _(" samples")), wxSizerFlags());
966 vbox->Add(exp3dGridBox, wxSizerFlags().Expand());
967
968 vbox->Add(new wxStaticText(this,-1, _("Samples for implicit plots and regions:")), wxSizerFlags());
969 wxBoxSizer *regionGridBox = new wxBoxSizer(wxHORIZONTAL);
970 regionGridBox->Add(m_x_voxel = new BTextCtrl(this,-1, config, wxT("")), wxSizerFlags().Expand());
971 regionGridBox->Add(new wxStaticText(this,-1, _("X")), wxSizerFlags());
972 regionGridBox->Add(m_y_voxel = new BTextCtrl(this,-1, config, wxT("")), wxSizerFlags().Expand());
973 regionGridBox->Add(new wxStaticText(this,-1, _("X")), wxSizerFlags());
974 regionGridBox->Add(m_z_voxel = new BTextCtrl(this,-1, config, wxT("")), wxSizerFlags().Expand());
975 regionGridBox->Add(new wxStaticText(this,-1, _(" samples")), wxSizerFlags());
976 vbox->Add(regionGridBox, wxSizerFlags().Expand());
977 }
978
979 wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
980 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"));
981 wxButton *cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
982
983 #if defined __WXMSW__
984 buttonSizer->Add(okButton);
985 buttonSizer->Add(cancelButton);
986 #else
987 buttonSizer->Add(cancelButton);
988 buttonSizer->Add(okButton);
989 #endif
990 okButton->SetDefault();
991 vbox->Add(buttonSizer, wxSizerFlags().Right());
992 SetName(wxString::Format("Draw_Accuracy%idWiz", dimensions));
993 wxPersistenceManager::Get().RegisterAndRestore(this);
994 SetSizerAndFit(vbox);
995 }
996
GetValue()997 wxString WizDrawAccuracy::GetValue()
998 {
999 wxString retval;
1000 if(m_nticks->GetValue() != wxEmptyString)
1001 {
1002 if(retval != wxEmptyString)
1003 retval += ",\n";
1004 retval += "nticks=" + m_nticks->GetValue();
1005 }
1006
1007 if(m_adapt_depth->GetValue() != wxEmptyString)
1008 {
1009 if(retval != wxEmptyString)
1010 retval += ",\n";
1011 retval += "adapt_depth=" + m_adapt_depth->GetValue();
1012 }
1013
1014 if(m_dimensions < 3)
1015 {
1016 if((m_ip_grid_x->GetValue() != wxEmptyString) && (m_ip_grid_y->GetValue() != wxEmptyString))
1017 {
1018 if(retval != wxEmptyString)
1019 retval += ",\n";
1020 retval += "ip_grid=[" + m_ip_grid_x->GetValue() + "," + m_ip_grid_y->GetValue()+"]";
1021 }
1022 if((!m_ip_grid_in_x->GetValue().IsEmpty()) && (!m_ip_grid_in_y->GetValue().IsEmpty()))
1023 {
1024 if(!retval.IsEmpty())
1025 retval += ",\n";
1026 retval += "ip_grid_in=[" + m_ip_grid_in_x->GetValue() + "," + m_ip_grid_in_y->GetValue()+"]";
1027 }
1028 }
1029 else
1030 {
1031 if(m_xu_grid->GetValue() != wxEmptyString)
1032 {
1033 if(retval != wxEmptyString)
1034 retval += ",\n";
1035 retval += "xu_grid=" + m_xu_grid->GetValue();
1036 }
1037 if(m_yv_grid->GetValue() != wxEmptyString)
1038 {
1039 if(retval != wxEmptyString)
1040 retval += ",\n";
1041 retval += "yv_grid=" + m_yv_grid->GetValue();
1042 }
1043
1044 if(m_x_voxel->GetValue() != wxEmptyString)
1045 {
1046 if(retval != wxEmptyString)
1047 retval += ",\n";
1048 retval += "x_voxel=" + m_x_voxel->GetValue();
1049 }
1050 if(m_y_voxel->GetValue() != wxEmptyString)
1051 {
1052 if(retval != wxEmptyString)
1053 retval += ",\n";
1054 retval += "y_voxel=" + m_y_voxel->GetValue();
1055 }
1056 if(m_z_voxel->GetValue() != wxEmptyString)
1057 {
1058 if(retval != wxEmptyString)
1059 retval += ",\n";
1060 retval += "z_voxel=" + m_z_voxel->GetValue();
1061 }
1062 }
1063 return retval;
1064 }
1065
1066