~cern-kicad/kicad/kicad-pns-tom

« back to all changes in this revision

Viewing changes to common/title_block_shapes_gost.cpp

  • Committer: Maciej Suminski
  • Date: 2013-08-02 13:57:24 UTC
  • mfrom: (4024.1.238 kicad)
  • mto: This revision was merged to the branch mainline in revision 4221.
  • Revision ID: maciej.suminski@cern.ch-20130802135724-gix6orezshkukodv
Upstream merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * @file title_block_shape_gost.h
3
 
 * @brief description of graphic items and texts to build a title block
4
 
 * using GOST standard
5
 
 */
6
 
 
7
 
/*
8
 
 * This file creates a lot of structures to define the shape of a title block
9
 
 * and frame references
10
 
 */
11
 
 
12
 
/*
13
 
 * This program source code file is part of KiCad, a free EDA CAD application.
14
 
 *
15
 
 * Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors.
16
 
 *
17
 
 *
18
 
 * This program is free software; you can redistribute it and/or
19
 
 * modify it under the terms of the GNU General Public License
20
 
 * as published by the Free Software Foundation; either version 2
21
 
 * of the License, or (at your option) any later version.
22
 
 *
23
 
 * This program is distributed in the hope that it will be useful,
24
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
 
 * GNU General Public License for more details.
27
 
 *
28
 
 * You should have received a copy of the GNU General Public License
29
 
 * along with this program; if not, you may find one here:
30
 
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
31
 
 * or you may search the http://www.gnu.org website for the version 2 license,
32
 
 * or you may write to the Free Software Foundation, Inc.,
33
 
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
34
 
 */
35
 
 
36
 
#include <fctsys.h>
37
 
#include <drawtxt.h>
38
 
#include <appl_wxstruct.h>
39
 
#include <worksheet.h>
40
 
#include <class_title_block.h>
41
 
#include <build_version.h>
42
 
#include <worksheet_shape_builder.h>
43
 
 
44
 
#define TEXTSIZE        100             // worksheet text size
45
 
 
46
 
struct Ki_WorkSheetData
47
 
{
48
 
public:
49
 
    int               m_Type;
50
 
    Ki_WorkSheetData* Pnext;
51
 
    int               m_Posx, m_Posy;
52
 
    int               m_Endx, m_Endy;
53
 
    const wxChar*     m_TextBase;
54
 
    int               m_Flags;
55
 
};
56
 
 
57
 
// Work sheet structure type definitions.
58
 
enum TypeKi_WorkSheetData {
59
 
    WS_OSN,
60
 
    WS_TONK,
61
 
    WS_TEXT,
62
 
    WS_TEXTL
63
 
};
64
 
 
65
 
extern Ki_WorkSheetData WS_Osn1_Line1;
66
 
extern Ki_WorkSheetData WS_Osn1_Line2;
67
 
extern Ki_WorkSheetData WS_Osn1_Line3;
68
 
extern Ki_WorkSheetData WS_Osn1_Line4;
69
 
extern Ki_WorkSheetData WS_Osn1_Line5;
70
 
extern Ki_WorkSheetData WS_Osn1_Line6;
71
 
extern Ki_WorkSheetData WS_Osn1_Line7;
72
 
extern Ki_WorkSheetData WS_Osn1_Line8;
73
 
extern Ki_WorkSheetData WS_Osn1_Line9;
74
 
extern Ki_WorkSheetData WS_Osn1_Line10;
75
 
extern Ki_WorkSheetData WS_Osn1_Line11;
76
 
extern Ki_WorkSheetData WS_Osn1_Line12;
77
 
extern Ki_WorkSheetData WS_Osn1_Line13;
78
 
extern Ki_WorkSheetData WS_Osn1_Line14;
79
 
extern Ki_WorkSheetData WS_Osn1_Line15;
80
 
extern Ki_WorkSheetData WS_Osn1_Line16;
81
 
extern Ki_WorkSheetData WS_Osn1_Line17;
82
 
extern Ki_WorkSheetData WS_Osn1_Line18;
83
 
extern Ki_WorkSheetData WS_Osn1_Line19;
84
 
extern Ki_WorkSheetData WS_Osn1_Line20;
85
 
extern Ki_WorkSheetData WS_Osn1_Line21;
86
 
extern Ki_WorkSheetData WS_Osn1_Line22;
87
 
extern Ki_WorkSheetData WS_Osn1_Line23;
88
 
extern Ki_WorkSheetData WS_Osn1_Line24;
89
 
extern Ki_WorkSheetData WS_Osn1_Line25;
90
 
extern Ki_WorkSheetData WS_Osn1_Line26;
91
 
extern Ki_WorkSheetData WS_Osn1_Line27;
92
 
 
93
 
extern Ki_WorkSheetData WS_Osn1_Text1;
94
 
extern Ki_WorkSheetData WS_Osn1_Text2;
95
 
extern Ki_WorkSheetData WS_Osn1_Text3;
96
 
extern Ki_WorkSheetData WS_Osn1_Text4;
97
 
extern Ki_WorkSheetData WS_Osn1_Text5;
98
 
extern Ki_WorkSheetData WS_Osn1_Text6;
99
 
extern Ki_WorkSheetData WS_Osn1_Text7;
100
 
extern Ki_WorkSheetData WS_Osn1_Text8;
101
 
extern Ki_WorkSheetData WS_Osn1_Text9;
102
 
extern Ki_WorkSheetData WS_Osn1_Text10;
103
 
extern Ki_WorkSheetData WS_Osn1_Text11;
104
 
extern Ki_WorkSheetData WS_Osn1_Text12;
105
 
extern Ki_WorkSheetData WS_Osn1_Text13;
106
 
extern Ki_WorkSheetData WS_Osn1_Text14;
107
 
extern Ki_WorkSheetData WS_Osn1_Text15;
108
 
extern Ki_WorkSheetData WS_Osn1_Text16;
109
 
extern Ki_WorkSheetData WS_Osn1_Text17;
110
 
 
111
 
extern Ki_WorkSheetData WS_Osn2a_Line1;
112
 
extern Ki_WorkSheetData WS_Osn2a_Line2;
113
 
extern Ki_WorkSheetData WS_Osn2a_Line3;
114
 
extern Ki_WorkSheetData WS_Osn2a_Line4;
115
 
extern Ki_WorkSheetData WS_Osn2a_Line5;
116
 
extern Ki_WorkSheetData WS_Osn2a_Line6;
117
 
extern Ki_WorkSheetData WS_Osn2a_Line7;
118
 
extern Ki_WorkSheetData WS_Osn2a_Line8;
119
 
extern Ki_WorkSheetData WS_Osn2a_Line9;
120
 
extern Ki_WorkSheetData WS_Osn2a_Line10;
121
 
extern Ki_WorkSheetData WS_Osn2a_Line11;
122
 
 
123
 
extern Ki_WorkSheetData WS_Osn2a_Text1;
124
 
extern Ki_WorkSheetData WS_Osn2a_Text2;
125
 
extern Ki_WorkSheetData WS_Osn2a_Text3;
126
 
extern Ki_WorkSheetData WS_Osn2a_Text4;
127
 
extern Ki_WorkSheetData WS_Osn2a_Text5;
128
 
extern Ki_WorkSheetData WS_Osn2a_Text6;
129
 
extern Ki_WorkSheetData WS_Osn2a_Text7;
130
 
extern Ki_WorkSheetData WS_Osn2a_Text8;
131
 
 
132
 
extern Ki_WorkSheetData WS_DopLeft_Line1;
133
 
extern Ki_WorkSheetData WS_DopLeft_Line2;
134
 
extern Ki_WorkSheetData WS_DopLeft_Line3;
135
 
extern Ki_WorkSheetData WS_DopLeft_Line4;
136
 
extern Ki_WorkSheetData WS_DopLeft_Line5;
137
 
extern Ki_WorkSheetData WS_DopLeft_Line6;
138
 
extern Ki_WorkSheetData WS_DopLeft_Line7;
139
 
extern Ki_WorkSheetData WS_DopLeft_Line8;
140
 
extern Ki_WorkSheetData WS_DopLeft_Line9;
141
 
extern Ki_WorkSheetData WS_DopLeft_Line10;
142
 
extern Ki_WorkSheetData WS_DopLeft_Line11;
143
 
extern Ki_WorkSheetData WS_DopLeft_Line12;
144
 
