Hot key operations for a single module such as Move 'M', Rotate 'R', Swap Layer 'S', now operate only on unlocked modules
and only on modules in the current layer.
This commit is contained in:
parent
ad61cdaaa0
commit
f601dff4b1
|
@ -1,108 +1,134 @@
|
|||
/*******************************************************/
|
||||
/* class_module.h : module description (excepted pads) */
|
||||
/*******************************************************/
|
||||
/*******************************************************/
|
||||
/* class_module.h : module description (excepted pads) */
|
||||
/*******************************************************/
|
||||
|
||||
|
||||
class Pcb3D_GLCanvas;
|
||||
class Struct3D_Master;
|
||||
|
||||
/************************************/
|
||||
/* Modules (footprints) description */
|
||||
/* pad are in class_pad.xx */
|
||||
/************************************/
|
||||
/************************************/
|
||||
/* Modules (footprints) description */
|
||||
/* pad are in class_pad.xx */
|
||||
/************************************/
|
||||
|
||||
/* Format des modules:
|
||||
Description generale
|
||||
Description segments contour
|
||||
Description textes
|
||||
Description pastilles
|
||||
Description generale
|
||||
Description segments contour
|
||||
Description textes
|
||||
Description pastilles
|
||||
*/
|
||||
|
||||
/* Flags :*/
|
||||
|
||||
enum Mod_Attribut /* Attributs d'un module */
|
||||
{
|
||||
MOD_DEFAULT = 0, /* Type default */
|
||||
MOD_CMS = 1, /* Pour module apparaissant dans les
|
||||
fichiers de placement automatique (principalement modules CMS */
|
||||
MOD_VIRTUAL = 2 /* Module virtuel constitue par un dessin sur circuit
|
||||
(connecteur, trou de percage..) */
|
||||
};
|
||||
enum Mod_Attribut /* Attributs d'un module */
|
||||
{
|
||||
MOD_DEFAULT = 0, /* Type default */
|
||||
MOD_CMS = 1, /* Pour module apparaissant dans les
|
||||
fichiers de placement automatique (principalement modules CMS */
|
||||
MOD_VIRTUAL = 2 /* Module virtuel constitue par un dessin sur circuit
|
||||
(connecteur, trou de percage..) */
|
||||
};
|
||||
|
||||
/* flags for autoplace and autoroute (.m_ModuleStatus member) */
|
||||
#define MODULE_is_LOCKED 0x01 /* module LOCKED: no autoplace allowed */
|
||||
#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */
|
||||
#define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */
|
||||
#define MODULE_is_LOCKED 0x01 /* module LOCKED: no autoplace allowed */
|
||||
#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */
|
||||
#define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */
|
||||
|
||||
class MODULE: public EDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
int m_Layer; // layer number
|
||||
wxPoint m_Pos; // Real coord on board
|
||||
D_PAD * m_Pads; /* Pad list (linked list) */
|
||||
EDA_BaseStruct * m_Drawings; /* Graphic items list (linked list) */
|
||||
Struct3D_Master * m_3D_Drawings; /* Pointeur sur la liste des elements de trace 3D*/
|
||||
TEXTE_MODULE * m_Reference; // texte reference du composant (U34, R18..)
|
||||
TEXTE_MODULE * m_Value; // texte valeur du composant (74LS00, 22K..)
|
||||
wxString m_LibRef; /* nom du module en librairie */
|
||||
int m_Layer; // layer number
|
||||
wxPoint m_Pos; // Real coord on board
|
||||
D_PAD * m_Pads; /* Pad list (linked list) */
|
||||
EDA_BaseStruct * m_Drawings; /* Graphic items list (linked list) */
|
||||
Struct3D_Master * m_3D_Drawings; /* Pointeur sur la liste des elements de trace 3D*/
|
||||
TEXTE_MODULE * m_Reference; // texte reference du composant (U34, R18..)
|
||||
TEXTE_MODULE * m_Value; // texte valeur du composant (74LS00, 22K..)
|
||||
wxString m_LibRef; /* nom du module en librairie */
|
||||
|
||||
int m_Attributs; /* Flags bits a bit ( voir enum Mod_Attribut ) */
|
||||
int m_Orient ; /* orientation en 1/10 degres */
|
||||
int flag ; /* flag utilise en trace rastnest et routage auto */
|
||||
int m_ModuleStatus; /* For autoplace: flags (LOCKED, AUTOPLACED) */
|
||||
EDA_Rect m_BoundaryBox ; /* position/taille du cadre de reperage (coord locales)*/
|
||||
EDA_Rect m_RealBoundaryBox ; /* position/taille du module (coord relles) */
|
||||
int m_PadNum; // Nombre total de pads
|
||||
int m_AltPadNum; // en placement auto Nombre de pads actifs pour
|
||||
// les calculs
|
||||
int m_CntRot90; // Placement auto: cout ( 0..10 ) de la rotation 90 degre
|
||||
int m_CntRot180; // Placement auto: cout ( 0..10 ) de la rotation 180 degre
|
||||
wxSize m_Ext; // marges de "garde": utilise en placement auto.
|
||||
float m_Surface; // surface du rectangle d'encadrement
|
||||
int m_Attributs; /* Flags bits a bit ( voir enum Mod_Attribut ) */
|
||||
int m_Orient ; /* orientation en 1/10 degres */
|
||||
int flag ; /* flag utilise en trace rastnest et routage auto */
|
||||
int m_ModuleStatus; /* For autoplace: flags (LOCKED, AUTOPLACED) */
|
||||
EDA_Rect m_BoundaryBox; /* position/taille du cadre de reperage (coord locales)*/
|
||||
EDA_Rect m_RealBoundaryBox ; /* position/taille du module (coord relles) */
|
||||
int m_PadNum; // Nombre total de pads
|
||||
int m_AltPadNum; // en placement auto Nombre de pads actifs pour
|
||||
// les calculs
|
||||
int m_CntRot90; // Placement auto: cout ( 0..10 ) de la rotation 90 degre
|
||||
int m_CntRot180; // Placement auto: cout ( 0..10 ) de la rotation 180 degre
|
||||
wxSize m_Ext; // marges de "garde": utilise en placement auto.
|
||||
float m_Surface; // surface du rectangle d'encadrement
|
||||
|
||||
long m_Link; // variable temporaire ( pour editions, ...)
|
||||
long m_LastEdit_Time; // Date de la derniere modification du module (gestion de librairies)
|
||||
long m_Link; // variable temporaire ( pour editions, ...)
|
||||
long m_LastEdit_Time; // Date de la derniere modification du module (gestion de librairies)
|
||||
|
||||
wxString m_Doc; // Texte de description du module
|
||||
wxString m_KeyWord; // Liste des mots cles relatifs au module
|
||||
wxString m_Doc; // Texte de description du module
|
||||
wxString m_KeyWord; // Liste des mots cles relatifs au module
|
||||
|
||||
public:
|
||||
MODULE(BOARD * parent);
|
||||
MODULE(MODULE * module);
|
||||
~MODULE(void);
|
||||
MODULE(BOARD * parent);
|
||||
MODULE(MODULE * module);
|
||||
~MODULE(void);
|
||||
|
||||
void Copy(MODULE * Module); // Copy structure
|
||||
MODULE * Next(void) { return (MODULE *) Pnext; }
|
||||
void Copy(MODULE * Module); // Copy structure
|
||||
MODULE * Next(void) { return (MODULE *) Pnext; }
|
||||
|
||||
void Set_Rectangle_Encadrement(void); /* mise a jour du rect d'encadrement
|
||||
en coord locales (orient 0 et origine = pos module) */
|
||||
void SetRectangleExinscrit(void); /* mise a jour du rect d'encadrement
|
||||
et de la surface en coord reelles */
|
||||
void Set_Rectangle_Encadrement(void); /* mise a jour du rect d'encadrement
|
||||
en coord locales (orient 0 et origine = pos module) */
|
||||
|
||||
void SetRectangleExinscrit(void); /* mise a jour du rect d'encadrement
|
||||
et de la surface en coord reelles */
|
||||
|
||||
|
||||
// deplacements
|
||||
void SetPosition(const wxPoint & newpos);
|
||||
void SetOrientation(int newangle);
|
||||
// deplacements
|
||||
void SetPosition(const wxPoint & newpos);
|
||||
void SetOrientation(int newangle);
|
||||
|
||||
/* supprime du chainage la structure Struct */
|
||||
void UnLink( void );
|
||||
/* supprime du chainage la structure Struct */
|
||||
void UnLink( void );
|
||||
|
||||
/* Readind and writing data on files */
|
||||
int WriteDescr( FILE * File );
|
||||
int Write_3D_Descr( FILE * File );
|
||||
int ReadDescr( FILE * File, int * LineNum = NULL);
|
||||
int Read_3D_Descr( FILE * File, int * LineNum = NULL);
|
||||
|
||||
/* drawing functions */
|
||||
void Draw(WinEDA_DrawPanel * panel, wxDC * DC,
|
||||
const wxPoint & offset, int draw_mode);
|
||||
void Draw3D(Pcb3D_GLCanvas * glcanvas);
|
||||
void DrawEdgesOnly(WinEDA_DrawPanel * panel, wxDC * DC,
|
||||
const wxPoint & offset,int draw_mode);
|
||||
void DrawAncre(WinEDA_DrawPanel * panel, wxDC * DC,
|
||||
const wxPoint & offset, int dim_ancre, int draw_mode);
|
||||
/**
|
||||
* Function IsLocked
|
||||
* @returns bool - true if the MODULE is locked, else false
|
||||
*/
|
||||
bool IsLocked()
|
||||
{
|
||||
return (m_ModuleStatus & MODULE_is_LOCKED) != 0;
|
||||
}
|
||||
|
||||
/* miscellaneous */
|
||||
void Display_Infos(WinEDA_BasePcbFrame * frame);
|
||||
|
||||
/**
|
||||
* Function SetLocked
|
||||
* sets the MODULE_is_LOCKED bit in the m_ModuleStatus
|
||||
* @param setLocked When true means turn on locked status, else unlock
|
||||
*/
|
||||
void SetLocked( bool setLocked )
|
||||
{
|
||||
if( setLocked )
|
||||
m_ModuleStatus |= MODULE_is_LOCKED;
|
||||
else
|
||||
m_ModuleStatus &= ~MODULE_is_LOCKED;
|
||||
}
|
||||
|
||||
|
||||
/* Readind and writing data on files */
|
||||
int WriteDescr( FILE * File );
|
||||
int Write_3D_Descr( FILE * File );
|
||||
int ReadDescr( FILE * File, int * LineNum = NULL);
|
||||
int Read_3D_Descr( FILE * File, int * LineNum = NULL);
|
||||
|
||||
/* drawing functions */
|
||||
void Draw(WinEDA_DrawPanel * panel, wxDC * DC,
|
||||
const wxPoint & offset, int draw_mode);
|
||||
void Draw3D(Pcb3D_GLCanvas * glcanvas);
|
||||
void DrawEdgesOnly(WinEDA_DrawPanel * panel, wxDC * DC,
|
||||
const wxPoint & offset,int draw_mode);
|
||||
void DrawAncre(WinEDA_DrawPanel * panel, wxDC * DC,
|
||||
const wxPoint & offset, int dim_ancre, int draw_mode);
|
||||
|
||||
/* miscellaneous */
|
||||
void Display_Infos(WinEDA_BasePcbFrame * frame);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/***************/
|
||||
/* hotkeys.cpp */
|
||||
/***************/
|
||||
/***************/
|
||||
/* hotkeys.cpp */
|
||||
/***************/
|
||||
|
||||
#include "fctsys.h"
|
||||
|
||||
|
@ -18,129 +18,161 @@
|
|||
|
||||
/***********************************************************/
|
||||
void WinEDA_PcbFrame::OnHotKey(wxDC * DC, int hotkey,
|
||||
EDA_BaseStruct * DrawStruct)
|
||||
EDA_BaseStruct * DrawStruct)
|
||||
/***********************************************************/
|
||||
/* Gestion des commandes rapides (Raccourcis claviers) concernant l'element
|
||||
sous le courseur souris
|
||||
Les majuscules/minuscules sont indifferenciees
|
||||
touche DELETE: Effacement (Module ou piste selon commande en cours)
|
||||
touche V: Place via en cours de trace de piste
|
||||
touche R: Rotation module
|
||||
touche S: Change couche module (Composant <-> Cuivre)
|
||||
touche M: Start Move module
|
||||
touche G: Start Drag module
|
||||
touche DELETE: Effacement (Module ou piste selon commande en cours)
|
||||
touche V: Place via en cours de trace de piste
|
||||
touche R: Rotation module
|
||||
touche S: Change couche module (Composant <-> Cuivre)
|
||||
touche M: Start Move module
|
||||
touche G: Start Drag module
|
||||
*/
|
||||
{
|
||||
bool PopupOn = GetScreen()->m_CurrentItem &&
|
||||
GetScreen()->m_CurrentItem->m_Flags;
|
||||
bool ItemFree = (GetScreen()->m_CurrentItem == 0 ) ||
|
||||
(GetScreen()->m_CurrentItem->m_Flags == 0);
|
||||
bool PopupOn = GetScreen()->m_CurrentItem &&
|
||||
GetScreen()->m_CurrentItem->m_Flags;
|
||||
bool ItemFree = (GetScreen()->m_CurrentItem == 0 ) ||
|
||||
(GetScreen()->m_CurrentItem->m_Flags == 0);
|
||||
|
||||
if ( hotkey == 0 ) return;
|
||||
if ( hotkey == 0 ) return;
|
||||
|
||||
MODULE* module = NULL;
|
||||
MODULE* module = NULL;
|
||||
|
||||
switch (hotkey)
|
||||
{
|
||||
case WXK_DELETE:
|
||||
case WXK_NUMPAD_DELETE:
|
||||
OnHotkeyDeleteItem(DC, DrawStruct);
|
||||
break;
|
||||
case WXK_BACK:{
|
||||
if( m_ID_current_state == ID_TRACK_BUTT &&
|
||||
GetScreen()->m_Active_Layer <= CMP_N ){
|
||||
bool ItemFree = (GetScreen()->m_CurrentItem == NULL ) ||
|
||||
(GetScreen()->m_CurrentItem->m_Flags == 0);
|
||||
if ( ItemFree ){
|
||||
//no track is currently being edited - select a segment and remove it.
|
||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||
//don't let backspace delete modules!!
|
||||
if ( DrawStruct && (DrawStruct->m_StructType == TYPETRACK
|
||||
|| DrawStruct->m_StructType == TYPEVIA))
|
||||
Delete_Segment(DC, (TRACK*)DrawStruct);
|
||||
GetScreen()->SetModify();
|
||||
}
|
||||
else if ( GetScreen()->m_CurrentItem->m_StructType == TYPETRACK )
|
||||
{
|
||||
//then an element is being edited - remove the last segment.
|
||||
GetScreen()->m_CurrentItem =
|
||||
Delete_Segment(DC, (TRACK*)GetScreen()->m_CurrentItem);
|
||||
GetScreen()->SetModify();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WXK_END:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
End_Route( (TRACK *) (GetScreen()->m_CurrentItem), DC);
|
||||
break;
|
||||
case 'v': // Switch to alternate layer and Place a via if a track is in progress
|
||||
case 'V':
|
||||
if ( m_ID_current_state != ID_TRACK_BUTT ) return;
|
||||
if ( ItemFree )
|
||||
{
|
||||
Other_Layer_Route( NULL, DC);
|
||||
break;
|
||||
}
|
||||
if ( GetScreen()->m_CurrentItem->m_StructType != TYPETRACK )
|
||||
return;
|
||||
if ( (GetScreen()->m_CurrentItem->m_Flags & IS_NEW) == 0 )
|
||||
return;
|
||||
Other_Layer_Route( (TRACK *) GetScreen()->m_CurrentItem, DC);
|
||||
if ( DisplayOpt.ContrastModeDisplay )
|
||||
GetScreen()->SetRefreshReq();
|
||||
break;
|
||||
switch (hotkey)
|
||||
{
|
||||
case WXK_DELETE:
|
||||
case WXK_NUMPAD_DELETE:
|
||||
OnHotkeyDeleteItem(DC, DrawStruct);
|
||||
break;
|
||||
|
||||
case 'r': // Rotation
|
||||
case 'R':
|
||||
if ( ItemFree )
|
||||
module = Locate_Prefered_Module(m_Pcb, CURSEUR_ON_GRILLE);
|
||||
else if (GetScreen()->m_CurrentItem->m_StructType == TYPEMODULE)
|
||||
module = (MODULE*)GetScreen()->m_CurrentItem;
|
||||
if ( module )
|
||||
{
|
||||
GetScreen()->m_CurrentItem = module;
|
||||
module->Display_Infos(this);
|
||||
Rotate_Module(DC, module, 900, TRUE);
|
||||
}
|
||||
break;
|
||||
case WXK_BACK:
|
||||
{
|
||||
if( m_ID_current_state == ID_TRACK_BUTT &&
|
||||
GetScreen()->m_Active_Layer <= CMP_N )
|
||||
{
|
||||
bool ItemFree = (GetScreen()->m_CurrentItem == NULL ) ||
|
||||
(GetScreen()->m_CurrentItem->m_Flags == 0);
|
||||
if ( ItemFree )
|
||||
{
|
||||
//no track is currently being edited - select a segment and remove it.
|
||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||
//don't let backspace delete modules!!
|
||||
if ( DrawStruct && (DrawStruct->m_StructType == TYPETRACK
|
||||
|| DrawStruct->m_StructType == TYPEVIA))
|
||||
Delete_Segment(DC, (TRACK*)DrawStruct);
|
||||
GetScreen()->SetModify();
|
||||
}
|
||||
else if ( GetScreen()->m_CurrentItem->m_StructType == TYPETRACK )
|
||||
{
|
||||
//then an element is being edited - remove the last segment.
|
||||
GetScreen()->m_CurrentItem =
|
||||
Delete_Segment(DC, (TRACK*)GetScreen()->m_CurrentItem);
|
||||
GetScreen()->SetModify();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WXK_END:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
End_Route( (TRACK *) (GetScreen()->m_CurrentItem), DC);
|
||||
break;
|
||||
|
||||
case 's': // move to other side
|
||||
case 'S':
|
||||
if ( ItemFree )
|
||||
module = Locate_Prefered_Module(m_Pcb, CURSEUR_ON_GRILLE);
|
||||
else if (GetScreen()->m_CurrentItem->m_StructType == TYPEMODULE)
|
||||
module = (MODULE*)GetScreen()->m_CurrentItem;
|
||||
if ( module )
|
||||
{
|
||||
GetScreen()->m_CurrentItem = module;
|
||||
module->Display_Infos(this);
|
||||
Change_Side_Module(module, DC);
|
||||
}
|
||||
break;
|
||||
case 'v': // Switch to alternate layer and Place a via if a track is in progress
|
||||
case 'V':
|
||||
if ( m_ID_current_state != ID_TRACK_BUTT ) return;
|
||||
if ( ItemFree )
|
||||
{
|
||||
Other_Layer_Route( NULL, DC);
|
||||
break;
|
||||
}
|
||||
if ( GetScreen()->m_CurrentItem->m_StructType != TYPETRACK )
|
||||
return;
|
||||
if ( (GetScreen()->m_CurrentItem->m_Flags & IS_NEW) == 0 )
|
||||
return;
|
||||
Other_Layer_Route( (TRACK *) GetScreen()->m_CurrentItem, DC);
|
||||
if ( DisplayOpt.ContrastModeDisplay )
|
||||
GetScreen()->SetRefreshReq();
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
case 'G': // Start move (and drag) module
|
||||
g_Drag_Pistes_On = TRUE;
|
||||
case 'm':
|
||||
case 'M': // Start move module
|
||||
if ( PopupOn ) break;
|
||||
if ( (module = Locate_Prefered_Module(m_Pcb, CURSEUR_ON_GRILLE)) != NULL)
|
||||
{
|
||||
GetScreen()->m_CurrentItem = module;
|
||||
module->Display_Infos(this);
|
||||
StartMove_Module( module, DC);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'r': // Rotation
|
||||
case 'R':
|
||||
if ( ItemFree )
|
||||
module = Locate_Prefered_Module(m_Pcb,
|
||||
CURSEUR_ON_GRILLE | IGNORE_LOCKED | MATCH_LAYER );
|
||||
else if (GetScreen()->m_CurrentItem->m_StructType == TYPEMODULE)
|
||||
{
|
||||
module = (MODULE*)GetScreen()->m_CurrentItem;
|
||||
// @todo: might need to add a layer check in if() below
|
||||
if( module->IsLocked() )
|
||||
module = 0; // do not move it.
|
||||
}
|
||||
if ( module )
|
||||
{
|
||||
GetScreen()->m_CurrentItem = module;
|
||||
module->Display_Infos(this);
|
||||
Rotate_Module(DC, module, 900, TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
case 's': // move to other side
|
||||
case 'S':
|
||||
if ( ItemFree )
|
||||
module = Locate_Prefered_Module(m_Pcb,
|
||||
CURSEUR_ON_GRILLE | IGNORE_LOCKED | MATCH_LAYER );
|
||||
else if (GetScreen()->m_CurrentItem->m_StructType == TYPEMODULE)
|
||||
{
|
||||
module = (MODULE*)GetScreen()->m_CurrentItem;
|
||||
// @todo: might need to add a layer check in if() below
|
||||
if( module->IsLocked() )
|
||||
module = 0; // do not move it.
|
||||
}
|
||||
if ( module )
|
||||
{
|
||||
GetScreen()->m_CurrentItem = module;
|
||||
module->Display_Infos(this);
|
||||
Change_Side_Module(module, DC);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'L': // toggle module "MODULE_is_LOCKED" status:
|
||||
case 'l':
|
||||
// get any module, locked or not locked and toggle its locked status
|
||||
module = Locate_Prefered_Module( m_Pcb, CURSEUR_ON_GRILLE | MATCH_LAYER );
|
||||
if( module )
|
||||
{
|
||||
GetScreen()->m_CurrentItem = module;
|
||||
module->Display_Infos(this);
|
||||
module->SetLocked( !module->IsLocked() );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
case 'G': // Start move (and drag) module
|
||||
g_Drag_Pistes_On = TRUE;
|
||||
// fall through
|
||||
|
||||
case 'm':
|
||||
case 'M': // Start move module
|
||||
if ( PopupOn ) break;
|
||||
module = Locate_Prefered_Module( m_Pcb,
|
||||
CURSEUR_ON_GRILLE | IGNORE_LOCKED | MATCH_LAYER );
|
||||
if( module )
|
||||
{
|
||||
GetScreen()->m_CurrentItem = module;
|
||||
module->Display_Infos(this);
|
||||
StartMove_Module( module, DC);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
void WinEDA_ModuleEditFrame::OnHotKey(wxDC * DC, int hotkey,
|
||||
EDA_BaseStruct * DrawStruct)
|
||||
EDA_BaseStruct * DrawStruct)
|
||||
/***********************************************************/
|
||||
/* Gestion des commandes rapides (Raccourcis claviers) concernant l'element
|
||||
sous le courseur souris
|
||||
|
@ -148,88 +180,88 @@ sous le courseur souris
|
|||
*/
|
||||
{
|
||||
bool PopupOn = GetScreen()->m_CurrentItem &&
|
||||
GetScreen()->m_CurrentItem->m_Flags;
|
||||
if ( hotkey == 0 ) return;
|
||||
GetScreen()->m_CurrentItem->m_Flags;
|
||||
if ( hotkey == 0 ) return;
|
||||
|
||||
switch (hotkey)
|
||||
{
|
||||
case WXK_DELETE:
|
||||
case WXK_NUMPAD_DELETE:
|
||||
if ( PopupOn ) break;
|
||||
break;
|
||||
switch (hotkey)
|
||||
{
|
||||
case WXK_DELETE:
|
||||
case WXK_NUMPAD_DELETE:
|
||||
if ( PopupOn ) break;
|
||||
break;
|
||||
|
||||
case 'r': // Rotation
|
||||
case 'R':
|
||||
break;
|
||||
case 'r': // Rotation
|
||||
case 'R':
|
||||
break;
|
||||
|
||||
case 'y': // Mirror Y (drawlibpart)
|
||||
case 'Y':
|
||||
break;
|
||||
case 'y': // Mirror Y (drawlibpart)
|
||||
case 'Y':
|
||||
break;
|
||||
|
||||
case 'x': // Mirror X (drawlibpart)
|
||||
case 'X':
|
||||
break;
|
||||
case 'x': // Mirror X (drawlibpart)
|
||||
case 'X':
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
case 'N': // Orient 0, no mirror (drawlibpart)
|
||||
break;
|
||||
case 'n':
|
||||
case 'N': // Orient 0, no mirror (drawlibpart)
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
case 'M': // Start move drawlibpart
|
||||
if ( PopupOn ) break;
|
||||
break;
|
||||
}
|
||||
case 'm':
|
||||
case 'M': // Start move drawlibpart
|
||||
if ( PopupOn ) break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
bool WinEDA_PcbFrame::OnHotkeyDeleteItem(wxDC * DC, EDA_BaseStruct * DrawStruct)
|
||||
/******************************************************************************/
|
||||
/* Efface l'item pointe par la souris, en reponse a la touche "Del"
|
||||
Effet dependant de l'outil selectionne:
|
||||
Outil trace de pistes
|
||||
Efface le segment en cours ou la piste si pas d'element
|
||||
Outil module:
|
||||
Efface le module.
|
||||
Effet dependant de l'outil selectionne:
|
||||
Outil trace de pistes
|
||||
Efface le segment en cours ou la piste si pas d'element
|
||||
Outil module:
|
||||
Efface le module.
|
||||
*/
|
||||
{
|
||||
bool ItemFree = (GetScreen()->m_CurrentItem == NULL ) ||
|
||||
(GetScreen()->m_CurrentItem->m_Flags == 0);
|
||||
(GetScreen()->m_CurrentItem->m_Flags == 0);
|
||||
|
||||
switch ( m_ID_current_state )
|
||||
{
|
||||
case ID_TRACK_BUTT:
|
||||
if ( GetScreen()->m_Active_Layer > CMP_N ) return FALSE;
|
||||
if ( ItemFree )
|
||||
{
|
||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||
if ( DrawStruct && DrawStruct->m_StructType != TYPETRACK ) return FALSE;
|
||||
Delete_Track(DC, (TRACK*)DrawStruct);
|
||||
}
|
||||
else if ( GetScreen()->m_CurrentItem->m_StructType == TYPETRACK )
|
||||
{
|
||||
GetScreen()->m_CurrentItem =
|
||||
Delete_Segment(DC, (TRACK*)GetScreen()->m_CurrentItem);
|
||||
GetScreen()->SetModify();
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
switch ( m_ID_current_state )
|
||||
{
|
||||
case ID_TRACK_BUTT:
|
||||
if ( GetScreen()->m_Active_Layer > CMP_N ) return FALSE;
|
||||
if ( ItemFree )
|
||||
{
|
||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||
if ( DrawStruct && DrawStruct->m_StructType != TYPETRACK ) return FALSE;
|
||||
Delete_Track(DC, (TRACK*)DrawStruct);
|
||||
}
|
||||
else if ( GetScreen()->m_CurrentItem->m_StructType == TYPETRACK )
|
||||
{
|
||||
GetScreen()->m_CurrentItem =
|
||||
Delete_Segment(DC, (TRACK*)GetScreen()->m_CurrentItem);
|
||||
GetScreen()->SetModify();
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
if ( ItemFree )
|
||||
{
|
||||
MODULE * module = Locate_Prefered_Module(m_Pcb, CURSEUR_ON_GRILLE);
|
||||
if ( module == NULL ) return FALSE;
|
||||
if( ! IsOK(this, _("Delete module?")) ) return FALSE;
|
||||
RemoveStruct(module, DC);
|
||||
}
|
||||
else return FALSE;
|
||||
break;
|
||||
case ID_COMPONENT_BUTT:
|
||||
if ( ItemFree )
|
||||
{
|
||||
MODULE * module = Locate_Prefered_Module(m_Pcb, CURSEUR_ON_GRILLE);
|
||||
if ( module == NULL ) return FALSE;
|
||||
if( ! IsOK(this, _("Delete module?")) ) return FALSE;
|
||||
RemoveStruct(module, DC);
|
||||
}
|
||||
else return FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->m_CurrentItem = NULL;
|
||||
return TRUE;
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->m_CurrentItem = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
1712
pcbnew/locate.cpp
1712
pcbnew/locate.cpp
File diff suppressed because it is too large
Load Diff
|
@ -15,8 +15,12 @@
|
|||
|
||||
/* valeur de flag indicant si le pointeur de reference pour une localisation
|
||||
est le curseur sur grille ou le curseur a deplacement fin hors grille */
|
||||
#define CURSEUR_ON_GRILLE 0
|
||||
#define CURSEUR_OFF_GRILLE 1
|
||||
#define CURSEUR_ON_GRILLE (0<<0)
|
||||
#define CURSEUR_OFF_GRILLE (1<<1)
|
||||
#define IGNORE_LOCKED (1<<2) ///< if module is locked, do not select for single module operation
|
||||
#define MATCH_LAYER (1<<3) ///< if module not on current layer, do not select
|
||||
#define VISIBLE_ONLY (1<<4) ///< if module not on a visible layer, do not select
|
||||
|
||||
|
||||
#define START 0 /* ctes parametre dans les routines de localisation */
|
||||
#define END 1
|
||||
|
|
Loading…
Reference in New Issue