105 const wxPoint& framepos ) :
106 DIALOG_SHIM( parent, -1,
_(
"Complex Shape" ), framepos, wxDefaultSize,
107 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
115 wxBoxSizer* mainBoxSizer =
new wxBoxSizer( wxVERTICAL );
116 SetSizer( mainBoxSizer );
120 wxBoxSizer* topBoxSizer =
new wxBoxSizer( wxHORIZONTAL );
121 mainBoxSizer->Add( topBoxSizer, 1, wxGROW | wxALL, 5 );
123 wxString shapelist[] = {
_(
"Normal" ),
_(
"Symmetrical" ),
_(
"Mirrored" ) };
126 wxDefaultPosition, wxDefaultSize, 3,
131 auto sizeSizer =
new wxStaticBoxSizer(
new wxStaticBox(
this, wxID_ANY,
_(
"Size" ) ),
133 wxBoxSizer* xSizer =
new wxBoxSizer( wxHORIZONTAL );
134 wxBoxSizer* ySizer =
new wxBoxSizer( wxHORIZONTAL );
136 topBoxSizer->Add( sizeSizer, 1, wxGROW | wxALL, 5 );
137 sizeSizer->Add( xSizer, 0, 0, 5 );
138 sizeSizer->Add( ySizer, 0, 0, 5 );
140 wxStaticText* xLabel =
new wxStaticText(
this, -1,
_(
"X:" ) );
141 wxTextCtrl* xCtrl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString );
142 wxStaticText* xUnits =
new wxStaticText(
this, -1,
_(
"units" ) );
144 xSizer->Add( xLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
145 xSizer->Add( xCtrl, 1, wxALIGN_CENTER_VERTICAL, 5 );
146 xSizer->Add( xUnits, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
149 wxStaticText* yLabel =
new wxStaticText(
this, -1,
_(
"Y:" ) );
150 wxTextCtrl* yCtrl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString );
151 wxStaticText* yUnits =
new wxStaticText(
this, -1,
_(
"units" ) );
153 ySizer->Add( yLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
154 ySizer->Add( yCtrl, 1, wxALIGN_CENTER_VERTICAL, 5 );
155 ySizer->Add( yUnits, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
160 wxBoxSizer* buttonsBoxSizer =
new wxBoxSizer( wxHORIZONTAL );
161 mainBoxSizer->Add( buttonsBoxSizer, 0, wxALL, 5 );
163 wxButton* btn =
new wxButton(
this,
ID_READ_SHAPE_FILE,
_(
"Read Shape Description File..." ) );
164 buttonsBoxSizer->Add( btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 10 );
165 buttonsBoxSizer->AddStretchSpacer();
167 wxStdDialogButtonSizer* sdbSizer =
new wxStdDialogButtonSizer();
168 buttonsBoxSizer->Add( sdbSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
169 wxButton* sdbSizerOK =
new wxButton(
this, wxID_OK );
170 sdbSizer->AddButton( sdbSizerOK );
171 wxButton* sdbSizerCancel =
new wxButton(
this, wxID_CANCEL );
172 sdbSizer->AddButton( sdbSizerCancel );
175 GetSizer()->SetSizeHints(
this );
201 static wxString s_lastpath;
202 wxString fullFileName;
203 wxString mask = wxFileSelectorDefaultWildcardStr;
205 fullFileName = wxFileSelector(
_(
"Shape Description File" ), s_lastpath,
206 fullFileName, wxEmptyString, mask, wxFD_OPEN,
this );
208 if( fullFileName.IsEmpty() )
211 wxFileName fn( fullFileName );
212 s_lastpath = fn.GetPath();
215 FILE* File = wxFopen( fullFileName, wxT(
"rt" ) );
217 if( File ==
nullptr )
233 char* Line = reader.
Line();
234 char* param1 = strtok( Line,
" =\n\r" );
235 char* param2 = strtok(
nullptr,
" \t\n\r" );
237 if( strncasecmp( param1,
"Unit", 4 ) == 0 )
239 if( strncasecmp( param2,
"inch", 4 ) == 0 )
242 if( strncasecmp( param2,
"mm", 2 ) == 0 )
246 if( strncasecmp( param1,
"$ENDCOORD", 8 ) == 0 )
249 if( strncasecmp( param1,
"$COORD", 6 ) == 0 )
253 Line = reader.
Line();
254 param1 = strtok( Line,
" \t\n\r" );
255 param2 = strtok(
nullptr,
" \t\n\r" );
257 if( strncasecmp( param1,
"$ENDCOORD", 8 ) == 0 )
260 wxRealPoint coord( atof( param1 ), atof( param2 ) );
265 if( strncasecmp( Line,
"XScale", 6 ) == 0 )
268 if( strncasecmp( Line,
"YScale", 6 ) == 0 )