Commit 2c0377b0 authored by CHARRAS's avatar CHARRAS
Browse files

more better hotkey.cpp and small changes in locate footprint

parent cd4ed0e7
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -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
;
;


+240 B (126 KiB)

File changed.

No diff preview for this file type.

+497 −491

File changed.

Preview size limit exceeded, changes collapsed.

+33 −7
Original line number Original line Diff line number Diff line
@@ -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
			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
				}
				}
			}
			}
			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
		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
			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;
					}
					}
				}
				}
+12 −3
Original line number Original line Diff line number Diff line
@@ -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;
    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;
    }
    }


    /* 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)
    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;


    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) )
Loading