diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index f1cfdce51b..f9fe1cd90a 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -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 { diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index d227212bf3..371bdae6b8 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -179,24 +179,14 @@ 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 : case 'f' | GR_KB_CTRL: DisplayOpt.DisplayPcbTrackFill ^= 1; DisplayOpt.DisplayPcbTrackFill &= 1 ; @@ -252,9 +242,22 @@ 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 */ case WXK_UP : Mouse.y -= delta.y; @@ -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(); +} diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index aaa2e39ec6..16a8bcc853 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -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 diff --git a/pcbnew/dialog_general_options.cpp b/pcbnew/dialog_general_options.cpp index 59a7e3796c..9d9c1a64bd 100644 --- a/pcbnew/dialog_general_options.cpp +++ b/pcbnew/dialog_general_options.cpp @@ -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); diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 2c9e938810..977c9b66df 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -23,8 +23,8 @@ static void Process_Move_Item(WinEDA_PcbFrame * frame, /********************************************************************/ void WinEDA_PcbFrame::OnLeftClick(wxDC * DC, const wxPoint& MousePos) /********************************************************************/ -/* Traite les commandes declench�e par le bouton gauche de la souris, - quand un outil est deja selectionn� +/* Traite les commandes declench�e 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 d�placement en cours + switch ( id ) // Arret eventuel de la commande de d�placement 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 d�placement en cours + default: // Arret de la commande de d�placement 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 �l�ment 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(); + } +} diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index fcfc0e0c9f..b8d1d1cff1 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -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; } diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index 58ebb26cac..c66d52ae41 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -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; diff --git a/pcbnew/makefile.gtk b/pcbnew/makefile.gtk index 7db2b41930..e025c531ae 100644 --- a/pcbnew/makefile.gtk +++ b/pcbnew/makefile.gtk @@ -1,12 +1,16 @@ ## 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 diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 254b2f2c90..885b088638 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -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... diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 74fe27111a..d0f161a948 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -1,5 +1,5 @@ /********************************************************************************/ -/* onrightclick.cpp: fonctions de l'edition du PCB appel�es 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 compl�t� 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); } diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 292c980f10..b11a56a575 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -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 trait�s dans drawpanel.cpp + // PopUp Menus pour Zooms trait�s 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 g�n�r�s 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); diff --git a/pcbnew/pcbtexte.cpp b/pcbnew/pcbtexte.cpp index e069f79dee..94d93443aa 100644 --- a/pcbnew/pcbtexte.cpp +++ b/pcbnew/pcbtexte.cpp @@ -147,6 +147,7 @@ wxButton * Button; m_SelLayerBox->Append(ReturnPcbLayerName(ii)); } 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"), diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index a1250ec617..48142e6715 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -425,7 +425,7 @@ long current_mask_layer; parent->AddControl(m_SelLayerBox); } - // Test si reconstruction de la liste n�cessaire + // Test si reconstruction de la liste n�cessaire 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