KiCad PCB EDA Suite
PAGE_LAYOUT_READER_PARSER Class Reference

Class PAGE_LAYOUT_READER_PARSER holds data and functions pertinent to parsing a S-expression file for a WS_DATA_MODEL. More...

Inheritance diagram for PAGE_LAYOUT_READER_PARSER:

Public Member Functions

 PAGE_LAYOUT_READER_PARSER (const char *aLine, const wxString &aSource)
 
void Parse (WS_DATA_MODEL *aLayout)
 

Private Member Functions

int parseInt (int aMin, int aMax)
 Function parseInt parses an integer and constrains it between two values. More...
 
double parseDouble ()
 Function parseDouble parses a double. More...
 
void parseSetup (WS_DATA_MODEL *aLayout)
 
void parseGraphic (WS_DATA_ITEM *aItem)
 parse a graphic item starting by "(line" or "(rect" and read parameters. More...
 
void parseText (WS_DATA_ITEM_TEXT *aItem)
 parse a text item starting by "(tbtext" and read parameters. More...
 
void parsePolygon (WS_DATA_ITEM_POLYGONS *aItem)
 parse a polygon item starting by "( polygon" and read parameters. More...
 
void parsePolyOutline (WS_DATA_ITEM_POLYGONS *aItem)
 parse a list of corners starting by "( pts" and read coordinates. More...
 
void parseBitmap (WS_DATA_ITEM_BITMAP *aItem)
 parse a bitmap item starting by "( bitmap" and read parameters. More...
 
void parseCoordinate (POINT_COORD &aCoord)
 
void readOption (WS_DATA_ITEM *aItem)
 
void readPngdata (WS_DATA_ITEM_BITMAP *aItem)
 

Detailed Description

Class PAGE_LAYOUT_READER_PARSER holds data and functions pertinent to parsing a S-expression file for a WS_DATA_MODEL.

Definition at line 50 of file page_layout_reader.cpp.

Constructor & Destructor Documentation

◆ PAGE_LAYOUT_READER_PARSER()

PAGE_LAYOUT_READER_PARSER::PAGE_LAYOUT_READER_PARSER ( const char *  aLine,
const wxString &  aSource 
)

Definition at line 110 of file page_layout_reader.cpp.

110  :
111  PAGE_LAYOUT_READER_LEXER( aLine, aSource )
112 {
113 }

Member Function Documentation

◆ Parse()

void PAGE_LAYOUT_READER_PARSER::Parse ( WS_DATA_MODEL aLayout)

Definition at line 116 of file page_layout_reader.cpp.

117 {
118  WS_DATA_ITEM* item;
119  LOCALE_IO toggle;
120 
121  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
122  {
123  if( token == T_LEFT )
124  token = NextTok();
125 
126  if( token == T_page_layout )
127  continue;
128 
129  switch( token )
130  {
131  case T_setup: // Defines default values for graphic items
132  parseSetup( aLayout );
133  break;
134 
135  case T_line:
137  parseGraphic( item );
138  aLayout->Append( item );
139  break;
140 
141  case T_rect:
142  item = new WS_DATA_ITEM( WS_DATA_ITEM::WS_RECT );
143  parseGraphic( item );
144  aLayout->Append( item );
145  break;
146 
147  case T_polygon:
148  item = new WS_DATA_ITEM_POLYGONS();
150  aLayout->Append( item );
151  break;
152 
153  case T_bitmap:
154  item = new WS_DATA_ITEM_BITMAP( NULL );
155  parseBitmap( (WS_DATA_ITEM_BITMAP*) item );
156  aLayout->Append( item );
157  break;
158 
159  case T_tbtext:
160  NeedSYMBOLorNUMBER();
161  item = new WS_DATA_ITEM_TEXT( FromUTF8() );
162  parseText( (WS_DATA_ITEM_TEXT*) item );
163  aLayout->Append( item );
164  break;
165 
166  default:
167  Unexpected( CurText() );
168  break;
169  }
170  }
171 }
void parseText(WS_DATA_ITEM_TEXT *aItem)
parse a text item starting by "(tbtext" and read parameters.
Work sheet structure type definitions.
Definition: ws_data_item.h:93
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:175
void parseBitmap(WS_DATA_ITEM_BITMAP *aItem)
parse a bitmap item starting by "( bitmap" and read parameters.
void Append(WS_DATA_ITEM *aItem)
void parseGraphic(WS_DATA_ITEM *aItem)
parse a graphic item starting by "(line" or "(rect" and read parameters.
void parsePolygon(WS_DATA_ITEM_POLYGONS *aItem)
parse a polygon item starting by "( polygon" and read parameters.
void parseSetup(WS_DATA_MODEL *aLayout)

References WS_DATA_MODEL::Append(), parseBitmap(), parseGraphic(), parsePolygon(), parseSetup(), parseText(), WS_DATA_ITEM::WS_RECT, and WS_DATA_ITEM::WS_SEGMENT.

Referenced by WS_DATA_MODEL::SetPageLayout().

◆ parseBitmap()

void PAGE_LAYOUT_READER_PARSER::parseBitmap ( WS_DATA_ITEM_BITMAP aItem)
private

parse a bitmap item starting by "( bitmap" and read parameters.

Definition at line 319 of file page_layout_reader.cpp.

320 {
321  BITMAP_BASE* image = new BITMAP_BASE;
322  aItem->m_ImageBitmap = image;
323 
324  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
325  {
326  if( token == T_LEFT )
327  token = NextTok();
328 
329  switch( token )
330  {
331  case T_name:
332  NeedSYMBOLorNUMBER();
333  aItem->m_Name = FromUTF8();
334  NeedRIGHT();
335  break;
336 
337  case T_pos:
338  parseCoordinate( aItem->m_Pos );
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  case T_scale:
362  aItem->m_ImageBitmap->SetScale( parseDouble() );
363  NeedRIGHT();
364  break;
365 
366  case T_pngdata:
367  readPngdata( aItem );
368  break;
369 
370  case T_option:
371  readOption( aItem );
372  break;
373 
374  default:
375  Unexpected( CurText() );
376  break;
377  }
378  }
379 }
wxString m_Name
Definition: ws_data_item.h:111
void parseCoordinate(POINT_COORD &aCoord)
int parseInt(int aMin, int aMax)
Function parseInt parses an integer and constrains it between two values.
void SetScale(double aScale)
Definition: bitmap_base.h:93
BITMAP_BASE * m_ImageBitmap
Definition: ws_data_item.h:366
double parseDouble()
Function parseDouble parses a double.
This class handle bitmap images in KiCad.
Definition: bitmap_base.h:51
void readPngdata(WS_DATA_ITEM_BITMAP *aItem)
DPOINT m_IncrementVector
Definition: ws_data_item.h:119
double m_LineWidth
Definition: ws_data_item.h:117
void readOption(WS_DATA_ITEM *aItem)
POINT_COORD m_Pos
Definition: ws_data_item.h:115

