2007-08-04 00:56:53 +00:00
|
|
|
/******************************************************/
|
|
|
|
/* edit.cpp: fonctions generales de l'edition du PCB */
|
|
|
|
/******************************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "pcbnew.h"
|
|
|
|
#include "autorout.h"
|
|
|
|
|
|
|
|
#include "id.h"
|
|
|
|
#include "protos.h"
|
2007-08-14 19:24:48 +00:00
|
|
|
|
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
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
static void Process_Move_Item( WinEDA_PcbFrame* frame,
|
|
|
|
EDA_BaseStruct* DrawStruct, wxDC* DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/*********************************************************************/
|
2007-08-04 00:56:53 +00:00
|
|
|
void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
/*********************************************************************/
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Traite les selections d'outils et les commandes appelees du menu POPUP
|
2007-08-04 00:56:53 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-04 00:56:53 +00:00
|
|
|
int id = event.GetId();
|
|
|
|
wxPoint pos;
|
|
|
|
int itmp;
|
|
|
|
wxClientDC dc( DrawPanel );
|
|
|
|
|
|
|
|
DrawPanel->CursorOff( &dc );
|
|
|
|
DrawPanel->PrepareGraphicContext( &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_AUX_TOOLBAR_PCB_TRACK_WIDTH:
|
|
|
|
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
|
|
|
|
case ID_ON_GRID_SELECT:
|
|
|
|
case ID_ON_ZOOM_SELECT:
|
|
|
|
case ID_PCB_USER_GRID_SETUP:
|
|
|
|
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
|
|
|
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:
|
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_SELECT_WIDTH:
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
|
|
|
|
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH1:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH2:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH3:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH4:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH5:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH6:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH7:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH8:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE1:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE2:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE3:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE4:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE5:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE6:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE7:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE8:
|
|
|
|
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:
|
|
|
|
case ID_POPUP_INVERT_BLOCK:
|
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
|
|
|
case ID_POPUP_PCB_VIA_EDITING:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_TO_VALUE:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_EXPORT:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
|
|
|
if( DrawPanel->ManageCurseur
|
|
|
|
&& DrawPanel->ForceCloseManageCurseur )
|
|
|
|
{
|
|
|
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
|
|
|
}
|
2007-09-29 13:31:10 +00:00
|
|
|
/* Should not be executed, just in case */
|
2008-04-17 16:25:29 +00:00
|
|
|
if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
|
|
|
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
|
|
|
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
if( m_ID_current_state == 0 )
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
|
|
|
else
|
|
|
|
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
|
|
|
|
break;
|
|
|
|
|
2007-09-29 13:31:10 +00:00
|
|
|
default: // Finish (abort ) the command
|
2007-08-04 00:56:53 +00:00
|
|
|
if( DrawPanel->ManageCurseur
|
|
|
|
&& DrawPanel->ForceCloseManageCurseur )
|
|
|
|
{
|
|
|
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
|
|
|
}
|
2007-10-29 15:51:48 +00:00
|
|
|
|
2007-10-12 13:56:22 +00:00
|
|
|
if( m_ID_current_state != id )
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
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
|
|
|
{
|
|
|
|
case ID_EXIT:
|
|
|
|
Close( TRUE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
m_ModuleEditFrame =
|
2007-08-08 03:50:44 +00:00
|
|
|
new WinEDA_ModuleEditFrame( this,
|
2008-12-08 15:27:13 +00:00
|
|
|
_( "Module Editor" ),
|
|
|
|
wxPoint( -1, -1 ),
|
|
|
|
wxSize( 600, 400 ) );
|
|
|
|
m_ModuleEditFrame->Show( TRUE );
|
|
|
|
m_ModuleEditFrame->Zoom_Automatique( TRUE );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
else
|
2008-12-08 15:27:13 +00:00
|
|
|
m_ModuleEditFrame->Iconize( FALSE );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NEW_PROJECT:
|
|
|
|
case ID_LOAD_PROJECT:
|
|
|
|
Files_io( event );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_GLOBAL_DELETE:
|
|
|
|
InstallPcbGlobalDeleteFrame( pos );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
|
|
|
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
|
|
|
HandleBlockPlace( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
|
|
|
HandleBlockPlace( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->BlockLocate.SetMessageBlock( this );
|
|
|
|
GetScreen()->BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_INVERT_BLOCK:
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_UNDO_BUTT:
|
|
|
|
UnDeleteItem( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_DRC_CONTROL:
|
|
|
|
Install_Test_DRC_Frame( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_GET_NETLIST:
|
|
|
|
InstallNetlistFrame( &dc, wxPoint( -1, -1 ) );
|
|
|
|
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_TRACK_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Tracks" ) );
|
|
|
|
DisplayTrackSettings();
|
|
|
|
if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
|
|
|
|
{
|
|
|
|
Compile_Ratsnest( &dc, TRUE );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_ZONES_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Zones" ) );
|
2008-12-12 21:30:07 +00:00
|
|
|
if( DisplayOpt.DisplayZonesMode != 0 )
|
2007-08-04 00:56:53 +00:00
|
|
|
DisplayInfo( this, _( "Warning: Display Zone is OFF!!!" ) );
|
|
|
|
if( !g_HightLigt_Status && (g_HightLigth_NetCode > 0 ) )
|
|
|
|
Hight_Light( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_MIRE_BUTT:
|
2007-10-10 14:08:26 +00:00
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Layer Alignment Target" ) );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Zero" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_LINE_COMMENT_BUTT:
|
|
|
|
case ID_PCB_ARC_BUTT:
|
|
|
|
case ID_PCB_CIRCLE_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Graphic" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TEXT_COMMENT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_COMPONENT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Add Modules" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_COTATION_BUTT:
|
2007-10-12 13:56:22 +00:00
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Dimension" ) );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NO_SELECT_BUTT:
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_HIGHLIGHT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Net Highlight" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Local Ratsnest" ) );
|
|
|
|
if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
|
|
|
|
Compile_Ratsnest( &dc, TRUE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_END_LINE:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2007-08-08 03:50:44 +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() );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
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() );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
break;
|
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_NET:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2007-10-13 06:18:44 +00:00
|
|
|
Edit_Net_Width( &dc, ( (TRACK*) GetCurItem() )->GetNet() );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE:
|
|
|
|
case ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE:
|
|
|
|
case ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
{
|
|
|
|
bool resize_vias = TRUE, resize_track = TRUE;
|
|
|
|
if( id == ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE )
|
|
|
|
resize_track = FALSE;
|
|
|
|
if( id == ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE )
|
|
|
|
resize_vias = FALSE;
|
|
|
|
if( Resize_Pistes_Vias( &dc, resize_track, resize_vias ) )
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
}
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_END_TRACK:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
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:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem()->m_Flags & IS_DRAGGED )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
PlaceDraggedTrackSegment( (TRACK*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-01-12 20:31:56 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_MICROVIA:
|
2008-12-08 15:27:13 +00:00
|
|
|
if( !( (PCB_SCREEN*) GetScreen() )->IsMicroViaAcceptable() )
|
2008-04-01 05:21:50 +00:00
|
|
|
break;
|
2008-02-01 21:30:45 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_VIA:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem()->m_Flags & IS_DRAGGED )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
PlaceDraggedTrackSegment( (TRACK*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-02-01 21:30:45 +00:00
|
|
|
int v_type = g_DesignSettings.m_CurrentViaType;
|
|
|
|
if( id == ID_POPUP_PCB_PLACE_MICROVIA )
|
|
|
|
g_DesignSettings.m_CurrentViaType = VIA_MICROVIA; // place micro via and switch layer
|
2007-09-12 02:14:07 +00:00
|
|
|
Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
|
2008-02-01 21:30:45 +00:00
|
|
|
g_DesignSettings.m_CurrentViaType = v_type;
|
2007-08-04 00:56:53 +00:00
|
|
|
if( DisplayOpt.ContrastModeDisplay )
|
2008-12-08 15:27:13 +00:00
|
|
|
( (PCB_SCREEN*) GetScreen() )->SetRefreshReq();
|
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;
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) );
|
2007-08-04 00:56:53 +00:00
|
|
|
GetScreen()->SetModify();
|
|
|
|
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;
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Track( &dc, (TRACK*) GetCurItem() );
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
GetScreen()->SetModify();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TRACKNET:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_net( &dc, (TRACK*) GetCurItem() );
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
GetScreen()->SetModify();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
|
2007-09-12 02:14:07 +00:00
|
|
|
Attribut_Segment( (TRACK*) GetCurItem(), &dc, TRUE );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_TRACKSEG:
|
2007-09-12 02:14:07 +00:00
|
|
|
Attribut_Segment( (TRACK*) GetCurItem(), &dc, FALSE );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_TRACK:
|
2007-09-12 02:14:07 +00:00
|
|
|
Attribut_Track( (TRACK*) GetCurItem(), &dc, TRUE );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_TRACK:
|
2007-09-12 02:14:07 +00:00
|
|
|
Attribut_Track( (TRACK*) GetCurItem(), &dc, FALSE );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_NET:
|
2007-10-13 06:18:44 +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:
|
2007-10-13 06:18:44 +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:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2008-01-05 13:37:51 +00:00
|
|
|
Delete_Zone_Fill( &dc, (SEGZONE*) GetCurItem() );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
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:
|
2008-01-04 12:27:16 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
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:
|
2008-01-04 12:27:16 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
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:
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-02-01 21:30:45 +00:00
|
|
|
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
2007-12-29 19:15:58 +00:00
|
|
|
SetCurItem( NULL );
|
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:
|
|
|
|
{
|
2007-12-29 19:15:58 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-02-01 21:30:45 +00:00
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
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:
|
|
|
|
{
|
2008-01-16 20:37:50 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-02-01 21:30:45 +00:00
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
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:
|
|
|
|
{
|
2007-12-29 19:15:58 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-02-01 21:30:45 +00:00
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
|
|
|
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:
|
|
|
|
{
|
2007-12-29 19:15:58 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-02-01 21:30:45 +00:00
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
|
|
|
wxPoint pos = GetScreen()->m_Curseur;
|
|
|
|
|
|
|
|
/* 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 );
|
2008-12-08 15:27:13 +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 );
|
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:
|
|
|
|
{
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
|
|
|
End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-12-30 18:20:51 +00:00
|
|
|
case ID_POPUP_PCB_FILL_ALL_ZONES:
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-12-08 15:27:13 +00:00
|
|
|
Fill_All_Zones();
|
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();
|
2008-11-18 18:13:55 +00:00
|
|
|
zone_container->m_FilledPolysList.clear();
|
2008-12-08 15:27:13 +00:00
|
|
|
test_1_net_connexion( NULL, zone_container->GetNet() );
|
2008-10-29 15:26:53 +00:00
|
|
|
GetScreen()->SetModify();
|
|
|
|
DrawPanel->Refresh();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
|
2008-12-04 04:28:11 +00:00
|
|
|
m_Pcb->m_Zone.DeleteAll();
|
2008-10-11 19:27:43 +00:00
|
|
|
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
|
|
|
{
|
|
|
|
ZONE_CONTAINER* zone_container = m_Pcb->GetArea( ii );
|
|
|
|
zone_container->m_FilledPolysList.clear();;
|
|
|
|
}
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2008-11-18 18:13:55 +00:00
|
|
|
test_connexions( NULL );
|
2008-11-24 20:46:41 +00:00
|
|
|
Tst_Ratsnest( NULL, 0 ); // Recalculate the active ratsnest, i.e. the unconnected links */
|
2008-10-11 19:27:43 +00:00
|
|
|
GetScreen()->SetModify();
|
|
|
|
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:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-11-18 18:13:55 +00:00
|
|
|
Fill_Zone( NULL, (ZONE_CONTAINER*) GetCurItem() );
|
2008-12-08 15:27:13 +00:00
|
|
|
test_1_net_connexion( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() );
|
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_PCB_DELETE_ITEM_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
|
2007-09-12 02:14:07 +00:00
|
|
|
Process_Move_Item( this, GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
|
|
|
|
g_Drag_Pistes_On = TRUE;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
|
|
|
|
|
|
|
|
// If the current Item is a pad, text module ...: Get the 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() );
|
2008-12-04 04:28:11 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
|
|
|
g_Drag_Pistes_On = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
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() );
|
|
|
|
if( GetCurItem() )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
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_DELETE_MODULE:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
|
|
|
// If the current Item is a pad, text module ...: Get the 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;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
|
|
|
// If the current Item is a pad, text module ...: Get the 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;
|
2007-09-12 02:14:07 +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:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
|
|
|
// If the current Item is a pad, text module ...: Get the 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;
|
2007-09-12 02:14:07 +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:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
|
|
|
// If the current Item is a pad, text module ...: Get the 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() );
|
2008-12-04 04:28:11 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2008-01-25 13:16:24 +00:00
|
|
|
m_Pcb->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
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get the 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() );
|
2008-12-04 04:28:11 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2007-09-12 02:14:07 +00:00
|
|
|
InstallModuleOptionsFrame( (MODULE*) GetCurItem(), &dc, pos );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DRAG_PAD_REQUEST:
|
|
|
|
g_Drag_Pistes_On = TRUE;
|
2007-10-07 18:24:15 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
StartMovePad( (D_PAD*) GetCurItem(), &dc );
|
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_PAD_REQUEST:
|
2007-10-07 18:24:15 +00:00
|
|
|
g_Drag_Pistes_On = false;
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
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:
|
2007-09-12 02:14:07 +00:00
|
|
|
InstallPadOptionsFrame( (D_PAD*) GetCurItem(), &dc, pos );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
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:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
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:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
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:
|
2007-09-12 02:14:07 +00:00
|
|
|
DeletePad( (D_PAD*) GetCurItem(), &dc );
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTMODULE:
|
2007-09-12 02:14:07 +00:00
|
|
|
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetCurItem(), &dc, pos );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
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 );
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TEXTMODULE:
|
2007-10-01 15:37:42 +00:00
|
|
|
DeleteTextModule( (TEXTE_MODULE*) GetCurItem(), &dc );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_LAYER:
|
2008-12-08 15:27:13 +00:00
|
|
|
itmp = SelectLayer(
|
|
|
|
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer, -1, -1 );
|
2007-08-04 00:56:53 +00:00
|
|
|
if( itmp >= 0 )
|
2008-12-08 15:27:13 +00:00
|
|
|
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
|
|
|
|
SelectLayerPair();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
|
2008-12-08 15:27:13 +00:00
|
|
|
itmp = SelectLayer(
|
|
|
|
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer,
|
|
|
|
FIRST_NO_COPPER_LAYER,
|
|
|
|
-1 );
|
2007-08-04 00:56:53 +00:00
|
|
|
if( itmp >= 0 )
|
2008-12-08 15:27:13 +00:00
|
|
|
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_CU_LAYER:
|
2008-12-08 15:27:13 +00:00
|
|
|
itmp = SelectLayer(
|
|
|
|
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer, -1,
|
|
|
|
LAST_COPPER_LAYER );
|
2007-08-04 00:56:53 +00:00
|
|
|
if( itmp >= 0 )
|
2008-12-08 15:27:13 +00:00
|
|
|
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_LAYER_PAIR:
|
|
|
|
SelectLayerPair();
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
|
|
|
itmp = m_SelLayerBox->GetChoice();
|
2008-12-08 15:27:13 +00:00
|
|
|
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer =
|
|
|
|
(int) ( (size_t) m_SelLayerBox->GetClientData( itmp ) );
|
2007-08-04 00:56:53 +00:00
|
|
|
if( DisplayOpt.ContrastModeDisplay )
|
|
|
|
DrawPanel->Refresh( TRUE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTEPCB:
|
2008-12-20 17:28:25 +00:00
|
|
|
InstallTextPCBOptionsFrame( (TEXTE_PCB*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
|
2007-09-12 02:14:07 +00:00
|
|
|
Rotate_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TEXTEPCB:
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_MIRE_REQUEST:
|
2007-09-12 02:14:07 +00:00
|
|
|
StartMove_Mire( (MIREPCB*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_MIRE:
|
2007-09-12 02:14:07 +00:00
|
|
|
InstallMireOptionsFrame( (MIREPCB*) GetCurItem(), &dc, pos );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_MIRE:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Mire( (MIREPCB*) GetCurItem(), &dc );
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_COTATION:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Cotation( (COTATION*) GetCurItem(), &dc );
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_COTATION:
|
2007-09-12 02:14:07 +00:00
|
|
|
Install_Edit_Cotation( (COTATION*) GetCurItem(), &dc, pos );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_DRAWING:
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Segment_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_MARKER:
|
|
|
|
RemoveStruct( GetCurItem(), &dc );
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Drawings_All_Layer( (DRAWSEGMENT*) GetCurItem(), &dc );
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_DRAWING:
|
2007-09-12 02:14:07 +00:00
|
|
|
Drawing_SetNewWidth( (DRAWSEGMENT*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_DRAWING_REQUEST:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
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:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-01-23 08:01:38 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
|
2007-08-04 00:56:53 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
|
|
|
|
{
|
|
|
|
int ii = m_SelTrackWidthBox->GetChoice();
|
2008-12-08 15:27:13 +00:00
|
|
|
g_DesignSettings.m_CurrentTrackWidth =
|
|
|
|
g_DesignSettings.m_TrackWidthHistory[ii];
|
2007-08-04 00:56:53 +00:00
|
|
|
DisplayTrackSettings();
|
|
|
|
m_SelTrackWidthBox_Changed = FALSE;
|
|
|
|
m_SelViaSizeBox_Changed = FALSE;
|
2008-02-01 21:30:45 +00:00
|
|
|
g_DesignSettings.m_UseConnectedTrackWidth = false;
|
|
|
|
}
|
2008-12-08 15:27:13 +00:00
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH1:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH2:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH3:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH4:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH5:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH6:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH7:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH8:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-02-01 21:30:45 +00:00
|
|
|
g_DesignSettings.m_UseConnectedTrackWidth = false;
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
|
|
|
int ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
|
2008-12-08 15:27:13 +00:00
|
|
|
g_DesignSettings.m_CurrentTrackWidth =
|
|
|
|
g_DesignSettings.m_TrackWidthHistory[ii];
|
2007-08-04 00:56:53 +00:00
|
|
|
DisplayTrackSettings();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
|
2008-12-08 15:27:13 +00:00
|
|
|
g_DesignSettings.m_UseConnectedTrackWidth =
|
|
|
|
not g_DesignSettings.m_UseConnectedTrackWidth;
|
2008-02-01 21:30:45 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
|
2008-01-28 18:44:14 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-02-01 21:30:45 +00:00
|
|
|
g_DesignSettings.m_UseConnectedTrackWidth = true;
|
2008-01-28 18:44:14 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
|
|
|
|
{
|
|
|
|
int ii = m_SelViaSizeBox->GetChoice();
|
2008-12-08 15:27:13 +00:00
|
|
|
g_DesignSettings.m_CurrentViaSize =
|
|
|
|
g_DesignSettings.m_ViaSizeHistory[ii];
|
2007-08-04 00:56:53 +00:00
|
|
|
DisplayTrackSettings();
|
|
|
|
m_SelTrackWidthBox_Changed = FALSE;
|
|
|
|
m_SelViaSizeBox_Changed = FALSE;
|
|
|
|
}
|
2008-12-08 15:27:13 +00:00
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE1:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE2:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE3:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE4:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE5:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE6:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE7:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE8:
|
|
|
|
case ID_POPUP_PCB_VIA_EDITING:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_TO_VALUE:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_EXPORT:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT:
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS:
|
2007-08-20 01:20:48 +00:00
|
|
|
Via_Edit_Control( &dc, id, (SEGVIA*) GetScreen()->GetCurItem() );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-08-20 01:20:48 +00:00
|
|
|
Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(),
|
2007-08-04 00:56:53 +00:00
|
|
|
&dc, id );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
|
|
|
|
case ID_POPUP_PCB_MOVE_TRACK_NODE:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-08-20 01:20:48 +00:00
|
|
|
Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(),
|
2007-08-04 00:56:53 +00:00
|
|
|
&dc, id );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-08-20 01:20:48 +00:00
|
|
|
Start_DragTrackSegmentAndKeepSlope( (TRACK*) GetScreen()->GetCurItem(),
|
2007-08-04 00:56:53 +00:00
|
|
|
&dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_BREAK_TRACK:
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
TRACK* track = (TRACK*) GetScreen()->GetCurItem();
|
2007-08-04 00:56:53 +00:00
|
|
|
wxPoint pos = GetScreen()->m_Curseur;
|
|
|
|
track->Draw( DrawPanel, &dc, GR_XOR );
|
|
|
|
TRACK* newtrack = CreateLockPoint( &pos.x, &pos.y, track, NULL );
|
|
|
|
track->Draw( DrawPanel, &dc, GR_XOR );
|
|
|
|
newtrack->Draw( DrawPanel, &dc, GR_XOR );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MENU_PCB_CLEAN:
|
|
|
|
Clean_Pcb( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MENU_PCB_SWAP_LAYERS:
|
|
|
|
Swap_Layers( event );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER:
|
|
|
|
GlobalRoute( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA:
|
|
|
|
ReadAutoroutedTracks( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_USER_GRID_SETUP:
|
|
|
|
InstallGridFrame( pos );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC:
|
|
|
|
{
|
|
|
|
wxString msg = FindKicadHelpPath();
|
2008-12-08 15:27:13 +00:00
|
|
|
msg += wxGetApp().m_EDA_CommonConfig->Read( wxT( "module_doc_file" ),
|
2007-10-29 15:51:48 +00:00
|
|
|
wxT( "pcbnew/footprints.pdf" ) );
|
2007-08-04 00:56:53 +00:00
|
|
|
GetAssociatedDocument( this, wxEmptyString, msg );
|
|
|
|
}
|
2008-12-08 15:27:13 +00:00
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_MENU_ARCHIVE_NEW_MODULES:
|
|
|
|
Archive_Modules( wxEmptyString, TRUE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MENU_ARCHIVE_ALL_MODULES:
|
|
|
|
Archive_Modules( wxEmptyString, FALSE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2008-12-08 15:27:13 +00:00
|
|
|
DisplayError( this,
|
|
|
|
wxT( "WinEDA_PcbFrame::Process_Special_Functions() id error" ) );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetToolbars();
|
|
|
|
DrawPanel->CursorOn( &dc );
|
|
|
|
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
2007-08-04 00:56:53 +00:00
|
|
|
static void Process_Move_Item( WinEDA_PcbFrame* frame,
|
|
|
|
EDA_BaseStruct* DrawStruct, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
/****************************************************************/
|
|
|
|
{
|
2007-08-04 00:56:53 +00:00
|
|
|
if( DrawStruct == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
frame->DrawPanel->MouseToCursorSchema();
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DrawStruct->Type() )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE:
|
2007-08-04 00:56:53 +00:00
|
|
|
frame->StartMoveTextePcb( (TEXTE_PCB*) DrawStruct, DC );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf(
|
|
|
|
wxT( "WinEDA_PcbFrame::Move_Item Error: Bad DrawType %d" ),
|
2007-09-01 12:00:30 +00:00
|
|
|
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
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/***************************************************************/
|
2007-10-29 15:51:48 +00:00
|
|
|
void WinEDA_PcbFrame::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;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_COTATION:
|
2007-08-04 00:56:53 +00:00
|
|
|
Delete_Cotation( (COTATION*) Item, DC );
|
|
|
|
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:
|
2008-01-05 13:37:51 +00:00
|
|
|
Delete_Zone_Fill( DC, (SEGZONE*) Item );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MARKER:
|
2007-10-29 15:51:48 +00:00
|
|
|
if( Item == GetCurItem() )
|
|
|
|
SetCurItem( NULL );
|
2007-11-27 22:49:35 +00:00
|
|
|
( (MARKER*) Item )->Draw( DrawPanel, DC, GR_XOR );
|
2007-10-29 15:51:48 +00:00
|
|
|
|
2007-11-27 22:49:35 +00:00
|
|
|
// delete the marker, and free memory. Don't use undelete stack.
|
|
|
|
m_Pcb->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_EQUIPOT:
|
|
|
|
case TYPE_PCB:
|
2007-08-04 00:56:53 +00:00
|
|
|
default:
|
|
|
|
{
|
|
|
|
wxString Line;
|
|
|
|
Line.Printf( wxT( "Remove: StructType %d Inattendu" ),
|
2007-10-01 15:37:42 +00:00
|
|
|
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
|
|
|
|
2007-06-11 21:21:00 +00:00
|
|
|
/****************************************************************/
|
2007-08-04 00:56:53 +00:00
|
|
|
void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
|
2007-06-11 21:21:00 +00:00
|
|
|
/*****************************************************************/
|
|
|
|
{
|
2008-04-29 16:22:39 +00:00
|
|
|
int preslayer = GetScreen()->m_Active_Layer;
|
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
|
|
|
|
if( layer == preslayer )
|
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.
|
2007-11-01 05:27:31 +00:00
|
|
|
if( (layer >= FIRST_COPPER_LAYER) && (layer <= LAST_COPPER_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
|
|
|
|
// that can be selected to is the "Copper" layer (so the
|
|
|
|
// selection of any other copper layer is disregarded).
|
|
|
|
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 )
|
|
|
|
{
|
|
|
|
if( layer != COPPER_LAYER_N )
|
|
|
|
{
|
|
|
|
// 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
|
|
|
|
{
|
|
|
|
if( (layer != COPPER_LAYER_N) && (layer != LAYER_CMP_N)
|
2007-10-29 15:51:48 +00:00
|
|
|
&& (layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
EDA_BaseStruct* 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?
|
2007-08-04 00:56:53 +00:00
|
|
|
if( m_ID_current_state == ID_TRACK_BUTT && current != NULL )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
if( current->Type() == TYPE_TRACK && (current->m_Flags & IS_NEW) )
|
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.
|
2008-04-29 16:22:39 +00:00
|
|
|
GetScreen()->m_Route_Layer_TOP = preslayer;
|
|
|
|
GetScreen()->m_Route_Layer_BOTTOM = layer;
|
|
|
|
GetScreen()->m_Active_Layer = preslayer;
|
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 )
|
|
|
|
GetScreen()->SetRefreshReq();
|
|
|
|
}
|
2008-02-01 21:30:45 +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
|
2007-12-14 22:31:45 +00:00
|
|
|
// return now so assignment to m_Active_Layer below doesn't happen.
|
|
|
|
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
|
|
|
|
2008-04-29 16:22:39 +00:00
|
|
|
GetScreen()->m_Active_Layer = layer;
|
2007-10-10 21:35:41 +00:00
|
|
|
|
|
|
|
if( DisplayOpt.ContrastModeDisplay )
|
|
|
|
GetScreen()->SetRefreshReq();
|
2007-06-11 21:21:00 +00:00
|
|
|
}
|