KiCad PCB EDA Suite
bitmap2cmp_gui_base.cpp
Go to the documentation of this file.
1 // C++ code generated with wxFormBuilder (version Oct 26 2018)
3 // http://www.wxformbuilder.org/
4 //
5 // PLEASE DO *NOT* EDIT THIS FILE!
7 
8 #include "bitmap2cmp_gui_base.h"
9 
11 
12 BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : KIWAY_PLAYER( parent, id, title, pos, size, style )
13 {
14  this->SetSizeHints( wxDefaultSize, wxDefaultSize );
15 
16  wxBoxSizer* bMainSizer;
17  bMainSizer = new wxBoxSizer( wxHORIZONTAL );
18 
19  m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
20  m_InitialPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
21  m_InitialPicturePanel->SetScrollRate( 5, 5 );
22  m_InitialPicturePanel->SetMinSize( wxSize( 400,300 ) );
23 
24  m_Notebook->AddPage( m_InitialPicturePanel, _("Original Picture"), true );
25  m_GreyscalePicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
26  m_GreyscalePicturePanel->SetScrollRate( 5, 5 );
27  m_GreyscalePicturePanel->SetMinSize( wxSize( 400,300 ) );
28 
29  m_Notebook->AddPage( m_GreyscalePicturePanel, _("Greyscale Picture"), false );
30  m_BNPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
31  m_BNPicturePanel->SetScrollRate( 5, 5 );
32  m_Notebook->AddPage( m_BNPicturePanel, _("Black&&White Picture"), false );
33 
34  bMainSizer->Add( m_Notebook, 1, wxEXPAND, 5 );
35 
36  m_panelRight = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
37  wxBoxSizer* brightSizer;
38  brightSizer = new wxBoxSizer( wxVERTICAL );
39 
40  wxStaticBoxSizer* sbSizerInfo;
41  sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Bitmap Information") ), wxVERTICAL );
42 
43  wxFlexGridSizer* fgSizerInfo;
44  fgSizerInfo = new wxFlexGridSizer( 0, 4, 0, 0 );
45  fgSizerInfo->AddGrowableCol( 1 );
46  fgSizerInfo->AddGrowableCol( 2 );
47  fgSizerInfo->SetFlexibleDirection( wxBOTH );
48  fgSizerInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
49 
50  m_staticTextISize = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Bitmap size:"), wxDefaultPosition, wxDefaultSize, 0 );
51  m_staticTextISize->Wrap( -1 );
52  fgSizerInfo->Add( m_staticTextISize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
53 
54  m_SizeXValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
55  m_SizeXValue->Wrap( -1 );
56  fgSizerInfo->Add( m_SizeXValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
57 
58  m_SizeYValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
59  m_SizeYValue->Wrap( -1 );
60  fgSizerInfo->Add( m_SizeYValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
61 
62  m_SizePixUnits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
63  m_SizePixUnits->Wrap( -1 );
64  fgSizerInfo->Add( m_SizePixUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
65 
66  m_staticTextDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Bitmap PPI:"), wxDefaultPosition, wxDefaultSize, 0 );
67  m_staticTextDPI->Wrap( -1 );
68  fgSizerInfo->Add( m_staticTextDPI, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
69 
70  m_InputXValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
71  m_InputXValueDPI->Wrap( -1 );
72  fgSizerInfo->Add( m_InputXValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
73 
74  m_InputYValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
75  m_InputYValueDPI->Wrap( -1 );
76  fgSizerInfo->Add( m_InputYValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
77 
78  m_DPIUnit = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("PPI"), wxDefaultPosition, wxDefaultSize, 0 );
79  m_DPIUnit->Wrap( -1 );
80  fgSizerInfo->Add( m_DPIUnit, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
81 
82  m_staticTextBPP = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 );
83  m_staticTextBPP->Wrap( -1 );
84  fgSizerInfo->Add( m_staticTextBPP, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
85 
86  m_BPPValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
87  m_BPPValue->Wrap( -1 );
88  fgSizerInfo->Add( m_BPPValue, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
89 
90  m_BPPunits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 );
91  m_BPPunits->Wrap( -1 );
92  fgSizerInfo->Add( m_BPPunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
93 
94 
95  fgSizerInfo->Add( 0, 0, 0, 0, 5 );
96 
97 
98  sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND, 5 );
99 
100 
101  brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 );
102 
103  wxStaticBoxSizer* sbSizerImgPrms;
104  sbSizerImgPrms = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Output Parameters") ), wxVERTICAL );
105 
106  wxBoxSizer* bSizerLock;
107  bSizerLock = new wxBoxSizer( wxHORIZONTAL );
108 
109  m_textLock = new wxStaticText( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("Lock height/width ratio"), wxDefaultPosition, wxDefaultSize, 0 );
110  m_textLock->Wrap( -1 );
111  bSizerLock->Add( m_textLock, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
112 
113  m_AspectRatioLockButton = new wxBitmapButton( sbSizerImgPrms->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
114  bSizerLock->Add( m_AspectRatioLockButton, 0, wxALL, 5 );
115 
116 
117  sbSizerImgPrms->Add( bSizerLock, 0, wxEXPAND, 5 );
118 
119  wxBoxSizer* bSizerRes;
120  bSizerRes = new wxBoxSizer( wxHORIZONTAL );
121 
122  m_staticTextOSize = new wxStaticText( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
123  m_staticTextOSize->Wrap( -1 );
124  bSizerRes->Add( m_staticTextOSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
125 
126  m_UnitSizeX = new wxTextCtrl( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
127  m_UnitSizeX->SetMinSize( wxSize( 60,-1 ) );
128 
129  bSizerRes->Add( m_UnitSizeX, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
130 
131  m_UnitSizeY = new wxTextCtrl( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
132  m_UnitSizeY->SetMinSize( wxSize( 60,-1 ) );
133 
134  bSizerRes->Add( m_UnitSizeY, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
135 
136  wxArrayString m_PixelUnitChoices;
137  m_PixelUnit = new wxChoice( sbSizerImgPrms->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_PixelUnitChoices, 0 );
138  m_PixelUnit->SetSelection( 0 );
139  m_PixelUnit->SetMinSize( wxSize( 80,-1 ) );
140 
141  bSizerRes->Add( m_PixelUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
142 
143 
144  sbSizerImgPrms->Add( bSizerRes, 0, wxEXPAND, 5 );
145 
146 
147  brightSizer->Add( sbSizerImgPrms, 0, wxEXPAND|wxALL, 5 );
148 
149  m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
150  brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
151 
152  m_buttonExportFile = new wxButton( m_panelRight, wxID_ANY, _("Export to File"), wxDefaultPosition, wxDefaultSize, 0 );
153  brightSizer->Add( m_buttonExportFile, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
154 
155  m_buttonExportClipboard = new wxButton( m_panelRight, wxID_ANY, _("Export to Clipboard"), wxDefaultPosition, wxDefaultSize, 0 );
156  brightSizer->Add( m_buttonExportClipboard, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
157 
158  wxString m_rbOutputFormatChoices[] = { _("Symbol (.lib file)"), _("Footprint (.kicad_mod file)"), _("Postscript (.ps file)"), _("Worksheet (.kicad_wks file)") };
159  int m_rbOutputFormatNChoices = sizeof( m_rbOutputFormatChoices ) / sizeof( wxString );
160  m_rbOutputFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Output Format"), wxDefaultPosition, wxDefaultSize, m_rbOutputFormatNChoices, m_rbOutputFormatChoices, 1, wxRA_SPECIFY_COLS );
161  m_rbOutputFormat->SetSelection( 0 );
162  brightSizer->Add( m_rbOutputFormat, 0, wxEXPAND|wxALL, 5 );
163 
164  wxStaticBoxSizer* sbSizer2;
165  sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Image Options") ), wxVERTICAL );
166 
167  m_ThresholdText = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Black / White Threshold:"), wxDefaultPosition, wxDefaultSize, 0 );
168  m_ThresholdText->Wrap( -1 );
169  sbSizer2->Add( m_ThresholdText, 0, wxTOP|wxLEFT, 5 );
170 
171  m_sliderThreshold = new wxSlider( sbSizer2->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
172  m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") );
173 
174  sbSizer2->Add( m_sliderThreshold, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
175 
176  m_checkNegative = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Negative"), wxDefaultPosition, wxDefaultSize, 0 );
177  sbSizer2->Add( m_checkNegative, 0, wxTOP|wxBOTTOM, 10 );
178 
179 
180  brightSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 );
181 
182  wxString m_rbPCBLayerChoices[] = { _("Front silk screen"), _("Front solder mask"), _("User layer Eco1"), _("User layer Eco2") };
183  int m_rbPCBLayerNChoices = sizeof( m_rbPCBLayerChoices ) / sizeof( wxString );
184  m_rbPCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline"), wxDefaultPosition, wxDefaultSize, m_rbPCBLayerNChoices, m_rbPCBLayerChoices, 1, wxRA_SPECIFY_COLS );
185  m_rbPCBLayer->SetSelection( 1 );
186  m_rbPCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe reference designator and value are always placed on the silk screen layer (but will be marked invisible).") );
187 
188  brightSizer->Add( m_rbPCBLayer, 0, wxALL|wxEXPAND, 5 );
189 
190 
191  m_panelRight->SetSizer( brightSizer );
192  m_panelRight->Layout();
193  brightSizer->Fit( m_panelRight );
194  bMainSizer->Add( m_panelRight, 0, wxEXPAND, 0 );
195 
196 
197  this->SetSizer( bMainSizer );
198  this->Layout();
199  bMainSizer->Fit( this );
200  m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
201 
202  // Connect Events
203  m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
204  m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
205  m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
206  m_AspectRatioLockButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this );
207  m_UnitSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this );
208  m_UnitSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this );
209  m_PixelUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this );
210  m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
211  m_buttonExportFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this );
212  m_buttonExportClipboard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this );
213  m_rbOutputFormat->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this );
214  m_sliderThreshold->Connect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
215  m_sliderThreshold->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
216  m_checkNegative->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this );
217 }
218 
220 {
221  // Disconnect Events
222  m_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
223  m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
224  m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
225  m_AspectRatioLockButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this );
226  m_UnitSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this );
227  m_UnitSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this );
228  m_PixelUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this );
229  m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
230  m_buttonExportFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this );
231  m_buttonExportClipboard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this );
232  m_rbOutputFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this );
233  m_sliderThreshold->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
234  m_sliderThreshold->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
235  m_checkNegative->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this );
236 
237 }
virtual void OnSizeChangeX(wxCommandEvent &event)
wxStaticText * m_DPIUnit
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:61
wxTextCtrl * m_UnitSizeY
wxStaticText * m_staticTextOSize
wxStaticText * m_BPPValue
wxStaticText * m_staticTextBPP
virtual void OnLoadFile(wxCommandEvent &event)
wxStaticText * m_SizePixUnits
wxRadioBox * m_rbPCBLayer
virtual void OnFormatChange(wxCommandEvent &event)
wxButton * m_buttonExportClipboard
virtual void OnExportToFile(wxCommandEvent &event)
virtual void ToggleAspectRatioLock(wxCommandEvent &event)
wxStaticText * m_textLock
BM2CMP_FRAME_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Bitmap to Component Converter"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL)
wxStaticText * m_InputXValueDPI
wxTextCtrl * m_UnitSizeX
wxStatusBar * m_statusBar
wxStaticText * m_SizeXValue
#define NULL
virtual void OnPaintGreyscale(wxPaintEvent &event)
virtual void OnSizeUnitChange(wxCommandEvent &event)
virtual void OnPaintBW(wxPaintEvent &event)
virtual void OnThresholdChange(wxScrollEvent &event)
virtual void OnSizeChangeY(wxCommandEvent &event)
wxSlider * m_sliderThreshold
wxCheckBox * m_checkNegative
wxRadioBox * m_rbOutputFormat
wxStaticText * m_InputYValueDPI
wxButton * m_buttonExportFile
virtual void OnPaintInit(wxPaintEvent &event)
wxStaticText * m_ThresholdText
wxBitmapButton * m_AspectRatioLockButton
#define _(s)
Definition: 3d_actions.cpp:33
wxScrolledWindow * m_GreyscalePicturePanel
wxScrolledWindow * m_InitialPicturePanel
wxStaticText * m_staticTextDPI
virtual void OnNegativeClicked(wxCommandEvent &event)
wxStaticText * m_BPPunits
wxStaticText * m_SizeYValue
wxScrolledWindow * m_BNPicturePanel
wxStaticText * m_staticTextISize
virtual void OnExportToClipboard(wxCommandEvent &event)