2009-11-14 22:15:22 +00:00
|
|
|
/**************************************/
|
|
|
|
/* edit.cpp: edit PCB implementation. */
|
|
|
|
/**************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "appl_wxstruct.h"
|
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
#include "eda_doc.h"
|
|
|
|
#include "gestfich.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "pcbnew_id.h"
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2010-08-10 18:34:26 +00:00
|
|
|
#include "module_editor_frame.h"
|
2009-10-28 11:48:47 +00:00
|
|
|
#include "class_board_design_settings.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "protos.h"
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2010-09-15 14:53:33 +00:00
|
|
|
#include "dialog_drc.h"
|
|
|
|
|
2009-12-20 19:48:58 +00:00
|
|
|
#include "kicad_device_context.h"
|
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
#include "dialog_global_edit_tracks_and_vias.h"
|
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Uncomment following line to enable wxBell() command (which beeps speaker)
|
|
|
|
// #include <wx/utils.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
static void Process_Move_Item( PCB_EDIT_FRAME* frame, EDA_ITEM* DrawStruct, wxDC* DC );
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2010-01-18 19:33:45 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Handles the selection of command events. */
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
int id = event.GetId();
|
|
|
|
wxPoint pos;
|
2009-06-19 20:13:22 +00:00
|
|
|
|
2009-07-25 04:53:39 +00:00
|
|
|
int itmp;
|
2011-01-30 22:22:38 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
2009-06-19 20:13:22 +00:00
|
|
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
2010-08-29 21:31:27 +00:00
|
|
|
MODULE* module;
|
2009-06-19 20:13:22 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOff( &dc );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
wxGetMousePosition( &pos.x, &pos.y );
|
|
|
|
|
|
|
|
pos.y += 20;
|
|
|
|
|
2007-09-29 13:31:10 +00:00
|
|
|
switch( id ) // Some (not all ) edit commands must be finished or aborted
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
|
|
|
case wxID_CUT:
|
|
|
|
case wxID_COPY:
|
|
|
|
case ID_PCB_USER_GRID_SETUP:
|
|
|
|
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
2009-09-28 12:21:54 +00:00
|
|
|
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTEPCB:
|
|
|
|
case ID_POPUP_PCB_EDIT_MIRE:
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
|
|
|
|
case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
|
|
|
|
case ID_POPUP_PCB_EDIT_MODULE:
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTMODULE:
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
|
|
|
|
case ID_POPUP_PCB_END_TRACK:
|
|
|
|
case ID_POPUP_PCB_PLACE_VIA:
|
2010-06-16 15:01:45 +00:00
|
|
|
case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
|
2008-01-12 20:31:56 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_MICROVIA:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
|
|
|
|
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
|
|
|
|
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
|
2008-01-23 08:01:38 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
|
2007-12-30 18:20:51 +00:00
|
|
|
case ID_POPUP_PCB_FILL_ALL_ZONES:
|
2008-10-29 15:26:53 +00:00
|
|
|
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES:
|
|
|
|
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_ZONE_CORNER:
|
|
|
|
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
|
2007-12-29 19:15:58 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE:
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_ZONE_CORNER:
|
|
|
|
case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
|
|
|
|
case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
|
|
|
|
case ID_POPUP_PCB_ADD_ZONE_CORNER:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_TRACKSEG:
|
|
|
|
case ID_POPUP_PCB_DELETE_TRACK:
|
|
|
|
case ID_POPUP_PCB_DELETE_TRACKNET:
|
|
|
|
case ID_POPUP_PCB_FILL_ZONE:
|
|
|
|
case ID_POPUP_PCB_SELECT_LAYER:
|
|
|
|
case ID_POPUP_PCB_SELECT_CU_LAYER:
|
|
|
|
case ID_POPUP_PCB_SELECT_LAYER_PAIR:
|
|
|
|
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
|
|
|
|
case ID_POPUP_PCB_MOVE_TRACK_NODE:
|
|
|
|
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
|
|
|
|
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
|
|
|
|
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
|
|
|
|
case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE:
|
|
|
|
case ID_POPUP_PCB_BREAK_TRACK:
|
|
|
|
case ID_POPUP_PCB_EDIT_NET:
|
|
|
|
case ID_POPUP_PCB_EDIT_TRACK:
|
|
|
|
case ID_POPUP_PCB_EDIT_TRACKSEG:
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_TRACKSEG:
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_TRACK:
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_TRACK:
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_NET:
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_NET:
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
2009-08-12 10:40:01 +00:00
|
|
|
case ID_POPUP_FLIP_BLOCK:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
2009-02-24 13:55:13 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_DRAWING:
|
2009-07-13 15:25:41 +00:00
|
|
|
case ID_POPUP_PCB_GETINFO_MARKER:
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
2011-02-11 20:48:13 +00:00
|
|
|
if( DrawPanel->IsMouseCaptured() )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2011-02-17 18:34:27 +00:00
|
|
|
DrawPanel->EndMouseCapture();
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2007-09-29 13:31:10 +00:00
|
|
|
/* Should not be executed, just in case */
|
2009-07-25 04:53:39 +00:00
|
|
|
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
|
|
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
2007-08-04 00:56:53 +00:00
|
|
|
else
|
2011-02-08 14:48:38 +00:00
|
|
|
SetCursor( DrawPanel->GetDefaultCursor() );
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2009-07-25 04:53:39 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
default: // Finish (abort) the command
|
2011-02-11 20:48:13 +00:00
|
|
|
if( DrawPanel->IsMouseCaptured() )
|
|
|
|
DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
|
2007-10-29 15:51:48 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() != id )
|
2009-07-25 04:53:39 +00:00
|
|
|
{
|
2011-02-24 20:22:12 +00:00
|
|
|
if( m_ID_last_state != GetToolId() )
|
|
|
|
m_ID_last_state = GetToolId();
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
2009-06-19 20:13:22 +00:00
|
|
|
}
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-09-29 13:31:10 +00:00
|
|
|
switch( id ) // Execute command
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_OPEN_MODULE_EDITOR:
|
2008-12-08 15:27:13 +00:00
|
|
|
if( m_ModuleEditFrame == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2011-08-26 17:01:17 +00:00
|
|
|
m_ModuleEditFrame = new FOOTPRINT_EDIT_FRAME( this,
|
|
|
|
_( "Module Editor" ),
|
|
|
|
wxPoint( -1, -1 ),
|
|
|
|
wxSize( 600, 400 ) );
|
2009-01-09 19:09:13 +00:00
|
|
|
m_ModuleEditFrame->Show( true );
|
2011-03-01 18:45:21 +00:00
|
|
|
m_ModuleEditFrame->Zoom_Automatique( false );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
else
|
2011-08-03 15:09:39 +00:00
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
if( m_ModuleEditFrame->IsIconized() )
|
|
|
|
m_ModuleEditFrame->Iconize( false );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-08-03 15:09:39 +00:00
|
|
|
m_ModuleEditFrame->Raise();
|
|
|
|
|
|
|
|
// Raising the window does not set the focus on Linux. This should work on
|
|
|
|
// any platform.
|
|
|
|
if( wxWindow::FindFocus() != m_ModuleEditFrame )
|
|
|
|
m_ModuleEditFrame->SetFocus();
|
|
|
|
}
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_GLOBAL_DELETE:
|
|
|
|
InstallPcbGlobalDeleteFrame( pos );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE;
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockPlace( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
|
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockPlace( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
|
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
|
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE;
|
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
2009-08-12 10:40:01 +00:00
|
|
|
case ID_POPUP_FLIP_BLOCK:
|
|
|
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_FLIP;
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_DRC_CONTROL:
|
2011-03-03 19:08:13 +00:00
|
|
|
m_drc->ShowDialog();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_GET_NETLIST:
|
2011-05-03 12:57:44 +00:00
|
|
|
InstallNetlistFrame( &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_GET_TOOLS:
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
// InstalloolsFrame(this, wxPoint(-1,-1) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_FIND_ITEMS:
|
|
|
|
InstallFindFrame( pos, &dc );
|
|
|
|
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-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
|
|
|
break;
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
case ID_POPUP_PCB_END_LINE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// EndSegment(&dc);
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TRACK:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2007-09-12 02:14:07 +00:00
|
|
|
Edit_Track_Width( &dc, (TRACK*) GetCurItem() );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TRACKSEG:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2007-09-12 02:14:07 +00:00
|
|
|
Edit_TrackSegm_Width( &dc, (TRACK*) GetCurItem() );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
{
|
2009-10-30 17:58:15 +00:00
|
|
|
int type = GetCurItem()->Type();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
if( type == TYPE_TRACK || type == TYPE_VIA )
|
|
|
|
{
|
|
|
|
BOARD_CONNECTED_ITEM*item = (BOARD_CONNECTED_ITEM*) GetCurItem();
|
|
|
|
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( this, item->GetNet() );
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_END_TRACK:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
End_Route( (TRACK*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem()->m_Flags & IS_DRAGGED )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2009-08-08 06:07:08 +00:00
|
|
|
PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-06-16 15:01:45 +00:00
|
|
|
case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
|
2010-07-11 16:24:44 +00:00
|
|
|
/* change the position of initial segment when creating new tracks
|
|
|
|
* switch from _/ to -\ .
|
2010-08-17 10:41:44 +00:00
|
|
|
* If a track is in progress, it will be redrawn
|
2010-07-11 16:24:44 +00:00
|
|
|
*/
|
2011-02-11 20:48:13 +00:00
|
|
|
if( DrawPanel->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor )
|
2011-02-03 19:27:28 +00:00
|
|
|
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false );
|
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
|
2011-02-03 19:27:28 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
if( DrawPanel->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor )
|
2011-02-03 19:27:28 +00:00
|
|
|
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false );
|
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
break;
|
2010-06-16 15:01:45 +00:00
|
|
|
|
2008-01-12 20:31:56 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_MICROVIA:
|
2010-01-31 20:01:46 +00:00
|
|
|
if( !IsMicroViaAcceptable() )
|
2008-04-01 05:21:50 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_VIA:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem()->m_Flags & IS_DRAGGED )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2009-08-08 06:07:08 +00:00
|
|
|
PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
int v_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
|
2008-02-01 21:30:45 +00:00
|
|
|
if( id == ID_POPUP_PCB_PLACE_MICROVIA )
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = VIA_MICROVIA; // place micro via and switch layer
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = v_type;
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
if( DisplayOpt.ContrastModeDisplay )
|
2011-02-21 21:07:00 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_TRACKSEG:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TRACK:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Track( &dc, (TRACK*) GetCurItem() );
|
|
|
|
SetCurItem( NULL );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TRACKNET:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_net( &dc, (TRACK*) GetCurItem() );
|
|
|
|
SetCurItem( NULL );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
|
2009-01-09 19:09:13 +00:00
|
|
|
Attribut_Segment( (TRACK*) GetCurItem(), &dc, true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_TRACKSEG:
|
2009-01-09 19:09:13 +00:00
|
|
|
Attribut_Segment( (TRACK*) GetCurItem(), &dc, false );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_TRACK:
|
2009-01-09 19:09:13 +00:00
|
|
|
Attribut_Track( (TRACK*) GetCurItem(), &dc, true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_TRACK:
|
2009-01-09 19:09:13 +00:00
|
|
|
Attribut_Track( (TRACK*) GetCurItem(), &dc, false );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_NET:
|
2009-01-09 19:09:13 +00:00
|
|
|
Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNet(), true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_NET:
|
2009-01-09 19:09:13 +00:00
|
|
|
Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNet(), false );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SETFLAGS_TRACK_MNU:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_ZONE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-03-30 15:36:41 +00:00
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
SEGZONE* zsegm = (SEGZONE*) GetCurItem();
|
|
|
|
int netcode = zsegm->GetNet();
|
2011-07-16 16:04:49 +00:00
|
|
|
Delete_OldZone_Fill( zsegm );
|
2009-07-25 04:53:39 +00:00
|
|
|
SetCurItem( NULL );
|
|
|
|
test_1_net_connexion( NULL, netcode );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2009-07-25 04:53:39 +00:00
|
|
|
GetBoard()->DisplayInfo( this );
|
2009-03-30 15:36:41 +00:00
|
|
|
}
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2007-12-29 19:15:58 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
|
|
|
|
Edit_Zone_Params( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
2008-02-01 21:30:45 +00:00
|
|
|
SetCurItem( NULL ); // Outlines can have changed
|
2007-12-29 19:15:58 +00:00
|
|
|
break;
|
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2008-01-04 12:27:16 +00:00
|
|
|
Add_Similar_Zone( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
2008-02-01 21:30:45 +00:00
|
|
|
break;
|
2008-01-01 11:46:47 +00:00
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2008-01-04 12:27:16 +00:00
|
|
|
Add_Zone_Cutout( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
2008-02-01 21:30:45 +00:00
|
|
|
break;
|
2008-01-01 11:46:47 +00:00
|
|
|
|
2007-12-29 19:15:58 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_CONTAINER:
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_CUTOUT:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2009-03-30 15:36:41 +00:00
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNet();
|
|
|
|
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
|
|
|
SetCurItem( NULL );
|
|
|
|
test_1_net_connexion( NULL, netcode );
|
|
|
|
GetBoard()->DisplayInfo( this );
|
2009-03-30 15:36:41 +00:00
|
|
|
}
|
2008-02-01 21:30:45 +00:00
|
|
|
break;
|
2007-12-29 19:15:58 +00:00
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_CORNER:
|
|
|
|
Remove_Zone_Corner( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
2007-12-29 19:15:58 +00:00
|
|
|
SetCurItem( NULL );
|
|
|
|
break;
|
2008-02-01 21:30:45 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_ZONE_CORNER:
|
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2008-02-01 21:30:45 +00:00
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2008-12-08 15:27:13 +00:00
|
|
|
Start_Move_Zone_Corner( &dc,
|
|
|
|
zone_cont,
|
|
|
|
zone_cont->m_CornerSelection,
|
|
|
|
false );
|
2007-12-29 19:15:58 +00:00
|
|
|
break;
|
2008-02-01 21:30:45 +00:00
|
|
|
}
|
2007-12-29 19:15:58 +00:00
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
|
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2008-02-01 21:30:45 +00:00
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2008-12-08 15:27:13 +00:00
|
|
|
Start_Move_Zone_Drag_Outline_Edge( &dc,
|
|
|
|
zone_cont,
|
|
|
|
zone_cont->m_CornerSelection );
|
2008-01-16 20:37:50 +00:00
|
|
|
break;
|
2008-02-01 21:30:45 +00:00
|
|
|
}
|
2008-01-16 20:37:50 +00:00
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
|
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2008-02-01 21:30:45 +00:00
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2008-02-01 21:30:45 +00:00
|
|
|
Start_Move_Zone_Outlines( &dc, zone_cont );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2008-02-01 21:30:45 +00:00
|
|
|
}
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_ADD_ZONE_CORNER:
|
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2008-02-01 21:30:45 +00:00
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
2011-02-11 20:48:13 +00:00
|
|
|
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
2008-02-01 21:30:45 +00:00
|
|
|
|
|
|
|
/* add corner between zone_cont->m_CornerSelection
|
|
|
|
* and zone_cont->m_CornerSelection+1
|
|
|
|
* and start move the new corner
|
|
|
|
*/
|
2008-04-01 05:21:50 +00:00
|
|
|
zone_cont->Draw( DrawPanel, &dc, GR_XOR );
|
2011-08-26 17:01:17 +00:00
|
|
|
zone_cont->m_Poly->InsertCorner( zone_cont->m_CornerSelection, pos.x, pos.y );
|
2008-02-01 21:30:45 +00:00
|
|
|
zone_cont->m_CornerSelection++;
|
2008-04-01 05:21:50 +00:00
|
|
|
zone_cont->Draw( DrawPanel, &dc, GR_XOR );
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2008-12-08 15:27:13 +00:00
|
|
|
Start_Move_Zone_Corner( &dc,
|
|
|
|
zone_cont,
|
|
|
|
zone_cont->m_CornerSelection,
|
|
|
|
true );
|
2007-12-29 19:15:58 +00:00
|
|
|
break;
|
2008-02-01 21:30:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
|
|
|
|
case ID_POPUP_PCB_PLACE_ZONE_CORNER:
|
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2008-02-01 21:30:45 +00:00
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
|
|
|
End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont );
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2008-02-01 21:30:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-12-30 18:20:51 +00:00
|
|
|
case ID_POPUP_PCB_FILL_ALL_ZONES:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2008-12-08 15:27:13 +00:00
|
|
|
Fill_All_Zones();
|
2009-07-25 04:53:39 +00:00
|
|
|
GetBoard()->DisplayInfo( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2008-10-29 15:26:53 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
|
2008-12-08 15:27:13 +00:00
|
|
|
if( ( GetCurItem() )->Type() == TYPE_ZONE_CONTAINER )
|
2008-10-29 15:26:53 +00:00
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
|
2011-07-16 16:04:49 +00:00
|
|
|
zone_container->UnFill();
|
2008-12-08 15:27:13 +00:00
|
|
|
test_1_net_connexion( NULL, zone_container->GetNet() );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2009-07-25 04:53:39 +00:00
|
|
|
GetBoard()->DisplayInfo( this );
|
2008-10-29 15:26:53 +00:00
|
|
|
DrawPanel->Refresh();
|
|
|
|
}
|
2009-05-24 18:28:36 +00:00
|
|
|
SetCurItem( NULL );
|
2008-10-29 15:26:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
|
2009-07-25 04:53:39 +00:00
|
|
|
GetBoard()->m_Zone.DeleteAll(); // remove zone segments used to fill zones.
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
|
2009-07-25 04:53:39 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
// Remove filled areas in zone
|
2009-01-05 05:21:35 +00:00
|
|
|
ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii );
|
2011-03-03 19:08:13 +00:00
|
|
|
zone_container->m_FilledPolysList.clear();
|
2008-10-11 19:27:43 +00:00
|
|
|
}
|
2009-07-25 04:53:39 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer
|
2008-11-18 18:13:55 +00:00
|
|
|
test_connexions( NULL );
|
2011-08-26 17:01:17 +00:00
|
|
|
Tst_Ratsnest( NULL, 0 ); // Recalculate the active ratsnest, i.e. the unconnected links
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2009-07-25 04:53:39 +00:00
|
|
|
GetBoard()->DisplayInfo( this );
|
2008-10-11 19:27:43 +00:00
|
|
|
DrawPanel->Refresh();
|
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2007-12-29 19:15:58 +00:00
|
|
|
case ID_POPUP_PCB_FILL_ZONE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2009-08-23 15:22:44 +00:00
|
|
|
Fill_Zone( (ZONE_CONTAINER*) GetCurItem() );
|
2008-12-08 15:27:13 +00:00
|
|
|
test_1_net_connexion( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetBoard()->DisplayInfo( this );
|
2008-11-18 18:13:55 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-12-29 19:15:58 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
|
2007-09-12 02:14:07 +00:00
|
|
|
Process_Move_Item( this, GetCurItem(), &dc );
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = true;
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
|
2009-01-09 19:09:13 +00:00
|
|
|
g_Drag_Pistes_On = true;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
|
2010-09-15 17:50:47 +00:00
|
|
|
if( GetCurItem() == NULL )
|
|
|
|
break;
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2008-12-04 04:28:11 +00:00
|
|
|
if( GetCurItem()->Type() != TYPE_MODULE )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2009-01-09 19:09:13 +00:00
|
|
|
g_Drag_Pistes_On = false;
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
|
|
|
module->m_Reference->m_Text.GetData() );
|
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
GetScreen()->SetCrossHairPosition( ((MODULE*) GetCurItem())->m_Pos );
|
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
StartMove_Module( (MODULE*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: /* get module by name and move it */
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetModuleByName() );
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-09-15 17:50:47 +00:00
|
|
|
if( module == NULL )
|
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
|
|
|
module->m_Reference->m_Text.GetData() );
|
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-09-15 17:50:47 +00:00
|
|
|
StartMove_Module( module, &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_MODULE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2008-12-04 04:28:11 +00:00
|
|
|
if( GetCurItem()->Type() != TYPE_MODULE )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
|
|
|
module->m_Reference->m_Text.GetData() );
|
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
if( Delete_Module( (MODULE*) GetCurItem(), &dc, true ) )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2008-12-04 04:28:11 +00:00
|
|
|
if( GetCurItem()->Type() != TYPE_MODULE )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
|
|
|
module->m_Reference->m_Text.GetData() );
|
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-08-06 07:11:04 +00:00
|
|
|
if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple rotation, no other edition in progress */
|
|
|
|
SaveCopyInUndoList(GetCurItem(), UR_ROTATED, ((MODULE*)GetCurItem())->m_Pos);
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-08-06 07:11:04 +00:00
|
|
|
Rotate_Module( &dc, (MODULE*) GetCurItem(), 900, true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2008-12-04 04:28:11 +00:00
|
|
|
if( GetCurItem()->Type() != TYPE_MODULE )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
|
|
|
module->m_Reference->m_Text.GetData() );
|
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-08-06 07:11:04 +00:00
|
|
|
if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple rotation, no other edition in progress */
|
|
|
|
SaveCopyInUndoList(GetCurItem(), UR_ROTATED_CLOCKWISE, ((MODULE*)GetCurItem())->m_Pos);
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-08-06 07:11:04 +00:00
|
|
|
Rotate_Module( &dc, (MODULE*) GetCurItem(), -900, true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2008-12-04 04:28:11 +00:00
|
|
|
if( GetCurItem()->Type() != TYPE_MODULE )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
|
|
|
module->m_Reference->m_Text.GetData() );
|
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-08-06 07:11:04 +00:00
|
|
|
if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple flip, no other edition in progress */
|
|
|
|
SaveCopyInUndoList(GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->m_Pos);
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-08-06 07:11:04 +00:00
|
|
|
Change_Side_Module( (MODULE*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_MODULE:
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2008-12-04 04:28:11 +00:00
|
|
|
if( GetCurItem()->Type() != TYPE_MODULE )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-05-23 07:16:05 +00:00
|
|
|
InstallModuleOptionsFrame( (MODULE*) GetCurItem(), &dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DRAG_PAD_REQUEST:
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem()->GetParent();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( !module || module->Type() != TYPE_MODULE )
|
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "The parent (%s) of the pad is locked" ),
|
|
|
|
module->m_Reference->m_Text.GetData() );
|
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-01-09 19:09:13 +00:00
|
|
|
g_Drag_Pistes_On = true;
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-10-07 18:24:15 +00:00
|
|
|
StartMovePad( (D_PAD*) GetCurItem(), &dc );
|
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_PAD_REQUEST:
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem()->GetParent();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( !module || module->Type() != TYPE_MODULE )
|
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "The parent (%s) of the pad is locked" ),
|
|
|
|
module->m_Reference->m_Text.GetData() );
|
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-10-07 18:24:15 +00:00
|
|
|
g_Drag_Pistes_On = false;
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
StartMovePad( (D_PAD*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_PAD:
|
2009-12-19 19:24:49 +00:00
|
|
|
InstallPadOptionsFrame( (D_PAD*) GetCurItem() );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2009-08-03 18:54:48 +00:00
|
|
|
SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
|
2008-04-18 13:28:56 +00:00
|
|
|
Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2008-04-18 13:28:56 +00:00
|
|
|
Global_Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
Export_Pad_Settings( (D_PAD*) GetCurItem() );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_PAD:
|
2009-08-03 18:54:48 +00:00
|
|
|
SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
|
2009-05-21 12:45:21 +00:00
|
|
|
DeletePad( (D_PAD*) GetCurItem() );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTMODULE:
|
2009-08-11 10:27:21 +00:00
|
|
|
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetCurItem(), &dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2011-01-09 11:17:28 +00:00
|
|
|
case ID_POPUP_PCB_RESET_TEXT_SIZE:
|
|
|
|
ResetTextSize( GetCurItem(), &dc );
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
StartMoveTexteModule( (TEXTE_MODULE*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
|
2007-09-12 02:14:07 +00:00
|
|
|
RotateTextModule( (TEXTE_MODULE*) GetCurItem(),
|
2007-08-04 00:56:53 +00:00
|
|
|
&dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TEXTMODULE:
|
2009-05-23 07:16:05 +00:00
|
|
|
DeleteTextModule( (TEXTE_MODULE*) GetCurItem() );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_LAYER:
|
2010-01-24 02:05:07 +00:00
|
|
|
itmp = SelectLayer( getActiveLayer(), -1, -1 );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
if( itmp >= 0 )
|
2010-01-24 02:05:07 +00:00
|
|
|
setActiveLayer( itmp );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2009-07-25 04:53:39 +00:00
|
|
|
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
|
2007-08-04 00:56:53 +00:00
|
|
|
SelectLayerPair();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
|
2010-01-24 02:05:07 +00:00
|
|
|
itmp = SelectLayer( getActiveLayer(), FIRST_NO_COPPER_LAYER, -1 );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
if( itmp >= 0 )
|
2010-01-24 02:05:07 +00:00
|
|
|
setActiveLayer( itmp );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-01-24 02:05:07 +00:00
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_CU_LAYER:
|
2010-01-24 02:05:07 +00:00
|
|
|
itmp = SelectLayer( getActiveLayer(), -1, LAST_COPPER_LAYER );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
if( itmp >= 0 )
|
2010-01-24 02:05:07 +00:00
|
|
|
setActiveLayer( itmp );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-01-24 02:05:07 +00:00
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_LAYER_PAIR:
|
|
|
|
SelectLayerPair();
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
2010-11-03 21:19:46 +00:00
|
|
|
setActiveLayer( (size_t) m_SelLayerBox->GetLayerSelection());
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
if( DisplayOpt.ContrastModeDisplay )
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->Refresh( true );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTEPCB:
|
2008-12-20 17:28:25 +00:00
|
|
|
InstallTextPCBOptionsFrame( (TEXTE_PCB*) GetCurItem(), &dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
|
2007-09-12 02:14:07 +00:00
|
|
|
Rotate_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TEXTEPCB:
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_MIRE_REQUEST:
|
2007-09-12 02:14:07 +00:00
|
|
|
StartMove_Mire( (MIREPCB*) GetCurItem(), &dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_MIRE:
|
2010-08-10 18:34:26 +00:00
|
|
|
InstallMireOptionsFrame( (MIREPCB*) GetCurItem(), &dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_MIRE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Mire( (MIREPCB*) GetCurItem(), &dc );
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_DIMENSION:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2010-04-23 09:54:40 +00:00
|
|
|
Delete_Dimension( (DIMENSION*) GetCurItem(), &dc );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_DIMENSION:
|
2010-08-10 18:34:26 +00:00
|
|
|
Install_Edit_Dimension( (DIMENSION*) GetCurItem(), &dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_DRAWING:
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Segment_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_MARKER:
|
|
|
|
RemoveStruct( GetCurItem(), &dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-10-29 15:51:48 +00:00
|
|
|
break;
|
|
|
|
|
2009-07-13 15:25:41 +00:00
|
|
|
case ID_POPUP_PCB_GETINFO_MARKER:
|
2009-08-01 19:26:05 +00:00
|
|
|
if( GetCurItem() && GetCurItem()->Type() == TYPE_MARKER_PCB )
|
|
|
|
( (MARKER_PCB*) GetCurItem() )->DisplayMarkerInfo( this );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2009-07-13 15:25:41 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
|
2009-08-11 10:27:21 +00:00
|
|
|
if( GetCurItem()->m_Flags != 0 )
|
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
Delete_Drawings_All_Layer( GetCurItem()->GetLayer() );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2009-08-11 10:27:21 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_DRAWING:
|
2009-07-25 04:53:39 +00:00
|
|
|
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), &dc );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_DRAWING_REQUEST:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
Start_Move_DrawItem( (DRAWSEGMENT*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
if( GetCurItem() && (GetCurItem()->IsNew()) )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
if( GetCurItem() && (GetCurItem()->IsNew()) )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2008-02-01 21:30:45 +00:00
|
|
|
if( End_Zone( &dc ) )
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = false;
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-23 08:01:38 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
if( GetCurItem() && (GetCurItem()->IsNew()) )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2008-02-01 21:30:45 +00:00
|
|
|
if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline,
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
|
|
|
|
case ID_POPUP_PCB_MOVE_TRACK_NODE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
Start_DragTrackSegmentAndKeepSlope( (TRACK*) GetScreen()->GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_BREAK_TRACK:
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
TRACK* track = (TRACK*) GetScreen()->GetCurItem();
|
2011-02-11 20:48:13 +00:00
|
|
|
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
2007-08-04 00:56:53 +00:00
|
|
|
track->Draw( DrawPanel, &dc, GR_XOR );
|
2009-08-08 06:07:08 +00:00
|
|
|
PICKED_ITEMS_LIST itemsListPicker;
|
2011-08-26 17:01:17 +00:00
|
|
|
TRACK* newtrack = CreateLockPoint( GetBoard(), pos, track, &itemsListPicker );
|
|
|
|
SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED );
|
2007-08-04 00:56:53 +00:00
|
|
|
track->Draw( DrawPanel, &dc, GR_XOR );
|
|
|
|
newtrack->Draw( DrawPanel, &dc, GR_XOR );
|
2011-08-26 17:01:17 +00:00
|
|
|
/* compute the new ratsnest, because connectivity could change */
|
2010-05-27 10:23:29 +00:00
|
|
|
test_1_net_connexion( &dc, track->GetNet() );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MENU_PCB_CLEAN:
|
|
|
|
Clean_Pcb( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MENU_PCB_SWAP_LAYERS:
|
|
|
|
Swap_Layers( event );
|
|
|
|
break;
|
|
|
|
|
2011-01-09 11:17:28 +00:00
|
|
|
case ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES:
|
|
|
|
ResetModuleTextSizes( TEXT_is_REFERENCE, &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES:
|
|
|
|
ResetModuleTextSizes( TEXT_is_VALUE, &dc );
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_PCB_USER_GRID_SETUP:
|
|
|
|
InstallGridFrame( pos );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC:
|
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxConfig* cfg = wxGetApp().m_EDA_CommonConfig;
|
2009-04-19 15:03:48 +00:00
|
|
|
cfg->Read( wxT( "module_doc_file" ), g_DocModulesFileName );
|
|
|
|
GetAssociatedDocument( this, g_DocModulesFileName, &wxGetApp().GetLibraryPathList() );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2008-12-08 15:27:13 +00:00
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_MENU_ARCHIVE_NEW_MODULES:
|
2009-01-09 19:09:13 +00:00
|
|
|
Archive_Modules( wxEmptyString, true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MENU_ARCHIVE_ALL_MODULES:
|
2009-01-09 19:09:13 +00:00
|
|
|
Archive_Modules( wxEmptyString, false );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2009-07-25 04:53:39 +00:00
|
|
|
wxString msg;
|
2011-08-26 17:01:17 +00:00
|
|
|
msg.Printf( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() id %d error" ),
|
|
|
|
DrawStruct->Type() );
|
2009-06-19 20:13:22 +00:00
|
|
|
DisplayError( this, msg );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOn( &dc );
|
2009-01-09 19:09:13 +00:00
|
|
|
DrawPanel->m_IgnoreMouseEvents = false;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
static void Process_Move_Item( PCB_EDIT_FRAME* frame, EDA_ITEM* DrawStruct, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-04 00:56:53 +00:00
|
|
|
if( DrawStruct == NULL )
|
|
|
|
return;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DrawStruct->Type() )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
case TYPE_TEXTE:
|
2007-08-04 00:56:53 +00:00
|
|
|
frame->StartMoveTextePcb( (TEXTE_PCB*) DrawStruct, DC );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
wxString msg;
|
2011-08-26 17:01:17 +00:00
|
|
|
msg.Printf( wxT( "PCB_EDIT_FRAME::Move_Item Error: Bad DrawType %d" ),
|
|
|
|
DrawStruct->Type() );
|
2007-08-04 00:56:53 +00:00
|
|
|
DisplayError( frame, msg );
|
|
|
|
break;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-04 00:56:53 +00:00
|
|
|
if( Item == NULL )
|
|
|
|
return;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( Item->Type() )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MODULE:
|
2008-03-22 18:08:44 +00:00
|
|
|
Delete_Module( (MODULE*) Item, DC, true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
case TYPE_DIMENSION:
|
|
|
|
Delete_Dimension( (DIMENSION*) Item, DC );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MIRE:
|
2007-08-04 00:56:53 +00:00
|
|
|
Delete_Mire( (MIREPCB*) Item, DC );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_DRAWSEGMENT:
|
2007-08-04 00:56:53 +00:00
|
|
|
Delete_Segment_Edge( (DRAWSEGMENT*) Item, DC );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE:
|
2007-08-04 00:56:53 +00:00
|
|
|
Delete_Texte_Pcb( (TEXTE_PCB*) Item, DC );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TRACK:
|
2007-08-04 00:56:53 +00:00
|
|
|
Delete_Track( DC, (TRACK*) Item );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_VIA:
|
2007-08-04 00:56:53 +00:00
|
|
|
Delete_Segment( DC, (TRACK*) Item );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_ZONE:
|
2011-07-16 16:04:49 +00:00
|
|
|
Delete_OldZone_Fill( (SEGZONE*) Item );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
case TYPE_ZONE_EDGE_CORNER:
|
|
|
|
Remove_Zone_Corner( DC, (ZONE_CONTAINER*) Item );
|
|
|
|
SetCurItem( NULL );
|
|
|
|
break;
|
2009-04-17 08:51:02 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
case TYPE_ZONE_CONTAINER:
|
2009-07-25 04:53:39 +00:00
|
|
|
{
|
2009-04-07 11:53:58 +00:00
|
|
|
SetCurItem( NULL );
|
2009-07-25 04:53:39 +00:00
|
|
|
int netcode = ( (ZONE_CONTAINER*) Item )->GetNet();
|
2009-04-07 11:53:58 +00:00
|
|
|
Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
|
|
|
|
test_1_net_connexion( NULL, netcode );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetBoard()->DisplayInfo( this );
|
|
|
|
}
|
|
|
|
break;
|
2009-04-07 11:53:58 +00:00
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
case TYPE_MARKER_PCB:
|
2007-10-29 15:51:48 +00:00
|
|
|
if( Item == GetCurItem() )
|
|
|
|
SetCurItem( NULL );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
( (MARKER_PCB*) Item )->Draw( DrawPanel, DC, GR_XOR );
|
2007-10-29 15:51:48 +00:00
|
|
|
|
2009-07-29 13:10:36 +00:00
|
|
|
// delete the marker, and free memory. Don't use undo stack.
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->Delete( Item );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_PAD:
|
|
|
|
case TYPE_TEXTE_MODULE:
|
|
|
|
case TYPE_EDGE_MODULE:
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TYPE_NOT_INIT:
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_PCB:
|
2007-08-04 00:56:53 +00:00
|
|
|
default:
|
|
|
|
{
|
|
|
|
wxString Line;
|
2011-08-26 17:01:17 +00:00
|
|
|
Line.Printf( wxT( "Remove: item type %d unknown." ), Item->Type() );
|
2007-08-04 00:56:53 +00:00
|
|
|
DisplayError( this, Line );
|
|
|
|
}
|
2008-12-08 15:27:13 +00:00
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-06-11 21:21:00 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, int layer )
|
2007-06-11 21:21:00 +00:00
|
|
|
{
|
2010-01-24 02:05:07 +00:00
|
|
|
int curLayer = getActiveLayer();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Check if the specified layer matches the present layer
|
2010-01-24 02:05:07 +00:00
|
|
|
if( layer == curLayer )
|
2007-08-04 00:56:53 +00:00
|
|
|
return;
|
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Copper layers cannot be selected unconditionally; how many
|
|
|
|
// of those layers are currently enabled needs to be checked.
|
2009-12-07 03:46:13 +00:00
|
|
|
if( IsValidCopperLayerIndex( layer ) )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-10-10 21:35:41 +00:00
|
|
|
// If only one copper layer is enabled, the only such layer
|
2010-01-24 02:05:07 +00:00
|
|
|
// that can be selected to is the "Back" layer (so the
|
2007-10-10 21:35:41 +00:00
|
|
|
// selection of any other copper layer is disregarded).
|
2010-01-31 20:01:46 +00:00
|
|
|
if( GetBoard()->GetCopperLayerCount() < 2 )
|
2007-10-10 21:35:41 +00:00
|
|
|
{
|
2009-12-07 03:46:13 +00:00
|
|
|
if( layer != LAYER_N_BACK )
|
2007-10-10 21:35:41 +00:00
|
|
|
{
|
|
|
|
// Uncomment following command (and line 17) to beep
|
|
|
|
// the speaker. (Doing that would provide feedback to
|
|
|
|
// the user that the (layer-switching) command has been
|
|
|
|
// "acknowledged", but is unable to be acted upon.)
|
|
|
|
// wxBell();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If more than one copper layer is enabled, the "Copper"
|
|
|
|
// and "Component" layers can be selected, but the total
|
|
|
|
// number of copper layers determines which internal
|
|
|
|
// layers are also capable of being selected.
|
|
|
|
else
|
|
|
|
{
|
2009-12-07 03:46:13 +00:00
|
|
|
if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT )
|
2010-01-31 20:01:46 +00:00
|
|
|
&& ( layer >= GetBoard()->GetCopperLayerCount() - 1 ) )
|
2007-10-10 21:35:41 +00:00
|
|
|
{
|
|
|
|
// Uncomment following command (and line 17) to beep
|
|
|
|
// the speaker. (Doing that would provide feedback to
|
|
|
|
// the user that the (layer-switching) command has been
|
|
|
|
// "acknowledged", but is unable to be acted upon.)
|
|
|
|
// wxBell();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
EDA_ITEM* current = GetScreen()->GetCurItem();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// See if we are drawing a segment; if so, add a via?
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == ID_TRACK_BUTT && current != NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2011-02-21 13:54:29 +00:00
|
|
|
if( current->Type() == TYPE_TRACK && ( current->IsNew() ) )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-10-10 21:35:41 +00:00
|
|
|
// Want to set the routing layers so that it switches properly -
|
|
|
|
// see the implementation of Other_Layer_Route - the working
|
|
|
|
// layer is used to 'start' the via and set the layer masks appropriately.
|
2010-01-24 02:05:07 +00:00
|
|
|
GetScreen()->m_Route_Layer_TOP = curLayer;
|
2008-04-29 16:22:39 +00:00
|
|
|
GetScreen()->m_Route_Layer_BOTTOM = layer;
|
2010-01-24 02:05:07 +00:00
|
|
|
|
|
|
|
setActiveLayer( curLayer );
|
2008-02-01 21:30:45 +00:00
|
|
|
|
2007-12-14 22:31:45 +00:00
|
|
|
if( Other_Layer_Route( (TRACK*) GetScreen()->GetCurItem(), DC ) )
|
|
|
|
{
|
|
|
|
if( DisplayOpt.ContrastModeDisplay )
|
2011-02-21 21:07:00 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-12-14 22:31:45 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-12-14 22:31:45 +00:00
|
|
|
// if the via was allowed by DRC, then the layer swap has already
|
2008-02-01 21:30:45 +00:00
|
|
|
// been done by Other_Layer_Route(). if via not allowed, then
|
2010-01-24 02:05:07 +00:00
|
|
|
// return now so assignment to setActiveLayer() below doesn't happen.
|
2007-12-14 22:31:45 +00:00
|
|
|
return;
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
}
|
2007-10-10 21:35:41 +00:00
|
|
|
}
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Is yet more checking required? E.g. when the layer to be selected
|
|
|
|
// is a non-copper layer, or when switching between a copper layer
|
|
|
|
// and a non-copper layer, or vice-versa?
|
|
|
|
// ...
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2010-01-24 02:05:07 +00:00
|
|
|
setActiveLayer( layer );
|
2007-10-10 21:35:41 +00:00
|
|
|
|
|
|
|
if( DisplayOpt.ContrastModeDisplay )
|
2011-02-21 21:07:00 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-06-11 21:21:00 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
|
|
|
int id = aEvent.GetId();
|
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == id )
|
2011-02-21 13:54:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
|
|
|
|
|
|
|
// 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(), wxEmptyString );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TRACK_BUTT:
|
|
|
|
if( Drc_On )
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) );
|
|
|
|
else
|
|
|
|
SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
|
|
|
|
|
|
|
|
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
|
|
|
{
|
|
|
|
Compile_Ratsnest( &dc, true );
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_MODULE_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add module" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_ZONES_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add zones" ) );
|
|
|
|
|
|
|
|
if( DisplayOpt.DisplayZonesMode != 0 )
|
|
|
|
DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
|
|
|
|
|
2011-04-05 17:49:14 +00:00
|
|
|
if( !GetBoard()->IsHightLightNetON() &&
|
|
|
|
(GetBoard()->GetHightLightNetCode() > 0 ) )
|
2011-02-21 13:54:29 +00:00
|
|
|
High_Light( &dc );
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_MIRE_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add layer alignment target" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust zero" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_PLACE_GRID_COORD_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_ADD_LINE_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic line" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_ARC_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic arc" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_CIRCLE_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic circle" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_ADD_TEXT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_COMPONENT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Add module" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_DIMENSION_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add dimension" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_DELETE_ITEM_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_HIGHLIGHT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Highlight net" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
|
|
|
|
|
|
|
|
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
|
|
|
|
Compile_Ratsnest( &dc, true );
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|