2009-11-04 20:46:53 +00:00
|
|
|
/*****************/
|
|
|
|
/* schedit.cpp */
|
|
|
|
/*****************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
2009-04-07 15:54:40 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
#include "eda_doc.h"
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_marker_sch.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "program.h"
|
|
|
|
#include "general.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "eeschema_id.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "protos.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_library.h"
|
2009-12-20 19:48:58 +00:00
|
|
|
#include "kicad_device_context.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
int id = event.GetId();
|
|
|
|
wxPoint pos;
|
|
|
|
SCH_SCREEN* screen = GetScreen();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
pos = wxGetMousePosition();
|
|
|
|
|
|
|
|
pos.y += 20;
|
|
|
|
|
|
|
|
// If needed, stop the current command and deselect current tool
|
|
|
|
switch( id )
|
|
|
|
{
|
2008-03-10 11:42:41 +00:00
|
|
|
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
|
|
|
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
|
|
|
|
case ID_POPUP_END_LINE:
|
|
|
|
case ID_POPUP_SCH_EDIT_TEXT:
|
|
|
|
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
|
|
|
|
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
|
|
|
|
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
|
|
|
|
case ID_POPUP_SCH_SET_SHAPE_TEXT:
|
|
|
|
case ID_POPUP_SCH_ROTATE_TEXT:
|
|
|
|
case ID_POPUP_SCH_EDIT_SHEET:
|
|
|
|
case ID_POPUP_SCH_CLEANUP_SHEET:
|
|
|
|
case ID_POPUP_SCH_END_SHEET:
|
|
|
|
case ID_POPUP_SCH_RESIZE_SHEET:
|
2009-05-16 05:38:38 +00:00
|
|
|
case ID_POPUP_IMPORT_GLABEL:
|
2008-03-10 11:42:41 +00:00
|
|
|
case ID_POPUP_SCH_EDIT_PINSHEET:
|
|
|
|
case ID_POPUP_SCH_MOVE_PINSHEET:
|
|
|
|
case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
|
|
|
|
case ID_POPUP_SCH_MOVE_CMP_REQUEST:
|
|
|
|
case ID_POPUP_SCH_DRAG_CMP_REQUEST:
|
2009-08-28 07:11:56 +00:00
|
|
|
case ID_POPUP_SCH_DRAG_WIRE_REQUEST:
|
2008-03-10 11:42:41 +00:00
|
|
|
case ID_POPUP_SCH_EDIT_CMP:
|
|
|
|
case ID_POPUP_SCH_MIROR_X_CMP:
|
|
|
|
case ID_POPUP_SCH_MIROR_Y_CMP:
|
|
|
|
case ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE:
|
|
|
|
case ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE:
|
|
|
|
case ID_POPUP_SCH_ORIENT_NORMAL_CMP:
|
|
|
|
case ID_POPUP_SCH_INIT_CMP:
|
|
|
|
case ID_POPUP_SCH_DISPLAYDOC_CMP:
|
|
|
|
case ID_POPUP_SCH_EDIT_VALUE_CMP:
|
|
|
|
case ID_POPUP_SCH_EDIT_REF_CMP:
|
|
|
|
case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP:
|
|
|
|
case ID_POPUP_SCH_EDIT_CONVERT_CMP:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT_CMP:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT1:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT2:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT3:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT4:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT5:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT6:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT7:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT8:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT9:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT10:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT11:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT12:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT13:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT14:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT15:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT16:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT17:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT18:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT19:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT20:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT21:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT22:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT23:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT24:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT25:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT26:
|
|
|
|
case ID_POPUP_SCH_ROTATE_FIELD:
|
|
|
|
case ID_POPUP_SCH_EDIT_FIELD:
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
|
|
|
case ID_POPUP_DRAG_BLOCK:
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
|
|
|
case ID_POPUP_MIRROR_X_BLOCK:
|
|
|
|
case ID_POPUP_MIRROR_Y_BLOCK:
|
|
|
|
case ID_POPUP_SCH_DELETE_NODE:
|
|
|
|
case ID_POPUP_SCH_DELETE_CONNECTION:
|
|
|
|
case wxID_CUT:
|
|
|
|
case wxID_COPY:
|
|
|
|
case ID_POPUP_SCH_ENTER_SHEET:
|
|
|
|
case ID_POPUP_SCH_LEAVE_SHEET:
|
|
|
|
case ID_POPUP_SCH_ADD_JUNCTION:
|
|
|
|
case ID_POPUP_SCH_ADD_LABEL:
|
2009-07-08 15:42:45 +00:00
|
|
|
case ID_POPUP_SCH_GETINFO_MARKER:
|
2008-03-10 11:42:41 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
/* At this point: Do nothing. these commands do not need to stop the
|
|
|
|
* current command (mainly a block command) or reset the current state
|
|
|
|
* They will be executed later, in next switch structure.
|
2008-03-10 11:42:41 +00:00
|
|
|
*/
|
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
2009-07-25 04:53:39 +00:00
|
|
|
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
|
2008-02-26 01:07:38 +00:00
|
|
|
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
|
2008-03-10 11:42:41 +00:00
|
|
|
DrawPanel->
|
|
|
|
m_PanelDefaultCursor ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-12-20 19:48:58 +00:00
|
|
|
// Stop the current command (if any) but keep the current tool
|
2010-09-05 17:01:48 +00:00
|
|
|
DrawPanel->UnManageCursor();
|
2009-11-04 20:46:53 +00:00
|
|
|
|
|
|
|
/* Should not be executed, except bug. */
|
2009-07-25 04:53:39 +00:00
|
|
|
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
screen->m_BlockLocate.m_Command = BLOCK_IDLE;
|
|
|
|
screen->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
|
|
|
screen->m_BlockLocate.ClearItemsList();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_DELETE_CMP:
|
2009-11-04 20:46:53 +00:00
|
|
|
case ID_POPUP_SCH_DELETE:
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2009-12-20 19:48:58 +00:00
|
|
|
// Stop the current command (if any) but keep the current tool
|
2010-09-05 17:01:48 +00:00
|
|
|
DrawPanel->UnManageCursor();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
default:
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// Stop the current command and deselect the current tool
|
2008-02-26 01:07:38 +00:00
|
|
|
DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor =
|
|
|
|
wxCURSOR_ARROW;
|
2009-12-20 19:48:58 +00:00
|
|
|
DrawPanel->UnManageCursor( 0, DrawPanel->m_PanelCursor );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-12-20 19:48:58 +00:00
|
|
|
INSTALL_DC( dc, DrawPanel );
|
2009-11-04 20:46:53 +00:00
|
|
|
switch( id )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
case ID_HIERARCHY:
|
|
|
|
InstallHierarchyFrame( &dc, pos );
|
|
|
|
g_ItemToRepeat = NULL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case wxID_CUT:
|
2009-07-25 04:53:39 +00:00
|
|
|
if( screen->m_BlockLocate.m_Command != BLOCK_MOVE )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
|
|
|
|
g_ItemToRepeat = NULL;
|
2009-01-06 20:09:32 +00:00
|
|
|
SetSheetNumberAndCount();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case wxID_PASTE:
|
2008-04-17 16:25:29 +00:00
|
|
|
HandleBlockBegin( &dc, BLOCK_PASTE, screen->m_Curseur );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_HIERARCHY_PUSH_POP_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Push/Pop Hierarchy" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NOCONN_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add NoConnect Flag" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_WIRE_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Wire" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_BUS_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Bus" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_LINE_COMMENT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Drawing" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_JUNCTION_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Junction" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_LABEL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Label" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_GLABEL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Global label" ) );
|
|
|
|
break;
|
2008-02-26 01:07:38 +00:00
|
|
|
|
|
|
|
case ID_HIERLABEL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Hierarchal label" ) );
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_TEXT_COMMENT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_WIRETOBUS_ENTRY_BUTT:
|
2008-11-09 18:15:24 +00:00
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Wire to Bus entry" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_BUSTOBUS_ENTRY_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Bus to Bus entry" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SHEET_SYMBOL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Sheet" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SHEET_LABEL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add PinSheet" ) );
|
|
|
|
break;
|
|
|
|
|
2009-07-29 13:10:36 +00:00
|
|
|
case ID_IMPORT_HLABEL_BUTT:
|
2007-08-20 01:20:48 +00:00
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Import PinSheet" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_COMPONENT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Component" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PLACE_POWER_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Power" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-12-02 21:44:03 +00:00
|
|
|
SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '/' );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-12-02 21:44:03 +00:00
|
|
|
SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '\\' );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NO_SELECT_BUTT:
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
|
|
|
if( m_ID_current_state == 0 )
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_END_LINE:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
EndSegment( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_EDIT_TEXT:
|
2009-12-27 14:01:21 +00:00
|
|
|
EditSchematicText( (SCH_TEXT*) screen->GetCurItem() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ROTATE_TEXT:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-04-17 16:25:29 +00:00
|
|
|
ChangeTextOrient( (SCH_TEXT*) screen->GetCurItem(), &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-04-17 16:25:29 +00:00
|
|
|
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(),
|
2008-03-20 01:50:21 +00:00
|
|
|
&dc, TYPE_SCH_LABEL );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-04-17 16:25:29 +00:00
|
|
|
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(),
|
2008-03-20 01:50:21 +00:00
|
|
|
&dc, TYPE_SCH_GLOBALLABEL );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2008-02-21 12:21:01 +00:00
|
|
|
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-04-17 16:25:29 +00:00
|
|
|
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(),
|
2008-03-20 01:50:21 +00:00
|
|
|
&dc, TYPE_SCH_HIERLABEL );
|
2008-02-21 12:21:01 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-04-17 16:25:29 +00:00
|
|
|
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(),
|
2008-03-20 01:50:21 +00:00
|
|
|
&dc, TYPE_SCH_TEXT );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_SET_SHAPE_TEXT:
|
|
|
|
|
2008-02-21 12:21:01 +00:00
|
|
|
// Not used
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ROTATE_FIELD:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-12-02 21:44:03 +00:00
|
|
|
RotateCmpField( (SCH_FIELD*) screen->GetCurItem(), &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_EDIT_FIELD:
|
2009-12-02 21:44:03 +00:00
|
|
|
EditCmpFieldText( (SCH_FIELD*) screen->GetCurItem(), &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_DELETE_NODE:
|
|
|
|
case ID_POPUP_SCH_DELETE_CONNECTION:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-07-25 07:31:07 +00:00
|
|
|
DeleteConnection( id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE );
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
g_ItemToRepeat = NULL;
|
2008-04-17 16:25:29 +00:00
|
|
|
TestDanglingEnds( screen->EEDrawList, &dc );
|
2009-07-25 07:31:07 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_BREAK_WIRE:
|
|
|
|
{
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-08-27 05:53:24 +00:00
|
|
|
SCH_ITEM* oldWiresList = screen->ExtractWires( true );
|
|
|
|
BreakSegment( screen, screen->m_Curseur );
|
|
|
|
if( oldWiresList )
|
|
|
|
SaveCopyInUndoList( oldWiresList, UR_WIRE_IMAGE );
|
2008-04-17 16:25:29 +00:00
|
|
|
TestDanglingEnds( screen->EEDrawList, &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2010-09-05 17:01:48 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_SCH_DELETE_CMP:
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// Ensure the struct is a component (could be a struct of a
|
|
|
|
// component, like Field, text..)
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
|
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_SCH_DELETE:
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
|
|
|
SCH_ITEM* item = screen->GetCurItem();
|
|
|
|
if( item == NULL )
|
|
|
|
break;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
DeleteStruct( DrawPanel, &dc, item );
|
|
|
|
screen->SetCurItem( NULL );
|
|
|
|
g_ItemToRepeat = NULL;
|
|
|
|
TestDanglingEnds( screen->EEDrawList, &dc );
|
|
|
|
SetSheetNumberAndCount();
|
|
|
|
OnModify();
|
|
|
|
}
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_END_SHEET:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->GetCurItem()->Place( this, &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_RESIZE_SHEET:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-11-04 20:46:53 +00:00
|
|
|
ReSizeSheet( (SCH_SHEET*) screen->GetCurItem(), &dc );
|
2008-04-17 16:25:29 +00:00
|
|
|
TestDanglingEnds( screen->EEDrawList, &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_EDIT_SHEET:
|
2009-12-15 21:11:05 +00:00
|
|
|
if( EditSheet( (SCH_SHEET*) screen->GetCurItem(), &dc ) )
|
2010-02-18 20:07:29 +00:00
|
|
|
OnModify();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2009-07-25 04:53:39 +00:00
|
|
|
|
2009-05-16 05:38:38 +00:00
|
|
|
case ID_POPUP_IMPORT_GLABEL:
|
2010-09-05 17:01:48 +00:00
|
|
|
if( screen->GetCurItem() && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
|
|
|
|
GetScreen()->SetCurItem( Import_PinSheet( (SCH_SHEET*) screen->GetCurItem(), &dc ) );
|
2009-05-16 05:38:38 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_SCH_CLEANUP_SHEET:
|
2010-09-05 17:01:48 +00:00
|
|
|
if( screen->GetCurItem() && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();
|
|
|
|
|
|
|
|
if( !sheet->HasUndefinedLabels() )
|
|
|
|
{
|
|
|
|
DisplayInfoMessage( this,
|
2010-09-05 17:01:48 +00:00
|
|
|
_( "There are no undefined labels in this sheet to clean up." ) );
|
2010-06-24 18:31:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
if( !IsOK( this, _( "Do you wish to cleanup this sheet?" ) ) )
|
2010-06-24 18:31:43 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Save sheet in undo list before cleaning up unreferenced hierarchical labels. */
|
|
|
|
SaveCopyInUndoList( sheet, UR_CHANGED );
|
|
|
|
sheet->CleanupSheet();
|
|
|
|
OnModify();
|
|
|
|
DrawPanel->PostDirtyRect( sheet->GetBoundingBox() );
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_EDIT_PINSHEET:
|
2009-11-04 20:46:53 +00:00
|
|
|
Edit_PinSheet( (SCH_SHEET_PIN*) screen->GetCurItem(), &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_MOVE_PINSHEET:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2010-09-05 17:01:48 +00:00
|
|
|
StartMove_PinSheet( (SCH_SHEET_PIN*) screen->GetCurItem(), &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2007-09-22 14:31:20 +00:00
|
|
|
case ID_POPUP_SCH_DRAG_CMP_REQUEST:
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_POPUP_SCH_MOVE_CMP_REQUEST:
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// Ensure the struct is a component (could be a struct of a
|
2010-03-24 18:26:04 +00:00
|
|
|
// component, like Field, text..) or a hierachical sheet
|
2010-07-17 11:14:57 +00:00
|
|
|
// or a label
|
2010-03-24 18:26:04 +00:00
|
|
|
if( (screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT)
|
2010-09-05 17:01:48 +00:00
|
|
|
&& (screen->GetCurItem()->Type() != TYPE_SCH_LABEL)
|
|
|
|
&& (screen->GetCurItem()->Type() != TYPE_SCH_GLOBALLABEL)
|
|
|
|
&& (screen->GetCurItem()->Type() != TYPE_SCH_HIERLABEL)
|
|
|
|
&& (screen->GetCurItem()->Type() != DRAW_SHEET_STRUCT_TYPE) )
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2010-09-05 17:01:48 +00:00
|
|
|
|
|
|
|
// fall through
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-12-12 08:21:32 +00:00
|
|
|
if( id == ID_POPUP_SCH_DRAG_CMP_REQUEST )
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
2010-03-24 18:26:04 +00:00
|
|
|
// The easiest way to handle a drag component or sheet command
|
|
|
|
// is to simulate a block drag command
|
2009-07-25 04:53:39 +00:00
|
|
|
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
|
2007-09-22 14:31:20 +00:00
|
|
|
{
|
2008-02-26 01:07:38 +00:00
|
|
|
if( !HandleBlockBegin( &dc, BLOCK_DRAG,
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->m_Curseur ) )
|
2008-02-26 01:07:38 +00:00
|
|
|
break;
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2009-12-12 08:21:32 +00:00
|
|
|
// Give a non null size to the search block:
|
2010-09-05 17:01:48 +00:00
|
|
|
screen->m_BlockLocate.Inflate( 1 );
|
2007-09-22 14:31:20 +00:00
|
|
|
HandleBlockEnd( &dc );
|
2008-02-26 01:07:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2008-04-17 16:25:29 +00:00
|
|
|
Process_Move_Item( (SCH_ITEM*) screen->GetCurItem(), &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2009-08-28 07:11:56 +00:00
|
|
|
case ID_POPUP_SCH_DRAG_WIRE_REQUEST:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2009-08-28 07:11:56 +00:00
|
|
|
// The easiest way to handle a drag component is to simulate a
|
|
|
|
// block drag command
|
|
|
|
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
|
|
|
|
{
|
|
|
|
if( !HandleBlockBegin( &dc, BLOCK_DRAG,
|
|
|
|
screen->m_Curseur ) )
|
|
|
|
break;
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// Ensure the block selection contains the segment, or one end of
|
|
|
|
// the segment. The initial rect is only one point (w = h = 0)
|
2009-08-28 07:11:56 +00:00
|
|
|
// The rect must contains one or 2 ends.
|
|
|
|
// If only one end is selected, this is a drag Node
|
2009-11-04 20:46:53 +00:00
|
|
|
// if no ends selected, we adjust the rect area to contain the
|
|
|
|
// whole segment. This works fine only for H and V segments and
|
|
|
|
// only if they do not cross a component
|
2009-08-28 07:11:56 +00:00
|
|
|
// TODO: a better way to drag only wires
|
2010-09-05 17:01:48 +00:00
|
|
|
SCH_LINE* segm = (SCH_LINE*) screen->GetCurItem();
|
|
|
|
if( !screen->m_BlockLocate.Inside( segm->m_Start )
|
|
|
|
&& !screen->m_BlockLocate.Inside( segm->m_End ) )
|
2009-08-28 07:11:56 +00:00
|
|
|
{
|
2010-09-05 17:01:48 +00:00
|
|
|
screen->m_BlockLocate.SetOrigin( segm->m_Start );
|
|
|
|
screen->m_BlockLocate.SetEnd( segm->m_End );
|
2009-08-28 07:11:56 +00:00
|
|
|
}
|
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
case ID_POPUP_SCH_EDIT_CMP:
|
2008-03-10 11:42:41 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// Ensure the struct is a component (could be a struct of a
|
|
|
|
// component, like Field, text..)
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
|
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
InstallCmpeditFrame( this, pos,
|
2008-04-17 16:25:29 +00:00
|
|
|
(SCH_COMPONENT*) screen->GetCurItem() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_MIROR_X_CMP:
|
|
|
|
case ID_POPUP_SCH_MIROR_Y_CMP:
|
|
|
|
case ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE:
|
|
|
|
case ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE:
|
|
|
|
case ID_POPUP_SCH_ORIENT_NORMAL_CMP:
|
2008-03-10 11:42:41 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// Ensure the struct is a component (could be a struct of a
|
|
|
|
// component, like Field, text..)
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
|
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
{
|
|
|
|
int option;
|
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_POPUP_SCH_MIROR_X_CMP:
|
2010-01-13 21:15:54 +00:00
|
|
|
option = CMP_MIRROR_X; break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_SCH_MIROR_Y_CMP:
|
2010-01-13 21:15:54 +00:00
|
|
|
option = CMP_MIRROR_Y; break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE:
|
|
|
|
option = CMP_ROTATE_COUNTERCLOCKWISE; break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE:
|
|
|
|
option = CMP_ROTATE_CLOCKWISE; break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
case ID_POPUP_SCH_ORIENT_NORMAL_CMP:
|
|
|
|
option = CMP_NORMAL; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem()->m_Flags == 0 )
|
2009-12-02 21:44:03 +00:00
|
|
|
SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(),
|
2010-09-05 17:01:48 +00:00
|
|
|
UR_CHANGED );
|
2008-03-13 05:04:59 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
CmpRotationMiroir( (SCH_COMPONENT*) screen->GetCurItem(),
|
2010-09-05 17:01:48 +00:00
|
|
|
&dc, option );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_INIT_CMP:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_EDIT_VALUE_CMP:
|
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// Ensure the struct is a component (could be a struct of a
|
|
|
|
// component, like Field, text..)
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
|
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2008-03-13 05:04:59 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
EditComponentValue(
|
2008-04-17 16:25:29 +00:00
|
|
|
(SCH_COMPONENT*) screen->GetCurItem(), &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_EDIT_REF_CMP:
|
2008-03-10 11:42:41 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// Ensure the struct is a component (could be a struct of a
|
|
|
|
// component, like Field, text..)
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
|
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2008-03-13 05:04:59 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
EditComponentReference( (SCH_COMPONENT*) screen->GetCurItem(), &dc );
|
2008-02-26 01:07:38 +00:00
|
|
|
break;
|
2007-12-11 16:41:43 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP:
|
2008-03-10 11:42:41 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// Ensure the struct is a component (could be a struct of a
|
|
|
|
// component, like Field, text..)
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
|
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-12-11 16:41:43 +00:00
|
|
|
break;
|
2009-12-02 21:44:03 +00:00
|
|
|
EditComponentFootprint( (SCH_COMPONENT*) screen->GetCurItem(), &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
case ID_POPUP_SCH_EDIT_CONVERT_CMP:
|
2008-03-10 11:42:41 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// Ensure the struct is a component (could be a struct of a
|
|
|
|
// component, like Field, text..)
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
|
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
ConvertPart(
|
2008-04-17 16:25:29 +00:00
|
|
|
(SCH_COMPONENT*) screen->GetCurItem(),
|
2007-08-20 01:20:48 +00:00
|
|
|
&dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT1:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT2:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT3:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT4:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT5:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT6:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT7:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT8:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT9:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT10:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT11:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT12:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT13:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT14:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT15:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT16:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT17:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT18:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT19:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT20:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT21:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT22:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT23:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT24:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT25:
|
|
|
|
case ID_POPUP_SCH_SELECT_UNIT26:
|
2008-03-10 11:42:41 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// Ensure the struct is a component (could be a struct of a
|
|
|
|
// component, like Field, text..)
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
|
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-12-02 21:44:03 +00:00
|
|
|
SelPartUnit( (SCH_COMPONENT*) screen->GetCurItem(),
|
2010-09-05 17:01:48 +00:00
|
|
|
id + 1 - ID_POPUP_SCH_SELECT_UNIT1, &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_DISPLAYDOC_CMP:
|
2008-03-10 11:42:41 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// Ensure the struct is a component (could be a piece of a
|
|
|
|
// component, like Field, text..)
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
|
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
{
|
2009-09-18 14:56:05 +00:00
|
|
|
CMP_LIB_ENTRY* LibEntry;
|
|
|
|
LibEntry = CMP_LIBRARY::FindLibraryEntry(
|
|
|
|
( (SCH_COMPONENT*) screen->GetCurItem() )->m_ChipName );
|
|
|
|
|
2009-12-15 21:11:05 +00:00
|
|
|
if( LibEntry && LibEntry->GetDocFileName() != wxEmptyString )
|
2009-04-07 11:53:58 +00:00
|
|
|
{
|
2009-12-15 21:11:05 +00:00
|
|
|
GetAssociatedDocument( this, LibEntry->GetDocFileName(),
|
2010-09-05 17:01:48 +00:00
|
|
|
&wxGetApp().GetLibraryPathList() );
|
2009-04-07 11:53:58 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ENTER_SHEET:
|
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
EDA_BaseStruct* DrawStruct = screen->GetCurItem();
|
2007-09-01 12:00:30 +00:00
|
|
|
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
InstallNextScreen( (SCH_SHEET*) DrawStruct );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
}
|
2010-09-05 17:01:48 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_SCH_LEAVE_SHEET:
|
2008-02-12 21:12:46 +00:00
|
|
|
InstallPreviousSheet();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case wxID_COPY: // really this is a Save block for paste
|
|
|
|
HandleBlockEndByPopUp( BLOCK_SAVE, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
|
|
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
HandleBlockPlace( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
|
|
|
HandleBlockEndByPopUp( BLOCK_ZOOM, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
|
2009-01-06 20:09:32 +00:00
|
|
|
SetSheetNumberAndCount();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
HandleBlockEndByPopUp( BLOCK_ROTATE, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_MIRROR_X_BLOCK:
|
2010-09-05 17:01:48 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
HandleBlockEndByPopUp( BLOCK_MIRROR_X, &dc );
|
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_POPUP_MIRROR_Y_BLOCK:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
HandleBlockEndByPopUp( BLOCK_MIRROR_Y, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
HandleBlockEndByPopUp( BLOCK_COPY, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_DRAG_BLOCK:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
HandleBlockEndByPopUp( BLOCK_DRAG, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ADD_JUNCTION:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-12-02 21:44:03 +00:00
|
|
|
screen->SetCurItem( CreateNewJunctionStruct( &dc, screen->m_Curseur,
|
|
|
|
true ) );
|
2008-04-17 16:25:29 +00:00
|
|
|
TestDanglingEnds( screen->EEDrawList, &dc );
|
|
|
|
screen->SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ADD_LABEL:
|
|
|
|
case ID_POPUP_SCH_ADD_GLABEL:
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem(
|
2008-02-26 01:07:38 +00:00
|
|
|
CreateNewText( &dc,
|
|
|
|
id == ID_POPUP_SCH_ADD_LABEL ?
|
|
|
|
LAYER_LOCLABEL : LAYER_GLOBLABEL ) );
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-09-05 17:01:48 +00:00
|
|
|
( (SCH_ITEM*) screen->GetCurItem() )->Place( this, &dc );
|
2008-04-17 16:25:29 +00:00
|
|
|
TestDanglingEnds( screen->EEDrawList, &dc );
|
|
|
|
screen->SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-07-08 15:42:45 +00:00
|
|
|
case ID_POPUP_SCH_GETINFO_MARKER:
|
2009-11-04 20:46:53 +00:00
|
|
|
if( screen->GetCurItem()
|
2009-12-02 21:44:03 +00:00
|
|
|
&& screen->GetCurItem()->Type() == TYPE_SCH_MARKER )
|
2010-09-05 17:01:48 +00:00
|
|
|
( (SCH_MARKER*) screen->GetCurItem() )->DisplayMarkerInfo( this );
|
2009-07-08 15:42:45 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
default: // Log error:
|
2008-02-26 01:07:38 +00:00
|
|
|
DisplayError( this,
|
2010-09-05 17:01:48 +00:00
|
|
|
wxT( "WinEDA_SchematicFrame::Process_Special_Functions error" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// End switch ( id ) (Command execution)
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
if( m_ID_current_state == 0 )
|
|
|
|
g_ItemToRepeat = NULL;
|
|
|
|
SetToolbars();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( DrawStruct == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DrawStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
2009-12-02 21:44:03 +00:00
|
|
|
StartMoveBusEntry( (SCH_BUS_ENTRY*) DrawStruct, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_LABEL:
|
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
|
|
|
case TYPE_SCH_TEXT:
|
|
|
|
StartMoveTexte( (SCH_TEXT*) DrawStruct, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_COMPONENT:
|
|
|
|
StartMovePart( (SCH_COMPONENT*) DrawStruct, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_SHEET_STRUCT_TYPE:
|
2009-11-04 20:46:53 +00:00
|
|
|
StartMoveSheet( (SCH_SHEET*) DrawStruct, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_PART_TEXT_STRUCT_TYPE:
|
2009-12-02 21:44:03 +00:00
|
|
|
StartMoveCmpField( (SCH_FIELD*) DrawStruct, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
case TYPE_SCH_MARKER:
|
2008-04-15 19:38:19 +00:00
|
|
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
2007-08-20 01:20:48 +00:00
|
|
|
default:
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf(
|
|
|
|
wxT( "WinEDA_SchematicFrame::Move_Item Error: Bad DrawType %d" ),
|
2007-09-01 12:00:30 +00:00
|
|
|
DrawStruct->Type() );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|