Commit 2c0377b0 authored by CHARRAS's avatar CHARRAS

more better hotkey.cpp and small changes in locate footprint

parent cd4ed0e7
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE #ifdef EDA_BASE
(wxT("(2007-06-25)")) (wxT("(2007-06-26)"))
#endif #endif
; ;
......
No preview for this file type
This diff is collapsed.
...@@ -38,9 +38,12 @@ sous le courseur souris ...@@ -38,9 +38,12 @@ sous le courseur souris
if ( hotkey == 0 ) return; if ( hotkey == 0 ) return;
// code Ctrl A = 1, Ctr B = 2 ..., remapped, (more easy to understand in switch)
if ( hotkey & GR_KB_CTRL ) hotkey += 'A' - 1;
MODULE* module = NULL; MODULE* module = NULL;
hotkey = toupper(hotkey); if ( hotkey <= 0xFF) hotkey = toupper(hotkey);
switch (hotkey) switch (hotkey)
{ {
case WXK_DELETE: case WXK_DELETE:
...@@ -49,7 +52,6 @@ sous le courseur souris ...@@ -49,7 +52,6 @@ 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 )
{ {
...@@ -74,13 +76,38 @@ sous le courseur souris ...@@ -74,13 +76,38 @@ sous le courseur souris
} }
} }
break; break;
}
case WXK_END: case WXK_END:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
End_Route( (TRACK *) (GetScreen()->m_CurrentItem), DC); End_Route( (TRACK *) (GetScreen()->m_CurrentItem), DC);
break; break;
case 'F' + GR_KB_CTRL :
{
wxCommandEvent evt;
evt.SetId(ID_FIND_ITEMS);
Process_Special_Functions(evt);
}
break;
case (int('O') + GR_KB_CTRL) :
{
//try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId(ID_LOAD_FILE);
Files_io(evt);
}
break;
case 'S' + GR_KB_CTRL:
{
//try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId(ID_SAVE_BOARD);
Files_io(evt);
}
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 )
...@@ -101,7 +128,7 @@ sous le courseur souris ...@@ -101,7 +128,7 @@ sous le courseur souris
case 'L': // toggle module "MODULE_is_LOCKED" status: case 'L': // toggle module "MODULE_is_LOCKED" status:
// get any module, locked or not locked and toggle its locked status // get any module, locked or not locked and toggle its locked status
if ( ItemFree ) if ( ItemFree )
module = Locate_Prefered_Module( m_Pcb, CURSEUR_ON_GRILLE | MATCH_LAYER ); module = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE | VISIBLE_ONLY );
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;
if( module ) if( module )
...@@ -120,14 +147,13 @@ sous le courseur souris ...@@ -120,14 +147,13 @@ sous le courseur souris
if ( ItemFree ) if ( ItemFree )
{ {
module = Locate_Prefered_Module(m_Pcb, module = Locate_Prefered_Module(m_Pcb,
CURSEUR_ON_GRILLE | IGNORE_LOCKED | MATCH_LAYER ); CURSEUR_OFF_GRILLE | IGNORE_LOCKED | VISIBLE_ONLY /*MATCH_LAYER */ );
if ( module == NULL ) // no footprint found if ( module == NULL ) // no footprint found
{ {
module = Locate_Prefered_Module(m_Pcb, CURSEUR_ON_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") );
else DisplayInfo(this, _("Footprint found, but not on this layer") );
module = NULL; module = NULL;
} }
} }
......
...@@ -163,7 +163,7 @@ EDA_BaseStruct * item; ...@@ -163,7 +163,7 @@ EDA_BaseStruct * item;
{ {
TEXTE_MODULE * pt_texte; TEXTE_MODULE * pt_texte;
if ( module->m_Layer != LayerSearch) continue; if ( module->m_Layer != LayerSearch) continue;
pt_texte = LocateTexteModule(m_Pcb, &module, typeloc); pt_texte = LocateTexteModule(m_Pcb, &module, typeloc | VISIBLE_ONLY);
if( pt_texte != NULL ) if( pt_texte != NULL )
{ {
Affiche_Infos_E_Texte(this, module, pt_texte); Affiche_Infos_E_Texte(this, module, pt_texte);
...@@ -176,7 +176,7 @@ EDA_BaseStruct * item; ...@@ -176,7 +176,7 @@ EDA_BaseStruct * item;
module = NULL; module = NULL;
{ {
TEXTE_MODULE * pt_texte; TEXTE_MODULE * pt_texte;
pt_texte = LocateTexteModule(m_Pcb, &module, typeloc); pt_texte = LocateTexteModule(m_Pcb, &module, typeloc | VISIBLE_ONLY);
if( pt_texte != NULL ) if( pt_texte != NULL )
{ {
Affiche_Infos_E_Texte(this, module, pt_texte); Affiche_Infos_E_Texte(this, module, pt_texte);
...@@ -185,7 +185,7 @@ EDA_BaseStruct * item; ...@@ -185,7 +185,7 @@ EDA_BaseStruct * item;
} }
/* Search for a footprint */ /* Search for a footprint */
if ( (module = Locate_Prefered_Module(m_Pcb, typeloc)) != NULL) if ( (module = Locate_Prefered_Module(m_Pcb, typeloc | VISIBLE_ONLY)) != NULL)
{ {
module->Display_Infos(this); module->Display_Infos(this);
return module; return module;
...@@ -738,6 +738,8 @@ TEXTE_MODULE * LocateTexteModule(BOARD * Pcb, MODULE ** PtModule, int typeloc) ...@@ -738,6 +738,8 @@ TEXTE_MODULE * LocateTexteModule(BOARD * Pcb, MODULE ** PtModule, int typeloc)
retourne retourne
- pointeur sur le texte localise ( ou NULL ) - pointeur sur le texte localise ( ou NULL )
- si Ptmodule != NULL: pointeur sur module module ( non modifie sinon ) - si Ptmodule != NULL: pointeur sur module module ( non modifie sinon )
if typeloc bas the flag VISIBLE_ONLY set, only footprints which are "visible" are considered
*/ */
{ {
EDA_BaseStruct * PtStruct; EDA_BaseStruct * PtStruct;
...@@ -755,6 +757,13 @@ wxPoint ref_pos; ...@@ -755,6 +757,13 @@ wxPoint ref_pos;
for( ; module != NULL; module = (MODULE*)module->Pnext ) for( ; module != NULL; module = (MODULE*)module->Pnext )
{ {
if ( (typeloc & VISIBLE_ONLY) )
{
int layer = module->m_Layer;
if( layer==ADHESIVE_N_CU || layer==SILKSCREEN_N_CU ) layer = CUIVRE_N;
else if( layer==ADHESIVE_N_CMP || layer==SILKSCREEN_N_CMP ) layer = CMP_N;
if ( ! IsModuleLayerVisible( layer ) ) continue;
}
pt_txt_mod = module->m_Reference; pt_txt_mod = module->m_Reference;
/* la souris est-elle dans le rectangle autour du texte*/ /* la souris est-elle dans le rectangle autour du texte*/
if( pt_txt_mod->Locate(ref_pos) ) if( pt_txt_mod->Locate(ref_pos) )
......
...@@ -117,9 +117,9 @@ double value; ...@@ -117,9 +117,9 @@ double value;
/****************************************************************************/ /****************************************************************************/
void WinEDA_PcbFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu) void WinEDA_PcbFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu)
/****************************************************************************/ /****************************************************************************/
/* Prepare le menu PopUp affich� par un click sur le bouton droit /* Create the PopUp menu (click on right mouse button)
de la souris. de la souris.
Ce menu est ensuite compl�t� par la liste des commandes de ZOOM The ZOOM menu is added to this menu
*/ */
{ {
EDA_BaseStruct *DrawStruct = m_CurrentScreen->m_CurrentItem; EDA_BaseStruct *DrawStruct = m_CurrentScreen->m_CurrentItem;
...@@ -137,14 +137,14 @@ wxClientDC dc(DrawPanel); ...@@ -137,14 +137,14 @@ wxClientDC dc(DrawPanel);
{ {
if (m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE) if (m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE)
{ {
DrawStruct = Locate_Prefered_Module(m_Pcb, CURSEUR_OFF_GRILLE); DrawStruct = Locate_Prefered_Module(m_Pcb, CURSEUR_OFF_GRILLE | VISIBLE_ONLY);
if ( DrawStruct ) ((MODULE*)DrawStruct)->Display_Infos(this); if ( DrawStruct ) ((MODULE*)DrawStruct)->Display_Infos(this);
else DrawStruct = PcbGeneralLocateAndDisplay(); else DrawStruct = PcbGeneralLocateAndDisplay();
} }
else DrawStruct = PcbGeneralLocateAndDisplay(); else DrawStruct = PcbGeneralLocateAndDisplay();
} }
// Si commande en cours: affichage fin de commande // If command in progress: Put the Cancel command (if needed) and End command
if ( m_ID_current_state ) if ( m_ID_current_state )
{ {
if ( DrawStruct && DrawStruct->m_Flags ) if ( DrawStruct && DrawStruct->m_Flags )
...@@ -187,7 +187,7 @@ wxClientDC dc(DrawPanel); ...@@ -187,7 +187,7 @@ wxClientDC dc(DrawPanel);
if( !flags ) if( !flags )
{ {
ADD_MENUITEM(PopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST, ADD_MENUITEM(PopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST,
_("Footprint Get and Move (F)"), Move_Module_xpm); _("Get and Move Footprint"), Move_Module_xpm);
} }
if ( DrawStruct ) if ( DrawStruct )
{ {
...@@ -200,7 +200,7 @@ wxClientDC dc(DrawPanel); ...@@ -200,7 +200,7 @@ wxClientDC dc(DrawPanel);
if (m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE) if (m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE)
{ {
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM(PopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, _("Fix Module"), ADD_MENUITEM(PopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, _("Lock Module"),
Locked_xpm); Locked_xpm);
ADD_MENUITEM(PopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, _("Free Module"), ADD_MENUITEM(PopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, _("Free Module"),
Unlocked_xpm); Unlocked_xpm);
......
...@@ -900,12 +900,10 @@ bool escape = FALSE; ...@@ -900,12 +900,10 @@ bool escape = FALSE;
break; break;
} }
if( event.ControlDown() ) localkey |= GR_KB_CTRL; if( event.ControlDown() ) localkey |= GR_KB_CTRL;
if( event.AltDown() ) localkey |= GR_KB_ALT; if( event.AltDown() ) localkey |= GR_KB_ALT;
if( event.ShiftDown() && (key > 256) ) localkey |= GR_KB_SHIFT; if( event.ShiftDown() && (key > 256) ) localkey |= GR_KB_SHIFT;
wxClientDC DC(this); wxClientDC DC(this);
BASE_SCREEN * Screen = GetScreen(); BASE_SCREEN * Screen = GetScreen();
...@@ -925,6 +923,10 @@ BASE_SCREEN * Screen = GetScreen(); ...@@ -925,6 +923,10 @@ BASE_SCREEN * Screen = GetScreen();
} }
m_Parent->GeneralControle(&DC, Screen->m_MousePositionInPixels); m_Parent->GeneralControle(&DC, Screen->m_MousePositionInPixels);
#if 0
event.Skip(); // Allow menu shortcut processing
#endif
} }
......
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