Loading pcbnew/hotkeys.cpp +14 −34 Original line number Original line Diff line number Diff line Loading @@ -202,12 +202,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, case HK_SWITCH_LAYER_TO_PREVIOUS: case HK_SWITCH_LAYER_TO_PREVIOUS: ll = GetScreen()->m_Active_Layer; ll = GetScreen()->m_Active_Layer; if( (ll <= FIRST_COPPER_LAYER) || (ll > LAST_COPPER_LAYER) ) if( (ll <= COPPER_LAYER_N) || (ll > CMP_N) ) break; break; if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer ll = COPPER_LAYER_N; ll = COPPER_LAYER_N; else if( ll == LAST_COPPER_LAYER ) else if( ll == CMP_N ) ll = MAX( FIRST_COPPER_LAYER, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 ); ll = MAX( COPPER_LAYER_N, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 ); else else ll--; ll--; SwitchLayer( DC, ll ); SwitchLayer( DC, ll ); Loading @@ -215,12 +215,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, case HK_SWITCH_LAYER_TO_NEXT: case HK_SWITCH_LAYER_TO_NEXT: ll = GetScreen()->m_Active_Layer; ll = GetScreen()->m_Active_Layer; if( (ll < FIRST_COPPER_LAYER) || (ll >= LAST_COPPER_LAYER) ) if( (ll < COPPER_LAYER_N) || (ll >= CMP_N) ) break; break; if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer ll = COPPER_LAYER_N; ll = COPPER_LAYER_N; else if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 ) else if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 ) ll = LAST_COPPER_LAYER; ll = CMP_N; else else ll++; ll++; SwitchLayer( DC, ll ); SwitchLayer( DC, ll ); Loading Loading @@ -299,7 +299,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, break; break; case HK_BACK_SPACE: case HK_BACK_SPACE: if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= LAST_COPPER_LAYER ) if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= CMP_N ) { { if( ItemFree ) if( ItemFree ) { { Loading @@ -314,23 +314,13 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, // don't let backspace delete modules!! // don't let backspace delete modules!! if( DrawStruct && (DrawStruct->Type() == TYPETRACK if( DrawStruct && (DrawStruct->Type() == TYPETRACK || DrawStruct->Type() == TYPEVIA) ) || DrawStruct->Type() == TYPEVIA) ) { Delete_Segment( DC, (TRACK*) DrawStruct ); Delete_Segment( DC, (TRACK*) DrawStruct ); SetCurItem(NULL); // this is an exception to the new rule that only the "selected" item // gets its Infos displayed, but we cannot "select" a deleted item. DrawStruct->Display_Infos(this); } GetScreen()->SetModify(); GetScreen()->SetModify(); } } else if( GetCurItem()->Type() == TYPETRACK ) else if( GetCurItem()->Type() == TYPETRACK ) { { // then an element is being edited - remove the last segment. // then an element is being edited - remove the last segment. Delete_Segment( DC, (TRACK*) GetCurItem() ); SetCurItem( Delete_Segment( DC, (TRACK*) GetCurItem() ) ); SetCurItem(NULL); // this is an exception to the new rule that only the "selected" item // gets its Infos displayed, but we cannot "select" a deleted item. DrawStruct->Display_Infos(this); GetScreen()->SetModify(); GetScreen()->SetModify(); } } } } Loading Loading @@ -395,7 +385,6 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, return; return; if( (GetCurItem()->m_Flags & IS_NEW) == 0 ) if( (GetCurItem()->m_Flags & IS_NEW) == 0 ) return; return; Other_Layer_Route( (TRACK*) GetCurItem(), DC ); // place via and switch layer Other_Layer_Route( (TRACK*) GetCurItem(), DC ); // place via and switch layer if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay ) GetScreen()->SetRefreshReq(); GetScreen()->SetRefreshReq(); Loading Loading @@ -575,33 +564,25 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ) * Delete the module. * Delete the module. */ */ { { bool ItemFree = (GetCurItem() == NULL ) || (GetCurItem()->m_Flags == 0); bool ItemFree = (GetCurItem() == NULL ) || (GetCurItem()->m_Flags == 0); switch( m_ID_current_state ) switch( m_ID_current_state ) { { case ID_TRACK_BUTT: case ID_TRACK_BUTT: if( GetScreen()->m_Active_Layer > LAST_COPPER_LAYER ) if( GetScreen()->m_Active_Layer > CMP_N ) return FALSE; return FALSE; if( ItemFree ) if( ItemFree ) { { DrawStruct = PcbGeneralLocateAndDisplay(); DrawStruct = PcbGeneralLocateAndDisplay(); if( DrawStruct && DrawStruct->Type() != TYPETRACK ) if( DrawStruct && DrawStruct->Type() != TYPETRACK ) return FALSE; return FALSE; Delete_Track( DC, (TRACK*) DrawStruct ); Delete_Track( DC, (TRACK*) DrawStruct ); SetCurItem(NULL); // this is an exception to the rule that only the "selected" item // gets its Infos displayed, but we cannot "select" a deleted item. DrawStruct->Display_Infos(this); } } else if( GetCurItem()->Type() == TYPETRACK ) else if( GetCurItem()->Type() == TYPETRACK ) { { Delete_Segment( DC, (TRACK*) GetCurItem() ); SetCurItem( SetCurItem(NULL); Delete_Segment( DC, (TRACK*) GetCurItem() ) ); // this is an exception to the new rule that only the "selected" item // gets its Infos displayed, but we cannot "select" a deleted item. DrawStruct->Display_Infos(this); GetScreen()->SetModify(); GetScreen()->SetModify(); return TRUE; return TRUE; } } Loading @@ -613,10 +594,8 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ) MODULE* module = Locate_Prefered_Module( m_Pcb, CURSEUR_ON_GRILLE ); MODULE* module = Locate_Prefered_Module( m_Pcb, CURSEUR_ON_GRILLE ); if( module == NULL ) if( module == NULL ) return FALSE; return FALSE; if( !IsOK( this, _( "Delete module?" ) ) ) if( !IsOK( this, _( "Delete module?" ) ) ) return FALSE; return FALSE; RemoveStruct( module, DC ); RemoveStruct( module, DC ); } } else else Loading @@ -631,3 +610,4 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ) SetCurItem( NULL ); SetCurItem( NULL ); return TRUE; return TRUE; } } Loading
pcbnew/hotkeys.cpp +14 −34 Original line number Original line Diff line number Diff line Loading @@ -202,12 +202,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, case HK_SWITCH_LAYER_TO_PREVIOUS: case HK_SWITCH_LAYER_TO_PREVIOUS: ll = GetScreen()->m_Active_Layer; ll = GetScreen()->m_Active_Layer; if( (ll <= FIRST_COPPER_LAYER) || (ll > LAST_COPPER_LAYER) ) if( (ll <= COPPER_LAYER_N) || (ll > CMP_N) ) break; break; if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer ll = COPPER_LAYER_N; ll = COPPER_LAYER_N; else if( ll == LAST_COPPER_LAYER ) else if( ll == CMP_N ) ll = MAX( FIRST_COPPER_LAYER, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 ); ll = MAX( COPPER_LAYER_N, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 ); else else ll--; ll--; SwitchLayer( DC, ll ); SwitchLayer( DC, ll ); Loading @@ -215,12 +215,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, case HK_SWITCH_LAYER_TO_NEXT: case HK_SWITCH_LAYER_TO_NEXT: ll = GetScreen()->m_Active_Layer; ll = GetScreen()->m_Active_Layer; if( (ll < FIRST_COPPER_LAYER) || (ll >= LAST_COPPER_LAYER) ) if( (ll < COPPER_LAYER_N) || (ll >= CMP_N) ) break; break; if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer ll = COPPER_LAYER_N; ll = COPPER_LAYER_N; else if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 ) else if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 ) ll = LAST_COPPER_LAYER; ll = CMP_N; else else ll++; ll++; SwitchLayer( DC, ll ); SwitchLayer( DC, ll ); Loading Loading @@ -299,7 +299,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, break; break; case HK_BACK_SPACE: case HK_BACK_SPACE: if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= LAST_COPPER_LAYER ) if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= CMP_N ) { { if( ItemFree ) if( ItemFree ) { { Loading @@ -314,23 +314,13 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, // don't let backspace delete modules!! // don't let backspace delete modules!! if( DrawStruct && (DrawStruct->Type() == TYPETRACK if( DrawStruct && (DrawStruct->Type() == TYPETRACK || DrawStruct->Type() == TYPEVIA) ) || DrawStruct->Type() == TYPEVIA) ) { Delete_Segment( DC, (TRACK*) DrawStruct ); Delete_Segment( DC, (TRACK*) DrawStruct ); SetCurItem(NULL); // this is an exception to the new rule that only the "selected" item // gets its Infos displayed, but we cannot "select" a deleted item. DrawStruct->Display_Infos(this); } GetScreen()->SetModify(); GetScreen()->SetModify(); } } else if( GetCurItem()->Type() == TYPETRACK ) else if( GetCurItem()->Type() == TYPETRACK ) { { // then an element is being edited - remove the last segment. // then an element is being edited - remove the last segment. Delete_Segment( DC, (TRACK*) GetCurItem() ); SetCurItem( Delete_Segment( DC, (TRACK*) GetCurItem() ) ); SetCurItem(NULL); // this is an exception to the new rule that only the "selected" item // gets its Infos displayed, but we cannot "select" a deleted item. DrawStruct->Display_Infos(this); GetScreen()->SetModify(); GetScreen()->SetModify(); } } } } Loading Loading @@ -395,7 +385,6 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, return; return; if( (GetCurItem()->m_Flags & IS_NEW) == 0 ) if( (GetCurItem()->m_Flags & IS_NEW) == 0 ) return; return; Other_Layer_Route( (TRACK*) GetCurItem(), DC ); // place via and switch layer Other_Layer_Route( (TRACK*) GetCurItem(), DC ); // place via and switch layer if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay ) GetScreen()->SetRefreshReq(); GetScreen()->SetRefreshReq(); Loading Loading @@ -575,33 +564,25 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ) * Delete the module. * Delete the module. */ */ { { bool ItemFree = (GetCurItem() == NULL ) || (GetCurItem()->m_Flags == 0); bool ItemFree = (GetCurItem() == NULL ) || (GetCurItem()->m_Flags == 0); switch( m_ID_current_state ) switch( m_ID_current_state ) { { case ID_TRACK_BUTT: case ID_TRACK_BUTT: if( GetScreen()->m_Active_Layer > LAST_COPPER_LAYER ) if( GetScreen()->m_Active_Layer > CMP_N ) return FALSE; return FALSE; if( ItemFree ) if( ItemFree ) { { DrawStruct = PcbGeneralLocateAndDisplay(); DrawStruct = PcbGeneralLocateAndDisplay(); if( DrawStruct && DrawStruct->Type() != TYPETRACK ) if( DrawStruct && DrawStruct->Type() != TYPETRACK ) return FALSE; return FALSE; Delete_Track( DC, (TRACK*) DrawStruct ); Delete_Track( DC, (TRACK*) DrawStruct ); SetCurItem(NULL); // this is an exception to the rule that only the "selected" item // gets its Infos displayed, but we cannot "select" a deleted item. DrawStruct->Display_Infos(this); } } else if( GetCurItem()->Type() == TYPETRACK ) else if( GetCurItem()->Type() == TYPETRACK ) { { Delete_Segment( DC, (TRACK*) GetCurItem() ); SetCurItem( SetCurItem(NULL); Delete_Segment( DC, (TRACK*) GetCurItem() ) ); // this is an exception to the new rule that only the "selected" item // gets its Infos displayed, but we cannot "select" a deleted item. DrawStruct->Display_Infos(this); GetScreen()->SetModify(); GetScreen()->SetModify(); return TRUE; return TRUE; } } Loading @@ -613,10 +594,8 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ) MODULE* module = Locate_Prefered_Module( m_Pcb, CURSEUR_ON_GRILLE ); MODULE* module = Locate_Prefered_Module( m_Pcb, CURSEUR_ON_GRILLE ); if( module == NULL ) if( module == NULL ) return FALSE; return FALSE; if( !IsOK( this, _( "Delete module?" ) ) ) if( !IsOK( this, _( "Delete module?" ) ) ) return FALSE; return FALSE; RemoveStruct( module, DC ); RemoveStruct( module, DC ); } } else else Loading @@ -631,3 +610,4 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ) SetCurItem( NULL ); SetCurItem( NULL ); return TRUE; return TRUE; } }