2007-09-29 15:30:16 +00:00
|
|
|
/**************************************************************/
|
|
|
|
/* onleftclick.cpp: */
|
|
|
|
/* function called when the left button is clicked (released) */
|
|
|
|
/* function called when the left button is double clicked */
|
|
|
|
/**************************************************************/
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
2007-09-29 15:30:16 +00:00
|
|
|
#include "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2007-09-29 15:30:16 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "pcbnew_id.h"
|
2007-09-29 15:30:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|
|
|
/********************************************************************/
|
|
|
|
|
|
|
|
/* Handle the left buttom mouse click, when a tool is active
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
2009-09-28 12:21:54 +00:00
|
|
|
bool exit = false;
|
2007-09-29 15:30:16 +00:00
|
|
|
|
|
|
|
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
|
|
|
|
{
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2009-10-26 19:00:46 +00:00
|
|
|
|
2007-09-29 15:30:16 +00:00
|
|
|
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
|
|
|
|
{
|
2009-09-28 12:21:54 +00:00
|
|
|
DrawPanel->m_IgnoreMouseEvents = true;
|
2008-02-23 04:53:44 +00:00
|
|
|
DrawPanel->CursorOff( DC );
|
2007-09-29 15:30:16 +00:00
|
|
|
|
|
|
|
switch( DrawStruct->Type() )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_ZONE_CONTAINER:
|
2009-09-28 12:21:54 +00:00
|
|
|
if( (DrawStruct->m_Flags & IS_NEW) )
|
2009-01-09 19:09:13 +00:00
|
|
|
{
|
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2008-02-23 04:53:44 +00:00
|
|
|
Begin_Zone( DC );
|
2009-01-09 19:09:13 +00:00
|
|
|
}
|
2008-01-31 20:53:44 +00:00
|
|
|
else
|
2009-09-28 12:21:54 +00:00
|
|
|
End_Move_Zone_Corner_Or_Outlines( DC, (ZONE_CONTAINER*) DrawStruct );
|
2007-12-29 19:15:58 +00:00
|
|
|
exit = true;
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TRACK:
|
|
|
|
case TYPE_VIA:
|
2007-09-29 15:30:16 +00:00
|
|
|
if( DrawStruct->m_Flags & IS_DRAGGED )
|
|
|
|
{
|
2009-08-08 06:07:08 +00:00
|
|
|
PlaceDraggedOrMovedTrackSegment( (TRACK*) DrawStruct, DC );
|
2007-09-29 15:30:16 +00:00
|
|
|
exit = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE:
|
2007-09-29 15:30:16 +00:00
|
|
|
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
|
|
|
|
exit = true;
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
2007-09-29 15:30:16 +00:00
|
|
|
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC );
|
|
|
|
exit = true;
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_PAD:
|
2007-09-29 15:30:16 +00:00
|
|
|
PlacePad( (D_PAD*) DrawStruct, DC );
|
|
|
|
exit = true;
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MODULE:
|
2007-09-29 15:30:16 +00:00
|
|
|
Place_Module( (MODULE*) DrawStruct, DC );
|
|
|
|
exit = true;
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MIRE:
|
2007-09-29 15:30:16 +00:00
|
|
|
Place_Mire( (MIREPCB*) DrawStruct, DC );
|
|
|
|
exit = true;
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_DRAWSEGMENT:
|
2007-09-29 15:30:16 +00:00
|
|
|
if( m_ID_current_state == 0 )
|
|
|
|
{
|
|
|
|
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, DC );
|
|
|
|
exit = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
case TYPE_DIMENSION:
|
2010-04-22 17:47:10 +00:00
|
|
|
// see above.
|
|
|
|
break;
|
|
|
|
|
2007-09-29 15:30:16 +00:00
|
|
|
default:
|
|
|
|
if( m_ID_current_state == 0 )
|
|
|
|
{
|
|
|
|
DisplayError( this,
|
2009-09-28 12:21:54 +00:00
|
|
|
wxT(
|
|
|
|
"WinEDA_PcbFrame::OnLeftClick() err: DrawType %d m_Flags != 0" ),
|
|
|
|
DrawStruct->Type() );
|
2007-09-29 15:30:16 +00:00
|
|
|
exit = true;
|
|
|
|
}
|
2008-02-23 04:53:44 +00:00
|
|
|
break;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_IgnoreMouseEvents = false;
|
2008-02-23 04:53:44 +00:00
|
|
|
DrawPanel->CursorOn( DC );
|
2009-09-28 12:21:54 +00:00
|
|
|
if( exit )
|
|
|
|
return;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
2009-09-28 12:21:54 +00:00
|
|
|
else if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
|
|
|
|
&& !wxGetKeyState( WXK_CONTROL ) )
|
2007-09-29 15:30:16 +00:00
|
|
|
{
|
|
|
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
|
|
|
if( DrawStruct )
|
|
|
|
SendMessageToEESCHEMA( DrawStruct );
|
2008-02-23 04:53:44 +00:00
|
|
|
}
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
if( DrawStruct ) // display netclass info for zones, tracks and pads
|
|
|
|
{
|
|
|
|
switch( DrawStruct->Type() )
|
|
|
|
{
|
|
|
|
case TYPE_ZONE_CONTAINER:
|
|
|
|
case TYPE_TRACK:
|
|
|
|
case TYPE_VIA:
|
|
|
|
case TYPE_PAD:
|
|
|
|
GetBoard()->SetCurrentNetClass(
|
|
|
|
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
|
|
|
|
m_TrackAndViasSizesList_Changed = true;
|
|
|
|
AuxiliaryToolBar_Update_UI();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-29 15:30:16 +00:00
|
|
|
switch( m_ID_current_state )
|
|
|
|
{
|
|
|
|
case ID_MAIN_MENUBAR:
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NO_SELECT_BUTT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
|
|
|
case ID_PCB_MUWAVE_TOOL_GAP_CMD:
|
|
|
|
case ID_PCB_MUWAVE_TOOL_STUB_CMD:
|
|
|
|
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
|
|
|
|
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
|
|
|
|
MuWaveCommand( DC, MousePos );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_HIGHLIGHT_BUTT:
|
2009-09-28 12:21:54 +00:00
|
|
|
{
|
|
|
|
int netcode = Select_High_Light( DC );
|
|
|
|
if( netcode < 0 )
|
|
|
|
GetBoard()->DisplayInfo( this );
|
|
|
|
else
|
2008-02-23 04:53:44 +00:00
|
|
|
{
|
2009-09-28 12:21:54 +00:00
|
|
|
NETINFO_ITEM* net = GetBoard()->FindNet( netcode );
|
|
|
|
if( net )
|
|
|
|
net->DisplayInfo( this );
|
2008-02-23 04:53:44 +00:00
|
|
|
}
|
2009-09-28 12:21:54 +00:00
|
|
|
}
|
|
|
|
break;
|
2007-09-29 15:30:16 +00:00
|
|
|
|
|
|
|
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
|
|
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
|
|
|
Show_1_Ratsnest( DrawStruct, DC );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-09-29 15:30:16 +00:00
|
|
|
if( DrawStruct )
|
|
|
|
SendMessageToEESCHEMA( DrawStruct );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_MIRE_BUTT:
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
|
|
|
SetCurItem( Create_Mire( DC ) );
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
}
|
2008-12-04 04:28:11 +00:00
|
|
|
else if( DrawStruct->Type() == TYPE_MIRE )
|
2007-09-29 15:30:16 +00:00
|
|
|
{
|
|
|
|
Place_Mire( (MIREPCB*) DrawStruct, DC );
|
|
|
|
}
|
|
|
|
else
|
2008-12-04 04:28:11 +00:00
|
|
|
DisplayError( this, wxT( "Internal err: Struct not TYPE_MIRE" ) );
|
2007-09-29 15:30:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_CIRCLE_BUTT:
|
|
|
|
case ID_PCB_ARC_BUTT:
|
2009-09-22 12:27:57 +00:00
|
|
|
case ID_PCB_ADD_LINE_BUTT:
|
2007-09-29 15:30:16 +00:00
|
|
|
{
|
|
|
|
int shape = S_SEGMENT;
|
|
|
|
if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
|
|
|
shape = S_CIRCLE;
|
|
|
|
if( m_ID_current_state == ID_PCB_ARC_BUTT )
|
|
|
|
shape = S_ARC;
|
|
|
|
|
2010-01-24 02:05:07 +00:00
|
|
|
if( getActiveLayer() <= LAST_COPPER_LAYER )
|
2007-09-29 15:30:16 +00:00
|
|
|
{
|
2007-11-01 05:27:31 +00:00
|
|
|
DisplayError( this, _( "Graphic not authorized on Copper layers" ) );
|
2007-09-29 15:30:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
2008-02-23 04:53:44 +00:00
|
|
|
DrawStruct = Begin_DrawSegment( NULL, shape, DC );
|
2007-09-29 15:30:16 +00:00
|
|
|
SetCurItem( DrawStruct );
|
2009-09-28 12:21:54 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
else if( DrawStruct
|
2008-12-04 04:28:11 +00:00
|
|
|
&& (DrawStruct->Type() == TYPE_DRAWSEGMENT)
|
2007-09-29 15:30:16 +00:00
|
|
|
&& (DrawStruct->m_Flags & IS_NEW) )
|
|
|
|
{
|
|
|
|
DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, DC );
|
|
|
|
SetCurItem( DrawStruct );
|
2009-09-28 12:21:54 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case ID_TRACK_BUTT:
|
2010-01-24 02:05:07 +00:00
|
|
|
if( getActiveLayer() > LAST_COPPER_LAYER )
|
2007-09-29 15:30:16 +00:00
|
|
|
{
|
|
|
|
DisplayError( this, _( "Tracks on Copper layers only " ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
|
|
|
DrawStruct = Begin_Route( NULL, DC );
|
|
|
|
SetCurItem( DrawStruct );
|
|
|
|
if( DrawStruct )
|
2009-09-28 12:21:54 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
2009-05-23 07:16:05 +00:00
|
|
|
else if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
2007-09-29 15:30:16 +00:00
|
|
|
{
|
|
|
|
TRACK* track = Begin_Route( (TRACK*) DrawStruct, DC );
|
2009-10-14 18:14:58 +00:00
|
|
|
// SetCurItem() must not write to the msg panel
|
|
|
|
// because a track info is displayed while moving the mouse cursor
|
|
|
|
if( track ) // A new segment was created
|
|
|
|
SetCurItem( DrawStruct = track, false );
|
2009-09-28 12:21:54 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ID_PCB_ZONES_BUTT:
|
2009-09-28 12:21:54 +00:00
|
|
|
|
|
|
|
/* 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
|
|
|
|
*/
|
2007-09-29 15:30:16 +00:00
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
2009-09-28 12:21:54 +00:00
|
|
|
// 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 ) )
|
2008-02-23 04:53:44 +00:00
|
|
|
{
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2009-01-05 05:21:35 +00:00
|
|
|
DrawStruct = GetBoard()->m_CurrentZoneContour;
|
2008-02-23 04:53:44 +00:00
|
|
|
GetScreen()->SetCurItem( DrawStruct );
|
|
|
|
}
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
else if( DrawStruct
|
2008-12-04 04:28:11 +00:00
|
|
|
&& (DrawStruct->Type() == TYPE_ZONE_CONTAINER)
|
2007-09-29 15:30:16 +00:00
|
|
|
&& (DrawStruct->m_Flags & IS_NEW) )
|
2009-09-28 12:21:54 +00:00
|
|
|
{ // Add a new corner to the current outline beeing created:
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2008-02-23 04:53:44 +00:00
|
|
|
Begin_Zone( DC );
|
2009-01-05 05:21:35 +00:00
|
|
|
DrawStruct = GetBoard()->m_CurrentZoneContour;
|
2008-01-31 20:53:44 +00:00
|
|
|
GetScreen()->SetCurItem( DrawStruct );
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
else
|
2009-09-28 12:21:54 +00:00
|
|
|
DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() zone internal error" ) );
|
2007-09-29 15:30:16 +00:00
|
|
|
break;
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
case ID_PCB_ADD_TEXT_BUTT:
|
2007-09-29 15:30:16 +00:00
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
|
|
|
SetCurItem( Create_Texte_Pcb( DC ) );
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-09-28 12:21:54 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
2008-12-04 04:28:11 +00:00
|
|
|
else if( DrawStruct->Type() == TYPE_TEXTE )
|
2007-09-29 15:30:16 +00:00
|
|
|
{
|
|
|
|
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
else
|
2008-12-04 04:28:11 +00:00
|
|
|
DisplayError( this, wxT( "Internal err: Struct not TYPE_TEXTE" ) );
|
2007-09-29 15:30:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_COMPONENT_BUTT:
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-02-23 04:53:44 +00:00
|
|
|
DrawStruct = Load_Module_From_Library( wxEmptyString, DC );
|
2007-09-29 15:30:16 +00:00
|
|
|
SetCurItem( DrawStruct );
|
|
|
|
if( DrawStruct )
|
|
|
|
StartMove_Module( (MODULE*) DrawStruct, DC );
|
|
|
|
}
|
2008-12-04 04:28:11 +00:00
|
|
|
else if( DrawStruct->Type() == TYPE_MODULE )
|
2007-09-29 15:30:16 +00:00
|
|
|
{
|
|
|
|
Place_Module( (MODULE*) DrawStruct, DC );
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
else
|
2008-12-04 04:28:11 +00:00
|
|
|
DisplayError( this, wxT( "Internal err: Struct not TYPE_MODULE" ) );
|
2007-09-29 15:30:16 +00:00
|
|
|
break;
|
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
case ID_PCB_DIMENSION_BUTT:
|
2010-01-24 02:05:07 +00:00
|
|
|
if( getActiveLayer() <= LAST_COPPER_LAYER )
|
2007-09-29 15:30:16 +00:00
|
|
|
{
|
2010-04-23 09:54:40 +00:00
|
|
|
DisplayError( this, _( "Dimension not authorized on Copper layers" ) );
|
2007-09-29 15:30:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
2010-04-23 09:54:40 +00:00
|
|
|
DrawStruct = Begin_Dimension( NULL, DC );
|
2007-09-29 15:30:16 +00:00
|
|
|
SetCurItem( DrawStruct );
|
2009-09-28 12:21:54 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
else if( DrawStruct
|
2010-04-23 09:54:40 +00:00
|
|
|
&& (DrawStruct->Type() == TYPE_DIMENSION)
|
2007-09-29 15:30:16 +00:00
|
|
|
&& (DrawStruct->m_Flags & IS_NEW) )
|
|
|
|
{
|
2010-04-23 09:54:40 +00:00
|
|
|
DrawStruct = Begin_Dimension( (DIMENSION*) DrawStruct, DC );
|
2007-09-29 15:30:16 +00:00
|
|
|
SetCurItem( DrawStruct );
|
2009-09-28 12:21:54 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
else
|
2010-04-22 17:47:10 +00:00
|
|
|
DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() error item is not a DIMENSION" ) );
|
2007-09-29 15:30:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_DELETE_ITEM_BUTT:
|
|
|
|
if( !DrawStruct || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
|
|
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
|
|
|
if( DrawStruct && (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
|
|
|
RemoveStruct( DrawStruct, DC );
|
|
|
|
SetCurItem( DrawStruct = NULL );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
|
2009-04-09 18:39:39 +00:00
|
|
|
DrawPanel->DrawAuxiliaryAxis( DC, GR_XOR );
|
2007-09-29 15:30:16 +00:00
|
|
|
m_Auxiliary_Axis_Position = GetScreen()->m_Curseur;
|
2009-04-09 18:39:39 +00:00
|
|
|
DrawPanel->DrawAuxiliaryAxis( DC, GR_COPY );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-09-29 15:30:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
DrawPanel->SetCursor( wxCURSOR_ARROW );
|
|
|
|
DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() id error" ) );
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************************************************/
|
|
|
|
void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|
|
|
/********************************************************************************/
|
|
|
|
|
2008-02-23 04:53:44 +00:00
|
|
|
/* handle the double click on the mouse left button
|
2007-09-29 15:30:16 +00:00
|
|
|
*/
|
|
|
|
{
|
2009-09-28 12:21:54 +00:00
|
|
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
|
|
|
wxPoint pos = GetPosition();
|
2007-09-29 15:30:16 +00:00
|
|
|
|
|
|
|
switch( m_ID_current_state )
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
|
|
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
|
|
|
|
break;
|
|
|
|
|
|
|
|
SendMessageToEESCHEMA( DrawStruct );
|
|
|
|
|
|
|
|
// An item is found
|
|
|
|
SetCurItem( DrawStruct );
|
|
|
|
|
|
|
|
switch( DrawStruct->Type() )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TRACK:
|
|
|
|
case TYPE_VIA:
|
2007-09-29 15:30:16 +00:00
|
|
|
if( DrawStruct->m_Flags & IS_NEW )
|
|
|
|
{
|
|
|
|
End_Route( (TRACK*) DrawStruct, DC );
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
else if( DrawStruct->m_Flags == 0 )
|
|
|
|
{
|
|
|
|
Edit_TrackSegm_Width( DC, (TRACK*) DrawStruct );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE:
|
2008-12-20 17:28:25 +00:00
|
|
|
InstallTextPCBOptionsFrame( (TEXTE_PCB*) DrawStruct, DC );
|
2007-09-29 15:30:16 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_PAD:
|
2009-12-19 19:24:49 +00:00
|
|
|
InstallPadOptionsFrame( (D_PAD*) DrawStruct );
|
2007-09-29 15:30:16 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MODULE:
|
2009-12-19 16:10:25 +00:00
|
|
|
InstallModuleOptionsFrame( (MODULE*) DrawStruct, DC );
|
2007-09-29 15:30:16 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MIRE:
|
2009-12-19 16:10:25 +00:00
|
|
|
InstallMireOptionsFrame( (MIREPCB*) DrawStruct, DC, pos );
|
2007-09-29 15:30:16 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
case TYPE_DIMENSION:
|
|
|
|
Install_Edit_Dimension( (DIMENSION*) DrawStruct, DC, pos );
|
2008-12-23 13:14:01 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
2009-12-19 16:10:25 +00:00
|
|
|
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, DC );
|
2007-09-29 15:30:16 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_DRAWSEGMENT:
|
2009-12-19 16:10:25 +00:00
|
|
|
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) DrawStruct, DC );
|
2009-01-05 05:21:35 +00:00
|
|
|
break;
|
2007-09-29 15:30:16 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_ZONE_CONTAINER:
|
2008-10-09 19:13:25 +00:00
|
|
|
if( DrawStruct->m_Flags )
|
|
|
|
break;
|
2009-12-19 16:10:25 +00:00
|
|
|
Edit_Zone_Params( DC, (ZONE_CONTAINER*) DrawStruct );
|
2008-10-09 19:13:25 +00:00
|
|
|
break;
|
|
|
|
|
2007-09-29 15:30:16 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
break; // end case 0
|
|
|
|
|
|
|
|
case ID_TRACK_BUTT:
|
|
|
|
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
|
|
|
{
|
|
|
|
End_Route( (TRACK*) DrawStruct, DC );
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-09-29 15:30:16 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_ZONES_BUTT:
|
2009-09-28 12:21:54 +00:00
|
|
|
if( End_Zone( DC ) )
|
2008-02-23 04:53:44 +00:00
|
|
|
{
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2008-02-23 04:53:44 +00:00
|
|
|
SetCurItem( NULL );
|
|
|
|
}
|
2007-09-29 15:30:16 +00:00
|
|
|
break;
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
case ID_PCB_ADD_LINE_BUTT:
|
2007-09-29 15:30:16 +00:00
|
|
|
case ID_PCB_ARC_BUTT:
|
|
|
|
case ID_PCB_CIRCLE_BUTT:
|
|
|
|
if( DrawStruct == NULL )
|
|
|
|
break;
|
2008-12-04 04:28:11 +00:00
|
|
|
if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
|
2007-09-29 15:30:16 +00:00
|
|
|
{
|
|
|
|
DisplayError( this, wxT( "DrawStruct Type error" ) );
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-09-29 15:30:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if( (DrawStruct->m_Flags & IS_NEW) )
|
|
|
|
{
|
2009-12-19 16:10:25 +00:00
|
|
|
End_Edge( (DRAWSEGMENT*) DrawStruct, DC );
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-09-29 15:30:16 +00:00
|
|
|
SetCurItem( NULL );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|