extern Ki_WorkSheetData WS_DopLeft_Line13;
145
 
extern Ki_WorkSheetData WS_DopLeft_Line14;
146
 
 
147
 
extern Ki_WorkSheetData WS_DopLeft_Text1;
148
 
extern Ki_WorkSheetData WS_DopLeft_Text2;
149
 
extern Ki_WorkSheetData WS_DopLeft_Text3;
150
 
extern Ki_WorkSheetData WS_DopLeft_Text4;
151
 
extern Ki_WorkSheetData WS_DopLeft_Text5;
152
 
extern Ki_WorkSheetData WS_DopLeft_Text6;
153
 
extern Ki_WorkSheetData WS_DopLeft_Text7;
154
 
 
155
 
extern Ki_WorkSheetData WS_DopTop_Line1;
156
 
extern Ki_WorkSheetData WS_DopTop_Line2;
157
 
extern Ki_WorkSheetData WS_DopTop_Line3;
158
 
extern Ki_WorkSheetData WS_DopTop_Line4;
159
 
extern Ki_WorkSheetData WS_DopTop_Line5;
160
 
extern Ki_WorkSheetData WS_DopTop_Line6;
161
 
 
162
 
 
163
 
// Center - right bottom corner
164
 
Ki_WorkSheetData    WS_Osn1_Line1 =
165
 
{
166
 
    WS_OSN,
167
 
    &WS_Osn1_Line2,
168
 
    Mm2mils( 185 ),Mm2mils( 55 ),
169
 
    0,             Mm2mils( 55 ),
170
 
    NULL
171
 
};
172
 
 
173
 
Ki_WorkSheetData    WS_Osn1_Line2 =
174
 
{
175
 
    WS_OSN,
176
 
    &WS_Osn1_Line3,
177
 
    Mm2mils( 120 ),Mm2mils( 40 ),
178
 
    0,             Mm2mils( 40 ),
179
 
    NULL
180
 
};
181
 
 
182
 
Ki_WorkSheetData    WS_Osn1_Line3 =
183
 
{
184
 
    WS_OSN,
185
 
    &WS_Osn1_Line4,
186
 
    Mm2mils( 185 ),Mm2mils( 35 ),
187
 
    Mm2mils( 120 ),Mm2mils( 35 ),
188
 
    NULL
189
 
};
190
 
 
191
 
Ki_WorkSheetData    WS_Osn1_Line4 =
192
 
{
193
 
    WS_OSN,
194
 
    &WS_Osn1_Line5,
195
 
    Mm2mils( 50 ), Mm2mils( 35 ),
196
 
    0,             Mm2mils( 35 ),
197
 
    NULL
198
 
};
199
 
 
200
 
Ki_WorkSheetData    WS_Osn1_Line5 =
201
 
{
202
 
    WS_OSN,
203
 
    &WS_Osn1_Line6,
204
 
    Mm2mils( 185 ),Mm2mils( 30 ),
205
 
    Mm2mils( 120 ),Mm2mils( 30 ),
206
 
    NULL
207
 
};
208
 
 
209
 
Ki_WorkSheetData    WS_Osn1_Line6 =
210
 
{
211
 
    WS_OSN,
212
 
    &WS_Osn1_Line7,
213
 
    Mm2mils( 50 ), Mm2mils( 20 ),
214
 
    0,             Mm2mils( 20 ),
215
 
    NULL
216
 
};
217
 
 
218
 
Ki_WorkSheetData    WS_Osn1_Line7 =
219
 
{
220
 
    WS_OSN,
221
 
    &WS_Osn1_Line8,
222
 
    Mm2mils( 120 ),Mm2mils( 15 ),
223
 
    0,             Mm2mils( 15 ),
224
 
    NULL
225
 
};
226
 
 
227
 
Ki_WorkSheetData    WS_Osn1_Line8 =
228
 
{
229
 
    WS_OSN,
230
 
    &WS_Osn1_Line9,
231
 
    Mm2mils( 185 ),Mm2mils( 55 ),
232
 
    Mm2mils( 185 ),             0,
233
 
    NULL
234
 
};
235
 
 
236
 
Ki_WorkSheetData    WS_Osn1_Line9 =
237
 
{
238
 
    WS_OSN,
239
 
    &WS_Osn1_Line10,
240
 
    Mm2mils( 178 ), Mm2mils( 55 ),
241
 
    Mm2mils( 178 ), Mm2mils( 30 ),
242
 
    NULL
243
 
};
244
 
 
245
 
Ki_WorkSheetData    WS_Osn1_Line10 =
246
 
{
247
 
    WS_OSN,
248
 
    &WS_Osn1_Line11,
249
 
    Mm2mils( 168 ), Mm2mils( 55 ),
250
 
    Mm2mils( 168 ),             0,
251
 
    NULL
252
 
};
253
 
 
254
 
Ki_WorkSheetData    WS_Osn1_Line11 =
255
 
{
256
 
    WS_OSN,
257
 
    &WS_Osn1_Line12,
258
 
    Mm2mils( 145 ), Mm2mils( 55 ),
259
 
    Mm2mils( 145 ),             0,
260
 
    NULL
261
 
};
262
 
 
263
 
Ki_WorkSheetData    WS_Osn1_Line12 =
264
 
{
265
 
    WS_OSN,
266
 
    &WS_Osn1_Line13,
267
 
    Mm2mils( 130 ), Mm2mils( 55 ),
268
 
    Mm2mils( 130 ),             0,
269
 
    NULL
270
 
};
271
 
 
272
 
Ki_WorkSheetData    WS_Osn1_Line13 =
273
 
{
274
 
    WS_OSN,
275
 
    &WS_Osn1_Line14,
276
 
    Mm2mils( 120 ), Mm2mils( 55 ),
277
 
    Mm2mils( 120 ),             0,
278
 
    NULL
279
 
};
280
 
 
281
 
Ki_WorkSheetData    WS_Osn1_Line14 =
282
 
{
283
 
    WS_OSN,
284
 
    &WS_Osn1_Line15,
285
 
    Mm2mils( 50 ),  Mm2mils( 40 ),
286
 
    Mm2mils( 50 ),             0,
287
 
    NULL
288
 
};
289
 
 
290
 
Ki_WorkSheetData    WS_Osn1_Line15 =
291
 
{
292
 
    WS_OSN,
293
 
    &WS_Osn1_Line16,
294
 
    Mm2mils( 35 ),  Mm2mils( 40 ),
295
 
    Mm2mils( 35 ),  Mm2mils( 20 ),
296
 
    NULL
297
 
};
298
 
 
299
 
Ki_WorkSheetData    WS_Osn1_Line16 =
300
 
{
301
 
    WS_OSN,
302
 
    &WS_Osn1_Line17,
303
 
    Mm2mils( 30 ),  Mm2mils( 20 ),
304
 
    Mm2mils( 30 ),  Mm2mils( 15 ),
305
 
    NULL
306
 
};
307
 
 
308
 
Ki_WorkSheetData    WS_Osn1_Line17 =
309
 
{
310
 
    WS_OSN,
311
 
    &WS_Osn1_Line18,
312
 
    Mm2mils( 18 ),  Mm2mils( 40 ),
313
 
    Mm2mils( 18 ),  Mm2mils( 20 ),
314
 
    NULL
315
 
};
316
 
 
317
 
Ki_WorkSheetData    WS_Osn1_Line18 =
318
 
{
319
 
    WS_TONK,
320
 
    &WS_Osn1_Line19,
321
 
    Mm2mils( 185 ), Mm2mils( 50 ),
322
 
    Mm2mils( 120 ), Mm2mils( 50 ),
323
 
    NULL
324
 
};
325
 
 
326
 
Ki_WorkSheetData    WS_Osn1_Line19 =
327
 
{
328
 
    WS_TONK,
329
 
    &WS_Osn1_Line20,
330
 
    Mm2mils( 185 ), Mm2mils( 45 ),
331
 
    Mm2mils( 120 ), Mm2mils( 45 ),
332
 
    NULL
333
 
};
334
 
 
335
 
Ki_WorkSheetData    WS_Osn1_Line20 =
336
 
{
337
 
    WS_TONK,
338
 
    &WS_Osn1_Line21,
339
 
    Mm2mils( 185 ), Mm2mils( 40 ),
340
 
    Mm2mils( 120 ), Mm2mils( 40 ),
341
 
    NULL
342
 
};
343
 
 
344
 
