fixed bug 603481. Better bitmap2component look. fixed some locate problems for footprints using polygons (mainly created by bitmap2component)

This commit is contained in:
jean-pierre charras 2010-07-11 18:24:44 +02:00
parent ce0eec899c
commit 052876079a
20 changed files with 917 additions and 382 deletions

View File

@ -17,6 +17,7 @@ if(WIN32)
set(BITMAP2COMPONENT_RESOURCES bitmap2component.rc) set(BITMAP2COMPONENT_RESOURCES bitmap2component.rc)
endif(MINGW) endif(MINGW)
endif(WIN32) endif(WIN32)
add_executable(bitmap2component WIN32 MACOSX_BUNDLE add_executable(bitmap2component WIN32 MACOSX_BUNDLE
${BITMAP2COMPONENT_SRCS} ${BITMAP2COMPONENT_SRCS}
${BITMAP2COMPONENT_RESOURCES}) ${BITMAP2COMPONENT_RESOURCES})
@ -28,6 +29,6 @@ target_link_libraries( bitmap2component
kbool ) kbool )
install(TARGETS bitmap2component install(TARGETS bitmap2component
DESTINATION ${KICAD_PLUGINS} DESTINATION ${KICAD_BIN}
COMPONENT binary) COMPONENT binary)

View File

