Commit 72f7cb16 authored by dickelbeck's avatar dickelbeck

beautified

parent 97898b92
/******************************************************/ /******************************************************/
/* edit.cpp: fonctions generales de l'edition du PCB */ /* edit.cpp: fonctions generales de l'edition du PCB */
/******************************************************/ /******************************************************/
#include "fctsys.h" #include "fctsys.h"
...@@ -17,1362 +17,1413 @@ ...@@ -17,1362 +17,1413 @@
#define CURRENT_ITEM (GetScreen()->m_CurrentItem) #define CURRENT_ITEM (GetScreen()->m_CurrentItem)
static void Process_Move_Item(WinEDA_PcbFrame * frame, static void Process_Move_Item( WinEDA_PcbFrame* frame,
EDA_BaseStruct *DrawStruct, wxDC * DC); EDA_BaseStruct* DrawStruct, wxDC* DC );
/********************************************************************/ /********************************************************************/
void WinEDA_PcbFrame::OnLeftClick(wxDC * DC, const wxPoint& MousePos) void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/********************************************************************/ /********************************************************************/
/* Traite les commandes declench�e par le bouton gauche de la souris, /* Traite les commandes declench�e par le bouton gauche de la souris,
quand un outil est deja selectionn� * quand un outil est deja selectionn�
*/ */
{ {
EDA_BaseStruct * DrawStruct = CURRENT_ITEM; EDA_BaseStruct* DrawStruct = CURRENT_ITEM;
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
DrawPanel->CursorOff(DC); DrawPanel->CursorOff( DC );
if ( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags )) if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{ {
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
if ( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours
{ {
switch (DrawStruct->m_StructType ) switch( DrawStruct->m_StructType )
{ {
case TYPETRACK: case TYPETRACK:
case TYPEVIA: case TYPEVIA:
if ( CURRENT_ITEM->m_Flags & IS_DRAGGED ) if( CURRENT_ITEM->m_Flags & IS_DRAGGED )
{ {
PlaceDraggedTrackSegment((TRACK *)DrawStruct, DC); PlaceDraggedTrackSegment( (TRACK*) DrawStruct, DC );
goto out; goto out;
} }
break; break;
case TYPETEXTE: case TYPETEXTE:
Place_Texte_Pcb((TEXTE_PCB *)DrawStruct, DC); Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
goto out; goto out;
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
PlaceTexteModule( (TEXTE_MODULE *) DrawStruct, DC); PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC );
goto out; goto out;
break; break;
case TYPEPAD: case TYPEPAD:
PlacePad((D_PAD *)DrawStruct, DC); PlacePad( (D_PAD*) DrawStruct, DC );
goto out; goto out;
break; break;
case TYPEMODULE: case TYPEMODULE:
Place_Module((MODULE *)DrawStruct, DC); Place_Module( (MODULE*) DrawStruct, DC );
goto out; goto out;
break; break;
case TYPEMIRE: case TYPEMIRE:
Place_Mire((MIREPCB *)DrawStruct, DC); Place_Mire( (MIREPCB*) DrawStruct, DC );
goto out; goto out;
break; break;
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
if (m_ID_current_state == 0) if( m_ID_current_state == 0 )
{ {
Place_DrawItem( (DRAWSEGMENT * )DrawStruct, DC); Place_DrawItem( (DRAWSEGMENT*) DrawStruct, DC );
goto out; goto out;
} }
break; break;
default: default:
if (m_ID_current_state == 0) if( m_ID_current_state == 0 )
{ {
DisplayError(this, DisplayError( this,
wxT("WinEDA_PcbFrame::OnLeftClick() err: m_Flags != 0") ); wxT( "WinEDA_PcbFrame::OnLeftClick() err: m_Flags != 0" ) );
goto out; goto out;
} }
} }
} }
else else
{ {
DrawStruct = PcbGeneralLocateAndDisplay(); DrawStruct = PcbGeneralLocateAndDisplay();
} }
} }
switch ( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_MAIN_MENUBAR: case ID_MAIN_MENUBAR:
case 0: case 0:
break; break;
case ID_NO_SELECT_BUTT: case ID_NO_SELECT_BUTT:
break; break;
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
case ID_PCB_MUWAVE_TOOL_SELF_CMD: case ID_PCB_MUWAVE_TOOL_GAP_CMD:
case ID_PCB_MUWAVE_TOOL_GAP_CMD: case ID_PCB_MUWAVE_TOOL_STUB_CMD:
case ID_PCB_MUWAVE_TOOL_STUB_CMD: case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD: case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD: MuWaveCommand( DC, MousePos );
MuWaveCommand(DC, MousePos); break;
break;
case ID_PCB_HIGHLIGHT_BUTT:
{
case ID_PCB_HIGHLIGHT_BUTT: int netcode = Select_High_Light( DC );
{ if( netcode < 0 )
int netcode = Select_High_Light(DC); Affiche_Infos_Status_Pcb( this );
if ( netcode < 0 ) Affiche_Infos_Status_Pcb(this); else
else Affiche_Infos_Equipot(netcode, this); Affiche_Infos_Equipot( netcode, this );
} }
break; break;
case ID_PCB_SHOW_1_RATSNEST_BUTT: case ID_PCB_SHOW_1_RATSNEST_BUTT:
DrawStruct = PcbGeneralLocateAndDisplay(); DrawStruct = PcbGeneralLocateAndDisplay();
Show_1_Ratsnest(DrawStruct, DC); Show_1_Ratsnest( DrawStruct, DC );
break; break;
case ID_PCB_MIRE_BUTT: case ID_PCB_MIRE_BUTT:
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->m_CurrentItem = Create_Mire( DC ); GetScreen()->m_CurrentItem = Create_Mire( DC );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
} }
else if (DrawStruct->m_StructType == TYPEMIRE ) else if( DrawStruct->m_StructType == TYPEMIRE )
{ {
Place_Mire((MIREPCB *)DrawStruct, DC); Place_Mire( (MIREPCB*) DrawStruct, DC );
} }
else DisplayError(this, wxT("Internal err: Struct not TYPEMIRE")); else
break; DisplayError( this, wxT( "Internal err: Struct not TYPEMIRE" ) );
break;
case ID_PCB_CIRCLE_BUTT:
case ID_PCB_ARC_BUTT: case ID_PCB_CIRCLE_BUTT:
case ID_LINE_COMMENT_BUTT: case ID_PCB_ARC_BUTT:
{ case ID_LINE_COMMENT_BUTT:
int shape = S_SEGMENT; {
if ( m_ID_current_state == ID_PCB_CIRCLE_BUTT) shape = S_CIRCLE; int shape = S_SEGMENT;
if ( m_ID_current_state == ID_PCB_ARC_BUTT) shape = S_ARC; if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
shape = S_CIRCLE;
if ( GetScreen()->m_Active_Layer <= CMP_N ) if( m_ID_current_state == ID_PCB_ARC_BUTT )
{ shape = S_ARC;
DisplayError(this, _("Graphic not autorized on Copper layers"));
break; if( GetScreen()->m_Active_Layer <= CMP_N )
} {
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) DisplayError( this, _( "Graphic not autorized on Copper layers" ) );
{ break;
GetScreen()->m_CurrentItem = DrawStruct = }
Begin_DrawSegment(NULL, shape, DC); if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
DrawPanel->m_AutoPAN_Request = TRUE; {
} GetScreen()->m_CurrentItem = DrawStruct =
else if (DrawStruct && Begin_DrawSegment( NULL, shape, DC );
(DrawStruct->m_StructType == TYPEDRAWSEGMENT) && DrawPanel->m_AutoPAN_Request = TRUE;
(DrawStruct->m_Flags & IS_NEW) ) }
{ else if( DrawStruct
GetScreen()->m_CurrentItem = DrawStruct = && (DrawStruct->m_StructType == TYPEDRAWSEGMENT)
Begin_DrawSegment((DRAWSEGMENT *)DrawStruct, shape, DC); && (DrawStruct->m_Flags & IS_NEW) )
DrawPanel->m_AutoPAN_Request = TRUE; {
} GetScreen()->m_CurrentItem = DrawStruct =
break; Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape,
} DC );
DrawPanel->m_AutoPAN_Request = TRUE;
case ID_TRACK_BUTT: }
if ( GetScreen()->m_Active_Layer > CMP_N ) break;
{ }
DisplayError(this, _("Tracks on Copper layers only "));
break; case ID_TRACK_BUTT:
} if( GetScreen()->m_Active_Layer > CMP_N )
{
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) DisplayError( this, _( "Tracks on Copper layers only " ) );
{ break;
GetScreen()->m_CurrentItem = DrawStruct = }
Begin_Route(NULL, DC);
if ( DrawStruct ) DrawPanel->m_AutoPAN_Request = TRUE; if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
} {
else if (DrawStruct && GetScreen()->m_CurrentItem = DrawStruct =
Begin_Route( NULL, DC );
if( DrawStruct )
DrawPanel->m_AutoPAN_Request = TRUE;
}
else if( DrawStruct &&
// (DrawStruct->m_StructType == TYPETRACK) && // (DrawStruct->m_StructType == TYPETRACK) &&
(DrawStruct->m_Flags & IS_NEW) ) (DrawStruct->m_Flags & IS_NEW) )
{ {
TRACK * track = Begin_Route((TRACK *) DrawStruct, DC); TRACK* track = Begin_Route( (TRACK*) DrawStruct, DC );
if ( track ) // c'est a dire si OK if( track ) // c'est a dire si OK
GetScreen()->m_CurrentItem = DrawStruct = track; GetScreen()->m_CurrentItem = DrawStruct = track;
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
break; break;
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->m_CurrentItem = DrawStruct = GetScreen()->m_CurrentItem = DrawStruct =
Begin_Zone(); Begin_Zone();
} }
else if (DrawStruct && else if( DrawStruct
(DrawStruct->m_StructType == TYPEEDGEZONE) && && (DrawStruct->m_StructType == TYPEEDGEZONE)
(DrawStruct->m_Flags & IS_NEW) ) && (DrawStruct->m_Flags & IS_NEW) )
{ {
GetScreen()->m_CurrentItem = DrawStruct = GetScreen()->m_CurrentItem = DrawStruct =
Begin_Zone(); Begin_Zone();
} }
else DisplayError(this, wxT("Edit: zone internal error")); else
break; DisplayError( this, wxT( "Edit: zone internal error" ) );
break;
case ID_TEXT_COMMENT_BUTT:
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) case ID_TEXT_COMMENT_BUTT:
{ if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
GetScreen()->m_CurrentItem = Create_Texte_Pcb( DC ); {
DrawPanel->MouseToCursorSchema(); GetScreen()->m_CurrentItem = Create_Texte_Pcb( DC );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->MouseToCursorSchema();
} DrawPanel->m_AutoPAN_Request = TRUE;
else if (DrawStruct->m_StructType == TYPETEXTE ) }
{ else if( DrawStruct->m_StructType == TYPETEXTE )
Place_Texte_Pcb((TEXTE_PCB *)DrawStruct, DC); {
DrawPanel->m_AutoPAN_Request = FALSE; Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
} DrawPanel->m_AutoPAN_Request = FALSE;
else DisplayError(this, wxT("Internal err: Struct not TYPETEXTE")); }
break; else
DisplayError( this, wxT( "Internal err: Struct not TYPETEXTE" ) );
case ID_COMPONENT_BUTT: break;
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ case ID_COMPONENT_BUTT:
DrawPanel->MouseToCursorSchema(); if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
GetScreen()->m_CurrentItem = DrawStruct = {
Load_Module_From_Library(wxEmptyString, DC); DrawPanel->MouseToCursorSchema();
if ( DrawStruct ) GetScreen()->m_CurrentItem = DrawStruct =
StartMove_Module((MODULE *)DrawStruct, DC); Load_Module_From_Library( wxEmptyString, DC );
} if( DrawStruct )
else if (DrawStruct->m_StructType == TYPEMODULE ) StartMove_Module( (MODULE*) DrawStruct, DC );
{ }
Place_Module((MODULE *)DrawStruct, DC); else if( DrawStruct->m_StructType == TYPEMODULE )
DrawPanel->m_AutoPAN_Request = FALSE; {
} Place_Module( (MODULE*) DrawStruct, DC );
else DisplayError(this, wxT("Internal err: Struct not TYPEMODULE")); DrawPanel->m_AutoPAN_Request = FALSE;
break; }
else
case ID_PCB_COTATION_BUTT: DisplayError( this, wxT( "Internal err: Struct not TYPEMODULE" ) );
if ( GetScreen()->m_Active_Layer <= CMP_N ) break;
{
DisplayError(this, _("Cotation not autorized on Copper layers")); case ID_PCB_COTATION_BUTT:
break; if( GetScreen()->m_Active_Layer <= CMP_N )
} {
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) DisplayError( this, _( "Cotation not autorized on Copper layers" ) );
{ break;
GetScreen()->m_CurrentItem = DrawStruct = }
Begin_Cotation(NULL, DC); if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
DrawPanel->m_AutoPAN_Request = TRUE; {
} GetScreen()->m_CurrentItem = DrawStruct =
else if (DrawStruct && Begin_Cotation( NULL, DC );
(DrawStruct->m_StructType == TYPECOTATION) && DrawPanel->m_AutoPAN_Request = TRUE;
(DrawStruct->m_Flags & IS_NEW) ) }
{ else if( DrawStruct
GetScreen()->m_CurrentItem = DrawStruct = && (DrawStruct->m_StructType == TYPECOTATION)
Begin_Cotation((COTATION * )DrawStruct, DC); && (DrawStruct->m_Flags & IS_NEW) )
DrawPanel->m_AutoPAN_Request = TRUE; {
} GetScreen()->m_CurrentItem = DrawStruct =
else DisplayError(this, wxT("Internal err: Struct not COTATION")); Begin_Cotation( (COTATION*) DrawStruct, DC );
break; DrawPanel->m_AutoPAN_Request = TRUE;
}
case ID_PCB_DELETE_ITEM_BUTT: else
if ( !DrawStruct || (DrawStruct->m_Flags == 0) ) DisplayError( this, wxT( "Internal err: Struct not COTATION" ) );
{ break;
DrawStruct = PcbGeneralLocateAndDisplay();
if ( DrawStruct && (DrawStruct->m_Flags == 0) ) case ID_PCB_DELETE_ITEM_BUTT:
{ if( !DrawStruct || (DrawStruct->m_Flags == 0) )
RemoveStruct(DrawStruct, DC); {
GetScreen()->m_CurrentItem = DrawStruct = NULL; DrawStruct = PcbGeneralLocateAndDisplay();
} if( DrawStruct && (DrawStruct->m_Flags == 0) )
} {
break; RemoveStruct( DrawStruct, DC );
GetScreen()->m_CurrentItem = DrawStruct = NULL;
case ID_PCB_PLACE_OFFSET_COORD_BUTT: }
DrawPanel->m_Draw_Auxiliary_Axis(DC, GR_XOR); }
m_Auxiliary_Axis_Position = GetScreen()->m_Curseur; break;
DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_COPY);
GetScreen()->SetModify(); case ID_PCB_PLACE_OFFSET_COORD_BUTT:
break; DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_XOR );
m_Auxiliary_Axis_Position = GetScreen()->m_Curseur;
default : DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_COPY );
DrawPanel->SetCursor(wxCURSOR_ARROW); GetScreen()->SetModify();
DisplayError(this, wxT("WinEDA_PcbFrame::OnLeftClick() id error")); break;
SetToolID(0, wxCURSOR_ARROW,wxEmptyString);
break; default:
} DrawPanel->SetCursor( wxCURSOR_ARROW );
out: DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() id error" ) );
DrawPanel->m_IgnoreMouseEvents = FALSE; SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
DrawPanel->CursorOn(DC); break;
}
out:
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->CursorOn( DC );
} }
/*********************************************************************/ /*********************************************************************/
void WinEDA_PcbFrame::Process_Special_Functions(wxCommandEvent& event) void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
/*********************************************************************/ /*********************************************************************/
/* Traite les selections d'outils et les commandes appelees du menu POPUP /* Traite les selections d'outils et les commandes appelees du menu POPUP
*/ */
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
wxClientDC dc(DrawPanel); int itmp;
int itmp; wxClientDC dc( DrawPanel );
DrawPanel->CursorOff(&dc); DrawPanel->CursorOff( &dc );
DrawPanel->PrepareGraphicContext(&dc); DrawPanel->PrepareGraphicContext( &dc );
wxGetMousePosition(&pos.x, &pos.y); wxGetMousePosition( &pos.x, &pos.y );
pos.y += 20; pos.y += 20;
switch ( id ) // Arret eventuel de la commande de d�placement en cours switch( id ) // Arret eventuel de la commande de d�placement en cours
{ {
case wxID_CUT: case wxID_CUT:
case wxID_COPY: case wxID_COPY:
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH: case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
case ID_AUX_TOOLBAR_PCB_VIA_SIZE: case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
case ID_ON_GRID_SELECT: case ID_ON_GRID_SELECT:
case ID_ON_ZOOM_SELECT: case ID_ON_ZOOM_SELECT:
case ID_PCB_USER_GRID_SETUP: case ID_PCB_USER_GRID_SETUP:
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
case ID_POPUP_PCB_ROTATE_TEXTEPCB: case ID_POPUP_PCB_ROTATE_TEXTEPCB:
case ID_POPUP_PCB_EDIT_TEXTEPCB: case ID_POPUP_PCB_EDIT_TEXTEPCB:
case ID_POPUP_PCB_EDIT_MIRE: case ID_POPUP_PCB_EDIT_MIRE:
case ID_POPUP_PCB_ROTATE_TEXTMODULE: case ID_POPUP_PCB_ROTATE_TEXTMODULE:
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE: case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE: case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
case ID_POPUP_PCB_CHANGE_SIDE_MODULE: case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
case ID_POPUP_PCB_EDIT_MODULE: case ID_POPUP_PCB_EDIT_MODULE:
case ID_POPUP_PCB_EDIT_TEXTMODULE: case ID_POPUP_PCB_EDIT_TEXTMODULE:
case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
case ID_POPUP_PCB_END_TRACK: case ID_POPUP_PCB_END_TRACK:
case ID_POPUP_PCB_PLACE_VIA: case ID_POPUP_PCB_PLACE_VIA:
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS: case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE: case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
case ID_POPUP_PCB_DELETE_EDGE_ZONE: case ID_POPUP_PCB_DELETE_EDGE_ZONE:
case ID_POPUP_PCB_DELETE_ZONE_LIMIT: case ID_POPUP_PCB_DELETE_ZONE_LIMIT:
case ID_POPUP_PCB_EDIT_ZONE: case ID_POPUP_PCB_EDIT_ZONE:
case ID_POPUP_PCB_DELETE_ZONE: case ID_POPUP_PCB_DELETE_ZONE:
case ID_POPUP_PCB_DELETE_TRACKSEG: case ID_POPUP_PCB_DELETE_TRACKSEG:
case ID_POPUP_PCB_DELETE_TRACK: case ID_POPUP_PCB_DELETE_TRACK:
case ID_POPUP_PCB_DELETE_TRACKNET: case ID_POPUP_PCB_DELETE_TRACKNET:
case ID_POPUP_PCB_FILL_ZONE: case ID_POPUP_PCB_FILL_ZONE:
case ID_POPUP_PCB_SELECT_NET_ZONE: case ID_POPUP_PCB_SELECT_NET_ZONE:
case ID_POPUP_PCB_SELECT_LAYER: case ID_POPUP_PCB_SELECT_LAYER:
case ID_POPUP_PCB_SELECT_CU_LAYER: case ID_POPUP_PCB_SELECT_CU_LAYER:
case ID_POPUP_PCB_SELECT_LAYER_PAIR: case ID_POPUP_PCB_SELECT_LAYER_PAIR:
case ID_POPUP_PCB_SELECT_NO_CU_LAYER: case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
case ID_POPUP_PCB_SELECT_WIDTH: case ID_POPUP_PCB_SELECT_WIDTH:
case ID_POPUP_PCB_SELECT_WIDTH1: case ID_POPUP_PCB_SELECT_WIDTH1:
case ID_POPUP_PCB_SELECT_WIDTH2: case ID_POPUP_PCB_SELECT_WIDTH2:
case ID_POPUP_PCB_SELECT_WIDTH3: case ID_POPUP_PCB_SELECT_WIDTH3:
case ID_POPUP_PCB_SELECT_WIDTH4: case ID_POPUP_PCB_SELECT_WIDTH4:
case ID_POPUP_PCB_SELECT_WIDTH5: case ID_POPUP_PCB_SELECT_WIDTH5:
case ID_POPUP_PCB_SELECT_WIDTH6: case ID_POPUP_PCB_SELECT_WIDTH6:
case ID_POPUP_PCB_SELECT_WIDTH7: case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_WIDTH8: case ID_POPUP_PCB_SELECT_WIDTH8:
case ID_POPUP_PCB_SELECT_VIASIZE: case ID_POPUP_PCB_SELECT_VIASIZE:
case ID_POPUP_PCB_SELECT_VIASIZE1: case ID_POPUP_PCB_SELECT_VIASIZE1:
case ID_POPUP_PCB_SELECT_VIASIZE2: case ID_POPUP_PCB_SELECT_VIASIZE2:
case ID_POPUP_PCB_SELECT_VIASIZE3: case ID_POPUP_PCB_SELECT_VIASIZE3:
case ID_POPUP_PCB_SELECT_VIASIZE4: case ID_POPUP_PCB_SELECT_VIASIZE4:
case ID_POPUP_PCB_SELECT_VIASIZE5: case ID_POPUP_PCB_SELECT_VIASIZE5:
case ID_POPUP_PCB_SELECT_VIASIZE6: case ID_POPUP_PCB_SELECT_VIASIZE6:
case ID_POPUP_PCB_SELECT_VIASIZE7: case ID_POPUP_PCB_SELECT_VIASIZE7:
case ID_POPUP_PCB_SELECT_VIASIZE8: case ID_POPUP_PCB_SELECT_VIASIZE8:
case ID_POPUP_PCB_MOVE_TRACK_NODE: case ID_POPUP_PCB_MOVE_TRACK_NODE:
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE: case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE: case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE:
case ID_POPUP_PCB_BREAK_TRACK: case ID_POPUP_PCB_BREAK_TRACK:
case ID_POPUP_PCB_EDIT_NET: case ID_POPUP_PCB_EDIT_NET:
case ID_POPUP_PCB_EDIT_TRACK: case ID_POPUP_PCB_EDIT_TRACK:
case ID_POPUP_PCB_EDIT_TRACKSEG: case ID_POPUP_PCB_EDIT_TRACKSEG:
case ID_POPUP_PCB_LOCK_ON_TRACKSEG: case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
case ID_POPUP_PCB_LOCK_OFF_TRACKSEG: case ID_POPUP_PCB_LOCK_OFF_TRACKSEG:
case ID_POPUP_PCB_LOCK_ON_TRACK: case ID_POPUP_PCB_LOCK_ON_TRACK:
case ID_POPUP_PCB_LOCK_OFF_TRACK: case ID_POPUP_PCB_LOCK_OFF_TRACK:
case ID_POPUP_PCB_LOCK_ON_NET: case ID_POPUP_PCB_LOCK_ON_NET:
case ID_POPUP_PCB_LOCK_OFF_NET: case ID_POPUP_PCB_LOCK_OFF_NET:
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_INVERT_BLOCK:
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
case ID_POPUP_PCB_VIA_EDITING: case ID_POPUP_PCB_VIA_EDITING:
case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT: case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT:
case ID_POPUP_PCB_VIA_HOLE_TO_VALUE: case ID_POPUP_PCB_VIA_HOLE_TO_VALUE:
case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE: case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE:
case ID_POPUP_PCB_VIA_HOLE_EXPORT: case ID_POPUP_PCB_VIA_HOLE_EXPORT:
case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT: case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT:
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS: case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS:
break; break;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( DrawPanel->ManageCurseur && if( DrawPanel->ManageCurseur
DrawPanel->ForceCloseManageCurseur ) && DrawPanel->ForceCloseManageCurseur )
{ {
DrawPanel->ForceCloseManageCurseur(DrawPanel, &dc); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
/* ne devrait pas etre execute, sauf bug */ /* ne devrait pas etre execute, sauf bug */
if (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE) if( m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE )
{ {
m_CurrentScreen->BlockLocate.m_Command = BLOCK_IDLE; m_CurrentScreen->BlockLocate.m_Command = BLOCK_IDLE;
m_CurrentScreen->BlockLocate.m_State = STATE_NO_BLOCK; m_CurrentScreen->BlockLocate.m_State = STATE_NO_BLOCK;
m_CurrentScreen->BlockLocate.m_BlockDrawStruct = NULL; m_CurrentScreen->BlockLocate.m_BlockDrawStruct = NULL;
} }
if (m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
SetToolID(0, wxCURSOR_ARROW,wxEmptyString); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
else SetCursor(DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor); else
break; SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
break;
default: // Arret de la commande de d�placement en cours
if( DrawPanel->ManageCurseur && default: // Arret de la commande de d�placement en cours
DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->ManageCurseur
{ && DrawPanel->ForceCloseManageCurseur )
DrawPanel->ForceCloseManageCurseur(DrawPanel, &dc); {
} DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
SetToolID(0, wxCURSOR_ARROW,wxEmptyString); }
break; SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
} break;
}
switch ( id ) // Traitement des commandes
{ switch( id ) // Traitement des commandes
case ID_EXIT : {
Close(TRUE); case ID_EXIT:
break; Close( TRUE );
break;
case ID_OPEN_MODULE_EDITOR:
if (m_Parent->m_ModuleEditFrame == NULL ) case ID_OPEN_MODULE_EDITOR:
{ if( m_Parent->m_ModuleEditFrame == NULL )
m_Parent->m_ModuleEditFrame = new WinEDA_ModuleEditFrame(this, {
m_Parent,_("Module Editor"), m_Parent->m_ModuleEditFrame = new WinEDA_ModuleEditFrame( this,
wxPoint(-1, -1), wxSize(600,400) ); m_Parent, _( "Module Editor" ),
m_Parent->m_ModuleEditFrame->Show(TRUE); wxPoint( -1,
m_Parent->m_ModuleEditFrame->Zoom_Automatique(TRUE); -1 ),
} wxSize( 600, 400 ) );
else m_Parent->m_ModuleEditFrame->Iconize(FALSE); m_Parent->m_ModuleEditFrame->Show( TRUE );
break; m_Parent->m_ModuleEditFrame->Zoom_Automatique( TRUE );
}
case ID_NEW_PROJECT: else
case ID_LOAD_PROJECT: m_Parent->m_ModuleEditFrame->Iconize( FALSE );
Files_io(event); break;
break;
case ID_NEW_PROJECT:
case ID_PCB_GLOBAL_DELETE: case ID_LOAD_PROJECT:
InstallPcbGlobalDeleteFrame(pos); Files_io( event );
break; break;
case ID_POPUP_PLACE_BLOCK: case ID_PCB_GLOBAL_DELETE:
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE; InstallPcbGlobalDeleteFrame( pos );
DrawPanel->m_AutoPAN_Request = FALSE; break;
HandleBlockPlace(&dc);
break; case ID_POPUP_PLACE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
case ID_POPUP_COPY_BLOCK: DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->BlockLocate.m_Command = BLOCK_COPY; HandleBlockPlace( &dc );
m_CurrentScreen->BlockLocate.SetMessageBlock(this); break;
DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockPlace(&dc); case ID_POPUP_COPY_BLOCK:
break; GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
m_CurrentScreen->BlockLocate.SetMessageBlock( this );
case ID_POPUP_ZOOM_BLOCK: DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; HandleBlockPlace( &dc );
m_CurrentScreen->BlockLocate.SetMessageBlock(this); break;
m_CurrentScreen->BlockLocate.SetMessageBlock(this);
HandleBlockEnd(&dc); case ID_POPUP_ZOOM_BLOCK:
break; GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
m_CurrentScreen->BlockLocate.SetMessageBlock( this );
case ID_POPUP_DELETE_BLOCK: m_CurrentScreen->BlockLocate.SetMessageBlock( this );
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; HandleBlockEnd( &dc );
m_CurrentScreen->BlockLocate.SetMessageBlock(this); break;
HandleBlockEnd(&dc);
break; case ID_POPUP_DELETE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
case ID_POPUP_ROTATE_BLOCK: m_CurrentScreen->BlockLocate.SetMessageBlock( this );
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE; HandleBlockEnd( &dc );
m_CurrentScreen->BlockLocate.SetMessageBlock(this); break;
HandleBlockEnd(&dc);
break; case ID_POPUP_ROTATE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
case ID_POPUP_INVERT_BLOCK: m_CurrentScreen->BlockLocate.SetMessageBlock( this );
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT; HandleBlockEnd( &dc );
m_CurrentScreen->BlockLocate.SetMessageBlock(this); break;
HandleBlockEnd(&dc);
break; case ID_POPUP_INVERT_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
case ID_UNDO_BUTT: m_CurrentScreen->BlockLocate.SetMessageBlock( this );
UnDeleteItem(&dc); HandleBlockEnd( &dc );
break; break;
case ID_DRC_CONTROL: case ID_UNDO_BUTT:
Install_Test_DRC_Frame(&dc); UnDeleteItem( &dc );
break; break;
case ID_GET_NETLIST: case ID_DRC_CONTROL:
InstallNetlistFrame(&dc, wxPoint(-1,-1)); Install_Test_DRC_Frame( &dc );
break; break;
case ID_GET_TOOLS: case ID_GET_NETLIST:
// InstallToolsFrame(this, wxPoint(-1,-1) ); InstallNetlistFrame( &dc, wxPoint( -1, -1 ) );
break; break;
case ID_FIND_ITEMS: case ID_GET_TOOLS:
InstallFindFrame(pos, &dc);
break; // InstalloolsFrame(this, wxPoint(-1,-1) );
break;
case ID_TRACK_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _("Add Tracks")); case ID_FIND_ITEMS:
DisplayTrackSettings(); InstallFindFrame( pos, &dc );
if ( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0) break;
{
Compile_Ratsnest( &dc, TRUE ); case ID_TRACK_BUTT:
} SetToolID( id, wxCURSOR_PENCIL, _( "Add Tracks" ) );
break; DisplayTrackSettings();
if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
case ID_PCB_ZONES_BUTT: {
SetToolID( id, wxCURSOR_PENCIL, _("Add Zones")); Compile_Ratsnest( &dc, TRUE );
if ( ! DisplayOpt.DisplayZones ) }
DisplayInfo(this, _("Warning: Display Zone is OFF!!!") ); break;
DelLimitesZone(&dc, TRUE);
if( ! g_HightLigt_Status && (g_HightLigth_NetCode > 0 ) ) case ID_PCB_ZONES_BUTT:
Hight_Light(&dc); SetToolID( id, wxCURSOR_PENCIL, _( "Add Zones" ) );
break; if( !DisplayOpt.DisplayZones )
DisplayInfo( this, _( "Warning: Display Zone is OFF!!!" ) );
case ID_PCB_MIRE_BUTT: DelLimitesZone( &dc, TRUE );
SetToolID( id, wxCURSOR_PENCIL, _("Add Mire")); if( !g_HightLigt_Status && (g_HightLigth_NetCode > 0 ) )
break; Hight_Light( &dc );
break;
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _("Adjust Zero")); case ID_PCB_MIRE_BUTT:
break; SetToolID( id, wxCURSOR_PENCIL, _( "Add Mire" ) );
break;
case ID_LINE_COMMENT_BUTT:
case ID_PCB_ARC_BUTT: case ID_PCB_PLACE_OFFSET_COORD_BUTT:
case ID_PCB_CIRCLE_BUTT: SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Zero" ) );
SetToolID( id, wxCURSOR_PENCIL, _("Add Graphic")); break;
break;
case ID_LINE_COMMENT_BUTT:
case ID_TEXT_COMMENT_BUTT: case ID_PCB_ARC_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _("Add Text")); case ID_PCB_CIRCLE_BUTT:
break; SetToolID( id, wxCURSOR_PENCIL, _( "Add Graphic" ) );
break;
case ID_COMPONENT_BUTT:
SetToolID( id, wxCURSOR_HAND, _("Add Modules")); case ID_TEXT_COMMENT_BUTT:
break; SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
break;
case ID_PCB_COTATION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _("Add Cotation")); case ID_COMPONENT_BUTT:
break; SetToolID( id, wxCURSOR_HAND, _( "Add Modules" ) );
break;
case ID_NO_SELECT_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString); case ID_PCB_COTATION_BUTT:
break; SetToolID( id, wxCURSOR_PENCIL, _( "Add Cotation" ) );
break;
case ID_PCB_HIGHLIGHT_BUTT:
SetToolID( id, wxCURSOR_HAND, _("Net Highlight")); case ID_NO_SELECT_BUTT:
break; SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_PCB_SHOW_1_RATSNEST_BUTT:
SetToolID( id, wxCURSOR_HAND, _("Local Ratsnest")); case ID_PCB_HIGHLIGHT_BUTT:
if ( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0) SetToolID( id, wxCURSOR_HAND, _( "Net Highlight" ) );
Compile_Ratsnest( &dc, TRUE ); break;
break;
case ID_PCB_SHOW_1_RATSNEST_BUTT:
case ID_POPUP_CLOSE_CURRENT_TOOL: SetToolID( id, wxCURSOR_HAND, _( "Local Ratsnest" ) );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString); if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
break; Compile_Ratsnest( &dc, TRUE );
break;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CLOSE_CURRENT_TOOL:
break; SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_POPUP_END_LINE:
DrawPanel->MouseToCursorSchema(); case ID_POPUP_CANCEL_CURRENT_COMMAND:
break;
case ID_POPUP_END_LINE:
DrawPanel->MouseToCursorSchema();
// EndSegment(&dc); // EndSegment(&dc);
break; break;
case ID_POPUP_PCB_EDIT_TRACK: case ID_POPUP_PCB_EDIT_TRACK:
if ( CURRENT_ITEM == NULL) break; if( CURRENT_ITEM == NULL )
Edit_Track_Width(&dc, (TRACK *) CURRENT_ITEM); break;
DrawPanel->MouseToCursorSchema(); Edit_Track_Width( &dc, (TRACK*) CURRENT_ITEM );
GetScreen()->SetModify(); DrawPanel->MouseToCursorSchema();
break; GetScreen()->SetModify();
break;
case ID_POPUP_PCB_EDIT_TRACKSEG:
if ( CURRENT_ITEM == NULL) break; case ID_POPUP_PCB_EDIT_TRACKSEG:
Edit_TrackSegm_Width(&dc, (TRACK *) CURRENT_ITEM); if( CURRENT_ITEM == NULL )
DrawPanel->MouseToCursorSchema(); break;
GetScreen()->SetModify(); Edit_TrackSegm_Width( &dc, (TRACK*) CURRENT_ITEM );
break; DrawPanel->MouseToCursorSchema();
GetScreen()->SetModify();
case ID_POPUP_PCB_EDIT_NET: break;
if ( CURRENT_ITEM == NULL) break;
Edit_Net_Width(&dc, ((TRACK *) CURRENT_ITEM)->m_NetCode); case ID_POPUP_PCB_EDIT_NET:
DrawPanel->MouseToCursorSchema(); if( CURRENT_ITEM == NULL )
GetScreen()->SetModify(); break;
break; Edit_Net_Width( &dc, ( (TRACK*) CURRENT_ITEM )->m_NetCode );
DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE: GetScreen()->SetModify();
case ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE: break;
case ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE:
if ( CURRENT_ITEM == NULL) break; case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE:
{ case ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE:
bool resize_vias = TRUE, resize_track = TRUE; case ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE:
if( id == ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE) resize_track = FALSE; if( CURRENT_ITEM == NULL )
if( id == ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE) resize_vias = FALSE; break;
if ( Resize_Pistes_Vias(&dc, resize_track, resize_vias)) GetScreen()->SetModify(); {
} bool resize_vias = TRUE, resize_track = TRUE;
DrawPanel->MouseToCursorSchema(); if( id == ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE )
break; resize_track = FALSE;
if( id == ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE )
case ID_POPUP_PCB_END_TRACK: resize_vias = FALSE;
DrawPanel->MouseToCursorSchema(); if( Resize_Pistes_Vias( &dc, resize_track, resize_vias ) )
End_Route( (TRACK *) CURRENT_ITEM, &dc); GetScreen()->SetModify();
break; }
DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE: break;
DrawPanel->MouseToCursorSchema();
if ( CURRENT_ITEM->m_Flags & IS_DRAGGED ) case ID_POPUP_PCB_END_TRACK:
{ DrawPanel->MouseToCursorSchema();
PlaceDraggedTrackSegment((TRACK *) CURRENT_ITEM, &dc); End_Route( (TRACK*) CURRENT_ITEM, &dc );
} break;
break;
case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE:
case ID_POPUP_PCB_PLACE_VIA: DrawPanel->MouseToCursorSchema();
DrawPanel->MouseToCursorSchema(); if( CURRENT_ITEM->m_Flags & IS_DRAGGED )
if ( CURRENT_ITEM->m_Flags & IS_DRAGGED ) {
{ PlaceDraggedTrackSegment( (TRACK*) CURRENT_ITEM, &dc );
PlaceDraggedTrackSegment((TRACK *) CURRENT_ITEM, &dc); }
} break;
else
{ case ID_POPUP_PCB_PLACE_VIA:
Other_Layer_Route( (TRACK *) CURRENT_ITEM, &dc); DrawPanel->MouseToCursorSchema();
if ( DisplayOpt.ContrastModeDisplay ) if( CURRENT_ITEM->m_Flags & IS_DRAGGED )
GetScreen()->SetRefreshReq(); {
} PlaceDraggedTrackSegment( (TRACK*) CURRENT_ITEM, &dc );
break; }
else
{
case ID_POPUP_PCB_DELETE_TRACKSEG: Other_Layer_Route( (TRACK*) CURRENT_ITEM, &dc );
if ( CURRENT_ITEM == NULL) break; if( DisplayOpt.ContrastModeDisplay )
DrawPanel->MouseToCursorSchema(); GetScreen()->SetRefreshReq();
GetScreen()->m_CurrentItem = Delete_Segment(&dc, (TRACK*)CURRENT_ITEM); }
GetScreen()->SetModify(); break;
break;
case ID_POPUP_PCB_DELETE_TRACKSEG:
case ID_POPUP_PCB_DELETE_TRACK: if( CURRENT_ITEM == NULL )
if ( CURRENT_ITEM == NULL) break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Delete_Track(&dc, (TRACK*)CURRENT_ITEM); GetScreen()->m_CurrentItem = Delete_Segment( &dc, (TRACK*) CURRENT_ITEM );
GetScreen()->m_CurrentItem = NULL; GetScreen()->SetModify();
GetScreen()->SetModify(); break;
break;
case ID_POPUP_PCB_DELETE_TRACK:
case ID_POPUP_PCB_DELETE_TRACKNET: if( CURRENT_ITEM == NULL )
DrawPanel->MouseToCursorSchema(); break;
Delete_net(&dc, (TRACK*)CURRENT_ITEM); DrawPanel->MouseToCursorSchema();
GetScreen()->m_CurrentItem = NULL; Delete_Track( &dc, (TRACK*) CURRENT_ITEM );
GetScreen()->SetModify(); GetScreen()->m_CurrentItem = NULL;
break; GetScreen()->SetModify();
break;
case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
Attribut_Segment((TRACK*)CURRENT_ITEM, &dc, TRUE); case ID_POPUP_PCB_DELETE_TRACKNET:
break; DrawPanel->MouseToCursorSchema();
Delete_net( &dc, (TRACK*) CURRENT_ITEM );
case ID_POPUP_PCB_LOCK_OFF_TRACKSEG: GetScreen()->m_CurrentItem = NULL;
Attribut_Segment((TRACK*)CURRENT_ITEM, &dc, FALSE); GetScreen()->SetModify();
break; break;
case ID_POPUP_PCB_LOCK_ON_TRACK: case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
Attribut_Track((TRACK*)CURRENT_ITEM, &dc, TRUE); Attribut_Segment( (TRACK*) CURRENT_ITEM, &dc, TRUE );
break; break;
case ID_POPUP_PCB_LOCK_OFF_TRACK: case ID_POPUP_PCB_LOCK_OFF_TRACKSEG:
Attribut_Track((TRACK*)CURRENT_ITEM, &dc, FALSE); Attribut_Segment( (TRACK*) CURRENT_ITEM, &dc, FALSE );
break; break;
case ID_POPUP_PCB_LOCK_ON_NET: case ID_POPUP_PCB_LOCK_ON_TRACK:
Attribut_net(&dc, ((TRACK*)CURRENT_ITEM)->m_NetCode, TRUE); Attribut_Track( (TRACK*) CURRENT_ITEM, &dc, TRUE );
break; break;
case ID_POPUP_PCB_LOCK_OFF_NET: case ID_POPUP_PCB_LOCK_OFF_TRACK:
Attribut_net(&dc, ((TRACK*)CURRENT_ITEM)->m_NetCode, FALSE); Attribut_Track( (TRACK*) CURRENT_ITEM, &dc, FALSE );
break; break;
case ID_POPUP_PCB_SETFLAGS_TRACK_MNU: case ID_POPUP_PCB_LOCK_ON_NET:
break; Attribut_net( &dc, ( (TRACK*) CURRENT_ITEM )->m_NetCode, TRUE );
break;
case ID_POPUP_PCB_DELETE_ZONE:
DrawPanel->MouseToCursorSchema(); case ID_POPUP_PCB_LOCK_OFF_NET:
if ( CURRENT_ITEM == NULL) break; Attribut_net( &dc, ( (TRACK*) CURRENT_ITEM )->m_NetCode, FALSE );
Delete_Zone(&dc, (SEGZONE*)CURRENT_ITEM); break;
GetScreen()->m_CurrentItem = NULL;
break; case ID_POPUP_PCB_SETFLAGS_TRACK_MNU:
break;
case ID_POPUP_PCB_EDIT_ZONE:
DrawPanel->MouseToCursorSchema(); case ID_POPUP_PCB_DELETE_ZONE:
if ( CURRENT_ITEM == NULL) break; DrawPanel->MouseToCursorSchema();
Edit_Zone_Width(&dc, (SEGZONE*)CURRENT_ITEM); if( CURRENT_ITEM == NULL )
break; break;
Delete_Zone( &dc, (SEGZONE*) CURRENT_ITEM );
case ID_POPUP_PCB_DELETE_ZONE_LIMIT: GetScreen()->m_CurrentItem = NULL;
DrawPanel->MouseToCursorSchema(); break;
DelLimitesZone(&dc, TRUE);
break; case ID_POPUP_PCB_EDIT_ZONE:
DrawPanel->MouseToCursorSchema();
case ID_PCB_DELETE_ITEM_BUTT: if( CURRENT_ITEM == NULL )
SetToolID( id, wxCURSOR_BULLSEYE, _("Delete item")); break;
break; Edit_Zone_Width( &dc, (SEGZONE*) CURRENT_ITEM );
break;
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
Process_Move_Item(this, CURRENT_ITEM, &dc); case ID_POPUP_PCB_DELETE_ZONE_LIMIT:
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->MouseToCursorSchema();
break; DelLimitesZone( &dc, TRUE );
break;
case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
g_Drag_Pistes_On = TRUE; case ID_PCB_DELETE_ITEM_BUTT:
case ID_POPUP_PCB_MOVE_MODULE_REQUEST: SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
// If the current Item is a pad, text module ...: Get the parent break;
if ( CURRENT_ITEM->m_StructType != TYPEMODULE )
CURRENT_ITEM = (MODULE *) CURRENT_ITEM->m_Parent; case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
if ( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE ) Process_Move_Item( this, CURRENT_ITEM, &dc );
{ DrawPanel->m_AutoPAN_Request = TRUE;
g_Drag_Pistes_On = FALSE; break;
break;
} case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
DrawPanel->MouseToCursorSchema(); g_Drag_Pistes_On = TRUE;
StartMove_Module( (MODULE*)CURRENT_ITEM, &dc);
break; case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: /* get module by name and move it */ // If the current Item is a pad, text module ...: Get the parent
CURRENT_ITEM = GetModuleByName(); if( CURRENT_ITEM->m_StructType != TYPEMODULE )
if ( CURRENT_ITEM ) CURRENT_ITEM = (MODULE*) CURRENT_ITEM->m_Parent;
{ if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE )
DrawPanel->MouseToCursorSchema(); {
StartMove_Module( (MODULE*)CURRENT_ITEM, &dc); g_Drag_Pistes_On = FALSE;
} break;
break; }
DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_DELETE_MODULE: StartMove_Module( (MODULE*) CURRENT_ITEM, &dc );
DrawPanel->MouseToCursorSchema(); break;
// If the current Item is a pad, text module ...: Get the parent
if ( CURRENT_ITEM->m_StructType != TYPEMODULE ) case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: /* get module by name and move it */
CURRENT_ITEM = (MODULE *) CURRENT_ITEM->m_Parent; CURRENT_ITEM = GetModuleByName();
if ( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE ) if( CURRENT_ITEM )
break; {
if ( Delete_Module((MODULE*) CURRENT_ITEM, &dc) ) DrawPanel->MouseToCursorSchema();
{ StartMove_Module( (MODULE*) CURRENT_ITEM, &dc );
GetScreen()->m_CurrentItem = NULL; }
} break;
break;
case ID_POPUP_PCB_DELETE_MODULE:
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE: DrawPanel->MouseToCursorSchema();
DrawPanel->MouseToCursorSchema();
// If the current Item is a pad, text module ...: Get the parent // If the current Item is a pad, text module ...: Get the parent
if ( CURRENT_ITEM->m_StructType != TYPEMODULE ) if( CURRENT_ITEM->m_StructType != TYPEMODULE )
CURRENT_ITEM = (MODULE *) CURRENT_ITEM->m_Parent; CURRENT_ITEM = (MODULE*) CURRENT_ITEM->m_Parent;
if ( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE ) if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE )
break; break;
Rotate_Module(&dc, (MODULE*)CURRENT_ITEM, -900, TRUE); if( Delete_Module( (MODULE*) CURRENT_ITEM, &dc ) )
break; {
GetScreen()->m_CurrentItem = NULL;
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE: }
DrawPanel->MouseToCursorSchema(); break;
// If the current Item is a pad, text module ...: Get the parent
if ( CURRENT_ITEM->m_StructType != TYPEMODULE ) case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
CURRENT_ITEM = (MODULE *) CURRENT_ITEM->m_Parent; DrawPanel->MouseToCursorSchema();
if ( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE )
break; // If the current Item is a pad, text module ...: Get the parent
Rotate_Module(&dc, (MODULE*)CURRENT_ITEM, 900, TRUE); if( CURRENT_ITEM->m_StructType != TYPEMODULE )
break; CURRENT_ITEM = (MODULE*) CURRENT_ITEM->m_Parent;
if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE )
case ID_POPUP_PCB_CHANGE_SIDE_MODULE: break;
DrawPanel->MouseToCursorSchema(); Rotate_Module( &dc, (MODULE*) CURRENT_ITEM, -900, TRUE );
// If the current Item is a pad, text module ...: Get the parent break;
if ( CURRENT_ITEM->m_StructType != TYPEMODULE )
CURRENT_ITEM = (MODULE *) CURRENT_ITEM->m_Parent; case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
if ( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE ) DrawPanel->MouseToCursorSchema();
break;
Change_Side_Module((MODULE *) CURRENT_ITEM, &dc); // If the current Item is a pad, text module ...: Get the parent
break; if( CURRENT_ITEM->m_StructType != TYPEMODULE )
CURRENT_ITEM = (MODULE*) CURRENT_ITEM->m_Parent;
case ID_POPUP_PCB_EDIT_MODULE: if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE )
// If the current Item is a pad, text module ...: Get the parent break;
if ( CURRENT_ITEM->m_StructType != TYPEMODULE ) Rotate_Module( &dc, (MODULE*) CURRENT_ITEM, 900, TRUE );
CURRENT_ITEM = (MODULE *) CURRENT_ITEM->m_Parent; break;
if ( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE )
break; case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
InstallModuleOptionsFrame((MODULE *)CURRENT_ITEM, DrawPanel->MouseToCursorSchema();
&dc, pos);
DrawPanel->MouseToCursorSchema(); // If the current Item is a pad, text module ...: Get the parent
break; if( CURRENT_ITEM->m_StructType != TYPEMODULE )
CURRENT_ITEM = (MODULE*) CURRENT_ITEM->m_Parent;
case ID_POPUP_PCB_DRAG_PAD_REQUEST: if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE )
g_Drag_Pistes_On = TRUE; break;
case ID_POPUP_PCB_MOVE_PAD_REQUEST: Change_Side_Module( (MODULE*) CURRENT_ITEM, &dc );
DrawPanel->MouseToCursorSchema(); break;
StartMovePad((D_PAD *)CURRENT_ITEM, &dc);
break; case ID_POPUP_PCB_EDIT_MODULE:
case ID_POPUP_PCB_EDIT_PAD: // If the current Item is a pad, text module ...: Get the parent
InstallPadOptionsFrame((D_PAD *)CURRENT_ITEM, if( CURRENT_ITEM->m_StructType != TYPEMODULE )
&dc, pos); CURRENT_ITEM = (MODULE*) CURRENT_ITEM->m_Parent;
DrawPanel->MouseToCursorSchema(); if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE )
break; break;
InstallModuleOptionsFrame( (MODULE*) CURRENT_ITEM,
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS: &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Import_Pad_Settings((D_PAD *)CURRENT_ITEM, &dc); break;
break;
case ID_POPUP_PCB_DRAG_PAD_REQUEST:
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: g_Drag_Pistes_On = TRUE;
DrawPanel->MouseToCursorSchema();
Global_Import_Pad_Settings((D_PAD *)CURRENT_ITEM, &dc); case ID_POPUP_PCB_MOVE_PAD_REQUEST:
break; DrawPanel->MouseToCursorSchema();
StartMovePad( (D_PAD*) CURRENT_ITEM, &dc );
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS: break;
DrawPanel->MouseToCursorSchema();
Export_Pad_Settings((D_PAD *)CURRENT_ITEM); case ID_POPUP_PCB_EDIT_PAD:
break; InstallPadOptionsFrame( (D_PAD*) CURRENT_ITEM,
&dc, pos );
DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_DELETE_PAD: break;
DeletePad((D_PAD *)CURRENT_ITEM, &dc);
GetScreen()->m_CurrentItem = NULL; case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; Import_Pad_Settings( (D_PAD*) CURRENT_ITEM, &dc );
break;
case ID_POPUP_PCB_EDIT_TEXTMODULE:
InstallTextModOptionsFrame((TEXTE_MODULE *)CURRENT_ITEM, case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
&dc, pos); DrawPanel->MouseToCursorSchema();
DrawPanel->MouseToCursorSchema(); Global_Import_Pad_Settings( (D_PAD*) CURRENT_ITEM, &dc );
break; break;
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST: case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMoveTexteModule( (TEXTE_MODULE *) CURRENT_ITEM, Export_Pad_Settings( (D_PAD*) CURRENT_ITEM );
&dc); break;
break;
case ID_POPUP_PCB_DELETE_PAD:
case ID_POPUP_PCB_ROTATE_TEXTMODULE: DeletePad( (D_PAD*) CURRENT_ITEM, &dc );
RotateTextModule((TEXTE_MODULE *)CURRENT_ITEM, GetScreen()->m_CurrentItem = NULL;
&dc); DrawPanel->MouseToCursorSchema();
DrawPanel->MouseToCursorSchema(); break;
break;
case ID_POPUP_PCB_EDIT_TEXTMODULE:
case ID_POPUP_PCB_DELETE_TEXTMODULE: InstallTextModOptionsFrame( (TEXTE_MODULE*) CURRENT_ITEM,
DeleteTextModule((TEXTE_MODULE *)CURRENT_ITEM, &dc, pos );
&dc); DrawPanel->MouseToCursorSchema();
GetScreen()->m_CurrentItem = NULL; break;
DrawPanel->MouseToCursorSchema();
break; case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_SELECT_LAYER: StartMoveTexteModule( (TEXTE_MODULE*) CURRENT_ITEM,
itmp = SelectLayer(GetScreen()->m_Active_Layer, -1, -1); &dc );
if ( itmp >= 0 ) GetScreen()->m_Active_Layer = itmp; break;
DrawPanel->MouseToCursorSchema();
break; case ID_POPUP_PCB_ROTATE_TEXTMODULE:
RotateTextModule( (TEXTE_MODULE*) CURRENT_ITEM,
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: &dc );
SelectLayerPair(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_SELECT_NO_CU_LAYER: case ID_POPUP_PCB_DELETE_TEXTMODULE:
itmp = SelectLayer(GetScreen()->m_Active_Layer, CMP_N+1, -1); DeleteTextModule( (TEXTE_MODULE*) CURRENT_ITEM,
if ( itmp >= 0 ) GetScreen()->m_Active_Layer = itmp; &dc );
DrawPanel->MouseToCursorSchema(); GetScreen()->m_CurrentItem = NULL;
break; DrawPanel->MouseToCursorSchema();
break;
case ID_POPUP_PCB_SELECT_CU_LAYER:
itmp = SelectLayer(GetScreen()->m_Active_Layer, -1, CMP_N); case ID_POPUP_PCB_SELECT_LAYER:
if ( itmp >= 0 ) GetScreen()->m_Active_Layer = itmp; itmp = SelectLayer( GetScreen()->m_Active_Layer, -1, -1 );
break; if( itmp >= 0 )
GetScreen()->m_Active_Layer = itmp;
case ID_POPUP_PCB_SELECT_LAYER_PAIR: DrawPanel->MouseToCursorSchema();
SelectLayerPair(); break;
DrawPanel->MouseToCursorSchema();
break; case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
SelectLayerPair();
case ID_TOOLBARH_PCB_SELECT_LAYER: break;
itmp = m_SelLayerBox->GetChoice();
GetScreen()->m_Active_Layer = (int)((size_t) m_SelLayerBox->GetClientData(itmp)); case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
if ( DisplayOpt.ContrastModeDisplay ) DrawPanel->Refresh(TRUE); itmp = SelectLayer( GetScreen()->m_Active_Layer, CMP_N + 1, -1 );
break; if( itmp >= 0 )
GetScreen()->m_Active_Layer = itmp;
case ID_POPUP_PCB_EDIT_TEXTEPCB: DrawPanel->MouseToCursorSchema();
InstallTextPCBOptionsFrame((TEXTE_PCB *)CURRENT_ITEM, break;
&dc, pos);
DrawPanel->MouseToCursorSchema(); case ID_POPUP_PCB_SELECT_CU_LAYER:
break; itmp = SelectLayer( GetScreen()->m_Active_Layer, -1, CMP_N );
if( itmp >= 0 )
case ID_POPUP_PCB_ROTATE_TEXTEPCB: GetScreen()->m_Active_Layer = itmp;
Rotate_Texte_Pcb((TEXTE_PCB *)CURRENT_ITEM, &dc); break;
DrawPanel->MouseToCursorSchema();
break; case ID_POPUP_PCB_SELECT_LAYER_PAIR:
SelectLayerPair();
case ID_POPUP_PCB_DELETE_TEXTEPCB: DrawPanel->MouseToCursorSchema();
Delete_Texte_Pcb((TEXTE_PCB *)CURRENT_ITEM, &dc); break;
DrawPanel->MouseToCursorSchema();
break; case ID_TOOLBARH_PCB_SELECT_LAYER:
itmp = m_SelLayerBox->GetChoice();
case ID_POPUP_PCB_MOVE_MIRE_REQUEST: GetScreen()->m_Active_Layer = (int) ( (size_t) m_SelLayerBox->GetClientData( itmp ) );
StartMove_Mire((MIREPCB *)CURRENT_ITEM, &dc); if( DisplayOpt.ContrastModeDisplay )
DrawPanel->MouseToCursorSchema(); DrawPanel->Refresh( TRUE );
break; break;
case ID_POPUP_PCB_EDIT_MIRE: case ID_POPUP_PCB_EDIT_TEXTEPCB:
InstallMireOptionsFrame((MIREPCB *)CURRENT_ITEM, &dc, pos); InstallTextPCBOptionsFrame( (TEXTE_PCB*) CURRENT_ITEM,
DrawPanel->MouseToCursorSchema(); &dc, pos );
break; DrawPanel->MouseToCursorSchema();
break;
case ID_POPUP_PCB_DELETE_MIRE:
DrawPanel->MouseToCursorSchema(); case ID_POPUP_PCB_ROTATE_TEXTEPCB:
Delete_Mire((MIREPCB *)CURRENT_ITEM, &dc); Rotate_Texte_Pcb( (TEXTE_PCB*) CURRENT_ITEM, &dc );
GetScreen()->m_CurrentItem = NULL; DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_DELETE_COTATION: case ID_POPUP_PCB_DELETE_TEXTEPCB:
DrawPanel->MouseToCursorSchema(); Delete_Texte_Pcb( (TEXTE_PCB*) CURRENT_ITEM, &dc );
Delete_Cotation((COTATION*)CURRENT_ITEM, &dc); DrawPanel->MouseToCursorSchema();
GetScreen()->m_CurrentItem = NULL; break;
break;
case ID_POPUP_PCB_MOVE_MIRE_REQUEST:
case ID_POPUP_PCB_EDIT_COTATION: StartMove_Mire( (MIREPCB*) CURRENT_ITEM, &dc );
Install_Edit_Cotation((COTATION*)CURRENT_ITEM, &dc, pos); DrawPanel->MouseToCursorSchema();
DrawPanel->MouseToCursorSchema(); break;
break;
case ID_POPUP_PCB_EDIT_MIRE:
case ID_POPUP_PCB_DELETE_DRAWING: InstallMireOptionsFrame( (MIREPCB*) CURRENT_ITEM, &dc, pos );
Delete_Segment_Edge((DRAWSEGMENT *)CURRENT_ITEM, &dc); DrawPanel->MouseToCursorSchema();
DrawPanel->MouseToCursorSchema(); break;
break;
case ID_POPUP_PCB_DELETE_MIRE:
case ID_POPUP_PCB_DELETE_DRAWING_LAYER: DrawPanel->MouseToCursorSchema();
Delete_Drawings_All_Layer((DRAWSEGMENT *)CURRENT_ITEM, &dc); Delete_Mire( (MIREPCB*) CURRENT_ITEM, &dc );
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
DrawPanel->MouseToCursorSchema(); break;
break;
case ID_POPUP_PCB_DELETE_COTATION:
case ID_POPUP_PCB_EDIT_DRAWING: DrawPanel->MouseToCursorSchema();
Drawing_SetNewWidth((DRAWSEGMENT *)CURRENT_ITEM, &dc); Delete_Cotation( (COTATION*) CURRENT_ITEM, &dc );
DrawPanel->MouseToCursorSchema(); GetScreen()->m_CurrentItem = NULL;
break; break;
case ID_POPUP_PCB_MOVE_DRAWING_REQUEST: case ID_POPUP_PCB_EDIT_COTATION:
DrawPanel->MouseToCursorSchema(); Install_Edit_Cotation( (COTATION*) CURRENT_ITEM, &dc, pos );
Start_Move_DrawItem((DRAWSEGMENT *)CURRENT_ITEM, &dc); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_DELETE_DRAWING:
DrawPanel->MouseToCursorSchema(); Delete_Segment_Edge( (DRAWSEGMENT*) CURRENT_ITEM, &dc );
if ( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) ) DrawPanel->MouseToCursorSchema();
{ break;
End_Edge( (DRAWSEGMENT *)CURRENT_ITEM, &dc);
GetScreen()->m_CurrentItem = NULL; case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
} Delete_Drawings_All_Layer( (DRAWSEGMENT*) CURRENT_ITEM, &dc );
break; GetScreen()->m_CurrentItem = NULL;
DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE: break;
DrawPanel->MouseToCursorSchema();
if ( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) ) case ID_POPUP_PCB_EDIT_DRAWING:
{ Drawing_SetNewWidth( (DRAWSEGMENT*) CURRENT_ITEM, &dc );
End_Zone(&dc); DrawPanel->MouseToCursorSchema();
GetScreen()->m_CurrentItem = NULL; break;
}
break; case ID_POPUP_PCB_MOVE_DRAWING_REQUEST:
DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_DELETE_EDGE_ZONE: Start_Move_DrawItem( (DRAWSEGMENT*) CURRENT_ITEM, &dc );
DrawPanel->MouseToCursorSchema(); break;
if ( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) )
{ case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
GetScreen()->m_CurrentItem = Del_SegmEdgeZone(&dc, DrawPanel->MouseToCursorSchema();
(EDGE_ZONE *) CURRENT_ITEM); if( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) )
} {
break; End_Edge( (DRAWSEGMENT*) CURRENT_ITEM, &dc );
GetScreen()->m_CurrentItem = NULL;
case ID_POPUP_PCB_FILL_ZONE: }
DrawPanel->MouseToCursorSchema(); break;
Fill_Zone(&dc);
break; case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_SELECT_NET_ZONE: if( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) )
DrawPanel->MouseToCursorSchema(); {
CaptureNetName(&dc); End_Zone( &dc );
break; GetScreen()->m_CurrentItem = NULL;
}
case ID_POPUP_PCB_SELECT_WIDTH: break;
break;
case ID_POPUP_PCB_DELETE_EDGE_ZONE:
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH: DrawPanel->MouseToCursorSchema();
{ if( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) )
int ii = m_SelTrackWidthBox->GetChoice(); {
g_DesignSettings.m_CurrentTrackWidth = g_DesignSettings.m_TrackWidhtHistory[ii]; GetScreen()->m_CurrentItem = Del_SegmEdgeZone( &dc,
DisplayTrackSettings(); (EDGE_ZONE*) CURRENT_ITEM );
m_SelTrackWidthBox_Changed = FALSE; }
m_SelViaSizeBox_Changed = FALSE; break;
}
break; case ID_POPUP_PCB_FILL_ZONE:
case ID_POPUP_PCB_SELECT_WIDTH1: DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_SELECT_WIDTH2: Fill_Zone( &dc );
case ID_POPUP_PCB_SELECT_WIDTH3: break;
case ID_POPUP_PCB_SELECT_WIDTH4:
case ID_POPUP_PCB_SELECT_WIDTH5: case ID_POPUP_PCB_SELECT_NET_ZONE:
case ID_POPUP_PCB_SELECT_WIDTH6: DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_SELECT_WIDTH7: CaptureNetName( &dc );
case ID_POPUP_PCB_SELECT_WIDTH8: break;
DrawPanel->MouseToCursorSchema();
{ case ID_POPUP_PCB_SELECT_WIDTH:
int ii = id - ID_POPUP_PCB_SELECT_WIDTH1; break;
g_DesignSettings.m_CurrentTrackWidth = g_DesignSettings.m_TrackWidhtHistory[ii];
DisplayTrackSettings(); case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
} {
break; int ii = m_SelTrackWidthBox->GetChoice();
g_DesignSettings.m_CurrentTrackWidth = g_DesignSettings.m_TrackWidhtHistory[ii];
case ID_POPUP_PCB_SELECT_VIASIZE: DisplayTrackSettings();
break; m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE;
case ID_AUX_TOOLBAR_PCB_VIA_SIZE: }
{ break;
int ii = m_SelViaSizeBox->GetChoice();
g_DesignSettings.m_CurrentViaSize = g_DesignSettings.m_ViaSizeHistory[ii]; case ID_POPUP_PCB_SELECT_WIDTH1:
DisplayTrackSettings(); case ID_POPUP_PCB_SELECT_WIDTH2:
m_SelTrackWidthBox_Changed = FALSE; case ID_POPUP_PCB_SELECT_WIDTH3:
m_SelViaSizeBox_Changed = FALSE; case ID_POPUP_PCB_SELECT_WIDTH4:
} case ID_POPUP_PCB_SELECT_WIDTH5:
break; case ID_POPUP_PCB_SELECT_WIDTH6:
case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_VIASIZE1: case ID_POPUP_PCB_SELECT_WIDTH8:
case ID_POPUP_PCB_SELECT_VIASIZE2: DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_SELECT_VIASIZE3: {
case ID_POPUP_PCB_SELECT_VIASIZE4: int ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
case ID_POPUP_PCB_SELECT_VIASIZE5: g_DesignSettings.m_CurrentTrackWidth = g_DesignSettings.m_TrackWidhtHistory[ii];
case ID_POPUP_PCB_SELECT_VIASIZE6: DisplayTrackSettings();
case ID_POPUP_PCB_SELECT_VIASIZE7: }
case ID_POPUP_PCB_SELECT_VIASIZE8: break;
case ID_POPUP_PCB_VIA_EDITING:
case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT: case ID_POPUP_PCB_SELECT_VIASIZE:
case ID_POPUP_PCB_VIA_HOLE_TO_VALUE: break;
case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE:
case ID_POPUP_PCB_VIA_HOLE_EXPORT: case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT: {
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS: int ii = m_SelViaSizeBox->GetChoice();
Via_Edit_Control(&dc, id, (SEGVIA *) GetScreen()->m_CurrentItem); g_DesignSettings.m_CurrentViaSize = g_DesignSettings.m_ViaSizeHistory[ii];
break; DisplayTrackSettings();
m_SelTrackWidthBox_Changed = FALSE;
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: m_SelViaSizeBox_Changed = FALSE;
DrawPanel->MouseToCursorSchema(); }
Start_MoveOneNodeOrSegment((TRACK *) GetScreen()->m_CurrentItem, break;
&dc, id);
break; case ID_POPUP_PCB_SELECT_VIASIZE1:
case ID_POPUP_PCB_SELECT_VIASIZE2:
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: case ID_POPUP_PCB_SELECT_VIASIZE3:
case ID_POPUP_PCB_MOVE_TRACK_NODE: case ID_POPUP_PCB_SELECT_VIASIZE4:
DrawPanel->MouseToCursorSchema(); case ID_POPUP_PCB_SELECT_VIASIZE5:
Start_MoveOneNodeOrSegment((TRACK *) GetScreen()->m_CurrentItem, case ID_POPUP_PCB_SELECT_VIASIZE6:
&dc, id); case ID_POPUP_PCB_SELECT_VIASIZE7:
break; case ID_POPUP_PCB_SELECT_VIASIZE8:
case ID_POPUP_PCB_VIA_EDITING:
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE: case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT:
DrawPanel->MouseToCursorSchema(); case ID_POPUP_PCB_VIA_HOLE_TO_VALUE:
Start_DragTrackSegmentAndKeepSlope((TRACK *) GetScreen()->m_CurrentItem, case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE:
&dc); case ID_POPUP_PCB_VIA_HOLE_EXPORT:
break; case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT:
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS:
case ID_POPUP_PCB_BREAK_TRACK: Via_Edit_Control( &dc, id, (SEGVIA*) GetScreen()->m_CurrentItem );
DrawPanel->MouseToCursorSchema(); break;
{
TRACK * track = (TRACK *) GetScreen()->m_CurrentItem; case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
wxPoint pos = GetScreen()->m_Curseur; DrawPanel->MouseToCursorSchema();
track->Draw(DrawPanel, &dc, GR_XOR); Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->m_CurrentItem,
TRACK * newtrack = CreateLockPoint(&pos.x, &pos.y, track, NULL); &dc, id );
track->Draw(DrawPanel, &dc, GR_XOR); break;
newtrack->Draw(DrawPanel, &dc, GR_XOR);
} case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
break; case ID_POPUP_PCB_MOVE_TRACK_NODE:
DrawPanel->MouseToCursorSchema();
case ID_MENU_PCB_CLEAN: Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->m_CurrentItem,
Clean_Pcb(&dc); &dc, id );
break; break;
case ID_MENU_PCB_SWAP_LAYERS: case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
Swap_Layers(event); DrawPanel->MouseToCursorSchema();
break; Start_DragTrackSegmentAndKeepSlope( (TRACK*) GetScreen()->m_CurrentItem,
&dc );
case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER: break;
GlobalRoute(&dc);
break; case ID_POPUP_PCB_BREAK_TRACK:
DrawPanel->MouseToCursorSchema();
case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA: {
ReadAutoroutedTracks(&dc); TRACK* track = (TRACK*) GetScreen()->m_CurrentItem;
break; wxPoint pos = GetScreen()->m_Curseur;
track->Draw( DrawPanel, &dc, GR_XOR );
case ID_PCB_USER_GRID_SETUP: TRACK* newtrack = CreateLockPoint( &pos.x, &pos.y, track, NULL );
InstallGridFrame(pos); track->Draw( DrawPanel, &dc, GR_XOR );
break; newtrack->Draw( DrawPanel, &dc, GR_XOR );
}
case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC: break;
{
wxString msg = FindKicadHelpPath(); case ID_MENU_PCB_CLEAN:
msg += EDA_Appl->m_EDA_CommonConfig->Read(wxT("module_doc_file"), Clean_Pcb( &dc );
wxT("pcbnew/footprints.pdf")); break;
GetAssociatedDocument(this, wxEmptyString, msg);
} case ID_MENU_PCB_SWAP_LAYERS:
break; Swap_Layers( event );
break;
case ID_MENU_ARCHIVE_NEW_MODULES:
Archive_Modules(wxEmptyString, TRUE); case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER:
break; GlobalRoute( &dc );
break;
case ID_MENU_ARCHIVE_ALL_MODULES:
Archive_Modules(wxEmptyString, FALSE); case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA:
break; ReadAutoroutedTracks( &dc );
break;
default:
{ case ID_PCB_USER_GRID_SETUP:
DisplayError(this, wxT("WinEDA_PcbFrame::Process_Special_Functions() id error")); InstallGridFrame( pos );
break; break;
}
} case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC:
{
SetToolbars(); wxString msg = FindKicadHelpPath();
DrawPanel->CursorOn(&dc); msg += EDA_Appl->m_EDA_CommonConfig->Read( wxT( "module_doc_file" ),
DrawPanel->m_IgnoreMouseEvents = FALSE; wxT( "pcbnew/footprints.pdf" ) );
GetAssociatedDocument( this, wxEmptyString, msg );
}
break;
case ID_MENU_ARCHIVE_NEW_MODULES:
Archive_Modules( wxEmptyString, TRUE );
break;
case ID_MENU_ARCHIVE_ALL_MODULES:
Archive_Modules( wxEmptyString, FALSE );
break;
default:
{
DisplayError( this, wxT( "WinEDA_PcbFrame::Process_Special_Functions() id error" ) );
break;
}
}
SetToolbars();
DrawPanel->CursorOn( &dc );
DrawPanel->m_IgnoreMouseEvents = FALSE;
} }
/****************************************************************/ /****************************************************************/
static void Process_Move_Item(WinEDA_PcbFrame * frame, static void Process_Move_Item( WinEDA_PcbFrame* frame,
EDA_BaseStruct *DrawStruct, wxDC * DC) EDA_BaseStruct* DrawStruct, wxDC* DC )
/****************************************************************/ /****************************************************************/
{ {
if( DrawStruct == NULL )
if ( DrawStruct == NULL ) return; return;
frame->DrawPanel->MouseToCursorSchema(); frame->DrawPanel->MouseToCursorSchema();
switch ( DrawStruct->m_StructType )
{ switch( DrawStruct->m_StructType )
case TYPETEXTE: {
frame->StartMoveTextePcb((TEXTE_PCB *) DrawStruct, DC); case TYPETEXTE:
break; frame->StartMoveTextePcb( (TEXTE_PCB*) DrawStruct, DC );
break;
default:
wxString msg; default:
msg.Printf( wxString msg;
wxT("WinEDA_PcbFrame::Move_Item Error: Bad DrawType %d"), msg.Printf(
DrawStruct->m_StructType); wxT( "WinEDA_PcbFrame::Move_Item Error: Bad DrawType %d" ),
DisplayError(frame, msg ); DrawStruct->m_StructType );
break; DisplayError( frame, msg );
} break;
}
} }
/********************************************************************************/ /********************************************************************************/
void WinEDA_PcbFrame::OnLeftDClick(wxDC * DC, const wxPoint& MousePos) void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/********************************************************************************/ /********************************************************************************/
/* Appel� sur un double click: /* Appel� sur un double click:
pour un �l�ment editable (textes, composant): * pour un �l�ment editable (textes, composant):
appel de l'editeur correspondant. * appel de l'editeur correspondant.
pour une connexion en cours: * pour une connexion en cours:
termine la connexion * termine la connexion
*/ */
{ {
EDA_BaseStruct * DrawStruct = CURRENT_ITEM; EDA_BaseStruct* DrawStruct = CURRENT_ITEM;
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
wxClientDC dc(DrawPanel); wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext(&dc); DrawPanel->PrepareGraphicContext( &dc );
switch ( m_ID_current_state ) switch( m_ID_current_state )
{ {
case 0: case 0:
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
DrawStruct = PcbGeneralLocateAndDisplay(); DrawStruct = PcbGeneralLocateAndDisplay();
} }
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
break; break;
// Element localis� // Element localis�
GetScreen()->m_CurrentItem = DrawStruct; GetScreen()->m_CurrentItem = DrawStruct;
switch ( DrawStruct->m_StructType )
{ switch( DrawStruct->m_StructType )
case TYPETRACK: {
case TYPEVIA: case TYPETRACK:
if (DrawStruct->m_Flags & IS_NEW) case TYPEVIA:
{ if( DrawStruct->m_Flags & IS_NEW )
End_Route( (TRACK *) DrawStruct, DC); {
DrawPanel->m_AutoPAN_Request = FALSE; End_Route( (TRACK*) DrawStruct, DC );
} DrawPanel->m_AutoPAN_Request = FALSE;
else if (DrawStruct->m_Flags == 0) }
{ else if( DrawStruct->m_Flags == 0 )
Edit_TrackSegm_Width(DC, {
(TRACK *) DrawStruct); Edit_TrackSegm_Width( DC,
} (TRACK*) DrawStruct );
break; }
break;
case TYPETEXTE:
InstallTextPCBOptionsFrame((TEXTE_PCB *)DrawStruct, case TYPETEXTE:
DC, ((TEXTE_PCB *)DrawStruct)->m_Pos); InstallTextPCBOptionsFrame( (TEXTE_PCB*) DrawStruct,
DrawPanel->MouseToCursorSchema(); DC, ( (TEXTE_PCB*) DrawStruct )->m_Pos );
break; DrawPanel->MouseToCursorSchema();
break;
case TYPEPAD:
InstallPadOptionsFrame( case TYPEPAD:
(D_PAD *)DrawStruct, &dc, pos); InstallPadOptionsFrame(
DrawPanel->MouseToCursorSchema(); (D_PAD*) DrawStruct, &dc, pos );
break; DrawPanel->MouseToCursorSchema();
break;
case TYPEMODULE:
InstallModuleOptionsFrame((MODULE *)DrawStruct, case TYPEMODULE:
&dc, pos); InstallModuleOptionsFrame( (MODULE*) DrawStruct,
DrawPanel->MouseToCursorSchema(); &dc, pos );
break; DrawPanel->MouseToCursorSchema();
break;
case TYPEMIRE:
InstallMireOptionsFrame( (MIREPCB *)DrawStruct, &dc, pos); case TYPEMIRE:
DrawPanel->MouseToCursorSchema(); InstallMireOptionsFrame( (MIREPCB*) DrawStruct, &dc, pos );
break; DrawPanel->MouseToCursorSchema();
break;
case TYPETEXTEMODULE:
InstallTextModOptionsFrame((TEXTE_MODULE *)DrawStruct, case TYPETEXTEMODULE:
&dc, pos); InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct,
DrawPanel->MouseToCursorSchema(); &dc, pos );
break; DrawPanel->MouseToCursorSchema();
break;
case TYPEDRAWSEGMENT:
break; case TYPEDRAWSEGMENT:
break;
default:
break; default:
} break;
break; // end case 0 }
case ID_TRACK_BUTT: break; // end case 0
if ( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
{ case ID_TRACK_BUTT:
End_Route( (TRACK *) DrawStruct, DC); if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
DrawPanel->m_AutoPAN_Request = FALSE; {
} End_Route( (TRACK*) DrawStruct, DC );
break; DrawPanel->m_AutoPAN_Request = FALSE;
}
case ID_PCB_ZONES_BUTT: break;
End_Zone(DC);
DrawPanel->m_AutoPAN_Request = FALSE; case ID_PCB_ZONES_BUTT:
GetScreen()->m_CurrentItem = NULL; End_Zone( DC );
break; DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->m_CurrentItem = NULL;
case ID_LINE_COMMENT_BUTT: break;
case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT: case ID_LINE_COMMENT_BUTT:
if ( DrawStruct == NULL ) break; case ID_PCB_ARC_BUTT:
if ( DrawStruct->m_StructType != TYPEDRAWSEGMENT ) case ID_PCB_CIRCLE_BUTT:
{ if( DrawStruct == NULL )
DisplayError(this, wxT("DrawStruct Type error")); break;
DrawPanel->m_AutoPAN_Request = FALSE; if( DrawStruct->m_StructType != TYPEDRAWSEGMENT )
break; {
} DisplayError( this, wxT( "DrawStruct Type error" ) );
if ( (DrawStruct->m_Flags & IS_NEW) ) DrawPanel->m_AutoPAN_Request = FALSE;
{ break;
End_Edge( (DRAWSEGMENT *) DrawStruct, &dc); }
DrawPanel->m_AutoPAN_Request = FALSE; if( (DrawStruct->m_Flags & IS_NEW) )
GetScreen()->m_CurrentItem = NULL; {
} End_Edge( (DRAWSEGMENT*) DrawStruct, &dc );
break; DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->m_CurrentItem = NULL;
} }
break;
}
} }
/***************************************************************/ /***************************************************************/
void WinEDA_PcbFrame::RemoveStruct(EDA_BaseStruct * Item, wxDC * DC) void WinEDA_PcbFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC )
/***************************************************************/ /***************************************************************/
{ {
if ( Item == NULL ) return; if( Item == NULL )
return;
switch( Item->m_StructType )
{ switch( Item->m_StructType )
case TYPEMODULE: {
Delete_Module((MODULE *) Item, DC); case TYPEMODULE:
break; Delete_Module( (MODULE*) Item, DC );
break;
case TYPECOTATION:
Delete_Cotation((COTATION *) Item, DC); case TYPECOTATION:
break; Delete_Cotation( (COTATION*) Item, DC );
break;
case TYPEMIRE:
Delete_Mire((MIREPCB *) Item, DC); case TYPEMIRE:
break; Delete_Mire( (MIREPCB*) Item, DC );
break;
case TYPEDRAWSEGMENT:
Delete_Segment_Edge((DRAWSEGMENT *)Item, DC); case TYPEDRAWSEGMENT:
break; Delete_Segment_Edge( (DRAWSEGMENT*) Item, DC );
break;
case TYPETEXTE:
Delete_Texte_Pcb((TEXTE_PCB *) Item, DC); case TYPETEXTE:
break; Delete_Texte_Pcb( (TEXTE_PCB*) Item, DC );
break;
case TYPETRACK:
Delete_Track(DC, (TRACK *)Item); case TYPETRACK:
break; Delete_Track( DC, (TRACK*) Item );
break;
case TYPEVIA:
Delete_Segment(DC, (TRACK *)Item); case TYPEVIA:
break; Delete_Segment( DC, (TRACK*) Item );
break;
case TYPEZONE:
Delete_Zone(DC, (SEGZONE*)Item); case TYPEZONE:
break; Delete_Zone( DC, (SEGZONE*) Item );
break;
case TYPEMARQUEUR:
break; case TYPEMARQUEUR:
break;
case TYPEPAD:
case TYPETEXTEMODULE: case TYPEPAD:
case TYPEEDGEMODULE: case TYPETEXTEMODULE:
break; case TYPEEDGEMODULE:
break;
case TYPE_NOT_INIT:
case PCB_EQUIPOT_STRUCT_TYPE: case TYPE_NOT_INIT:
case TYPEPCB: case PCB_EQUIPOT_STRUCT_TYPE:
default: case TYPEPCB:
{ default:
wxString Line; {
Line.Printf( wxT("Remove: StructType %d Inattendu"), wxString Line;
Item->m_StructType); Line.Printf( wxT( "Remove: StructType %d Inattendu" ),
DisplayError(this, Line); Item->m_StructType );
} DisplayError( this, Line );
break; }
} break;
}
} }
/****************************************************************/ /****************************************************************/
void WinEDA_PcbFrame::SwitchLayer(wxDC *DC, int layer) void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
/*****************************************************************/ /*****************************************************************/
{ {
int preslayer = GetScreen()->m_Active_Layer; int preslayer = GetScreen()->m_Active_Layer;
//if there is only one layer, don't switch.
if ( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1) //if there is only one layer, don't switch.
return; if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 )
//otherwise, must be at least 2 layers..see if it is possible. return;
if(layer == LAYER_CUIVRE_N || layer == LAYER_CMP_N ||
layer < m_Pcb->m_BoardSettings->m_CopperLayerCount-1){ //otherwise, must be at least 2 layers..see if it is possible.
if( layer == LAYER_CUIVRE_N || layer == LAYER_CMP_N
if(preslayer == layer) || layer < m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
return; {
EDA_BaseStruct* current = GetScreen()->m_CurrentItem; if( preslayer == layer )
//see if we are drawing a segment; if so, add a via? return;
if ( m_ID_current_state == ID_TRACK_BUTT && current != NULL) EDA_BaseStruct* current = GetScreen()->m_CurrentItem;
{
if(current->m_StructType == TYPETRACK && (current->m_Flags & IS_NEW)){ //see if we are drawing a segment; if so, add a via?
//want to set the routing layers so that it switches properly - if( m_ID_current_state == ID_TRACK_BUTT && current != NULL )
//see the implementation of Other_Layer_Route - the working {
//layer is used to 'start' the via and set the layer masks appropriately. if( current->m_StructType == TYPETRACK && (current->m_Flags & IS_NEW) )
GetScreen()->m_Route_Layer_TOP = preslayer; {
GetScreen()->m_Route_Layer_BOTTOM = layer; //want to set the routing layers so that it switches properly -
GetScreen()->m_Active_Layer = preslayer; //see the implementation of Other_Layer_Route - the working
Other_Layer_Route( (TRACK *) GetScreen()->m_CurrentItem, DC); //layer is used to 'start' the via and set the layer masks appropriately.
} GetScreen()->m_Route_Layer_TOP = preslayer;
} GetScreen()->m_Route_Layer_BOTTOM = layer;
GetScreen()->m_Active_Layer = preslayer;
GetScreen()->m_Active_Layer = layer; Other_Layer_Route( (TRACK*) GetScreen()->m_CurrentItem, DC );
}
if ( DisplayOpt.ContrastModeDisplay ) }
GetScreen()->SetRefreshReq();
} GetScreen()->m_Active_Layer = layer;
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment