From af7c26e8bea3535f7b588b84da355d35c2135c64 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 25 Jun 2010 21:02:39 +0200 Subject: [PATCH] bitmap2component minor enhancements --- CHANGELOG.txt | 9 +++++++++ bitmap2component/bitmap2cmp_gui.cpp | 12 ++++++------ bitmap2component/bitmap2cmp_gui_base.cpp | 2 +- bitmap2component/bitmap2cmp_gui_base.fbp | 6 +++--- demos/pic_programmer/pic_programmer.pro | 2 +- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 5e625f6add..486e1abcab 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,15 @@ KiCad ChangeLog 2010 Please add newer entries at the top, list the date and your name with email address. +2010-jun-24 UPDATE Wayne Stambaugh +================================================================================ +++EESchema component library and hierarchical sheet label object improvements. + * Continue component library class clean up and encapsulation work. + * Change hierarchical sheet label container to boost::vector_ptr. + * Encapsulate hierarchical label handling in hierarchical sheet class. + * Convert some missed occurrences of wxString::GetData() to GetChars( wxString ). + * Fix some minor code formatting issues. + 2010-jun-23, UPDATE Jean-Pierre Charras ================================================================================ ++eeschema: diff --git a/bitmap2component/bitmap2cmp_gui.cpp b/bitmap2component/bitmap2cmp_gui.cpp index a376582919..3eab77a013 100644 --- a/bitmap2component/bitmap2cmp_gui.cpp +++ b/bitmap2component/bitmap2cmp_gui.cpp @@ -71,7 +71,7 @@ private: void OnLoadFile( wxCommandEvent& event ); void OnExportEeschema( wxCommandEvent& event ); void OnExportPcbnew( wxCommandEvent& event ); - void Binarize( int aThreshold ); + void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level) void OnOptionsSelection( wxCommandEvent& event ); void OnThresholdChange( wxScrollEvent& event ); void NegateGreyscaleImage( ); @@ -196,18 +196,18 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event ) m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image ); m_NB_Image = m_Greyscale_Image; - Binarize( m_sliderThreshold->GetValue() ); + Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() ); Refresh(); } -void BM2CMP_FRAME::Binarize( int aThreshold ) +void BM2CMP_FRAME::Binarize( double aThreshold ) { unsigned int pixin; unsigned char pixout; int h = m_Greyscale_Image.GetHeight(); int w = m_Greyscale_Image.GetWidth(); - unsigned int threshold = (aThreshold * 256) / 10; + unsigned int threshold = (int)(aThreshold * 256); for( int y = 1; y < h; y++ ) for( int x = 1; x < w; x++ ) @@ -243,13 +243,13 @@ void BM2CMP_FRAME::OnOptionsSelection( wxCommandEvent& event ) { NegateGreyscaleImage( ); m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image ); - Binarize( m_sliderThreshold->GetValue() ); + Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() ); Refresh(); } void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event ) { - Binarize( m_sliderThreshold->GetValue() ); + Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() ); Refresh(); } diff --git a/bitmap2component/bitmap2cmp_gui_base.cpp b/bitmap2component/bitmap2cmp_gui_base.cpp index 832e699a65..fa72459275 100644 --- a/bitmap2component/bitmap2cmp_gui_base.cpp +++ b/bitmap2component/bitmap2cmp_gui_base.cpp @@ -87,7 +87,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS m_ThresholdText->Wrap( -1 ); brightSizer->Add( m_ThresholdText, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_sliderThreshold = new wxSlider( this, wxID_ANY, 5, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS|wxSL_TOP ); + m_sliderThreshold = new wxSlider( this, wxID_ANY, 25, 0, 50, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_TOP ); brightSizer->Add( m_sliderThreshold, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( brightSizer, 0, wxEXPAND, 5 ); diff --git a/bitmap2component/bitmap2cmp_gui_base.fbp b/bitmap2component/bitmap2cmp_gui_base.fbp index a7fb614d88..d008ba62fd 100644 --- a/bitmap2component/bitmap2cmp_gui_base.fbp +++ b/bitmap2component/bitmap2cmp_gui_base.fbp @@ -670,7 +670,7 @@ 0 wxID_ANY - 10 + 50 0 @@ -678,10 +678,10 @@ protected - wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS|wxSL_TOP + wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_TOP - 5 + 25 diff --git a/demos/pic_programmer/pic_programmer.pro b/demos/pic_programmer/pic_programmer.pro index 750daa8a11..52544d9d8f 100644 --- a/demos/pic_programmer/pic_programmer.pro +++ b/demos/pic_programmer/pic_programmer.pro @@ -1,4 +1,4 @@ -update=23/06/2010 18:43:01 +update=24/06/2010 21:06:23 last_client=pcbnew [general] version=1