@ -69,6 +69,7 @@ private:
// Event handlers // Event handlers
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
void OnLoadFile( wxCommandEvent& event ); void OnLoadFile( wxCommandEvent& event );
bool LoadFile( wxString& aFullFileName );
void OnExportEeschema( wxCommandEvent& event ); void OnExportEeschema( wxCommandEvent& event );
void OnExportPcbnew( wxCommandEvent& event ); void OnExportPcbnew( wxCommandEvent& event );
void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level) 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 ) ); SetIcon( wxICON( bitmap2component ) );
#endif #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 ); 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 ) if ( m_FramePos == wxDefaultPosition )
Centre(); Centre();
} }
@ -162,13 +160,24 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
if( diag != wxID_OK ) if( diag != wxID_OK )
return; 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 ) ) if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
{ {
wxMessageBox( _( "Couldn't load image from <%s>" ), m_BitmapFileName.c_str() ); wxMessageBox( _( "Couldn't load image from <%s>" ), m_BitmapFileName.c_str() );
return; return false;
} }
m_Pict_Bitmap = wxBitmap( m_Pict_Image ); m_Pict_Bitmap = wxBitmap( m_Pict_Image );
@ -178,12 +187,12 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
int nb = m_Pict_Bitmap.GetDepth(); int nb = m_Pict_Bitmap.GetDepth();
wxString msg; wxString msg;
msg.Printf( wxT( "%d" ), h );
m_gridInfo->SetCellValue( 0, 0, msg );
msg.Printf( wxT( "%d" ), w ); 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 ); msg.Printf( wxT( "%d" ), nb );
m_gridInfo->SetCellValue( 2, 0, msg ); m_BPPValue->SetLabel(msg);
m_InitialPicturePanel->SetVirtualSize( w, h ); m_InitialPicturePanel->SetVirtualSize( w, h );
m_GreyscalePicturePanel->SetVirtualSize( w, h ); m_GreyscalePicturePanel->SetVirtualSize( w, h );
@ -197,9 +206,9 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
m_NB_Image = m_Greyscale_Image; m_NB_Image = m_Greyscale_Image;
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() ); Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
Refresh();
}
return true;
}
void BM2CMP_FRAME::Binarize( double aThreshold ) void BM2CMP_FRAME::Binarize( double aThreshold )
{ {
@ -261,7 +270,7 @@ void BM2CMP_FRAME::OnExportEeschema( wxCommandEvent& event )
if( path.IsEmpty() || !wxDirExists(path) ) if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd(); path = ::wxGetCwd();
wxString msg = _( "Schematic lib file (*.lib)|*.lib" ); 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, msg,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
int diag = FileDlg.ShowModal(); int diag = FileDlg.ShowModal();
@ -291,8 +300,9 @@ void BM2CMP_FRAME::OnExportPcbnew( wxCommandEvent& event )
wxString path = fn.GetPath(); wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists(path) ) if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd(); path = ::wxGetCwd();
wxString msg = _( "Footprint export file (*.emp)|*.emp" ); wxString msg = _( "Footprint file (*.mod)|*.mod" );
wxFileDialog FileDlg( this, _( "Create footprint export file" ), path, wxEmptyString, wxFileDialog FileDlg( this, _( "Create a footprint file for PcbNew" ),
path, wxEmptyString,
msg, msg,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
int diag = FileDlg.ShowModal(); int diag = FileDlg.ShowModal();

View File

@ -36,45 +36,65 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
wxBoxSizer* brightSizer; wxBoxSizer* brightSizer;
brightSizer = new wxBoxSizer( wxVERTICAL ); brightSizer = new wxBoxSizer( wxVERTICAL );
m_gridInfo = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); wxStaticBoxSizer* sbSizerInfo;
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Bitmap info:") ), wxVERTICAL );
// Grid wxFlexGridSizer* fgSizerInfo;
m_gridInfo->CreateGrid( 3, 1 ); fgSizerInfo = new wxFlexGridSizer( 3, 3, 0, 0 );
m_gridInfo->EnableEditing( false ); fgSizerInfo->SetFlexibleDirection( wxBOTH );
m_gridInfo->EnableGridLines( true ); fgSizerInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_gridInfo->EnableDragGridSize( false );
m_gridInfo->SetMargins( 0, 0 );
// Columns m_staticTextSizeX = new wxStaticText( this, wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_gridInfo->SetColSize( 0, 80 ); m_staticTextSizeX->Wrap( -1 );
m_gridInfo->EnableDragColMove( false ); fgSizerInfo->Add( m_staticTextSizeX, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_gridInfo->EnableDragColSize( true );
m_gridInfo->SetColLabelSize( 30 );
m_gridInfo->SetColLabelValue( 0, _("Value") );
m_gridInfo->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows m_SizeXValue = new wxStaticText( this, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_gridInfo->AutoSizeRows(); m_SizeXValue->Wrap( -1 );
m_gridInfo->EnableDragRowSize( true ); fgSizerInfo->Add( m_SizeXValue, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_gridInfo->SetRowLabelSize( 80 );
m_gridInfo->SetRowLabelValue( 0, _("Size X") );
m_gridInfo->SetRowLabelValue( 1, _("Size Y") );
m_gridInfo->SetRowLabelValue( 2, _("BPP") );
m_gridInfo->SetRowLabelAlignment( wxALIGN_RIGHT, wxALIGN_CENTRE );
// Label Appearance m_SizeXunits = new wxStaticText( this, wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXunits->Wrap( -1 );
fgSizerInfo->Add( m_SizeXunits, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
// Cell Defaults m_staticTextSizeY = new wxStaticText( this, wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_gridInfo->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); m_staticTextSizeY->Wrap( -1 );
brightSizer->Add( m_gridInfo, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); fgSizerInfo->Add( m_staticTextSizeY, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_SizeYValue = new wxStaticText( this, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYValue->Wrap( -1 );
fgSizerInfo->Add( m_SizeYValue, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_SizeYunits = new wxStaticText( this, wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYunits->Wrap( -1 );
fgSizerInfo->Add( m_SizeYunits, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextBPP = new wxStaticText( this, wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextBPP->Wrap( -1 );
fgSizerInfo->Add( m_staticTextBPP, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_BPPValue = new wxStaticText( this, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_BPPValue->Wrap( -1 );
fgSizerInfo->Add( m_BPPValue, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_BPPunits = new wxStaticText( this, wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 );
m_BPPunits->Wrap( -1 );
fgSizerInfo->Add( m_BPPunits, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND|wxBOTTOM, 5 );
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 );
m_buttonLoad = new wxButton( this, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonLoad = new wxButton( this, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
brightSizer->Add( m_buttonLoad, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); brightSizer->Add( m_buttonLoad, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonExportEeschema = new wxButton( this, wxID_ANY, _("Export to eeschema"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonExportEeschema = new wxButton( this, wxID_ANY, _("Export to eeschema"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonExportEeschema->SetToolTip( _("Create a lib file for Eeschema") );
brightSizer->Add( m_buttonExportEeschema, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); brightSizer->Add( m_buttonExportEeschema, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonExportPcbnew = new wxButton( this, wxID_ANY, _("Export to Pcbnew"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonExportPcbnew = new wxButton( this, wxID_ANY, _("Export to Pcbnew"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonExportPcbnew->SetToolTip( _("Create a footprint file for PcbNew") );
brightSizer->Add( m_buttonExportPcbnew, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); brightSizer->Add( m_buttonExportPcbnew, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
wxString m_rbOptionsChoices[] = { _("Normal"), _("Negative") }; wxString m_rbOptionsChoices[] = { _("Normal"), _("Negative") };
@ -94,6 +114,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
// Connect Events // Connect Events
m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this ); m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );

View File

@ -288,93 +288,61 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL</property> <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxGrid" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="autosize_cols">0</property> <property name="id">wxID_ANY</property>
<property name="autosize_rows">1</property> <property name="label">Bitmap info:</property>
<property name="minimum_size"></property>
<property name="name">sbSizerInfo</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">fgSizerInfo</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">3</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="cell_bg"></property>
<property name="cell_font"></property>
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
<property name="cell_text"></property>
<property name="cell_vert_alignment">wxALIGN_TOP</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="col_label_size">30</property>
<property name="col_label_values">&quot;Value&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="cols">1</property>
<property name="column_sizes">80</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">1</property>
<property name="editing">0</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
<property name="grid_line_color"></property>
<property name="grid_lines">1</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label_bg"></property> <property name="label">Size X:</property>
<property name="label_font"></property>
<property name="label_text"></property>
<property name="margin_height">0</property>
<property name="margin_width">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_gridInfo</property> <property name="name">m_staticTextSizeX</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="row_label_horiz_alignment">wxALIGN_RIGHT</property>
<property name="row_label_size">80</property>
<property name="row_label_values">&quot;Size X&quot; &quot;Size Y&quot; &quot;BPP&quot;</property>
<property name="row_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="row_sizes"></property>
<property name="rows">3</property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
<event name="OnGridCellChange"></event>
<event name="OnGridCellLeftClick"></event>
<event name="OnGridCellLeftDClick"></event>
<event name="OnGridCellRightClick"></event>
<event name="OnGridCellRightDClick"></event>
<event name="OnGridCmdCellChange"></event>
<event name="OnGridCmdCellLeftClick"></event>
<event name="OnGridCmdCellLeftDClick"></event>
<event name="OnGridCmdCellRightClick"></event>
<event name="OnGridCmdCellRightDClick"></event>
<event name="OnGridCmdColSize"></event>
<event name="OnGridCmdEditorCreated"></event>
<event name="OnGridCmdEditorHidden"></event>
<event name="OnGridCmdEditorShown"></event>
<event name="OnGridCmdLabelLeftClick"></event>
<event name="OnGridCmdLabelLeftDClick"></event>
<event name="OnGridCmdLabelRightClick"></event>
<event name="OnGridCmdLabelRightDClick"></event>
<event name="OnGridCmdRangeSelect"></event>
<event name="OnGridCmdRowSize"></event>
<event name="OnGridCmdSelectCell"></event>
<event name="OnGridColSize"></event>
<event name="OnGridEditorCreated"></event>
<event name="OnGridEditorHidden"></event>
<event name="OnGridEditorShown"></event>
<event name="OnGridLabelLeftClick"></event>
<event name="OnGridLabelLeftDClick"></event>
<event name="OnGridLabelRightClick"></event>
<event name="OnGridLabelRightDClick"></event>
<event name="OnGridRangeSelect"></event>
<event name="OnGridRowSize"></event>
<event name="OnGridSelectCell"></event>
<event name="OnKeyDown"></event> <event name="OnKeyDown"></event>
<event name="OnKeyUp"></event> <event name="OnKeyUp"></event>
<event name="OnKillFocus"></event> <event name="OnKillFocus"></event>
@ -397,6 +365,418 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">0000</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_SizeXValue</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">pixels</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_SizeXunits</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Size Y:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticTextSizeY</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">0000</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_SizeYValue</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">pixels</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_SizeYunits</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">BPP:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticTextBPP</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">0000</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_BPPValue</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">bits</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_BPPunits</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL</property> <property name="flag">wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL</property>
@ -471,7 +851,7 @@
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip">Create a lib file for Eeschema</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -523,7 +903,7 @@
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip">Create a footprint file for PcbNew</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -733,6 +1113,51 @@
</object> </object>
</object> </object>
</object> </object>
<object class="wxStatusBar" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="fields">1</property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_statusBar</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxST_SIZEGRIP</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object> </object>
</object> </object>
</wxFormBuilder_Project> </wxFormBuilder_Project>

View File

@ -20,12 +20,13 @@
#include <wx/image.h> #include <wx/image.h>
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/grid.h> #include <wx/stattext.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/stattext.h>
#include <wx/slider.h> #include <wx/slider.h>
#include <wx/sizer.h> #include <wx/statusbr.h>
#include <wx/frame.h> #include <wx/frame.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -43,13 +44,22 @@ class BM2CMP_FRAME_BASE : public wxFrame
wxScrolledWindow* m_InitialPicturePanel; wxScrolledWindow* m_InitialPicturePanel;
wxScrolledWindow* m_GreyscalePicturePanel; wxScrolledWindow* m_GreyscalePicturePanel;
wxScrolledWindow* m_BNPicturePanel; wxScrolledWindow* m_BNPicturePanel;
wxGrid* m_gridInfo; wxStaticText* m_staticTextSizeX;
wxStaticText* m_SizeXValue;
wxStaticText* m_SizeXunits;
wxStaticText* m_staticTextSizeY;
wxStaticText* m_SizeYValue;
wxStaticText* m_SizeYunits;
wxStaticText* m_staticTextBPP;
wxStaticText* m_BPPValue;
wxStaticText* m_BPPunits;
wxButton* m_buttonLoad; wxButton* m_buttonLoad;
wxButton* m_buttonExportEeschema; wxButton* m_buttonExportEeschema;
wxButton* m_buttonExportPcbnew; wxButton* m_buttonExportPcbnew;
wxRadioBox* m_rbOptions; wxRadioBox* m_rbOptions;
wxStaticText* m_ThresholdText; wxStaticText* m_ThresholdText;
wxSlider* m_sliderThreshold; wxSlider* m_sliderThreshold;
wxStatusBar* m_statusBar;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnPaint( wxPaintEvent& event ){ event.Skip(); } virtual void OnPaint( wxPaintEvent& event ){ event.Skip(); }

View File

@ -0,0 +1,38 @@
/* XPM */
const char *bitmap2component_16x16_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 16 1",
"& c #128B26",
" c #0CFA0C",
"# c #A75104",
"@ c #22204C",
"O c #050304",
"; c #191327",
"X c #054306",
"* c #F27504",
"o c #0C7E0C",
": c #1ACC2E",
"$ c #51280C",
"- c #391E07",
". c #0CBE0C",
"% c #289F55",
"= c #703505",
"+ c #1C563C",
/* pixels */
" . X",
"oooooooooooo .. ",
"oXO+ooooooXO .. ",
"@@#$+%+& XX X",
"OO#*#O#=OX XOOO",
"OO#*=O$-OO;@@@: ",
"OO=OO.%:XOO***$o",
"%:% X. ;***#X",
"ooooo . .o;***#;",
"OO=$OXooOOO###;o",
"OO#*#O#$OOX+o&: ",
"OO#*=O=-OX XOOO",
"&X=;& %% XX X",
"oX;oooooooXO .. ",
"oooooooooooo .. ",
" . X"
};

View File

@ -443,7 +443,7 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
} }
wxString msg; wxString msg;
msg.Printf( _( "Command <%s> could not found" ), GetChars( ExecFile ) ); msg.Printf( _( "Command <%s> could not found" ), GetChars( FullFileName ) );
DisplayError( frame, msg, 20 ); DisplayError( frame, msg, 20 );
return -1; return -1;
} }

View File

@ -1,4 +1,4 @@
update=30/06/2010 12:54:53 update=05/07/2010 19:03:21
version=1 version=1
last_client=pcbnew last_client=pcbnew
[common] [common]

View File

@ -181,7 +181,7 @@ wxPoint SCH_TEXT::GetSchematicTextOffset()
} }
bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void * aAuxData ) bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{ {
return SCH_ITEM::Matches( m_Text, aSearchData ); return SCH_ITEM::Matches( m_Text, aSearchData );
} }
@ -212,12 +212,21 @@ void SCH_TEXT::Mirror_Y( int aYaxis_position )
int px = m_Pos.x; int px = m_Pos.x;
int dx; int dx;
if( m_Orient == 0 ) /* horizontal text */ switch( GetSchematicTextOrientation() )
{
case 0: /* horizontal text */
dx = LenSize( m_Text ) / 2; dx = LenSize( m_Text ) / 2;
else if( m_Orient == 2 ) /* invert horizontal text*/ break;
case 2: /* invert horizontal text*/
dx = -LenSize( m_Text ) / 2; dx = -LenSize( m_Text ) / 2;
else break;
default:
dx = 0; dx = 0;
break;
}
px += dx; px += dx;
px -= aYaxis_position; px -= aYaxis_position;
NEGATE( px ); NEGATE( px );
@ -270,14 +279,23 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset()
*/ */
void SCH_HIERLABEL::Mirror_Y( int aYaxis_position ) void SCH_HIERLABEL::Mirror_Y( int aYaxis_position )
{ {
// Text is NOT really mirrored; it is moved to a suitable position /* The hierarchical label is NOT really mirrored.
// which is the closest position for a true mirrored text * for an horizontal label, the schematic orientation is changed.
// The center position is mirrored and the text is moved for half * for a vericalal label, the schematic orientation is not changed.
// horizontal len * and the label is moved to a suitable position
if( m_Orient == 0 ) /* horizontal text */ */
m_Orient = 2;
else if( m_Orient == 2 ) /* invert horizontal text*/ switch( GetSchematicTextOrientation() )
m_Orient = 0; {
case 0: /* horizontal text */
SetSchematicTextOrientation( 2 );
break;
case 2: /* invert horizontal text*/
SetSchematicTextOrientation( 0 );
break;
}
m_Pos.x -= aYaxis_position; m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x ); NEGATE( m_Pos.x );
m_Pos.x += aYaxis_position; m_Pos.x += aYaxis_position;
@ -290,14 +308,22 @@ void SCH_HIERLABEL::Mirror_Y( int aYaxis_position )
*/ */
void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position ) void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position )
{ {
// Text is NOT really mirrored; it is moved to a suitable position /* The global label is NOT really mirrored.
// which is the closest position for a true mirrored text * for an horizontal label, the schematic orientation is changed.
// The center position is mirrored and the text is moved for half * for a vericalal label, the schematic orientation is not changed.
// horizontal len * and the label is moved to a suitable position
if( m_Orient == 0 ) /* horizontal text */ */
m_Orient = 2; switch( GetSchematicTextOrientation() )
else if( m_Orient == 2 ) /* invert horizontal text*/ {
m_Orient = 0; case 0: /* horizontal text */
SetSchematicTextOrientation( 2 );
break;
case 2: /* invert horizontal text*/
SetSchematicTextOrientation( 0 );
break;
}
m_Pos.x -= aYaxis_position; m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x ); NEGATE( m_Pos.x );
m_Pos.x += aYaxis_position; m_Pos.x += aYaxis_position;
@ -583,6 +609,7 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
int DrawMode, int Color ) int DrawMode, int Color )
{ {
/****************************************************************************/ /****************************************************************************/
/* Text type Comment (text on layer "NOTE") have 4 directions, and the Text /* Text type Comment (text on layer "NOTE") have 4 directions, and the Text
* origin is the first letter * origin is the first letter
*/ */
@ -756,6 +783,7 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
bool SCH_GLOBALLABEL::HitTest( const wxPoint& aPosRef ) bool SCH_GLOBALLABEL::HitTest( const wxPoint& aPosRef )
{ {
/************************************************/ /************************************************/
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test * @param aPosRef = a wxPoint to test
@ -807,6 +835,7 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const
bool SCH_HIERLABEL::HitTest( const wxPoint& aPosRef ) bool SCH_HIERLABEL::HitTest( const wxPoint& aPosRef )
{ {
/************************************************/ /************************************************/
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test * @param aPosRef = a wxPoint to test
@ -834,6 +863,7 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel,
int Color ) int Color )
{ {
/*****************************************************************************/ /*****************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the /* Texts type Global Label have 4 directions, and the Text origin is the
* graphic icon * graphic icon
*/ */
@ -969,6 +999,7 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel,
int Color ) int Color )
{ {
/*****************************************************************************/ /*****************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the /* Texts type Global Label have 4 directions, and the Text origin is the
* graphic icon * graphic icon
*/ */
@ -1035,6 +1066,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
// 50% more for negation bar // 50% more for negation bar
int y = wxRound( (double) HalfSize * 1.5 + (double) linewidth + 3.0 ); int y = wxRound( (double) HalfSize * 1.5 + (double) linewidth + 3.0 );
// Starting point(anchor) // Starting point(anchor)
aCorner_list.push_back( wxPoint( 0, 0 ) ); aCorner_list.push_back( wxPoint( 0, 0 ) );
aCorner_list.push_back( wxPoint( 0, -y ) ); // Up aCorner_list.push_back( wxPoint( 0, -y ) ); // Up
@ -1113,6 +1145,7 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
height = ( (m_Size.y * 15) / 10 ) + width + 2 * TXTMARGE; height = ( (m_Size.y * 15) / 10 ) + width + 2 * TXTMARGE;
// text X size add height for triangular shapes(bidirectional) // text X size add height for triangular shapes(bidirectional)
length = LenSize( m_Text ) + height + DANGLING_SYMBOL_SIZE; length = LenSize( m_Text ) + height + DANGLING_SYMBOL_SIZE;
@ -1202,6 +1235,7 @@ EDA_Rect SCH_LABEL::GetBoundingBox()
return box; return box;
} }
/***********************************/ /***********************************/
EDA_Rect SCH_TEXT::GetBoundingBox() EDA_Rect SCH_TEXT::GetBoundingBox()
/***********************************/ /***********************************/
@ -1210,6 +1244,7 @@ EDA_Rect SCH_TEXT::GetBoundingBox()
// when calculating the bounding box // when calculating the bounding box
int linewidth = int linewidth =
(m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
EXCHG( linewidth, m_Width ); // Set the real width EXCHG( linewidth, m_Width ); // Set the real width
EDA_Rect rect = GetTextBox( -1 ); EDA_Rect rect = GetTextBox( -1 );
@ -1221,8 +1256,8 @@ EDA_Rect SCH_TEXT::GetBoundingBox()
wxPoint end = rect.GetEnd(); wxPoint end = rect.GetEnd();
RotatePoint( &pos, m_Pos, m_Orient ); RotatePoint( &pos, m_Pos, m_Orient );
RotatePoint( &end, m_Pos, m_Orient ); RotatePoint( &end, m_Pos, m_Orient );
rect.SetOrigin(pos); rect.SetOrigin( pos );
rect.SetEnd(end); rect.SetEnd( end );
} }
rect.Normalize(); rect.Normalize();

View File

@ -30,7 +30,7 @@ class WinEDA_DrawPanel;
*/ */
// default name for nameless projects // default name for nameless projects
#define NAMELESS_PROJECT wxT("noname") #define NAMELESS_PROJECT wxT( "noname" )
#define NB_ITEMS 11 #define NB_ITEMS 11
@ -49,21 +49,24 @@ enum pseudokeys {
/* TODO Executable names TODO*/ /* TODO Executable names TODO*/
#ifdef __WINDOWS__ #ifdef __WINDOWS__
# define CVPCB_EXE wxT( "cvpcb.exe" ) #define CVPCB_EXE wxT( "cvpcb.exe" )
# define PCBNEW_EXE wxT( "pcbnew.exe" ) #define PCBNEW_EXE wxT( "pcbnew.exe" )
# define EESCHEMA_EXE wxT( "eeschema.exe" ) #define EESCHEMA_EXE wxT( "eeschema.exe" )
# define GERBVIEW_EXE wxT( "gerbview.exe" ) #define GERBVIEW_EXE wxT( "gerbview.exe" )
#define BITMAPCONVERTER_EXE wxT( "bitmap2component.exe" )
#else #else
# ifndef __WXMAC__ #ifndef __WXMAC__
# define CVPCB_EXE wxT( "cvpcb" ) #define CVPCB_EXE wxT( "cvpcb" )
# define PCBNEW_EXE wxT( "pcbnew" ) #define PCBNEW_EXE wxT( "pcbnew" )
# define EESCHEMA_EXE wxT( "eeschema" ) #define EESCHEMA_EXE wxT( "eeschema" )
# define GERBVIEW_EXE wxT( "gerbview" ) #define GERBVIEW_EXE wxT( "gerbview" )
#define BITMAPCONVERTER_EXE wxT( "bitmap2component" )
#else #else
# define CVPCB_EXE wxT( "cvpcb.app/Contents/MacOS/cvpcb" ) #define CVPCB_EXE wxT( "cvpcb.app/Contents/MacOS/cvpcb" )
# define PCBNEW_EXE wxT( "pcbnew.app/Contents/MacOS/pcbnew" ) #define PCBNEW_EXE wxT( "pcbnew.app/Contents/MacOS/pcbnew" )
# define EESCHEMA_EXE wxT( "eeschema.app/Contents/MacOS/eeschema" ) #define EESCHEMA_EXE wxT( "eeschema.app/Contents/MacOS/eeschema" )
# define GERBVIEW_EXE wxT( "gerbview.app/Contents/MacOS/gerbview" ) #define GERBVIEW_EXE wxT( "gerbview.app/Contents/MacOS/gerbview" )
#define BITMAPCONVERTER_EXE wxT( "bitmap2component.app/Contents/MacOS/bitmap2component" )
# endif # endif
#endif #endif

View File

@ -9,16 +9,20 @@
#include "kicad.h" #include "kicad.h"
#include "../bitmap2component/bitmap2component_16x16.xpm"
RIGHT_KM_FRAME::RIGHT_KM_FRAME( WinEDA_MainFrame* parent ) : RIGHT_KM_FRAME::RIGHT_KM_FRAME( WinEDA_MainFrame* parent ) :
wxSashLayoutWindow( parent, wxID_ANY ) wxSashLayoutWindow( parent, wxID_ANY )
{ {
#define BUTTON_HEIGHT 32
m_Parent = parent; m_Parent = parent;
m_DialogWin = NULL; m_DialogWin = NULL;
m_ButtPanel = new wxPanel( this, wxID_ANY ); m_ButtPanel = new wxPanel( this, wxID_ANY );
m_ButtonSeparation = 10; // control of command buttons position m_ButtonSeparation = 10; // control of command buttons position
m_ButtonLastPosition.x = 20; // control of command buttons position m_ButtonsListPosition.x = 20;
m_ButtonLastPosition.y = 20; // control of command buttons position m_ButtonsListPosition.y = 20 + BUTTON_HEIGHT;
m_ButtonsPanelHeight = (m_ButtonLastPosition.y * 2) + 32; m_ButtonLastPosition = m_ButtonsListPosition;
m_ButtonsPanelHeight = m_ButtonsListPosition.y + 20;
CreateCommandToolbar(); CreateCommandToolbar();
m_DialogWin = new wxTextCtrl( this, wxID_ANY, wxEmptyString, m_DialogWin = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
@ -84,6 +88,11 @@ void RIGHT_KM_FRAME::CreateCommandToolbar( void )
btn->SetToolTip( _( "GerbView (Gerber viewer)" ) ); btn->SetToolTip( _( "GerbView (Gerber viewer)" ) );
AddFastLaunch( btn ); AddFastLaunch( btn );
btn = new wxBitmapButton( parent, ID_TO_BITMAP_CONVERTER,
wxBitmap( bitmap2component_16x16_xpm ) );
btn->SetToolTip( _( "Bitmap2Component (Bitmap converter to create logos)" ) );
AddFastLaunch( btn );
} }
@ -96,6 +105,8 @@ void RIGHT_KM_FRAME::AddFastLaunch( wxBitmapButton* button )
* @param button = wxBitmapButton to add to the window * @param button = wxBitmapButton to add to the window
*/ */
{ {
button->Move( m_ButtonLastPosition ); wxPoint buttPos = m_ButtonLastPosition;
buttPos.y -= button->GetSize().GetHeight();
button->Move( buttPos );
m_ButtonLastPosition.x += button->GetSize().GetWidth() + m_ButtonSeparation; m_ButtonLastPosition.x += button->GetSize().GetWidth() + m_ButtonSeparation;
} }

View File

@ -43,6 +43,7 @@ enum id_kicad_frm {
ID_TO_EDITOR, ID_TO_EDITOR,
ID_TO_EESCHEMA, ID_TO_EESCHEMA,
ID_TO_GERBVIEW, ID_TO_GERBVIEW,
ID_TO_BITMAP_CONVERTER,
ID_BROWSE_AN_SELECT_FILE, ID_BROWSE_AN_SELECT_FILE,
ID_SELECT_PREFERED_EDITOR, ID_SELECT_PREFERED_EDITOR,
ID_SELECT_PREFERED_PDF_BROWSER_NAME, ID_SELECT_PREFERED_PDF_BROWSER_NAME,
@ -90,6 +91,7 @@ public:
void OnRunCvpcb( wxCommandEvent& event ); void OnRunCvpcb( wxCommandEvent& event );
void OnRunEeschema( wxCommandEvent& event ); void OnRunEeschema( wxCommandEvent& event );
void OnRunGerbview( wxCommandEvent& event ); void OnRunGerbview( wxCommandEvent& event );
void OnRunBitmapConverter( wxCommandEvent& event );
void OnOpenTextEditor( wxCommandEvent& event ); void OnOpenTextEditor( wxCommandEvent& event );
void OnOpenFileInTextEditor( wxCommandEvent& event ); void OnOpenFileInTextEditor( wxCommandEvent& event );
@ -144,8 +146,11 @@ private:
WinEDA_MainFrame* m_Parent; WinEDA_MainFrame* m_Parent;
int m_ButtonsPanelHeight; int m_ButtonsPanelHeight;
wxPanel* m_ButtPanel; wxPanel* m_ButtPanel;
wxPoint m_ButtonLastPosition; /* position of the last button in the window */ int m_ButtonSeparation; // button distance in pixels
int m_ButtonSeparation; /* button distance in pixels */ wxPoint m_ButtonsListPosition; /* position of the left bottom corner
* of the first bitmap button
*/
wxPoint m_ButtonLastPosition; // position of the last button in the window
public: public:
RIGHT_KM_FRAME( WinEDA_MainFrame* parent ); RIGHT_KM_FRAME( WinEDA_MainFrame* parent );

View File

@ -171,6 +171,11 @@ void WinEDA_MainFrame::OnExit( wxCommandEvent& event )
Close( true ); Close( true );
} }
void WinEDA_MainFrame::OnRunBitmapConverter( wxCommandEvent& event )
{
ExecuteFile( this, BITMAPCONVERTER_EXE, wxEmptyString );
}
void WinEDA_MainFrame::OnRunPcbNew( wxCommandEvent& event ) void WinEDA_MainFrame::OnRunPcbNew( wxCommandEvent& event )
{ {

View File

@ -55,6 +55,7 @@ BEGIN_EVENT_TABLE( WinEDA_MainFrame, WinEDA_BasicFrame )
EVT_BUTTON( ID_TO_CVPCB, WinEDA_MainFrame::OnRunCvpcb ) EVT_BUTTON( ID_TO_CVPCB, WinEDA_MainFrame::OnRunCvpcb )
EVT_BUTTON( ID_TO_EESCHEMA, WinEDA_MainFrame::OnRunEeschema ) EVT_BUTTON( ID_TO_EESCHEMA, WinEDA_MainFrame::OnRunEeschema )
EVT_BUTTON( ID_TO_GERBVIEW, WinEDA_MainFrame::OnRunGerbview ) EVT_BUTTON( ID_TO_GERBVIEW, WinEDA_MainFrame::OnRunGerbview )
EVT_BUTTON( ID_TO_BITMAP_CONVERTER, WinEDA_MainFrame::OnRunBitmapConverter )
EVT_UPDATE_UI( ID_SELECT_DEFAULT_PDF_BROWSER, EVT_UPDATE_UI( ID_SELECT_DEFAULT_PDF_BROWSER,
WinEDA_MainFrame::OnUpdateDefaultPdfBrowser ) WinEDA_MainFrame::OnUpdateDefaultPdfBrowser )

View File

@ -94,21 +94,20 @@ EDA_Rect EDGE_MODULE::GetBoundingBox()
// We must compute true coordinates from m_PolyPoints // We must compute true coordinates from m_PolyPoints
// which are relative to module position, orientation 0 // which are relative to module position, orientation 0
std::vector<wxPoint> points = m_PolyPoints; wxPoint p_end;
wxPoint p_end = m_Start;
MODULE* Module = (MODULE*) m_Parent; MODULE* Module = (MODULE*) m_Parent;
for( unsigned ii = 0; ii < points.size(); ii++ ) for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ )
{ {
wxPoint& pt = points[ii]; wxPoint pt = m_PolyPoints[ii];
if( Module ) if( Module )
{ {
RotatePoint( &pt.x, &pt.y, Module->m_Orient ); RotatePoint( &pt, Module->m_Orient );
pt += Module->m_Pos; pt += Module->m_Pos;
} }
pt += m_Start0; if( ii == 0 )
p_end = pt;
bbox.m_Pos.x = MIN( bbox.m_Pos.x, pt.x ); bbox.m_Pos.x = MIN( bbox.m_Pos.x, pt.x );
bbox.m_Pos.y = MIN( bbox.m_Pos.y, pt.y ); bbox.m_Pos.y = MIN( bbox.m_Pos.y, pt.y );
p_end.x = MAX( p_end.x, pt.x ); p_end.x = MAX( p_end.x, pt.x );
@ -121,6 +120,7 @@ EDA_Rect EDGE_MODULE::GetBoundingBox()
} }
} }
bbox.Inflate( (m_Width+1) / 2 );
return bbox; return bbox;
} }
@ -269,8 +269,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
wxPoint& pt = points[ii]; wxPoint& pt = points[ii];
RotatePoint( &pt.x, &pt.y, module->m_Orient ); RotatePoint( &pt.x, &pt.y, module->m_Orient );
pt += module->m_Pos; pt += module->m_Pos - offset;
pt += m_Start0 - offset;
} }
GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0], GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0],

View File

@ -9,17 +9,19 @@ class EDGE_MODULE : public BOARD_ITEM
{ {
public: public:
int m_Width; // 0 = line, > 0 = tracks, bus ... int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point wxPoint m_Start; // Line start point / circle and arc center
wxPoint m_End; // Line end point wxPoint m_End; // Line end point / circle and arc starting point
int m_Shape; // enum Track_Shapes int m_Shape; // enum Track_Shapes
wxPoint m_Start0; // Start point. wxPoint m_Start0; // Start point or centre, relative to module origin, orient 0.
wxPoint m_End0; // End point. wxPoint m_End0; // End point, relative to module origin, orient 0.
int m_Angle; // Arcs: angle in 0.1 degrees int m_Angle; // Arcs: angle in 0.1 degrees
std::vector<wxPoint> m_PolyPoints; // For polygons: number of points (> 2) std::vector<wxPoint> m_PolyPoints; /* For polygons: number of points (> 2)
// Coord are relative to Origin, orient 0 * Coord are relative to Origin, orient 0
* m_Start0 and m_End0 are not used for polygons
*/
public: public:
EDGE_MODULE( MODULE* parent ); EDGE_MODULE( MODULE* parent );
@ -40,6 +42,7 @@ public:
return m_Start; return m_Start;
} }
void Copy( EDGE_MODULE* source ); // copy structure void Copy( EDGE_MODULE* source ); // copy structure
/** /**
@ -95,9 +98,11 @@ public:
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "MGRAPHIC" ); return wxT( "MGRAPHIC" );
// return wxT( "EDGE" ); ? // return wxT( "EDGE" ); ?
} }
/** Function TransformShapeWithClearanceToPolygon /** Function TransformShapeWithClearanceToPolygon
* Convert the track shape to a closed polygon * Convert the track shape to a closed polygon
* Used in filling zones calculations * Used in filling zones calculations
@ -117,6 +122,7 @@ public:
double aCorrectionFactor ); double aCorrectionFactor );
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.

View File

@ -36,7 +36,7 @@ MODULE::MODULE( BOARD* parent ) :
m_ModuleStatus = 0; m_ModuleStatus = 0;
flag = 0; flag = 0;
m_CntRot90 = m_CntRot180 = 0; m_CntRot90 = m_CntRot180 = 0;
m_Surface = 0; m_Surface = 0.0;
m_Link = 0; m_Link = 0;
m_LastEdit_Time = time( NULL ); m_LastEdit_Time = time( NULL );
m_LocalClearance = 0; m_LocalClearance = 0;
@ -634,13 +634,11 @@ void MODULE::Set_Rectangle_Encadrement()
int width; int width;
int cx, cy, uxf, uyf, rayon; int cx, cy, uxf, uyf, rayon;
int xmax, ymax; int xmax, ymax;
int xmin, ymin;
/* Initial coordinates of the module has a nonzero limit value. */ /* Initial coordinates of the module has a nonzero limit value. */
m_BoundaryBox.m_Pos.x = -500; xmin = ymin = -250;
m_BoundaryBox.m_Pos.y = -500; xmax = ymax = 250;
xmax = 500;
ymax = 500;
for( EDGE_MODULE* pt_edge_mod = (EDGE_MODULE*) m_Drawings.GetFirst(); for( EDGE_MODULE* pt_edge_mod = (EDGE_MODULE*) m_Drawings.GetFirst();
pt_edge_mod; pt_edge_mod = pt_edge_mod->Next() ) pt_edge_mod; pt_edge_mod = pt_edge_mod->Next() )
@ -655,50 +653,59 @@ void MODULE::Set_Rectangle_Encadrement()
case S_ARC: case S_ARC:
case S_CIRCLE: case S_CIRCLE:
{ {
cx = pt_edge_mod->m_Start0.x; cy = pt_edge_mod->m_Start0.y; // center cx = pt_edge_mod->m_Start0.x;
cy = pt_edge_mod->m_Start0.y; // center
uxf = pt_edge_mod->m_End0.x; uyf = pt_edge_mod->m_End0.y; uxf = pt_edge_mod->m_End0.x; uyf = pt_edge_mod->m_End0.y;
rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) ); rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) );
rayon += width; rayon += width;
m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, cx - rayon ); xmin = MIN( xmin, cx - rayon );
m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y, cy - rayon ); ymin = MIN( ymin, cy - rayon );
xmax = MAX( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = MAX( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
break; break;
} }
default: case S_SEGMENT:
m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, xmin = MIN( xmin, pt_edge_mod->m_Start0.x - width );
pt_edge_mod->m_Start0.x - width ); xmin = MIN( xmin, pt_edge_mod->m_End0.x - width );
m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, ymin = MIN( ymin, pt_edge_mod->m_Start0.y - width );
pt_edge_mod->m_End0.x - width ); ymin = MIN( ymin, pt_edge_mod->m_End0.y - width );
m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y,
pt_edge_mod->m_Start0.y - width );
m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y,
pt_edge_mod->m_End0.y - width );
xmax = MAX( xmax, pt_edge_mod->m_Start0.x + width ); xmax = MAX( xmax, pt_edge_mod->m_Start0.x + width );
xmax = MAX( xmax, pt_edge_mod->m_End0.x + width ); xmax = MAX( xmax, pt_edge_mod->m_End0.x + width );
ymax = MAX( ymax, pt_edge_mod->m_Start0.y + width ); ymax = MAX( ymax, pt_edge_mod->m_Start0.y + width );
ymax = MAX( ymax, pt_edge_mod->m_End0.y + width ); ymax = MAX( ymax, pt_edge_mod->m_End0.y + width );
break; break;
case S_POLYGON:
for( unsigned ii = 0; ii < pt_edge_mod->m_PolyPoints.size(); ii++ )
{
wxPoint pt = pt_edge_mod->m_PolyPoints[ii];
xmin = MIN( xmin, (pt.x - width) );
ymin = MIN( ymin, (pt.y - width) );
xmax = MAX( xmax, (pt.x + width) );
ymax = MAX( ymax, (pt.y + width) );
}
break;
} }
} }
/* Pads: find the min and max coordinates and update the bounding /* Pads: find the min and max coordinates and update the bounding box.
* rectangle.
*/ */
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{ {
rayon = pad->m_Rayon; rayon = pad->m_Rayon;
cx = pad->m_Pos0.x; cx = pad->m_Pos0.x;
cy = pad->m_Pos0.y; cy = pad->m_Pos0.y;
m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, cx - rayon ); xmin = MIN( xmin, cx - rayon );
m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y, cy - rayon ); ymin = MIN( ymin, cy - rayon );
xmax = MAX( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = MAX( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
} }
m_BoundaryBox.SetWidth( xmax - m_BoundaryBox.m_Pos.x ); m_BoundaryBox.m_Pos.x = xmin;
m_BoundaryBox.SetHeight( ymax - m_BoundaryBox.m_Pos.y ); m_BoundaryBox.m_Pos.y = ymin;
m_BoundaryBox.SetWidth( xmax - xmin );
m_BoundaryBox.SetHeight( ymax - ymin );
} }
@ -709,75 +716,28 @@ void MODULE::Set_Rectangle_Encadrement()
*/ */
void MODULE::SetRectangleExinscrit() void MODULE::SetRectangleExinscrit()
{ {
int width; m_RealBoundaryBox.m_Pos = m_Pos;
int cx, cy, uxf, uyf, rayon; m_RealBoundaryBox.SetEnd( m_Pos );
int xmax, ymax; m_RealBoundaryBox.Inflate( 500 ); // Give a min size
m_RealBoundaryBox.m_Pos.x = xmax = m_Pos.x;
m_RealBoundaryBox.m_Pos.y = ymax = m_Pos.y;
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst();
edge; edge = edge->Next() ) edge; edge = edge->Next() )
{ {
if( edge->Type() != TYPE_EDGE_MODULE ) if( edge->Type() != TYPE_EDGE_MODULE ) // Shoud not occur
continue; continue;
width = edge->m_Width / 2; EDA_Rect rect = edge->GetBoundingBox();
m_RealBoundaryBox.Merge(rect);
switch( edge->m_Shape )
{
case S_ARC:
case S_CIRCLE:
{
cx = edge->m_Start.x;
cy = edge->m_Start.y; // center
uxf = edge->m_End.x;
uyf = edge->m_End.y;
rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) );
rayon += width;
m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x,
cx - rayon );
m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y,
cy - rayon );
xmax = MAX( xmax, cx + rayon );
ymax = MAX( ymax, cy + rayon );
break;
} }
default:
m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x,
edge->m_Start.x - width );
m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x,
edge->m_End.x - width );
m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y,
edge->m_Start.y - width );
m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y,
edge->m_End.y - width );
xmax = MAX( xmax, edge->m_Start.x + width );
xmax = MAX( xmax, edge->m_End.x + width );
ymax = MAX( ymax, edge->m_Start.y + width );
ymax = MAX( ymax, edge->m_End.y + width );
break;
}
}
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{ {
rayon = pad->m_Rayon; EDA_Rect rect = pad->GetBoundingBox();
m_RealBoundaryBox.Merge(rect);
cx = pad->m_Pos.x;
cy = pad->m_Pos.y;
m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x, cx - rayon );
m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y, cy - rayon );
xmax = MAX( xmax, cx + rayon );
ymax = MAX( ymax, cy + rayon );
} }
m_RealBoundaryBox.SetWidth( xmax - m_RealBoundaryBox.m_Pos.x ); m_Surface = ABS( (double) m_RealBoundaryBox.GetWidth()
m_RealBoundaryBox.SetHeight( ymax - m_RealBoundaryBox.m_Pos.y );
m_Surface = ABS( (float) m_RealBoundaryBox.GetWidth()
* m_RealBoundaryBox.GetHeight() ); * m_RealBoundaryBox.GetHeight() );
} }