Ki_WorkSheetData    WS_Osn1_Line21 =
345
 
{
346
 
    WS_TONK,
347
 
    &WS_Osn1_Line22,
348
 
    Mm2mils( 185 ), Mm2mils( 25 ),
349
 
    Mm2mils( 120 ), Mm2mils( 25 ),
350
 
    NULL
351
 
};
352
 
 
353
 
Ki_WorkSheetData    WS_Osn1_Line22 =
354
 
{
355
 
    WS_TONK,
356
 
    &WS_Osn1_Line23,
357
 
    Mm2mils( 185 ), Mm2mils( 20 ),
358
 
    Mm2mils( 120 ), Mm2mils( 20 ),
359
 
    NULL
360
 
};
361
 
 
362
 
Ki_WorkSheetData    WS_Osn1_Line23 =
363
 
{
364
 
    WS_TONK,
365
 
    &WS_Osn1_Line24,
366
 
    Mm2mils( 185 ), Mm2mils( 15 ),
367
 
    Mm2mils( 120 ), Mm2mils( 15 ),
368
 
    NULL
369
 
};
370
 
 
371
 
Ki_WorkSheetData    WS_Osn1_Line24 =
372
 
{
373
 
    WS_TONK,
374
 
    &WS_Osn1_Line25,
375
 
    Mm2mils( 185 ), Mm2mils( 10 ),
376
 
    Mm2mils( 120 ), Mm2mils( 10 ),
377
 
    NULL
378
 
};
379
 
 
380
 
Ki_WorkSheetData    WS_Osn1_Line25 =
381
 
{
382
 
    WS_TONK,
383
 
    &WS_Osn1_Line26,
384
 
    Mm2mils( 185 ), Mm2mils( 5 ),
385
 
    Mm2mils( 120 ), Mm2mils( 5 ),
386
 
    NULL
387
 
};
388
 
 
389
 
Ki_WorkSheetData    WS_Osn1_Line26 =
390
 
{
391
 
    WS_TONK,
392
 
    &WS_Osn1_Line27,
393
 
    Mm2mils( 45 ),  Mm2mils( 35 ),
394
 
    Mm2mils( 45 ),  Mm2mils( 20 ),
395
 
    NULL
396
 
};
397
 
 
398
 
Ki_WorkSheetData    WS_Osn1_Line27 =
399
 
{
400
 
    WS_TONK,
401
 
    &WS_Osn1_Text1,
402
 
    Mm2mils( 40 ), Mm2mils( 35 ),
403
 
    Mm2mils( 40 ), Mm2mils( 20 ),
404
 
    NULL
405
 
};
406
 
 
407
 
Ki_WorkSheetData    WS_Osn1_Text1 =
408
 
{
409
 
    WS_TEXT,
410
 
    &WS_Osn1_Text2,
411
 
    Mm2mils( 181.5 ),Mm2mils( 32.5 ),
412
 
    0,                              0,
413
 
    wxT( "Изм." )
414
 
};
415
 
 
416
 
Ki_WorkSheetData    WS_Osn1_Text2 =
417
 
{
418
 
    WS_TEXTL,
419
 
    &WS_Osn1_Text3,
420
 
    Mm2mils( 184 ),  Mm2mils( 27.5 ),
421
 
    0,                              0,
422
 
    wxT( "Разраб." )
423
 
};
424
 
 
425
 
Ki_WorkSheetData    WS_Osn1_Text3 =
426
 
{
427
 
    WS_TEXTL,
428
 
    &WS_Osn1_Text4,
429
 
    Mm2mils( 184 ),Mm2mils( 22.5 ),
430
 
    0,                            0,
431
 
    wxT( "Пров." )
432
 
};
433
 
 
434
 
Ki_WorkSheetData    WS_Osn1_Text4 =
435
 
{
436
 
    WS_TEXTL,
437
 
    &WS_Osn1_Text5,
438
 
    Mm2mils( 184 ),   Mm2mils( 17.5 ),
439
 
    0,                               0,
440
 
    wxT( "Т.контр." )
441
 
};
442
 
 
443
 
Ki_WorkSheetData    WS_Osn1_Text5 =
444
 
{
445
 
    WS_TEXTL,
446
 
    &WS_Osn1_Text6,
447
 
    Mm2mils( 184 ),   Mm2mils( 7.5 ),
448
 
    0,                              0,
449
 
    wxT( "Н.контр." )
450
 
};
451
 
 
452
 
Ki_WorkSheetData    WS_Osn1_Text6 =
453
 
{
454
 
    WS_TEXTL,
455
 
    &WS_Osn1_Text7,
456
 
    Mm2mils( 184 ),Mm2mils( 2.5 ),
457
 
    0,                           0,
458
 
    wxT( "Утв." )
459
 
};
460
 
 
461
 
Ki_WorkSheetData    WS_Osn1_Text7 =
462
 
{
463
 
    WS_TEXT,
464
 
    &WS_Osn1_Text8,
465
 
    Mm2mils( 173 ),Mm2mils( 32.5 ),
466
 
    0,                            0,
467
 
    wxT( "Лист" )
468
 
};
469
 
 
470
 
Ki_WorkSheetData    WS_Osn1_Text8 =
471
 
{
472
 
    WS_TEXT,
473
 
    &WS_Osn1_Text9,
474
 
    Mm2mils( 156.5 ), Mm2mils( 32.5 ),
475
 
    0,                               0,
476
 
    wxT( "N докум." )
477
 
};
478
 
 
479
 
Ki_WorkSheetData    WS_Osn1_Text9 =
480
 
{
481
 
    WS_TEXT,
482
 
    &WS_Osn1_Text10,
483
 
    Mm2mils( 137.5 ),Mm2mils( 32.5 ),
484
 
    0,                              0,
485
 
    wxT( "Подп." )
486
 
};
487
 
 
488
 
Ki_WorkSheetData    WS_Osn1_Text10 =
489
 
{
490
 
    WS_TEXT,
491
 
    &WS_Osn1_Text11,
492
 
    Mm2mils( 125 ), Mm2mils( 32.5 ),
493
 
    0,                            0,
494
 
    wxT( "Дата" )
495
 
};
496
 
 
497
 
Ki_WorkSheetData    WS_Osn1_Text11 =
498
 
{
499
 
    WS_TEXT,
500
 
    &WS_Osn1_Text12,
501
 
    Mm2mils( 42.5 ),Mm2mils( 37.5 ),
502
 
    0,                             0,
503
 
    wxT( "Лит." )
504
 
};
505
 
 
506
 
Ki_WorkSheetData    WS_Osn1_Text12 =
507
 
{
508
 
    WS_TEXT,
509
 
    &WS_Osn1_Text13,
510
 
    Mm2mils( 26.5 ),Mm2mils( 37.5 ),
511
 
    0,                             0,
512
 
    wxT( "Масса" )
513
 
};
514
 
 
515
 
Ki_WorkSheetData    WS_Osn1_Text13 =
516
 
{
517
 
    WS_TEXT,
518
 
    &WS_Osn1_Text14,
519
 
    Mm2mils( 9 ),    Mm2mils( 37.5 ),
520
 
    0,                           0,
521
 
    wxT( "Масштаб" )
522
 
};
523
 
 
524
 
Ki_WorkSheetData    WS_Osn1_Text14 =
525
 
{
526
 
    WS_TEXTL,
527
 
    &WS_Osn1_Text15,
528
 
    Mm2mils( 49 ),  Mm2mils( 17.5 ),
529
 
    0,                           0,
530
 
    wxT( "Лист" )
531
 
};
532
 
 
533
 
Ki_WorkSheetData    WS_Osn1_Text15 =
534
 
{
535
 
    WS_TEXTL,
536
 
    &WS_Osn1_Text16,
537
 
    Mm2mils( 29 ),  Mm2mils( 17.5 ),
538
 
    0,                           0,
539
 
    wxT( "Листов" )
540
 
};
541
 
 
542
 
Ki_WorkSheetData    WS_Osn1_Text16 =
543
 
{
544
 
    WS_TEXTL,
545
 
    &WS_Osn1_Text17,
546
 
    Mm2mils( 40 ), -Mm2mils( 2.5 ),
547
 
    0,                           0,
548
 
    wxT( "Формат" )
549
 
};
550
 
 
551
 
Ki_WorkSheetData    WS_Osn1_Text17 =
552
 
