Commit 713d0175 authored by lifekidyeaa's avatar lifekidyeaa
Browse files

added the following features (mostly hotkey type stuff):

* backspace key now deletes segments and vias both while editing a new track and while 
modifying old ones
* internal layers can be accessed via F5-F8
* when creating a new trace, switching between layers with the Pageup, PageDown, and 
F5-F8 hotkeys inserts a via. (warning: i did not test this with blind vias; however, it 
calls Other_Layer_Route, so should still work)
* spelling fix
parent 22599cf6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ enum Mod_Attribut /* Attributs d'un module */
/* 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 fot autoplace */
#define MODULE_to_PLACE 0x04	/* In autoplace: module waiting for autoplace */

class MODULE: public EDA_BaseStruct
{
+39 −16
Original line number Diff line number Diff line
@@ -179,22 +179,12 @@ int CurrentTime = time(NULL);
			break ;
		case WXK_NUMPAD0 :
		case WXK_PAGEUP :
			if ( GetScreen()->m_Active_Layer != CMP_N )
			{
				GetScreen()->m_Active_Layer = CMP_N;
				if ( DisplayOpt.ContrastModeDisplay )
					GetScreen()->SetRefreshReq();
			}
			SwitchLayer(DC, CMP_N); 
			break ;

		case WXK_NUMPAD9 :
		case WXK_PAGEDOWN :
			if ( GetScreen()->m_Active_Layer != CUIVRE_N )
			{
				GetScreen()->m_Active_Layer = CUIVRE_N;
				if ( DisplayOpt.ContrastModeDisplay )
					GetScreen()->SetRefreshReq();
			}
			SwitchLayer(DC, CUIVRE_N); 
			break ;
			
		case 'F' | GR_KB_CTRL :
@@ -252,7 +242,20 @@ int CurrentTime = time(NULL);
			oldpos = curpos = GetScreen()->m_Curseur;
			break;

		case WXK_F5 :	/* unused */
		case WXK_F5 :
			SwitchLayer(DC, LAYER_N_2); 
			break;
		
		case WXK_F6 :
			SwitchLayer(DC, LAYER_N_3); 
			break;
			
		case WXK_F7 :
			SwitchLayer(DC, LAYER_N_4); 
			break;
			
		case WXK_F8 :
			SwitchLayer(DC, LAYER_N_5); 
			break;
			
		case WXK_NUMPAD8  :	/* Deplacement curseur vers le haut */
@@ -352,5 +355,25 @@ int CurrentTime = time(NULL);
		OnHotKey(DC, hotkey, NULL);
	}
}
/****************************************************************/
void WinEDA_BasePcbFrame::SwitchLayer(wxDC *DC, int layer)
/*****************************************************************/
{
	//overridden in WinEDA_PcbFrame;
	int preslayer = GetScreen()->m_Active_Layer; 
	//if there is only one layer, don't switch. 
	if ( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1)
		return; 
	//otherwise, must be at least 2 layers..see if it is possible.
	if(layer != LAYER_CUIVRE_N || layer != LAYER_CMP_N || 
		  layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount-1)
		return; 
	if(preslayer == layer)
		return; 
	
	GetScreen()->m_Active_Layer = layer; 
	
	if ( DisplayOpt.ContrastModeDisplay )
		GetScreen()->SetRefreshReq();
}
+0 −1
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ TRACK * WinEDA_PcbFrame::Delete_Segment(wxDC * DC, TRACK *Track)
*/
{
int current_net_code;

	if ( Track == NULL ) return NULL;

	if(Track->m_Flags & IS_NEW)  // Trace en cours, on peut effacer le dernier segment
+4 −2
Original line number Diff line number Diff line
@@ -271,14 +271,16 @@ void WinEDA_PcbGeneralOptionsFrame::CreateControls()
        _("Inches"),
        _("millimeters")
    };
    m_BoxUnits = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Units"), wxDefaultPosition, wxDefaultSize, 2, m_BoxUnitsStrings, 1, wxRA_SPECIFY_COLS );
    m_BoxUnits = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Units"), wxDefaultPosition, 
								 	wxDefaultSize, 2, m_BoxUnitsStrings, 1,wxRA_SPECIFY_COLS );
    itemBoxSizer3->Add(m_BoxUnits, 0, wxALIGN_LEFT|wxALL, 5);

    wxString m_CursorShapeStrings[] = {
        _("Small"),
        _("Big")
    };
    m_CursorShape = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Cursor"), wxDefaultPosition, wxDefaultSize, 2, m_CursorShapeStrings, 1, wxRA_SPECIFY_COLS );
    m_CursorShape = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Cursor"), wxDefaultPosition, wxDefaultSize, 2,
						m_CursorShapeStrings, 1, wxRA_SPECIFY_COLS );
    itemBoxSizer3->Add(m_CursorShape, 0, wxALIGN_LEFT|wxALL, 5);

    wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);