View File

@ -67,7 +67,7 @@ public:
* (UP <->Down) */ * (UP <->Down) */
wxSize m_Ext; /* Automatic placement margin around wxSize m_Ext; /* Automatic placement margin around
* the module */ * the module */
float m_Surface; // Bounding box area double m_Surface; // Bounding box area
unsigned long m_Link; /* Temporary variable ( used in unsigned long m_Link; /* Temporary variable ( used in
* editions, ...) */ * editions, ...) */

View File

@ -341,8 +341,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_SWITCH_TRACK_POSTURE: case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
/* XXX POSTURE XXX */ /* change the position of initial segment when creating new tracks
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, true ); * switch from _/ to -\ .
*/
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, false );
g_Alternate_Track_Posture = !g_Alternate_Track_Posture; g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, false ); ShowNewTrackWhenMovingCursor( DrawPanel, &dc, false );
break; break;

View File

@ -499,7 +499,10 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case HK_SWITCH_TRACK_POSTURE: // change the position of initial segment when creating new tracks case HK_SWITCH_TRACK_POSTURE:
/* change the position of initial segment when creating new tracks
* switch from _/ to -\ .
*/
ShowNewTrackWhenMovingCursor( DrawPanel, DC, false ); ShowNewTrackWhenMovingCursor( DrawPanel, DC, false );
g_Alternate_Track_Posture = !g_Alternate_Track_Posture; g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
ShowNewTrackWhenMovingCursor( DrawPanel, DC, false ); ShowNewTrackWhenMovingCursor( DrawPanel, DC, false );