Commit 713d0175 authored by lifekidyeaa's avatar lifekidyeaa

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
......@@ -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
{
......
......@@ -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();
}
......@@ -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
......
......@@ -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);
......
......@@ -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();
}
}
......@@ -192,8 +192,10 @@ int itmp;
Via->m_NetCode = g_HightLigth_NetCode ;
Via->m_Start = Via->m_End = g_CurrentTrackSegment->m_End;
Via->m_Layer = GetScreen()->m_Active_Layer; // Provisoirement
Via->m_Layer = GetScreen()->m_Active_Layer;
// Provisoirement. indicate the first layer (?)
//swap the layers.
if( GetScreen()->m_Active_Layer != GetScreen()->m_Route_Layer_TOP)
GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_TOP ;
else GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_BOTTOM ;
......@@ -202,7 +204,7 @@ int itmp;
{
Via->m_Layer |= GetScreen()->m_Active_Layer << 4;
}
else if ( (Via->m_Shape & 15) == VIA_BORGNE )
else if ( (Via->m_Shape & 15) == VIA_BORGNE ) //blind via
{ // A revoir! ( la via devrait deboucher sur 1 cote )
Via->m_Layer |= GetScreen()->m_Active_Layer << 4;
}
......
......@@ -46,7 +46,32 @@ MODULE* module = NULL;
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();
if ( DrawStruct )
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': // Rotation
case 'V':
if ( m_ID_current_state != ID_TRACK_BUTT ) return;
......
## Makefile for PCBNEW et wxGTK
CC = gcc
LD = gcc
# DEBUG = 1
# Compiler flags.
ifdef DEBUG
CPPFLAGS = -Wall -g `wx-config --cxxflags`
LDFLAGS = -g
else
CPPFLAGS = -Wall -O2 `wx-config --cxxflags`
LDFLAGS = -s
LDFLAGS = -s -v
endif
include ../libs.linux
......
......@@ -168,7 +168,9 @@ wxClientDC dc(DrawPanel);
MODULE* newmod = new MODULE(mainpcb);
newmod->Copy(presmod); //this will copy the padstack layers etc
newmod->m_Parent = mainpcb; //modify after the copy above
newmod->m_Layer = mod->m_Layer;
if(mod->m_Layer != CMP_N){//just changing m_Layer is insufficient.
Change_Side_Module(newmod, &dc);
}
newmod->m_Pos = mod->m_Pos;
newmod->m_Orient =0; //otherwise the pads will be rotated with respect to the module.
//copy data into the pads...
......
/********************************************************************************/
/* onrightclick.cpp: fonctions de l'edition du PCB appeles par le bouton droit */
/* onrightclick.cpp: fonctions de l'edition du PCB appel�es par le bouton droit */
/********************************************************************************/
#include "fctsys.h"
......@@ -117,9 +117,9 @@ double value;
/****************************************************************************/
void WinEDA_PcbFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu)
/****************************************************************************/
/* Prepare le menu PopUp affich par un click sur le bouton droit
/* Prepare le menu PopUp affich� par un click sur le bouton droit
de la souris.
Ce menu est ensuite complt par la liste des commandes de ZOOM
Ce menu est ensuite compl�t� par la liste des commandes de ZOOM
*/
{
EDA_BaseStruct *DrawStruct = m_CurrentScreen->m_CurrentItem;
......@@ -545,7 +545,7 @@ int flags = Track->m_Flags;
else // Edition in progress
{
if( flags & IS_NEW )
ADD_MENUITEM(PopMenu, ID_POPUP_PCB_END_TRACK, _("End Track"), apply_xpm);
ADD_MENUITEM(PopMenu, ID_POPUP_PCB_END_TRACK, _("End Track (end)"), apply_xpm);
PopMenu->Append(ID_POPUP_PCB_PLACE_VIA, _("Place Via (V)"));
}
......@@ -574,11 +574,11 @@ int flags = Track->m_Flags;
ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu,
ID_POPUP_PCB_DELETE_TRACK_MNU, _("Delete"), delete_xpm);
ADD_MENUITEM(track_mnu, ID_POPUP_PCB_DELETE_TRACKSEG,
_("Delete Segment"), Delete_Line_xpm);
_("Delete Segment (backspace)"), Delete_Line_xpm);
if( !flags )
{
ADD_MENUITEM(track_mnu, ID_POPUP_PCB_DELETE_TRACK,
_("Delete Track"), Delete_Track_xpm);
_("Delete Track (delete)"), Delete_Track_xpm);
ADD_MENUITEM(track_mnu, ID_POPUP_PCB_DELETE_TRACKNET,
_("Delete Net"), Delete_Net_xpm);
}
......
......@@ -159,7 +159,7 @@ BEGIN_EVENT_TABLE(WinEDA_PcbFrame, wxFrame)
EVT_MENU_RANGE(ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions )
// PopUp Menus pour Zooms traits dans drawpanel.cpp
// PopUp Menus pour Zooms traits dans drawpanel.cpp
END_EVENT_TABLE()
......@@ -178,7 +178,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame(wxWindow * father, WinEDA_App *parent,
m_FrameName = wxT("PcbFrame");
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = g_ShowGrid; // TRUE pour avoir la grille dessinee
m_Draw_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche dessin
m_Draw_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche dessin
m_Draw_Auxiliary_Axis = TRUE;
m_SelTrackWidthBox = NULL;
m_SelViaSizeBox = NULL;
......@@ -275,7 +275,7 @@ PCB_SCREEN * screen;
}
/* Reselection de l'ecran de base,
pour les evenements de refresh gnrs par wxWindows */
pour les evenements de refresh g�n�r�s par wxWindows */
m_CurrentScreen = ActiveScreen = ScreenPcb;
SaveSettings();
......@@ -342,7 +342,7 @@ int ii, jj;
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_DRC_OFF,
! Drc_On);
m_OptionsToolBar->SetToolShortHelp(ID_TB_OPTIONS_DRC_OFF,
Drc_On ? _("DCR Off (Disable !!!), Currently: DRC is active") : _("DRC On (Currently: DRC is DISABLE !!!)"));
Drc_On ? _("DRC Off (Disable !!!), Currently: DRC is active") : _("DRC On (Currently: DRC is inactive !!!)"));
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == MILLIMETRE ? TRUE : FALSE);
......
......@@ -148,6 +148,7 @@ wxButton * Button;
}
m_SelLayerBox->SetSelection( TextPCB->m_Layer );
wxString orient_msg[4] = { wxT("0"), wxT("90"), wxT("180"), wxT("-90") };
m_Orient = new wxRadioBox(this, -1, _("Orientation"),
wxDefaultPosition, wxSize(-1,-1), 4, orient_msg,
......
......@@ -425,7 +425,7 @@ long current_mask_layer;
parent->AddControl(m_SelLayerBox);
}
// Test si reconstruction de la liste ncessaire
// Test si reconstruction de la liste ncessaire
current_mask_layer = 0;
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount-1];
Masque_Layer |= ALL_NO_CU_LAYERS;
......@@ -444,11 +444,12 @@ long current_mask_layer;
{
if ( (g_TabOneLayerMask[ii] & Masque_Layer) )
{
m_SelLayerBox->Append(ReturnPcbLayerName(ii));
m_SelLayerBox->Append(ReturnPcbLayerName(ii,false,true));
m_SelLayerBox->SetClientData(jj, (void*)ii);
jj++;
}
}
m_SelLayerBox->SetToolTip(_("+/- to switch"));
}
// Activation de l'affichage sur la bonne couche
......
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