KiCad PCB EDA Suite
drawing_sheet_reader.cpp File Reference
#include <eda_item.h>
#include <locale_io.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_painter.h>
#include <drawing_sheet/drawing_sheet_reader_lexer.h>
#include <wx/ffile.h>
#include <wx/file.h>
#include <wx/mstream.h>

Go to the source code of this file.

Classes

class  DRAWING_SHEET_READER_PARSER
 DRAWING_SHEET_READER_PARSER holds data and functions pertinent to parsing a S-expression file for a DS_DATA_MODEL. More...
 

Functions

wxString convertLegacyVariableRefs (const wxString &aTextbase)
 

Variables

const char defaultDrawingSheet []
 
const char emptyDrawingSheet []
 

Function Documentation

◆ convertLegacyVariableRefs()

wxString convertLegacyVariableRefs ( const wxString &  aTextbase)

Definition at line 113 of file drawing_sheet_reader.cpp.

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 }

Referenced by DRAWING_SHEET_READER_PARSER::Parse().

Variable Documentation

◆ defaultDrawingSheet

const char defaultDrawingSheet[]

◆ emptyDrawingSheet

const char emptyDrawingSheet[]