fixed bug 603481. Better bitmap2component look. fixed some locate problems for footprints using polygons (mainly created by bitmap2component)
This commit is contained in:
@@ -69,6 +69,7 @@ private:
|
||||
// Event handlers
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void OnLoadFile( wxCommandEvent& event );
|
||||
bool LoadFile( wxString& aFullFileName );
|
||||
void OnExportEeschema( wxCommandEvent& event );
|
||||
void OnExportPcbnew( wxCommandEvent& event );
|
||||
void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level)
|
||||
@@ -94,16 +95,13 @@ BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL )
|
||||
SetIcon( wxICON( bitmap2component ) );
|
||||
#endif
|
||||
|
||||
wxString msg( wxT( "000000" ) );
|
||||
m_gridInfo->SetCellValue( 0, 0, msg );
|
||||
m_gridInfo->SetCellValue( 1, 0, msg );
|
||||
if( GetSizer() )
|
||||
{
|
||||
GetSizer()->SetSizeHints( this );
|
||||
}
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
m_buttonExportEeschema->Enable( false );
|
||||
m_buttonExportPcbnew->Enable( false );
|
||||
|
||||
if ( m_FramePos == wxDefaultPosition )
|
||||
Centre();
|
||||
}
|
||||
@@ -162,13 +160,24 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
wxString fullFilename = FileDlg.GetPath();
|
||||
if( ! LoadFile( fullFilename ) )
|
||||
return;
|
||||
|
||||
m_BitmapFileName = FileDlg.GetPath();
|
||||
m_buttonExportEeschema->Enable( true );
|
||||
m_buttonExportPcbnew->Enable( true );
|
||||
SetStatusText( fullFilename );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
bool BM2CMP_FRAME::LoadFile( wxString& aFullFileName )
|
||||
{
|
||||
m_BitmapFileName = aFullFileName;
|
||||
|
||||
if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
|
||||
{
|
||||
wxMessageBox( _( "Couldn't load image from <%s>" ), m_BitmapFileName.c_str() );
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Pict_Bitmap = wxBitmap( m_Pict_Image );
|
||||
@@ -178,12 +187,12 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||
int nb = m_Pict_Bitmap.GetDepth();
|
||||
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "%d" ), h );
|
||||
m_gridInfo->SetCellValue( 0, 0, msg );
|
||||
msg.Printf( wxT( "%d" ), w );
|
||||
m_gridInfo->SetCellValue( 1, 0, msg );
|
||||
m_SizeXValue->SetLabel(msg);
|
||||
msg.Printf( wxT( "%d" ), h );
|
||||
m_SizeYValue->SetLabel(msg);
|
||||
msg.Printf( wxT( "%d" ), nb );
|
||||
m_gridInfo->SetCellValue( 2, 0, msg );
|
||||
m_BPPValue->SetLabel(msg);
|
||||
|
||||
m_InitialPicturePanel->SetVirtualSize( w, h );
|
||||
m_GreyscalePicturePanel->SetVirtualSize( w, h );
|
||||
@@ -197,9 +206,9 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||
|
||||
m_NB_Image = m_Greyscale_Image;
|
||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BM2CMP_FRAME::Binarize( double aThreshold )
|
||||
{
|
||||
@@ -261,7 +270,7 @@ void BM2CMP_FRAME::OnExportEeschema( wxCommandEvent& event )
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
wxString msg = _( "Schematic lib file (*.lib)|*.lib" );
|
||||
wxFileDialog FileDlg( this, _( "Create lib file" ), path, wxEmptyString,
|
||||
wxFileDialog FileDlg( this, _( "Create a lib file for Eeschema" ), path, wxEmptyString,
|
||||
msg,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = FileDlg.ShowModal();
|
||||
@@ -291,8 +300,9 @@ void BM2CMP_FRAME::OnExportPcbnew( wxCommandEvent& event )
|
||||
wxString path = fn.GetPath();
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
wxString msg = _( "Footprint export file (*.emp)|*.emp" );
|
||||
wxFileDialog FileDlg( this, _( "Create footprint export file" ), path, wxEmptyString,
|
||||
wxString msg = _( "Footprint file (*.mod)|*.mod" );
|
||||
wxFileDialog FileDlg( this, _( "Create a footprint file for PcbNew" ),
|
||||
path, wxEmptyString,
|
||||
msg,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = FileDlg.ShowModal();
|
||||
|
||||
Reference in New Issue
Block a user