+44 −7
Original line number Diff line number Diff line
@@ -23,8 +23,8 @@ static void Process_Move_Item(WinEDA_PcbFrame * frame,
/********************************************************************/
void WinEDA_PcbFrame::OnLeftClick(wxDC * DC, const wxPoint& MousePos)
/********************************************************************/
/* Traite les commandes declenche par le bouton gauche de la souris,
	quand un outil est deja selectionn
/* Traite les commandes declenche par le bouton gauche de la souris,
	quand un outil est deja selectionn
*/
{
EDA_BaseStruct * DrawStruct = CURRENT_ITEM;
@@ -316,7 +316,7 @@ int itmp;

	pos.y += 20;

	switch ( id )	// Arret eventuel de la commande de dplacement en cours
	switch ( id )	// Arret eventuel de la commande de dplacement en cours
		{
		case wxID_CUT:
		case wxID_COPY:
@@ -421,7 +421,7 @@ int itmp;
			else SetCursor(DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor);
			break;

		default:	// Arret de la commande de dplacement en cours
		default:	// Arret de la commande de dplacement en cours
			if( DrawPanel->ManageCurseur &&
				DrawPanel->ForceCloseManageCurseur )
				{
@@ -650,12 +650,14 @@ int itmp;


		case ID_POPUP_PCB_DELETE_TRACKSEG:
			if ( CURRENT_ITEM == NULL) break;
			DrawPanel->MouseToCursorSchema();
			GetScreen()->m_CurrentItem = Delete_Segment(&dc, (TRACK*)CURRENT_ITEM);
			GetScreen()->SetModify();
			break;

		case ID_POPUP_PCB_DELETE_TRACK:
			if ( CURRENT_ITEM == NULL) break;
			DrawPanel->MouseToCursorSchema();
			Delete_Track(&dc, (TRACK*)CURRENT_ITEM);
			GetScreen()->m_CurrentItem = NULL;
@@ -1159,8 +1161,8 @@ static void Process_Move_Item(WinEDA_PcbFrame * frame,
/********************************************************************************/
void WinEDA_PcbFrame::OnLeftDClick(wxDC * DC, const wxPoint& MousePos)
/********************************************************************************/
/* Appel sur un double click:
	pour un lment editable (textes, composant):
/* Appel sur un double click:
	pour un �l�ment editable (textes, composant):
		appel de l'editeur correspondant.
	pour une connexion en cours:
		termine la connexion
@@ -1183,7 +1185,7 @@ wxClientDC dc(DrawPanel);
			if ( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
				break;

			// Element localis
			// Element localis
			GetScreen()->m_CurrentItem = DrawStruct;
			switch ( DrawStruct->m_StructType )
				{
@@ -1334,3 +1336,38 @@ void WinEDA_PcbFrame::RemoveStruct(EDA_BaseStruct * Item, wxDC * DC)
			break;
		}
}

/****************************************************************/
void WinEDA_PcbFrame::SwitchLayer(wxDC *DC, int layer)
/*****************************************************************/
{
	int preslayer = GetScreen()->m_Active_Layer; 
	//if there is only one layer, don't switch. 
	if ( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1)
		return; 
	//otherwise, must be at least 2 layers..see if it is possible.
	if(layer == LAYER_CUIVRE_N || layer == LAYER_CMP_N || 
		  layer < m_Pcb->m_BoardSettings->m_CopperLayerCount-1){
	
		if(preslayer == layer)
			return; 
		EDA_BaseStruct* current = GetScreen()->m_CurrentItem;
		//see if we are drawing a segment; if so, add a via?
		if ( m_ID_current_state == ID_TRACK_BUTT && current != NULL)
		{
			if(current->m_StructType == TYPETRACK && (current->m_Flags & IS_NEW)){
				//want to set the routing layers so that it switches properly - 
				//see the implementation of Other_Layer_Route - the working 
				//layer is used to 'start' the via and set the layer masks appropriately. 
				GetScreen()->m_Route_Layer_TOP = preslayer; 
				GetScreen()->m_Route_Layer_BOTTOM = layer; 
				GetScreen()->m_Active_Layer = preslayer; 
				Other_Layer_Route( (TRACK *) GetScreen()->m_CurrentItem, DC);
			}
		}else{
			GetScreen()->m_Active_Layer = layer; 
		}
		if ( DisplayOpt.ContrastModeDisplay )
			GetScreen()->SetRefreshReq();
	}
}
Loading