Commit f406e9d9 authored by dickelbeck's avatar dickelbeck

drc dialog fixes

parent 6bd9b7fc
......@@ -9,9 +9,12 @@ email address.
2008-Feb-22 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
specctra_export.cpp: added DSN 'outline' support from EDGE_MODULEs.
* specctra_export.cpp: added DSN 'outline' support from EDGE_MODULEs.
lines and circles, not arcs.
factored out EDGE_MODULE::ShowShape() from EDGE_MODULE::Show().
* factored out EDGE_MODULE::ShowShape() from EDGE_MODULE::Show().
* drc.cpp changed AsSecondItem to HasSecondItem and test it in generating
the file report and when making the popup menu in the dialog_drc and
when generating the html list item.
2008-Feb-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
......
......@@ -44,7 +44,7 @@ void MARKER::init()
m_Type = 0;
m_Color = RED;
m_Bitmap = Default_MarkerBitmap;
m_Size.x = Default_MarkerBitmap[0];
m_Size.x = Default_MarkerBitmap[0];
m_Size.y = Default_MarkerBitmap[1];
}
......@@ -56,25 +56,25 @@ MARKER::MARKER( BOARD_ITEM* StructFather ) :
}
MARKER::MARKER( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
MARKER::MARKER( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
const wxString& bText, const wxPoint& bPos ) :
BOARD_ITEM( NULL, TYPEMARKER ) // parent set during BOARD::Add()
{
init();
SetData( aErrorCode, aMarkerPos,
SetData( aErrorCode, aMarkerPos,
aText, aPos,
bText, bPos );
}
MARKER::MARKER( int aErrorCode, const wxPoint& aMarkerPos,
MARKER::MARKER( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos ) :
BOARD_ITEM( NULL, TYPEMARKER ) // parent set during BOARD::Add()
{
init();
SetData( aErrorCode, aMarkerPos,
SetData( aErrorCode, aMarkerPos,
aText, aPos );
}
......@@ -88,25 +88,25 @@ MARKER::~MARKER()
}
void MARKER::SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
void MARKER::SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
const wxString& bText, const wxPoint& bPos )
{
m_drc.SetData( aErrorCode, aMarkerPos,
m_drc.SetData( aErrorCode, aMarkerPos,
aText, bText,
aPos, bPos );
// @todo: switch on error code to set error code specific color, and possibly bitmap.
m_Color = WHITE;
}
void MARKER::SetData( int aErrorCode, const wxPoint& aMarkerPos,
void MARKER::SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos )
{
m_drc.SetData( aErrorCode, aMarkerPos,
m_drc.SetData( aErrorCode, aMarkerPos,
aText, aPos );
// @todo: switch on error code to set error code specific color, and possibly bitmap.
m_Color = WHITE;
}
......@@ -128,24 +128,24 @@ void MARKER::Display_Infos( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox();
const DRC_ITEM& rpt = m_drc;
text_pos = 1;
Affiche_1_Parametre( frame, text_pos, _( "Type" ), _("Marker"), DARKCYAN );
wxString errorTxt;
errorTxt << _("ErrType") << wxT("(") << rpt.GetErrorCode() << wxT(")- ") << rpt.GetErrorText() << wxT(":");
text_pos = 5;
Affiche_1_Parametre( frame, text_pos, errorTxt, wxEmptyString, RED );
wxString txtA;
txtA << DRC_ITEM::ShowCoord( rpt.GetPointA() ) << wxT(": ") << rpt.GetTextA();
wxString txtB;
if ( rpt.AsSecondItem() )
txtB << DRC_ITEM::ShowCoord( rpt.GetPointB() ) << wxT(": ") << rpt.GetTextB();
if ( rpt.HasSecondItem() )
txtB << DRC_ITEM::ShowCoord( rpt.GetPointB() ) << wxT(": ") << rpt.GetTextB();
text_pos = 25;
Affiche_1_Parametre( frame, text_pos, txtA, txtB, DARKBROWN );
}
......@@ -157,23 +157,23 @@ bool MARKER::HitTest( const wxPoint& refPos )
{
// the MARKER is 12 pixels by 12 pixels, but is not resized with zoom, so
// as zoom changes, the effective real size (in user units) of the MARKER changes.
wxSize TrueSize = m_Size;
if ( ActiveScreen )
{
TrueSize.x *= ActiveScreen->GetZoom();
TrueSize.y *= ActiveScreen->GetZoom();
}
if ( ActiveScreen )
{
TrueSize.x *= ActiveScreen->GetZoom();
TrueSize.y *= ActiveScreen->GetZoom();
}
wxPoint pos = GetPosition();
int dx = refPos.x - pos.x;
int dy = refPos.y - pos.y;
/* is refPos in the box: Marker size to right an bottom,
or size/2 to left or top */
/* is refPos in the box: Marker size to right an bottom,
or size/2 to left or top */
if( dx <= TrueSize.x && dy <= TrueSize.y &&
dx >= -TrueSize.x/2 && dy >= -TrueSize.y/2 )
dx >= -TrueSize.x/2 && dy >= -TrueSize.y/2 )
return true;
else
return false;
......@@ -201,11 +201,11 @@ void MARKER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode )
GRSetDrawMode( DC, DrawMode );
px = GRMapX( GetPosition().x );
px = GRMapX( GetPosition().x );
py = GRMapY( GetPosition().y );
/* Get the bitmap size */
m_Size.x = *(pt_bitmap++);
m_Size.x = *(pt_bitmap++);
m_Size.y = *(pt_bitmap++);
/* Draw the bitmap */
......
......@@ -43,7 +43,7 @@
/**
* Class DRC_LIST_MARKERS
* is an implementation of the interface named DRC_ITEM_LIST which uses
* a BOARD instance to fulfill the interface. No ownership is taken of the
* a BOARD instance to fulfill the interface. No ownership is taken of the
* BOARD.
*/
class DRC_LIST_MARKERS : public DRC_ITEM_LIST
......@@ -61,15 +61,15 @@ public:
~DRC_LIST_MARKERS() {}
*/
//-----<Interface DRC_ITEM_LIST>---------------------------------------
void DeleteAllItems()
{
m_board->DeleteMARKERs();
}
const DRC_ITEM* GetItem( int aIndex )
{
const MARKER* marker = m_board->GetMARKER( aIndex );
......@@ -83,7 +83,7 @@ public:
m_board->DeleteMARKER( aIndex );
}
/**
* Function GetCount
* returns the number of items in the list.
......@@ -92,7 +92,7 @@ public:
{
return m_board->GetMARKERCount();
}
//-----</Interface DRC_ITEM_LIST>--------------------------------------
};
......@@ -101,7 +101,7 @@ public:
/**
* Class DRC_LIST_UNCONNECTED
* is an implementation of the interface named DRC_ITEM_LIST which uses
* a vector of pointers to DRC_ITEMs to fulfill the interface. No ownership is taken of the
* a vector of pointers to DRC_ITEMs to fulfill the interface. No ownership is taken of the
* vector, which will reside in class DRC
*/
class DRC_LIST_UNCONNECTED : public DRC_ITEM_LIST
......@@ -119,21 +119,21 @@ public:
~DRC_LIST_UNCONNECTED() {}
*/
//-----<Interface DRC_ITEM_LIST>---------------------------------------
void DeleteAllItems()
{
if( m_vector )
{
for( unsigned i=0; i<m_vector->size(); ++i )
delete (*m_vector)[i];
m_vector->clear();
}
}
const DRC_ITEM* GetItem( int aIndex )
{
if( m_vector && (unsigned)aIndex < m_vector->size() )
......@@ -153,7 +153,7 @@ public:
}
}
/**
* Function GetCount
* returns the number of items in the list.
......@@ -166,7 +166,7 @@ public:
}
return 0;
}
//-----</Interface DRC_ITEM_LIST>--------------------------------------
};
......@@ -176,7 +176,7 @@ public:
/**
* Class DRCLISTBOX
* is used to display a DRC_ITEM_LIST.
*/
*/
class DRCLISTBOX : public wxHtmlListBox
{
private:
......@@ -191,16 +191,16 @@ public:
m_list = 0;
}
~DRCLISTBOX()
{
delete m_list; // I own it, I destroy it.
}
/**
* Function SetList
* sets the DRC_ITEM_LIST for this listbox. Ownership of the DRC_ITEM_LIST is
* sets the DRC_ITEM_LIST for this listbox. Ownership of the DRC_ITEM_LIST is
* transfered to this DRCLISTBOX.
* @param aList The DRC_ITEM_LIST* containing the DRC_ITEMs which will be
* displayed in the wxHtmlListBox
......@@ -208,7 +208,7 @@ public:
void SetList( DRC_ITEM_LIST* aList )
{
delete m_list;
m_list = aList;
SetItemCount( aList->GetCount() );
Refresh();
......@@ -227,8 +227,8 @@ public:
}
return NULL;
}
/**
* Function OnGetItem
* returns the html text associated with the DRC_ITEM given by index 'n'.
......@@ -257,8 +257,8 @@ public:
{
return OnGetItem( n );
}
/**
* Function DeleteElement
* will delete one of the items in the list.
......@@ -268,20 +268,20 @@ public:
{
if( m_list )
{
int selection = GetSelection();
int selection = GetSelection();
m_list->DeleteItem( aIndex );
int count = m_list->GetCount();
SetItemCount( count );
// if old selection >= new count
// if old selection >= new count
if( selection >= count )
SetSelection( count-1 ); // -1 is "no selection"
Refresh();
}
}
/**
* Function DeleteAllItems
* deletes all items in the list.
......@@ -342,7 +342,7 @@ BEGIN_EVENT_TABLE( DrcDialog, wxDialog )
EVT_MENU( ID_POPUP_UNCONNECTED_B, DrcDialog::OnPopupMenu )
EVT_MENU( ID_POPUP_MARKERS_A, DrcDialog::OnPopupMenu )
EVT_MENU( ID_POPUP_MARKERS_B, DrcDialog::OnPopupMenu )
END_EVENT_TABLE()
/*!
......@@ -353,7 +353,7 @@ DrcDialog::DrcDialog( )
{
}
DrcDialog::DrcDialog( DRC* aTester, WinEDA_PcbFrame* parent,
DrcDialog::DrcDialog( DRC* aTester, WinEDA_PcbFrame* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
......@@ -361,7 +361,7 @@ DrcDialog::DrcDialog( DRC* aTester, WinEDA_PcbFrame* parent,
long style )
{
m_tester = aTester;
m_Parent = parent;
Create(parent, id, caption, pos, size, style);
......@@ -609,7 +609,7 @@ wxIcon DrcDialog::GetIconResource( const wxString& name )
void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
{
wxString reportName;
if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt
{
reportName = m_RptFilenameCtrl->GetValue();
......@@ -625,16 +625,16 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
g_DesignSettings.m_TrackClearence =
ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits );
m_tester->SetSettings( m_Pad2PadTestCtrl->IsChecked(),
m_UnconnectedTestCtrl->IsChecked(),
m_UnconnectedTestCtrl->IsChecked(),
m_ZonesTestCtrl->IsChecked(),
reportName, m_CreateRptCtrl->IsChecked() );
DelDRCMarkers();
wxBeginBusyCursor();
// run all the tests, with no UI at this time.
m_tester->RunTests();
......@@ -643,30 +643,30 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
#else
m_Notebook->SetSelection(0); // display the 1at tab "... Markers..."
#endif
// Generate the report
// Generate the report
if( !reportName.IsEmpty() )
{
FILE* fp = wxFopen( reportName, wxT( "w" ) );
writeReport( fp );
fclose(fp);
wxString msg;
msg.Printf( _( "Report file \"%s\" created" ), reportName.GetData() );
wxString caption( _("Disk File Report Completed") );
wxMessageDialog popupWindow( this, msg, caption );
popupWindow.ShowModal();
}
wxEndBusyCursor();
RedrawDrawPanel();
}
......@@ -689,7 +689,7 @@ void DrcDialog::OnDeleteAllClick( wxCommandEvent& event )
void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event )
{
wxString reportName;
if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt
{
reportName = m_RptFilenameCtrl->GetValue();
......@@ -705,16 +705,16 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event )
g_DesignSettings.m_TrackClearence =
ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits );
m_tester->SetSettings( m_Pad2PadTestCtrl->IsChecked(),
m_UnconnectedTestCtrl->IsChecked(),
m_UnconnectedTestCtrl->IsChecked(),
m_ZonesTestCtrl->IsChecked(),
reportName, m_CreateRptCtrl->IsChecked() );
DelDRCMarkers();
DelDRCMarkers();
wxBeginBusyCursor();
m_tester->ListUnconnectedPads();
#if wxCHECK_VERSION( 2, 8, 0 )
......@@ -722,30 +722,30 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event )
#else
m_Notebook->SetSelection(1); // display the 2nd tab "Unconnected..."
#endif
// Generate the report
// Generate the report
if( !reportName.IsEmpty() )
{
FILE* fp = wxFopen( reportName, wxT( "w" ) );
writeReport( fp );
fclose(fp);
wxString msg;
msg.Printf( _( "Report file \"%s\" created" ), reportName.GetData() );
wxString caption( _("Disk File Report Completed") );
wxMessageDialog popupWindow( this, msg, caption );
popupWindow.ShowModal();
}
wxEndBusyCursor();
/* there is currently nothing visible on the DrawPanel for unconnected pads
/* there is currently nothing visible on the DrawPanel for unconnected pads
RedrawDrawPanel();
*/
}
......@@ -837,14 +837,14 @@ void DrcDialog::OnReportCheckBoxClicked( wxCommandEvent& event )
void DrcDialog::OnInitDialog( wxInitDialogEvent& event )
{
wxCommandEvent junk;
// Set the initial "enabled" status of the browse button and the text
// field for report name
// Set the initial "enabled" status of the browse button and the text
// field for report name
OnReportCheckBoxClicked( junk );
m_SetClearance->SetFocus();
// deselect the existing text, seems SetFocus() wants to emulate
// deselect the existing text, seems SetFocus() wants to emulate
// Microsoft and select all text, which is not desireable here.
m_SetClearance->SetSelection(0,0);
......@@ -861,7 +861,7 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )
event.Skip();
// I am assuming that the double click actually changed the selected item.
// please verify this.
// please verify this.
int selection = m_ClearanceListBox->GetSelection();
if( selection != wxNOT_FOUND )
......@@ -873,16 +873,16 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )
{
/*
// after the goto, process a button OK command later.
wxCommandEvent cmd( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK );
wxCommandEvent cmd( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK );
::wxPostEvent( GetEventHandler(), cmd );
*/
m_Parent->CursorGoto( item->GetPosition() );
// turn control over to m_Parent, hide this DrcDialog window,
// turn control over to m_Parent, hide this DrcDialog window,
// no destruction so we can preserve listbox cursor
Hide();
Hide();
event.StopPropagation(); // still get the popup window.
}
}
......@@ -892,11 +892,11 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )
void DrcDialog::OnPopupMenu( wxCommandEvent& event )
{
int source = event.GetId();
const DRC_ITEM* item = 0;
wxPoint pos;
int selection;
int selection;
switch( source )
{
......@@ -940,20 +940,23 @@ void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event )
event.Skip();
// popup menu to go to either of the items listed in the DRC_ITEM.
int selection = m_UnconnectedListBox->GetSelection();
if( selection != wxNOT_FOUND )
{
wxMenu menu;
wxMenuItem* mItem;
const DRC_ITEM* dItem = m_UnconnectedListBox->GetItem( selection );
mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_A, dItem->GetTextA() );
menu.Append( mItem );
mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_B, dItem->GetTextB() );
menu.Append( mItem );
if( dItem->HasSecondItem() )
{
mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_B, dItem->GetTextB() );
menu.Append( mItem );
}
PopupMenu( &menu );
}
......@@ -969,20 +972,23 @@ void DrcDialog::OnRightUpClearance( wxMouseEvent& event )
event.Skip();
// popup menu to go to either of the items listed in the DRC_ITEM.
int selection = m_ClearanceListBox->GetSelection();
if( selection != wxNOT_FOUND )
{
wxMenu menu;
wxMenuItem* mItem;
const DRC_ITEM* dItem = m_ClearanceListBox->GetItem( selection );
mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_A, dItem->GetTextA() );
menu.Append( mItem );
mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_B, dItem->GetTextB() );
menu.Append( mItem );
if( dItem->HasSecondItem() )
{
mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_B, dItem->GetTextB() );
menu.Append( mItem );
}
PopupMenu( &menu );
}
......@@ -998,23 +1004,23 @@ void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event )
event.Skip();
// I am assuming that the double click actually changed the selected item.
// please verify this.
// please verify this.
int selection = m_UnconnectedListBox->GetSelection();
if( selection != wxNOT_FOUND )
{
// Find the selected DRC_ITEM in the listbox, position cursor there,
// Find the selected DRC_ITEM in the listbox, position cursor there,
// at the first of the two pads.
// Then hide the dialog.
const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
if( item )
{
m_Parent->CursorGoto( item->GetPosition() );
Hide();
// intermittently, still get the popup window, even with this.
event.StopPropagation();
event.StopPropagation();
}
}
}
......@@ -1023,26 +1029,26 @@ void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event )
void DrcDialog::OnMarkerSelectionEvent( wxCommandEvent& event )
{
int selection = event.GetSelection();
if( selection != wxNOT_FOUND )
{
// until a MARKER is selected, this button is not enabled.
m_DeleteCurrentMarkerButton->Enable(true);
}
event.Skip();
}
void DrcDialog::OnUnconnectedSelectionEvent( wxCommandEvent& event )
{
int selection = event.GetSelection();
if( selection != wxNOT_FOUND )
{
// until a MARKER is selected, this button is not enabled.
m_DeleteCurrentMarkerButton->Enable(true);
}
event.Skip();
}
......@@ -1070,23 +1076,23 @@ void DrcDialog::writeReport( FILE* fp )
CONV_TO_UTF8( m_Parent->GetScreen()->m_FileName ) );
wxDateTime now = wxDateTime::Now();
fprintf( fp, "** Created on %s **\n", CONV_TO_UTF8(now.Format( wxT("%F %T"))) );
fprintf( fp, "** Created on %s **\n", CONV_TO_UTF8(now.Format( wxT("%F %T"))) );
count = m_ClearanceListBox->GetItemCount();
fprintf( fp, "\n** Found %d DRC errors **\n", count );
for( int i=0; i<count; ++i )
fprintf( fp, m_ClearanceListBox->GetItem(i)->ShowReport().mb_str() );
count = m_UnconnectedListBox->GetItemCount();
fprintf( fp, "\n** Found %d unconnected pads **\n", count );
for( int i=0; i<count; ++i )
fprintf( fp, m_UnconnectedListBox->GetItem(i)->ShowReport().mb_str() );
fprintf( fp, "\n** End of Report **\n" );
}
......@@ -1106,25 +1112,25 @@ void DrcDialog::OnDeleteOneClick( wxCommandEvent& event )
if( selectedIndex != wxNOT_FOUND )
{
m_ClearanceListBox->DeleteItem( selectedIndex );
// redraw the pcb
RedrawDrawPanel();
}
}
else if( curTab == 1 )
{
selectedIndex = m_UnconnectedListBox->GetSelection();
if( selectedIndex != wxNOT_FOUND )
{
m_UnconnectedListBox->DeleteItem( selectedIndex );
/* these unconnected DRC_ITEMs are not currently visible on the pcb
/* these unconnected DRC_ITEMs are not currently visible on the pcb
RedrawDrawPanel();
*/
}
}
// event.Skip();
}
......@@ -510,11 +510,16 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
// This test seems necessary since the dialog box that displays the
// desired via hole size and width does not enforce a hole size smaller
// than the via's diameter.
if( !aRefSeg->GetDrillValue() > aRefSeg->m_Width )
if( aRefSeg->GetDrillValue() > aRefSeg->m_Width )
{
#if 0 // a temporary way to fix a bad board here, change for your values
if( aRefSeg->GetDrillValue()==120 && aRefSeg->m_Width==100 )
aRefSeg->m_Width = 180;
#else
m_currentMarker = fillMarker( aRefSeg, NULL,
DRCE_VIA_HOLE_BIGGER, m_currentMarker );
return false;
#endif
}
// For microvias: test if they are blindvias and only between 2 layers
......
......@@ -26,23 +26,23 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
*/
{
BOARD_ITEM* DrawStruct = GetCurItem();
bool exit = false;
bool exit = false;
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{
DrawPanel->m_AutoPAN_Request = FALSE;
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
{
DrawPanel->m_IgnoreMouseEvents = TRUE;
DrawPanel->CursorOff( DC );
DrawPanel->m_IgnoreMouseEvents = TRUE;
DrawPanel->CursorOff( DC );
switch( DrawStruct->Type() )
{
case TYPEZONE_CONTAINER:
if ( (DrawStruct->m_Flags & IS_NEW) )
Begin_Zone( DC );
if ( (DrawStruct->m_Flags & IS_NEW) )
Begin_Zone( DC );
else
End_Move_Zone_Corner_Or_Outlines( DC, (ZONE_CONTAINER *) DrawStruct );
End_Move_Zone_Corner_Or_Outlines( DC, (ZONE_CONTAINER *) DrawStruct );
exit = true;
break;
......@@ -95,23 +95,23 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
wxT( "WinEDA_PcbFrame::OnLeftClick() err: DrawType %d m_Flags != 0" ), DrawStruct->Type() );
exit = true;
}
break;
break;
}
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->CursorOn( DC );
if ( exit ) return;
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->CursorOn( DC );
if ( exit ) return;
}
else if( !wxGetKeyState(WXK_SHIFT) && !wxGetKeyState(WXK_ALT) &&
!wxGetKeyState(WXK_CONTROL) )
{
DrawStruct = PcbGeneralLocateAndDisplay();
if( DrawStruct )
SendMessageToEESCHEMA( DrawStruct );
}
}
}
switch( m_ID_current_state )
{
case ID_MAIN_MENUBAR:
......@@ -130,19 +130,19 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_PCB_HIGHLIGHT_BUTT:
{
int netcode = Select_High_Light( DC );
if( netcode < 0 )
m_Pcb->Display_Infos( this );
else
Affiche_Infos_Equipot( netcode, this );
}
{
int netcode = Select_High_Light( DC );
if( netcode < 0 )
m_Pcb->Display_Infos( this );
else
Affiche_Infos_Equipot( netcode, this );
}
break;
case ID_PCB_SHOW_1_RATSNEST_BUTT:
DrawStruct = PcbGeneralLocateAndDisplay();
Show_1_Ratsnest( DrawStruct, DC );
if( DrawStruct )
SendMessageToEESCHEMA( DrawStruct );
break;
......@@ -171,14 +171,14 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( m_ID_current_state == ID_PCB_ARC_BUTT )
shape = S_ARC;
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer <= LAST_COPPER_LAYER )
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer <= LAST_COPPER_LAYER )
{
DisplayError( this, _( "Graphic not authorized on Copper layers" ) );
break;
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = Begin_DrawSegment( NULL, shape, DC );
DrawStruct = Begin_DrawSegment( NULL, shape, DC );
SetCurItem( DrawStruct );
DrawPanel->m_AutoPAN_Request = TRUE;
}
......@@ -194,7 +194,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
case ID_TRACK_BUTT:
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer > LAST_COPPER_LAYER )
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer > LAST_COPPER_LAYER )
{
DisplayError( this, _( "Tracks on Copper layers only " ) );
break;
......@@ -223,18 +223,18 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_PCB_ZONES_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
if ( Begin_Zone( DC ) )
{
DrawStruct = m_Pcb->m_CurrentZoneContour;
GetScreen()->SetCurItem( DrawStruct );
}
if ( Begin_Zone( DC ) )
{
DrawStruct = m_Pcb->m_CurrentZoneContour;
GetScreen()->SetCurItem( DrawStruct );
}
}
else if( DrawStruct
&& (DrawStruct->Type() == TYPEZONE_CONTAINER)
&& (DrawStruct->m_Flags & IS_NEW) )
{
Begin_Zone( DC );
DrawStruct = m_Pcb->m_CurrentZoneContour;
Begin_Zone( DC );
DrawStruct = m_Pcb->m_CurrentZoneContour;
GetScreen()->SetCurItem( DrawStruct );
}
else
......@@ -261,7 +261,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawPanel->MouseToCursorSchema();
DrawStruct = Load_Module_From_Library( wxEmptyString, DC );
DrawStruct = Load_Module_From_Library( wxEmptyString, DC );
SetCurItem( DrawStruct );
if( DrawStruct )
StartMove_Module( (MODULE*) DrawStruct, DC );
......@@ -276,7 +276,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_PCB_COTATION_BUTT:
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer <= LAST_COPPER_LAYER )
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer <= LAST_COPPER_LAYER )
{
DisplayError( this, _( "Cotation not authorized on Copper layers" ) );
break;
......@@ -291,7 +291,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
&& (DrawStruct->Type() == TYPECOTATION)
&& (DrawStruct->m_Flags & IS_NEW) )
{
DrawStruct = Begin_Cotation( (COTATION*) DrawStruct, DC );
DrawStruct = Begin_Cotation( (COTATION*) DrawStruct, DC );
SetCurItem( DrawStruct );
DrawPanel->m_AutoPAN_Request = TRUE;
}
......@@ -331,7 +331,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/********************************************************************************/
/* handle the double click on the mouse left button
/* handle the double click on the mouse left button
*/
{
BOARD_ITEM* DrawStruct = GetCurItem();
......@@ -416,10 +416,10 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case ID_PCB_ZONES_BUTT:
if ( End_Zone( DC ) )
{
DrawPanel->m_AutoPAN_Request = FALSE;
SetCurItem( NULL );
}
{
DrawPanel->m_AutoPAN_Request = FALSE;
SetCurItem( NULL );
}
break;
case ID_LINE_COMMENT_BUTT:
......
......@@ -53,7 +53,10 @@ void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
List->Append( Line );
}
ii = List->ShowModal(); List->Destroy();
ii = List->ShowModal();
List->Destroy();
if( ii < 0 )
return;
......@@ -64,6 +67,7 @@ void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
/* calcul adr relative du nom de la pastille reference de la piste */
if( !WildCompareString( msg, Equipot->m_Netname, FALSE ) )
continue;
if( ii == jj )
{
ii = Equipot->GetNet();
......@@ -78,6 +82,7 @@ void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
if( g_HightLigt_Status )
Hight_Light( &dc );
g_HightLigth_NetCode = ii;
Hight_Light( &dc );
}
......@@ -95,7 +100,7 @@ int WinEDA_PcbFrame::Select_High_Light( wxDC* DC )
// use this scheme because of pad is higher priority than tracks in the
// search, and finding a pad, instead of a track on a pad,
// allows us to fire a message to eescema.
// allows us to fire a message to eeschema.
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
......@@ -168,20 +173,16 @@ void WinEDA_PcbFrame::DrawHightLight( wxDC* DC, int NetCode )
else
draw_mode = GR_AND | GR_SURBRILL;
/* Redraw pads */
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
#if 0 // does not unhighlight properly
// redraw the zones with the NetCode
for( SEGZONE* zone = m_Pcb->m_Zone; zone; zone = zone->Next() )
{
Pad_Surbrillance( DrawPanel, DC, module, NetCode );
}
/* Redraw track and vias: */
for( TRACK* pts = m_Pcb->m_Track; pts; pts = pts->Next() )
{
if( pts->GetNet() == NetCode )
if( zone->GetNet() == NetCode )
{
pts->Draw( DrawPanel, DC, draw_mode );
zone->Draw( DrawPanel, DC, draw_mode );
}
}
#endif
wxPoint zero(0,0); // construct outside loop for speed
......@@ -194,6 +195,21 @@ void WinEDA_PcbFrame::DrawHightLight( wxDC* DC, int NetCode )
(*zc)->Draw( DrawPanel, DC, zero, draw_mode );
}
}
/* Redraw pads */
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
Pad_Surbrillance( DrawPanel, DC, module, NetCode );
}
/* Redraw track and vias: */
for( TRACK* pts = m_Pcb->m_Track; pts; pts = pts->Next() )
{
if( pts->GetNet() == NetCode )
{
pts->Draw( DrawPanel, DC, draw_mode );
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment