107 const wxPoint& framepos ) :
108 wxDialog( parent, -1,
_( "Complex shape" ), framepos, wxSize( 350, 280 ),
109 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
115 wxBoxSizer* MainBoxSizer =
new wxBoxSizer( wxHORIZONTAL );
116 SetSizer( MainBoxSizer );
117 wxBoxSizer* LeftBoxSizer =
new wxBoxSizer( wxVERTICAL );
118 wxBoxSizer* RightBoxSizer =
new wxBoxSizer( wxVERTICAL );
119 MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
120 MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
122 wxButton* Button =
new wxButton(
this, wxID_OK,
_(
"OK" ) );
123 RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
125 Button =
new wxButton(
this, wxID_CANCEL,
_(
"Cancel" ) );
126 RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
129 _(
"Read Shape Description File..." ) );
130 RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
132 wxString shapelist[] = {
_(
"Normal" ),
_(
"Symmetrical" ),
_(
"Mirrored" ) };
134 m_ShapeOptionCtrl =
new wxRadioBox(
this, -1,
_(
"Shape Option" ),
135 wxDefaultPosition, wxDefaultSize, 3,
138 LeftBoxSizer->Add( m_ShapeOptionCtrl, 0, wxGROW | wxALL, 5 );
143 GetSizer()->SetSizeHints(
this );
150 EndModal( wxID_CANCEL );
164 static wxString lastpath;
165 wxString fullFileName;
166 wxString mask = wxFileSelectorDefaultWildcardStr;
169 fullFileName, wxEmptyString, mask,
this,
172 if( fullFileName.IsEmpty() )
175 wxFileName fn( fullFileName );
176 lastpath = fn.GetPath();
179 FILE* File = wxFopen( fullFileName, wxT(
"rt" ) );
197 char* Line = reader.
Line();
198 char* param1 = strtok( Line,
" =\n\r" );
199 char* param2 = strtok(
NULL,
" \t\n\r" );
201 if( strncasecmp( param1,
"Unit", 4 ) == 0 )
203 if( strncasecmp( param2,
"inch", 4 ) == 0 )
206 if( strncasecmp( param2,
"mm", 2 ) == 0 )
210 if( strncasecmp( param1,
"$ENDCOORD", 8 ) == 0 )
213 if( strncasecmp( param1,
"$COORD", 6 ) == 0 )
217 Line = reader.
Line();
218 param1 = strtok( Line,
" \t\n\r" );
219 param2 = strtok(
NULL,
" \t\n\r" );
221 if( strncasecmp( param1,
"$ENDCOORD", 8 ) == 0 )
224 wxRealPoint coord( atof( param1 ), atof( param2 ) );
229 if( strncasecmp( Line,
"XScale", 6 ) == 0 )
232 if( strncasecmp( Line,
"YScale", 6 ) == 0 )
256 int ret = dlg.ShowModal();
282 cmp_name = wxT(
"muwave_polygon" );
294 pad1->
SetX0( offset.x );
310 std::vector<wxPoint> polyPoints;
311 polyPoints.reserve(
PolyEdges.size() + 2 );
314 polyPoints.emplace_back( wxPoint( offset.x, 0 ) );
316 wxPoint last_coordinate;
322 last_coordinate += offset;
323 polyPoints.push_back( last_coordinate );
327 if( last_coordinate.y != 0 )
328 polyPoints.emplace_back( wxPoint( last_coordinate.x, 0 ) );
337 for(
int ndx = (
int) polyPoints.size() - 1; ndx >= 0; --ndx )
339 wxPoint pt = polyPoints[ndx];
341 polyPoints.push_back( pt );
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
MWAVE_POLYGONAL_SHAPE_DLG(PCB_EDIT_FRAME *parent, const wxPoint &pos)
void OnModify() override
Must be called after a board change to set the modified flag.
char * Line() const
Return a pointer to the last line that was read in.
wxRadioBox * m_ShapeOptionCtrl
This file is part of the common library TODO brief description.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Implementation of conversion functions that require both schematic and board internal units.
This file is part of the common library.
PCB_EDIT_FRAME * m_Parent
static constexpr double IU_PER_MM
Mock up a conversion function.
void SetFilled(bool aFlag)
polygon (not yet used for tracks, but could be in microwave apps)
Object to edit/enter a size (pair of values for X and Y size ( INCHES or MM ) in dialog boxes.
EDA_SIZE_CTRL * m_SizeCtrl
char * ReadLine() override
Read a line of text into the buffer and increments the line number counter.
~MWAVE_POLYGONAL_SHAPE_DLG()
A LINE_READER that reads from an open file.
void SetShape(PCB_SHAPE_TYPE_T aShape)
void OnOkClick(wxCommandEvent &event)
void ReadDataShapeDescr(wxCommandEvent &event)
Function ReadDataShapeDescr read a description shape file File format is Unit=MM XScale=271....
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
A helper function that wraps a call to wxFileSelector.
void OnCancelClick(wxCommandEvent &event)
Helper dialog and control classes.
static double ShapeScaleY
const wxPoint & GetPos0() const
static std::vector< wxRealPoint > PolyEdges
The main frame for Pcbnew.
void SetWidth(int aWidth)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
Read lines of text from another LINE_READER but only returns non-comment lines and non-blank lines fr...
void SetValue(int x_value, int y_value)
void SetPolyPoints(const std::vector< wxPoint > &aPoints)
Custom text control validator definitions.
static double ShapeScaleX