{
553
 
    WS_TEXTL,
554
 
    NULL,
555
 
    Mm2mils( 110 ),     -Mm2mils( 2.5 ),
556
 
    0,                                0,
557
 
    wxT( "Копировал" )
558
 
};
559
 
 
560
 
Ki_WorkSheetData    WS_Osn2a_Line1 =
561
 
{
562
 
    WS_OSN,
563
 
    &WS_Osn2a_Line2,
564
 
    Mm2mils( 185 ), Mm2mils( 15 ),
565
 
    0,              Mm2mils( 15 ),
566
 
    NULL
567
 
};
568
 
 
569
 
Ki_WorkSheetData    WS_Osn2a_Line2 =
570
 
{
571
 
    WS_OSN,
572
 
    &WS_Osn2a_Line3,
573
 
    Mm2mils( 185 ), Mm2mils( 5 ),
574
 
    Mm2mils( 120 ), Mm2mils( 5 ),
575
 
    NULL
576
 
};
577
 
 
578
 
Ki_WorkSheetData    WS_Osn2a_Line3 =
579
 
{
580
 
    WS_OSN,
581
 
    &WS_Osn2a_Line4,
582
 
    Mm2mils( 10 ),  Mm2mils( 8 ),
583
 
    0,              Mm2mils( 8 ),
584
 
    NULL
585
 
};
586
 
 
587
 
Ki_WorkSheetData    WS_Osn2a_Line4 =
588
 
{
589
 
    WS_OSN,
590
 
    &WS_Osn2a_Line5,
591
 
    Mm2mils( 185 ), Mm2mils( 15 ),
592
 
    Mm2mils( 185 ),             0,
593
 
    NULL
594
 
};
595
 
 
596
 
Ki_WorkSheetData    WS_Osn2a_Line5 =
597
 
{
598
 
    WS_OSN,
599
 
    &WS_Osn2a_Line6,
600
 
    Mm2mils( 178 ), Mm2mils( 15 ),
601
 
    Mm2mils( 178 ),             0,
602
 
    NULL
603
 
};
604
 
 
605
 
Ki_WorkSheetData    WS_Osn2a_Line6 =
606
 
{
607
 
    WS_OSN,
608
 
    &WS_Osn2a_Line7,
609
 
    Mm2mils( 168 ), Mm2mils( 15 ),
610
 
    Mm2mils( 168 ),             0,
611
 
    NULL
612
 
};
613
 
 
614
 
Ki_WorkSheetData    WS_Osn2a_Line7 =
615
 
{
616
 
    WS_OSN,
617
 
    &WS_Osn2a_Line8,
618
 
    Mm2mils( 145 ), Mm2mils( 15 ),
619
 
    Mm2mils( 145 ),             0,
620
 
    NULL
621
 
};
622
 
 
623
 
Ki_WorkSheetData    WS_Osn2a_Line8 =
624
 
{
625
 
    WS_OSN,
626
 
    &WS_Osn2a_Line9,
627
 
    Mm2mils( 130 ), Mm2mils( 15 ),
628
 
    Mm2mils( 130 ),             0,
629
 
    NULL
630
 
};
631
 
 
632
 
Ki_WorkSheetData    WS_Osn2a_Line9 =
633
 
{
634
 
    WS_OSN,
635
 
    &WS_Osn2a_Line10,
636
 
    Mm2mils( 120 ),  Mm2mils( 15 ),
637
 
    Mm2mils( 120 ),             0,
638
 
    NULL
639
 
};
640
 
 
641
 
Ki_WorkSheetData    WS_Osn2a_Line10 =
642
 
{
643
 
    WS_OSN,
644
 
    &WS_Osn2a_Line11,
645
 
    Mm2mils( 10 ),   Mm2mils( 15 ),
646
 
    Mm2mils( 10 ),             0,
647
 
    NULL
648
 
};
649
 
 
650
 
Ki_WorkSheetData    WS_Osn2a_Line11 =
651
 
{
652
 
    WS_TONK,
653
 
    &WS_Osn2a_Text1,
654
 
    Mm2mils( 185 ), Mm2mils( 10 ),
655
 
    Mm2mils( 120 ), Mm2mils( 10 ),
656
 
    NULL
657
 
};
658
 
 
659
 
Ki_WorkSheetData    WS_Osn2a_Text1 =
660
 
{
661
 
    WS_TEXT,
662
 
    &WS_Osn2a_Text2,
663
 
    Mm2mils( 181.5 ),Mm2mils( 2.5 ),
664
 
    0,                             0,
665
 
    wxT( "Изм." )
666
 
};
667
 
 
668
 
Ki_WorkSheetData    WS_Osn2a_Text2 =
669
 
{
670
 
    WS_TEXT,
671
 
    &WS_Osn2a_Text3,
672
 
    Mm2mils( 173 ), Mm2mils( 2.5 ),
673
 
    0,                           0,
674
 
    wxT( "Лист" )
675
 
};
676
 
 
677
 
Ki_WorkSheetData    WS_Osn2a_Text3 =
678
 
{
679
 
    WS_TEXT,
680
 
    &WS_Osn2a_Text4,
681
 
    Mm2mils( 156.5 ), Mm2mils( 2.5 ),
682
 
    0,                              0,
683
 
    wxT( "N докум." )
684
 
};
685
 
 
686
 
Ki_WorkSheetData    WS_Osn2a_Text4 =
687
 
{
688
 
    WS_TEXT,
689
 
    &WS_Osn2a_Text5,
690
 
    Mm2mils( 137.5 ),Mm2mils( 2.5 ),
691
 
    0,                             0,
692
 
    wxT( "Подп." )
693
 
};
694
 
 
695
 
Ki_WorkSheetData    WS_Osn2a_Text5 =
696
 
{
697
 
    WS_TEXT,
698
 
    &WS_Osn2a_Text6,
699
 
    Mm2mils( 125 ), Mm2mils( 2.5 ),
700
 
    0,                           0,
701
 
    wxT( "Дата" )
702
 
};
703
 
 
704
 
Ki_WorkSheetData    WS_Osn2a_Text6 =
705
 
{
706
 
    WS_TEXT,
707
 
    &WS_Osn2a_Text7,
708
 
    Mm2mils( 5 ),   Mm2mils( 11.5 ),
709
 
    0,                          0,
710
 
    wxT( "Лист" )
711
 
};
712
 
 
713
 
Ki_WorkSheetData    WS_Osn2a_Text7 =
714
 
{
715
 
    WS_TEXTL,
716
 
    &WS_Osn2a_Text8,
717
 
    Mm2mils( 40 ), -Mm2mils( 2.5 ),
718
 
    0,                           0,
719
 
    wxT( "Формат" )
720
 
};
721
 
 
722
 
Ki_WorkSheetData    WS_Osn2a_Text8 =
723
 
{
724
 
    WS_TEXTL,
725
 
    NULL,
726
 
    Mm2mils( 110 ),     -Mm2mils( 2.5 ),
727
 
    0,                                0,
728
 
    wxT( "Копировал" )
729
 
};
730
 
 
731
 
// Center - left bottom corner
732
 
 
733
 
Ki_WorkSheetData    WS_DopLeft_Line1 =
734
 
{
735
 
    WS_OSN,
736
 
    &WS_DopLeft_Line2,
737
 
    Mm2mils( 12 ),    Mm2mils( 145 ),
738
 
    0,                Mm2mils( 145 ),
739
 
    NULL
740
 
};
741
 
 
742
 
Ki_WorkSheetData    WS_DopLeft_Line2 =
743
 
{
744
 
    WS_OSN,
745
 
    &WS_DopLeft_Line3,
746
 
    Mm2mils( 12 ),    Mm2mils( 110 ),
747
 
    0,                Mm2mils( 110 ),
748
 
    NULL
749
 
};
750
 
 
751
 
Ki_WorkSheetData    WS_DopLeft_Line3 =
752
 
{
753
 
    WS_OSN,
754
 
    &WS_DopLeft_Line4,
755
 
    Mm2mils( 12 ),    Mm2mils( 85 ),
756
 
    0,                Mm2mils( 85 ),
757
 
    NULL
758
 
};
759
 
 
760
 
Ki_WorkSheetData    WS_DopLeft_Line4 =
761
 
