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 */
......
This diff is collapsed.
......@@ -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