more better hotkey.cpp and small changes in locate footprint

This commit is contained in:
CHARRAS 2007-06-26 10:42:11 +00:00
parent cd4ed0e7e6
commit 2c0377b02b
7 changed files with 501 additions and 458 deletions

View File

@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE
(wxT("(2007-06-25)"))
(wxT("(2007-06-26)"))
#endif
;

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -38,9 +38,12 @@ sous le courseur souris
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;
hotkey = toupper(hotkey);
if ( hotkey <= 0xFF) hotkey = toupper(hotkey);
switch (hotkey)
{
case WXK_DELETE:
@ -49,7 +52,6 @@ sous le courseur souris
break;
case WXK_BACK:
{
if( m_ID_current_state == ID_TRACK_BUTT &&
GetScreen()->m_Active_Layer <= CMP_N )
{
@ -74,13 +76,38 @@ sous le courseur souris
}
}
break;
}
case WXK_END:
DrawPanel->MouseToCursorSchema();
End_Route( (TRACK *) (GetScreen()->m_CurrentItem), DC);
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
if ( m_ID_current_state != ID_TRACK_BUTT ) return;
if ( ItemFree )
@ -101,7 +128,7 @@ sous le courseur souris
case 'L': // toggle module "MODULE_is_LOCKED" status:
// get any module, locked or not locked and toggle its locked status
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)
module = (MODULE*)GetScreen()->m_CurrentItem;
if( module )
@ -120,14 +147,13 @@ sous le courseur souris
if ( ItemFree )
{
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
{
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->IsLocked() ) DisplayInfo(this, _("Footprint found, but locked") );
else DisplayInfo(this, _("Footprint found, but not on this layer") );
module = NULL;
}
}

View File

@ -163,7 +163,7 @@ EDA_BaseStruct * item;
{
TEXTE_MODULE * pt_texte;
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 )
{
Affiche_Infos_E_Texte(this, module, pt_texte);
@ -176,7 +176,7 @@ EDA_BaseStruct * item;
module = NULL;
{
TEXTE_MODULE * pt_texte;
pt_texte = LocateTexteModule(m_Pcb, &module, typeloc);
pt_texte = LocateTexteModule(m_Pcb, &module, typeloc | VISIBLE_ONLY);
if( pt_texte != NULL )
{
Affiche_Infos_E_Texte(this, module, pt_texte);
@ -185,7 +185,7 @@ EDA_BaseStruct * item;
}
/* 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);
return module;
@ -738,6 +738,8 @@ TEXTE_MODULE * LocateTexteModule(BOARD * Pcb, MODULE ** PtModule, int typeloc)
retourne
- pointeur sur le texte localise ( ou NULL )
- 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;
@ -755,6 +757,13 @@ wxPoint ref_pos;
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;
/* la souris est-elle dans le rectangle autour du texte*/
if( pt_txt_mod->Locate(ref_pos) )

View File

@ -117,9 +117,9 @@ double value;
/****************************************************************************/
void WinEDA_PcbFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu)
/****************************************************************************/
/* Prepare le menu PopUp affich<63> par un click sur le bouton droit
/* Create the PopUp menu (click on right mouse button)
de la souris.
Ce menu est ensuite compl<EFBFBD>t<EFBFBD> par la liste des commandes de ZOOM
The ZOOM menu is added to this menu
*/
{
EDA_BaseStruct *DrawStruct = m_CurrentScreen->m_CurrentItem;
@ -137,14 +137,14 @@ wxClientDC dc(DrawPanel);
{
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);
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 ( DrawStruct && DrawStruct->m_Flags )
@ -187,7 +187,7 @@ wxClientDC dc(DrawPanel);
if( !flags )
{
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 )
{
@ -200,7 +200,7 @@ wxClientDC dc(DrawPanel);
if (m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE)
{
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);
ADD_MENUITEM(PopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, _("Free Module"),
Unlocked_xpm);

View File

@ -900,12 +900,10 @@ bool escape = FALSE;
break;
}
if( event.ControlDown() ) localkey |= GR_KB_CTRL;
if( event.AltDown() ) localkey |= GR_KB_ALT;
if( event.ShiftDown() && (key > 256) ) localkey |= GR_KB_SHIFT;
wxClientDC DC(this);
BASE_SCREEN * Screen = GetScreen();
@ -925,6 +923,10 @@ BASE_SCREEN * Screen = GetScreen();
}
m_Parent->GeneralControle(&DC, Screen->m_MousePositionInPixels);
#if 0
event.Skip(); // Allow menu shortcut processing
#endif
}