pcbnew: apply zone patch, fixed very minor bugs
This commit is contained in:
parent
8b3d5a69cf
commit
b0a527091e
|
@ -57,6 +57,10 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
|
|||
|
||||
switch( id ) // Arret eventuel de la commande de déplacement en cours
|
||||
{
|
||||
case ID_TOOLBARH_PCB_AUTOPLACE:
|
||||
case ID_TOOLBARH_PCB_AUTOROUTE:
|
||||
break;
|
||||
|
||||
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
||||
if( DrawPanel->ManageCurseur
|
||||
&& DrawPanel->ForceCloseManageCurseur )
|
||||
|
@ -71,9 +75,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
|
|||
{
|
||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||
}
|
||||
m_ID_current_state = 0;
|
||||
DisplayToolMsg( wxEmptyString );
|
||||
DrawPanel->SetCursor( wxCursor( wxCURSOR_ARROW ) );
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_ON_ZOOM_SELECT:
|
||||
case ID_PCB_USER_GRID_SETUP:
|
||||
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
||||
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
|
||||
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
|
||||
case ID_POPUP_PCB_EDIT_TEXTEPCB:
|
||||
case ID_POPUP_PCB_EDIT_MIRE:
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "pcbnew_id.h"
|
||||
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||
/********************************************************************/
|
||||
|
@ -30,7 +29,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
DrawPanel->m_AutoPAN_Request = false;
|
||||
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
|
||||
{
|
||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||
DrawPanel->m_IgnoreMouseEvents = true;
|
||||
DrawPanel->CursorOff( DC );
|
||||
|
||||
switch( DrawStruct->Type() )
|
||||
|
@ -92,7 +91,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
if( m_ID_current_state == 0 )
|
||||
{
|
||||
DisplayError( this,
|
||||
wxT( "WinEDA_PcbFrame::OnLeftClick() err: DrawType %d m_Flags != 0" ), DrawStruct->Type() );
|
||||
wxT(
|
||||
"WinEDA_PcbFrame::OnLeftClick() err: DrawType %d m_Flags != 0" ),
|
||||
DrawStruct->Type() );
|
||||
exit = true;
|
||||
}
|
||||
break;
|
||||
|
@ -100,11 +101,11 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
|
||||
DrawPanel->m_IgnoreMouseEvents = false;
|
||||
DrawPanel->CursorOn( DC );
|
||||
if ( exit ) return;
|
||||
if( exit )
|
||||
return;
|
||||
}
|
||||
|
||||
else if( !wxGetKeyState(WXK_SHIFT) && !wxGetKeyState(WXK_ALT) &&
|
||||
!wxGetKeyState(WXK_CONTROL) )
|
||||
else if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
|
||||
&& !wxGetKeyState( WXK_CONTROL ) )
|
||||
{
|
||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||
if( DrawStruct )
|
||||
|
@ -184,7 +185,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
{
|
||||
DrawStruct = Begin_DrawSegment( NULL, shape, DC );
|
||||
SetCurItem( DrawStruct );
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
}
|
||||
else if( DrawStruct
|
||||
&& (DrawStruct->Type() == TYPE_DRAWSEGMENT)
|
||||
|
@ -192,7 +193,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
{
|
||||
DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, DC );
|
||||
SetCurItem( DrawStruct );
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -209,22 +210,48 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
DrawStruct = Begin_Route( NULL, DC );
|
||||
SetCurItem( DrawStruct );
|
||||
if( DrawStruct )
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
}
|
||||
else if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
||||
{
|
||||
TRACK* track = Begin_Route( (TRACK*) DrawStruct, DC );
|
||||
if( track ) // c'est a dire si OK
|
||||
SetCurItem( DrawStruct = track );
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ID_PCB_ZONES_BUTT:
|
||||
|
||||
/* ZONE Tool is selected. Determine action for a left click:
|
||||
* this can be start a new zone or select and move an existing zone outline corner
|
||||
* if found near the mouse cursor
|
||||
*/
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
{
|
||||
if ( Begin_Zone( DC ) )
|
||||
// there is no current item, try to find something under mouse
|
||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||
bool hit_on_corner = false;
|
||||
if( DrawStruct && (DrawStruct->Type() == TYPE_ZONE_CONTAINER) )
|
||||
{
|
||||
// We have a hit under mouse (a zone outline corner or segment)
|
||||
// test for a corner only because want to move corners only.
|
||||
ZONE_CONTAINER* edge_zone = (ZONE_CONTAINER*) DrawStruct;
|
||||
if( edge_zone->HitTestForCorner( GetScreen()->RefPos( true ) ) >= 0 ) // corner located!
|
||||
hit_on_corner = true;
|
||||
}
|
||||
if( hit_on_corner )
|
||||
{
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
Start_Move_Zone_Corner( DC,
|
||||
zone_cont,
|
||||
zone_cont->m_CornerSelection,
|
||||
false );
|
||||
}
|
||||
else if( Begin_Zone( DC ) )
|
||||
{
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
DrawStruct = GetBoard()->m_CurrentZoneContour;
|
||||
|
@ -234,14 +261,14 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
else if( DrawStruct
|
||||
&& (DrawStruct->Type() == TYPE_ZONE_CONTAINER)
|
||||
&& (DrawStruct->m_Flags & IS_NEW) )
|
||||
{
|
||||
{ // Add a new corner to the current outline beeing created:
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
Begin_Zone( DC );
|
||||
DrawStruct = GetBoard()->m_CurrentZoneContour;
|
||||
GetScreen()->SetCurItem( DrawStruct );
|
||||
}
|
||||
else
|
||||
DisplayError( this, wxT( "Edit: zone internal error" ) );
|
||||
DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() zone internal error" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_ADD_TEXT_BUTT:
|
||||
|
@ -249,7 +276,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
{
|
||||
SetCurItem( Create_Texte_Pcb( DC ) );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
}
|
||||
else if( DrawStruct->Type() == TYPE_TEXTE )
|
||||
{
|
||||
|
@ -288,7 +315,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
{
|
||||
DrawStruct = Begin_Cotation( NULL, DC );
|
||||
SetCurItem( DrawStruct );
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
}
|
||||
else if( DrawStruct
|
||||
&& (DrawStruct->Type() == TYPE_COTATION)
|
||||
|
@ -296,7 +323,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
{
|
||||
DrawStruct = Begin_Cotation( (COTATION*) DrawStruct, DC );
|
||||
SetCurItem( DrawStruct );
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
}
|
||||
else
|
||||
DisplayError( this, wxT( "Internal err: Struct not COTATION" ) );
|
||||
|
|
Loading…
Reference in New Issue