2009-11-04 20:46:53 +00:00
|
|
|
/*******************/
|
|
|
|
/* onleftclick.cpp */
|
|
|
|
/*******************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "eeschema_id.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "class_sch_screen.h"
|
|
|
|
#include "wxEeschemaStruct.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "general.h"
|
|
|
|
#include "protos.h"
|
2010-12-21 15:13:09 +00:00
|
|
|
#include "sch_bus_entry.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_text.h"
|
|
|
|
#include "sch_marker.h"
|
2011-01-12 21:47:54 +00:00
|
|
|
#include "sch_junction.h"
|
2010-12-21 15:13:09 +00:00
|
|
|
#include "sch_line.h"
|
|
|
|
#include "sch_no_connect.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_component.h"
|
|
|
|
#include "sch_sheet.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
static wxArrayString s_CmpNameList;
|
|
|
|
static wxArrayString s_PowerNameList;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
SCH_ITEM* item = GetScreen()->GetCurItem();
|
2011-02-03 19:27:28 +00:00
|
|
|
wxPoint gridPosition = GetGridPosition( aPosition );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( ( GetToolId() == ID_NO_TOOL_SELECTED ) || ( item && item->m_Flags ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2011-01-12 21:47:54 +00:00
|
|
|
m_itemToRepeat = NULL;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
if( item && item->m_Flags )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
|
|
|
case SCH_TEXT_T:
|
|
|
|
case SCH_SHEET_LABEL_T:
|
|
|
|
case SCH_SHEET_T:
|
|
|
|
case SCH_BUS_ENTRY_T:
|
|
|
|
case SCH_JUNCTION_T:
|
|
|
|
case SCH_COMPONENT_T:
|
|
|
|
case SCH_FIELD_T:
|
2011-02-02 19:01:21 +00:00
|
|
|
item->Place( this, aDC );
|
2008-03-16 04:47:43 +00:00
|
|
|
GetScreen()->SetCurItem( NULL );
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds();
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
return;
|
|
|
|
|
2011-02-23 15:42:56 +00:00
|
|
|
case SCH_LINE_T: // May already be drawing segment.
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-02-23 15:42:56 +00:00
|
|
|
wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick error. Item type <" ) +
|
|
|
|
item->GetClass() + wxT( "> is already being edited." ) );
|
|
|
|
item->SetFlags( 0 );
|
2010-08-28 18:02:24 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item = LocateAndShowItem( aPosition );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
switch( GetToolId() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-24 20:22:12 +00:00
|
|
|
case ID_NO_TOOL_SELECTED:
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_HIERARCHY_PUSH_POP_BUTT:
|
2011-02-21 13:54:29 +00:00
|
|
|
if( ( item && item->m_Flags ) || ( g_RootSheet->CountSheets() == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2011-02-02 19:01:21 +00:00
|
|
|
|
|
|
|
item = LocateAndShowItem( aPosition );
|
|
|
|
|
|
|
|
if( item && ( item->Type() == SCH_SHEET_T ) )
|
2011-02-05 02:21:11 +00:00
|
|
|
{
|
|
|
|
m_CurrentSheet->Push( (SCH_SHEET*) item );
|
|
|
|
DisplayCurrentSheet();
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
else
|
2011-02-05 02:21:11 +00:00
|
|
|
{
|
|
|
|
wxCHECK_RET( m_CurrentSheet->Last() != g_RootSheet,
|
|
|
|
wxT( "Cannot leave root sheet. Bad Programmer!" ) );
|
|
|
|
|
|
|
|
m_CurrentSheet->Pop();
|
|
|
|
DisplayCurrentSheet();
|
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NOCONN_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-03 19:27:28 +00:00
|
|
|
m_itemToRepeat = AddNoConnect( aDC, gridPosition );
|
2011-01-12 21:47:54 +00:00
|
|
|
GetScreen()->SetCurItem( m_itemToRepeat );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item->Place( this, aDC );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-02 19:01:21 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds();
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_JUNCTION_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-05 02:21:11 +00:00
|
|
|
m_itemToRepeat = AddJunction( aDC, gridPosition, true );
|
2011-01-12 21:47:54 +00:00
|
|
|
GetScreen()->SetCurItem( m_itemToRepeat );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item->Place( this, aDC );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-02 19:01:21 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds();
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_WIRETOBUS_ENTRY_BUTT:
|
|
|
|
case ID_BUSTOBUS_ENTRY_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-24 20:22:12 +00:00
|
|
|
item = CreateBusEntry( aDC, ( GetToolId() == ID_WIRETOBUS_ENTRY_BUTT ) ?
|
2011-02-02 19:01:21 +00:00
|
|
|
WIRE_TO_BUS : BUS_TO_BUS );
|
|
|
|
GetScreen()->SetCurItem( item );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item->Place( this, aDC );
|
2008-03-16 04:47:43 +00:00
|
|
|
GetScreen()->SetCurItem( NULL );
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds();
|
2011-02-02 19:01:21 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
LocateAndDeleteItem( this, aDC );
|
|
|
|
OnModify();
|
2008-03-16 04:47:43 +00:00
|
|
|
GetScreen()->SetCurItem( NULL );
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds();
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_WIRE_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
BeginSegment( aDC, LAYER_WIRE );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_BUS_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
BeginSegment( aDC, LAYER_BUS );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_LINE_COMMENT_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
BeginSegment( aDC, LAYER_NOTES );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TEXT_COMMENT_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_NOTES ) );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item->Place( this, aDC );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_LABEL_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_LOCLABEL ) );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item->Place( this, aDC );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds();
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_GLABEL_BUTT:
|
2008-03-16 04:47:43 +00:00
|
|
|
case ID_HIERLABEL_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
if( (item == NULL) || (item->m_Flags == 0) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == ID_GLABEL_BUTT )
|
2011-02-02 19:01:21 +00:00
|
|
|
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_GLOBLABEL ) );
|
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == ID_HIERLABEL_BUTT )
|
2011-02-02 19:01:21 +00:00
|
|
|
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) );
|
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item->Place( this, aDC );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds();
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2008-03-16 04:47:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_SHEET_SYMBOL_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
GetScreen()->SetCurItem( CreateSheet( aDC ) );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item->Place( this, aDC );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds();
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-07-29 13:10:36 +00:00
|
|
|
case ID_IMPORT_HLABEL_BUTT:
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_SHEET_LABEL_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
|
|
|
item = LocateAndShowItem( aPosition );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
if( item == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
if( (item->Type() == SCH_SHEET_T) && (item->m_Flags == 0) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == ID_IMPORT_HLABEL_BUTT )
|
2011-02-02 19:01:21 +00:00
|
|
|
GetScreen()->SetCurItem( Import_PinSheet( (SCH_SHEET*) item, aDC ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
else
|
2011-02-02 19:01:21 +00:00
|
|
|
GetScreen()->SetCurItem( Create_PinSheet( (SCH_SHEET*) item, aDC ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-02 19:01:21 +00:00
|
|
|
else if( (item->Type() == SCH_SHEET_LABEL_T) && (item->m_Flags != 0) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item->Place( this, aDC );
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds();
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
case ID_SCH_PLACE_COMPONENT:
|
2011-02-02 19:01:21 +00:00
|
|
|
if( (item == NULL) || (item->m_Flags == 0) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-03 19:27:28 +00:00
|
|
|
GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, true ) );
|
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item->Place( this, aDC );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds();
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PLACE_POWER_BUTT:
|
2011-02-02 19:01:21 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
GetScreen()->SetCurItem( Load_Component( aDC, wxT( "power" ),
|
2011-02-03 19:27:28 +00:00
|
|
|
s_PowerNameList, false ) );
|
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item->Place( this, aDC );
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds();
|
2011-02-03 19:27:28 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-02-24 20:22:12 +00:00
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
2011-02-23 15:42:56 +00:00
|
|
|
wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick invalid tool ID <" ) +
|
2011-02-24 20:22:12 +00:00
|
|
|
wxString::Format( wxT( "%d> selected." ), GetToolId() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function OnLeftDClick
|
2009-01-31 18:08:47 +00:00
|
|
|
* called on a double click event from the drawpanel mouse handler
|
|
|
|
* if an editable item is found (text, component)
|
|
|
|
* Call the suitable dialog editor.
|
2009-11-04 20:46:53 +00:00
|
|
|
* Id a create command is in progress:
|
2009-01-31 18:08:47 +00:00
|
|
|
* validate and finish the command
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2011-02-02 19:01:21 +00:00
|
|
|
void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
EDA_ITEM* item = GetScreen()->GetCurItem();
|
|
|
|
wxPoint pos = aPosition;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
switch( GetToolId() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-24 20:22:12 +00:00
|
|
|
case ID_NO_TOOL_SELECTED:
|
2011-02-02 19:01:21 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
item = LocateAndShowItem( aPosition );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags != 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_SHEET_T:
|
2011-02-05 02:21:11 +00:00
|
|
|
m_CurrentSheet->Push( (SCH_SHEET*) item );
|
|
|
|
DisplayCurrentSheet();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_COMPONENT_T:
|
2011-02-02 19:01:21 +00:00
|
|
|
InstallCmpeditFrame( this, (SCH_COMPONENT*) item );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_TEXT_T:
|
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
2011-02-02 19:01:21 +00:00
|
|
|
EditSchematicText( (SCH_TEXT*) item );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_FIELD_T:
|
2011-02-02 19:01:21 +00:00
|
|
|
EditCmpFieldText( (SCH_FIELD*) item, aDC );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_MARKER_T:
|
2011-02-02 19:01:21 +00:00
|
|
|
( (SCH_MARKER*) item )->DisplayMarkerInfo( this );
|
2009-07-09 17:02:15 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_BUS_BUTT:
|
|
|
|
case ID_WIRE_BUTT:
|
|
|
|
case ID_LINE_COMMENT_BUTT:
|
2011-02-21 13:54:29 +00:00
|
|
|
if( item && item->IsNew() )
|
2011-02-02 19:01:21 +00:00
|
|
|
EndSegment( aDC );
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|