References WS_DATA_ITEM_BITMAP::m_ImageBitmap, WS_DATA_ITEM::m_IncrementVector, WS_DATA_ITEM::m_LineWidth, WS_DATA_ITEM::m_Name, WS_DATA_ITEM::m_Pos, WS_DATA_ITEM::m_RepeatCount, parseCoordinate(), parseDouble(), parseInt(), readOption(), readPngdata(), BITMAP_BASE::SetScale(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Parse().

◆ parseCoordinate()

void PAGE_LAYOUT_READER_PARSER::parseCoordinate ( POINT_COORD aCoord)
private

Definition at line 638 of file page_layout_reader.cpp.

639 {
640  aCoord.m_Pos.x = parseDouble();
641  aCoord.m_Pos.y = parseDouble();
642 
643  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
644  {
645  switch( token )
646  {
647  case T_ltcorner: aCoord.m_Anchor = LT_CORNER; break;
648  case T_lbcorner: aCoord.m_Anchor = LB_CORNER; break;
649  case T_rbcorner: aCoord.m_Anchor = RB_CORNER; break;
650  case T_rtcorner: aCoord.m_Anchor = RT_CORNER; break;
651  default: Unexpected( CurText() ); break;
652  }
653  }
654 }
double parseDouble()
Function parseDouble parses a double.
DPOINT m_Pos
Definition: ws_data_item.h:71

References LB_CORNER, LT_CORNER, POINT_COORD::m_Anchor, POINT_COORD::m_Pos, parseDouble(), RB_CORNER, RT_CORNER, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by parseBitmap(), parseGraphic(), parsePolygon(), and parseText().

◆ parseDouble()

double PAGE_LAYOUT_READER_PARSER::parseDouble ( )
private

Function parseDouble parses a double.

Returns
double - the parsed double.

Definition at line 674 of file page_layout_reader.cpp.

675 {
676  T token = NextTok();
677 
678  if( token != T_NUMBER )
679  Expecting( T_NUMBER );
680 
681  double val = strtod( CurText(), NULL );
682 
683  return val;
684 }

Referenced by parseBitmap(), parseCoordinate(), parseGraphic(), parsePolygon(), parsePolyOutline(), parseSetup(), and parseText().

◆ parseGraphic()

void PAGE_LAYOUT_READER_PARSER::parseGraphic ( WS_DATA_ITEM aItem)
private

parse a graphic item starting by "(line" or "(rect" and read parameters.

Definition at line 429 of file page_layout_reader.cpp.

430 {
431  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
432  {
433  if( token == T_LEFT )
434  token = NextTok();
435  else
436  {
437  // If another token than T_LEFT is read here, this is an error
438  // however, due to a old bug in kicad, the token T_end can be found
439  // without T_LEFT in a very few .wks files (perhaps only one in a demo).
440  // So this ugly hack disables the error detection.
441  if( token != T_end )
442  Unexpected( CurText() );
443  }
444 
445  switch( token )
446  {
447  case T_comment:
448  NeedSYMBOLorNUMBER();
449  aItem->m_Info = FromUTF8();
450  NeedRIGHT();
451  break;
452 
453  case T_option:
454  readOption( aItem );
455  break;
456 
457  case T_name:
458  NeedSYMBOLorNUMBER();
459  aItem->m_Name = FromUTF8();
460  NeedRIGHT();
461  break;
462 
463  case T_start:
464  parseCoordinate( aItem->m_Pos );
465  break;
466 
467  case T_end:
468  parseCoordinate( aItem->m_End );
469  break;
470 
471  case T_repeat:
472  aItem->m_RepeatCount = parseInt( -1, 100 );
473  NeedRIGHT();
474  break;
475 
476  case T_incrx:
477  aItem->m_IncrementVector.x = parseDouble();
478  NeedRIGHT();
479  break;
480 
481  case T_incry:
482  aItem->m_IncrementVector.y = parseDouble();
483  NeedRIGHT();
484  break;
485 
486  case T_linewidth:
487  aItem->m_LineWidth = parseDouble();
488  NeedRIGHT();
489  break;
490 
491  default:
492  Unexpected( CurText() );
493  break;
494  }
495  }
496 }
wxString m_Name
Definition: ws_data_item.h:111
void parseCoordinate(POINT_COORD &aCoord)
int parseInt(int aMin, int aMax)
Function parseInt parses an integer and constrains it between two values.
POINT_COORD m_End
Definition: ws_data_item.h:116
double parseDouble()
Function parseDouble parses a double.
wxString m_Info
Definition: ws_data_item.h:113
DPOINT m_IncrementVector
Definition: ws_data_item.h:119
double m_LineWidth
Definition: ws_data_item.h:117
void readOption(WS_DATA_ITEM *aItem)
POINT_COORD m_Pos
Definition: ws_data_item.h:115

References WS_DATA_ITEM::m_End, WS_DATA_ITEM::m_IncrementVector, WS_DATA_ITEM::m_Info, WS_DATA_ITEM::m_LineWidth, WS_DATA_ITEM::m_Name, WS_DATA_ITEM::m_Pos, WS_DATA_ITEM::m_RepeatCount, parseCoordinate(), parseDouble(), parseInt(), readOption(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Parse().

◆ parseInt()

int PAGE_LAYOUT_READER_PARSER::parseInt ( int  aMin,
int  aMax 
)
private

Function parseInt parses an integer and constrains it between two values.

Parameters
aMinis the smallest return value.
aMaxis the largest return value.
Returns
int - the parsed integer.

Definition at line 656 of file page_layout_reader.cpp.

657 {
658  T token = NextTok();
659 
660  if( token != T_NUMBER )
661  Expecting( T_NUMBER );
662 
663  int val = atoi( CurText() );
664 
665  if( val < aMin )
666  val = aMin;
667  else if( val > aMax )
668  val = aMax;
669 
670  return val;
671 }

Referenced by parseBitmap(), parseGraphic(), parsePolygon(), and parseText().

◆ parsePolygon()

void PAGE_LAYOUT_READER_PARSER::parsePolygon ( WS_DATA_ITEM_POLYGONS aItem)
private

parse a polygon item starting by "( polygon" and read parameters.

the list of corners included in this description is read by parsePolyOutline

Definition at line 225 of file page_layout_reader.cpp.

226 {
227  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
228  {
229  if( token == T_LEFT )
230  token = NextTok();
231 
232  switch( token )
233  {
234  case T_comment:
235  NeedSYMBOLorNUMBER();
236  aItem->m_Info = FromUTF8();
237  NeedRIGHT();
238  break;
239 
240  case T_pos:
241  parseCoordinate( aItem->m_Pos );
242  break;
243 
244  case T_name:
245  NeedSYMBOLorNUMBER();
246  aItem->m_Name = FromUTF8();
247  NeedRIGHT();
248  break;
249 
250  case T_option:
251  readOption( aItem );
252  break;
253 
254  case T_pts:
255  parsePolyOutline( aItem );
256  aItem->CloseContour();
257  break;
258 
259  case T_rotate:
260  aItem->m_Orient = parseDouble();
261  NeedRIGHT();
262  break;
263 
264  case T_repeat:
265  aItem->m_RepeatCount = parseInt( -1, 100 );
266  NeedRIGHT();
267  break;
268 
269  case T_incrx:
270  aItem->m_IncrementVector.x = parseDouble();
271  NeedRIGHT();
272  break;
273 
274  case T_incry:
275  aItem->m_IncrementVector.y = parseDouble();
276  NeedRIGHT();
277  break;
278 
279  case T_linewidth:
280  aItem->m_LineWidth = parseDouble();
281  NeedRIGHT();
282  break;
283 
284  default:
285  Unexpected( CurText() );
286  break;
287  }
288  }
289 
290  aItem->SetBoundingBox();
291 }
wxString m_Name
Definition: ws_data_item.h:111
void parseCoordinate(POINT_COORD &aCoord)
int parseInt(int aMin, int aMax)
Function parseInt parses an integer and constrains it between two values.
double parseDouble()
Function parseDouble parses a double.
wxString m_Info
Definition: ws_data_item.h:113
void CloseContour()
Closes the current contour, by storing the index of the last corner of the current polygon in m_polyI...
Definition: ws_data_item.h:246
void parsePolyOutline(WS_DATA_ITEM_POLYGONS *aItem)
parse a list of corners starting by "( pts" and read coordinates.
DPOINT m_IncrementVector
Definition: ws_data_item.h:119
double m_LineWidth
Definition: ws_data_item.h:117
void readOption(WS_DATA_ITEM *aItem)
void SetBoundingBox()
calculate the bounding box of the set polygons
POINT_COORD m_Pos
Definition: ws_data_item.h:115

References WS_DATA_ITEM_POLYGONS::CloseContour(), WS_DATA_ITEM::m_IncrementVector, WS_DATA_ITEM::m_Info, WS_DATA_ITEM::m_LineWidth, WS_DATA_ITEM::m_Name, WS_DATA_ITEM_POLYGONS::m_Orient, WS_DATA_ITEM::m_Pos, WS_DATA_ITEM::m_RepeatCount, parseCoordinate(), parseDouble(), parseInt(), parsePolyOutline(), readOption(), WS_DATA_ITEM_POLYGONS::SetBoundingBox(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Parse().

◆ parsePolyOutline()

void PAGE_LAYOUT_READER_PARSER::parsePolyOutline ( WS_DATA_ITEM_POLYGONS aItem)
private

parse a list of corners starting by "( pts" and read coordinates.

Definition at line 293 of file page_layout_reader.cpp.

294 {
295  DPOINT corner;
296 
297  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
298  {
299  if( token == T_LEFT )
300  token = NextTok();
301 
302  switch( token )
303  {
304  case T_xy:
305  corner.x = parseDouble();
306  corner.y = parseDouble();
307  aItem->AppendCorner( corner );
308  NeedRIGHT();
309  break;
310 
311  default:
312  Unexpected( CurText() );
313  break;
314  }
315  }
316 }
void AppendCorner(const DPOINT &aCorner)
add a corner in corner list
Definition: ws_data_item.h:237
double parseDouble()
Function parseDouble parses a double.

References WS_DATA_ITEM_POLYGONS::AppendCorner(), parseDouble(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by parsePolygon().

◆ parseSetup()

void PAGE_LAYOUT_READER_PARSER::parseSetup ( WS_DATA_MODEL aLayout)
private

Definition at line 173 of file page_layout_reader.cpp.

174 {
175  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
176  {
177  switch( token )
178  {
179  case T_LEFT:
180  break;
181 
182  case T_linewidth:
183  aLayout->m_DefaultLineWidth = parseDouble();
184  NeedRIGHT();
185  break;
186 
187  case T_textsize:
188  aLayout->m_DefaultTextSize.x = parseDouble();
189  aLayout->m_DefaultTextSize.y = parseDouble();
190  NeedRIGHT();
191  break;
192 
193  case T_textlinewidth:
194  aLayout->m_DefaultTextThickness = parseDouble();
195  NeedRIGHT();
196  break;
197 
198  case T_left_margin:
199  aLayout->SetLeftMargin( parseDouble() );
200  NeedRIGHT();
201  break;
202 
203  case T_right_margin:
204  aLayout->SetRightMargin( parseDouble() );
205  NeedRIGHT();
206  break;
207 
208  case T_top_margin:
209  aLayout->SetTopMargin( parseDouble() );
210  NeedRIGHT();
211  break;
212 
213  case T_bottom_margin:
214  aLayout->SetBottomMargin( parseDouble() );
215  NeedRIGHT();
216  break;
217 
218  default:
219  Unexpected( CurText() );
220  break;
221  }
222  }
223 }
double parseDouble()
Function parseDouble parses a double.
DSIZE m_DefaultTextSize
Definition: ws_data_model.h:56
void SetLeftMargin(double aMargin)
Definition: ws_data_model.h:85
void SetTopMargin(double aMargin)
Definition: ws_data_model.h:91
void SetBottomMargin(double aMargin)
Definition: ws_data_model.h:94
double m_DefaultLineWidth
Definition: ws_data_model.h:55
double m_DefaultTextThickness
Definition: ws_data_model.h:57
void SetRightMargin(double aMargin)
Definition: ws_data_model.h:88

References WS_DATA_MODEL::m_DefaultLineWidth, WS_DATA_MODEL::m_DefaultTextSize, WS_DATA_MODEL::m_DefaultTextThickness, parseDouble(), WS_DATA_MODEL::SetBottomMargin(), WS_DATA_MODEL::SetLeftMargin(), WS_DATA_MODEL::SetRightMargin(), WS_DATA_MODEL::SetTopMargin(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Parse().

◆ parseText()

void PAGE_LAYOUT_READER_PARSER::parseText ( WS_DATA_ITEM_TEXT aItem)
private

parse a text item starting by "(tbtext" and read parameters.

Definition at line 499 of file page_layout_reader.cpp.

500 {
501  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
502  {
503  if( token == T_LEFT )
504  token = NextTok();
505 
506  switch( token )
507  {
508  case T_comment:
509  NeedSYMBOLorNUMBER();
510  aItem->m_Info = FromUTF8();
511  NeedRIGHT();
512  break;
513 
514  case T_option:
515  readOption( aItem );
516  break;
517 
518  case T_name:
519  NeedSYMBOLorNUMBER();
520  aItem->m_Name = FromUTF8();
521  NeedRIGHT();
522  break;
523 
524  case T_pos:
525  parseCoordinate( aItem->m_Pos );
526  break;
527 
528  case T_repeat:
529  aItem->m_RepeatCount = parseInt( -1, 100 );
530  NeedRIGHT();
531  break;
532 
533  case T_incrx:
534  aItem->m_IncrementVector.x = parseDouble();
535  NeedRIGHT();
536  break;
537 
538  case T_incry:
539  aItem->m_IncrementVector.y = parseDouble();
540  NeedRIGHT();
541  break;
542 
543  case T_incrlabel:
544  aItem->m_IncrementLabel = parseInt(INT_MIN, INT_MAX);
545  NeedRIGHT();
546  break;
547 
548  case T_maxlen:
549  aItem->m_BoundingBoxSize.x = parseDouble();
550  NeedRIGHT();
551  break;
552 
553  case T_maxheight:
554  aItem->m_BoundingBoxSize.y = parseDouble();
555  NeedRIGHT();
556  break;
557 
558  case T_font:
559  for( token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
560  {
561  switch( token )
562  {
563  case T_LEFT:
564  break;
565 
566  case T_bold:
567  aItem->m_Bold = true;
568  break;
569 
570  case T_italic:
571  aItem->m_Italic = true;
572  break;
573 
574  case T_size:
575  aItem->m_TextSize.x = parseDouble();
576  aItem->m_TextSize.y = parseDouble();
577  NeedRIGHT();
578  break;
579 
580  case T_linewidth:
581  aItem->m_LineWidth = parseDouble();
582  NeedRIGHT();
583  break;
584 
585  default:
586  Unexpected( CurText() );
587  break;
588  }
589  }
590  break;
591 
592  case T_justify:
593  for( token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
594  {
595  switch( token )
596  {
597  case T_center:
600  break;
601 
602  case T_left:
604  break;
605 
606  case T_right:
608  break;
609 
610  case T_top:
612  break;
613 
614  case T_bottom:
616  break;
617 
618  default:
619  Unexpected( CurText() );
620  break;
621  }
622  }
623  break;
624 
625  case T_rotate:
626  aItem->m_Orient = parseDouble();
627  NeedRIGHT();
628  break;
629 
630  default:
631  Unexpected( CurText() );
632  break;
633  }
634  }
635 }
wxString m_Name
Definition: ws_data_item.h:111
void parseCoordinate(POINT_COORD &aCoord)
int parseInt(int aMin, int aMax)
Function parseInt parses an integer and constrains it between two values.
double parseDouble()
Function parseDouble parses a double.
wxString m_Info
Definition: ws_data_item.h:113
EDA_TEXT_HJUSTIFY_T m_Hjustify
Definition: ws_data_item.h:304
EDA_TEXT_VJUSTIFY_T m_Vjustify
Definition: ws_data_item.h:305
DPOINT m_IncrementVector
Definition: ws_data_item.h:119
double m_LineWidth
Definition: ws_data_item.h:117
void readOption(WS_DATA_ITEM *aItem)
int m_IncrementLabel
Definition: ws_data_item.h:121
POINT_COORD m_Pos
Definition: ws_data_item.h:115

References GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, WS_DATA_ITEM_TEXT::m_Bold, WS_DATA_ITEM_TEXT::m_BoundingBoxSize, WS_DATA_ITEM_TEXT::m_Hjustify, WS_DATA_ITEM::m_IncrementLabel, WS_DATA_ITEM::m_IncrementVector, WS_DATA_ITEM::m_Info, WS_DATA_ITEM_TEXT::m_Italic, WS_DATA_ITEM::m_LineWidth, WS_DATA_ITEM::m_Name, WS_DATA_ITEM_TEXT::m_Orient, WS_DATA_ITEM::m_Pos, WS_DATA_ITEM::m_RepeatCount, WS_DATA_ITEM_TEXT::m_TextSize, WS_DATA_ITEM_TEXT::m_Vjustify, parseCoordinate(), parseDouble(), parseInt(), readOption(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Parse().

◆ readOption()

void PAGE_LAYOUT_READER_PARSER::readOption ( WS_DATA_ITEM aItem)
private

Definition at line 415 of file page_layout_reader.cpp.

416 {
417  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
418  {
419  switch( token )
420  {
421  case T_page1only: aItem->SetPage1Option( FIRST_PAGE_ONLY ); break;
422  case T_notonpage1: aItem->SetPage1Option( SUBSEQUENT_PAGES ); break;
423  default: Unexpected( CurText() ); break;
424  }
425  }
426 }
void SetPage1Option(PAGE_OPTION aChoice)
Definition: ws_data_item.h:154

References FIRST_PAGE_ONLY, WS_DATA_ITEM::SetPage1Option(), and SUBSEQUENT_PAGES.

Referenced by parseBitmap(), parseGraphic(), parsePolygon(), and parseText().

◆ readPngdata()

void PAGE_LAYOUT_READER_PARSER::readPngdata ( WS_DATA_ITEM_BITMAP aItem)
private

Definition at line 381 of file page_layout_reader.cpp.

382 {
383  std::string tmp;
384 
385  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
386  {
387  if( token == T_LEFT )
388  token = NextTok();
389 
390  switch( token )
391  {
392  case T_data:
393  NeedSYMBOLorNUMBER();
394  tmp += CurStr();
395  tmp += "\n";
396  NeedRIGHT();
397  break;
398 
399  default:
400  Unexpected( CurText() );
401  break;
402  }
403  }
404 
405  tmp += "EndData";
406 
407  wxString msg;
408  STRING_LINE_READER str_reader( tmp, wxT("Png kicad_wks data") );
409 
410  if( ! aItem->m_ImageBitmap->LoadData( str_reader, msg ) )
411  wxLogMessage(msg);
412 }
BITMAP_BASE * m_ImageBitmap
Definition: ws_data_item.h:366
bool LoadData(LINE_READER &aLine, wxString &aErrorMsg)
Load an image data saved by SaveData (png, in Hexadecimal form)
Class STRING_LINE_READER is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:254

References BITMAP_BASE::LoadData(), and WS_DATA_ITEM_BITMAP::m_ImageBitmap.

Referenced by parseBitmap().


The documentation for this class was generated from the following file: