beautified

This commit is contained in:
dickelbeck 2007-08-04 00:56:53 +00:00
parent 97898b92aa
commit 72f7cb164c
1 changed files with 1282 additions and 1231 deletions

View File

@ -23,8 +23,9 @@ static void Process_Move_Item(WinEDA_PcbFrame * frame,
/********************************************************************/ /********************************************************************/
void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/********************************************************************/ /********************************************************************/
/* Traite les commandes declench<63>e par le bouton gauche de la souris, /* Traite les commandes declench<63>e par le bouton gauche de la souris,
quand un outil est deja selectionn<EFBFBD> * quand un outil est deja selectionn<EFBFBD>
*/ */
{ {
EDA_BaseStruct* DrawStruct = CURRENT_ITEM; EDA_BaseStruct* DrawStruct = CURRENT_ITEM;
@ -105,7 +106,6 @@ 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:
@ -114,12 +114,13 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
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;
@ -138,7 +139,8 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
{ {
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,8 +148,10 @@ 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 )
{ {
@ -160,12 +164,13 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
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;
@ -182,9 +187,11 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
{ {
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) )
{ {
@ -202,14 +209,15 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
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:
@ -224,7 +232,8 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
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:
@ -241,7 +250,8 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
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:
@ -256,15 +266,16 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
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:
@ -292,6 +303,7 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
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 );
@ -301,13 +313,14 @@ EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
/*********************************************************************/ /*********************************************************************/
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 );
@ -404,8 +417,8 @@ 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 );
} }
@ -418,12 +431,13 @@ int itmp;
} }
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 );
} }
@ -442,11 +456,14 @@ int itmp;
{ {
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,
-1 ),
wxSize( 600, 400 ) );
m_Parent->m_ModuleEditFrame->Show( TRUE ); m_Parent->m_ModuleEditFrame->Show( TRUE );
m_Parent->m_ModuleEditFrame->Zoom_Automatique( 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:
@ -509,7 +526,8 @@ int itmp;
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:
@ -578,31 +596,34 @@ int itmp;
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 )
break;
Edit_Track_Width( &dc, (TRACK*) CURRENT_ITEM ); 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 )
break;
Edit_TrackSegm_Width( &dc, (TRACK*) CURRENT_ITEM ); 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 )
break;
Edit_Net_Width( &dc, ( (TRACK*) CURRENT_ITEM )->m_NetCode ); Edit_Net_Width( &dc, ( (TRACK*) CURRENT_ITEM )->m_NetCode );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
GetScreen()->SetModify(); GetScreen()->SetModify();
@ -611,12 +632,16 @@ 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;
@ -648,16 +673,17 @@ int itmp;
} }
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;
@ -700,14 +726,16 @@ 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 )
break;
Delete_Zone( &dc, (SEGZONE*) CURRENT_ITEM ); 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 )
break;
Edit_Zone_Width( &dc, (SEGZONE*) CURRENT_ITEM ); Edit_Zone_Width( &dc, (SEGZONE*) CURRENT_ITEM );
break; break;
@ -727,7 +755,9 @@ int itmp;
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;
@ -751,6 +781,7 @@ int itmp;
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;
@ -764,6 +795,7 @@ 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;
@ -774,6 +806,7 @@ int itmp;
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;
@ -784,6 +817,7 @@ int itmp;
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;
@ -793,6 +827,7 @@ int itmp;
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;
@ -805,6 +840,7 @@ int itmp;
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 );
@ -831,7 +867,6 @@ int itmp;
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;
@ -865,7 +900,8 @@ int itmp;
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;
@ -875,13 +911,15 @@ int itmp;
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:
@ -892,7 +930,8 @@ 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:
@ -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:
@ -1141,10 +1181,11 @@ 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:
@ -1165,11 +1206,12 @@ static void Process_Move_Item(WinEDA_PcbFrame * frame,
/********************************************************************************/ /********************************************************************************/
void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/********************************************************************************/ /********************************************************************************/
/* Appel<65> sur un double click: /* Appel<65> sur un double click:
pour un <EFBFBD>l<EFBFBD>ment editable (textes, composant): * pour un <EFBFBD>l<EFBFBD>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;
@ -1191,6 +1233,7 @@ wxClientDC dc(DrawPanel);
// Element localis<69> // Element localis<69>
GetScreen()->m_CurrentItem = DrawStruct; GetScreen()->m_CurrentItem = DrawStruct;
switch( DrawStruct->m_StructType ) switch( DrawStruct->m_StructType )
{ {
case TYPETRACK: case TYPETRACK:
@ -1242,6 +1285,7 @@ wxClientDC dc(DrawPanel);
default: default:
break; break;
} }
break; // end case 0 break; // end case 0
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
@ -1261,7 +1305,8 @@ 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 )
break;
if( DrawStruct->m_StructType != TYPEDRAWSEGMENT ) if( DrawStruct->m_StructType != TYPEDRAWSEGMENT )
{ {
DisplayError( this, wxT( "DrawStruct Type error" ) ); DisplayError( this, wxT( "DrawStruct Type error" ) );
@ -1275,15 +1320,16 @@ wxClientDC dc(DrawPanel);
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 )
{ {
@ -1341,25 +1387,30 @@ void WinEDA_PcbFrame::RemoveStruct(EDA_BaseStruct * Item, wxDC * DC)
} }
} }
/****************************************************************/ /****************************************************************/
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){
//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 ) 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.