109 const wxPoint& framepos ) :
110 DIALOG_SHIM( parent, -1,
_(
"Complex Shape" ), framepos, wxDefaultSize,
111 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
119 wxBoxSizer* mainBoxSizer =
new wxBoxSizer( wxVERTICAL );
120 SetSizer( mainBoxSizer );
124 wxBoxSizer* topBoxSizer =
new wxBoxSizer( wxHORIZONTAL );
125 mainBoxSizer->Add( topBoxSizer, 1, wxGROW | wxALL, 5 );
127 wxString shapelist[] = {
_(
"Normal" ),
_(
"Symmetrical" ),
_(
"Mirrored" ) };
130 wxDefaultPosition, wxDefaultSize, 3,
135 auto sizeSizer =
new wxStaticBoxSizer(
new wxStaticBox(
this, wxID_ANY,
_(
"Size" ) ),
137 wxBoxSizer* xSizer =
new wxBoxSizer( wxHORIZONTAL );
138 wxBoxSizer* ySizer =
new wxBoxSizer( wxHORIZONTAL );
140 topBoxSizer->Add( sizeSizer, 1, wxGROW | wxALL, 5 );
141 sizeSizer->Add( xSizer, 0, 0, 5 );
142 sizeSizer->Add( ySizer, 0, 0, 5 );
144 wxStaticText* xLabel =
new wxStaticText(
this, -1,
_(
"X:" ) );
145 wxTextCtrl* xCtrl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString );
146 wxStaticText* xUnits =
new wxStaticText(
this, -1,
_(
"units" ) );
148 xSizer->Add( xLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
149 xSizer->Add( xCtrl, 1, wxALIGN_CENTER_VERTICAL, 5 );
150 xSizer->Add( xUnits, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
153 wxStaticText* yLabel =
new wxStaticText(
this, -1,
_(
"Y:" ) );
154 wxTextCtrl* yCtrl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString );
155 wxStaticText* yUnits =
new wxStaticText(
this, -1,
_(
"units" ) );
157 ySizer->Add( yLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
158 ySizer->Add( yCtrl, 1, wxALIGN_CENTER_VERTICAL, 5 );
159 ySizer->Add( yUnits, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
164 wxBoxSizer* buttonsBoxSizer =
new wxBoxSizer( wxHORIZONTAL );
165 mainBoxSizer->Add( buttonsBoxSizer, 0, wxALL, 5 );
167 wxButton* btn =
new wxButton(
this,
ID_READ_SHAPE_FILE,
_(
"Read Shape Description File..." ) );
168 buttonsBoxSizer->Add( btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 10 );
169 buttonsBoxSizer->AddStretchSpacer();
171 wxStdDialogButtonSizer* sdbSizer =
new wxStdDialogButtonSizer();
172 buttonsBoxSizer->Add( sdbSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
173 wxButton* sdbSizerOK =
new wxButton(
this, wxID_OK );
174 sdbSizer->AddButton( sdbSizerOK );
175 wxButton* sdbSizerCancel =
new wxButton(
this, wxID_CANCEL );
176 sdbSizer->AddButton( sdbSizerCancel );
179 GetSizer()->SetSizeHints(
this );
205 static wxString s_lastpath;
206 wxString fullFileName;
207 wxString mask = wxFileSelectorDefaultWildcardStr;
209 fullFileName = wxFileSelector(
_(
"Shape Description File" ), s_lastpath,
210 fullFileName, wxEmptyString, mask, wxFD_OPEN,
this );
212 if( fullFileName.IsEmpty() )
215 wxFileName fn( fullFileName );
216 s_lastpath = fn.GetPath();
219 FILE* File = wxFopen( fullFileName, wxT(
"rt" ) );
221 if( File ==
nullptr )
237 char* Line = reader.
Line();
238 char* param1 = strtok( Line,
" =\n\r" );
239 char* param2 = strtok(
nullptr,
" \t\n\r" );
241 if( strncasecmp( param1,
"Unit", 4 ) == 0 )
243 if( strncasecmp( param2,
"inch", 4 ) == 0 )
246 if( strncasecmp( param2,
"mm", 2 ) == 0 )
250 if( strncasecmp( param1,
"$ENDCOORD", 8 ) == 0 )
253 if( strncasecmp( param1,
"$COORD", 6 ) == 0 )
257 Line = reader.
Line();
258 param1 = strtok( Line,
" \t\n\r" );
259 param2 = strtok(
nullptr,
" \t\n\r" );
261 if( strncasecmp( param1,
"$ENDCOORD", 8 ) == 0 )
264 wxRealPoint coord( atof( param1 ), atof( param2 ) );
269 if( strncasecmp( Line,
"XScale", 6 ) == 0 )
272 if( strncasecmp( Line,
"YScale", 6 ) == 0 )