From b2eac14552259c99aba1fb6f93c8486fa5260a3a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 18 Jun 2019 18:25:46 +0200 Subject: [PATCH] Fixes in bitmap2cmp: remove empty strings (not translatable) and a few cosmetic enhancements. --- bitmap2component/bitmap2cmp_gui.cpp | 1434 ++++---- bitmap2component/bitmap2cmp_gui_base.cpp | 403 ++- bitmap2component/bitmap2cmp_gui_base.fbp | 3780 +++++++++++----------- bitmap2component/bitmap2cmp_gui_base.h | 194 +- 4 files changed, 2847 insertions(+), 2964 deletions(-) diff --git a/bitmap2component/bitmap2cmp_gui.cpp b/bitmap2component/bitmap2cmp_gui.cpp index 68bff33cff..81c03a003e 100644 --- a/bitmap2component/bitmap2cmp_gui.cpp +++ b/bitmap2component/bitmap2cmp_gui.cpp @@ -1,155 +1,155 @@ -/* - * This program source code file is part of KICAD, a free EDA CAD application. - * - * Copyright (C) 1992-2010 jean-pierre.charras - * Copyright (C) 1992-2019 Kicad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 1992-2010 jean-pierre.charras + * Copyright (C) 1992-2019 Kicad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + #include "bitmap2cmp_gui.h" #include "bitmap2component.h" -#include -#include -#include +#include +#include +#include #include #include #include -#include +#include #include #include #include -#include +#include #include #include #include - -#include "bitmap2cmp_gui_base.h" - - -#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" ) -#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" ) -#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" ) -#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" ) -#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" ) -#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" ) -#define KEYWORD_LAST_FORMAT wxT( "Last_format" ) -#define KEYWORD_LAST_MODLAYER wxT( "Last_modlayer" ) -#define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" ) -#define KEYWORD_BW_NEGATIVE wxT( "Negative_choice" ) - + +#include "bitmap2cmp_gui_base.h" + + +#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" ) +#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" ) +#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" ) +#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" ) +#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" ) +#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" ) +#define KEYWORD_LAST_FORMAT wxT( "Last_format" ) +#define KEYWORD_LAST_MODLAYER wxT( "Last_modlayer" ) +#define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" ) +#define KEYWORD_BW_NEGATIVE wxT( "Negative_choice" ) + //Default value and unit for input #define DEFAULT_SIZE_VALUE 10 #define DEFAULT_SIZE_UNIT MM - + IMAGE_SIZE::IMAGE_SIZE() { m_value = 0; m_value = MM; } - + void IMAGE_SIZE::Set( float aValue, UNIT aUnit ) { m_value = aValue; m_unit = aUnit; } - + void IMAGE_SIZE::SetInputResolution( int aResolution ) { m_originalResolution = aResolution; } - - + + float IMAGE_SIZE::GetValue() { return m_value; } - + int IMAGE_SIZE::GetOutputDPI() { int outputDPI; if( m_unit == MM ) - { + { outputDPI = m_originalResolution / ( m_value / 25.4 ); - } - + } + else if( m_unit == INCH ) - { + { outputDPI = m_originalResolution / ( m_value ); - } - + } + else if( m_unit == MILS ) { outputDPI = m_originalResolution / ( m_value / 1000 ); } - + else { outputDPI = m_value; } return outputDPI; } - - -BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) : - BM2CMP_FRAME_BASE( aParent ) -{ - SetKiway( this, aKiway ); - - int tmp; - m_config = GetNewConfig( Pgm().App().GetAppName() ); - m_config->Read( KEYWORD_FRAME_POSX, & m_framePos.x, -1 ); - m_config->Read( KEYWORD_FRAME_POSY, & m_framePos.y, -1 ); - m_config->Read( KEYWORD_FRAME_SIZEX, & m_frameSize.x, -1 ); - m_config->Read( KEYWORD_FRAME_SIZEY, & m_frameSize.y, -1 ); - m_config->Read( KEYWORD_LAST_INPUT_FILE, &m_BitmapFileName ); - m_config->Read( KEYWORD_LAST_OUTPUT_FILE, &m_ConvertedFileName ); - - if( m_config->Read( KEYWORD_BINARY_THRESHOLD, &tmp ) ) - m_sliderThreshold->SetValue( tmp ); - - m_config->Read( KEYWORD_BW_NEGATIVE, &tmp, 0 ); - m_Negative = tmp != 0; - m_checkNegative->SetValue( m_Negative ); - m_exportToClipboard = false; + + +BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) : + BM2CMP_FRAME_BASE( aParent ) +{ + SetKiway( this, aKiway ); + + int tmp; + m_config = GetNewConfig( Pgm().App().GetAppName() ); + m_config->Read( KEYWORD_FRAME_POSX, & m_framePos.x, -1 ); + m_config->Read( KEYWORD_FRAME_POSY, & m_framePos.y, -1 ); + m_config->Read( KEYWORD_FRAME_SIZEX, & m_frameSize.x, -1 ); + m_config->Read( KEYWORD_FRAME_SIZEY, & m_frameSize.y, -1 ); + m_config->Read( KEYWORD_LAST_INPUT_FILE, &m_BitmapFileName ); + m_config->Read( KEYWORD_LAST_OUTPUT_FILE, &m_ConvertedFileName ); + + if( m_config->Read( KEYWORD_BINARY_THRESHOLD, &tmp ) ) + m_sliderThreshold->SetValue( tmp ); + + m_config->Read( KEYWORD_BW_NEGATIVE, &tmp, 0 ); + m_Negative = tmp != 0; + m_checkNegative->SetValue( m_Negative ); + m_exportToClipboard = false; m_AspectRatioLocked = false; - - if( m_config->Read( KEYWORD_LAST_FORMAT, &tmp ) ) - { - if( tmp < 0 || tmp > FINAL_FMT ) - tmp = PCBNEW_KICAD_MOD; - - m_radioBoxFormat->SetSelection( tmp ); - } - - if( tmp == PCBNEW_KICAD_MOD ) - m_radio_PCBLayer->Enable( true ); - else - m_radio_PCBLayer->Enable( false ); - - if( m_config->Read( KEYWORD_LAST_MODLAYER, &tmp ) ) - { - if( (unsigned) tmp > MOD_LYR_FINAL ) // Out of range - m_radio_PCBLayer->SetSelection( MOD_LYR_FSILKS ); - else - m_radio_PCBLayer->SetSelection( tmp ); - } - + + if( m_config->Read( KEYWORD_LAST_FORMAT, &tmp ) ) + { + if( tmp < 0 || tmp > FINAL_FMT ) + tmp = PCBNEW_KICAD_MOD; + + m_radioBoxFormat->SetSelection( tmp ); + } + + if( tmp == PCBNEW_KICAD_MOD ) + m_radio_PCBLayer->Enable( true ); + else + m_radio_PCBLayer->Enable( false ); + + if( m_config->Read( KEYWORD_LAST_MODLAYER, &tmp ) ) + { + if( (unsigned) tmp > MOD_LYR_FINAL ) // Out of range + m_radio_PCBLayer->SetSelection( MOD_LYR_FSILKS ); + else + m_radio_PCBLayer->SetSelection( tmp ); + } + for( auto const& it : m_unitMap ) { m_PixelUnit->Append( it.second ); @@ -167,174 +167,174 @@ BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_AspectRatio = 1; m_AspectRatioLockButton->SetBitmap( KiBitmap( locked_xpm ) ); - // Give an icon - wxIcon icon; - icon.CopyFromBitmap( KiBitmap( icon_bitmap2component_xpm ) ); - SetIcon( icon ); - - GetSizer()->SetSizeHints( this ); - - SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y ); - - m_buttonExportFile->Enable( false ); - m_buttonExportClipboard->Enable( false ); - - - if ( m_framePos == wxDefaultPosition ) - Centre(); -} - - -BM2CMP_FRAME::~BM2CMP_FRAME() -{ - if( !m_config || IsIconized() ) - return; - - m_frameSize = GetSize(); - m_framePos = GetPosition(); - - m_config->Write( KEYWORD_FRAME_POSX, (long) m_framePos.x ); - m_config->Write( KEYWORD_FRAME_POSY, (long) m_framePos.y ); - m_config->Write( KEYWORD_FRAME_SIZEX, (long) m_frameSize.x ); - m_config->Write( KEYWORD_FRAME_SIZEY, (long) m_frameSize.y ); - m_config->Write( KEYWORD_LAST_INPUT_FILE, m_BitmapFileName ); - m_config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName ); - m_config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() ); - m_config->Write( KEYWORD_BW_NEGATIVE, m_checkNegative->IsChecked() ? 1 : 0 ); - m_config->Write( KEYWORD_LAST_FORMAT, m_radioBoxFormat->GetSelection() ); - m_config->Write( KEYWORD_LAST_MODLAYER, m_radio_PCBLayer->GetSelection() ); - - /* This needed for OSX: avoids further OnDraw processing after this - * destructor and before the native window is destroyed - */ - this->Freeze( ); -} - - -void BM2CMP_FRAME::OnPaintInit( wxPaintEvent& event ) -{ -#ifdef __WXMAC__ - // Otherwise fails due: using wxPaintDC without being in a native paint event - wxClientDC pict_dc( m_InitialPicturePanel ); -#else - wxPaintDC pict_dc( m_InitialPicturePanel ); -#endif - - m_InitialPicturePanel->PrepareDC( pict_dc ); - - // OSX crashes with empty bitmaps (on initial refreshes) - if( m_Pict_Bitmap.IsOk() ) - pict_dc.DrawBitmap( m_Pict_Bitmap, 0, 0, !!m_Pict_Bitmap.GetMask() ); - - event.Skip(); -} - - -void BM2CMP_FRAME::OnPaintGreyscale( wxPaintEvent& event ) -{ -#ifdef __WXMAC__ - // Otherwise fails due: using wxPaintDC without being in a native paint event - wxClientDC greyscale_dc( m_GreyscalePicturePanel ); -#else - wxPaintDC greyscale_dc( m_GreyscalePicturePanel ); -#endif - - m_GreyscalePicturePanel->PrepareDC( greyscale_dc ); - - // OSX crashes with empty bitmaps (on initial refreshes) - if( m_Greyscale_Bitmap.IsOk() ) - greyscale_dc.DrawBitmap( m_Greyscale_Bitmap, 0, 0, !!m_Greyscale_Bitmap.GetMask() ); - - event.Skip(); -} - - -void BM2CMP_FRAME::OnPaintBW( wxPaintEvent& event ) -{ -#ifdef __WXMAC__ - // Otherwise fails due: using wxPaintDC without being in a native paint event - wxClientDC nb_dc( m_BNPicturePanel ); -#else - wxPaintDC nb_dc( m_BNPicturePanel ); -#endif - - m_BNPicturePanel->PrepareDC( nb_dc ); - - if( m_BN_Bitmap.IsOk() ) - nb_dc.DrawBitmap( m_BN_Bitmap, 0, 0, !!m_BN_Bitmap.GetMask() ); - - event.Skip(); -} - - -void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event ) -{ - wxFileName fn( m_BitmapFileName ); - wxString path = fn.GetPath(); - - if( path.IsEmpty() || !wxDirExists( path ) ) - path = m_mruPath; - - wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString, - _( "Image Files " ) + wxImage::GetImageExtWildcard(), - wxFD_OPEN | wxFD_FILE_MUST_EXIST ); - - int diag = fileDlg.ShowModal(); - - if( diag != wxID_OK ) - return; - - wxString fullFilename = fileDlg.GetPath(); - - if( !OpenProjectFiles( std::vector( 1, fullFilename ) ) ) - return; - - fn = fullFilename; - m_mruPath = fn.GetPath(); - SetStatusText( fullFilename ); - Refresh(); -} - - -bool BM2CMP_FRAME::OpenProjectFiles( const std::vector& aFileSet, int aCtl ) -{ - m_Pict_Image.Destroy(); - m_BitmapFileName = aFileSet[0]; - - if( !m_Pict_Image.LoadFile( m_BitmapFileName ) ) - { - // LoadFile has its own UI, no need for further failure notification here - return false; - } - - m_Pict_Bitmap = wxBitmap( m_Pict_Image ); - - int h = m_Pict_Bitmap.GetHeight(); - int w = m_Pict_Bitmap.GetWidth(); - + // Give an icon + wxIcon icon; + icon.CopyFromBitmap( KiBitmap( icon_bitmap2component_xpm ) ); + SetIcon( icon ); + + GetSizer()->SetSizeHints( this ); + + SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y ); + + m_buttonExportFile->Enable( false ); + m_buttonExportClipboard->Enable( false ); + + + if ( m_framePos == wxDefaultPosition ) + Centre(); +} + + +BM2CMP_FRAME::~BM2CMP_FRAME() +{ + if( !m_config || IsIconized() ) + return; + + m_frameSize = GetSize(); + m_framePos = GetPosition(); + + m_config->Write( KEYWORD_FRAME_POSX, (long) m_framePos.x ); + m_config->Write( KEYWORD_FRAME_POSY, (long) m_framePos.y ); + m_config->Write( KEYWORD_FRAME_SIZEX, (long) m_frameSize.x ); + m_config->Write( KEYWORD_FRAME_SIZEY, (long) m_frameSize.y ); + m_config->Write( KEYWORD_LAST_INPUT_FILE, m_BitmapFileName ); + m_config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName ); + m_config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() ); + m_config->Write( KEYWORD_BW_NEGATIVE, m_checkNegative->IsChecked() ? 1 : 0 ); + m_config->Write( KEYWORD_LAST_FORMAT, m_radioBoxFormat->GetSelection() ); + m_config->Write( KEYWORD_LAST_MODLAYER, m_radio_PCBLayer->GetSelection() ); + + /* This needed for OSX: avoids further OnDraw processing after this + * destructor and before the native window is destroyed + */ + this->Freeze( ); +} + + +void BM2CMP_FRAME::OnPaintInit( wxPaintEvent& event ) +{ +#ifdef __WXMAC__ + // Otherwise fails due: using wxPaintDC without being in a native paint event + wxClientDC pict_dc( m_InitialPicturePanel ); +#else + wxPaintDC pict_dc( m_InitialPicturePanel ); +#endif + + m_InitialPicturePanel->PrepareDC( pict_dc ); + + // OSX crashes with empty bitmaps (on initial refreshes) + if( m_Pict_Bitmap.IsOk() ) + pict_dc.DrawBitmap( m_Pict_Bitmap, 0, 0, !!m_Pict_Bitmap.GetMask() ); + + event.Skip(); +} + + +void BM2CMP_FRAME::OnPaintGreyscale( wxPaintEvent& event ) +{ +#ifdef __WXMAC__ + // Otherwise fails due: using wxPaintDC without being in a native paint event + wxClientDC greyscale_dc( m_GreyscalePicturePanel ); +#else + wxPaintDC greyscale_dc( m_GreyscalePicturePanel ); +#endif + + m_GreyscalePicturePanel->PrepareDC( greyscale_dc ); + + // OSX crashes with empty bitmaps (on initial refreshes) + if( m_Greyscale_Bitmap.IsOk() ) + greyscale_dc.DrawBitmap( m_Greyscale_Bitmap, 0, 0, !!m_Greyscale_Bitmap.GetMask() ); + + event.Skip(); +} + + +void BM2CMP_FRAME::OnPaintBW( wxPaintEvent& event ) +{ +#ifdef __WXMAC__ + // Otherwise fails due: using wxPaintDC without being in a native paint event + wxClientDC nb_dc( m_BNPicturePanel ); +#else + wxPaintDC nb_dc( m_BNPicturePanel ); +#endif + + m_BNPicturePanel->PrepareDC( nb_dc ); + + if( m_BN_Bitmap.IsOk() ) + nb_dc.DrawBitmap( m_BN_Bitmap, 0, 0, !!m_BN_Bitmap.GetMask() ); + + event.Skip(); +} + + +void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event ) +{ + wxFileName fn( m_BitmapFileName ); + wxString path = fn.GetPath(); + + if( path.IsEmpty() || !wxDirExists( path ) ) + path = m_mruPath; + + wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString, + _( "Image Files " ) + wxImage::GetImageExtWildcard(), + wxFD_OPEN | wxFD_FILE_MUST_EXIST ); + + int diag = fileDlg.ShowModal(); + + if( diag != wxID_OK ) + return; + + wxString fullFilename = fileDlg.GetPath(); + + if( !OpenProjectFiles( std::vector( 1, fullFilename ) ) ) + return; + + fn = fullFilename; + m_mruPath = fn.GetPath(); + SetStatusText( fullFilename ); + Refresh(); +} + + +bool BM2CMP_FRAME::OpenProjectFiles( const std::vector& aFileSet, int aCtl ) +{ + m_Pict_Image.Destroy(); + m_BitmapFileName = aFileSet[0]; + + if( !m_Pict_Image.LoadFile( m_BitmapFileName ) ) + { + // LoadFile has its own UI, no need for further failure notification here + return false; + } + + m_Pict_Bitmap = wxBitmap( m_Pict_Image ); + + int h = m_Pict_Bitmap.GetHeight(); + int w = m_Pict_Bitmap.GetWidth(); + m_outputSizeX.SetInputResolution( w ); m_outputSizeY.SetInputResolution( h ); m_AspectRatio = (float) w / (float) h; - // Determine image resolution in DPI (does not existing in all formats). - // the resolution can be given in bit per inches or bit per cm in file - + // Determine image resolution in DPI (does not existing in all formats). + // the resolution can be given in bit per inches or bit per cm in file + int imageDPIx = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX ); int imageDPIy = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY ); if( imageDPIx > 1 && imageDPIy > 1 ) - { - if( m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM ) - { - // When the initial resolution is given in bits per cm, - // experience shows adding 1.27 to the resolution converted in dpi - // before convert to int value reduce the conversion error - // but it is not perfect + { + if( m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM ) + { + // When the initial resolution is given in bits per cm, + // experience shows adding 1.27 to the resolution converted in dpi + // before convert to int value reduce the conversion error + // but it is not perfect imageDPIx = imageDPIx * 2.54 + 1.27; imageDPIy = imageDPIy * 2.54 + 1.27; - } - } - else // fallback to the default value + } + } + else // fallback to the default value { imageDPIx = imageDPIy = 0; } @@ -345,72 +345,72 @@ bool BM2CMP_FRAME::OpenProjectFiles( const std::vector& aFileSet, int //Update display to keep aspectratio auto fakeEvent = wxCommandEvent(); OnSizeChangeX( fakeEvent ); - - updateImageInfo(); - - m_InitialPicturePanel->SetVirtualSize( w, h ); - m_GreyscalePicturePanel->SetVirtualSize( w, h ); - m_BNPicturePanel->SetVirtualSize( w, h ); - - m_Greyscale_Image.Destroy(); - m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( ); - - if( m_Pict_Bitmap.GetMask() ) - { - for( int x = 0; x < m_Pict_Bitmap.GetWidth(); x++ ) - { - for( int y = 0; y < m_Pict_Bitmap.GetHeight(); y++ ) - { - if( m_Pict_Image.GetRed( x, y ) == m_Pict_Image.GetMaskRed() && - m_Pict_Image.GetGreen( x, y ) == m_Pict_Image.GetMaskGreen() && - m_Pict_Image.GetBlue( x, y ) == m_Pict_Image.GetMaskBlue() ) - { - m_Greyscale_Image.SetRGB( x, y, 255, 255, 255 ); - } - } - } - } - - if( m_Negative ) - NegateGreyscaleImage( ); - - m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image ); - m_NB_Image = m_Greyscale_Image; - Binarize( (double) m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() ); - - m_buttonExportFile->Enable( true ); - m_buttonExportClipboard->Enable( true ); - - return true; -} - - -void BM2CMP_FRAME::updateImageInfo() -{ - // Note: the image resolution text controls are not modified - // here, to avoid a race between text change when entered by user and - // a text change if it is modified here. - + + updateImageInfo(); + + m_InitialPicturePanel->SetVirtualSize( w, h ); + m_GreyscalePicturePanel->SetVirtualSize( w, h ); + m_BNPicturePanel->SetVirtualSize( w, h ); + + m_Greyscale_Image.Destroy(); + m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( ); + + if( m_Pict_Bitmap.GetMask() ) + { + for( int x = 0; x < m_Pict_Bitmap.GetWidth(); x++ ) + { + for( int y = 0; y < m_Pict_Bitmap.GetHeight(); y++ ) + { + if( m_Pict_Image.GetRed( x, y ) == m_Pict_Image.GetMaskRed() && + m_Pict_Image.GetGreen( x, y ) == m_Pict_Image.GetMaskGreen() && + m_Pict_Image.GetBlue( x, y ) == m_Pict_Image.GetMaskBlue() ) + { + m_Greyscale_Image.SetRGB( x, y, 255, 255, 255 ); + } + } + } + } + + if( m_Negative ) + NegateGreyscaleImage( ); + + m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image ); + m_NB_Image = m_Greyscale_Image; + Binarize( (double) m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() ); + + m_buttonExportFile->Enable( true ); + m_buttonExportClipboard->Enable( true ); + + return true; +} + + +void BM2CMP_FRAME::updateImageInfo() +{ + // Note: the image resolution text controls are not modified + // here, to avoid a race between text change when entered by user and + // a text change if it is modified here. + if( m_Pict_Bitmap.IsOk() ) { int h = m_Pict_Bitmap.GetHeight(); int w = m_Pict_Bitmap.GetWidth(); int nb = m_Pict_Bitmap.GetDepth(); - + m_SizeXValue->SetLabel( wxString::Format( wxT( "%d" ), w ) ); m_SizeYValue->SetLabel( wxString::Format( wxT( "%d" ), h ) ); m_BPPValue->SetLabel( wxString::Format( wxT( "%d" ), nb ) ); } -} - - +} + + void BM2CMP_FRAME::OnSizeChangeX( wxCommandEvent& event ) -{ +{ double setSize; if( m_UnitSizeX->GetValue().ToDouble( &setSize ) ) { m_outputSizeX.Set( setSize, (UNIT) m_PixelUnit->GetSelection() ); - + if( m_AspectRatioLocked ) { double calculatedY = setSize / m_AspectRatio; @@ -420,11 +420,11 @@ void BM2CMP_FRAME::OnSizeChangeX( wxCommandEvent& event ) } updateImageInfo(); } - + void BM2CMP_FRAME::OnSizeChangeY( wxCommandEvent& event ) { double setSize; - + if( m_UnitSizeY->GetValue().ToDouble( &setSize ) ) { m_outputSizeY.Set( setSize, (UNIT) m_PixelUnit->GetSelection() ); @@ -437,14 +437,14 @@ void BM2CMP_FRAME::OnSizeChangeY( wxCommandEvent& event ) } updateImageInfo(); } - + void BM2CMP_FRAME::OnSizeUnitChange( wxCommandEvent& event ) { m_outputSizeX.SetUnit( (UNIT) m_PixelUnit->GetSelection() ); m_outputSizeY.SetUnit( (UNIT) m_PixelUnit->GetSelection() ); - updateImageInfo(); -} - + updateImageInfo(); +} + void BM2CMP_FRAME::ToggleAspectRatioLock( wxCommandEvent& event ) { m_AspectRatioLocked = !m_AspectRatioLocked; @@ -459,406 +459,406 @@ void BM2CMP_FRAME::ToggleAspectRatioLock( wxCommandEvent& event ) else { - m_AspectRatioLockButton->SetBitmap( KiBitmap( lock_unlock_xpm ) ); + m_AspectRatioLockButton->SetBitmap( KiBitmap( unlocked_xpm ) ); } } - -void BM2CMP_FRAME::Binarize( double aThreshold ) -{ - int h = m_Greyscale_Image.GetHeight(); - int w = m_Greyscale_Image.GetWidth(); - unsigned char threshold = aThreshold * 255; - unsigned char alpha_thresh = 0.7 * threshold; - - for( int y = 0; y < h; y++ ) - for( int x = 0; x < w; x++ ) - { - unsigned char pixout; - auto pixin = m_Greyscale_Image.GetGreen( x, y ); - auto alpha = m_Greyscale_Image.HasAlpha() ? - m_Greyscale_Image.GetAlpha( x, y ) : wxALPHA_OPAQUE; - - if( pixin < threshold && alpha > alpha_thresh ) - pixout = 0; - else - pixout = 255; - - m_NB_Image.SetRGB( x, y, pixout, pixout, pixout ); - - } - - m_BN_Bitmap = wxBitmap( m_NB_Image ); - -} - - -void BM2CMP_FRAME::NegateGreyscaleImage( ) -{ - unsigned char pix; - int h = m_Greyscale_Image.GetHeight(); - int w = m_Greyscale_Image.GetWidth(); - - for( int y = 0; y < h; y++ ) - for( int x = 0; x < w; x++ ) - { - pix = m_Greyscale_Image.GetGreen( x, y ); - pix = ~pix; - m_Greyscale_Image.SetRGB( x, y, pix, pix, pix ); - } -} - - -void BM2CMP_FRAME::OnNegativeClicked( wxCommandEvent& ) -{ - if( m_checkNegative->GetValue() != m_Negative ) - { - NegateGreyscaleImage(); - - m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image ); - Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() ); - m_Negative = m_checkNegative->GetValue(); - - Refresh(); - } -} - - -void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event ) -{ - Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() ); - Refresh(); -} - - -void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event ) -{ - m_exportToClipboard = false; - // choices of m_radioBoxFormat are expected to be in same order as - // OUTPUT_FMT_ID. See bitmap2component.h - OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_radioBoxFormat->GetSelection(); - exportBitmap( format ); -} - - -void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event ) -{ - m_exportToClipboard = true; - // choices of m_radioBoxFormat are expected to be in same order as - // OUTPUT_FMT_ID. See bitmap2component.h - OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_radioBoxFormat->GetSelection(); - - std::string buffer; - ExportToBuffer( buffer, format ); - - // Write buffer to the clipboard - if (wxTheClipboard->Open()) - { - // This data objects are held by the clipboard, - // so do not delete them in the app. - wxTheClipboard->SetData( new wxTextDataObject( buffer.c_str() ) ); - wxTheClipboard->Close(); - } - else - wxMessageBox( _( "Unable to export to the Clipboard") ); -} - - -void BM2CMP_FRAME::exportBitmap( OUTPUT_FMT_ID aFormat ) -{ - switch( aFormat ) - { - case EESCHEMA_FMT: - exportEeschemaFormat(); - break; - - case PCBNEW_KICAD_MOD: - exportPcbnewFormat(); - break; - - case POSTSCRIPT_FMT: - exportPostScriptFormat(); - break; - - case KICAD_LOGO: - OnExportLogo(); - break; - } -} - - -void BM2CMP_FRAME::OnExportLogo() -{ - wxFileName fn( m_ConvertedFileName ); - wxString path = fn.GetPath(); - - if( path.IsEmpty() || !wxDirExists(path) ) - path = ::wxGetCwd(); - - wxFileDialog fileDlg( this, _( "Create Logo File" ), path, wxEmptyString, - PageLayoutDescrFileWildcard(), - wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - int diag = fileDlg.ShowModal(); - - if( diag != wxID_OK ) - return; - - fn = fileDlg.GetPath(); - fn.SetExt( PageLayoutDescrFileExtension ); - m_ConvertedFileName = fn.GetFullPath(); - - FILE* outfile; - outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) ); - - if( outfile == NULL ) - { - wxString msg; - msg.Printf( _( "File \"%s\" could not be created." ), GetChars( m_ConvertedFileName ) ); - wxMessageBox( msg ); - return; - } - - std::string buffer; - ExportToBuffer( buffer, KICAD_LOGO ); - fputs( buffer.c_str(), outfile ); - fclose( outfile ); -} - - -void BM2CMP_FRAME::exportPostScriptFormat() -{ - wxFileName fn( m_ConvertedFileName ); - wxString path = fn.GetPath(); - - if( path.IsEmpty() || !wxDirExists( path ) ) - path = ::wxGetCwd(); - - wxFileDialog fileDlg( this, _( "Create Postscript File" ), - path, wxEmptyString, - PSFileWildcard(), - wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - - int diag = fileDlg.ShowModal(); - - if( diag != wxID_OK ) - return; - - fn = fileDlg.GetPath(); - fn.SetExt( wxT( "ps" ) ); - m_ConvertedFileName = fn.GetFullPath(); - - FILE* outfile; - outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) ); - - if( outfile == NULL ) - { - wxString msg; - msg.Printf( _( "File \"%s\" could not be created." ), GetChars( m_ConvertedFileName ) ); - wxMessageBox( msg ); - return; - } - - std::string buffer; - ExportToBuffer( buffer, POSTSCRIPT_FMT ); - fputs( buffer.c_str(), outfile ); - fclose( outfile ); -} - - -void BM2CMP_FRAME::exportEeschemaFormat() -{ - wxFileName fn( m_ConvertedFileName ); - wxString path = fn.GetPath(); - - if( path.IsEmpty() || !wxDirExists(path) ) - path = ::wxGetCwd(); - - wxFileDialog fileDlg( this, _( "Create Symbol Library" ), - path, wxEmptyString, - SchematicLibraryFileWildcard(), - wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - - int diag = fileDlg.ShowModal(); - - if( diag != wxID_OK ) - return; - - fn = fileDlg.GetPath(); - fn.SetExt( SchematicLibraryFileExtension ); - m_ConvertedFileName = fn.GetFullPath(); - - FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) ); - - if( outfile == NULL ) - { - wxString msg; - msg.Printf( _( "File \"%s\" could not be created." ), GetChars( m_ConvertedFileName ) ); - wxMessageBox( msg ); - return; - } - - std::string buffer; - ExportToBuffer( buffer, EESCHEMA_FMT ); - fputs( buffer.c_str(), outfile ); - fclose( outfile ); -} - - -void BM2CMP_FRAME::exportPcbnewFormat() -{ - wxFileName fn( m_ConvertedFileName ); - wxString path = fn.GetPath(); - - if( path.IsEmpty() || !wxDirExists( path ) ) - path = m_mruPath; - - wxFileDialog fileDlg( this, _( "Create Footprint Library" ), - path, wxEmptyString, - KiCadFootprintLibFileWildcard(), - wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - - int diag = fileDlg.ShowModal(); - - if( diag != wxID_OK ) - return; - - fn = fileDlg.GetPath(); - fn.SetExt( KiCadFootprintFileExtension ); - m_ConvertedFileName = fn.GetFullPath(); - - FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) ); - - if( outfile == NULL ) - { - wxString msg; - msg.Printf( _( "File \"%s\" could not be created." ), GetChars( m_ConvertedFileName ) ); - wxMessageBox( msg ); - return; - } - - std::string buffer; - ExportToBuffer( buffer, PCBNEW_KICAD_MOD ); - fputs( buffer.c_str(), outfile ); - fclose( outfile ); - m_mruPath = fn.GetPath(); -} - - -void BM2CMP_FRAME::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat ) -{ - // Create a potrace bitmap - int h = m_NB_Image.GetHeight(); - int w = m_NB_Image.GetWidth(); - potrace_bitmap_t* potrace_bitmap = bm_new( w, h ); - - if( !potrace_bitmap ) - { - wxString msg; - msg.Printf( _( "Error allocating memory for potrace bitmap" ) ); - wxMessageBox( msg ); - return; - } - - /* fill the bitmap with data */ - for( int y = 0; y < h; y++ ) - { - for( int x = 0; x < w; x++ ) - { - auto pix = m_NB_Image.GetGreen( x, y ); - BM_PUT( potrace_bitmap, x, y, pix ? 0 : 1 ); - } - } - - // choices of m_radio_PCBLayer are expected to be in same order as - // BMP2CMP_MOD_LAYER. See bitmap2component.h - BMP2CMP_MOD_LAYER modLayer = MOD_LYR_FSILKS; - - if( aFormat == PCBNEW_KICAD_MOD ) - modLayer = (BMP2CMP_MOD_LAYER) m_radio_PCBLayer->GetSelection(); - - BITMAPCONV_INFO converter( aOutput ); + +void BM2CMP_FRAME::Binarize( double aThreshold ) +{ + int h = m_Greyscale_Image.GetHeight(); + int w = m_Greyscale_Image.GetWidth(); + unsigned char threshold = aThreshold * 255; + unsigned char alpha_thresh = 0.7 * threshold; + + for( int y = 0; y < h; y++ ) + for( int x = 0; x < w; x++ ) + { + unsigned char pixout; + auto pixin = m_Greyscale_Image.GetGreen( x, y ); + auto alpha = m_Greyscale_Image.HasAlpha() ? + m_Greyscale_Image.GetAlpha( x, y ) : wxALPHA_OPAQUE; + + if( pixin < threshold && alpha > alpha_thresh ) + pixout = 0; + else + pixout = 255; + + m_NB_Image.SetRGB( x, y, pixout, pixout, pixout ); + + } + + m_BN_Bitmap = wxBitmap( m_NB_Image ); + +} + + +void BM2CMP_FRAME::NegateGreyscaleImage( ) +{ + unsigned char pix; + int h = m_Greyscale_Image.GetHeight(); + int w = m_Greyscale_Image.GetWidth(); + + for( int y = 0; y < h; y++ ) + for( int x = 0; x < w; x++ ) + { + pix = m_Greyscale_Image.GetGreen( x, y ); + pix = ~pix; + m_Greyscale_Image.SetRGB( x, y, pix, pix, pix ); + } +} + + +void BM2CMP_FRAME::OnNegativeClicked( wxCommandEvent& ) +{ + if( m_checkNegative->GetValue() != m_Negative ) + { + NegateGreyscaleImage(); + + m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image ); + Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() ); + m_Negative = m_checkNegative->GetValue(); + + Refresh(); + } +} + + +void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event ) +{ + Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() ); + Refresh(); +} + + +void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event ) +{ + m_exportToClipboard = false; + // choices of m_radioBoxFormat are expected to be in same order as + // OUTPUT_FMT_ID. See bitmap2component.h + OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_radioBoxFormat->GetSelection(); + exportBitmap( format ); +} + + +void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event ) +{ + m_exportToClipboard = true; + // choices of m_radioBoxFormat are expected to be in same order as + // OUTPUT_FMT_ID. See bitmap2component.h + OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_radioBoxFormat->GetSelection(); + + std::string buffer; + ExportToBuffer( buffer, format ); + + // Write buffer to the clipboard + if (wxTheClipboard->Open()) + { + // This data objects are held by the clipboard, + // so do not delete them in the app. + wxTheClipboard->SetData( new wxTextDataObject( buffer.c_str() ) ); + wxTheClipboard->Close(); + } + else + wxMessageBox( _( "Unable to export to the Clipboard") ); +} + + +void BM2CMP_FRAME::exportBitmap( OUTPUT_FMT_ID aFormat ) +{ + switch( aFormat ) + { + case EESCHEMA_FMT: + exportEeschemaFormat(); + break; + + case PCBNEW_KICAD_MOD: + exportPcbnewFormat(); + break; + + case POSTSCRIPT_FMT: + exportPostScriptFormat(); + break; + + case KICAD_LOGO: + OnExportLogo(); + break; + } +} + + +void BM2CMP_FRAME::OnExportLogo() +{ + wxFileName fn( m_ConvertedFileName ); + wxString path = fn.GetPath(); + + if( path.IsEmpty() || !wxDirExists(path) ) + path = ::wxGetCwd(); + + wxFileDialog fileDlg( this, _( "Create Logo File" ), path, wxEmptyString, + PageLayoutDescrFileWildcard(), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + int diag = fileDlg.ShowModal(); + + if( diag != wxID_OK ) + return; + + fn = fileDlg.GetPath(); + fn.SetExt( PageLayoutDescrFileExtension ); + m_ConvertedFileName = fn.GetFullPath(); + + FILE* outfile; + outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) ); + + if( outfile == NULL ) + { + wxString msg; + msg.Printf( _( "File \"%s\" could not be created." ), GetChars( m_ConvertedFileName ) ); + wxMessageBox( msg ); + return; + } + + std::string buffer; + ExportToBuffer( buffer, KICAD_LOGO ); + fputs( buffer.c_str(), outfile ); + fclose( outfile ); +} + + +void BM2CMP_FRAME::exportPostScriptFormat() +{ + wxFileName fn( m_ConvertedFileName ); + wxString path = fn.GetPath(); + + if( path.IsEmpty() || !wxDirExists( path ) ) + path = ::wxGetCwd(); + + wxFileDialog fileDlg( this, _( "Create Postscript File" ), + path, wxEmptyString, + PSFileWildcard(), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + + int diag = fileDlg.ShowModal(); + + if( diag != wxID_OK ) + return; + + fn = fileDlg.GetPath(); + fn.SetExt( wxT( "ps" ) ); + m_ConvertedFileName = fn.GetFullPath(); + + FILE* outfile; + outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) ); + + if( outfile == NULL ) + { + wxString msg; + msg.Printf( _( "File \"%s\" could not be created." ), GetChars( m_ConvertedFileName ) ); + wxMessageBox( msg ); + return; + } + + std::string buffer; + ExportToBuffer( buffer, POSTSCRIPT_FMT ); + fputs( buffer.c_str(), outfile ); + fclose( outfile ); +} + + +void BM2CMP_FRAME::exportEeschemaFormat() +{ + wxFileName fn( m_ConvertedFileName ); + wxString path = fn.GetPath(); + + if( path.IsEmpty() || !wxDirExists(path) ) + path = ::wxGetCwd(); + + wxFileDialog fileDlg( this, _( "Create Symbol Library" ), + path, wxEmptyString, + SchematicLibraryFileWildcard(), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + + int diag = fileDlg.ShowModal(); + + if( diag != wxID_OK ) + return; + + fn = fileDlg.GetPath(); + fn.SetExt( SchematicLibraryFileExtension ); + m_ConvertedFileName = fn.GetFullPath(); + + FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) ); + + if( outfile == NULL ) + { + wxString msg; + msg.Printf( _( "File \"%s\" could not be created." ), GetChars( m_ConvertedFileName ) ); + wxMessageBox( msg ); + return; + } + + std::string buffer; + ExportToBuffer( buffer, EESCHEMA_FMT ); + fputs( buffer.c_str(), outfile ); + fclose( outfile ); +} + + +void BM2CMP_FRAME::exportPcbnewFormat() +{ + wxFileName fn( m_ConvertedFileName ); + wxString path = fn.GetPath(); + + if( path.IsEmpty() || !wxDirExists( path ) ) + path = m_mruPath; + + wxFileDialog fileDlg( this, _( "Create Footprint Library" ), + path, wxEmptyString, + KiCadFootprintLibFileWildcard(), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + + int diag = fileDlg.ShowModal(); + + if( diag != wxID_OK ) + return; + + fn = fileDlg.GetPath(); + fn.SetExt( KiCadFootprintFileExtension ); + m_ConvertedFileName = fn.GetFullPath(); + + FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) ); + + if( outfile == NULL ) + { + wxString msg; + msg.Printf( _( "File \"%s\" could not be created." ), GetChars( m_ConvertedFileName ) ); + wxMessageBox( msg ); + return; + } + + std::string buffer; + ExportToBuffer( buffer, PCBNEW_KICAD_MOD ); + fputs( buffer.c_str(), outfile ); + fclose( outfile ); + m_mruPath = fn.GetPath(); +} + + +void BM2CMP_FRAME::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat ) +{ + // Create a potrace bitmap + int h = m_NB_Image.GetHeight(); + int w = m_NB_Image.GetWidth(); + potrace_bitmap_t* potrace_bitmap = bm_new( w, h ); + + if( !potrace_bitmap ) + { + wxString msg; + msg.Printf( _( "Error allocating memory for potrace bitmap" ) ); + wxMessageBox( msg ); + return; + } + + /* fill the bitmap with data */ + for( int y = 0; y < h; y++ ) + { + for( int x = 0; x < w; x++ ) + { + auto pix = m_NB_Image.GetGreen( x, y ); + BM_PUT( potrace_bitmap, x, y, pix ? 0 : 1 ); + } + } + + // choices of m_radio_PCBLayer are expected to be in same order as + // BMP2CMP_MOD_LAYER. See bitmap2component.h + BMP2CMP_MOD_LAYER modLayer = MOD_LYR_FSILKS; + + if( aFormat == PCBNEW_KICAD_MOD ) + modLayer = (BMP2CMP_MOD_LAYER) m_radio_PCBLayer->GetSelection(); + + BITMAPCONV_INFO converter( aOutput ); converter.ConvertBitmap( potrace_bitmap, aFormat, m_outputSizeX.GetOutputDPI(), m_outputSizeY.GetOutputDPI(), modLayer ); -} - - - -//---------------------------------------------------------------------- - -namespace BMP2CMP { - -static struct IFACE : public KIFACE_I -{ - bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override; - - wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override - { - return new BM2CMP_FRAME( aKiway, aParent ); - } - - /** - * Function IfaceOrAddress - * return a pointer to the requested object. The safest way to use this - * is to retrieve a pointer to a static instance of an interface, similar to - * how the KIFACE interface is exported. But if you know what you are doing - * use it to retrieve anything you want. - * - * @param aDataId identifies which object you want the address of. - * - * @return void* - and must be cast into the know type. - */ - void* IfaceOrAddress( int aDataId ) override - { - return NULL; - } - - IFACE( const char* aDSOname, KIWAY::FACE_T aType ) : - KIFACE_I( aDSOname, aType ) - {} - -} kiface( "BMP2CMP", KIWAY::FACE_BMP2CMP ); - -} // namespace BMP2CMP - -using namespace BMP2CMP; - -static PGM_BASE* process; - -KIFACE_I& Kiface() -{ - return kiface; -} - - -// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h. -// KIFACE_GETTER will not have name mangling due to declaration in kiway.h. -KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram ) -{ - process = (PGM_BASE*) aProgram; - return &kiface; -} - - -#if defined(BUILD_KIWAY_DLLS) -PGM_BASE& Pgm() -{ - wxASSERT( process ); // KIFACE_GETTER has already been called. - return *process; -} -#endif - - -bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) -{ - return start_common( aCtlBits ); -} - - -void BM2CMP_FRAME::OnFormatChange( wxCommandEvent& event ) -{ - if( m_radioBoxFormat->GetSelection() == PCBNEW_KICAD_MOD ) - m_radio_PCBLayer->Enable( true ); - else - m_radio_PCBLayer->Enable( false ); - - event.Skip(); -} +} + + + +//---------------------------------------------------------------------- + +namespace BMP2CMP { + +static struct IFACE : public KIFACE_I +{ + bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override; + + wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override + { + return new BM2CMP_FRAME( aKiway, aParent ); + } + + /** + * Function IfaceOrAddress + * return a pointer to the requested object. The safest way to use this + * is to retrieve a pointer to a static instance of an interface, similar to + * how the KIFACE interface is exported. But if you know what you are doing + * use it to retrieve anything you want. + * + * @param aDataId identifies which object you want the address of. + * + * @return void* - and must be cast into the know type. + */ + void* IfaceOrAddress( int aDataId ) override + { + return NULL; + } + + IFACE( const char* aDSOname, KIWAY::FACE_T aType ) : + KIFACE_I( aDSOname, aType ) + {} + +} kiface( "BMP2CMP", KIWAY::FACE_BMP2CMP ); + +} // namespace BMP2CMP + +using namespace BMP2CMP; + +static PGM_BASE* process; + +KIFACE_I& Kiface() +{ + return kiface; +} + + +// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h. +// KIFACE_GETTER will not have name mangling due to declaration in kiway.h. +KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram ) +{ + process = (PGM_BASE*) aProgram; + return &kiface; +} + + +#if defined(BUILD_KIWAY_DLLS) +PGM_BASE& Pgm() +{ + wxASSERT( process ); // KIFACE_GETTER has already been called. + return *process; +} +#endif + + +bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) +{ + return start_common( aCtlBits ); +} + + +void BM2CMP_FRAME::OnFormatChange( wxCommandEvent& event ) +{ + if( m_radioBoxFormat->GetSelection() == PCBNEW_KICAD_MOD ) + m_radio_PCBLayer->Enable( true ); + else + m_radio_PCBLayer->Enable( false ); + + event.Skip(); +} diff --git a/bitmap2component/bitmap2cmp_gui_base.cpp b/bitmap2component/bitmap2cmp_gui_base.cpp index 4af328c4a2..c31e0cc18f 100644 --- a/bitmap2component/bitmap2cmp_gui_base.cpp +++ b/bitmap2component/bitmap2cmp_gui_base.cpp @@ -1,233 +1,228 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "bitmap2cmp_gui_base.h" - -/////////////////////////////////////////////////////////////////////////// - -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 ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bMainSizer; - bMainSizer = new wxBoxSizer( wxHORIZONTAL ); - - m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - m_InitialPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); - m_InitialPicturePanel->SetScrollRate( 5, 5 ); - m_InitialPicturePanel->SetMinSize( wxSize( 400,300 ) ); - - m_Notebook->AddPage( m_InitialPicturePanel, _("Original Picture"), true ); - m_GreyscalePicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); - m_GreyscalePicturePanel->SetScrollRate( 5, 5 ); - m_GreyscalePicturePanel->SetMinSize( wxSize( 400,300 ) ); - - m_Notebook->AddPage( m_GreyscalePicturePanel, _("Greyscale Picture"), false ); - m_BNPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); - m_BNPicturePanel->SetScrollRate( 5, 5 ); - m_Notebook->AddPage( m_BNPicturePanel, _("Black&&White Picture"), false ); - - bMainSizer->Add( m_Notebook, 1, wxEXPAND, 5 ); - - m_panelRight = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* brightSizer; - brightSizer = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizerInfo; - sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Bitmap Info:") ), wxVERTICAL ); - - wxFlexGridSizer* fgSizerInfo; - fgSizerInfo = new wxFlexGridSizer( 0, 4, 0, 0 ); - fgSizerInfo->AddGrowableCol( 1 ); - fgSizerInfo->AddGrowableCol( 2 ); - fgSizerInfo->SetFlexibleDirection( wxBOTH ); - fgSizerInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_staticTextSize = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Input size:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSize->Wrap( -1 ); - fgSizerInfo->Add( m_staticTextSize, 0, wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_SizeXValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 ); - m_SizeXValue->Wrap( -1 ); - fgSizerInfo->Add( m_SizeXValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); - - m_SizeYValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 ); - m_SizeYValue->Wrap( -1 ); - fgSizerInfo->Add( m_SizeYValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); - - m_SizePixUnits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 ); - m_SizePixUnits->Wrap( -1 ); - fgSizerInfo->Add( m_SizePixUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); - +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Dec 1 2018) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "bitmap2cmp_gui_base.h" + +/////////////////////////////////////////////////////////////////////////// + +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 ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_InitialPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); + m_InitialPicturePanel->SetScrollRate( 5, 5 ); + m_InitialPicturePanel->SetMinSize( wxSize( 400,300 ) ); + + m_Notebook->AddPage( m_InitialPicturePanel, _("Original Picture"), true ); + m_GreyscalePicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); + m_GreyscalePicturePanel->SetScrollRate( 5, 5 ); + m_GreyscalePicturePanel->SetMinSize( wxSize( 400,300 ) ); + + m_Notebook->AddPage( m_GreyscalePicturePanel, _("Greyscale Picture"), false ); + m_BNPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); + m_BNPicturePanel->SetScrollRate( 5, 5 ); + m_Notebook->AddPage( m_BNPicturePanel, _("Black&&White Picture"), false ); + + bMainSizer->Add( m_Notebook, 1, wxEXPAND, 5 ); + + m_panelRight = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* brightSizer; + brightSizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizerInfo; + sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Bitmap Info:") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizerInfo; + fgSizerInfo = new wxFlexGridSizer( 0, 4, 0, 0 ); + fgSizerInfo->AddGrowableCol( 1 ); + fgSizerInfo->AddGrowableCol( 2 ); + fgSizerInfo->SetFlexibleDirection( wxBOTH ); + fgSizerInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextISize = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Input size:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextISize->Wrap( -1 ); + fgSizerInfo->Add( m_staticTextISize, 0, wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_SizeXValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 ); + m_SizeXValue->Wrap( -1 ); + fgSizerInfo->Add( m_SizeXValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + + m_SizeYValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 ); + m_SizeYValue->Wrap( -1 ); + fgSizerInfo->Add( m_SizeYValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + + m_SizePixUnits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 ); + m_SizePixUnits->Wrap( -1 ); + fgSizerInfo->Add( m_SizePixUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + m_staticTextDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Input DPI:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextDPI->Wrap( -1 ); fgSizerInfo->Add( m_staticTextDPI, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - + m_InputXValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 ); m_InputXValueDPI->Wrap( -1 ); fgSizerInfo->Add( m_InputXValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); - + m_InputYValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 ); m_InputYValueDPI->Wrap( -1 ); fgSizerInfo->Add( m_InputYValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); - + m_DPIUnit = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("DPI"), wxDefaultPosition, wxDefaultSize, 0 ); m_DPIUnit->Wrap( -1 ); fgSizerInfo->Add( m_DPIUnit, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); - - m_staticTextBPP = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextBPP->Wrap( -1 ); - fgSizerInfo->Add( m_staticTextBPP, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - m_BPPValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 ); - m_BPPValue->Wrap( -1 ); - fgSizerInfo->Add( m_BPPValue, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); - - m_BPPunits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 ); - m_BPPunits->Wrap( -1 ); - fgSizerInfo->Add( m_BPPunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - - fgSizerInfo->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_BPPunits1 = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _( "Lock Aspect Ratio" ), - wxDefaultPosition, wxDefaultSize, 0 ); - m_BPPunits1->Wrap( -1 ); - fgSizerInfo->Add( m_BPPunits1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - m_BPPunits2 = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_BPPunits2->Wrap( -1 ); - fgSizerInfo->Add( m_BPPunits2, 0, wxALL, 5 ); + m_staticTextBPP = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBPP->Wrap( -1 ); + fgSizerInfo->Add( m_staticTextBPP, 0, wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + m_BPPValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 ); + m_BPPValue->Wrap( -1 ); + fgSizerInfo->Add( m_BPPValue, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); + + m_BPPunits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 ); + m_BPPunits->Wrap( -1 ); + fgSizerInfo->Add( m_BPPunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + + fgSizerInfo->Add( 0, 0, 0, 0, 5 ); + + + sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND|wxBOTTOM, 5 ); + + wxBoxSizer* bSizerLock; + bSizerLock = new wxBoxSizer( wxHORIZONTAL ); + + m_textLock = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Lock Aspect Ratio"), wxDefaultPosition, wxDefaultSize, 0 ); + m_textLock->Wrap( -1 ); + bSizerLock->Add( m_textLock, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_AspectRatioLockButton = new wxBitmapButton( sbSizerInfo->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); - fgSizerInfo->Add( m_AspectRatioLockButton, 0, wxALL, 5 ); + bSizerLock->Add( m_AspectRatioLockButton, 0, wxALL, 5 ); - m_BPPunits3 = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_BPPunits3->Wrap( -1 ); - fgSizerInfo->Add( m_BPPunits3, 0, wxALL, 5 ); - m_staticTextBPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Resolution:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextBPI->Wrap( -1 ); - fgSizerInfo->Add( m_staticTextBPI, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - + sbSizerInfo->Add( bSizerLock, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizerRes; + bSizerRes = new wxBoxSizer( wxHORIZONTAL ); + + m_staticTextOSize = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextOSize->Wrap( -1 ); + bSizerRes->Add( m_staticTextOSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_UnitSizeX = new wxTextCtrl( sbSizerInfo->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 ); m_UnitSizeX->SetMinSize( wxSize( 60,-1 ) ); - m_UnitSizeX->SetValidator( wxTextValidator( wxFILTER_NUMERIC, &m_NumericValidator ) ); + bSizerRes->Add( m_UnitSizeX, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); - fgSizerInfo->Add( m_UnitSizeX, 0, wxBOTTOM|wxRIGHT|wxALIGN_BOTTOM, 5 ); - m_UnitSizeY = new wxTextCtrl( sbSizerInfo->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 ); m_UnitSizeY->SetMinSize( wxSize( 60,-1 ) ); - - fgSizerInfo->Add( m_UnitSizeY, 0, wxBOTTOM|wxRIGHT|wxALIGN_BOTTOM, 5 ); - + + bSizerRes->Add( m_UnitSizeY, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + wxArrayString m_PixelUnitChoices; m_PixelUnit = new wxChoice( sbSizerInfo->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_PixelUnitChoices, 0 ); m_PixelUnit->SetSelection( 0 ); m_PixelUnit->SetMinSize( wxSize( 80,-1 ) ); - - fgSizerInfo->Add( m_PixelUnit, 0, wxALL|wxALIGN_BOTTOM, 5 ); - - - sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND|wxBOTTOM, 5 ); - - - brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 ); - - m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 ); - brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_buttonExportFile = new wxButton( m_panelRight, wxID_ANY, _("Export to File"), wxDefaultPosition, wxDefaultSize, 0 ); - brightSizer->Add( m_buttonExportFile, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_buttonExportClipboard = new wxButton( m_panelRight, wxID_ANY, _("Export to Clipboard"), wxDefaultPosition, wxDefaultSize, 0 ); - brightSizer->Add( m_buttonExportClipboard, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - wxString m_radioBoxFormatChoices[] = { _("Eeschema (.lib file)"), _("Pcbnew (.kicad_mod file)"), _("Postscript (.ps file)"), _("Logo for title block (.kicad_wks file)") }; - int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString ); - m_radioBoxFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format:"), wxDefaultPosition, wxDefaultSize, m_radioBoxFormatNChoices, m_radioBoxFormatChoices, 1, wxRA_SPECIFY_COLS ); - m_radioBoxFormat->SetSelection( 1 ); - brightSizer->Add( m_radioBoxFormat, 0, wxEXPAND|wxALL, 5 ); - - wxStaticBoxSizer* sbSizer2; - sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Image Options:") ), wxVERTICAL ); - - m_ThresholdText = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Black / White Threshold:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ThresholdText->Wrap( -1 ); - sbSizer2->Add( m_ThresholdText, 0, wxTOP|wxLEFT, 5 ); - - m_sliderThreshold = new wxSlider( sbSizer2->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS ); - m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") ); - - sbSizer2->Add( m_sliderThreshold, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_checkNegative = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Negative"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer2->Add( m_checkNegative, 0, wxTOP|wxBOTTOM, 10 ); - - - brightSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 ); - - wxString m_radio_PCBLayerChoices[] = { _("Front silk screen"), _("Front solder mask"), _("User layer Eco1"), _("User layer Eco2") }; - int m_radio_PCBLayerNChoices = sizeof( m_radio_PCBLayerChoices ) / sizeof( wxString ); - m_radio_PCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline:"), wxDefaultPosition, wxDefaultSize, m_radio_PCBLayerNChoices, m_radio_PCBLayerChoices, 1, wxRA_SPECIFY_COLS ); - m_radio_PCBLayer->SetSelection( 3 ); - m_radio_PCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe 2 invisible fields reference and value are always placed on the silk screen layer.") ); - - brightSizer->Add( m_radio_PCBLayer, 0, wxALL|wxEXPAND, 5 ); - - - m_panelRight->SetSizer( brightSizer ); - m_panelRight->Layout(); - brightSizer->Fit( m_panelRight ); - bMainSizer->Add( m_panelRight, 0, wxEXPAND, 0 ); - - - this->SetSizer( bMainSizer ); - this->Layout(); - m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY ); - - // Connect Events - m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this ); - m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this ); - m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this ); + + bSizerRes->Add( m_PixelUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + + sbSizerInfo->Add( bSizerRes, 0, wxEXPAND, 5 ); + + + brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 ); + + m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 ); + brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_buttonExportFile = new wxButton( m_panelRight, wxID_ANY, _("Export to File"), wxDefaultPosition, wxDefaultSize, 0 ); + brightSizer->Add( m_buttonExportFile, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_buttonExportClipboard = new wxButton( m_panelRight, wxID_ANY, _("Export to Clipboard"), wxDefaultPosition, wxDefaultSize, 0 ); + brightSizer->Add( m_buttonExportClipboard, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + wxString m_radioBoxFormatChoices[] = { _("Eeschema (.lib file)"), _("Pcbnew (.kicad_mod file)"), _("Postscript (.ps file)"), _("Logo for title block (.kicad_wks file)") }; + int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString ); + m_radioBoxFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format:"), wxDefaultPosition, wxDefaultSize, m_radioBoxFormatNChoices, m_radioBoxFormatChoices, 1, wxRA_SPECIFY_COLS ); + m_radioBoxFormat->SetSelection( 1 ); + brightSizer->Add( m_radioBoxFormat, 0, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizer2; + sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Image Options:") ), wxVERTICAL ); + + m_ThresholdText = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Black / White Threshold:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ThresholdText->Wrap( -1 ); + sbSizer2->Add( m_ThresholdText, 0, wxTOP|wxLEFT, 5 ); + + m_sliderThreshold = new wxSlider( sbSizer2->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS ); + m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") ); + + sbSizer2->Add( m_sliderThreshold, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_checkNegative = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Negative"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer2->Add( m_checkNegative, 0, wxTOP|wxBOTTOM, 10 ); + + + brightSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 ); + + wxString m_radio_PCBLayerChoices[] = { _("Front silk screen"), _("Front solder mask"), _("User layer Eco1"), _("User layer Eco2") }; + int m_radio_PCBLayerNChoices = sizeof( m_radio_PCBLayerChoices ) / sizeof( wxString ); + m_radio_PCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline:"), wxDefaultPosition, wxDefaultSize, m_radio_PCBLayerNChoices, m_radio_PCBLayerChoices, 1, wxRA_SPECIFY_COLS ); + m_radio_PCBLayer->SetSelection( 3 ); + m_radio_PCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe 2 invisible fields reference and value are always placed on the silk screen layer.") ); + + brightSizer->Add( m_radio_PCBLayer, 0, wxALL|wxEXPAND, 5 ); + + + m_panelRight->SetSizer( brightSizer ); + m_panelRight->Layout(); + brightSizer->Fit( m_panelRight ); + bMainSizer->Add( m_panelRight, 0, wxEXPAND, 0 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY ); + + // Connect Events + m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this ); + m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this ); + m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this ); m_AspectRatioLockButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this ); - m_UnitSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, - wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this ); - m_UnitSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, - wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this ); - m_PixelUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, - wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this ); - m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this ); - m_buttonExportFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this ); - m_buttonExportClipboard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this ); - m_radioBoxFormat->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this ); - m_sliderThreshold->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this ); - m_checkNegative->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this ); -} - -BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE() -{ - // Disconnect Events - m_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this ); - m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this ); - m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this ); + m_UnitSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this ); + m_UnitSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this ); + m_PixelUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this ); + m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this ); + m_buttonExportFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this ); + m_buttonExportClipboard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this ); + m_radioBoxFormat->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this ); + m_sliderThreshold->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this ); + m_checkNegative->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this ); +} + +BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE() +{ + // Disconnect Events + m_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this ); + m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this ); + m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this ); m_AspectRatioLockButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this ); - m_UnitSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, - wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this ); - m_UnitSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, - wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this ); - m_PixelUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, - wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this ); - m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this ); - m_buttonExportFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this ); - m_buttonExportClipboard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this ); - m_radioBoxFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this ); - m_sliderThreshold->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this ); - m_checkNegative->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this ); - -} + m_UnitSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this ); + m_UnitSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this ); + m_PixelUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this ); + m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this ); + m_buttonExportFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this ); + m_buttonExportClipboard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this ); + m_radioBoxFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this ); + m_sliderThreshold->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this ); + m_checkNegative->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this ); + +} diff --git a/bitmap2component/bitmap2cmp_gui_base.fbp b/bitmap2component/bitmap2cmp_gui_base.fbp index 8c302fd733..272c271f01 100644 --- a/bitmap2component/bitmap2cmp_gui_base.fbp +++ b/bitmap2component/bitmap2cmp_gui_base.fbp @@ -1,1072 +1,1083 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - bitmap2cmp_gui_base - 1000 - none - - 1 - bitmap2cmp_gui - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - BM2CMP_FRAME_BASE - + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + bitmap2cmp_gui_base + 1000 + none + + 1 + bitmap2cmp_gui + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + BM2CMP_FRAME_BASE + 746,616 - wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER - KIWAY_PLAYER; kiway_player.h - Bitmap to Component Converter - - - - wxTAB_TRAVERSAL - 1 - - - bMainSizer - wxHORIZONTAL - none - - 5 - wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Notebook - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - - - Original Picture - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - -1,-1 - - 0 - 400,300 - 1 - m_InitialPicturePanel - 1 - - - protected - 1 - - Resizable - 5 - 5 - 1 - - - 0 - - - - wxHSCROLL|wxVSCROLL - OnPaintInit - - - - - Greyscale Picture - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - -1,-1 - - 0 - 400,300 - 1 - m_GreyscalePicturePanel - 1 - - - protected - 1 - - Resizable - 5 - 5 - 1 - - - 0 - - - - wxHSCROLL|wxVSCROLL - OnPaintGreyscale - - - - - Black&&White Picture - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_BNPicturePanel - 1 - - - protected - 1 - - Resizable - 5 - 5 - 1 - - - 0 - - - - wxHSCROLL|wxVSCROLL - OnPaintBW - - - - - - 0 - wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_panelRight - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - brightSizer - wxVERTICAL - none - - 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - Bitmap Info: - - sbSizerInfo - wxVERTICAL - 1 - none - - 5 - wxEXPAND|wxBOTTOM - 0 + wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER + KIWAY_PLAYER; kiway_player.h + Bitmap to Component Converter + + + + wxTAB_TRAVERSAL + 1 + + + bMainSizer + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_Notebook + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + + + Original Picture + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + -1,-1 + + 0 + 400,300 + 1 + m_InitialPicturePanel + 1 + + + protected + 1 + + Resizable + 5 + 5 + 1 + + + 0 + + + + wxHSCROLL|wxVSCROLL + OnPaintInit + + + + + Greyscale Picture + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + -1,-1 + + 0 + 400,300 + 1 + m_GreyscalePicturePanel + 1 + + + protected + 1 + + Resizable + 5 + 5 + 1 + + + 0 + + + + wxHSCROLL|wxVSCROLL + OnPaintGreyscale + + + + + Black&&White Picture + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_BNPicturePanel + 1 + + + protected + 1 + + Resizable + 5 + 5 + 1 + + + 0 + + + + wxHSCROLL|wxVSCROLL + OnPaintBW + + + + + + 0 + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panelRight + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + brightSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Bitmap Info: + + sbSizerInfo + wxVERTICAL + 1 + none + + 5 + wxEXPAND|wxBOTTOM + 0 - 4 - wxBOTH - 1,2 - - 0 - - fgSizerInfo - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 0 - - 5 - wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY + 4 + wxBOTH + 1,2 + + 0 + + fgSizerInfo + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY Input size: - 0 - - 0 - - - 0 - - 1 - m_staticTextSize - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 0000 - 0 - - 0 - - - 0 - - 1 - m_SizeXValue - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 0000 - 0 - - 0 - - - 0 - - 1 - m_SizeYValue - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - pixels - 0 - - 0 - - - 0 - - 1 - m_SizePixUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - + 0 + + 0 + + + 0 + + 1 + m_staticTextISize + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0000 + 0 + + 0 + + + 0 + + 1 + m_SizeXValue + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0000 + 0 + + 0 + + + 0 + + 1 + m_SizeYValue + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + pixels + 0 + + 0 + + + 0 + + 1 + m_SizePixUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + - 5 + 5 wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT - 0 + 0 - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY Input DPI: - 0 - - 0 - - - 0 - - 1 + 0 + + 0 + + + 0 + + 1 m_staticTextDPI - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + - 5 + 5 wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT - 0 + 0 - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 0000 - 0 - - 0 - - - 0 - - 1 + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0000 + 0 + + 0 + + + 0 + + 1 m_InputXValueDPI - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + - 5 + 5 wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT - 0 + 0 - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 0000 - 0 - - 0 - - - 0 - - 1 + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0000 + 0 + + 0 + + + 0 + + 1 m_InputYValueDPI - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + - 5 + 5 wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT - 0 + 0 - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY DPI - 0 - - 0 - - - 0 - - 1 + 0 + + 0 + + + 0 + + 1 m_DPIUnit - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - BPP: - 0 - - 0 - - - 0 - - 1 - m_staticTextBPP - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 0000 - 0 - - 0 - - - 0 - - 1 - m_BPPValue - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - bits - 0 - - 0 - - - 0 - - 1 - m_BPPunits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + BPP: + 0 + + 0 + + + 0 + + 1 + m_staticTextBPP + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0000 + 0 + + 0 + + + 0 + + 1 + m_BPPValue + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + bits + 0 + + 0 + + + 0 + + 1 + m_BPPunits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + - 5 - wxEXPAND - 1 + 5 + + 0 - 0 - protected - 0 - - + 0 + protected + 0 + + + + + + 5 + wxEXPAND + 0 + + + bSizerLock + wxHORIZONTAL + none 5 wxALL|wxALIGN_CENTER_VERTICAL @@ -1108,68 +1119,7 @@ 0 1 - m_BPPunits1 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - - 0 - - 1 - m_BPPunits2 + m_textLock 1 @@ -1262,11 +1212,22 @@ ToggleAspectRatioLock - + + + + 5 + wxEXPAND + 0 + + + bSizerRes + wxHORIZONTAL + none + 5 - wxALL + wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -1294,7 +1255,7 @@ 0 0 wxID_ANY - + Size: 0 0 @@ -1303,7 +1264,7 @@ 0 1 - m_BPPunits3 + m_staticTextOSize 1 @@ -1323,851 +1284,790 @@ -1 - - 5 - wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Resolution: - 0 - - 0 - - - 0 - - 1 - m_staticTextBPI - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxBOTTOM|wxRIGHT|wxALIGN_BOTTOM - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 60,-1 - 1 + 1 m_UnitSizeX - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + wxFILTER_NUMERIC wxTextValidator - - 300 - - - + + 300 + + + OnSizeChangeX - - - - 5 - wxBOTTOM|wxRIGHT|wxALIGN_BOTTOM - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 60,-1 - 1 + 1 m_UnitSizeY - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + wxFILTER_NUMERIC wxTextValidator - - 300 - - - + + 300 + + + OnSizeChangeY - - - - 5 - wxALL|wxALIGN_BOTTOM - 0 + + + + 5 + wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL + 0 - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 80,-1 - 1 + 1 m_PixelUnit - 1 - - - protected - 1 - - Resizable + 1 + + + protected + 1 + + Resizable 0 - 1 - - + 1 + + ; ; Not forward_declare - 0 - + 0 + wxFILTER_NONE wxDefaultValidator - - - + + + OnSizeUnitChange - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Load Bitmap - - 0 - - 0 - - - 0 - - 1 - m_buttonLoad - 1 - - - protected - 1 - - - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnLoadFile - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Export to File - - 0 - - 0 - - - 0 - - 1 - m_buttonExportFile - 1 - - - protected - 1 - - - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnExportToFile - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Export to Clipboard - - 0 - - 0 - - - 0 - - 1 - m_buttonExportClipboard - 1 - - - protected - 1 - - - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnExportToClipboard - - - - 5 - wxEXPAND|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Eeschema (.lib file)" "Pcbnew (.kicad_mod file)" "Postscript (.ps file)" "Logo for title block (.kicad_wks file)" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Format: - 1 - - 0 - - - 0 - - 1 - m_radioBoxFormat - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnFormatChange - - - - 5 - wxALL|wxEXPAND - 0 - - wxID_ANY - Image Options: - - sbSizer2 - wxVERTICAL - 1 - none - - 5 - wxTOP|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Black / White Threshold: - 0 - - 0 - - - 0 - - 1 - m_ThresholdText - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 100 - - 0 - - 0 - - 0 - - 1 - m_sliderThreshold - 1 - - - protected - 1 - - Resizable - 1 - - wxSL_HORIZONTAL|wxSL_LABELS - - 0 - Adjust the level to convert the greyscale picture to a black and white picture. - - wxFILTER_NONE - wxDefaultValidator - - 50 - - - - OnThresholdChange - - - - 10 - wxTOP|wxBOTTOM - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Negative - - 0 - - - 0 - - 1 - m_checkNegative - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnNegativeClicked - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Front silk screen" "Front solder mask" "User layer Eco1" "User layer Eco2" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Board Layer for Outline: - 1 - - 0 - - - 0 - - 1 - m_radio_PCBLayer - 1 - - - protected - 1 - - Resizable - 3 - 1 - - wxRA_SPECIFY_COLS - - 0 - Choose the board layer to place the outline. The 2 invisible fields reference and value are always placed on the silk screen layer. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - 1 - 1 - - 1 - - 0 - wxID_ANY - - - m_statusBar - protected - - - wxSTB_SIZEGRIP - - - - - - - - - + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Load Bitmap + + 0 + + 0 + + + 0 + + 1 + m_buttonLoad + 1 + + + protected + 1 + + + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnLoadFile + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Export to File + + 0 + + 0 + + + 0 + + 1 + m_buttonExportFile + 1 + + + protected + 1 + + + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnExportToFile + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Export to Clipboard + + 0 + + 0 + + + 0 + + 1 + m_buttonExportClipboard + 1 + + + protected + 1 + + + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnExportToClipboard + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Eeschema (.lib file)" "Pcbnew (.kicad_mod file)" "Postscript (.ps file)" "Logo for title block (.kicad_wks file)" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Format: + 1 + + 0 + + + 0 + + 1 + m_radioBoxFormat + 1 + + + protected + 1 + + Resizable + 1 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnFormatChange + + + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + Image Options: + + sbSizer2 + wxVERTICAL + 1 + none + + 5 + wxTOP|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Black / White Threshold: + 0 + + 0 + + + 0 + + 1 + m_ThresholdText + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 100 + + 0 + + 0 + + 0 + + 1 + m_sliderThreshold + 1 + + + protected + 1 + + Resizable + 1 + + wxSL_HORIZONTAL|wxSL_LABELS + + 0 + Adjust the level to convert the greyscale picture to a black and white picture. + + wxFILTER_NONE + wxDefaultValidator + + 50 + + + + OnThresholdChange + + + + 10 + wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Negative + + 0 + + + 0 + + 1 + m_checkNegative + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnNegativeClicked + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Front silk screen" "Front solder mask" "User layer Eco1" "User layer Eco2" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Board Layer for Outline: + 1 + + 0 + + + 0 + + 1 + m_radio_PCBLayer + 1 + + + protected + 1 + + Resizable + 3 + 1 + + wxRA_SPECIFY_COLS + + 0 + Choose the board layer to place the outline. The 2 invisible fields reference and value are always placed on the silk screen layer. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + 1 + 1 + + 1 + + 0 + wxID_ANY + + + m_statusBar + protected + + + wxSTB_SIZEGRIP + + + + + + + + + diff --git a/bitmap2component/bitmap2cmp_gui_base.h b/bitmap2component/bitmap2cmp_gui_base.h index 7af2e0a9bc..fbdd18e877 100644 --- a/bitmap2component/bitmap2cmp_gui_base.h +++ b/bitmap2component/bitmap2cmp_gui_base.h @@ -1,117 +1,105 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "kiway_player.h" +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Dec 1 2018) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + #include -#include +#include +#include +#include "kiway_player.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class BM2CMP_FRAME_BASE -/////////////////////////////////////////////////////////////////////////////// -class BM2CMP_FRAME_BASE : public KIWAY_PLAYER -{ - private: - - protected: - wxNotebook* m_Notebook; - wxScrolledWindow* m_InitialPicturePanel; - wxScrolledWindow* m_GreyscalePicturePanel; - wxScrolledWindow* m_BNPicturePanel; - wxPanel* m_panelRight; - wxStaticText* m_staticTextSize; - wxStaticText* m_SizeXValue; - wxStaticText* m_SizeYValue; - wxStaticText* m_SizePixUnits; +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class BM2CMP_FRAME_BASE +/////////////////////////////////////////////////////////////////////////////// +class BM2CMP_FRAME_BASE : public KIWAY_PLAYER +{ + private: + + protected: + wxNotebook* m_Notebook; + wxScrolledWindow* m_InitialPicturePanel; + wxScrolledWindow* m_GreyscalePicturePanel; + wxScrolledWindow* m_BNPicturePanel; + wxPanel* m_panelRight; + wxStaticText* m_staticTextISize; + wxStaticText* m_SizeXValue; + wxStaticText* m_SizeYValue; + wxStaticText* m_SizePixUnits; wxStaticText* m_staticTextDPI; wxStaticText* m_InputXValueDPI; wxStaticText* m_InputYValueDPI; wxStaticText* m_DPIUnit; - wxStaticText* m_staticTextBPP; - wxStaticText* m_BPPValue; - wxStaticText* m_BPPunits; - wxStaticText* m_BPPunits1; - wxStaticText* m_BPPunits2; + wxStaticText* m_staticTextBPP; + wxStaticText* m_BPPValue; + wxStaticText* m_BPPunits; + wxStaticText* m_textLock; wxBitmapButton* m_AspectRatioLockButton; - wxStaticText* m_BPPunits3; - wxStaticText* m_staticTextBPI; + wxStaticText* m_staticTextOSize; wxTextCtrl* m_UnitSizeX; wxTextCtrl* m_UnitSizeY; wxChoice* m_PixelUnit; - wxButton* m_buttonLoad; - wxButton* m_buttonExportFile; - wxButton* m_buttonExportClipboard; - wxRadioBox* m_radioBoxFormat; - wxStaticText* m_ThresholdText; - wxSlider* m_sliderThreshold; - wxCheckBox* m_checkNegative; - wxRadioBox* m_radio_PCBLayer; - wxStatusBar* m_statusBar; - - // Virtual event handlers, overide them in your derived class - virtual void OnPaintInit( wxPaintEvent& event ) { event.Skip(); } - virtual void OnPaintGreyscale( wxPaintEvent& event ) { event.Skip(); } - virtual void OnPaintBW( wxPaintEvent& event ) { event.Skip(); } + wxButton* m_buttonLoad; + wxButton* m_buttonExportFile; + wxButton* m_buttonExportClipboard; + wxRadioBox* m_radioBoxFormat; + wxStaticText* m_ThresholdText; + wxSlider* m_sliderThreshold; + wxCheckBox* m_checkNegative; + wxRadioBox* m_radio_PCBLayer; + wxStatusBar* m_statusBar; + + // Virtual event handlers, overide them in your derived class + virtual void OnPaintInit( wxPaintEvent& event ) { event.Skip(); } + virtual void OnPaintGreyscale( wxPaintEvent& event ) { event.Skip(); } + virtual void OnPaintBW( wxPaintEvent& event ) { event.Skip(); } virtual void ToggleAspectRatioLock( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSizeChangeX( wxCommandEvent& event ) - { - event.Skip(); - } - virtual void OnSizeChangeY( wxCommandEvent& event ) - { - event.Skip(); - } - virtual void OnSizeUnitChange( wxCommandEvent& event ) - { - event.Skip(); - } - virtual void OnLoadFile( wxCommandEvent& event ) { event.Skip(); } - virtual void OnExportToFile( wxCommandEvent& event ) { event.Skip(); } - virtual void OnExportToClipboard( wxCommandEvent& event ) { event.Skip(); } - virtual void OnFormatChange( wxCommandEvent& event ) { event.Skip(); } - virtual void OnThresholdChange( wxScrollEvent& event ) { event.Skip(); } - virtual void OnNegativeClicked( wxCommandEvent& event ) { event.Skip(); } - - - public: - wxString m_NumericValidator; - - BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Bitmap to Component Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 746,616 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL ); - - ~BM2CMP_FRAME_BASE(); - -}; - + virtual void OnSizeChangeX( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSizeChangeY( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSizeUnitChange( wxCommandEvent& event ) { event.Skip(); } + virtual void OnLoadFile( wxCommandEvent& event ) { event.Skip(); } + virtual void OnExportToFile( wxCommandEvent& event ) { event.Skip(); } + virtual void OnExportToClipboard( wxCommandEvent& event ) { event.Skip(); } + virtual void OnFormatChange( wxCommandEvent& event ) { event.Skip(); } + virtual void OnThresholdChange( wxScrollEvent& event ) { event.Skip(); } + virtual void OnNegativeClicked( wxCommandEvent& event ) { event.Skip(); } + + + public: + + BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Bitmap to Component Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 746,616 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL ); + + ~BM2CMP_FRAME_BASE(); + +}; +