{
762
 
    WS_OSN,
763
 
    &WS_DopLeft_Line5,
764
 
    Mm2mils( 12 ),    Mm2mils( 60 ),
765
 
    0,                Mm2mils( 60 ),
766
 
    NULL
767
 
};
768
 
 
769
 
Ki_WorkSheetData    WS_DopLeft_Line5 =
770
 
{
771
 
    WS_OSN,
772
 
    &WS_DopLeft_Line6,
773
 
    Mm2mils( 12 ),    Mm2mils( 25 ),
774
 
    0,                Mm2mils( 25 ),
775
 
    NULL
776
 
};
777
 
 
778
 
Ki_WorkSheetData    WS_DopLeft_Line6 =
779
 
{
780
 
    WS_OSN,
781
 
    &WS_DopLeft_Line7,
782
 
    Mm2mils( 12 ),     0,
783
 
    0,                 0,
784
 
    NULL
785
 
};
786
 
 
787
 
Ki_WorkSheetData    WS_DopLeft_Line7 =
788
 
{
789
 
    WS_OSN,
790
 
    &WS_DopLeft_Line8,
791
 
    Mm2mils( 12 ),    Mm2mils( 145 ),
792
 
    Mm2mils( 12 ),              0,
793
 
    NULL
794
 
};
795
 
 
796
 
Ki_WorkSheetData    WS_DopLeft_Line8 =
797
 
{
798
 
    WS_OSN,
799
 
    &WS_DopLeft_Text1,
800
 
    Mm2mils( 7 ),     Mm2mils( 145 ),
801
 
    Mm2mils( 7 ),              0,
802
 
    NULL
803
 
};
804
 
 
805
 
Ki_WorkSheetData    WS_DopLeft_Text1 =
806
 
{
807
 
    WS_TEXT,
808
 
    &WS_DopLeft_Text2,
809
 
    Mm2mils( 9.5 ),      Mm2mils( 12.5 ),
810
 
    0,                               0,
811
 
    wxT( "Инв.N подл." )
812
 
};
813
 
 
814
 
Ki_WorkSheetData    WS_DopLeft_Text2 =
815
 
{
816
 
    WS_TEXT,
817
 
    &WS_DopLeft_Text3,
818
 
    Mm2mils( 9.5 ),       Mm2mils( 42.5 ),
819
 
    0,                                0,
820
 
    wxT( "Подп. и дата" )
821
 
};
822
 
 
823
 
Ki_WorkSheetData    WS_DopLeft_Text3 =
824
 
{
825
 
    WS_TEXT,
826
 
    &WS_DopLeft_Text4,
827
 
    Mm2mils( 9.5 ),     Mm2mils( 72.5 ),
828
 
    0,                              0,
829
 
    wxT( "Взам.инв.N" )
830
 
};
831
 
 
832
 
Ki_WorkSheetData    WS_DopLeft_Text4 =
833
 
{
834
 
    WS_TEXT,
835
 
    &WS_DopLeft_Text5,
836
 
    Mm2mils( 9.5 ),      Mm2mils( 97.5 ),
837
 
    0,                               0,
838
 
    wxT( "Инв.N дубл." )
839
 
};
840
 
 
841
 
Ki_WorkSheetData    WS_DopLeft_Text5 =
842
 
{
843
 
    WS_TEXT,
844
 
    &WS_DopLeft_Line9,
845
 
    Mm2mils( 9.5 ),       Mm2mils( 127.5 ),
846
 
    0,                                 0,
847
 
    wxT( "Подп. и дата" )
848
 
};
849
 
 
850
 
Ki_WorkSheetData    WS_DopLeft_Line9 =
851
 
{
852
 
    WS_OSN,
853
 
    &WS_DopLeft_Line10,
854
 
    Mm2mils( 7 ),      Mm2mils( 287 ),
855
 
    Mm2mils( 7 ),      Mm2mils( 167 ),
856
 
    NULL
857
 
};
858
 
 
859
 
Ki_WorkSheetData    WS_DopLeft_Line10 =
860
 
{
861
 
    WS_OSN,
862
 
    &WS_DopLeft_Line11,
863
 
    Mm2mils( 12 ),     Mm2mils( 287 ),
864
 
    Mm2mils( 12 ),     Mm2mils( 167 ),
865
 
    NULL
866
 
};
867
 
 
868
 
Ki_WorkSheetData    WS_DopLeft_Line11 =
869
 
{
870
 
    WS_OSN,
871
 
    &WS_DopLeft_Line12,
872
 
    Mm2mils( 12 ),     Mm2mils( 287 ),
873
 
    Mm2mils( 12 ),     Mm2mils( 167 ),
874
 
    NULL
875
 
};
876
 
 
877
 
Ki_WorkSheetData    WS_DopLeft_Line12 =
878
 
{
879
 
    WS_OSN,
880
 
    &WS_DopLeft_Line13,
881
 
    Mm2mils( 12 ),     Mm2mils( 167 ),
882
 
    0,                 Mm2mils( 167 ),
883
 
    NULL
884
 
};
885
 
 
886
 
Ki_WorkSheetData    WS_DopLeft_Line13 =
887
 
{
888
 
    WS_OSN,
889
 
    &WS_DopLeft_Line14,
890
 
    Mm2mils( 12 ),     Mm2mils( 227 ),
891
 
    0,                 Mm2mils( 227 ),
892
 
    NULL
893
 
};
894
 
 
895
 
Ki_WorkSheetData    WS_DopLeft_Line14 =
896
 
{
897
 
    WS_OSN,
898
 
    &WS_DopLeft_Text6,
899
 
    Mm2mils( 12 ),    Mm2mils( 287 ),
900
 
    0,                Mm2mils( 287 ),
901
 
    NULL
902
 
};
903
 
 
904
 
Ki_WorkSheetData    WS_DopLeft_Text6 =
905
 
{
906
 
    WS_TEXT,
907
 
    &WS_DopLeft_Text7,
908
 
    Mm2mils( 9.5 ),   Mm2mils( 197 ),
909
 
    0,                           0,
910
 
    wxT( "Справ. N" )
911
 
};
912
 
 
913
 
Ki_WorkSheetData    WS_DopLeft_Text7 =
914
 
{
915
 
    WS_TEXT,
916
 
    NULL,
917
 
    Mm2mils( 9.5 ),        Mm2mils( 257 ),
918
 
    0,                                   0,
919
 
    wxT( "Перв. примен." )
920
 
};
921
 
 
922
 
// Center - left top corner
923
 
 
924
 
Ki_WorkSheetData    WS_DopTop_Line1 =
925
 
{
926
 
    WS_OSN,
927
 
    &WS_DopTop_Line2,
928
 
    Mm2mils( 70 ),                0,
929
 
    Mm2mils( 70 ),   Mm2mils( 14 ),
930
 
    NULL
931
 
};
932
 
 
933
 
Ki_WorkSheetData    WS_DopTop_Line2 =
934
 
{
935
 
    WS_OSN,
936
 
    &WS_DopTop_Line3,
937
 
    Mm2mils( 70 ),   Mm2mils( 14 ),
938
 
    0,               Mm2mils( 14 ),
939
 
    NULL
940
 
};
941
 
 
942
 
Ki_WorkSheetData    WS_DopTop_Line3 =
943
 
{
944
 
    WS_OSN,
945
 
    &WS_DopTop_Line4,
946
 
    Mm2mils( 70 ),   Mm2mils( 14 ),
947
 
    Mm2mils( 137 ),  Mm2mils( 14 ),
948
 
    NULL
949
 
};
950
 
 
951
 
Ki_WorkSheetData    WS_DopTop_Line4 =
952
 
{
953
 
    WS_OSN,
954
 
    &WS_DopTop_Line5,
955
 
    Mm2mils( 84 ),   Mm2mils( 7 ),
956
 
    Mm2mils( 137 ),  Mm2mils( 7 ),
957
 
    NULL
958
 
};
959
 
 
960
 
Ki_WorkSheetData    WS_DopTop_Line5 =
961
 
{
962
 
    WS_OSN,
963
 
    &WS_DopTop_Line6,
964
 
    Mm2mils( 84 ),   Mm2mils( 14 ),
965
 
    Mm2mils( 84 ),             0,
966
 
    NULL
967
 
};
968
 
 
969
 
Ki_WorkSheetData    WS_DopTop_Line6 =
970
 
{
971
 
    WS_OSN,
972
 
    NULL,
973
 
    Mm2mils( 137 ),Mm2mils( 14 ),
974
 
    Mm2mils( 137 ),             0,
975
 
    NULL
976
 
};
977
 
 
978
 
