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,75 +17,76 @@ ...@@ -17,75 +17,76 @@
#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;
} }
} }
...@@ -96,7 +97,7 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM; ...@@ -96,7 +97,7 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
} }
} }
switch ( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_MAIN_MENUBAR: case ID_MAIN_MENUBAR:
case 0: case 0:
...@@ -105,40 +106,41 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM; ...@@ -105,40 +106,41 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
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); int netcode = Select_High_Light( DC );
if ( netcode < 0 ) Affiche_Infos_Status_Pcb(this); if( netcode < 0 )
else Affiche_Infos_Equipot(netcode, this); Affiche_Infos_Status_Pcb( this );
else
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
DisplayError( this, wxT( "Internal err: Struct not TYPEMIRE" ) );
break; break;
case ID_PCB_CIRCLE_BUTT: case ID_PCB_CIRCLE_BUTT:
...@@ -146,50 +148,55 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM; ...@@ -146,50 +148,55 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
case ID_LINE_COMMENT_BUTT: case ID_LINE_COMMENT_BUTT:
{ {
int shape = S_SEGMENT; int shape = S_SEGMENT;
if ( m_ID_current_state == ID_PCB_CIRCLE_BUTT) shape = S_CIRCLE; if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
if ( m_ID_current_state == ID_PCB_ARC_BUTT) shape = S_ARC; shape = S_CIRCLE;
if( m_ID_current_state == ID_PCB_ARC_BUTT )
shape = S_ARC;
if ( GetScreen()->m_Active_Layer <= CMP_N ) if( GetScreen()->m_Active_Layer <= CMP_N )
{ {
DisplayError(this, _("Graphic not autorized on Copper layers")); DisplayError( this, _( "Graphic not autorized on Copper layers" ) );
break; break;
} }
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->m_CurrentItem = DrawStruct = GetScreen()->m_CurrentItem = DrawStruct =
Begin_DrawSegment(NULL, shape, DC); Begin_DrawSegment( NULL, shape, DC );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else if (DrawStruct && else if( DrawStruct
(DrawStruct->m_StructType == TYPEDRAWSEGMENT) && && (DrawStruct->m_StructType == TYPEDRAWSEGMENT)
(DrawStruct->m_Flags & IS_NEW) ) && (DrawStruct->m_Flags & IS_NEW) )
{ {
GetScreen()->m_CurrentItem = DrawStruct = GetScreen()->m_CurrentItem = DrawStruct =
Begin_DrawSegment((DRAWSEGMENT *)DrawStruct, shape, DC); Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape,
DC );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
break; break;
} }
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
if ( GetScreen()->m_Active_Layer > CMP_N ) if( GetScreen()->m_Active_Layer > CMP_N )
{ {
DisplayError(this, _("Tracks on Copper layers only ")); DisplayError( this, _( "Tracks on Copper layers only " ) );
break; break;
} }
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->m_CurrentItem = DrawStruct = GetScreen()->m_CurrentItem = DrawStruct =
Begin_Route(NULL, DC); Begin_Route( NULL, DC );
if ( DrawStruct ) DrawPanel->m_AutoPAN_Request = TRUE; if( DrawStruct )
DrawPanel->m_AutoPAN_Request = TRUE;
} }
else if (DrawStruct && 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;
} }
...@@ -197,126 +204,132 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM; ...@@ -197,126 +204,132 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
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
DisplayError( this, wxT( "Edit: zone internal error" ) );
break; break;
case ID_TEXT_COMMENT_BUTT: case ID_TEXT_COMMENT_BUTT:
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->m_CurrentItem = Create_Texte_Pcb( DC ); GetScreen()->m_CurrentItem = Create_Texte_Pcb( DC );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else if (DrawStruct->m_StructType == TYPETEXTE ) else if( DrawStruct->m_StructType == TYPETEXTE )
{ {
Place_Texte_Pcb((TEXTE_PCB *)DrawStruct, DC); Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
else DisplayError(this, wxT("Internal err: Struct not TYPETEXTE")); else
DisplayError( this, wxT( "Internal err: Struct not TYPETEXTE" ) );
break; break;
case ID_COMPONENT_BUTT: case ID_COMPONENT_BUTT:
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
GetScreen()->m_CurrentItem = DrawStruct = GetScreen()->m_CurrentItem = DrawStruct =
Load_Module_From_Library(wxEmptyString, DC); Load_Module_From_Library( wxEmptyString, DC );
if ( DrawStruct ) if( DrawStruct )
StartMove_Module((MODULE *)DrawStruct, DC); StartMove_Module( (MODULE*) DrawStruct, DC );
} }
else if (DrawStruct->m_StructType == TYPEMODULE ) else if( DrawStruct->m_StructType == TYPEMODULE )
{ {
Place_Module((MODULE *)DrawStruct, DC); Place_Module( (MODULE*) DrawStruct, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
else DisplayError(this, wxT("Internal err: Struct not TYPEMODULE")); else
DisplayError( this, wxT( "Internal err: Struct not TYPEMODULE" ) );
break; break;
case ID_PCB_COTATION_BUTT: case ID_PCB_COTATION_BUTT:
if ( GetScreen()->m_Active_Layer <= CMP_N ) if( GetScreen()->m_Active_Layer <= CMP_N )
{ {
DisplayError(this, _("Cotation not autorized on Copper layers")); DisplayError( this, _( "Cotation not autorized on Copper layers" ) );
break; break;
} }
if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->m_CurrentItem = DrawStruct = GetScreen()->m_CurrentItem = DrawStruct =
Begin_Cotation(NULL, DC); Begin_Cotation( NULL, DC );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else if (DrawStruct && else if( DrawStruct
(DrawStruct->m_StructType == TYPECOTATION) && && (DrawStruct->m_StructType == TYPECOTATION)
(DrawStruct->m_Flags & IS_NEW) ) && (DrawStruct->m_Flags & IS_NEW) )
{ {
GetScreen()->m_CurrentItem = DrawStruct = GetScreen()->m_CurrentItem = DrawStruct =
Begin_Cotation((COTATION * )DrawStruct, DC); Begin_Cotation( (COTATION*) DrawStruct, DC );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else DisplayError(this, wxT("Internal err: Struct not COTATION")); else
DisplayError( this, wxT( "Internal err: Struct not COTATION" ) );
break; break;
case ID_PCB_DELETE_ITEM_BUTT: case ID_PCB_DELETE_ITEM_BUTT:
if ( !DrawStruct || (DrawStruct->m_Flags == 0) ) if( !DrawStruct || (DrawStruct->m_Flags == 0) )
{ {
DrawStruct = PcbGeneralLocateAndDisplay(); DrawStruct = PcbGeneralLocateAndDisplay();
if ( DrawStruct && (DrawStruct->m_Flags == 0) ) if( DrawStruct && (DrawStruct->m_Flags == 0) )
{ {
RemoveStruct(DrawStruct, DC); RemoveStruct( DrawStruct, DC );
GetScreen()->m_CurrentItem = DrawStruct = NULL; GetScreen()->m_CurrentItem = DrawStruct = NULL;
} }
} }
break; break;
case ID_PCB_PLACE_OFFSET_COORD_BUTT: case ID_PCB_PLACE_OFFSET_COORD_BUTT:
DrawPanel->m_Draw_Auxiliary_Axis(DC, GR_XOR); DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_XOR );
m_Auxiliary_Axis_Position = GetScreen()->m_Curseur; m_Auxiliary_Axis_Position = GetScreen()->m_Curseur;
DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_COPY); DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_COPY );
GetScreen()->SetModify(); GetScreen()->SetModify();
break; break;
default : default:
DrawPanel->SetCursor(wxCURSOR_ARROW); DrawPanel->SetCursor( wxCURSOR_ARROW );
DisplayError(this, wxT("WinEDA_PcbFrame::OnLeftClick() id error")); DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() id error" ) );
SetToolID(0, wxCURSOR_ARROW,wxEmptyString); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
} }
out:
out:
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->CursorOn(DC); 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:
...@@ -404,206 +417,214 @@ int itmp; ...@@ -404,206 +417,214 @@ int itmp;
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
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
break; break;
default: // Arret de la commande de d�placement en cours default: // Arret de la commande de d�placement en cours
if( DrawPanel->ManageCurseur && if( DrawPanel->ManageCurseur
DrawPanel->ForceCloseManageCurseur ) && DrawPanel->ForceCloseManageCurseur )
{ {
DrawPanel->ForceCloseManageCurseur(DrawPanel, &dc); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
SetToolID(0, wxCURSOR_ARROW,wxEmptyString); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
} }
switch ( id ) // Traitement des commandes switch( id ) // Traitement des commandes
{ {
case ID_EXIT : case ID_EXIT:
Close(TRUE); Close( TRUE );
break; break;
case ID_OPEN_MODULE_EDITOR: case ID_OPEN_MODULE_EDITOR:
if (m_Parent->m_ModuleEditFrame == NULL ) if( m_Parent->m_ModuleEditFrame == NULL )
{ {
m_Parent->m_ModuleEditFrame = new WinEDA_ModuleEditFrame(this, m_Parent->m_ModuleEditFrame = new WinEDA_ModuleEditFrame( this,
m_Parent,_("Module Editor"), m_Parent, _( "Module Editor" ),
wxPoint(-1, -1), wxSize(600,400) ); wxPoint( -1,
m_Parent->m_ModuleEditFrame->Show(TRUE); -1 ),
m_Parent->m_ModuleEditFrame->Zoom_Automatique(TRUE); wxSize( 600, 400 ) );
m_Parent->m_ModuleEditFrame->Show( TRUE );
m_Parent->m_ModuleEditFrame->Zoom_Automatique( TRUE );
} }
else m_Parent->m_ModuleEditFrame->Iconize(FALSE); else
m_Parent->m_ModuleEditFrame->Iconize( FALSE );
break; break;
case ID_NEW_PROJECT: case ID_NEW_PROJECT:
case ID_LOAD_PROJECT: case ID_LOAD_PROJECT:
Files_io(event); Files_io( event );
break; break;
case ID_PCB_GLOBAL_DELETE: case ID_PCB_GLOBAL_DELETE:
InstallPcbGlobalDeleteFrame(pos); InstallPcbGlobalDeleteFrame( pos );
break; break;
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE; GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockPlace(&dc); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_COPY; GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
m_CurrentScreen->BlockLocate.SetMessageBlock(this); m_CurrentScreen->BlockLocate.SetMessageBlock( this );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockPlace(&dc); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
m_CurrentScreen->BlockLocate.SetMessageBlock(this); m_CurrentScreen->BlockLocate.SetMessageBlock( this );
m_CurrentScreen->BlockLocate.SetMessageBlock(this); m_CurrentScreen->BlockLocate.SetMessageBlock( this );
HandleBlockEnd(&dc); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
m_CurrentScreen->BlockLocate.SetMessageBlock(this); m_CurrentScreen->BlockLocate.SetMessageBlock( this );
HandleBlockEnd(&dc); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE; GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
m_CurrentScreen->BlockLocate.SetMessageBlock(this); m_CurrentScreen->BlockLocate.SetMessageBlock( this );
HandleBlockEnd(&dc); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_INVERT_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT; GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
m_CurrentScreen->BlockLocate.SetMessageBlock(this); m_CurrentScreen->BlockLocate.SetMessageBlock( this );
HandleBlockEnd(&dc); HandleBlockEnd( &dc );
break; break;
case ID_UNDO_BUTT: case ID_UNDO_BUTT:
UnDeleteItem(&dc); UnDeleteItem( &dc );
break; break;
case ID_DRC_CONTROL: case ID_DRC_CONTROL:
Install_Test_DRC_Frame(&dc); Install_Test_DRC_Frame( &dc );
break; break;
case ID_GET_NETLIST: case ID_GET_NETLIST:
InstallNetlistFrame(&dc, wxPoint(-1,-1)); InstallNetlistFrame( &dc, wxPoint( -1, -1 ) );
break; break;
case ID_GET_TOOLS: case ID_GET_TOOLS:
// InstallToolsFrame(this, wxPoint(-1,-1) );
// InstalloolsFrame(this, wxPoint(-1,-1) );
break; break;
case ID_FIND_ITEMS: case ID_FIND_ITEMS:
InstallFindFrame(pos, &dc); InstallFindFrame( pos, &dc );
break; break;
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _("Add Tracks")); SetToolID( id, wxCURSOR_PENCIL, _( "Add Tracks" ) );
DisplayTrackSettings(); DisplayTrackSettings();
if ( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0) if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
{ {
Compile_Ratsnest( &dc, TRUE ); Compile_Ratsnest( &dc, TRUE );
} }
break; break;
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _("Add Zones")); SetToolID( id, wxCURSOR_PENCIL, _( "Add Zones" ) );
if ( ! DisplayOpt.DisplayZones ) if( !DisplayOpt.DisplayZones )
DisplayInfo(this, _("Warning: Display Zone is OFF!!!") ); DisplayInfo( this, _( "Warning: Display Zone is OFF!!!" ) );
DelLimitesZone(&dc, TRUE); DelLimitesZone( &dc, TRUE );
if( ! g_HightLigt_Status && (g_HightLigth_NetCode > 0 ) ) if( !g_HightLigt_Status && (g_HightLigth_NetCode > 0 ) )
Hight_Light(&dc); Hight_Light( &dc );
break; break;
case ID_PCB_MIRE_BUTT: case ID_PCB_MIRE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _("Add Mire")); SetToolID( id, wxCURSOR_PENCIL, _( "Add Mire" ) );
break; break;
case ID_PCB_PLACE_OFFSET_COORD_BUTT: case ID_PCB_PLACE_OFFSET_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _("Adjust Zero")); SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Zero" ) );
break; break;
case ID_LINE_COMMENT_BUTT: case ID_LINE_COMMENT_BUTT:
case ID_PCB_ARC_BUTT: case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT: case ID_PCB_CIRCLE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _("Add Graphic")); SetToolID( id, wxCURSOR_PENCIL, _( "Add Graphic" ) );
break; break;
case ID_TEXT_COMMENT_BUTT: case ID_TEXT_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _("Add Text")); SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
break; break;
case ID_COMPONENT_BUTT: case ID_COMPONENT_BUTT:
SetToolID( id, wxCURSOR_HAND, _("Add Modules")); SetToolID( id, wxCURSOR_HAND, _( "Add Modules" ) );
break; break;
case ID_PCB_COTATION_BUTT: case ID_PCB_COTATION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _("Add Cotation")); SetToolID( id, wxCURSOR_PENCIL, _( "Add Cotation" ) );
break; break;
case ID_NO_SELECT_BUTT: case ID_NO_SELECT_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
case ID_PCB_HIGHLIGHT_BUTT: case ID_PCB_HIGHLIGHT_BUTT:
SetToolID( id, wxCURSOR_HAND, _("Net Highlight")); SetToolID( id, wxCURSOR_HAND, _( "Net Highlight" ) );
break; break;
case ID_PCB_SHOW_1_RATSNEST_BUTT: case ID_PCB_SHOW_1_RATSNEST_BUTT:
SetToolID( id, wxCURSOR_HAND, _("Local Ratsnest")); SetToolID( id, wxCURSOR_HAND, _( "Local Ratsnest" ) );
if ( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0) if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
Compile_Ratsnest( &dc, TRUE ); Compile_Ratsnest( &dc, TRUE );
break; break;
case ID_POPUP_CLOSE_CURRENT_TOOL: case ID_POPUP_CLOSE_CURRENT_TOOL:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
break; break;
case ID_POPUP_END_LINE: case ID_POPUP_END_LINE:
DrawPanel->MouseToCursorSchema(); 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;
Edit_Track_Width( &dc, (TRACK*) CURRENT_ITEM );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
GetScreen()->SetModify(); GetScreen()->SetModify();
break; break;
case ID_POPUP_PCB_EDIT_TRACKSEG: case ID_POPUP_PCB_EDIT_TRACKSEG:
if ( CURRENT_ITEM == NULL) break; if( CURRENT_ITEM == NULL )
Edit_TrackSegm_Width(&dc, (TRACK *) CURRENT_ITEM); break;
Edit_TrackSegm_Width( &dc, (TRACK*) CURRENT_ITEM );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
GetScreen()->SetModify(); GetScreen()->SetModify();
break; break;
case ID_POPUP_PCB_EDIT_NET: case ID_POPUP_PCB_EDIT_NET:
if ( CURRENT_ITEM == NULL) break; if( CURRENT_ITEM == NULL )
Edit_Net_Width(&dc, ((TRACK *) CURRENT_ITEM)->m_NetCode); break;
Edit_Net_Width( &dc, ( (TRACK*) CURRENT_ITEM )->m_NetCode );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
GetScreen()->SetModify(); GetScreen()->SetModify();
break; break;
...@@ -611,88 +632,93 @@ int itmp; ...@@ -611,88 +632,93 @@ int itmp;
case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE: case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE:
case ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE: case ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE:
case ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE: case ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE:
if ( CURRENT_ITEM == NULL) break; if( CURRENT_ITEM == NULL )
break;
{ {
bool resize_vias = TRUE, resize_track = TRUE; 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_VIAS_SIZE )
if( id == ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE) resize_vias = FALSE; resize_track = FALSE;
if ( Resize_Pistes_Vias(&dc, resize_track, resize_vias)) GetScreen()->SetModify(); 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(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_END_TRACK: case ID_POPUP_PCB_END_TRACK:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
End_Route( (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_MOVED_TRACK_NODE:
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; break;
case ID_POPUP_PCB_PLACE_VIA: 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 );
} }
else else
{ {
Other_Layer_Route( (TRACK *) CURRENT_ITEM, &dc); Other_Layer_Route( (TRACK*) CURRENT_ITEM, &dc );
if ( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq(); GetScreen()->SetRefreshReq();
} }
break; break;
case ID_POPUP_PCB_DELETE_TRACKSEG: case ID_POPUP_PCB_DELETE_TRACKSEG:
if ( CURRENT_ITEM == NULL) break; if( CURRENT_ITEM == NULL )
break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
GetScreen()->m_CurrentItem = Delete_Segment(&dc, (TRACK*)CURRENT_ITEM); GetScreen()->m_CurrentItem = Delete_Segment( &dc, (TRACK*) CURRENT_ITEM );
GetScreen()->SetModify(); GetScreen()->SetModify();
break; break;
case ID_POPUP_PCB_DELETE_TRACK: case ID_POPUP_PCB_DELETE_TRACK:
if ( CURRENT_ITEM == NULL) break; if( CURRENT_ITEM == NULL )
break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Delete_Track(&dc, (TRACK*)CURRENT_ITEM); Delete_Track( &dc, (TRACK*) CURRENT_ITEM );
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
GetScreen()->SetModify(); GetScreen()->SetModify();
break; break;
case ID_POPUP_PCB_DELETE_TRACKNET: case ID_POPUP_PCB_DELETE_TRACKNET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Delete_net(&dc, (TRACK*)CURRENT_ITEM); Delete_net( &dc, (TRACK*) CURRENT_ITEM );
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
GetScreen()->SetModify(); GetScreen()->SetModify();
break; break;
case ID_POPUP_PCB_LOCK_ON_TRACKSEG: case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
Attribut_Segment((TRACK*)CURRENT_ITEM, &dc, TRUE); Attribut_Segment( (TRACK*) CURRENT_ITEM, &dc, TRUE );
break; break;
case ID_POPUP_PCB_LOCK_OFF_TRACKSEG: case ID_POPUP_PCB_LOCK_OFF_TRACKSEG:
Attribut_Segment((TRACK*)CURRENT_ITEM, &dc, FALSE); Attribut_Segment( (TRACK*) CURRENT_ITEM, &dc, FALSE );
break; break;
case ID_POPUP_PCB_LOCK_ON_TRACK: case ID_POPUP_PCB_LOCK_ON_TRACK:
Attribut_Track((TRACK*)CURRENT_ITEM, &dc, TRUE); Attribut_Track( (TRACK*) CURRENT_ITEM, &dc, TRUE );
break; break;
case ID_POPUP_PCB_LOCK_OFF_TRACK: case ID_POPUP_PCB_LOCK_OFF_TRACK:
Attribut_Track((TRACK*)CURRENT_ITEM, &dc, FALSE); Attribut_Track( (TRACK*) CURRENT_ITEM, &dc, FALSE );
break; break;
case ID_POPUP_PCB_LOCK_ON_NET: case ID_POPUP_PCB_LOCK_ON_NET:
Attribut_net(&dc, ((TRACK*)CURRENT_ITEM)->m_NetCode, TRUE); Attribut_net( &dc, ( (TRACK*) CURRENT_ITEM )->m_NetCode, TRUE );
break; break;
case ID_POPUP_PCB_LOCK_OFF_NET: case ID_POPUP_PCB_LOCK_OFF_NET:
Attribut_net(&dc, ((TRACK*)CURRENT_ITEM)->m_NetCode, FALSE); Attribut_net( &dc, ( (TRACK*) CURRENT_ITEM )->m_NetCode, FALSE );
break; break;
case ID_POPUP_PCB_SETFLAGS_TRACK_MNU: case ID_POPUP_PCB_SETFLAGS_TRACK_MNU:
...@@ -700,63 +726,68 @@ int itmp; ...@@ -700,63 +726,68 @@ int itmp;
case ID_POPUP_PCB_DELETE_ZONE: case ID_POPUP_PCB_DELETE_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if ( CURRENT_ITEM == NULL) break; if( CURRENT_ITEM == NULL )
Delete_Zone(&dc, (SEGZONE*)CURRENT_ITEM); break;
Delete_Zone( &dc, (SEGZONE*) CURRENT_ITEM );
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
break; break;
case ID_POPUP_PCB_EDIT_ZONE: case ID_POPUP_PCB_EDIT_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if ( CURRENT_ITEM == NULL) break; if( CURRENT_ITEM == NULL )
Edit_Zone_Width(&dc, (SEGZONE*)CURRENT_ITEM); break;
Edit_Zone_Width( &dc, (SEGZONE*) CURRENT_ITEM );
break; break;
case ID_POPUP_PCB_DELETE_ZONE_LIMIT: case ID_POPUP_PCB_DELETE_ZONE_LIMIT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DelLimitesZone(&dc, TRUE); DelLimitesZone( &dc, TRUE );
break; break;
case ID_PCB_DELETE_ITEM_BUTT: case ID_PCB_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _("Delete item")); SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break; break;
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST: case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
Process_Move_Item(this, CURRENT_ITEM, &dc); Process_Move_Item( this, CURRENT_ITEM, &dc );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
break; break;
case ID_POPUP_PCB_DRAG_MODULE_REQUEST: case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
g_Drag_Pistes_On = TRUE; g_Drag_Pistes_On = TRUE;
case ID_POPUP_PCB_MOVE_MODULE_REQUEST: case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
// 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 )
{ {
g_Drag_Pistes_On = FALSE; g_Drag_Pistes_On = FALSE;
break; break;
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMove_Module( (MODULE*)CURRENT_ITEM, &dc); StartMove_Module( (MODULE*) CURRENT_ITEM, &dc );
break; break;
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: /* get module by name and move it */ case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: /* get module by name and move it */
CURRENT_ITEM = GetModuleByName(); CURRENT_ITEM = GetModuleByName();
if ( CURRENT_ITEM ) if( CURRENT_ITEM )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMove_Module( (MODULE*)CURRENT_ITEM, &dc); StartMove_Module( (MODULE*) CURRENT_ITEM, &dc );
} }
break; break;
case ID_POPUP_PCB_DELETE_MODULE: case ID_POPUP_PCB_DELETE_MODULE:
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;
if ( Delete_Module((MODULE*) CURRENT_ITEM, &dc) ) if( Delete_Module( (MODULE*) CURRENT_ITEM, &dc ) )
{ {
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
} }
...@@ -764,108 +795,113 @@ int itmp; ...@@ -764,108 +795,113 @@ int itmp;
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE: 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); Rotate_Module( &dc, (MODULE*) CURRENT_ITEM, -900, TRUE );
break; break;
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE: case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
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); Rotate_Module( &dc, (MODULE*) CURRENT_ITEM, 900, TRUE );
break; break;
case ID_POPUP_PCB_CHANGE_SIDE_MODULE: case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
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;
Change_Side_Module((MODULE *) CURRENT_ITEM, &dc); Change_Side_Module( (MODULE*) CURRENT_ITEM, &dc );
break; break;
case ID_POPUP_PCB_EDIT_MODULE: case ID_POPUP_PCB_EDIT_MODULE:
// 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;
InstallModuleOptionsFrame((MODULE *)CURRENT_ITEM, InstallModuleOptionsFrame( (MODULE*) CURRENT_ITEM,
&dc, pos); &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_DRAG_PAD_REQUEST: case ID_POPUP_PCB_DRAG_PAD_REQUEST:
g_Drag_Pistes_On = TRUE; g_Drag_Pistes_On = TRUE;
case ID_POPUP_PCB_MOVE_PAD_REQUEST: case ID_POPUP_PCB_MOVE_PAD_REQUEST:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMovePad((D_PAD *)CURRENT_ITEM, &dc); StartMovePad( (D_PAD*) CURRENT_ITEM, &dc );
break; break;
case ID_POPUP_PCB_EDIT_PAD: case ID_POPUP_PCB_EDIT_PAD:
InstallPadOptionsFrame((D_PAD *)CURRENT_ITEM, InstallPadOptionsFrame( (D_PAD*) CURRENT_ITEM,
&dc, pos); &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Import_Pad_Settings((D_PAD *)CURRENT_ITEM, &dc); Import_Pad_Settings( (D_PAD*) CURRENT_ITEM, &dc );
break; break;
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Global_Import_Pad_Settings((D_PAD *)CURRENT_ITEM, &dc); Global_Import_Pad_Settings( (D_PAD*) CURRENT_ITEM, &dc );
break; break;
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS: case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Export_Pad_Settings((D_PAD *)CURRENT_ITEM); Export_Pad_Settings( (D_PAD*) CURRENT_ITEM );
break; break;
case ID_POPUP_PCB_DELETE_PAD: case ID_POPUP_PCB_DELETE_PAD:
DeletePad((D_PAD *)CURRENT_ITEM, &dc); DeletePad( (D_PAD*) CURRENT_ITEM, &dc );
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_EDIT_TEXTMODULE: case ID_POPUP_PCB_EDIT_TEXTMODULE:
InstallTextModOptionsFrame((TEXTE_MODULE *)CURRENT_ITEM, InstallTextModOptionsFrame( (TEXTE_MODULE*) CURRENT_ITEM,
&dc, pos); &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST: case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMoveTexteModule( (TEXTE_MODULE *) CURRENT_ITEM, StartMoveTexteModule( (TEXTE_MODULE*) CURRENT_ITEM,
&dc); &dc );
break; break;
case ID_POPUP_PCB_ROTATE_TEXTMODULE: case ID_POPUP_PCB_ROTATE_TEXTMODULE:
RotateTextModule((TEXTE_MODULE *)CURRENT_ITEM, RotateTextModule( (TEXTE_MODULE*) CURRENT_ITEM,
&dc); &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_DELETE_TEXTMODULE: case ID_POPUP_PCB_DELETE_TEXTMODULE:
DeleteTextModule((TEXTE_MODULE *)CURRENT_ITEM, DeleteTextModule( (TEXTE_MODULE*) CURRENT_ITEM,
&dc); &dc );
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_SELECT_LAYER: case ID_POPUP_PCB_SELECT_LAYER:
itmp = SelectLayer(GetScreen()->m_Active_Layer, -1, -1); itmp = SelectLayer( GetScreen()->m_Active_Layer, -1, -1 );
if ( itmp >= 0 ) GetScreen()->m_Active_Layer = itmp; if( itmp >= 0 )
GetScreen()->m_Active_Layer = itmp;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
...@@ -874,14 +910,16 @@ int itmp; ...@@ -874,14 +910,16 @@ int itmp;
break; break;
case ID_POPUP_PCB_SELECT_NO_CU_LAYER: case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
itmp = SelectLayer(GetScreen()->m_Active_Layer, CMP_N+1, -1); itmp = SelectLayer( GetScreen()->m_Active_Layer, CMP_N + 1, -1 );
if ( itmp >= 0 ) GetScreen()->m_Active_Layer = itmp; if( itmp >= 0 )
GetScreen()->m_Active_Layer = itmp;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_SELECT_CU_LAYER: case ID_POPUP_PCB_SELECT_CU_LAYER:
itmp = SelectLayer(GetScreen()->m_Active_Layer, -1, CMP_N); itmp = SelectLayer( GetScreen()->m_Active_Layer, -1, CMP_N );
if ( itmp >= 0 ) GetScreen()->m_Active_Layer = itmp; if( itmp >= 0 )
GetScreen()->m_Active_Layer = itmp;
break; break;
case ID_POPUP_PCB_SELECT_LAYER_PAIR: case ID_POPUP_PCB_SELECT_LAYER_PAIR:
...@@ -891,109 +929,110 @@ int itmp; ...@@ -891,109 +929,110 @@ int itmp;
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
itmp = m_SelLayerBox->GetChoice(); itmp = m_SelLayerBox->GetChoice();
GetScreen()->m_Active_Layer = (int)((size_t) m_SelLayerBox->GetClientData(itmp)); GetScreen()->m_Active_Layer = (int) ( (size_t) m_SelLayerBox->GetClientData( itmp ) );
if ( DisplayOpt.ContrastModeDisplay ) DrawPanel->Refresh(TRUE); if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh( TRUE );
break; break;
case ID_POPUP_PCB_EDIT_TEXTEPCB: case ID_POPUP_PCB_EDIT_TEXTEPCB:
InstallTextPCBOptionsFrame((TEXTE_PCB *)CURRENT_ITEM, InstallTextPCBOptionsFrame( (TEXTE_PCB*) CURRENT_ITEM,
&dc, pos); &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_ROTATE_TEXTEPCB: case ID_POPUP_PCB_ROTATE_TEXTEPCB:
Rotate_Texte_Pcb((TEXTE_PCB *)CURRENT_ITEM, &dc); Rotate_Texte_Pcb( (TEXTE_PCB*) CURRENT_ITEM, &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_DELETE_TEXTEPCB: case ID_POPUP_PCB_DELETE_TEXTEPCB:
Delete_Texte_Pcb((TEXTE_PCB *)CURRENT_ITEM, &dc); Delete_Texte_Pcb( (TEXTE_PCB*) CURRENT_ITEM, &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_MOVE_MIRE_REQUEST: case ID_POPUP_PCB_MOVE_MIRE_REQUEST:
StartMove_Mire((MIREPCB *)CURRENT_ITEM, &dc); StartMove_Mire( (MIREPCB*) CURRENT_ITEM, &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_EDIT_MIRE: case ID_POPUP_PCB_EDIT_MIRE:
InstallMireOptionsFrame((MIREPCB *)CURRENT_ITEM, &dc, pos); InstallMireOptionsFrame( (MIREPCB*) CURRENT_ITEM, &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_DELETE_MIRE: case ID_POPUP_PCB_DELETE_MIRE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Delete_Mire((MIREPCB *)CURRENT_ITEM, &dc); Delete_Mire( (MIREPCB*) CURRENT_ITEM, &dc );
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
break; break;
case ID_POPUP_PCB_DELETE_COTATION: case ID_POPUP_PCB_DELETE_COTATION:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Delete_Cotation((COTATION*)CURRENT_ITEM, &dc); Delete_Cotation( (COTATION*) CURRENT_ITEM, &dc );
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
break; break;
case ID_POPUP_PCB_EDIT_COTATION: case ID_POPUP_PCB_EDIT_COTATION:
Install_Edit_Cotation((COTATION*)CURRENT_ITEM, &dc, pos); Install_Edit_Cotation( (COTATION*) CURRENT_ITEM, &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_DELETE_DRAWING: case ID_POPUP_PCB_DELETE_DRAWING:
Delete_Segment_Edge((DRAWSEGMENT *)CURRENT_ITEM, &dc); Delete_Segment_Edge( (DRAWSEGMENT*) CURRENT_ITEM, &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_DELETE_DRAWING_LAYER: case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
Delete_Drawings_All_Layer((DRAWSEGMENT *)CURRENT_ITEM, &dc); Delete_Drawings_All_Layer( (DRAWSEGMENT*) CURRENT_ITEM, &dc );
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_EDIT_DRAWING: case ID_POPUP_PCB_EDIT_DRAWING:
Drawing_SetNewWidth((DRAWSEGMENT *)CURRENT_ITEM, &dc); Drawing_SetNewWidth( (DRAWSEGMENT*) CURRENT_ITEM, &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_MOVE_DRAWING_REQUEST: case ID_POPUP_PCB_MOVE_DRAWING_REQUEST:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Start_Move_DrawItem((DRAWSEGMENT *)CURRENT_ITEM, &dc); Start_Move_DrawItem( (DRAWSEGMENT*) CURRENT_ITEM, &dc );
break; break;
case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if ( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) ) if( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) )
{ {
End_Edge( (DRAWSEGMENT *)CURRENT_ITEM, &dc); End_Edge( (DRAWSEGMENT*) CURRENT_ITEM, &dc );
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
} }
break; break;
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE: case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if ( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) ) if( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) )
{ {
End_Zone(&dc); End_Zone( &dc );
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
} }
break; break;
case ID_POPUP_PCB_DELETE_EDGE_ZONE: case ID_POPUP_PCB_DELETE_EDGE_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if ( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) ) if( CURRENT_ITEM && (CURRENT_ITEM->m_Flags & IS_NEW) )
{ {
GetScreen()->m_CurrentItem = Del_SegmEdgeZone(&dc, GetScreen()->m_CurrentItem = Del_SegmEdgeZone( &dc,
(EDGE_ZONE *) CURRENT_ITEM); (EDGE_ZONE*) CURRENT_ITEM );
} }
break; break;
case ID_POPUP_PCB_FILL_ZONE: case ID_POPUP_PCB_FILL_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Fill_Zone(&dc); Fill_Zone( &dc );
break; break;
case ID_POPUP_PCB_SELECT_NET_ZONE: case ID_POPUP_PCB_SELECT_NET_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
CaptureNetName(&dc); CaptureNetName( &dc );
break; break;
case ID_POPUP_PCB_SELECT_WIDTH: case ID_POPUP_PCB_SELECT_WIDTH:
...@@ -1008,6 +1047,7 @@ int itmp; ...@@ -1008,6 +1047,7 @@ int itmp;
m_SelViaSizeBox_Changed = FALSE; m_SelViaSizeBox_Changed = FALSE;
} }
break; break;
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:
...@@ -1052,187 +1092,190 @@ int itmp; ...@@ -1052,187 +1092,190 @@ int itmp;
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:
Via_Edit_Control(&dc, id, (SEGVIA *) GetScreen()->m_CurrentItem); Via_Edit_Control( &dc, id, (SEGVIA*) GetScreen()->m_CurrentItem );
break; break;
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Start_MoveOneNodeOrSegment((TRACK *) GetScreen()->m_CurrentItem, Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->m_CurrentItem,
&dc, id); &dc, id );
break; break;
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
case ID_POPUP_PCB_MOVE_TRACK_NODE: case ID_POPUP_PCB_MOVE_TRACK_NODE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Start_MoveOneNodeOrSegment((TRACK *) GetScreen()->m_CurrentItem, Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->m_CurrentItem,
&dc, id); &dc, id );
break; break;
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE: case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Start_DragTrackSegmentAndKeepSlope((TRACK *) GetScreen()->m_CurrentItem, Start_DragTrackSegmentAndKeepSlope( (TRACK*) GetScreen()->m_CurrentItem,
&dc); &dc );
break; break;
case ID_POPUP_PCB_BREAK_TRACK: case ID_POPUP_PCB_BREAK_TRACK:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
{ {
TRACK * track = (TRACK *) GetScreen()->m_CurrentItem; TRACK* track = (TRACK*) GetScreen()->m_CurrentItem;
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->m_Curseur;
track->Draw(DrawPanel, &dc, GR_XOR); track->Draw( DrawPanel, &dc, GR_XOR );
TRACK * newtrack = CreateLockPoint(&pos.x, &pos.y, track, NULL); TRACK* newtrack = CreateLockPoint( &pos.x, &pos.y, track, NULL );
track->Draw(DrawPanel, &dc, GR_XOR); track->Draw( DrawPanel, &dc, GR_XOR );
newtrack->Draw(DrawPanel, &dc, GR_XOR); newtrack->Draw( DrawPanel, &dc, GR_XOR );
} }
break; break;
case ID_MENU_PCB_CLEAN: case ID_MENU_PCB_CLEAN:
Clean_Pcb(&dc); Clean_Pcb( &dc );
break; break;
case ID_MENU_PCB_SWAP_LAYERS: case ID_MENU_PCB_SWAP_LAYERS:
Swap_Layers(event); Swap_Layers( event );
break; break;
case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER: case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER:
GlobalRoute(&dc); GlobalRoute( &dc );
break; break;
case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA: case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA:
ReadAutoroutedTracks(&dc); ReadAutoroutedTracks( &dc );
break; break;
case ID_PCB_USER_GRID_SETUP: case ID_PCB_USER_GRID_SETUP:
InstallGridFrame(pos); InstallGridFrame( pos );
break; break;
case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC: case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC:
{ {
wxString msg = FindKicadHelpPath(); wxString msg = FindKicadHelpPath();
msg += EDA_Appl->m_EDA_CommonConfig->Read(wxT("module_doc_file"), msg += EDA_Appl->m_EDA_CommonConfig->Read( wxT( "module_doc_file" ),
wxT("pcbnew/footprints.pdf")); wxT( "pcbnew/footprints.pdf" ) );
GetAssociatedDocument(this, wxEmptyString, msg); GetAssociatedDocument( this, wxEmptyString, msg );
} }
break; break;
case ID_MENU_ARCHIVE_NEW_MODULES: case ID_MENU_ARCHIVE_NEW_MODULES:
Archive_Modules(wxEmptyString, TRUE); Archive_Modules( wxEmptyString, TRUE );
break; break;
case ID_MENU_ARCHIVE_ALL_MODULES: case ID_MENU_ARCHIVE_ALL_MODULES:
Archive_Modules(wxEmptyString, FALSE); Archive_Modules( wxEmptyString, FALSE );
break; break;
default: default:
{ {
DisplayError(this, wxT("WinEDA_PcbFrame::Process_Special_Functions() id error")); DisplayError( this, wxT( "WinEDA_PcbFrame::Process_Special_Functions() id error" ) );
break; break;
} }
} }
SetToolbars(); SetToolbars();
DrawPanel->CursorOn(&dc); DrawPanel->CursorOn( &dc );
DrawPanel->m_IgnoreMouseEvents = FALSE; 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: case TYPETEXTE:
frame->StartMoveTextePcb((TEXTE_PCB *) DrawStruct, DC); frame->StartMoveTextePcb( (TEXTE_PCB*) DrawStruct, DC );
break; break;
default: default:
wxString msg; wxString msg;
msg.Printf( msg.Printf(
wxT("WinEDA_PcbFrame::Move_Item Error: Bad DrawType %d"), wxT( "WinEDA_PcbFrame::Move_Item Error: Bad DrawType %d" ),
DrawStruct->m_StructType); DrawStruct->m_StructType );
DisplayError(frame, msg ); DisplayError( frame, msg );
break; 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 TYPETRACK:
case TYPEVIA: case TYPEVIA:
if (DrawStruct->m_Flags & IS_NEW) if( DrawStruct->m_Flags & IS_NEW )
{ {
End_Route( (TRACK *) DrawStruct, DC); End_Route( (TRACK*) DrawStruct, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
else if (DrawStruct->m_Flags == 0) else if( DrawStruct->m_Flags == 0 )
{ {
Edit_TrackSegm_Width(DC, Edit_TrackSegm_Width( DC,
(TRACK *) DrawStruct); (TRACK*) DrawStruct );
} }
break; break;
case TYPETEXTE: case TYPETEXTE:
InstallTextPCBOptionsFrame((TEXTE_PCB *)DrawStruct, InstallTextPCBOptionsFrame( (TEXTE_PCB*) DrawStruct,
DC, ((TEXTE_PCB *)DrawStruct)->m_Pos); DC, ( (TEXTE_PCB*) DrawStruct )->m_Pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case TYPEPAD: case TYPEPAD:
InstallPadOptionsFrame( InstallPadOptionsFrame(
(D_PAD *)DrawStruct, &dc, pos); (D_PAD*) DrawStruct, &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case TYPEMODULE: case TYPEMODULE:
InstallModuleOptionsFrame((MODULE *)DrawStruct, InstallModuleOptionsFrame( (MODULE*) DrawStruct,
&dc, pos); &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case TYPEMIRE: case TYPEMIRE:
InstallMireOptionsFrame( (MIREPCB *)DrawStruct, &dc, pos); InstallMireOptionsFrame( (MIREPCB*) DrawStruct, &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
InstallTextModOptionsFrame((TEXTE_MODULE *)DrawStruct, InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct,
&dc, pos); &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
...@@ -1242,18 +1285,19 @@ wxClientDC dc(DrawPanel); ...@@ -1242,18 +1285,19 @@ wxClientDC dc(DrawPanel);
default: default:
break; break;
} }
break; // end case 0 break; // end case 0
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
if ( DrawStruct && (DrawStruct->m_Flags & IS_NEW) ) if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
{ {
End_Route( (TRACK *) DrawStruct, DC); End_Route( (TRACK*) DrawStruct, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
break; break;
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
End_Zone(DC); End_Zone( DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
break; break;
...@@ -1261,62 +1305,64 @@ wxClientDC dc(DrawPanel); ...@@ -1261,62 +1305,64 @@ wxClientDC dc(DrawPanel);
case ID_LINE_COMMENT_BUTT: case ID_LINE_COMMENT_BUTT:
case ID_PCB_ARC_BUTT: case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT: case ID_PCB_CIRCLE_BUTT:
if ( DrawStruct == NULL ) break; if( DrawStruct == NULL )
if ( DrawStruct->m_StructType != TYPEDRAWSEGMENT ) break;
if( DrawStruct->m_StructType != TYPEDRAWSEGMENT )
{ {
DisplayError(this, wxT("DrawStruct Type error")); DisplayError( this, wxT( "DrawStruct Type error" ) );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
break; break;
} }
if ( (DrawStruct->m_Flags & IS_NEW) ) if( (DrawStruct->m_Flags & IS_NEW) )
{ {
End_Edge( (DRAWSEGMENT *) DrawStruct, &dc); End_Edge( (DRAWSEGMENT*) DrawStruct, &dc );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->m_CurrentItem = NULL; GetScreen()->m_CurrentItem = NULL;
} }
break; 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: case TYPEMODULE:
Delete_Module((MODULE *) Item, DC); Delete_Module( (MODULE*) Item, DC );
break; break;
case TYPECOTATION: case TYPECOTATION:
Delete_Cotation((COTATION *) Item, DC); Delete_Cotation( (COTATION*) Item, DC );
break; break;
case TYPEMIRE: case TYPEMIRE:
Delete_Mire((MIREPCB *) Item, DC); Delete_Mire( (MIREPCB*) Item, DC );
break; break;
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
Delete_Segment_Edge((DRAWSEGMENT *)Item, DC); Delete_Segment_Edge( (DRAWSEGMENT*) Item, DC );
break; break;
case TYPETEXTE: case TYPETEXTE:
Delete_Texte_Pcb((TEXTE_PCB *) Item, DC); Delete_Texte_Pcb( (TEXTE_PCB*) Item, DC );
break; break;
case TYPETRACK: case TYPETRACK:
Delete_Track(DC, (TRACK *)Item); Delete_Track( DC, (TRACK*) Item );
break; break;
case TYPEVIA: case TYPEVIA:
Delete_Segment(DC, (TRACK *)Item); Delete_Segment( DC, (TRACK*) Item );
break; break;
case TYPEZONE: case TYPEZONE:
Delete_Zone(DC, (SEGZONE*)Item); Delete_Zone( DC, (SEGZONE*) Item );
break; break;
case TYPEMARQUEUR: case TYPEMARQUEUR:
...@@ -1333,46 +1379,51 @@ void WinEDA_PcbFrame::RemoveStruct(EDA_BaseStruct * Item, wxDC * DC) ...@@ -1333,46 +1379,51 @@ void WinEDA_PcbFrame::RemoveStruct(EDA_BaseStruct * Item, wxDC * DC)
default: default:
{ {
wxString Line; wxString Line;
Line.Printf( wxT("Remove: StructType %d Inattendu"), Line.Printf( wxT( "Remove: StructType %d Inattendu" ),
Item->m_StructType); Item->m_StructType );
DisplayError(this, Line); 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 there is only one layer, don't switch.
if ( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1) if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 )
return; return;
//otherwise, must be at least 2 layers..see if it is possible.
if(layer == LAYER_CUIVRE_N || layer == LAYER_CMP_N ||
layer < m_Pcb->m_BoardSettings->m_CopperLayerCount-1){
if(preslayer == layer) //otherwise, must be at least 2 layers..see if it is possible.
if( layer == LAYER_CUIVRE_N || layer == LAYER_CMP_N
|| layer < m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
{
if( preslayer == layer )
return; return;
EDA_BaseStruct* current = GetScreen()->m_CurrentItem; EDA_BaseStruct* current = GetScreen()->m_CurrentItem;
//see if we are drawing a segment; if so, add a via? //see if we are drawing a segment; if so, add a via?
if ( m_ID_current_state == ID_TRACK_BUTT && current != NULL) if( m_ID_current_state == ID_TRACK_BUTT && current != NULL )
{
if( current->m_StructType == TYPETRACK && (current->m_Flags & IS_NEW) )
{ {
if(current->m_StructType == TYPETRACK && (current->m_Flags & IS_NEW)){
//want to set the routing layers so that it switches properly - //want to set the routing layers so that it switches properly -
//see the implementation of Other_Layer_Route - the working //see the implementation of Other_Layer_Route - the working
//layer is used to 'start' the via and set the layer masks appropriately. //layer is used to 'start' the via and set the layer masks appropriately.
GetScreen()->m_Route_Layer_TOP = preslayer; GetScreen()->m_Route_Layer_TOP = preslayer;
GetScreen()->m_Route_Layer_BOTTOM = layer; GetScreen()->m_Route_Layer_BOTTOM = layer;
GetScreen()->m_Active_Layer = preslayer; GetScreen()->m_Active_Layer = preslayer;
Other_Layer_Route( (TRACK *) GetScreen()->m_CurrentItem, DC); Other_Layer_Route( (TRACK*) GetScreen()->m_CurrentItem, DC );
} }
} }
GetScreen()->m_Active_Layer = layer; GetScreen()->m_Active_Layer = layer;
if ( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq(); 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