KiCad PCB EDA Suite
drawing_sheet_reader.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
5  * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include <eda_item.h>
27 #include <locale_io.h>
32 #include <drawing_sheet/drawing_sheet_reader_lexer.h>
33 #include <wx/ffile.h>
34 
35 #include <wx/file.h>
36 #include <wx/mstream.h>
37 
38 
39 using namespace TB_READER_T;
40 
46 class DRAWING_SHEET_READER_PARSER : public DRAWING_SHEET_READER_LEXER
47 {
48 public:
49  DRAWING_SHEET_READER_PARSER( const char* aLine, const wxString& aSource );
50  void Parse( DS_DATA_MODEL* aLayout );
51 
52 private:
53 
61  int parseInt( int aMin, int aMax );
62 
68  double parseDouble();
69 
70  void parseSetup( DS_DATA_MODEL* aLayout );
71 
75  void parseGraphic( DS_DATA_ITEM * aItem );
76 
80  void parseText( DS_DATA_ITEM_TEXT * aItem );
81 
86  void parsePolygon( DS_DATA_ITEM_POLYGONS * aItem );
87 
91  void parsePolyOutline( DS_DATA_ITEM_POLYGONS * aItem );
92 
93 
97  void parseBitmap( DS_DATA_ITEM_BITMAP * aItem );
98 
99  void parseCoordinate( POINT_COORD& aCoord);
100  void readOption( DS_DATA_ITEM * aItem );
101  void readPngdata( DS_DATA_ITEM_BITMAP * aItem );
102 };
103 
104 // PCB_PLOT_PARAMS_PARSER
105 
107  const wxString& aSource ) :
108  DRAWING_SHEET_READER_LEXER( aLine, aSource )
109 {
110 }
111 
112 
113 wxString convertLegacyVariableRefs( const wxString& aTextbase )
114 {
115  wxString msg;
116 
117  /*
118  * Legacy formats
119  * %% = replaced by %
120  * %K = Kicad version
121  * %Z = paper format name (A4, USLetter)
122  * %Y = company name
123  * %D = date
124  * %R = revision
125  * %S = sheet number
126  * %N = number of sheets
127  * %L = layer name
128  * %Cx = comment (x = 0 to 9 to identify the comment)
129  * %F = filename
130  * %P = sheet path (sheet full name)
131  * %T = title
132  */
133 
134  for( unsigned ii = 0; ii < aTextbase.Len(); ii++ )
135  {
136  if( aTextbase[ii] != '%' )
137  {
138  msg << aTextbase[ii];
139  continue;
140  }
141 
142  if( ++ii >= aTextbase.Len() )
143  break;
144 
145  wxChar format = aTextbase[ii];
146 
147  switch( format )
148  {
149  case '%': msg += '%'; break;
150  case 'D': msg += wxT( "${ISSUE_DATE}" ); break;
151  case 'R': msg += wxT( "${REVISION}" ); break;
152  case 'K': msg += wxT( "${KICAD_VERSION}" ); break;
153  case 'Z': msg += wxT( "${PAPER}" ); break;
154  case 'S': msg += wxT( "${#}" ); break;
155  case 'N': msg += wxT( "${##}" ); break;
156  case 'F': msg += wxT( "${FILENAME}" ); break;
157  case 'L': msg += wxT( "${LAYER}" ); break;
158  case 'P': msg += wxT( "${SHEETNAME}" ); break;
159  case 'Y': msg += wxT( "${COMPANY}" ); break;
160  case 'T': msg += wxT( "${TITLE}" ); break;
161  case 'C':
162  format = aTextbase[++ii];
163 
164  switch( format )
165  {
166  case '0': msg += wxT( "${COMMENT1}" ); break;
167  case '1': msg += wxT( "${COMMENT2}" ); break;
168  case '2': msg += wxT( "${COMMENT3}" ); break;
169  case '3': msg += wxT( "${COMMENT4}" ); break;
170  case '4': msg += wxT( "${COMMENT5}" ); break;
171  case '5': msg += wxT( "${COMMENT6}" ); break;
172  case '6': msg += wxT( "${COMMENT7}" ); break;
173  case '7': msg += wxT( "${COMMENT8}" ); break;
174  case '8': msg += wxT( "${COMMENT9}" ); break;
175  }
176  break;
177 
178  default:
179  break;
180  }
181  }
182 
183  return msg;
184 }
185 
186 
188 {
189  DS_DATA_ITEM* item;
190  LOCALE_IO toggle;
191 
192  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
193  {
194  if( token == T_LEFT )
195  token = NextTok();
196 
197  if( token == T_page_layout || token == T_drawing_sheet )
198  continue;
199 
200  switch( token )
201  {
202  case T_setup: // Defines default values for graphic items
203  parseSetup( aLayout );
204  break;
205 
206  case T_line:
208  parseGraphic( item );
209  aLayout->Append( item );
210  break;
211 
212  case T_rect:
213  item = new DS_DATA_ITEM( DS_DATA_ITEM::DS_RECT );
214  parseGraphic( item );
215  aLayout->Append( item );
216  break;
217 
218  case T_polygon:
219  item = new DS_DATA_ITEM_POLYGONS();
221  aLayout->Append( item );
222  break;
223 
224  case T_bitmap:
225  item = new DS_DATA_ITEM_BITMAP( NULL );
226  parseBitmap( (DS_DATA_ITEM_BITMAP*) item );
227  aLayout->Append( item );
228  break;
229 
230  case T_tbtext:
231  NeedSYMBOLorNUMBER();
232  item = new DS_DATA_ITEM_TEXT( convertLegacyVariableRefs( FromUTF8() ) );
233  parseText( (DS_DATA_ITEM_TEXT*) item );
234  aLayout->Append( item );
235  break;
236 
237  default:
238  Unexpected( CurText() );
239  break;
240  }
241  }
242 }
243 
244 
246 {
247  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
248  {
249  switch( token )
250  {
251  case T_LEFT:
252  break;
253 
254  case T_linewidth:
255  aLayout->m_DefaultLineWidth = parseDouble();
256  NeedRIGHT();
257  break;
258 
259  case T_textsize:
260  aLayout->m_DefaultTextSize.x = parseDouble();
261  aLayout->m_DefaultTextSize.y = parseDouble();
262  NeedRIGHT();
263  break;
264 
265  case T_textlinewidth:
266  aLayout->m_DefaultTextThickness = parseDouble();
267  NeedRIGHT();
268  break;
269 
270  case T_left_margin:
271  aLayout->SetLeftMargin( parseDouble() );
272  NeedRIGHT();
273  break;
274 
275  case T_right_margin:
276  aLayout->SetRightMargin( parseDouble() );
277  NeedRIGHT();
278  break;
279 
280  case T_top_margin:
281  aLayout->SetTopMargin( parseDouble() );
282  NeedRIGHT();
283  break;
284 
285  case T_bottom_margin:
286  aLayout->SetBottomMargin( parseDouble() );
287  NeedRIGHT();
288  break;
289 
290  default:
291  Unexpected( CurText() );
292  break;
293  }
294  }
295 
296  // The file is well-formed. If it has no further items, then that's the way the
297  // user wants it.
298  aLayout->AllowVoidList( true );
299 }
300 
301 
303 {
304  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
305  {
306  if( token == T_LEFT )
307  token = NextTok();
308 
309  switch( token )
310  {
311  case T_comment:
312  NeedSYMBOLorNUMBER();
313  aItem->m_Info = FromUTF8();
314  NeedRIGHT();
315  break;
316 
317  case T_pos:
318  parseCoordinate( aItem->m_Pos );
319  break;
320 
321  case T_name:
322  NeedSYMBOLorNUMBER();
323  aItem->m_Name = FromUTF8();
324  NeedRIGHT();
325  break;
326 
327  case T_option:
328  readOption( aItem );
329  break;
330 
331  case T_pts:
332  parsePolyOutline( aItem );
333  aItem->CloseContour();
334  break;
335 
336  case T_rotate:
337  aItem->m_Orient = parseDouble();
338  NeedRIGHT();
339  break;
340 
341  case T_repeat:
342  aItem->m_RepeatCount = parseInt( -1, 100 );
343  NeedRIGHT();
344  break;
345 
346  case T_incrx:
347  aItem->m_IncrementVector.x = parseDouble();
348  NeedRIGHT();
349  break;
350 
351  case T_incry:
352  aItem->m_IncrementVector.y = parseDouble();
353  NeedRIGHT();
354  break;
355 
356  case T_linewidth:
357  aItem->m_LineWidth = parseDouble();
358  NeedRIGHT();
359  break;
360 
361  default:
362  Unexpected( CurText() );
363  break;
364  }
365  }
366 
367  aItem->SetBoundingBox();
368 }
369 
371 {
372  DPOINT corner;
373 
374  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
375  {
376  if( token == T_LEFT )
377  token = NextTok();
378 
379  switch( token )
380  {
381  case T_xy:
382  corner.x = parseDouble();
383  corner.y = parseDouble();
384  aItem->AppendCorner( corner );
385  NeedRIGHT();
386  break;
387 
388  default:
389  Unexpected( CurText() );
390  break;
391  }
392  }
393 }
394 
395 
397 {
399  aItem->m_ImageBitmap = image;
400 
401  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
402  {
403  if( token == T_LEFT )
404  token = NextTok();
405 
406  switch( token )
407  {
408  case T_name:
409  NeedSYMBOLorNUMBER();
410  aItem->m_Name = FromUTF8();
411  NeedRIGHT();
412  break;
413 
414  case T_pos:
415  parseCoordinate( aItem->m_Pos );
416  break;
417 
418  case T_repeat:
419  aItem->m_RepeatCount = parseInt( -1, 100 );
420  NeedRIGHT();
421  break;
422 
423  case T_incrx:
424  aItem->m_IncrementVector.x = parseDouble();
425  NeedRIGHT();
426  break;
427 
428  case T_incry:
429  aItem->m_IncrementVector.y = parseDouble();
430  NeedRIGHT();
431  break;
432 
433  case T_linewidth:
434  aItem->m_LineWidth = parseDouble();
435  NeedRIGHT();
436  break;
437 
438  case T_scale:
439  aItem->m_ImageBitmap->SetScale( parseDouble() );
440  NeedRIGHT();
441  break;
442 
443  case T_pngdata:
444  readPngdata( aItem );
445  break;
446 
447  case T_option:
448  readOption( aItem );
449  break;
450 
451  default:
452  Unexpected( CurText() );
453  break;
454  }
455  }
456 }
457 
459 {
460  std::string tmp;
461 
462  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
463  {
464  if( token == T_LEFT )
465  token = NextTok();
466 
467  switch( token )
468  {
469  case T_data:
470  NeedSYMBOLorNUMBER();
471  tmp += CurStr();
472  tmp += "\n";
473  NeedRIGHT();
474  break;
475 
476  default:
477  Unexpected( CurText() );
478  break;
479  }
480  }
481 
482  tmp += "EndData";
483 
484  wxString msg;
485  STRING_LINE_READER str_reader( tmp, wxT("Png kicad_wks data") );
486 
487  if( ! aItem->m_ImageBitmap->LoadData( str_reader, msg ) )
488  wxLogMessage(msg);
489 }
490 
491 
493 {
494  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
495  {
496  switch( token )
497  {
498  case T_page1only: aItem->SetPage1Option( FIRST_PAGE_ONLY ); break;
499  case T_notonpage1: aItem->SetPage1Option( SUBSEQUENT_PAGES ); break;
500  default: Unexpected( CurText() ); break;
501  }
502  }
503 }
504 
505 
507 {
508  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
509  {
510  if( token == T_LEFT )
511  token = NextTok();
512  else
513  {
514  // If another token than T_LEFT is read here, this is an error
515  // however, due to a old bug in kicad, the token T_end can be found
516  // without T_LEFT in a very few .wks files (perhaps only one in a demo).
517  // So this ugly hack disables the error detection.
518  if( token != T_end )
519  Unexpected( CurText() );
520  }
521 
522  switch( token )
523  {
524  case T_comment:
525  NeedSYMBOLorNUMBER();
526  aItem->m_Info = FromUTF8();
527  NeedRIGHT();
528  break;
529 
530  case T_option:
531  readOption( aItem );
532  break;
533 
534  case T_name:
535  NeedSYMBOLorNUMBER();
536  aItem->m_Name = FromUTF8();
537  NeedRIGHT();
538  break;
539 
540  case T_start:
541  parseCoordinate( aItem->m_Pos );
542  break;
543 
544  case T_end:
545  parseCoordinate( aItem->m_End );
546  break;
547 
548  case T_repeat:
549  aItem->m_RepeatCount = parseInt( -1, 100 );
550  NeedRIGHT();
551  break;
552 
553  case T_incrx:
554  aItem->m_IncrementVector.x = parseDouble();
555  NeedRIGHT();
556  break;
557 
558  case T_incry:
559  aItem->m_IncrementVector.y = parseDouble();
560  NeedRIGHT();
561  break;
562 
563  case T_linewidth:
564  aItem->m_LineWidth = parseDouble();
565  NeedRIGHT();
566  break;
567 
568  default:
569  Unexpected( CurText() );
570  break;
571  }
572  }
573 }
574 
575 
577 {
578  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
579  {
580  if( token == T_LEFT )
581  token = NextTok();
582 
583  switch( token )
584  {
585  case T_comment:
586  NeedSYMBOLorNUMBER();
587  aItem->m_Info = FromUTF8();
588  NeedRIGHT();
589  break;
590 
591  case T_option:
592  readOption( aItem );
593  break;
594 
595  case T_name:
596  NeedSYMBOLorNUMBER();
597  aItem->m_Name = FromUTF8();
598  NeedRIGHT();
599  break;
600 
601  case T_pos:
602  parseCoordinate( aItem->m_Pos );
603  break;
604 
605  case T_repeat:
606  aItem->m_RepeatCount = parseInt( -1, 100 );
607  NeedRIGHT();
608  break;
609 
610  case T_incrx:
611  aItem->m_IncrementVector.x = parseDouble();
612  NeedRIGHT();
613  break;
614 
615  case T_incry:
616  aItem->m_IncrementVector.y = parseDouble();
617  NeedRIGHT();
618  break;
619 
620  case T_incrlabel:
621  aItem->m_IncrementLabel = parseInt(INT_MIN, INT_MAX);
622  NeedRIGHT();
623  break;
624 
625  case T_maxlen:
626  aItem->m_BoundingBoxSize.x = parseDouble();
627  NeedRIGHT();
628  break;
629 
630  case T_maxheight:
631  aItem->m_BoundingBoxSize.y = parseDouble();
632  NeedRIGHT();
633  break;
634 
635  case T_font:
636  for( token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
637  {
638  switch( token )
639  {
640  case T_LEFT:
641  break;
642 
643  case T_bold:
644  aItem->m_Bold = true;
645  break;
646 
647  case T_italic:
648  aItem->m_Italic = true;
649  break;
650 
651  case T_size:
652  aItem->m_TextSize.x = parseDouble();
653  aItem->m_TextSize.y = parseDouble();
654  NeedRIGHT();
655  break;
656 
657  case T_linewidth:
658  aItem->m_LineWidth = parseDouble();
659  NeedRIGHT();
660  break;
661 
662  default:
663  Unexpected( CurText() );
664  break;
665  }
666  }
667  break;
668 
669  case T_justify:
670  for( token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
671  {
672  switch( token )
673  {
674  case T_center:
677  break;
678 
679  case T_left:
681  break;
682 
683  case T_right:
685  break;
686 
687  case T_top:
689  break;
690 
691  case T_bottom:
693  break;
694 
695  default:
696  Unexpected( CurText() );
697  break;
698  }
699  }
700  break;
701 
702  case T_rotate:
703  aItem->m_Orient = parseDouble();
704  NeedRIGHT();
705  break;
706 
707  default:
708  Unexpected( CurText() );
709  break;
710  }
711  }
712 }
713 
714 // parse an expression like " 25 1 ltcorner)"
716 {
717  aCoord.m_Pos.x = parseDouble();
718  aCoord.m_Pos.y = parseDouble();
719 
720  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
721  {
722  switch( token )
723  {
724  case T_ltcorner: aCoord.m_Anchor = LT_CORNER; break;
725  case T_lbcorner: aCoord.m_Anchor = LB_CORNER; break;
726  case T_rbcorner: aCoord.m_Anchor = RB_CORNER; break;
727  case T_rtcorner: aCoord.m_Anchor = RT_CORNER; break;
728  default: Unexpected( CurText() ); break;
729  }
730  }
731 }
732 
733 int DRAWING_SHEET_READER_PARSER::parseInt( int aMin, int aMax )
734 {
735  T token = NextTok();
736 
737  if( token != T_NUMBER )
738  Expecting( T_NUMBER );
739 
740  int val = atoi( CurText() );
741 
742  if( val < aMin )
743  val = aMin;
744  else if( val > aMax )
745  val = aMax;
746 
747  return val;
748 }
749 
750 
752 {
753  T token = NextTok();
754 
755  if( token != T_NUMBER )
756  Expecting( T_NUMBER );
757 
758  double val = strtod( CurText(), NULL );
759 
760  return val;
761 }
762 
763 // defaultDrawingSheet is the default page layout description using the S expr.
764 extern const char defaultDrawingSheet[];
765 
767 {
768  SetPageLayout( defaultDrawingSheet, false, wxT( "default page" ) );
769 }
770 
771 // Returns defaultDrawingSheet as a string;
773 {
774  return wxString( defaultDrawingSheet );
775 }
776 
777 // emptyDrawingSheet is a "empty" page layout description using the S expr.
778 // there is a 0 length line to fool something somewhere.
779 extern const char emptyDrawingSheet[];
780 
782 {
783  SetPageLayout( emptyDrawingSheet, false, wxT( "empty page" ) );
784 }
785 
786 
788 {
789  return wxString( emptyDrawingSheet );
790 }
791 
792 
793 void DS_DATA_MODEL::SetPageLayout( const char* aPageLayout, bool Append, const wxString& aSource )
794 {
795  if( ! Append )
796  ClearList();
797 
798  DRAWING_SHEET_READER_PARSER lp_parser( aPageLayout, wxT( "Sexpr_string" ) );
799 
800  try
801  {
802  lp_parser.Parse( this );
803  }
804  catch( const IO_ERROR& ioe )
805  {
806  wxLogMessage( ioe.What() );
807  }
808 }
809 
810 
811 void DS_DATA_MODEL::LoadDrawingSheet( const wxString& aFullFileName, bool Append )
812 {
813  wxString fullFileName = aFullFileName;
814 
815  if( !Append )
816  {
817  if( fullFileName.IsEmpty() )
818  wxGetEnv( wxT( "KICAD_WKSFILE" ), &fullFileName );
819 
820  if( fullFileName.IsEmpty() || !wxFileExists( fullFileName ) )
821  {
822  #if 0
823  if( !fullFileName.IsEmpty() )
824  wxLogMessage( wxT( "Drawing sheet file <%s> not found" ), fullFileName.GetData() );
825  #endif
827  return;
828  }
829  }
830 
831  wxFFile wksFile( fullFileName, "rb" );
832 
833  if( ! wksFile.IsOpened() )
834  {
835  if( !Append )
837  return;
838  }
839 
840  size_t filelen = wksFile.Length();
841  char * buffer = new char[filelen+10];
842 
843  if( wksFile.Read( buffer, filelen ) != filelen )
844  wxLogMessage( _("The file \"%s\" was not fully read"), fullFileName.GetData() );
845  else
846  {
847  buffer[filelen]=0;
848 
849  if( ! Append )
850  ClearList();
851 
852  DRAWING_SHEET_READER_PARSER pl_parser( buffer, fullFileName );
853 
854  try
855  {
856  pl_parser.Parse( this );
857  }
858  catch( const IO_ERROR& ioe )
859  {
860  wxLogMessage( ioe.What() );
861  }
862  }
863 
864  delete[] buffer;
865 }
wxString m_Info
Definition: ds_data_item.h:208
void ClearList()
Erase the list of items.
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:38
void LoadDrawingSheet(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout or the default layout if no custom layout is available.
EDA_TEXT_VJUSTIFY_T m_Vjustify
Definition: ds_data_item.h:344
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
void parsePolygon(DS_DATA_ITEM_POLYGONS *aItem)
parse a polygon item starting by "( polygon" and read parameters.
static wxString DefaultLayout()
Return a string containing the empty layout shape.
void SetScale(double aScale)
Definition: bitmap_base.h:80
void SetBottomMargin(double aMargin)
Definition: ds_data_model.h:70
void SetBoundingBox()
Calculate the bounding box of the set polygons.
void readOption(DS_DATA_ITEM *aItem)
double m_DefaultLineWidth
DRAWING_SHEET_READER_PARSER holds data and functions pertinent to parsing a S-expression file for a D...
void SetLeftMargin(double aMargin)
Definition: ds_data_model.h:61
static double parseDouble(LINE_READER &aReader, const char *aLine, const char **aOutput=NULL)
Parses an ASCII point string with possible leading whitespace into a double precision floating point ...
void readPngdata(DS_DATA_ITEM_BITMAP *aItem)
POINT_COORD m_End
Definition: ds_data_item.h:210
void parseText(DS_DATA_ITEM_TEXT *aItem)
parse a text item starting by "(tbtext" and read parameters.
void parseBitmap(DS_DATA_ITEM_BITMAP *aItem)
parse a bitmap item starting by "( bitmap" and read parameters.
void SetRightMargin(double aMargin)
Definition: ds_data_model.h:64
double m_DefaultTextThickness
This class handle bitmap images in KiCad.
Definition: bitmap_base.h:51
EDA_TEXT_HJUSTIFY_T m_Hjustify
Definition: ds_data_item.h:343
DPOINT m_IncrementVector
Definition: ds_data_item.h:213
double m_LineWidth
Definition: ds_data_item.h:211
#define NULL
DSIZE m_DefaultTextSize
BITMAP_BASE * m_ImageBitmap
Definition: ds_data_item.h:373
void AllowVoidList(bool Allow)
In KiCad applications, a page layout description is needed So if the list is empty,...
Definition: ds_data_model.h:81
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
DPOINT m_Pos
Definition: ds_data_item.h:80
int parseInt(int aMin, int aMax)
Function parseInt parses an integer and constrains it between two values.
void CloseContour()
Closes the current contour, by storing the index of the last corner of the current polygon in m_polyI...
Definition: ds_data_item.h:242
void SetTopMargin(double aMargin)
Definition: ds_data_model.h:67
void parseGraphic(DS_DATA_ITEM *aItem)
parse a graphic item starting by "(line" or "(rect" and read parameters.
int m_IncrementLabel
Definition: ds_data_item.h:215
static wxString EmptyLayout()
Return a string containing the empty layout shape.
const char defaultDrawingSheet[]
A coordinate point.
Definition: ds_data_item.h:69
void parseCoordinate(POINT_COORD &aCoord)
static int parseInt(LINE_READER &aReader, const char *aLine, const char **aOutput=NULL)
Parse an ASCII integer string with possible leading whitespace into an integer and updates the pointe...
void Parse(DS_DATA_MODEL *aLayout)
void SetPageLayout(const char *aPageLayout, bool aAppend=false, const wxString &aSource=wxT("Sexpr_string"))
Populate the list from a S expr description stored in a string.
void SetPage1Option(PAGE_OPTION aChoice)
Definition: ds_data_item.h:135
wxString convertLegacyVariableRefs(const wxString &aTextbase)
void parseSetup(DS_DATA_MODEL *aLayout)
POINT_COORD m_Pos
Definition: ds_data_item.h:209
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95
#define _(s)
Definition: 3d_actions.cpp:33
DRAWING_SHEET_READER_PARSER(const char *aLine, const wxString &aSource)
bool LoadData(LINE_READER &aLine, wxString &aErrorMsg)
Load an image data saved by SaveData.
void parsePolyOutline(DS_DATA_ITEM_POLYGONS *aItem)
parse a list of corners starting by "( pts" and read coordinates.
double parseDouble()
Function parseDouble parses a double.
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:237
const char emptyDrawingSheet[]
wxString m_Name
Definition: ds_data_item.h:206
void AppendCorner(const DPOINT &aCorner)
Add a corner in corner list.
Definition: ds_data_item.h:233
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
void Append(DS_DATA_ITEM *aItem)