#include <worksheet_shape_builder.h>
979
 
 
980
 
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
981
 
                           const wxString& aPaperFormat,
982
 
                           const wxString& aFileName,
983
 
                           const wxString& aSheetPathHumanReadable,
984
 
                           const TITLE_BLOCK& aTitleBlock,
985
 
                           EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
986
 
{
987
 
    wxPoint             pos;
988
 
    wxPoint             end;
989
 
    int                 refx, refy;
990
 
    Ki_WorkSheetData*   WsItem;
991
 
    wxSize              size( TEXTSIZE * m_milsToIu, TEXTSIZE * m_milsToIu );
992
 
    wxString            msg;
993
 
    WS_DRAW_ITEM_TEXT*  gtext;
994
 
 
995
 
    // Upper left corner
996
 
    refx    = m_LTmargin.x;
997
 
    refy    = m_LTmargin.y;
998
 
 
999
 
    // lower right corner
1000
 
    int xg, yg;
1001
 
    xg  = m_pageSize.x - m_RBmargin.x;
1002
 
    yg  = m_pageSize.y - m_RBmargin.y;
1003
 
 
1004
 
    int     lnMsg, ln;
1005
 
    int     lnWosn  = m_penSize * 2;
1006
 
    int     lnWtonk = m_penSize;
1007
 
    wxSize  sz;
1008
 
    wxSize  size0_8( TEXTSIZE * m_milsToIu * 0.8, TEXTSIZE * m_milsToIu * 1 );
1009
 
    wxSize  size1_5( TEXTSIZE * m_milsToIu * 1.5, TEXTSIZE * m_milsToIu * 1.5 );
1010
 
    wxSize  size2( TEXTSIZE * m_milsToIu * 2, TEXTSIZE * m_milsToIu * 2 );
1011
 
    wxSize  size3( TEXTSIZE * m_milsToIu * 3, TEXTSIZE * m_milsToIu * 3 );
1012
 
 
1013
 
    // Draw the border.
1014
 
    Append( new WS_DRAW_ITEM_RECT(
1015
 
                wxPoint( refx * m_milsToIu, refy * m_milsToIu ),
1016
 
                wxPoint( xg * m_milsToIu, yg * m_milsToIu ),
1017
 
                lnWosn, aLineColor ) );
1018
 
 
1019
 
    // Center - right bottom corner
1020
 
    refx    = m_pageSize.x - m_RBmargin.x;
1021
 
    refy    = m_pageSize.y - m_RBmargin.y;
1022
 
 
1023
 
    // First page
1024
 
    if( m_sheetNumber == 1 )
1025
 
    {
1026
 
        for( WsItem = &WS_Osn1_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
1027
 
        {
1028
 
            pos.x   = (refx - WsItem->m_Posx) * m_milsToIu;
1029
 
            pos.y   = (refy - WsItem->m_Posy) * m_milsToIu;
1030
 
            end.x   = (refx - WsItem->m_Endx) * m_milsToIu;
1031
 
            end.y   = (refy - WsItem->m_Endy) * m_milsToIu;
1032
 
            msg     = WsItem->m_TextBase;
1033
 
 
1034
 
            switch( WsItem->m_Type )
1035
 
            {
1036
 
            case WS_OSN:
1037
 
                Append( new WS_DRAW_ITEM_LINE( pos, end,
1038
 
                                               lnWosn, aLineColor ) );
1039
 
                break;
1040
 
 
1041
 
            case WS_TONK:
1042
 
                Append( new WS_DRAW_ITEM_LINE( pos, end,
1043
 
                                               lnWtonk, aLineColor ) );
1044
 
                break;
1045
 
 
1046
 
            case WS_TEXT:
1047
 
 
1048
 
                if( !msg.IsEmpty() )
1049
 
                {
1050
 
                    if( WsItem == &WS_Osn1_Text1 )
1051
 
                        Append( new WS_DRAW_ITEM_TEXT( msg, pos,
1052
 
                                                       size0_8, m_penSize,
1053
 
                                                       aLineColor ) );
1054
 
                    else
1055
 
                        Append( new WS_DRAW_ITEM_TEXT( msg, pos,
1056
 
                                                       size, m_penSize, aLineColor ) );
1057
 
                }
1058
 
 
1059
 
                break;
1060
 
 
1061
 
            case WS_TEXTL:
1062
 
 
1063
 
                if( !msg.IsEmpty() )
1064
 
                {
1065
 
                    Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
1066
 
                                                           size, m_penSize, aLineColor ) );
1067
 
                    gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
1068
 
                }
1069
 
 
1070
 
                break;
1071
 
            }
1072
 
        }
1073
 
 
1074
 
        // Sheet number
1075
 
        if( m_sheetCount > 1 )
1076
 
        {
1077
 
            pos.x   = ( refx - Mm2mils( 36 ) ) * m_milsToIu;
1078
 
            pos.y   = ( refy - Mm2mils( 17.5 ) ) * m_milsToIu;
1079
 
            msg.Empty();
1080
 
            msg << m_sheetNumber;
1081
 
            Append( new WS_DRAW_ITEM_TEXT( msg, pos,
1082
 
                                           size, m_penSize, aLineColor ) );
1083
 
        }
1084
 
 
1085
 
        // Count of sheets
1086
 
        pos.x   = ( refx - Mm2mils( 10 ) ) * m_milsToIu;
1087
 
        pos.y   = ( refy - Mm2mils( 17.5 ) ) * m_milsToIu;
1088
 
        msg.Empty();
1089
 
        msg << m_sheetCount;
1090
 
        Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
1091
 
                                               size, m_penSize, aLineColor ) );
1092
 
        gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
1093
 
 
1094
 
        // Company name
1095
 
        msg = aTitleBlock.GetCompany();
1096
 
 
1097
 
        if( !msg.IsEmpty() )
1098
 
        {
1099
 
            sz      = size1_5;
1100
 
            lnMsg   = ReturnGraphicTextWidth( msg, sz.x, false, false ) / m_milsToIu;
1101
 
            ln      = Mm2mils( 49 );
1102
 
 
1103
 
            if( lnMsg > ln )
1104
 
                sz.x *= float(ln) / lnMsg;
1105
 
 
1106
 
            pos.x   = ( refx - Mm2mils( 25 ) ) * m_milsToIu;
1107
 
            pos.y   = ( refy - Mm2mils( 7.5 ) ) * m_milsToIu;
1108
 
            Append( new WS_DRAW_ITEM_TEXT( msg, pos,
1109
 
                                           sz, m_penSize, aLineColor ) );
1110
 
        }
1111
 
 
1112
 
        // Title
1113
 
        msg = aTitleBlock.GetTitle();
1114
 
 
1115
 
        if( !msg.IsEmpty() )
