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"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "wxEeschemaStruct.h"
|
|
|
|
#include "class_sch_screen.h"
|
|
|
|
#include "kicad_device_context.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#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"
|
2010-12-21 15:13:09 +00:00
|
|
|
#include "sch_bus_entry.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_marker.h"
|
|
|
|
#include "sch_component.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"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_sheet.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::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:
|
2010-11-26 11:55:34 +00:00
|
|
|
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL:
|
2008-03-10 11:42:41 +00:00
|
|
|
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_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
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->EndMouseCapture();
|
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
|
2011-02-24 20:22:12 +00:00
|
|
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-01-30 22:22:38 +00:00
|
|
|
INSTALL_UNBUFFERED_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 );
|
2011-01-12 21:47:54 +00:00
|
|
|
m_itemToRepeat = NULL;
|
2007-08-20 01:20:48 +00:00
|
|
|
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 );
|
2011-01-12 21:47:54 +00:00
|
|
|
m_itemToRepeat = NULL;
|
2009-01-06 20:09:32 +00:00
|
|
|
SetSheetNumberAndCount();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case wxID_PASTE:
|
2011-02-11 20:48:13 +00:00
|
|
|
HandleBlockBegin( &dc, BLOCK_PASTE, screen->GetCrossHairPosition() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
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_CANCEL_CURRENT_COMMAND:
|
2011-02-24 20:22:12 +00:00
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_END_LINE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-12-10 19:47:44 +00:00
|
|
|
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_LABEL_T );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-12-10 19:47:44 +00:00
|
|
|
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_GLOBAL_LABEL_T );
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-12-10 19:47:44 +00:00
|
|
|
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_HIERARCHICAL_LABEL_T );
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-12-10 19:47:44 +00:00
|
|
|
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_TEXT_T );
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
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 );
|
2011-01-12 21:47:54 +00:00
|
|
|
m_itemToRepeat = NULL;
|
2011-01-21 19:30:59 +00:00
|
|
|
screen->TestDanglingEnds( DrawPanel, &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:
|
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2009-08-27 05:53:24 +00:00
|
|
|
SCH_ITEM* oldWiresList = screen->ExtractWires( true );
|
2011-02-11 20:48:13 +00:00
|
|
|
screen->BreakSegment( screen->GetCrossHairPosition() );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2009-08-27 05:53:24 +00:00
|
|
|
if( oldWiresList )
|
|
|
|
SaveCopyInUndoList( oldWiresList, UR_WIRE_IMAGE );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
screen->TestDanglingEnds( DrawPanel, &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..)
|
2010-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
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();
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
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 );
|
2011-01-12 21:47:54 +00:00
|
|
|
m_itemToRepeat = NULL;
|
2011-01-21 19:30:59 +00:00
|
|
|
screen->TestDanglingEnds( DrawPanel, &dc );
|
2010-09-05 17:01:48 +00:00
|
|
|
SetSheetNumberAndCount();
|
|
|
|
OnModify();
|
|
|
|
}
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_SCH_END_SHEET:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2009-11-04 20:46:53 +00:00
|
|
|
ReSizeSheet( (SCH_SHEET*) screen->GetCurItem(), &dc );
|
2011-01-21 19:30:59 +00:00
|
|
|
screen->TestDanglingEnds( DrawPanel, &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-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem() && screen->GetCurItem()->Type() == SCH_SHEET_T )
|
2010-12-23 10:00:55 +00:00
|
|
|
screen->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-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem() && screen->GetCurItem()->Type() == SCH_SHEET_T )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();
|
|
|
|
|
|
|
|
if( !sheet->HasUndefinedLabels() )
|
|
|
|
{
|
|
|
|
DisplayInfoMessage( this,
|
2010-12-08 20:12:46 +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();
|
2011-01-30 22:22:38 +00:00
|
|
|
DrawPanel->RefreshDrawingRect( sheet->GetBoundingBox() );
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
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
|
2011-02-21 13:54:29 +00:00
|
|
|
// component, like Field, text..) or a hierarchical sheet
|
2010-07-17 11:14:57 +00:00
|
|
|
// or a label
|
2010-12-10 19:47:44 +00:00
|
|
|
if( (screen->GetCurItem()->Type() != SCH_COMPONENT_T)
|
|
|
|
&& (screen->GetCurItem()->Type() != SCH_LABEL_T)
|
|
|
|
&& (screen->GetCurItem()->Type() != SCH_GLOBAL_LABEL_T)
|
|
|
|
&& (screen->GetCurItem()->Type() != SCH_HIERARCHICAL_LABEL_T)
|
|
|
|
&& (screen->GetCurItem()->Type() != SCH_SHEET_T) )
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-12-08 20:12:46 +00:00
|
|
|
|
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
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->GetCrossHairPosition() ) )
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
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 )
|
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->GetCrossHairPosition() ) )
|
2009-08-28 07:11:56 +00:00
|
|
|
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
|
2011-01-20 11:26:10 +00:00
|
|
|
// the segment. The initial rect is only one point (w = h = 2)
|
|
|
|
// The rect contains one or 0 ends.
|
|
|
|
// If one end is selected, this is a drag Node
|
|
|
|
// if no ends selected the current segment is dragged
|
|
|
|
screen->m_BlockLocate.Inflate( 1 );
|
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..)
|
2010-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
InstallCmpeditFrame( this, (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..)
|
2010-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem()->m_Flags == 0 )
|
2010-12-08 20:12:46 +00:00
|
|
|
SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(), UR_CHANGED );
|
2008-03-13 05:04:59 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
CmpRotationMiroir( (SCH_COMPONENT*) screen->GetCurItem(), &dc, option );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_INIT_CMP:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
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..)
|
2010-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2008-03-13 05:04:59 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
EditComponentValue( (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..)
|
2010-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
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..)
|
2010-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-12-11 16:41:43 +00:00
|
|
|
break;
|
2010-12-08 20:12:46 +00:00
|
|
|
|
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..)
|
2010-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-12-08 20:12:46 +00:00
|
|
|
ConvertPart( (SCH_COMPONENT*) screen->GetCurItem(), &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
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..)
|
2010-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2009-12-02 21:44:03 +00:00
|
|
|
SelPartUnit( (SCH_COMPONENT*) screen->GetCurItem(),
|
2010-12-08 20:12:46 +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..)
|
2010-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem()->Type() != SCH_COMPONENT_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( LocateSmallestComponent( screen ) );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->GetCurItem() == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
{
|
2010-10-25 15:43:42 +00:00
|
|
|
LIB_ALIAS* LibEntry;
|
2009-09-18 14:56:05 +00:00
|
|
|
LibEntry = CMP_LIBRARY::FindLibraryEntry(
|
2010-12-14 15:56:30 +00:00
|
|
|
( (SCH_COMPONENT*) screen->GetCurItem() )->GetLibName() );
|
2009-09-18 14:56:05 +00:00
|
|
|
|
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-10-25 15:43:42 +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:
|
|
|
|
{
|
2011-02-05 02:21:11 +00:00
|
|
|
EDA_ITEM* item = screen->GetCurItem();
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
if( item && (item->Type() == SCH_SHEET_T) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-05 02:21:11 +00:00
|
|
|
m_CurrentSheet->Push( (SCH_SHEET*) item );
|
|
|
|
DisplayCurrentSheet();
|
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:
|
2011-02-05 02:21:11 +00:00
|
|
|
m_CurrentSheet->Pop();
|
|
|
|
DisplayCurrentSheet();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
2011-02-24 20:22:12 +00:00
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
2007-08-20 01:20:48 +00:00
|
|
|
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;
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
HandleBlockPlace( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
|
|
|
HandleBlockEndByPopUp( BLOCK_ZOOM, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
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:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
HandleBlockEndByPopUp( BLOCK_ROTATE, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_MIRROR_X_BLOCK:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-09-05 17:01:48 +00:00
|
|
|
HandleBlockEndByPopUp( BLOCK_MIRROR_X, &dc );
|
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_POPUP_MIRROR_Y_BLOCK:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
HandleBlockEndByPopUp( BLOCK_MIRROR_Y, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
HandleBlockEndByPopUp( BLOCK_COPY, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_DRAG_BLOCK:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
HandleBlockEndByPopUp( BLOCK_DRAG, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ADD_JUNCTION:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
|
|
|
screen->SetCurItem( AddJunction( &dc, screen->GetCrossHairPosition(), true ) );
|
2011-01-21 19:30:59 +00:00
|
|
|
screen->TestDanglingEnds( DrawPanel, &dc );
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ADD_LABEL:
|
|
|
|
case ID_POPUP_SCH_ADD_GLABEL:
|
2010-12-08 20:12:46 +00:00
|
|
|
screen->SetCurItem( 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 );
|
2011-01-21 19:30:59 +00:00
|
|
|
screen->TestDanglingEnds( DrawPanel, &dc );
|
2008-04-17 16:25:29 +00:00
|
|
|
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:
|
2010-12-10 19:47:44 +00:00
|
|
|
if( screen->GetCurItem() && screen->GetCurItem()->Type() == SCH_MARKER_T )
|
2010-09-05 17:01:48 +00:00
|
|
|
( (SCH_MARKER*) screen->GetCurItem() )->DisplayMarkerInfo( this );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2009-07-08 15:42:45 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
default: // Log error:
|
2010-12-08 20:12:46 +00:00
|
|
|
DisplayError( this, wxT( "SCH_EDIT_FRAME::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
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
2011-01-12 21:47:54 +00:00
|
|
|
m_itemToRepeat = NULL;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::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;
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DrawStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_JUNCTION_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_BUS_ENTRY_T:
|
2009-12-02 21:44:03 +00:00
|
|
|
StartMoveBusEntry( (SCH_BUS_ENTRY*) DrawStruct, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
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:
|
2008-03-20 01:50:21 +00:00
|
|
|
StartMoveTexte( (SCH_TEXT*) DrawStruct, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_COMPONENT_T:
|
2008-03-20 01:50:21 +00:00
|
|
|
StartMovePart( (SCH_COMPONENT*) DrawStruct, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LINE_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_SHEET_T:
|
2009-11-04 20:46:53 +00:00
|
|
|
StartMoveSheet( (SCH_SHEET*) DrawStruct, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_NO_CONNECT_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_FIELD_T:
|
2009-12-02 21:44:03 +00:00
|
|
|
StartMoveCmpField( (SCH_FIELD*) DrawStruct, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_MARKER_T:
|
|
|
|
case SCH_SHEET_LABEL_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
default:
|
|
|
|
wxString msg;
|
2010-12-08 20:12:46 +00:00
|
|
|
msg.Printf( wxT( "SCH_EDIT_FRAME::Move_Item Error: Bad DrawType %d" ),
|
|
|
|
DrawStruct->Type() );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2011-02-05 19:22:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = GetScreen();
|
|
|
|
|
|
|
|
if( screen->IsBlockActive() )
|
|
|
|
{
|
2011-02-08 14:48:38 +00:00
|
|
|
DrawPanel->SetCursor( wxCursor( DrawPanel->GetDefaultCursor() ) );
|
2011-02-05 19:22:58 +00:00
|
|
|
screen->ClearBlockCommand();
|
|
|
|
|
|
|
|
// Stop the current command (if any) but keep the current tool
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->EndMouseCapture();
|
2011-02-05 19:22:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Stop the current command (if any) but keep the current tool
|
2011-02-24 20:22:12 +00:00
|
|
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
2011-02-05 19:22:58 +00:00
|
|
|
}
|
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
int id = aEvent.GetId();
|
|
|
|
|
|
|
|
// Stop the current command and deselect the current tool.
|
2011-02-24 20:22:12 +00:00
|
|
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
2011-02-24 20:22:12 +00:00
|
|
|
case ID_NO_TOOL_SELECTED:
|
2011-02-21 13:54:29 +00:00
|
|
|
SetToolID( id, DrawPanel->GetDefaultCursor(), _( "No tool selected" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_HIERARCHY_PUSH_POP_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Descend or ascend hierarchy" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NOCONN_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add no connect" ) );
|
|
|
|
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 lines" ) );
|
|
|
|
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;
|
|
|
|
|
|
|
|
case ID_HIERLABEL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add hierarchical label" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TEXT_COMMENT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_WIRETOBUS_ENTRY_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add wire to bus entry" ) );
|
|
|
|
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 sheet pins" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_IMPORT_HLABEL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Import sheet pins" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SCH_PLACE_COMPONENT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add component" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PLACE_POWER_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add power" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
m_itemToRepeat = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
if( aEvent.GetEventObject() == m_VToolBar )
|
2011-02-24 20:22:12 +00:00
|
|
|
aEvent.Check( GetToolId() == aEvent.GetId() );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|