1 | /* printwx.c */ |
---|
2 | /* Device dependent part of Survex wxWidgets driver */ |
---|
3 | /* Copyright (C) 1993-2003,2004,2005 Olly Betts |
---|
4 | * Copyright (C) 2001,2004 Philip Underwood |
---|
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 | * You should have received a copy of the GNU General Public License |
---|
17 | * along with this program; if not, write to the Free Software |
---|
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
19 | */ |
---|
20 | |
---|
21 | #ifdef HAVE_CONFIG_H |
---|
22 | # include <config.h> |
---|
23 | #endif |
---|
24 | |
---|
25 | #include <stdio.h> |
---|
26 | #include <stdlib.h> |
---|
27 | #include <math.h> |
---|
28 | #include <string.h> |
---|
29 | #include <time.h> |
---|
30 | #include <ctype.h> |
---|
31 | #include <float.h> |
---|
32 | #include <limits.h> |
---|
33 | #include <wx/print.h> |
---|
34 | #include <wx/printdlg.h> |
---|
35 | #include <wx/spinctrl.h> |
---|
36 | #include <wx/radiobox.h> |
---|
37 | #include <wx/statbox.h> |
---|
38 | |
---|
39 | #include "debug.h" /* for BUG and SVX_ASSERT */ |
---|
40 | #include "filelist.h" |
---|
41 | #include "filename.h" |
---|
42 | #include "ini.h" |
---|
43 | #include "message.h" |
---|
44 | #include "useful.h" |
---|
45 | |
---|
46 | #include "aven.h" |
---|
47 | #include "avenprcore.h" |
---|
48 | #include "mainfrm.h" |
---|
49 | #include "printwx.h" |
---|
50 | |
---|
51 | class svxPrintout : public wxPrintout { |
---|
52 | MainFrm *mainfrm; |
---|
53 | layout *m_layout; |
---|
54 | wxString m_title; |
---|
55 | wxPageSetupDialogData* m_data; |
---|
56 | wxDC* pdc; |
---|
57 | static const int cur_pass = 0; |
---|
58 | |
---|
59 | wxPen *pen_frame, *pen_cross, *pen_surface_leg, *pen_leg; |
---|
60 | wxColour colour_text, colour_labels, colour_frame, colour_leg; |
---|
61 | wxColour colour_cross,colour_surface_leg; |
---|
62 | |
---|
63 | long x_t, y_t; |
---|
64 | double font_scaling_x, font_scaling_y; |
---|
65 | wxFont * current_font; |
---|
66 | |
---|
67 | int check_intersection(long x_p, long y_p); |
---|
68 | void draw_info_box(); |
---|
69 | void draw_scale_bar(double x, double y, double MaxLength); |
---|
70 | int next_page(int *pstate, char **q, int pageLim); |
---|
71 | void drawticks(border clip, int tsize, int x, int y); |
---|
72 | |
---|
73 | void MOVEMM(double X, double Y) { |
---|
74 | MoveTo((long)(X * m_layout->scX), (long)(Y * m_layout->scY)); |
---|
75 | } |
---|
76 | void DRAWMM(double X, double Y) { |
---|
77 | DrawTo((long)(X * m_layout->scX), (long)(Y * m_layout->scY)); |
---|
78 | } |
---|
79 | void MoveTo(long x, long y); |
---|
80 | void DrawTo(long x, long y); |
---|
81 | void DrawCross(long x, long y); |
---|
82 | void SetFont(int fontcode); |
---|
83 | void SetColour(int colourcode); |
---|
84 | void WriteString(const char *s); |
---|
85 | void DrawEllipse(long x, long y, long r, long R); |
---|
86 | void SolidRectangle(long x, long y, long w, long h); |
---|
87 | int Charset(void); |
---|
88 | int Pre(); |
---|
89 | void NewPage(int pg, int pagesX, int pagesY); |
---|
90 | void ShowPage(const char *szPageDetails); |
---|
91 | char * Init(FILE **fh_list, bool fCalibrate); |
---|
92 | public: |
---|
93 | svxPrintout(MainFrm *mainfrm, layout *l, wxPageSetupDialogData *data, const wxString & title); |
---|
94 | bool OnPrintPage(int pageNum); |
---|
95 | void GetPageInfo(int *minPage, int *maxPage, |
---|
96 | int *pageFrom, int *pageTo); |
---|
97 | wxString GetTitle(); |
---|
98 | bool HasPage(int pageNum); |
---|
99 | void OnBeginPrinting(); |
---|
100 | void OnEndPrinting(); |
---|
101 | }; |
---|
102 | |
---|
103 | BEGIN_EVENT_TABLE(svxPrintDlg, wxDialog) |
---|
104 | EVT_TEXT(svx_SCALE, svxPrintDlg::OnChange) |
---|
105 | EVT_COMBOBOX(svx_SCALE, svxPrintDlg::OnChange) |
---|
106 | EVT_SPINCTRL(svx_BEARING, svxPrintDlg::OnChangeSpin) |
---|
107 | EVT_SPINCTRL(svx_TILT, svxPrintDlg::OnChangeSpin) |
---|
108 | EVT_BUTTON(wxID_PRINT, svxPrintDlg::OnPrint) |
---|
109 | EVT_BUTTON(wxID_PREVIEW, svxPrintDlg::OnPreview) |
---|
110 | EVT_BUTTON(svx_PLAN, svxPrintDlg::OnPlan) |
---|
111 | EVT_BUTTON(svx_ELEV, svxPrintDlg::OnElevation) |
---|
112 | END_EVENT_TABLE() |
---|
113 | |
---|
114 | static wxString scales[] = { |
---|
115 | "", |
---|
116 | "25", |
---|
117 | "50", |
---|
118 | "100", |
---|
119 | "250", |
---|
120 | "500", |
---|
121 | "1000", |
---|
122 | "2500", |
---|
123 | "5000", |
---|
124 | "10000", |
---|
125 | "25000", |
---|
126 | "50000", |
---|
127 | "100000" |
---|
128 | }; |
---|
129 | |
---|
130 | // there are three jobs to do here... |
---|
131 | // User <-> wx - this should possibly be done in a separate file |
---|
132 | svxPrintDlg::svxPrintDlg(MainFrm* mainfrm_, const wxString & filename, |
---|
133 | const wxString & title, const wxString & datestamp, |
---|
134 | double angle, double tilt_angle, |
---|
135 | bool labels, bool crosses, bool legs, bool surf) |
---|
136 | : wxDialog(mainfrm_, -1, wxString(msg(/*Print*/399))), |
---|
137 | m_layout(wxGetApp().GetPageSetupDialogData()), |
---|
138 | m_File(filename), mainfrm(mainfrm_) |
---|
139 | { |
---|
140 | m_layout.Labels = labels; |
---|
141 | m_layout.Crosses = crosses; |
---|
142 | m_layout.Shots = legs; |
---|
143 | m_layout.Surface = surf; |
---|
144 | m_layout.datestamp = osstrdup(datestamp.c_str()); |
---|
145 | m_layout.rot = int(angle + .001); |
---|
146 | if (title.length() > 11 && |
---|
147 | title.substr(title.length() - 11) == " (extended)") { |
---|
148 | m_layout.title = osstrdup(title.substr(0, title.length() - 11).c_str()); |
---|
149 | m_layout.view = layout::EXTELEV; |
---|
150 | if (m_layout.rot != 0 && m_layout.rot != 180) m_layout.rot = 0; |
---|
151 | m_layout.tilt = 0; |
---|
152 | } else { |
---|
153 | // FIXME rot and tilt shouldn't be integers, but for now add a small |
---|
154 | // fraction before forcing to int as otherwise plan view ends up being |
---|
155 | // 89 degrees! |
---|
156 | m_layout.title = osstrdup(title.c_str()); |
---|
157 | m_layout.tilt = int(tilt_angle + .001); |
---|
158 | if (m_layout.tilt == 90) { |
---|
159 | m_layout.view = layout::PLAN; |
---|
160 | } else if (m_layout.tilt == 0) { |
---|
161 | m_layout.view = layout::ELEV; |
---|
162 | } else { |
---|
163 | m_layout.view = layout::TILT; |
---|
164 | } |
---|
165 | } |
---|
166 | |
---|
167 | /* setup our print dialog*/ |
---|
168 | wxBoxSizer* v1 = new wxBoxSizer(wxVERTICAL); |
---|
169 | wxBoxSizer* h1 = new wxBoxSizer(wxHORIZONTAL); // holds controls |
---|
170 | wxBoxSizer* v2 = new wxStaticBoxSizer(new wxStaticBox(this, -1, msg(/*View*/255)), wxVERTICAL); |
---|
171 | wxBoxSizer* v3 = new wxStaticBoxSizer(new wxStaticBox(this, -1, msg(/*Elements*/256)), wxVERTICAL); |
---|
172 | wxBoxSizer* h2 = new wxBoxSizer(wxHORIZONTAL); // holds buttons |
---|
173 | |
---|
174 | { // this isn't the "too wide" bit... |
---|
175 | wxStaticText* label; |
---|
176 | label = new wxStaticText(this, -1, wxString(msg(/*Scale*/154)) + " 1:"); |
---|
177 | if (scales[0].empty()) scales[0].assign(msg(/*One page*/258)); |
---|
178 | m_scale = new wxComboBox(this, svx_SCALE, scales[0], wxDefaultPosition, |
---|
179 | wxDefaultSize, sizeof(scales) / sizeof(scales[0]), |
---|
180 | scales); |
---|
181 | wxBoxSizer* scalebox = new wxBoxSizer(wxHORIZONTAL); |
---|
182 | scalebox->Add(label, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); |
---|
183 | scalebox->Add(m_scale, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); |
---|
184 | |
---|
185 | v2->Add(scalebox, 0, wxALIGN_LEFT|wxALL, 0); |
---|
186 | } |
---|
187 | |
---|
188 | // Make the dummy string wider than any sane value and use that to |
---|
189 | // fix the width of the control so the sizers allow space for bigger |
---|
190 | // page layouts. |
---|
191 | m_printSize = new wxStaticText(this, -1, wxString::Format(msg(/*%d pages (%dx%d)*/257), 9604, 98, 98)); |
---|
192 | v2->Add(m_printSize, 0, wxALIGN_LEFT|wxALL, 5); |
---|
193 | |
---|
194 | if (m_layout.view != layout::EXTELEV) { |
---|
195 | wxFlexGridSizer* anglebox = new wxFlexGridSizer(2); |
---|
196 | wxStaticText * brg_label, * tilt_label; |
---|
197 | brg_label = new wxStaticText(this, -1, msg(/*Bearing*/259)); |
---|
198 | anglebox->Add(brg_label, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5); |
---|
199 | m_bearing = new wxSpinCtrl(this, svx_BEARING); |
---|
200 | m_bearing->SetRange(0, 359); |
---|
201 | anglebox->Add(m_bearing, 0, wxALIGN_CENTER|wxALL, 5); |
---|
202 | tilt_label = new wxStaticText(this, -1, msg(/*Tilt angle*/263)); |
---|
203 | anglebox->Add(tilt_label, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5); |
---|
204 | m_tilt = new wxSpinCtrl(this,svx_TILT); |
---|
205 | m_tilt->SetRange(-90, 90); |
---|
206 | anglebox->Add(m_tilt, 0, wxALIGN_CENTER|wxALL, 5); |
---|
207 | |
---|
208 | v2->Add(anglebox, 0, wxALIGN_LEFT|wxALL, 0); |
---|
209 | |
---|
210 | wxBoxSizer * planelevsizer = new wxBoxSizer(wxHORIZONTAL); |
---|
211 | planelevsizer->Add(new wxButton(this, svx_PLAN, "Plan"), |
---|
212 | 0, wxALIGN_CENTRE_VERTICAL|wxALL, 5); |
---|
213 | planelevsizer->Add(new wxButton(this, svx_ELEV, "Elevation"), |
---|
214 | 0, wxALIGN_CENTRE_VERTICAL|wxALL, 5); |
---|
215 | |
---|
216 | v2->Add(planelevsizer, 0, wxALIGN_LEFT|wxALL, 5); |
---|
217 | } |
---|
218 | |
---|
219 | h1->Add(v2, 0, wxALIGN_LEFT|wxALL, 5); |
---|
220 | |
---|
221 | m_legs = new wxCheckBox(this, svx_LEGS, msg(/*Underground Survey Legs*/262)); |
---|
222 | v3->Add(m_legs, 0, wxALIGN_LEFT|wxALL, 2); |
---|
223 | m_surface = new wxCheckBox(this, svx_SCALEBAR, msg(/*Sur&face Survey Legs*/403)); |
---|
224 | v3->Add(m_surface, 0, wxALIGN_LEFT|wxALL, 2); |
---|
225 | m_stations = new wxCheckBox(this, svx_STATIONS, msg(/*Crosses*/261)); |
---|
226 | v3->Add(m_stations, 0, wxALIGN_LEFT|wxALL, 2); |
---|
227 | m_names = new wxCheckBox(this, svx_NAMES, msg(/*Station Names*/260)); |
---|
228 | v3->Add(m_names, 0, wxALIGN_LEFT|wxALL, 2); |
---|
229 | m_borders = new wxCheckBox(this, svx_BORDERS, msg(/*Page Borders*/264)); |
---|
230 | v3->Add(m_borders, 0, wxALIGN_LEFT|wxALL, 2); |
---|
231 | // m_blanks = new wxCheckBox(this, svx_BLANKS, msg(/*Blank Pages*/266)); |
---|
232 | // v3->Add(m_blanks, 0, wxALIGN_LEFT|wxALL, 2); |
---|
233 | m_infoBox = new wxCheckBox(this, svx_INFOBOX, msg(/*Info Box*/265)); |
---|
234 | v3->Add(m_infoBox, 0, wxALIGN_LEFT|wxALL, 2); |
---|
235 | |
---|
236 | h1->Add(v3, 0, wxALIGN_LEFT|wxALL, 5); |
---|
237 | |
---|
238 | v1->Add(h1, 0, wxALIGN_LEFT|wxALL, 5); |
---|
239 | |
---|
240 | wxButton * but; |
---|
241 | but = new wxButton(this, wxID_CANCEL); |
---|
242 | h2->Add(but, 0, wxALIGN_RIGHT|wxALL, 5); |
---|
243 | but = new wxButton(this, wxID_PREVIEW, msg(/*Pre&view*/401)); |
---|
244 | h2->Add(but, 0, wxALIGN_RIGHT|wxALL, 5); |
---|
245 | but = new wxButton(this, wxID_PRINT, msg(/*&Print*/400)); |
---|
246 | but->SetDefault(); |
---|
247 | h2->Add(but, 0, wxALIGN_RIGHT|wxALL, 5); |
---|
248 | v1->Add(h2, 0, wxALIGN_RIGHT|wxALL, 5); |
---|
249 | |
---|
250 | SetAutoLayout(true); |
---|
251 | SetSizer(v1); |
---|
252 | v1->Fit(this); |
---|
253 | v1->SetSizeHints(this); |
---|
254 | |
---|
255 | LayoutToUI(); |
---|
256 | SomethingChanged(); |
---|
257 | } |
---|
258 | |
---|
259 | svxPrintDlg::~svxPrintDlg() { |
---|
260 | osfree(m_layout.title); |
---|
261 | osfree(m_layout.datestamp); |
---|
262 | } |
---|
263 | |
---|
264 | void |
---|
265 | svxPrintDlg::OnPrint(wxCommandEvent&) { |
---|
266 | SomethingChanged(); |
---|
267 | wxPageSetupDialogData * psdd = wxGetApp().GetPageSetupDialogData(); |
---|
268 | wxPrintDialogData pd(psdd->GetPrintData()); |
---|
269 | wxPrinter pr(&pd); |
---|
270 | svxPrintout po(mainfrm, &m_layout, psdd, m_File); |
---|
271 | if (pr.Print(this, &po, true)) { |
---|
272 | // Close the print dialog if printing succeeded. |
---|
273 | Destroy(); |
---|
274 | } |
---|
275 | } |
---|
276 | |
---|
277 | void |
---|
278 | svxPrintDlg::OnPreview(wxCommandEvent&) { |
---|
279 | SomethingChanged(); |
---|
280 | wxPageSetupDialogData * psdd = wxGetApp().GetPageSetupDialogData(); |
---|
281 | wxPrintDialogData pd(psdd->GetPrintData()); |
---|
282 | wxPrintPreview* pv; |
---|
283 | pv = new wxPrintPreview(new svxPrintout(mainfrm, &m_layout, psdd, m_File), |
---|
284 | new svxPrintout(mainfrm, &m_layout, psdd, m_File), |
---|
285 | &pd); |
---|
286 | wxPreviewFrame *frame = new wxPreviewFrame(pv, mainfrm, msg(/*Print Preview*/398)); |
---|
287 | frame->Initialize(); |
---|
288 | |
---|
289 | // Size preview frame so that all of the controlbar and canvas can be seen |
---|
290 | // if possible. |
---|
291 | int w, h; |
---|
292 | // GetBestSize gives us the width needed to show the whole controlbar. |
---|
293 | frame->GetBestSize(&w, &h); |
---|
294 | #ifdef __WXMAC__ |
---|
295 | // wxMac opens the preview window at minimum size by default. |
---|
296 | // 360x480 is apparently enough to show A4 portrait. |
---|
297 | if (h < 480 || w < 360) { |
---|
298 | if (h < 480) h = 480; |
---|
299 | if (w < 360) w = 360; |
---|
300 | } |
---|
301 | #else |
---|
302 | if (h < w) { |
---|
303 | // On wxGTK at least, GetBestSize() returns much too small a height. |
---|
304 | h = w * 6 / 5; |
---|
305 | } |
---|
306 | #endif |
---|
307 | // Ensure that we don't make the window bigger than the screen. |
---|
308 | // Use wxGetClientDisplayRect() so we don't cover the MS Windows |
---|
309 | // task bar either. |
---|
310 | wxRect disp = wxGetClientDisplayRect(); |
---|
311 | if (w > disp.GetWidth()) w = disp.GetWidth(); |
---|
312 | if (h > disp.GetHeight()) h = disp.GetHeight(); |
---|
313 | // Centre the window within the "ClientDisplayRect". |
---|
314 | int x = disp.GetLeft() + (disp.GetWidth() - w) / 2; |
---|
315 | int y = disp.GetTop() + (disp.GetHeight() - h) / 2; |
---|
316 | frame->SetSize(x, y, w, h); |
---|
317 | |
---|
318 | frame->Show(); |
---|
319 | } |
---|
320 | |
---|
321 | void |
---|
322 | svxPrintDlg::OnPlan(wxCommandEvent&) { |
---|
323 | m_tilt->SetValue(90); |
---|
324 | SomethingChanged(); |
---|
325 | } |
---|
326 | |
---|
327 | void |
---|
328 | svxPrintDlg::OnElevation(wxCommandEvent&) { |
---|
329 | m_tilt->SetValue(0); |
---|
330 | SomethingChanged(); |
---|
331 | } |
---|
332 | |
---|
333 | void |
---|
334 | svxPrintDlg::OnChangeSpin(wxSpinEvent&e) { |
---|
335 | SomethingChanged(); |
---|
336 | } |
---|
337 | |
---|
338 | void |
---|
339 | svxPrintDlg::OnChange(wxCommandEvent&) { |
---|
340 | SomethingChanged(); |
---|
341 | } |
---|
342 | |
---|
343 | void |
---|
344 | svxPrintDlg::SomethingChanged() { |
---|
345 | UIToLayout(); |
---|
346 | // Update the bounding box. |
---|
347 | RecalcBounds(); |
---|
348 | if (m_layout.xMax >= m_layout.xMin) { |
---|
349 | m_layout.pages_required(); |
---|
350 | m_printSize->SetLabel(wxString::Format(msg(/*%d pages (%dx%d)*/257), m_layout.pages, m_layout.pagesX, m_layout.pagesY)); |
---|
351 | } |
---|
352 | } |
---|
353 | |
---|
354 | void |
---|
355 | svxPrintDlg::LayoutToUI(){ |
---|
356 | m_names->SetValue(m_layout.Labels); |
---|
357 | m_legs->SetValue(m_layout.Shots); |
---|
358 | m_stations->SetValue(m_layout.Crosses); |
---|
359 | m_borders->SetValue(m_layout.Border); |
---|
360 | // m_blanks->SetValue(m_layout.SkipBlank); |
---|
361 | m_infoBox->SetValue(!m_layout.Raw); |
---|
362 | m_surface->SetValue(m_layout.Surface); |
---|
363 | if (m_layout.view != layout::EXTELEV) { |
---|
364 | m_tilt->SetValue(m_layout.tilt); |
---|
365 | // FIXME: enable both buttons |
---|
366 | if (m_layout.tilt > 89) { |
---|
367 | // FIXME: disable Plan button |
---|
368 | } else if (m_layout.tilt == 0) { |
---|
369 | // FIXME: disable Elevation button |
---|
370 | } |
---|
371 | |
---|
372 | m_bearing->SetValue(m_layout.rot); |
---|
373 | } |
---|
374 | |
---|
375 | // Do this last as it causes an OnChange message which calls UIToLayout |
---|
376 | if (m_layout.Scale != 0) { |
---|
377 | wxString temp; |
---|
378 | temp << m_layout.Scale; |
---|
379 | m_scale->SetValue(temp); |
---|
380 | } else { |
---|
381 | if (scales[0].empty()) scales[0].assign(msg(/*One page*/258)); |
---|
382 | m_scale->SetValue(scales[0]); |
---|
383 | } |
---|
384 | } |
---|
385 | |
---|
386 | void |
---|
387 | svxPrintDlg::UIToLayout(){ |
---|
388 | m_layout.Labels = m_names->IsChecked(); |
---|
389 | m_layout.Shots = m_legs->IsChecked(); |
---|
390 | m_layout.Crosses = m_stations->IsChecked(); |
---|
391 | m_layout.Border = m_borders->IsChecked(); |
---|
392 | // m_layout.SkipBlank = m_blanks->IsChecked(); |
---|
393 | m_layout.Raw = !m_infoBox->IsChecked(); |
---|
394 | m_layout.Surface = m_surface->IsChecked(); |
---|
395 | |
---|
396 | if (m_layout.view != layout::EXTELEV) { |
---|
397 | m_layout.tilt = m_tilt->GetValue(); |
---|
398 | if (m_layout.tilt == 90) { |
---|
399 | m_layout.view = layout::PLAN; |
---|
400 | } else if (m_layout.tilt == 0) { |
---|
401 | m_layout.view = layout::ELEV; |
---|
402 | } else { |
---|
403 | m_layout.view = layout::TILT; |
---|
404 | } |
---|
405 | m_layout.rot = m_bearing->GetValue(); |
---|
406 | } |
---|
407 | |
---|
408 | (m_scale->GetValue()).ToDouble(&(m_layout.Scale)); |
---|
409 | if (m_layout.Scale == 0.0) { |
---|
410 | m_layout.pick_scale(1, 1); |
---|
411 | } |
---|
412 | } |
---|
413 | |
---|
414 | void |
---|
415 | svxPrintDlg::RecalcBounds() |
---|
416 | { |
---|
417 | m_layout.yMax = m_layout.xMax = -DBL_MAX; |
---|
418 | m_layout.yMin = m_layout.xMin = DBL_MAX; |
---|
419 | |
---|
420 | double SIN,COS,SINT,COST; |
---|
421 | SIN = sin(rad(m_layout.rot)); |
---|
422 | COS = cos(rad(m_layout.rot)); |
---|
423 | SINT = sin(rad(m_layout.tilt)); |
---|
424 | COST = cos(rad(m_layout.tilt)); |
---|
425 | |
---|
426 | if (m_layout.Surface || m_layout.Shots) { |
---|
427 | for (int i=0; i < NUM_DEPTH_COLOURS; ++i) { |
---|
428 | list<PointInfo*>::const_iterator p = mainfrm->GetPoints(i); |
---|
429 | while (p != mainfrm->GetPointsEnd(i)) { |
---|
430 | double x = (*p)->GetX(); |
---|
431 | double y = (*p)->GetY(); |
---|
432 | double z = (*p)->GetZ(); |
---|
433 | if ((*p)->IsSurface() ? m_layout.Surface : m_layout.Shots) { |
---|
434 | double X = x * COS - y * SIN; |
---|
435 | if (X > m_layout.xMax) m_layout.xMax = X; |
---|
436 | if (X < m_layout.xMin) m_layout.xMin = X; |
---|
437 | double Y = (x * SIN + y * COS) * SINT + z * COST; |
---|
438 | if (Y > m_layout.yMax) m_layout.yMax = Y; |
---|
439 | if (Y < m_layout.yMin) m_layout.yMin = Y; |
---|
440 | } |
---|
441 | ++p; |
---|
442 | } |
---|
443 | } |
---|
444 | } |
---|
445 | if (m_layout.Labels || m_layout.Crosses) { |
---|
446 | list<LabelInfo*>::const_iterator label = mainfrm->GetLabels(); |
---|
447 | while (label != mainfrm->GetLabelsEnd()) { |
---|
448 | double x = (*label)->GetX(); |
---|
449 | double y = (*label)->GetY(); |
---|
450 | double z = (*label)->GetZ(); |
---|
451 | if (m_layout.Surface || (*label)->IsUnderground()) { |
---|
452 | double X = x * COS - y * SIN; |
---|
453 | if (X > m_layout.xMax) m_layout.xMax = X; |
---|
454 | if (X < m_layout.xMin) m_layout.xMin = X; |
---|
455 | double Y = (x * SIN + y * COS) * SINT + z * COST; |
---|
456 | if (Y > m_layout.yMax) m_layout.yMax = Y; |
---|
457 | if (Y < m_layout.yMin) m_layout.yMin = Y; |
---|
458 | } |
---|
459 | ++label; |
---|
460 | } |
---|
461 | } |
---|
462 | } |
---|
463 | |
---|
464 | #define DEG "\xB0" /* degree symbol in iso-8859-1 */ |
---|
465 | |
---|
466 | static int xpPageWidth, ypPageDepth; |
---|
467 | static long MarginLeft, MarginRight, MarginTop, MarginBottom; |
---|
468 | static long x_offset, y_offset; |
---|
469 | static wxFont *font_labels, *font_default; |
---|
470 | static int fontsize, fontsize_labels; |
---|
471 | |
---|
472 | /* FIXME: allow the font to be set */ |
---|
473 | |
---|
474 | static const char *fontname = "Arial", *fontname_labels = "Arial"; |
---|
475 | |
---|
476 | // wx <-> prcore (calls to print_page etc...) |
---|
477 | svxPrintout::svxPrintout(MainFrm *mainfrm_, layout *l, wxPageSetupDialogData *data, |
---|
478 | const wxString & title) |
---|
479 | : wxPrintout(title) |
---|
480 | { |
---|
481 | mainfrm = mainfrm_; |
---|
482 | m_layout = l; |
---|
483 | m_title = title; |
---|
484 | m_data = data; |
---|
485 | } |
---|
486 | |
---|
487 | void |
---|
488 | svxPrintout::draw_info_box() |
---|
489 | { |
---|
490 | layout *l = m_layout; |
---|
491 | char szTmp[256]; |
---|
492 | char *p; |
---|
493 | int boxwidth = 60; |
---|
494 | int boxheight = 30; |
---|
495 | |
---|
496 | SetColour(PR_COLOUR_FRAME); |
---|
497 | |
---|
498 | if (l->view != layout::EXTELEV) { |
---|
499 | boxwidth = 100; |
---|
500 | boxheight = 40; |
---|
501 | MOVEMM(60,40); |
---|
502 | DRAWMM(60, 0); |
---|
503 | MOVEMM(0, 30); DRAWMM(60, 30); |
---|
504 | } |
---|
505 | |
---|
506 | MOVEMM(0, boxheight); |
---|
507 | DRAWMM(boxwidth, boxheight); |
---|
508 | DRAWMM(boxwidth, 0); |
---|
509 | if (!l->Border) { |
---|
510 | DRAWMM(0, 0); |
---|
511 | DRAWMM(0, boxheight); |
---|
512 | } |
---|
513 | |
---|
514 | MOVEMM(0, 20); DRAWMM(60, 20); |
---|
515 | MOVEMM(0, 10); DRAWMM(60, 10); |
---|
516 | |
---|
517 | switch (l->view) { |
---|
518 | case layout::PLAN: { |
---|
519 | long ax, ay, bx, by, cx, cy, dx, dy; |
---|
520 | |
---|
521 | #define RADIUS 16.0 |
---|
522 | DrawEllipse((long)(80.0 * l->scX), (long)(20.0 * l->scY), |
---|
523 | (long)(RADIUS * l->scX), (long)(RADIUS * l->scY)); |
---|
524 | |
---|
525 | ax = (long)((80 - 15 * sin(rad(000.0 + l->rot))) * l->scX); |
---|
526 | ay = (long)((20 + 15 * cos(rad(000.0 + l->rot))) * l->scY); |
---|
527 | bx = (long)((80 - 7 * sin(rad(180.0 + l->rot))) * l->scX); |
---|
528 | by = (long)((20 + 7 * cos(rad(180.0 + l->rot))) * l->scY); |
---|
529 | cx = (long)((80 - 15 * sin(rad(160.0 + l->rot))) * l->scX); |
---|
530 | cy = (long)((20 + 15 * cos(rad(160.0 + l->rot))) * l->scY); |
---|
531 | dx = (long)((80 - 15 * sin(rad(200.0 + l->rot))) * l->scX); |
---|
532 | dy = (long)((20 + 15 * cos(rad(200.0 + l->rot))) * l->scY); |
---|
533 | |
---|
534 | MoveTo(ax, ay); |
---|
535 | DrawTo(bx, by); |
---|
536 | DrawTo(cx, cy); |
---|
537 | DrawTo(ax, ay); |
---|
538 | DrawTo(dx, dy); |
---|
539 | DrawTo(bx, by); |
---|
540 | |
---|
541 | SetColour(PR_COLOUR_TEXT); |
---|
542 | MOVEMM(62, 36); |
---|
543 | WriteString(msg(/*North*/115)); |
---|
544 | |
---|
545 | MOVEMM(5, 23); |
---|
546 | WriteString(msg(/*Plan view*/117)); |
---|
547 | break; |
---|
548 | } |
---|
549 | case layout::ELEV: case layout::TILT: |
---|
550 | MOVEMM(65, 15); DRAWMM(70, 12); DRAWMM(68, 15); DRAWMM(70, 18); |
---|
551 | |
---|
552 | DRAWMM(65, 15); DRAWMM(95, 15); |
---|
553 | |
---|
554 | DRAWMM(90, 18); DRAWMM(92, 15); DRAWMM(90, 12); DRAWMM(95, 15); |
---|
555 | |
---|
556 | MOVEMM(80, 13); DRAWMM(80, 17); |
---|
557 | |
---|
558 | SetColour(PR_COLOUR_TEXT); |
---|
559 | MOVEMM(62, 33); |
---|
560 | WriteString(msg(/*Elevation on*/116)); |
---|
561 | |
---|
562 | sprintf(szTmp, "%03d"DEG, (l->rot + 270) % 360); |
---|
563 | MOVEMM(65, 20); WriteString(szTmp); |
---|
564 | sprintf(szTmp, "%03d"DEG, (l->rot + 90) % 360); |
---|
565 | MOVEMM(85, 20); WriteString(szTmp); |
---|
566 | |
---|
567 | MOVEMM(5, 23); |
---|
568 | WriteString(msg(/*Elevation*/118)); |
---|
569 | break; |
---|
570 | case layout::EXTELEV: |
---|
571 | SetColour(PR_COLOUR_TEXT); |
---|
572 | MOVEMM(5, 13); |
---|
573 | WriteString(msg(/*Extended elevation*/191)); |
---|
574 | break; |
---|
575 | } |
---|
576 | |
---|
577 | MOVEMM(5, boxheight - 7); WriteString(l->title); |
---|
578 | |
---|
579 | strcpy(szTmp, msg(/*Scale*/154)); |
---|
580 | p = szTmp + strlen(szTmp); |
---|
581 | sprintf(p, " 1:%.0f", l->Scale); |
---|
582 | MOVEMM(5, boxheight - 27); WriteString(szTmp); |
---|
583 | |
---|
584 | if (l->view != layout::EXTELEV) { |
---|
585 | strcpy(szTmp, |
---|
586 | msg(l->view == layout::PLAN ? /*Up page*/168 : /*View*/169)); |
---|
587 | p = szTmp + strlen(szTmp); |
---|
588 | sprintf(p, " %03d"DEG, l->rot); |
---|
589 | MOVEMM(5, 3); WriteString(szTmp); |
---|
590 | } |
---|
591 | |
---|
592 | /* This used to be a copyright line, but it was occasionally |
---|
593 | * mis-interpreted as us claiming copyright on the survey, so let's |
---|
594 | * give the website URL instead */ |
---|
595 | MOVEMM(boxwidth + 2, 2); |
---|
596 | WriteString("Survex "VERSION" - http://www.survex.com/"); |
---|
597 | |
---|
598 | draw_scale_bar(boxwidth + 10.0, 17.0, l->PaperWidth - boxwidth - 18.0); |
---|
599 | } |
---|
600 | |
---|
601 | /* Draw fancy scale bar with bottom left at (x,y) (both in mm) and at most */ |
---|
602 | /* MaxLength mm long. The scaling in use is 1:scale */ |
---|
603 | void |
---|
604 | svxPrintout::draw_scale_bar(double x, double y, double MaxLength) |
---|
605 | { |
---|
606 | double StepEst, d; |
---|
607 | int E, Step, n, le, c; |
---|
608 | char u_buf[3], buf[256]; |
---|
609 | char *p; |
---|
610 | static const signed char powers[] = { |
---|
611 | 12, 9, 9, 9, 6, 6, 6, 3, 2, 2, 0, 0, 0, -3, -3, -3, -6, -6, -6, -9, |
---|
612 | }; |
---|
613 | static const char si_mods[sizeof(powers)] = { |
---|
614 | 'p', 'n', 'n', 'n', 'u', 'u', 'u', 'm', 'c', 'c', '\0', '\0', '\0', |
---|
615 | 'k', 'k', 'k', 'M', 'M', 'M', 'G' |
---|
616 | }; |
---|
617 | /* Limit scalebar to 20cm to stop people with A0 plotters complaining */ |
---|
618 | if (MaxLength > 200.0) MaxLength = 200.0; |
---|
619 | |
---|
620 | #define dmin 10.0 /* each division >= dmin mm long */ |
---|
621 | #define StepMax 5 /* number in steps of at most StepMax (x 10^N) */ |
---|
622 | #define epsilon (1e-4) /* fudge factor to prevent rounding problems */ |
---|
623 | |
---|
624 | E = (int)ceil(log10((dmin * 0.001 * m_layout->Scale) / StepMax)); |
---|
625 | StepEst = pow(10.0, -(double)E) * (dmin * 0.001) * m_layout->Scale - epsilon; |
---|
626 | |
---|
627 | /* Force labelling to be in multiples of 1, 2, or 5 */ |
---|
628 | Step = (StepEst <= 1.0 ? 1 : (StepEst <= 2.0 ? 2 : 5)); |
---|
629 | |
---|
630 | /* Work out actual length of each scale bar division */ |
---|
631 | d = Step * pow(10.0, (double)E) / m_layout->Scale * 1000.0; |
---|
632 | |
---|
633 | /* Choose appropriate units, s.t. if possible E is >=0 and minimized */ |
---|
634 | /* Range of units is a little extreme, but it doesn't hurt... */ |
---|
635 | n = min(E, 9); |
---|
636 | n = max(n, -10) + 10; |
---|
637 | E += (int)powers[n]; |
---|
638 | |
---|
639 | u_buf[0] = si_mods[n]; |
---|
640 | u_buf[1] = '\0'; |
---|
641 | strcat(u_buf, "m"); |
---|
642 | |
---|
643 | strcpy(buf, msg(/*Scale*/154)); |
---|
644 | |
---|
645 | /* Add units used - eg. "Scale (10m)" */ |
---|
646 | p = buf + strlen(buf); |
---|
647 | sprintf(p, " (%.0f%s)", (double)pow(10.0, (double)E), u_buf); |
---|
648 | |
---|
649 | SetColour(PR_COLOUR_TEXT); |
---|
650 | MOVEMM(x, y + 4); WriteString(buf); |
---|
651 | |
---|
652 | /* Work out how many divisions there will be */ |
---|
653 | n = (int)(MaxLength / d); |
---|
654 | |
---|
655 | SetColour(PR_COLOUR_FRAME); |
---|
656 | |
---|
657 | long Y = long(y * m_layout->scY); |
---|
658 | long Y2 = long((y + 3) * m_layout->scY); |
---|
659 | long X = long(x * m_layout->scX); |
---|
660 | long X2 = long((x + n * d) * m_layout->scX); |
---|
661 | |
---|
662 | /* Draw top of scale bar */ |
---|
663 | MoveTo(X2, Y2); |
---|
664 | DrawTo(X, Y2); |
---|
665 | #if 0 |
---|
666 | DrawTo(X2, Y); |
---|
667 | DrawTo(X, Y); |
---|
668 | MOVEMM(x + n * d, y); DRAWMM(x, y); |
---|
669 | #endif |
---|
670 | /* Draw divisions and label them */ |
---|
671 | for (c = 0; c <= n; c++) { |
---|
672 | SetColour(PR_COLOUR_FRAME); |
---|
673 | X = long((x + c * d) * m_layout->scX); |
---|
674 | MoveTo(X, Y); |
---|
675 | DrawTo(X, Y2); |
---|
676 | #if 0 // Don't waste toner! |
---|
677 | /* Draw a "zebra crossing" scale bar. */ |
---|
678 | if (c < n && (c & 1) == 0) { |
---|
679 | X2 = long((x + (c + 1) * d) * m_layout->scX); |
---|
680 | SolidRectangle(X, Y, X2 - X, Y2 - Y); |
---|
681 | } |
---|
682 | #endif |
---|
683 | /* ANSI sprintf returns length of formatted string, but some pre-ANSI Unix |
---|
684 | * implementations return char* (ptr to end of written string I think) */ |
---|
685 | sprintf(buf, "%d", c * Step); |
---|
686 | le = strlen(buf); |
---|
687 | SetColour(PR_COLOUR_TEXT); |
---|
688 | MOVEMM(x + c * d - le, y - 4); |
---|
689 | WriteString(buf); |
---|
690 | } |
---|
691 | } |
---|
692 | |
---|
693 | #if 0 |
---|
694 | void |
---|
695 | make_calibration(layout *l) { |
---|
696 | img_point pt = { 0.0, 0.0, 0.0 }; |
---|
697 | l->xMax = l->yMax = 0.1; |
---|
698 | l->xMin = l->yMin = 0; |
---|
699 | |
---|
700 | stack(l,img_MOVE, NULL, &pt); |
---|
701 | pt.x = 0.1; |
---|
702 | stack(l,img_LINE, NULL, &pt); |
---|
703 | pt.y = 0.1; |
---|
704 | stack(l,img_LINE, NULL, &pt); |
---|
705 | pt.x = 0.0; |
---|
706 | stack(l,img_LINE, NULL, &pt); |
---|
707 | pt.y = 0.0; |
---|
708 | stack(l,img_LINE, NULL, &pt); |
---|
709 | pt.x = 0.05; |
---|
710 | pt.y = 0.001; |
---|
711 | stack(l,img_LABEL, "10cm", &pt); |
---|
712 | pt.x = 0.001; |
---|
713 | pt.y = 0.05; |
---|
714 | stack(l,img_LABEL, "10cm", &pt); |
---|
715 | l->Scale = 1.0; |
---|
716 | } |
---|
717 | #endif |
---|
718 | |
---|
719 | int |
---|
720 | svxPrintout::next_page(int *pstate, char **q, int pageLim) |
---|
721 | { |
---|
722 | char *p; |
---|
723 | int page; |
---|
724 | int c; |
---|
725 | p = *q; |
---|
726 | if (*pstate > 0) { |
---|
727 | /* doing a range */ |
---|
728 | (*pstate)++; |
---|
729 | SVX_ASSERT(*p == '-'); |
---|
730 | p++; |
---|
731 | while (isspace((unsigned char)*p)) p++; |
---|
732 | if (sscanf(p, "%u%n", &page, &c) > 0) { |
---|
733 | p += c; |
---|
734 | } else { |
---|
735 | page = pageLim; |
---|
736 | } |
---|
737 | if (*pstate > page) goto err; |
---|
738 | if (*pstate < page) return *pstate; |
---|
739 | *q = p; |
---|
740 | *pstate = 0; |
---|
741 | return page; |
---|
742 | } |
---|
743 | |
---|
744 | while (isspace((unsigned char)*p) || *p == ',') p++; |
---|
745 | |
---|
746 | if (!*p) return 0; /* done */ |
---|
747 | |
---|
748 | if (*p == '-') { |
---|
749 | *q = p; |
---|
750 | *pstate = 1; |
---|
751 | return 1; /* range with initial parameter omitted */ |
---|
752 | } |
---|
753 | if (sscanf(p, "%u%n", &page, &c) > 0) { |
---|
754 | p += c; |
---|
755 | while (isspace((unsigned char)*p)) p++; |
---|
756 | *q = p; |
---|
757 | if (0 < page && page <= pageLim) { |
---|
758 | if (*p == '-') *pstate = page; /* range with start */ |
---|
759 | return page; |
---|
760 | } |
---|
761 | } |
---|
762 | err: |
---|
763 | *pstate = -1; |
---|
764 | return 0; |
---|
765 | } |
---|
766 | |
---|
767 | /* Draws in alignment marks on each page or borders on edge pages */ |
---|
768 | void |
---|
769 | svxPrintout::drawticks(border clip, int tsize, int x, int y) |
---|
770 | { |
---|
771 | long i; |
---|
772 | int s = tsize * 4; |
---|
773 | int o = s / 8; |
---|
774 | bool fAtCorner = fFalse; |
---|
775 | SetColour(PR_COLOUR_FRAME); |
---|
776 | if (x == 0 && m_layout->Border) { |
---|
777 | /* solid left border */ |
---|
778 | MoveTo(clip.x_min, clip.y_min); |
---|
779 | DrawTo(clip.x_min, clip.y_max); |
---|
780 | fAtCorner = fTrue; |
---|
781 | } else { |
---|
782 | if (x > 0 || y > 0) { |
---|
783 | MoveTo(clip.x_min, clip.y_min); |
---|
784 | DrawTo(clip.x_min, clip.y_min + tsize); |
---|
785 | } |
---|
786 | if (s && x > 0 && m_layout->Cutlines) { |
---|
787 | /* dashed left border */ |
---|
788 | i = (clip.y_max - clip.y_min) - |
---|
789 | (tsize + ((clip.y_max - clip.y_min - tsize * 2L) % s) / 2); |
---|
790 | for ( ; i > tsize; i -= s) { |
---|
791 | MoveTo(clip.x_min, clip.y_max - (i + o)); |
---|
792 | DrawTo(clip.x_min, clip.y_max - (i - o)); |
---|
793 | } |
---|
794 | } |
---|
795 | if (x > 0 || y < m_layout->pagesY - 1) { |
---|
796 | MoveTo(clip.x_min, clip.y_max - tsize); |
---|
797 | DrawTo(clip.x_min, clip.y_max); |
---|
798 | fAtCorner = fTrue; |
---|
799 | } |
---|
800 | } |
---|
801 | |
---|
802 | if (y == m_layout->pagesY - 1 && m_layout->Border) { |
---|
803 | /* solid top border */ |
---|
804 | if (!fAtCorner) MoveTo(clip.x_min, clip.y_max); |
---|
805 | DrawTo(clip.x_max, clip.y_max); |
---|
806 | fAtCorner = fTrue; |
---|
807 | } else { |
---|
808 | if (y < m_layout->pagesY - 1 || x > 0) { |
---|
809 | if (!fAtCorner) MoveTo(clip.x_min, clip.y_max); |
---|
810 | DrawTo(clip.x_min + tsize, clip.y_max); |
---|
811 | } |
---|
812 | if (s && y < m_layout->pagesY - 1 && m_layout->Cutlines) { |
---|
813 | /* dashed top border */ |
---|
814 | i = (clip.x_max - clip.x_min) - |
---|
815 | (tsize + ((clip.x_max - clip.x_min - tsize * 2L) % s) / 2); |
---|
816 | for ( ; i > tsize; i -= s) { |
---|
817 | MoveTo(clip.x_max - (i + o), clip.y_max); |
---|
818 | DrawTo(clip.x_max - (i - o), clip.y_max); |
---|
819 | } |
---|
820 | } |
---|
821 | if (y < m_layout->pagesY - 1 || x < m_layout->pagesX - 1) { |
---|
822 | MoveTo(clip.x_max - tsize, clip.y_max); |
---|
823 | DrawTo(clip.x_max, clip.y_max); |
---|
824 | fAtCorner = fTrue; |
---|
825 | } else { |
---|
826 | fAtCorner = fFalse; |
---|
827 | } |
---|
828 | } |
---|
829 | |
---|
830 | if (x == m_layout->pagesX - 1 && m_layout->Border) { |
---|
831 | /* solid right border */ |
---|
832 | if (!fAtCorner) MoveTo(clip.x_max, clip.y_max); |
---|
833 | DrawTo(clip.x_max, clip.y_min); |
---|
834 | fAtCorner = fTrue; |
---|
835 | } else { |
---|
836 | if (x < m_layout->pagesX - 1 || y < m_layout->pagesY - 1) { |
---|
837 | if (!fAtCorner) MoveTo(clip.x_max, clip.y_max); |
---|
838 | DrawTo(clip.x_max, clip.y_max - tsize); |
---|
839 | } |
---|
840 | if (s && x < m_layout->pagesX - 1 && m_layout->Cutlines) { |
---|
841 | /* dashed right border */ |
---|
842 | i = (clip.y_max - clip.y_min) - |
---|
843 | (tsize + ((clip.y_max - clip.y_min - tsize * 2L) % s) / 2); |
---|
844 | for ( ; i > tsize; i -= s) { |
---|
845 | MoveTo(clip.x_max, clip.y_min + (i + o)); |
---|
846 | DrawTo(clip.x_max, clip.y_min + (i - o)); |
---|
847 | } |
---|
848 | } |
---|
849 | if (x < m_layout->pagesX - 1 || y > 0) { |
---|
850 | MoveTo(clip.x_max, clip.y_min + tsize); |
---|
851 | DrawTo(clip.x_max, clip.y_min); |
---|
852 | fAtCorner = fTrue; |
---|
853 | } else { |
---|
854 | fAtCorner = fFalse; |
---|
855 | } |
---|
856 | } |
---|
857 | |
---|
858 | if (y == 0 && m_layout->Border) { |
---|
859 | /* solid bottom border */ |
---|
860 | if (!fAtCorner) MoveTo(clip.x_max, clip.y_min); |
---|
861 | DrawTo(clip.x_min, clip.y_min); |
---|
862 | } else { |
---|
863 | if (y > 0 || x < m_layout->pagesX - 1) { |
---|
864 | if (!fAtCorner) MoveTo(clip.x_max, clip.y_min); |
---|
865 | DrawTo(clip.x_max - tsize, clip.y_min); |
---|
866 | } |
---|
867 | if (s && y > 0 && m_layout->Cutlines) { |
---|
868 | /* dashed bottom border */ |
---|
869 | i = (clip.x_max - clip.x_min) - |
---|
870 | (tsize + ((clip.x_max - clip.x_min - tsize * 2L) % s) / 2); |
---|
871 | for ( ; i > tsize; i -= s) { |
---|
872 | MoveTo(clip.x_min + (i + o), clip.y_min); |
---|
873 | DrawTo(clip.x_min + (i - o), clip.y_min); |
---|
874 | } |
---|
875 | } |
---|
876 | if (y > 0 || x > 0) { |
---|
877 | MoveTo(clip.x_min + tsize, clip.y_min); |
---|
878 | DrawTo(clip.x_min, clip.y_min); |
---|
879 | } |
---|
880 | } |
---|
881 | } |
---|
882 | |
---|
883 | bool |
---|
884 | svxPrintout::OnPrintPage(int pageNum) { |
---|
885 | GetPageSizePixels(&xpPageWidth, &ypPageDepth); |
---|
886 | pdc = GetDC(); |
---|
887 | if (IsPreview()) { |
---|
888 | int dcx, dcy; |
---|
889 | pdc->GetSize(&dcx, &dcy); |
---|
890 | pdc->SetUserScale((double)dcx / xpPageWidth, (double)dcy / ypPageDepth); |
---|
891 | } |
---|
892 | |
---|
893 | layout * l = m_layout; |
---|
894 | { |
---|
895 | int pwidth, pdepth; |
---|
896 | GetPageSizeMM(&pwidth, &pdepth); |
---|
897 | l->scX = (double)xpPageWidth / pwidth; |
---|
898 | l->scY = (double)ypPageDepth / pdepth; |
---|
899 | font_scaling_x = l->scX * (25.4 / 72.0); |
---|
900 | font_scaling_y = l->scY * (25.4 / 72.0); |
---|
901 | MarginLeft = m_data->GetMarginTopLeft().x; |
---|
902 | MarginTop = m_data->GetMarginTopLeft().y; |
---|
903 | MarginBottom = m_data->GetMarginBottomRight().y; |
---|
904 | MarginRight = m_data->GetMarginBottomRight().x; |
---|
905 | xpPageWidth -= (int)(l->scX * (MarginLeft + MarginRight)); |
---|
906 | ypPageDepth -= (int)(l->scY * (10 + MarginBottom + MarginRight)); |
---|
907 | // xpPageWidth -= 1; |
---|
908 | pdepth -= 10; |
---|
909 | x_offset = (long)(l->scX * MarginLeft); |
---|
910 | y_offset = (long)(l->scY * MarginTop); |
---|
911 | l->PaperWidth = pwidth -= MarginLeft + MarginRight; |
---|
912 | l->PaperDepth = pdepth -= MarginTop + MarginBottom; |
---|
913 | } |
---|
914 | |
---|
915 | double SIN,COS,SINT,COST; |
---|
916 | SIN = sin(rad(l->rot)); |
---|
917 | COS = cos(rad(l->rot)); |
---|
918 | SINT = sin(rad(l->tilt)); |
---|
919 | COST = cos(rad(l->tilt)); |
---|
920 | |
---|
921 | long x = 0, y = 0; |
---|
922 | bool pending_move = false; |
---|
923 | bool last_leg_surface = false; |
---|
924 | |
---|
925 | NewPage(pageNum, l->pagesX, l->pagesY); |
---|
926 | |
---|
927 | if (!l->Raw && pageNum == (l->pagesY - 1) * l->pagesX + 1) { |
---|
928 | SetFont(PR_FONT_DEFAULT); |
---|
929 | draw_info_box(); |
---|
930 | } |
---|
931 | |
---|
932 | const double Sc = 1000 / l->Scale; |
---|
933 | |
---|
934 | if (l->Surface || l->Shots) { |
---|
935 | for (int i=0; i < mainfrm->GetNumDepthBands(); ++i) { |
---|
936 | list<PointInfo*>::const_iterator p = mainfrm->GetPoints(i); |
---|
937 | while (p != mainfrm->GetPointsEnd(i)) { |
---|
938 | double px = (*p)->GetX(); |
---|
939 | double py = (*p)->GetY(); |
---|
940 | double pz = (*p)->GetZ(); |
---|
941 | double X = px * COS - py * SIN; |
---|
942 | double Y = (px * SIN + py * COS) * SINT + pz * COST; |
---|
943 | long xnew = (long)((X * Sc + l->xOrg) * l->scX); |
---|
944 | long ynew = (long)((Y * Sc + l->yOrg) * l->scY); |
---|
945 | |
---|
946 | if ((*p)->IsLine()) { |
---|
947 | bool draw = ((*p)->IsSurface() ? l->Surface : l->Shots); |
---|
948 | if (draw) { |
---|
949 | SetColour((*p)->IsSurface() ? |
---|
950 | PR_COLOUR_SURFACE_LEG : PR_COLOUR_LEG); |
---|
951 | } |
---|
952 | |
---|
953 | if ((*p)->IsSurface() != last_leg_surface) |
---|
954 | pending_move = true; |
---|
955 | |
---|
956 | /* avoid drawing superfluous lines */ |
---|
957 | if (pending_move || xnew != x || ynew != y) { |
---|
958 | if (draw) { |
---|
959 | if (pending_move) MoveTo(x, y); |
---|
960 | pending_move = false; |
---|
961 | DrawTo(xnew, ynew); |
---|
962 | } else { |
---|
963 | pending_move = true; |
---|
964 | } |
---|
965 | last_leg_surface = (*p)->IsSurface(); |
---|
966 | x = xnew; |
---|
967 | y = ynew; |
---|
968 | } |
---|
969 | } else { |
---|
970 | /* avoid superfluous moves */ |
---|
971 | if (xnew != x || ynew != y) { |
---|
972 | x = xnew; |
---|
973 | y = ynew; |
---|
974 | pending_move = true; |
---|
975 | } |
---|
976 | } |
---|
977 | p++; |
---|
978 | } |
---|
979 | } |
---|
980 | } |
---|
981 | |
---|
982 | if (l->Labels || l->Crosses) { |
---|
983 | if (l->Labels) SetFont(PR_FONT_LABELS); |
---|
984 | list<LabelInfo*>::const_iterator label = mainfrm->GetLabels(); |
---|
985 | while (label != mainfrm->GetLabelsEnd()) { |
---|
986 | double px = (*label)->GetX(); |
---|
987 | double py = (*label)->GetY(); |
---|
988 | double pz = (*label)->GetZ(); |
---|
989 | if (l->Surface || (*label)->IsUnderground()) { |
---|
990 | double X = px * COS - py * SIN; |
---|
991 | double Y = (px * SIN + py * COS) * SINT + pz * COST; |
---|
992 | long xnew, ynew; |
---|
993 | xnew = (long)((X * Sc + l->xOrg) * l->scX); |
---|
994 | ynew = (long)((Y * Sc + l->yOrg) * l->scY); |
---|
995 | if (l->Crosses) { |
---|
996 | SetColour(PR_COLOUR_CROSS); |
---|
997 | DrawCross(xnew, ynew); |
---|
998 | } |
---|
999 | if (l->Labels) { |
---|
1000 | SetColour(PR_COLOUR_LABELS); |
---|
1001 | MoveTo(xnew, ynew); |
---|
1002 | WriteString((*label)->GetText()); |
---|
1003 | } |
---|
1004 | } |
---|
1005 | ++label; |
---|
1006 | } |
---|
1007 | } |
---|
1008 | |
---|
1009 | if (!l->Raw) { |
---|
1010 | char szTmp[256]; |
---|
1011 | SetColour(PR_COLOUR_TEXT); |
---|
1012 | sprintf(szTmp, l->footer, l->title, pageNum, l->pagesX * l->pagesY, |
---|
1013 | l->datestamp); |
---|
1014 | ShowPage(szTmp); |
---|
1015 | } else { |
---|
1016 | ShowPage(""); |
---|
1017 | } |
---|
1018 | |
---|
1019 | return true; |
---|
1020 | } |
---|
1021 | |
---|
1022 | void |
---|
1023 | svxPrintout::GetPageInfo(int *minPage, int *maxPage, |
---|
1024 | int *pageFrom, int *pageTo) |
---|
1025 | { |
---|
1026 | *minPage = *pageFrom = 1; |
---|
1027 | *maxPage = *pageTo = m_layout->pages; |
---|
1028 | } |
---|
1029 | |
---|
1030 | wxString |
---|
1031 | svxPrintout::GetTitle() { |
---|
1032 | return m_title; |
---|
1033 | } |
---|
1034 | |
---|
1035 | bool |
---|
1036 | svxPrintout::HasPage(int pageNum) { |
---|
1037 | return (pageNum <= m_layout->pages); |
---|
1038 | } |
---|
1039 | |
---|
1040 | void |
---|
1041 | svxPrintout::OnBeginPrinting() { |
---|
1042 | FILE *fh_list[4]; |
---|
1043 | |
---|
1044 | FILE **pfh = fh_list; |
---|
1045 | FILE *fh; |
---|
1046 | const char *pth_cfg; |
---|
1047 | char *print_ini; |
---|
1048 | |
---|
1049 | /* ini files searched in this order: |
---|
1050 | * ~/.survex/print.ini [unix only] |
---|
1051 | * /etc/survex/print.ini [unix only] |
---|
1052 | * <support file directory>/myprint.ini [not unix] |
---|
1053 | * <support file directory>/print.ini [must exist] |
---|
1054 | */ |
---|
1055 | |
---|
1056 | #if (OS==UNIX) |
---|
1057 | pth_cfg = getenv("HOME"); |
---|
1058 | if (pth_cfg) { |
---|
1059 | fh = fopenWithPthAndExt(pth_cfg, ".survex/print."EXT_INI, NULL, |
---|
1060 | "rb", NULL); |
---|
1061 | if (fh) *pfh++ = fh; |
---|
1062 | } |
---|
1063 | pth_cfg = msg_cfgpth(); |
---|
1064 | fh = fopenWithPthAndExt(NULL, "/etc/survex/print."EXT_INI, NULL, "rb", |
---|
1065 | NULL); |
---|
1066 | if (fh) *pfh++ = fh; |
---|
1067 | #else |
---|
1068 | pth_cfg = msg_cfgpth(); |
---|
1069 | print_ini = add_ext("myprint", EXT_INI); |
---|
1070 | fh = fopenWithPthAndExt(pth_cfg, print_ini, NULL, "rb", NULL); |
---|
1071 | if (fh) *pfh++ = fh; |
---|
1072 | #endif |
---|
1073 | print_ini = add_ext("print", EXT_INI); |
---|
1074 | fh = fopenWithPthAndExt(pth_cfg, print_ini, NULL, "rb", NULL); |
---|
1075 | if (!fh) fatalerror(/*Couldn't open data file `%s'*/24, print_ini); |
---|
1076 | *pfh++ = fh; |
---|
1077 | *pfh = NULL; |
---|
1078 | Init(pfh, false); |
---|
1079 | for (pfh = fh_list; *pfh; pfh++) (void)fclose(*pfh); |
---|
1080 | Pre(); |
---|
1081 | m_layout->footer = msgPerm(/*Survey `%s' Page %d (of %d) Processed on %s*/167); |
---|
1082 | } |
---|
1083 | |
---|
1084 | void |
---|
1085 | svxPrintout::OnEndPrinting() { |
---|
1086 | delete(font_labels); |
---|
1087 | delete(font_default); |
---|
1088 | delete(pen_frame); |
---|
1089 | delete(pen_leg); |
---|
1090 | delete(pen_surface_leg); |
---|
1091 | delete(pen_cross); |
---|
1092 | } |
---|
1093 | |
---|
1094 | |
---|
1095 | // prcore -> wx.grafx (calls to move pens around and stuff - low level) |
---|
1096 | // this seems to have been done... |
---|
1097 | |
---|
1098 | |
---|
1099 | |
---|
1100 | static border clip; |
---|
1101 | |
---|
1102 | |
---|
1103 | int |
---|
1104 | svxPrintout::check_intersection(long x_p, long y_p) |
---|
1105 | { |
---|
1106 | #define U 1 |
---|
1107 | #define D 2 |
---|
1108 | #define L 4 |
---|
1109 | #define R 8 |
---|
1110 | int mask_p = 0, mask_t = 0; |
---|
1111 | if (x_p < 0) |
---|
1112 | mask_p = L; |
---|
1113 | else if (x_p > xpPageWidth) |
---|
1114 | mask_p = R; |
---|
1115 | |
---|
1116 | if (y_p < 0) |
---|
1117 | mask_p |= D; |
---|
1118 | else if (y_p > ypPageDepth) |
---|
1119 | mask_p |= U; |
---|
1120 | |
---|
1121 | if (x_t < 0) |
---|
1122 | mask_t = L; |
---|
1123 | else if (x_t > xpPageWidth) |
---|
1124 | mask_t = R; |
---|
1125 | |
---|
1126 | if (y_t < 0) |
---|
1127 | mask_t |= D; |
---|
1128 | else if (y_t > ypPageDepth) |
---|
1129 | mask_t |= U; |
---|
1130 | |
---|
1131 | #if 0 |
---|
1132 | /* approximation to correct answer */ |
---|
1133 | return !(mask_t & mask_p); |
---|
1134 | #else |
---|
1135 | /* One end of the line is on the page */ |
---|
1136 | if (!mask_t || !mask_p) return 1; |
---|
1137 | |
---|
1138 | /* whole line is above, left, right, or below page */ |
---|
1139 | if (mask_t & mask_p) return 0; |
---|
1140 | |
---|
1141 | if (mask_t == 0) mask_t = mask_p; |
---|
1142 | if (mask_t & U) { |
---|
1143 | double v = (double)(y_p - ypPageDepth) / (y_p - y_t); |
---|
1144 | return v >= 0 && v <= 1; |
---|
1145 | } |
---|
1146 | if (mask_t & D) { |
---|
1147 | double v = (double)y_p / (y_p - y_t); |
---|
1148 | return v >= 0 && v <= 1; |
---|
1149 | } |
---|
1150 | if (mask_t & R) { |
---|
1151 | double v = (double)(x_p - xpPageWidth) / (x_p - x_t); |
---|
1152 | return v >= 0 && v <= 1; |
---|
1153 | } |
---|
1154 | SVX_ASSERT(mask_t & L); |
---|
1155 | { |
---|
1156 | double v = (double)x_p / (x_p - x_t); |
---|
1157 | return v >= 0 && v <= 1; |
---|
1158 | } |
---|
1159 | #endif |
---|
1160 | #undef U |
---|
1161 | #undef D |
---|
1162 | #undef L |
---|
1163 | #undef R |
---|
1164 | } |
---|
1165 | |
---|
1166 | void |
---|
1167 | svxPrintout::MoveTo(long x, long y) |
---|
1168 | { |
---|
1169 | x_t = x_offset + x - clip.x_min; |
---|
1170 | y_t = y_offset + clip.y_max - y; |
---|
1171 | } |
---|
1172 | |
---|
1173 | void |
---|
1174 | svxPrintout::DrawTo(long x, long y) |
---|
1175 | { |
---|
1176 | long x_p = x_t, y_p = y_t; |
---|
1177 | x_t = x_offset + x - clip.x_min; |
---|
1178 | y_t = y_offset + clip.y_max - y; |
---|
1179 | if (cur_pass != -1) { |
---|
1180 | pdc->DrawLine(x_p,y_p,x_t,y_t); |
---|
1181 | } else { |
---|
1182 | if (check_intersection(x_p, y_p)) fBlankPage = fFalse; |
---|
1183 | } |
---|
1184 | } |
---|
1185 | |
---|
1186 | #define POINTS_PER_INCH 72.0 |
---|
1187 | #define POINTS_PER_MM (POINTS_PER_INCH / MM_PER_INCH) |
---|
1188 | #define PWX_CROSS_SIZE (int)(2 * m_layout->scX / POINTS_PER_MM) |
---|
1189 | |
---|
1190 | void |
---|
1191 | svxPrintout::DrawCross(long x, long y) |
---|
1192 | { |
---|
1193 | if (cur_pass != -1) { |
---|
1194 | MoveTo(x - PWX_CROSS_SIZE, y - PWX_CROSS_SIZE); |
---|
1195 | DrawTo(x + PWX_CROSS_SIZE, y + PWX_CROSS_SIZE); |
---|
1196 | MoveTo(x + PWX_CROSS_SIZE, y - PWX_CROSS_SIZE); |
---|
1197 | DrawTo(x - PWX_CROSS_SIZE, y + PWX_CROSS_SIZE); |
---|
1198 | MoveTo(x, y); |
---|
1199 | } else { |
---|
1200 | if ((x + PWX_CROSS_SIZE > clip.x_min && |
---|
1201 | x - PWX_CROSS_SIZE < clip.x_max) || |
---|
1202 | (y + PWX_CROSS_SIZE > clip.y_min && |
---|
1203 | y - PWX_CROSS_SIZE < clip.y_max)) { |
---|
1204 | fBlankPage = fFalse; |
---|
1205 | } |
---|
1206 | } |
---|
1207 | } |
---|
1208 | |
---|
1209 | void |
---|
1210 | svxPrintout::SetFont(int fontcode) |
---|
1211 | { |
---|
1212 | switch (fontcode) { |
---|
1213 | case PR_FONT_DEFAULT: |
---|
1214 | current_font = font_default; |
---|
1215 | break; |
---|
1216 | case PR_FONT_LABELS: |
---|
1217 | current_font = font_labels; |
---|
1218 | break; |
---|
1219 | default: |
---|
1220 | BUG("unknown font code"); |
---|
1221 | } |
---|
1222 | } |
---|
1223 | |
---|
1224 | void |
---|
1225 | svxPrintout::SetColour(int colourcode) |
---|
1226 | { |
---|
1227 | switch (colourcode) { |
---|
1228 | case PR_COLOUR_TEXT: |
---|
1229 | pdc->SetTextForeground(colour_text); |
---|
1230 | break; |
---|
1231 | case PR_COLOUR_LABELS: |
---|
1232 | pdc->SetTextForeground(colour_labels); |
---|
1233 | pdc->SetBackgroundMode(wxTRANSPARENT); |
---|
1234 | break; |
---|
1235 | case PR_COLOUR_FRAME: |
---|
1236 | pdc->SetPen(*pen_frame); |
---|
1237 | break; |
---|
1238 | case PR_COLOUR_LEG: |
---|
1239 | pdc->SetPen(*pen_leg); |
---|
1240 | break; |
---|
1241 | case PR_COLOUR_CROSS: |
---|
1242 | pdc->SetPen(*pen_cross); |
---|
1243 | break; |
---|
1244 | case PR_COLOUR_SURFACE_LEG: |
---|
1245 | pdc->SetPen(*pen_surface_leg); |
---|
1246 | break; |
---|
1247 | default: |
---|
1248 | BUG("unknown colour code"); |
---|
1249 | } |
---|
1250 | } |
---|
1251 | |
---|
1252 | void |
---|
1253 | svxPrintout::WriteString(const char *s) |
---|
1254 | { |
---|
1255 | double xsc, ysc; |
---|
1256 | pdc->GetUserScale(&xsc, &ysc); |
---|
1257 | pdc->SetUserScale(xsc * font_scaling_x, ysc * font_scaling_y); |
---|
1258 | pdc->SetFont(*current_font); |
---|
1259 | int w, h; |
---|
1260 | if (cur_pass != -1) { |
---|
1261 | pdc->GetTextExtent("My", &w, &h); |
---|
1262 | pdc->DrawText(s, |
---|
1263 | long(x_t / font_scaling_x), |
---|
1264 | long(y_t / font_scaling_y) - h); |
---|
1265 | } else { |
---|
1266 | pdc->GetTextExtent(s, &w, &h); |
---|
1267 | if ((y_t + h > 0 && y_t - h < clip.y_max - clip.y_min) || |
---|
1268 | (x_t < clip.x_max - clip.x_min && x_t + w > 0)) { |
---|
1269 | fBlankPage = fFalse; |
---|
1270 | } |
---|
1271 | } |
---|
1272 | pdc->SetUserScale(xsc, ysc); |
---|
1273 | } |
---|
1274 | |
---|
1275 | void |
---|
1276 | svxPrintout::DrawEllipse(long x, long y, long r, long R) |
---|
1277 | { |
---|
1278 | /* Don't need to check in first-pass - circle is only used in title box */ |
---|
1279 | if (cur_pass != -1) { |
---|
1280 | x_t = x_offset + x - clip.x_min; |
---|
1281 | y_t = y_offset + clip.y_max - y; |
---|
1282 | pdc->SetBrush(*wxTRANSPARENT_BRUSH); |
---|
1283 | pdc->DrawEllipse(x_t - r, y_t - R, 2 * r, 2 * R); |
---|
1284 | } |
---|
1285 | } |
---|
1286 | |
---|
1287 | void |
---|
1288 | svxPrintout::SolidRectangle(long x, long y, long w, long h) |
---|
1289 | { |
---|
1290 | long X = x_offset + x - clip.x_min; |
---|
1291 | long Y = y_offset + clip.y_max - y; |
---|
1292 | pdc->SetBrush(*wxBLACK_BRUSH); |
---|
1293 | pdc->DrawRectangle(X, Y - h, w, h); |
---|
1294 | } |
---|
1295 | |
---|
1296 | int |
---|
1297 | svxPrintout::Charset(void) |
---|
1298 | { |
---|
1299 | return CHARSET_ISO_8859_1; |
---|
1300 | } |
---|
1301 | |
---|
1302 | int |
---|
1303 | svxPrintout::Pre() |
---|
1304 | { |
---|
1305 | font_labels = new wxFont(fontsize_labels,wxDEFAULT,wxNORMAL,wxNORMAL,false,fontname_labels,wxFONTENCODING_ISO8859_1); |
---|
1306 | font_default = new wxFont(fontsize,wxDEFAULT,wxNORMAL,wxNORMAL,false,fontname,wxFONTENCODING_ISO8859_1); |
---|
1307 | current_font = font_default; |
---|
1308 | pen_leg = new wxPen(colour_leg,0,wxSOLID); |
---|
1309 | pen_surface_leg = new wxPen(colour_surface_leg,0,wxSOLID); |
---|
1310 | pen_cross = new wxPen(colour_cross,0,wxSOLID); |
---|
1311 | pen_frame = new wxPen(colour_frame,0,wxSOLID); |
---|
1312 | return 1; /* only need 1 pass */ |
---|
1313 | } |
---|
1314 | |
---|
1315 | void |
---|
1316 | svxPrintout::NewPage(int pg, int pagesX, int pagesY) |
---|
1317 | { |
---|
1318 | int x, y; |
---|
1319 | x = (pg - 1) % pagesX; |
---|
1320 | y = pagesY - 1 - ((pg - 1) / pagesX); |
---|
1321 | |
---|
1322 | clip.x_min = (long)x * xpPageWidth; |
---|
1323 | clip.y_min = (long)y * ypPageDepth; |
---|
1324 | clip.x_max = clip.x_min + xpPageWidth; /* dm/pcl/ps had -1; */ |
---|
1325 | clip.y_max = clip.y_min + ypPageDepth; /* dm/pcl/ps had -1; */ |
---|
1326 | |
---|
1327 | //we have to write the footer here. PostScript is being weird. Really weird. |
---|
1328 | pdc->SetFont(*font_labels); |
---|
1329 | MoveTo((long)(6 * m_layout->scX) + clip.x_min, |
---|
1330 | clip.y_min - (long)(7 * m_layout->scY)); |
---|
1331 | char szFooter[256]; |
---|
1332 | sprintf(szFooter, m_layout->footer, m_layout->title, pg, |
---|
1333 | m_layout->pagesX * m_layout->pagesY,m_layout->datestamp); |
---|
1334 | WriteString(szFooter); |
---|
1335 | pdc->DestroyClippingRegion(); |
---|
1336 | pdc->SetClippingRegion(x_offset, y_offset,xpPageWidth+1, ypPageDepth+1); |
---|
1337 | drawticks(clip, (int)(9 * m_layout->scX / POINTS_PER_MM), x, y); |
---|
1338 | } |
---|
1339 | |
---|
1340 | void |
---|
1341 | svxPrintout::ShowPage(const char *szPageDetails) |
---|
1342 | { |
---|
1343 | } |
---|
1344 | |
---|
1345 | static wxColour |
---|
1346 | to_rgb(const char *var, char *val) |
---|
1347 | { |
---|
1348 | unsigned long rgb; |
---|
1349 | if (!val) return *wxBLACK; |
---|
1350 | rgb = as_colour(var, val); |
---|
1351 | return wxColour((rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff); |
---|
1352 | } |
---|
1353 | |
---|
1354 | /* Initialise printer routines */ |
---|
1355 | char * |
---|
1356 | svxPrintout::Init(FILE **fh_list, bool fCalibrate) |
---|
1357 | { |
---|
1358 | static const char *vars[] = { |
---|
1359 | "like", |
---|
1360 | "font_size_labels", |
---|
1361 | "colour_text", |
---|
1362 | "colour_labels", |
---|
1363 | "colour_frame", |
---|
1364 | "colour_legs", |
---|
1365 | "colour_crosses", |
---|
1366 | "colour_surface_legs", |
---|
1367 | NULL |
---|
1368 | }; |
---|
1369 | char **vals; |
---|
1370 | |
---|
1371 | fCalibrate = fCalibrate; /* suppress unused argument warning */ |
---|
1372 | |
---|
1373 | vals = ini_read_hier(fh_list, "win", vars); |
---|
1374 | fontsize_labels = 10; |
---|
1375 | if (vals[1]) fontsize_labels = as_int(vars[1], vals[1], 1, INT_MAX); |
---|
1376 | fontsize = 10; |
---|
1377 | |
---|
1378 | colour_text = colour_labels = colour_frame = colour_leg = colour_cross = colour_surface_leg = *wxBLACK; |
---|
1379 | if (vals[2]) colour_text = to_rgb(vars[2], vals[2]); |
---|
1380 | if (vals[3]) colour_labels = to_rgb(vars[3], vals[3]); |
---|
1381 | if (vals[4]) colour_frame = to_rgb(vars[4], vals[4]); |
---|
1382 | if (vals[5]) colour_leg = to_rgb(vars[5], vals[5]); |
---|
1383 | if (vals[6]) colour_cross = to_rgb(vars[6], vals[6]); |
---|
1384 | if (vals[7]) colour_surface_leg = to_rgb(vars[7], vals[7]); |
---|
1385 | m_layout->scX = 1; |
---|
1386 | m_layout->scY = 1; |
---|
1387 | return NULL; |
---|
1388 | } |
---|