1116
 
        {
1117
 
            sz = size1_5;
1118
 
            wxArrayString   lines;
1119
 
            int             titleWidth          = 0;
1120
 
            int             titleHeight         = (sz.y + sz.y * 0.5) / m_milsToIu;
1121
 
            int             titleFieldWidth     = Mm2mils( 69 );
1122
 
            int             titleFieldHeight    = Mm2mils( 24 );
1123
 
            int             index   = 0;
1124
 
            wxString        fullMsg = msg;
1125
 
 
1126
 
            while( 1 )      // Reduce the height of wrapped title until the fit
1127
 
            {
1128
 
                 while( 1 ) // Wrap the title
1129
 
                {
1130
 
                    titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / m_milsToIu;
1131
 
 
1132
 
                    if( titleWidth > titleFieldWidth )
1133
 
                    {
1134
 
                        index = 0;
1135
 
 
1136
 
                        while( 1 )
1137
 
                        {
1138
 
                            msg = msg.Left( msg.Length() - 1 );
1139
 
 
1140
 
                            if( msg.Length() == 0 )
1141
 
                            {
1142
 
                                lines.Clear();
1143
 
                                msg     = fullMsg;
1144
 
                                sz.x    -= m_milsToIu;
1145
 
                                break;
1146
 
                            }
1147
 
                            else
1148
 
                            {
1149
 
                                index++;
1150
 
                                titleWidth =
1151
 
                                    ReturnGraphicTextWidth( msg, sz.x, false, false ) / m_milsToIu;
1152
 
 
1153
 
                                wxString ch = wxString( msg.Last() );
1154
 
 
1155
 
                                if( titleWidth < titleFieldWidth && ch == wxT( " " ) )
1156
 
                                {
1157
 
                                    // New sentence on a new line
1158
 
                                    int dot = msg.Index( wxT( ". " ) );
1159
 
 
1160
 
                                    if( dot != wxNOT_FOUND )
1161
 
                                    {
1162
 
                                        index   += msg.Length() - dot - 2;
1163
 
                                        msg     = msg.Left( dot + 1 );
1164
 
                                        lines.Add( msg );
1165
 
                                        msg = fullMsg.Right( index );
1166
 
                                        break;
1167
 
                                    }
1168
 
                                    else
1169
 
                                    {
1170
 
                                        msg = msg.Left( msg.Length() - 1 );
1171
 
                                        lines.Add( msg );
1172
 
                                        msg = fullMsg.Right( index );
1173
 
                                        break;
1174
 
                                    }
1175
 
                                }
1176
 
                            }
1177
 
                        }
1178
 
                    }
1179
 
                    else
1180
 
                    {
1181
 
                        // New sentence on a new line
1182
 
                        int dot = msg.Index( wxT( ". " ) );
1183
 
 
1184
 
                        if( dot != wxNOT_FOUND )
1185
 
                        {
1186
 
                            lines.Add( msg.Left( dot + 1 ) );
1187
 
                            lines.Add( fullMsg.Right( msg.Length() - dot - 2 ) );
1188
 
                        }
1189
 
                        else
1190
 
                            lines.Add( msg );
1191
 
 
1192
 
                        break;
1193
 
                    }
1194
 
                }
1195
 
 
1196
 
                if( titleFieldHeight < (int) ( titleHeight * lines.Count() ) )
1197
 
                {
1198
 
                    sz.y    -= m_milsToIu;
1199
 
                    sz.x    -= m_milsToIu;
1200
 
                    msg     = fullMsg;
1201
 
                    lines.Clear();
1202
 
                }
1203
 
                else
1204
 
                    break;
1205
 
            }
1206
 
 
1207
 
            pos.x   = ( refx - Mm2mils( 85 ) ) * m_milsToIu;
1208
 
            pos.y   =
1209
 
                ( refy - Mm2mils( 27.5 ) - (titleHeight * (lines.Count() - 1) / 2) ) * m_milsToIu;
1210
 
 
1211
 
            for( unsigned curLn = 0; curLn < lines.Count(); curLn++ )
1212
 
            {
1213
 
                msg = lines[curLn];
1214
 
                Append( new WS_DRAW_ITEM_TEXT( msg, pos,
1215
 
                                               sz, m_penSize, aTextColor ) );
1216
 
                pos.y += titleHeight * m_milsToIu;
1217
 
            }
1218
 
        }
1219
 
 
1220
 
        // Decimal number
1221
 
        msg = aTitleBlock.GetComment1();
1222
 
 
1223
 
        if( !msg.IsEmpty() )
1224
 
        {
1225
 
            sz      = size3;
1226
 
            lnMsg   = ReturnGraphicTextWidth( msg, sz.x, false, false ) / m_milsToIu;
1227
 
            ln      = Mm2mils( 119 );
1228
 
 
1229
 
            if( lnMsg > ln )
1230
 
                sz.x *= float(ln) / lnMsg;
1231
 
 
1232
 
            pos.x   = ( refx - Mm2mils( 60 ) ) * m_milsToIu;
1233
 
            pos.y   = ( refy - Mm2mils( 47.5 ) ) * m_milsToIu;
1234
 
            Append( new WS_DRAW_ITEM_TEXT( msg, pos,
1235
 
                                           sz, m_penSize, aTextColor ) );
1236
 
        }
1237
 
 
1238
 
        // Developer
1239
 
        msg = aTitleBlock.GetComment2();
1240
 
 
1241
 
        if( !msg.IsEmpty() )
1242
 
        {
1243
 
            sz      = size;
1244
 
            lnMsg   = ReturnGraphicTextWidth( msg, sz.x, false, false ) / m_milsToIu;
1245
 
            ln      = Mm2mils( 22 );
1246
 
 
1247
 
            if( lnMsg > ln )
1248
 
                sz.x *= float(ln) / lnMsg;
1249
 
 
1250
 
            pos.x   = ( refx - Mm2mils( 167.5 ) ) * m_milsToIu;
1251
 
            pos.y   = ( refy - Mm2mils( 27.5 ) ) * m_milsToIu;
1252
 
            Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
1253
 
                                                   sz, m_penSize, aTextColor ) );
1254
 
            gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
1255
 
        }
1256
 
 
1257
 
        // Verifier
1258
 
        msg = aTitleBlock.GetComment3();
1259
 
 
1260
 
        if( !msg.IsEmpty() )
1261
 
        {
1262
 
            sz      = size;
1263
 
            lnMsg   = ReturnGraphicTextWidth( msg, sz.x, false, false ) / m_milsToIu;
1264
 
            ln      = Mm2mils( 22 );
1265
 
 
1266
 
            if( lnMsg > ln )
1267
 
                sz.x *= float(ln) / lnMsg;
1268
 
 
1269
 
            pos.x   = ( refx - Mm2mils( 167 ) ) * m_milsToIu;
1270
 
            pos.y   = ( refy - Mm2mils( 22.5 ) ) * m_milsToIu;
1271
 
            Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
1272
 
                                                   sz, m_penSize, aTextColor ) );
1273
 
            gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
1274
 
        }
1275
 
 
1276
 
        // Approver
1277
 
        msg = aTitleBlock.GetComment4();
1278
 
 
1279
 
        if( !msg.IsEmpty() )
1280
 
        {
1281
 
            sz      = size;
1282
 
            lnMsg   = ReturnGraphicTextWidth( msg, sz.x, false, false ) / m_milsToIu;
1283
 
            ln      = Mm2mils( 22 );
1284
 
 
1285
 
            if( lnMsg > ln )
1286
 
                sz.x *= float(ln) / lnMsg;
1287
 
 
1288
 
            pos.x   = ( refx - Mm2mils( 167 ) ) * m_milsToIu;
1289
 
            pos.y   = ( refy - Mm2mils( 2.5 ) ) * m_milsToIu;
1290
 
            Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
1291
 
                                                   sz, m_penSize, aTextColor ) );
1292
 
            gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
1293
 
        }
1294
 
    }
1295
 
    else    // other pages
1296
 
    {
1297
 
        for( WsItem = &WS_Osn2a_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
1298
 
        {
1299
 
            pos.x   = (refx - WsItem->m_Posx) * m_milsToIu;
1300
 
            pos.y   = (refy - WsItem->m_Posy) * m_milsToIu;
1301
 
            end.x   = (refx - WsItem->m_Endx) * m_milsToIu;
1302
 
            end.y   = (refy - WsItem->m_Endy) * m_milsToIu;
1303
 
            msg     = WsItem->m_TextBase;
1304
 
 
1305
 
            switch( WsItem->m_Type )
1306
 
            {
1307
 
            case WS_OSN:
1308
 
                Append( new WS_DRAW_ITEM_LINE( pos, end,
1309
 
                                               lnWosn, aLineColor ) );
1310
 
                break;
1311
 
 
1312
 
            case WS_TONK:
1313
 
                Append( new WS_DRAW_ITEM_LINE( pos, end,
1314
 
                                               lnWtonk, aLineColor ) );
1315
 
                break;
1316
 
 
1317
 
            case WS_TEXT:
1318
 
 
1319
 
                if( !msg.IsEmpty() )
1320
 
                {
1321
 
                    if( WsItem == &WS_Osn2a_Text1 )
1322
 
                        Append( new WS_DRAW_ITEM_TEXT( msg, pos,
1323
 
                                                       size0_8, m_penSize,
1324
 
                                                       aLineColor ) );
1325
 
                    else
1326
 
                        Append( new WS_DRAW_ITEM_TEXT( msg, pos,
1327
 
                                                       size, m_penSize, aLineColor ) );
1328
 
                }
1329
 
 
1330
 
                break;
1331
 
 
1332
 
            case WS_TEXTL:
1333
 
 
1334
 
                if( !msg.IsEmpty() )
1335
 
                {
1336
 
                    Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
1337
 
                                                           size, m_penSize,
1338
 
                                                           aLineColor ) );
1339
 
                    gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
1340
 
                }
1341
 
 
1342
 
                break;
1343
 
            }
1344
 
        }
