beautified
This commit is contained in:
parent
2ba87b4a86
commit
7d8f2fcff0
|
@ -20,30 +20,35 @@
|
||||||
void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
|
void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
EDA_BaseStruct* DrawStruct )
|
EDA_BaseStruct* DrawStruct )
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
|
||||||
/* Gestion des commandes rapides (Raccourcis claviers) concernant l'element
|
/* Gestion des commandes rapides (Raccourcis claviers) concernant l'element
|
||||||
sous le courseur souris
|
* sous le courseur souris
|
||||||
Les majuscules/minuscules sont indifferenciees
|
* Les majuscules/minuscules sont indifferenciees
|
||||||
touche DELETE: Effacement (Module ou piste selon commande en cours)
|
* touche DELETE: Effacement (Module ou piste selon commande en cours)
|
||||||
touche V: Place via en cours de trace de piste
|
* touche V: Place via en cours de trace de piste
|
||||||
touche R: Rotation module
|
* touche R: Rotation module
|
||||||
touche S: Change couche module (Composant <-> Cuivre)
|
* touche S: Change couche module (Composant <-> Cuivre)
|
||||||
touche M: Start Move module
|
* touche M: Start Move module
|
||||||
touche G: Start Drag module
|
* touche G: Start Drag module
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bool PopupOn = GetScreen()->m_CurrentItem &&
|
bool PopupOn = GetScreen()->m_CurrentItem
|
||||||
GetScreen()->m_CurrentItem->m_Flags;
|
&& GetScreen()->m_CurrentItem->m_Flags;
|
||||||
bool ItemFree = (GetScreen()->m_CurrentItem == 0 ) ||
|
bool ItemFree = (GetScreen()->m_CurrentItem == 0 )
|
||||||
(GetScreen()->m_CurrentItem->m_Flags == 0);
|
|| (GetScreen()->m_CurrentItem->m_Flags == 0);
|
||||||
|
|
||||||
if ( hotkey == 0 ) return;
|
if( hotkey == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
// code Ctrl A = 1, Ctr B = 2 ..., remapped, (more easy to understand in switch)
|
// code Ctrl A = 1, Ctr B = 2 ..., remapped, (more easy to understand in switch)
|
||||||
if ( hotkey & GR_KB_CTRL ) hotkey += 'A' - 1;
|
if( hotkey & GR_KB_CTRL )
|
||||||
|
hotkey += 'A' - 1;
|
||||||
|
|
||||||
MODULE* module = NULL;
|
MODULE* module = NULL;
|
||||||
|
|
||||||
if ( hotkey <= 0xFF) hotkey = toupper(hotkey);
|
if( hotkey <= 0xFF )
|
||||||
|
hotkey = toupper( hotkey );
|
||||||
|
|
||||||
switch( hotkey )
|
switch( hotkey )
|
||||||
{
|
{
|
||||||
case WXK_DELETE:
|
case WXK_DELETE:
|
||||||
|
@ -52,15 +57,15 @@ sous le courseur souris
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_BACK:
|
case WXK_BACK:
|
||||||
if( m_ID_current_state == ID_TRACK_BUTT &&
|
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= CMP_N )
|
||||||
GetScreen()->m_Active_Layer <= CMP_N )
|
|
||||||
{
|
{
|
||||||
bool ItemFree = (GetScreen()->m_CurrentItem == NULL ) ||
|
bool ItemFree = (GetScreen()->m_CurrentItem == NULL )
|
||||||
(GetScreen()->m_CurrentItem->m_Flags == 0);
|
|| (GetScreen()->m_CurrentItem->m_Flags == 0);
|
||||||
if( ItemFree )
|
if( ItemFree )
|
||||||
{
|
{
|
||||||
//no track is currently being edited - select a segment and remove it.
|
//no track is currently being edited - select a segment and remove it.
|
||||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||||
|
|
||||||
//don't let backspace delete modules!!
|
//don't let backspace delete modules!!
|
||||||
if( DrawStruct && (DrawStruct->m_StructType == TYPETRACK
|
if( DrawStruct && (DrawStruct->m_StructType == TYPETRACK
|
||||||
|| DrawStruct->m_StructType == TYPEVIA) )
|
|| DrawStruct->m_StructType == TYPEVIA) )
|
||||||
|
@ -90,7 +95,7 @@ sous le courseur souris
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int('O') + GR_KB_CTRL) :
|
case 'O' + GR_KB_CTRL:
|
||||||
{
|
{
|
||||||
//try not to duplicate save, load code etc.
|
//try not to duplicate save, load code etc.
|
||||||
wxCommandEvent evt;
|
wxCommandEvent evt;
|
||||||
|
@ -109,7 +114,8 @@ sous le courseur souris
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'V': // Switch to alternate layer and Place a via if a track is in progress
|
case 'V': // Switch to alternate layer and Place a via if a track is in progress
|
||||||
if ( m_ID_current_state != ID_TRACK_BUTT ) return;
|
if( m_ID_current_state != ID_TRACK_BUTT )
|
||||||
|
return;
|
||||||
if( ItemFree )
|
if( ItemFree )
|
||||||
{
|
{
|
||||||
Other_Layer_Route( NULL, DC );
|
Other_Layer_Route( NULL, DC );
|
||||||
|
@ -141,7 +147,9 @@ sous le courseur souris
|
||||||
|
|
||||||
case 'G': // Start move (and drag) module
|
case 'G': // Start move (and drag) module
|
||||||
case 'M': // Start move module
|
case 'M': // Start move module
|
||||||
if ( PopupOn ) break;
|
if( PopupOn )
|
||||||
|
break;
|
||||||
|
|
||||||
case 'R': // Rotation
|
case 'R': // Rotation
|
||||||
case 'S': // move to other side
|
case 'S': // move to other side
|
||||||
if( ItemFree )
|
if( ItemFree )
|
||||||
|
@ -157,23 +165,26 @@ sous le courseur souris
|
||||||
module = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE );
|
module = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE );
|
||||||
if( module ) // a footprint is found, but locked or on an other layer
|
if( module ) // a footprint is found, but locked or on an other layer
|
||||||
{
|
{
|
||||||
if ( module->IsLocked() ) DisplayInfo(this, _("Footprint found, but locked") );
|
if( module->IsLocked() )
|
||||||
|
DisplayInfo( this, _( "Footprint found, but locked" ) );
|
||||||
module = NULL;
|
module = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( GetScreen()->m_CurrentItem->m_StructType == TYPEMODULE )
|
else if( GetScreen()->m_CurrentItem->m_StructType == TYPEMODULE )
|
||||||
{
|
{
|
||||||
module = (MODULE*) GetScreen()->m_CurrentItem;
|
module = (MODULE*) GetScreen()->m_CurrentItem;
|
||||||
|
|
||||||
// @todo: might need to add a layer check in if() below
|
// @todo: might need to add a layer check in if() below
|
||||||
if ( (GetScreen()->m_CurrentItem->m_Flags == 0) &&
|
if( (GetScreen()->m_CurrentItem->m_Flags == 0)
|
||||||
module->IsLocked() )
|
&& module->IsLocked() )
|
||||||
module = NULL; // do not move, rotate ... it.
|
module = NULL; // do not move, rotate ... it.
|
||||||
}
|
}
|
||||||
if ( module == NULL) break;
|
if( module == NULL )
|
||||||
|
break;
|
||||||
|
|
||||||
GetScreen()->m_CurrentItem = module;
|
GetScreen()->m_CurrentItem = module;
|
||||||
|
|
||||||
switch( hotkey )
|
switch( hotkey )
|
||||||
{
|
{
|
||||||
case 'R': // Rotation
|
case 'R': // Rotation
|
||||||
|
@ -186,11 +197,14 @@ sous le courseur souris
|
||||||
|
|
||||||
case 'G': // Start move (and drag) module
|
case 'G': // Start move (and drag) module
|
||||||
g_Drag_Pistes_On = TRUE;
|
g_Drag_Pistes_On = TRUE;
|
||||||
|
|
||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
case 'M': // Start move module
|
case 'M': // Start move module
|
||||||
StartMove_Module( module, DC );
|
StartMove_Module( module, DC );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
module->Display_Infos( this );
|
module->Display_Infos( this );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -201,20 +215,24 @@ sous le courseur souris
|
||||||
void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
|
void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
EDA_BaseStruct* DrawStruct )
|
EDA_BaseStruct* DrawStruct )
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
|
||||||
/* Gestion des commandes rapides (Raccourcis claviers) concernant l'element
|
/* Gestion des commandes rapides (Raccourcis claviers) concernant l'element
|
||||||
sous le courseur souris
|
* sous le courseur souris
|
||||||
Les majuscules/minuscules sont indifferenciees
|
* Les majuscules/minuscules sont indifferenciees
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bool PopupOn = GetScreen()->m_CurrentItem &&
|
bool PopupOn = GetScreen()->m_CurrentItem
|
||||||
GetScreen()->m_CurrentItem->m_Flags;
|
&& GetScreen()->m_CurrentItem->m_Flags;
|
||||||
if ( hotkey == 0 ) return;
|
|
||||||
|
if( hotkey == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
switch( hotkey )
|
switch( hotkey )
|
||||||
{
|
{
|
||||||
case WXK_DELETE:
|
case WXK_DELETE:
|
||||||
case WXK_NUMPAD_DELETE:
|
case WXK_NUMPAD_DELETE:
|
||||||
if ( PopupOn ) break;
|
if( PopupOn )
|
||||||
|
break;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r': // Rotation
|
case 'r': // Rotation
|
||||||
|
@ -235,33 +253,38 @@ bool PopupOn = GetScreen()->m_CurrentItem &&
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
case 'M': // Start move drawlibpart
|
case 'M': // Start move drawlibpart
|
||||||
if ( PopupOn ) break;
|
if( PopupOn )
|
||||||
|
break;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
|
bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/* Efface l'item pointe par la souris, en reponse a la touche "Del"
|
/* Efface l'item pointe par la souris, en reponse a la touche "Del"
|
||||||
Effet dependant de l'outil selectionne:
|
* Effet dependant de l'outil selectionne:
|
||||||
Outil trace de pistes
|
* Outil trace de pistes
|
||||||
Efface le segment en cours ou la piste si pas d'element
|
* Efface le segment en cours ou la piste si pas d'element
|
||||||
Outil module:
|
* Outil module:
|
||||||
Efface le module.
|
* Efface le module.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bool ItemFree = (GetScreen()->m_CurrentItem == NULL ) ||
|
bool ItemFree = (GetScreen()->m_CurrentItem == NULL )
|
||||||
(GetScreen()->m_CurrentItem->m_Flags == 0);
|
|| (GetScreen()->m_CurrentItem->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 > CMP_N ) return FALSE;
|
if( GetScreen()->m_Active_Layer > CMP_N )
|
||||||
|
return FALSE;
|
||||||
if( ItemFree )
|
if( ItemFree )
|
||||||
{
|
{
|
||||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||||
if ( DrawStruct && DrawStruct->m_StructType != TYPETRACK ) return FALSE;
|
if( DrawStruct && DrawStruct->m_StructType != TYPETRACK )
|
||||||
|
return FALSE;
|
||||||
Delete_Track( DC, (TRACK*) DrawStruct );
|
Delete_Track( DC, (TRACK*) DrawStruct );
|
||||||
}
|
}
|
||||||
else if( GetScreen()->m_CurrentItem->m_StructType == TYPETRACK )
|
else if( GetScreen()->m_CurrentItem->m_StructType == TYPETRACK )
|
||||||
|
@ -277,11 +300,14 @@ bool ItemFree = (GetScreen()->m_CurrentItem == NULL ) ||
|
||||||
if( ItemFree )
|
if( ItemFree )
|
||||||
{
|
{
|
||||||
MODULE* module = Locate_Prefered_Module( m_Pcb, CURSEUR_ON_GRILLE );
|
MODULE* module = Locate_Prefered_Module( m_Pcb, CURSEUR_ON_GRILLE );
|
||||||
if ( module == NULL ) return FALSE;
|
if( module == NULL )
|
||||||
if( ! IsOK(this, _("Delete module?")) ) return FALSE;
|
return FALSE;
|
||||||
|
if( !IsOK( this, _( "Delete module?" ) ) )
|
||||||
|
return FALSE;
|
||||||
RemoveStruct( module, DC );
|
RemoveStruct( module, DC );
|
||||||
}
|
}
|
||||||
else return FALSE;
|
else
|
||||||
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue