Loading include/layers_id_colors_and_visibility.h +0 −16 Original line number Diff line number Diff line Loading @@ -126,22 +126,6 @@ enum LAYER_ID #define MAX_CU_LAYERS (B_Cu - F_Cu + 1) /* These were moved to legacy_plugin.cpp, please don't ever use them outside there. Now with the advent of class LSEQ, we don't iterate over LAYER_ID any more, so therefore FIRST_COPPER_LAYER and LAST_COPPER_LAYER are dead concepts. They in fact failed to do what they were intended to do because they implied a particular sequence which in and of itself was subject to change and actually did when we flipped the pretty and *.kicad_pcb copper layer stack. LSEQ is the way to go, use it. It gives a level of manipulation between LAYER_ID and iteration. #define FIRST_COPPER_LAYER brain dead #define LAST_COPPER_LAYER brain dead #define FIRST_LAYER brain dead #define NB_LAYERS use LAYER_ID_COUNT instead #define NB_COPPER_LAYERS was always a max, not a number, use MAX_CU_LAYERS now. */ /// A sequence of layers, a sequence provides a certain order. typedef std::vector<LAYER_ID> BASE_SEQ; Loading include/wxBasePcbFrame.h +0 −1 Original line number Diff line number Diff line Loading @@ -343,7 +343,6 @@ public: void DeleteTextModule( TEXTE_MODULE* Text ); void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ); void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ); TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC ); /** * Function ResetTextSize Loading kicad/kicad.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -6,8 +6,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004-2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading Loading @@ -173,6 +173,13 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp ) prjloaded = true; // OnFileHistory() loads the project } } else // there is no history { wxFileName namelessProject( wxGetCwd(), NAMELESS_PROJECT, ProjectFileExtension ); frame->SetProjectFileName( namelessProject.GetFullPath() ); } if( !prjloaded ) { Loading kicad/prjconfig.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -6,8 +6,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004-2012 Jean-Pierre Charras * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2015 Jean-Pierre Charras * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading Loading @@ -259,7 +259,7 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) wxString nameless_prj = NAMELESS_PROJECT wxT( ".pro" ); // Check if project file exists and if it is not noname.pro if( !wxFileExists( prj_filename ) && !prj_filename.IsSameAs( nameless_prj ) ) if( !wxFileExists( prj_filename ) && !wxFileName( prj_filename ).GetFullName().IsSameAs( nameless_prj ) ) { wxString msg = wxString::Format( _( "KiCad project file '%s' not found" ), Loading pcbnew/class_pcb_layer_widget.cpp +66 −7 Original line number Diff line number Diff line /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr * Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr * Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors. * Loading Loading @@ -79,15 +79,22 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = { RR( _( "References" ), MOD_REFERENCES_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprint's references") ), }; static int s_allowed_in_FpEditor[] = { MOD_TEXT_INVISIBLE, PAD_FR_VISIBLE, PAD_BK_VISIBLE, GRID_VISIBLE, MOD_VALUES_VISIBLE, MOD_REFERENCES_VISIBLE }; PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize ) : PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize, bool aFpEditorMode ) : LAYER_WIDGET( aParent, aFocusOwner, aPointSize ), myframe( aParent ) { m_alwaysShowActiveCopperLayer = false; m_fp_editor_mode = aFpEditorMode; ReFillRender(); // Update default tabs labels for GerbView // Update default tabs labels SetLayersManagerTabsText(); //-----<Popup menu>------------------------------------------------- Loading @@ -106,6 +113,33 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwn } /* return true if item aId has meaning in footprint editor mode, * i.e. is in s_allowed_in_FpEditor and therefore is shown in render panel */ bool PCB_LAYER_WIDGET::isAllowedInFpMode( int aId ) { for( unsigned ii = 0; ii < DIM( s_allowed_in_FpEditor ); ii++ ) if( s_allowed_in_FpEditor[ii] == aId ) return true; return false; } /* return true if item aId has meaning in footprint editor mode, * i.e. is in s_allowed_in_FpEditor and therefore is shown in render panel * Note: User layers, which are not paired, are not shown in layers manager. * However a not listed layer can be reachable in the graphic item proprerties * dialog. */ bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( LAYER_ID aLayer ) { static LSET allowed = LSET::AllTechMask(); // Currently not in use because putting a graphic item on a copper layer // is not currently supported by DRC. // allowed.set( F_Cu ).set( B_Cu ); return allowed.test( aLayer ); } void PCB_LAYER_WIDGET::installRightLayerClickHandler() { int rowCount = GetLayerRowCount(); Loading Loading @@ -223,6 +257,9 @@ void PCB_LAYER_WIDGET::ReFillRender() { LAYER_WIDGET::ROW renderRow = s_render_rows[row]; if( !isAllowedInFpMode( renderRow.id ) ) continue; renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip ); renderRow.rowName = wxGetTranslation( s_render_rows[row].rowName ); Loading @@ -247,6 +284,9 @@ void PCB_LAYER_WIDGET::SyncRenderStates() { int rowId = s_render_rows[row].id; if( !isAllowedInFpMode( rowId ) ) continue; // this does not fire a UI event SetRenderState( rowId, board->IsElementVisible( rowId ) ); } Loading Loading @@ -305,6 +345,13 @@ void PCB_LAYER_WIDGET::ReFill() AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), dsc, true ) ); if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) ) { getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false ); getLayerComp( GetLayerRowCount()-1, COLUMN_COLORBM )->SetToolTip( wxEmptyString ); } } Loading Loading @@ -345,6 +392,13 @@ void PCB_LAYER_WIDGET::ReFill() AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), wxGetTranslation( non_cu_seq[i].tooltip ), true ) ); if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) ) { getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false ); getLayerComp( GetLayerRowCount()-1, COLUMN_COLORBM )->SetToolTip( wxEmptyString ); } } installRightLayerClickHandler(); Loading @@ -371,7 +425,12 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer ) { // the layer change from the PCB_LAYER_WIDGET can be denied by returning // false from this function. myframe->SetActiveLayer( ToLAYER_ID( aLayer ) ); LAYER_ID layer = ToLAYER_ID( aLayer ); if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) ) return false; myframe->SetActiveLayer( layer ); if( m_alwaysShowActiveCopperLayer ) OnLayerSelected(); Loading Loading
include/layers_id_colors_and_visibility.h +0 −16 Original line number Diff line number Diff line Loading @@ -126,22 +126,6 @@ enum LAYER_ID #define MAX_CU_LAYERS (B_Cu - F_Cu + 1) /* These were moved to legacy_plugin.cpp, please don't ever use them outside there. Now with the advent of class LSEQ, we don't iterate over LAYER_ID any more, so therefore FIRST_COPPER_LAYER and LAST_COPPER_LAYER are dead concepts. They in fact failed to do what they were intended to do because they implied a particular sequence which in and of itself was subject to change and actually did when we flipped the pretty and *.kicad_pcb copper layer stack. LSEQ is the way to go, use it. It gives a level of manipulation between LAYER_ID and iteration. #define FIRST_COPPER_LAYER brain dead #define LAST_COPPER_LAYER brain dead #define FIRST_LAYER brain dead #define NB_LAYERS use LAYER_ID_COUNT instead #define NB_COPPER_LAYERS was always a max, not a number, use MAX_CU_LAYERS now. */ /// A sequence of layers, a sequence provides a certain order. typedef std::vector<LAYER_ID> BASE_SEQ; Loading
include/wxBasePcbFrame.h +0 −1 Original line number Diff line number Diff line Loading @@ -343,7 +343,6 @@ public: void DeleteTextModule( TEXTE_MODULE* Text ); void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ); void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ); TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC ); /** * Function ResetTextSize Loading
kicad/kicad.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -6,8 +6,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004-2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading Loading @@ -173,6 +173,13 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp ) prjloaded = true; // OnFileHistory() loads the project } } else // there is no history { wxFileName namelessProject( wxGetCwd(), NAMELESS_PROJECT, ProjectFileExtension ); frame->SetProjectFileName( namelessProject.GetFullPath() ); } if( !prjloaded ) { Loading
kicad/prjconfig.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -6,8 +6,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004-2012 Jean-Pierre Charras * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2015 Jean-Pierre Charras * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading Loading @@ -259,7 +259,7 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) wxString nameless_prj = NAMELESS_PROJECT wxT( ".pro" ); // Check if project file exists and if it is not noname.pro if( !wxFileExists( prj_filename ) && !prj_filename.IsSameAs( nameless_prj ) ) if( !wxFileExists( prj_filename ) && !wxFileName( prj_filename ).GetFullName().IsSameAs( nameless_prj ) ) { wxString msg = wxString::Format( _( "KiCad project file '%s' not found" ), Loading
pcbnew/class_pcb_layer_widget.cpp +66 −7 Original line number Diff line number Diff line /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr * Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr * Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors. * Loading Loading @@ -79,15 +79,22 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = { RR( _( "References" ), MOD_REFERENCES_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprint's references") ), }; static int s_allowed_in_FpEditor[] = { MOD_TEXT_INVISIBLE, PAD_FR_VISIBLE, PAD_BK_VISIBLE, GRID_VISIBLE, MOD_VALUES_VISIBLE, MOD_REFERENCES_VISIBLE }; PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize ) : PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize, bool aFpEditorMode ) : LAYER_WIDGET( aParent, aFocusOwner, aPointSize ), myframe( aParent ) { m_alwaysShowActiveCopperLayer = false; m_fp_editor_mode = aFpEditorMode; ReFillRender(); // Update default tabs labels for GerbView // Update default tabs labels SetLayersManagerTabsText(); //-----<Popup menu>------------------------------------------------- Loading @@ -106,6 +113,33 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwn } /* return true if item aId has meaning in footprint editor mode, * i.e. is in s_allowed_in_FpEditor and therefore is shown in render panel */ bool PCB_LAYER_WIDGET::isAllowedInFpMode( int aId ) { for( unsigned ii = 0; ii < DIM( s_allowed_in_FpEditor ); ii++ ) if( s_allowed_in_FpEditor[ii] == aId ) return true; return false; } /* return true if item aId has meaning in footprint editor mode, * i.e. is in s_allowed_in_FpEditor and therefore is shown in render panel * Note: User layers, which are not paired, are not shown in layers manager. * However a not listed layer can be reachable in the graphic item proprerties * dialog. */ bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( LAYER_ID aLayer ) { static LSET allowed = LSET::AllTechMask(); // Currently not in use because putting a graphic item on a copper layer // is not currently supported by DRC. // allowed.set( F_Cu ).set( B_Cu ); return allowed.test( aLayer ); } void PCB_LAYER_WIDGET::installRightLayerClickHandler() { int rowCount = GetLayerRowCount(); Loading Loading @@ -223,6 +257,9 @@ void PCB_LAYER_WIDGET::ReFillRender() { LAYER_WIDGET::ROW renderRow = s_render_rows[row]; if( !isAllowedInFpMode( renderRow.id ) ) continue; renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip ); renderRow.rowName = wxGetTranslation( s_render_rows[row].rowName ); Loading @@ -247,6 +284,9 @@ void PCB_LAYER_WIDGET::SyncRenderStates() { int rowId = s_render_rows[row].id; if( !isAllowedInFpMode( rowId ) ) continue; // this does not fire a UI event SetRenderState( rowId, board->IsElementVisible( rowId ) ); } Loading Loading @@ -305,6 +345,13 @@ void PCB_LAYER_WIDGET::ReFill() AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), dsc, true ) ); if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) ) { getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false ); getLayerComp( GetLayerRowCount()-1, COLUMN_COLORBM )->SetToolTip( wxEmptyString ); } } Loading Loading @@ -345,6 +392,13 @@ void PCB_LAYER_WIDGET::ReFill() AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), wxGetTranslation( non_cu_seq[i].tooltip ), true ) ); if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) ) { getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false ); getLayerComp( GetLayerRowCount()-1, COLUMN_COLORBM )->SetToolTip( wxEmptyString ); } } installRightLayerClickHandler(); Loading @@ -371,7 +425,12 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer ) { // the layer change from the PCB_LAYER_WIDGET can be denied by returning // false from this function. myframe->SetActiveLayer( ToLAYER_ID( aLayer ) ); LAYER_ID layer = ToLAYER_ID( aLayer ); if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) ) return false; myframe->SetActiveLayer( layer ); if( m_alwaysShowActiveCopperLayer ) OnLayerSelected(); Loading