1345
 
 
1346
 
        // Sheet number
1347
 
        pos.x   = ( refx - Mm2mils( 5 ) ) * m_milsToIu;
1348
 
        pos.y   = ( refy - Mm2mils( 4 ) ) * m_milsToIu;
1349
 
        msg.Empty();
1350
 
        msg << m_sheetNumber;
1351
 
        Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
1352
 
                                               size, m_penSize, aLineColor ) );
1353
 
 
1354
 
        // Decimal number
1355
 
        msg = aTitleBlock.GetComment1();
1356
 
 
1357
 
        if( !msg.IsEmpty() )
1358
 
        {
1359
 
            sz      = size3;
1360
 
            lnMsg   = ReturnGraphicTextWidth( msg, sz.x, false, false ) / m_milsToIu;
1361
 
            ln      = Mm2mils( 109 );
1362
 
 
1363
 
            if( lnMsg > ln )
1364
 
                sz.x *= float(ln) / lnMsg;
1365
 
 
1366
 
            pos.x   = ( refx - Mm2mils( 65 ) ) * m_milsToIu;
1367
 
            pos.y   = ( refy - Mm2mils( 7.5 ) ) * m_milsToIu;
1368
 
            Append( new WS_DRAW_ITEM_TEXT( msg, pos,
1369
 
                                           sz, m_penSize, aTextColor ) );
1370
 
        }
1371
 
    }
1372
 
 
1373
 
    // Format
1374
 
    pos.x   = ( refx - Mm2mils( 23 ) ) * m_milsToIu;
1375
 
    pos.y   = ( refy + Mm2mils( 2.5 ) ) * m_milsToIu;
1376
 
    msg.Empty();
1377
 
    msg << aPaperFormat;
1378
 
    Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
1379
 
                                           size, m_penSize, aLineColor ) );
1380
 
    gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
1381
 
 
1382
 
    // Center - left bottom corner
1383
 
    refx    = m_LTmargin.x;
1384
 
    refy    = m_pageSize.y - m_RBmargin.y;
1385
 
 
1386
 
    for( WsItem = &WS_DopLeft_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
1387
 
    {
1388
 
        if( m_sheetNumber > 1 && WsItem == &WS_DopLeft_Line9 ) // Some fields for first page only
1389
 
            break;
1390
 
 
1391
 
        pos.x   = (refx - WsItem->m_Posx) * m_milsToIu;
1392
 
        pos.y   = (refy - WsItem->m_Posy) * m_milsToIu;
1393
 
        end.x   = (refx - WsItem->m_Endx) * m_milsToIu;
1394
 
        end.y   = (refy - WsItem->m_Endy) * m_milsToIu;
1395
 
        msg     = WsItem->m_TextBase;
1396
 
 
1397
 
        switch( WsItem->m_Type )
1398
 
        {
1399
 
        case WS_OSN:
1400
 
            Append( new WS_DRAW_ITEM_LINE( pos, end,
1401
 
                                           lnWosn, aLineColor ) );
1402
 
            break;
1403
 
 
1404
 
        case WS_TEXT:
1405
 
 
1406
 
            if( !msg.IsEmpty() )
1407
 
            {
1408
 
                Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
1409
 
                                                       size, m_penSize, aLineColor ) );
1410
 
                gtext->SetOrientation( TEXT_ORIENT_VERT );
1411
 
            }
1412
 
 
1413
 
            break;
1414
 
        }
1415
 
    }
1416
 
 
1417
 
    if( aPaperFormat == PAGE_INFO::A4 || m_pageSize.x > m_pageSize.y )    // A4 or Landscape
1418
 
    {
1419
 
        // Center - left top corner
1420
 
        refx    = m_LTmargin.x;
1421
 
        refy    = m_LTmargin.y;
1422
 
 
1423
 
        for( WsItem = &WS_DopTop_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
1424
 
        {
1425
 
            if( m_sheetNumber > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only
1426
 
                break;
1427
 
 
1428
 
            pos.x   = (refx + WsItem->m_Posx) * m_milsToIu;
1429
 
            pos.y   = (refy + WsItem->m_Posy) * m_milsToIu;
1430
 
            end.x   = (refx + WsItem->m_Endx) * m_milsToIu;
1431
 
            end.y   = (refy + WsItem->m_Endy) * m_milsToIu;
1432
 
            msg     = WsItem->m_TextBase;
1433
 
 
1434
 
            switch( WsItem->m_Type )
1435
 
            {
1436
 
            case WS_OSN:
1437
 
                Append( new WS_DRAW_ITEM_LINE( pos, end,
1438
 
                                               lnWosn, aLineColor ) );
1439
 
                break;
1440
 
 
1441
 
            case WS_TONK:
1442
 
                Append( new WS_DRAW_ITEM_LINE( pos, end,
1443
 
                                               lnWtonk, aLineColor ) );
1444
 
                break;
1445
 
            }
1446
 
        }
1447
 
 
1448
 
        // Decimal number
1449
 
        msg = aTitleBlock.GetComment1();
1450
 
 
1451
 
        if( !msg.IsEmpty() )
1452
 
        {
1453
 
            sz      = size2;
1454
 
            lnMsg   = ReturnGraphicTextWidth( msg, sz.x, false, false ) / m_milsToIu;
1455
 
            ln      = Mm2mils( 69 );
1456
 
 
1457
 
            if( lnMsg > ln )
1458
 
                sz.x *= float(ln) / lnMsg;
1459
 
 
1460
 
            pos.x   = ( refx + Mm2mils( 35 ) ) * m_milsToIu;
1461
 
            pos.y   = ( refy + Mm2mils( 7 ) ) * m_milsToIu;
1462
 
            Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
1463
 
                                                   sz, m_penSize, aTextColor ) );
1464
 
            gtext->SetOrientation( 1800.0 );
1465
 
        }
1466
 
    }
1467
 
    else    // Portrait
1468
 
    {
1469
 
        // Center - right top corner
1470
 
        // Lines are used from the upper left corner by the change of coordinates
1471
 
        refx    = m_pageSize.x - m_RBmargin.x;
1472
 
        refy    = m_LTmargin.y;
1473
 
 
1474
 
        for( WsItem = &WS_DopTop_Line1; WsItem != NULL; WsItem = WsItem->Pnext )
1475
 
        {
1476
 
            if( m_sheetNumber > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only
1477
 
                break;
1478
 
 
1479
 
            pos.x   = (refx - WsItem->m_Posy) * m_milsToIu;
1480
 
            pos.y   = (refy + WsItem->m_Posx) * m_milsToIu;
1481
 
            end.x   = (refx - WsItem->m_Endy) * m_milsToIu;
1482
 
            end.y   = (refy + WsItem->m_Endx) * m_milsToIu;
1483
 
            msg     = WsItem->m_TextBase;
1484
 
 
1485
 
            switch( WsItem->m_Type )
1486
 
            {
1487
 
            case WS_OSN:
1488
 
                Append( new WS_DRAW_ITEM_LINE( pos, end,
1489
 
                                               lnWosn, aLineColor ) );
1490
 
                break;
1491
 
 
1492
 
            case WS_TONK:
1493
 
                Append( new WS_DRAW_ITEM_LINE( pos, end,
1494
 
                                               lnWtonk, aLineColor ) );
1495
 
                break;
1496
 
            }
1497
 
        }
1498
 
 
1499
 
        // Decimal number
1500
 
        msg = aTitleBlock.GetComment1();
1501
 
 
1502
 
        if( !msg.IsEmpty() )
1503
 
        {
1504
 
            sz      = size2;
1505
 
            lnMsg   = ReturnGraphicTextWidth( msg, sz.x, false, false ) / m_milsToIu;
1506
 
            ln      = Mm2mils( 69 );
1507
 
 
1508
 
            if( lnMsg > ln )
1509
 
                sz.x *= float(ln) / lnMsg;
1510
 
 
1511
 
            pos.x   = ( refx - Mm2mils( 7 ) ) * m_milsToIu;
1512
 
            pos.y   = ( refy + Mm2mils( 35 ) ) * m_milsToIu;
1513
 
            Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos,
1514
 
                                                   sz, m_penSize, aTextColor ) );
1515
 
            gtext->SetOrientation( TEXT_ORIENT_VERT );
1516
 
        }
1517
 
    }
1518
 
}