Loading include/pcbstruct.h +144 −27 Original line number Diff line number Diff line Loading @@ -149,7 +149,38 @@ enum ELEMENTS_NUMBERS PAD_CMP_VISIBLE }; /** * Function IsValidLayerIndex * tests whether a given integer is a valid layer index * @param aLayerIndex = Layer index to test * @return true if aLayerIndex is a valid layer index */ inline bool IsValidLayerIndex( int aLayerIndex ) { return aLayerIndex >= 0 && aLayerIndex < NB_LAYERS; } /** * Function IsValidCopperLayerIndex * tests whether an integer is a valid copper layer index * @param aLayerIndex = Layer index to test * @return true if aLayerIndex is a valid copper layer index */ inline bool IsValidCopperLayerIndex( int aLayerIndex ) { return aLayerIndex >= FIRST_COPPER_LAYER && aLayerIndex <= LAST_COPPER_LAYER; } /** * Function IsValidNonCopperLayerIndex * tests whether an integer is a valid non copper layer index * @param aLayerIndex = Layer index to test * @return true if aLayerIndex is a valid non copper layer index */ inline bool IsValidNonCopperLayerIndex( int aLayerIndex ) { return aLayerIndex >= FIRST_NO_COPPER_LAYER && aLayerIndex <= LAST_NO_COPPER_LAYER; } // Class for handle current printed board design settings class EDA_BoardDesignSettings Loading @@ -176,25 +207,17 @@ public: int m_MaskMargin; // Solder mask margin int m_LayerThickness; // Layer Thickness for 3D viewer // Color options for screen display of the Printed Board: //@@IMB: Not used int m_PcbGridColor; // Grid color int m_EnabledLayers; // IMB: Paving the road int m_VisibleLayers; // IMB: Bit-mask for layer visibility int m_VisibleElements; // IMB: Bit-mask for elements visibility protected: int m_EnabledLayers; // Bit-mask for layer enabling int m_VisibleLayers; // Bit-mask for layer visibility int m_VisibleElements; // Bit-mask for element category visibility public: // Color options for screen display of the Printed Board: int m_LayerColor[32]; // Layer colors (tracks and graphic items) int m_ViaColor[4]; // Via color (depending on is type) //@@IMB: Not used int m_ModuleTextCMPColor; // Text module color for modules on the COMPONENT layer //@@IMB: Not used int m_ModuleTextCUColor; // Text module color for modules on the COPPER layer //@@IMB: Not used int m_ModuleTextNOVColor; // Text module color for "invisible" texts (must be BLACK if really not displayed) //@@IMB: Not used int m_AnchorColor; // Anchor color for modules and texts //@@IMB: Not used int m_PadCUColor; // Pad color for the COPPER side of the pad //@@IMB: Not used int m_PadCMPColor; // Pad color for the COMPONENT side of the pad // Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors) int m_RatsnestColor; // Ratsnest color Loading @@ -205,40 +228,134 @@ public: /** * Function GetVisibleLayers * returns a bit-map of all the layers that are visible. * returns a bit-mask of all the layers that are visible * @return int - the visible layers in bit-mapped form. */ int GetVisibleLayers() const; void SetVisibleLayers( int Mask ); /** * Function SetVisibleLayers * changes the bit-mask of visible layers * @param aMask = The new bit-mask of visible layers */ void SetVisibleLayers( int aMask ); /** * Function IsLayerVisible * @param LayerNumber The number of the layer to be tested. * tests whether a given layer is visible * @param aLayerIndex = The index of the layer to be tested * @return bool - true if the layer is visible. */ inline bool IsLayerVisible( int LayerNumber ) const inline bool IsLayerVisible( int aLayerIndex ) const { if( LayerNumber < 0 || LayerNumber >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers if( aLayerIndex < 0 || aLayerIndex >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers return false; return (bool)( m_VisibleLayers & 1 << LayerNumber ); // If a layer is disabled, it is automatically invisible return (bool)( m_VisibleLayers & m_EnabledLayers & 1 << aLayerIndex ); } void SetLayerVisibility( int LayerNumber, bool State ); /** * Function SetLayerVisibility * changes the visibility of a given layer * @param aLayerIndex = The index of the layer to be changed * @param aNewState = The new visibility state of the layer */ void SetLayerVisibility( int aLayerIndex, bool aNewState ); /** * Function GetVisibleElements * returns a bit-mask of all the element categories that are visible * @return int - the visible element categories in bit-mapped form. */ inline int GetVisibleElements() const { return m_VisibleElements; } /** * Function SetVisibleElements * changes the bit-mask of visible element categories * @param aMask = The new bit-mask of visible element categories */ inline void SetVisibleElements( int aMask ) { m_VisibleElements = aMask; } /** * Function IsElementVisible * @param ElementNumber The number of the element to be tested. * @return bool - true if the elememt is visible. * tests whether a given element category is visible * @param aCategoryIndex = The index of the element category to be tested. * @return bool - true if the element is visible. */ inline bool IsElementVisible( int ElementNumber ) const inline bool IsElementVisible( int aCategoryIndex ) const { if( ElementNumber < 0 || ElementNumber > PAD_CMP_VISIBLE ) if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE ) return false; return (bool)( m_VisibleElements & 1 << ElementNumber ); return (bool)( m_VisibleElements & 1 << aCategoryIndex ); } /** * Function SetElementVisibility * changes the visibility of an element category * @param aCategoryIndex = The index of the element category to be changed * @param aNewState = The new visibility state of the element category */ void SetElementVisibility( int aCategoryIndex, bool aNewState ); /** * Function GetEnabledLayers * returns a bit-mask of all the layers that are enabled * @return int - the enabled layers in bit-mapped form. */ inline int GetEnabledLayers() const { return m_EnabledLayers; } /** * Function SetEnabledLayers * changes the bit-mask of enabled layers * @param aMask = The new bit-mask of enabled layers */ void SetEnabledLayers( int aMask ) { // TODO; ensure consistency with m_CopperLayerCount m_EnabledLayers = aMask; // A disabled layer cannot be visible m_VisibleLayers &= aMask; } /** * Function IsLayerEnabled * tests whether a given layer is enabled * @param aLayerIndex = The index of the layer to be tested * @return bool - true if the layer is enabled */ inline bool IsLayerEnabled( int aLayerIndex ) { return (bool)( m_EnabledLayers & 1 << aLayerIndex ); } void SetElementVisibility( int ElementNumber, bool State ); /** * Function GetCopperLayerCount * @return int - the number of neabled copper layers */ inline int GetCopperLayerCount() const { return m_CopperLayerCount; } /** * Function SetCopperLayerCount * do what its name says... * @param aNewLayerCount = The new number of enabled copper layers */ inline void SetCopperLayerCount( int aNewLayerCount ) { // TODO; ensure consistency with the m_EnabledLayers member m_CopperLayerCount = aNewLayerCount; } }; Loading pcbnew/CMakeLists.txt +3 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ set(PCBNEW_SRCS cross-probing.cpp debug_kbool_key_file_fct.cpp deltrack.cpp dialog_copper_layers_setup_base.cpp dialog_copper_layers_setup.cpp # dialog_copper_layers_setup_base.cpp # dialog_copper_layers_setup.cpp dialog_copper_zones.cpp dialog_copper_zones_base.cpp dialog_design_rules.cpp Loading @@ -50,6 +50,7 @@ set(PCBNEW_SRCS dialog_graphic_item_properties.cpp dialog_graphic_item_properties_base.cpp # dialog_initpcb.cpp dialog_layers_setup.cpp dialog_netlist.cpp dialog_netlist_fbp.cpp dialog_pcb_text_properties.cpp Loading pcbnew/class_board.cpp +64 −22 Original line number Diff line number Diff line Loading @@ -129,9 +129,11 @@ BOARD::~BOARD() wxString BOARD::GetLayerName( int aLayerIndex ) const { if( ! IsValidLayerIndex( aLayerIndex )) return wxEmptyString; // copper layer names are stored in the BOARD. if( (unsigned) aLayerIndex < (unsigned) GetCopperLayerCount() || aLayerIndex == LAST_COPPER_LAYER ) if( IsValidCopperLayerIndex( aLayerIndex ) && m_BoardSettings->IsLayerEnabled( aLayerIndex )) { // default names were set in BOARD::BOARD() but they may be // over-ridden by BOARD::SetLayerName() Loading @@ -144,9 +146,9 @@ wxString BOARD::GetLayerName( int aLayerIndex ) const bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) { if( (unsigned) aLayerIndex < (unsigned) GetCopperLayerCount() || aLayerIndex==LAST_COPPER_LAYER ) { if( ! IsValidCopperLayerIndex( aLayerIndex )) return false; if( aLayerName == wxEmptyString || aLayerName.Len() > 20 ) return false; Loading @@ -154,20 +156,20 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) if( aLayerName.Find( wxChar( '"' ) ) != wxNOT_FOUND ) return false; // ensure unique-ness of layer names for( int layer = 0; layer<GetCopperLayerCount() || layer==LAST_COPPER_LAYER; ) wxString NameTemp = aLayerName; // replace any spaces with underscores before we do any comparing NameTemp.Replace( wxT( " " ), wxT( "_" ) ); if( m_BoardSettings->IsLayerEnabled( aLayerIndex )) { if( layer!=aLayerIndex && aLayerName == m_Layer[layer].m_Name ) for( int i = 0; i < NB_COPPER_LAYERS; i++ ) { if( i != aLayerIndex && m_BoardSettings->IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name ) return false; if( ++layer == GetCopperLayerCount() ) layer = LAST_COPPER_LAYER; } m_Layer[aLayerIndex].m_Name = aLayerName; // replace any spaces with underscores m_Layer[aLayerIndex].m_Name.Replace( wxT( " " ), wxT( "_" ) ); m_Layer[aLayerIndex].m_Name = NameTemp; return true; } Loading @@ -178,7 +180,12 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) LAYER_T BOARD::GetLayerType( int aLayerIndex ) const { if( (unsigned) aLayerIndex < (unsigned) GetCopperLayerCount() ) if( ! IsValidCopperLayerIndex( aLayerIndex )) return LT_SIGNAL; //@@IMB: The original test was broken due to the discontinuity // in the layer sequence. if( m_BoardSettings->IsLayerEnabled( aLayerIndex )) return m_Layer[aLayerIndex].m_Type; return LT_SIGNAL; } Loading @@ -186,7 +193,12 @@ LAYER_T BOARD::GetLayerType( int aLayerIndex ) const bool BOARD::SetLayerType( int aLayerIndex, LAYER_T aLayerType ) { if( (unsigned) aLayerIndex < (unsigned) GetCopperLayerCount() ) if( ! IsValidCopperLayerIndex( aLayerIndex )) return false; //@@IMB: The original test was broken due to the discontinuity // in the layer sequence. if( m_BoardSettings->IsLayerEnabled( aLayerIndex )) { m_Layer[aLayerIndex].m_Type = aLayerType; return true; Loading Loading @@ -239,6 +251,36 @@ int BOARD::GetCopperLayerCount() const return m_BoardSettings->m_CopperLayerCount; } int BOARD::GetEnabledLayers() const { return m_BoardSettings->GetEnabledLayers(); } int BOARD::GetVisibleLayers() const { return m_BoardSettings->GetVisibleLayers(); } void BOARD::SetEnabledLayers( int aLayerMask ) { m_BoardSettings->SetEnabledLayers( aLayerMask ); } void BOARD::SetVisibleLayers( int aLayerMask ) { m_BoardSettings->SetVisibleLayers( aLayerMask ); } void BOARD::SetVisibleElements( int aMask ) { m_BoardSettings->SetVisibleElements( aMask ); } int BOARD::GetVisibleElements() const { return m_BoardSettings->GetVisibleElements(); } wxPoint& BOARD::GetPosition() { Loading pcbnew/class_board.h +53 −4 Original line number Diff line number Diff line Loading @@ -207,6 +207,55 @@ public: */ int GetCopperLayerCount() const; /** * Function GetEnabledLayers * is a proxy function that calls the correspondent function in m_BoardSettings * Returns a bit-mask of all the layers that are enabled * @return int - the enabled layers in bit-mapped form. */ int GetEnabledLayers() const; /** * Function GetVisibleLayers * is a proxy function that calls the correspondent function in m_BoardSettings * Returns a bit-mask of all the layers that are visible * @return int - the visible layers in bit-mapped form. */ int GetVisibleLayers() const; /** * Function SetEnabledLayers * is a proxy function that calls the correspondent function in m_BoardSettings * Changes the bit-mask of enabled layers * @param aMask = The new bit-mask of enabled layers */ void SetEnabledLayers( int aLayerMask ); /** * Function SetVisibleLayers * is a proxy function that calls the correspondent function in m_BoardSettings * changes the bit-mask of visible layers * @param aMask = The new bit-mask of visible layers */ void SetVisibleLayers( int aLayerMask ); /** * Function SetVisibleElements * is a proxy function that calls the correspondent function in m_BoardSettings * changes the bit-mask of visible element categories * @param aMask = The new bit-mask of visible element categories */ void SetVisibleElements( int aMask ); /** * Function GetVisibleElements * is a proxy function that calls the correspondent function in m_BoardSettings * returns a bit-mask of all the element categories that are visible * @return int - the visible element categories in bit-mapped form. */ int GetVisibleElements() const; /** * Function GetLayerName * returns the name of the copper layer given by aLayerIndex. Loading pcbnew/classpcb.cpp +33 −50 Original line number Diff line number Diff line Loading @@ -222,7 +222,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() //@@IMB: Not used m_PcbGridColor = DARKGRAY; // Grid color m_EnabledLayers = 0x1fffffff; // IMB: All layers enabled at first. TODO: Use a macro for the initial value. m_EnabledLayers = ALL_LAYERS; // All layers enabled at first. m_VisibleLayers = 0xffffffff; // IMB: All layers visible at first. TODO: Use a macro for the initial value. m_VisibleElements = 0x00000fff; // IMB: All elements visible at first. TODO: Use a macro for the initial value. Loading Loading @@ -252,45 +252,28 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const return m_VisibleLayers; } void EDA_BoardDesignSettings::SetVisibleLayers( int Mask ) void EDA_BoardDesignSettings::SetVisibleLayers( int aMask ) { m_VisibleLayers = Mask & 0x1fffffff; m_VisibleLayers = aMask & m_EnabledLayers & ALL_LAYERS; } /* //@@IMB: Made inline bool EDA_BoardDesignSettings::IsLayerVisible( int LayerNumber ) const void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewState ) { if( LayerNumber < 0 || LayerNumber >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers return false; return (bool)( m_VisibleLayers & 1 << LayerNumber ); } */ void EDA_BoardDesignSettings::SetLayerVisibility( int LayerNumber, bool State ) { if( LayerNumber < 0 || LayerNumber >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers // Altough Pcbnew uses only 29, Gerbview uses all 32 layers if( aLayerIndex < 0 || aLayerIndex >= 32 ) return; if( State ) m_VisibleLayers |= 1 << LayerNumber; if( aNewState && IsLayerEnabled( aLayerIndex )) m_VisibleLayers |= 1 << aLayerIndex; else m_VisibleLayers &= ~( 1 << LayerNumber ); m_VisibleLayers &= ~( 1 << aLayerIndex ); } /* //@@IMB: Made inline bool EDA_BoardDesignSettings::IsElementVisible( int ElementNumber ) const { if( ElementNumber < 0 || ElementNumber > PAD_CMP_VISIBLE ) return false; return (bool)( m_VisibleElements & 1 << ElementNumber ); } */ void EDA_BoardDesignSettings::SetElementVisibility( int ElementNumber, bool State ) void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState ) { if( ElementNumber < 0 || ElementNumber > PAD_CMP_VISIBLE ) if( aElementCategory < 0 || aElementCategory > PAD_CMP_VISIBLE ) return; if( State ) m_VisibleElements |= 1 << ElementNumber; if( aNewState ) m_VisibleElements |= 1 << aElementCategory; else m_VisibleElements &= ~( 1 << ElementNumber ); m_VisibleElements &= ~( 1 << aElementCategory ); } Loading
include/pcbstruct.h +144 −27 Original line number Diff line number Diff line Loading @@ -149,7 +149,38 @@ enum ELEMENTS_NUMBERS PAD_CMP_VISIBLE }; /** * Function IsValidLayerIndex * tests whether a given integer is a valid layer index * @param aLayerIndex = Layer index to test * @return true if aLayerIndex is a valid layer index */ inline bool IsValidLayerIndex( int aLayerIndex ) { return aLayerIndex >= 0 && aLayerIndex < NB_LAYERS; } /** * Function IsValidCopperLayerIndex * tests whether an integer is a valid copper layer index * @param aLayerIndex = Layer index to test * @return true if aLayerIndex is a valid copper layer index */ inline bool IsValidCopperLayerIndex( int aLayerIndex ) { return aLayerIndex >= FIRST_COPPER_LAYER && aLayerIndex <= LAST_COPPER_LAYER; } /** * Function IsValidNonCopperLayerIndex * tests whether an integer is a valid non copper layer index * @param aLayerIndex = Layer index to test * @return true if aLayerIndex is a valid non copper layer index */ inline bool IsValidNonCopperLayerIndex( int aLayerIndex ) { return aLayerIndex >= FIRST_NO_COPPER_LAYER && aLayerIndex <= LAST_NO_COPPER_LAYER; } // Class for handle current printed board design settings class EDA_BoardDesignSettings Loading @@ -176,25 +207,17 @@ public: int m_MaskMargin; // Solder mask margin int m_LayerThickness; // Layer Thickness for 3D viewer // Color options for screen display of the Printed Board: //@@IMB: Not used int m_PcbGridColor; // Grid color int m_EnabledLayers; // IMB: Paving the road int m_VisibleLayers; // IMB: Bit-mask for layer visibility int m_VisibleElements; // IMB: Bit-mask for elements visibility protected: int m_EnabledLayers; // Bit-mask for layer enabling int m_VisibleLayers; // Bit-mask for layer visibility int m_VisibleElements; // Bit-mask for element category visibility public: // Color options for screen display of the Printed Board: int m_LayerColor[32]; // Layer colors (tracks and graphic items) int m_ViaColor[4]; // Via color (depending on is type) //@@IMB: Not used int m_ModuleTextCMPColor; // Text module color for modules on the COMPONENT layer //@@IMB: Not used int m_ModuleTextCUColor; // Text module color for modules on the COPPER layer //@@IMB: Not used int m_ModuleTextNOVColor; // Text module color for "invisible" texts (must be BLACK if really not displayed) //@@IMB: Not used int m_AnchorColor; // Anchor color for modules and texts //@@IMB: Not used int m_PadCUColor; // Pad color for the COPPER side of the pad //@@IMB: Not used int m_PadCMPColor; // Pad color for the COMPONENT side of the pad // Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors) int m_RatsnestColor; // Ratsnest color Loading @@ -205,40 +228,134 @@ public: /** * Function GetVisibleLayers * returns a bit-map of all the layers that are visible. * returns a bit-mask of all the layers that are visible * @return int - the visible layers in bit-mapped form. */ int GetVisibleLayers() const; void SetVisibleLayers( int Mask ); /** * Function SetVisibleLayers * changes the bit-mask of visible layers * @param aMask = The new bit-mask of visible layers */ void SetVisibleLayers( int aMask ); /** * Function IsLayerVisible * @param LayerNumber The number of the layer to be tested. * tests whether a given layer is visible * @param aLayerIndex = The index of the layer to be tested * @return bool - true if the layer is visible. */ inline bool IsLayerVisible( int LayerNumber ) const inline bool IsLayerVisible( int aLayerIndex ) const { if( LayerNumber < 0 || LayerNumber >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers if( aLayerIndex < 0 || aLayerIndex >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers return false; return (bool)( m_VisibleLayers & 1 << LayerNumber ); // If a layer is disabled, it is automatically invisible return (bool)( m_VisibleLayers & m_EnabledLayers & 1 << aLayerIndex ); } void SetLayerVisibility( int LayerNumber, bool State ); /** * Function SetLayerVisibility * changes the visibility of a given layer * @param aLayerIndex = The index of the layer to be changed * @param aNewState = The new visibility state of the layer */ void SetLayerVisibility( int aLayerIndex, bool aNewState ); /** * Function GetVisibleElements * returns a bit-mask of all the element categories that are visible * @return int - the visible element categories in bit-mapped form. */ inline int GetVisibleElements() const { return m_VisibleElements; } /** * Function SetVisibleElements * changes the bit-mask of visible element categories * @param aMask = The new bit-mask of visible element categories */ inline void SetVisibleElements( int aMask ) { m_VisibleElements = aMask; } /** * Function IsElementVisible * @param ElementNumber The number of the element to be tested. * @return bool - true if the elememt is visible. * tests whether a given element category is visible * @param aCategoryIndex = The index of the element category to be tested. * @return bool - true if the element is visible. */ inline bool IsElementVisible( int ElementNumber ) const inline bool IsElementVisible( int aCategoryIndex ) const { if( ElementNumber < 0 || ElementNumber > PAD_CMP_VISIBLE ) if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE ) return false; return (bool)( m_VisibleElements & 1 << ElementNumber ); return (bool)( m_VisibleElements & 1 << aCategoryIndex ); } /** * Function SetElementVisibility * changes the visibility of an element category * @param aCategoryIndex = The index of the element category to be changed * @param aNewState = The new visibility state of the element category */ void SetElementVisibility( int aCategoryIndex, bool aNewState ); /** * Function GetEnabledLayers * returns a bit-mask of all the layers that are enabled * @return int - the enabled layers in bit-mapped form. */ inline int GetEnabledLayers() const { return m_EnabledLayers; } /** * Function SetEnabledLayers * changes the bit-mask of enabled layers * @param aMask = The new bit-mask of enabled layers */ void SetEnabledLayers( int aMask ) { // TODO; ensure consistency with m_CopperLayerCount m_EnabledLayers = aMask; // A disabled layer cannot be visible m_VisibleLayers &= aMask; } /** * Function IsLayerEnabled * tests whether a given layer is enabled * @param aLayerIndex = The index of the layer to be tested * @return bool - true if the layer is enabled */ inline bool IsLayerEnabled( int aLayerIndex ) { return (bool)( m_EnabledLayers & 1 << aLayerIndex ); } void SetElementVisibility( int ElementNumber, bool State ); /** * Function GetCopperLayerCount * @return int - the number of neabled copper layers */ inline int GetCopperLayerCount() const { return m_CopperLayerCount; } /** * Function SetCopperLayerCount * do what its name says... * @param aNewLayerCount = The new number of enabled copper layers */ inline void SetCopperLayerCount( int aNewLayerCount ) { // TODO; ensure consistency with the m_EnabledLayers member m_CopperLayerCount = aNewLayerCount; } }; Loading
pcbnew/CMakeLists.txt +3 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ set(PCBNEW_SRCS cross-probing.cpp debug_kbool_key_file_fct.cpp deltrack.cpp dialog_copper_layers_setup_base.cpp dialog_copper_layers_setup.cpp # dialog_copper_layers_setup_base.cpp # dialog_copper_layers_setup.cpp dialog_copper_zones.cpp dialog_copper_zones_base.cpp dialog_design_rules.cpp Loading @@ -50,6 +50,7 @@ set(PCBNEW_SRCS dialog_graphic_item_properties.cpp dialog_graphic_item_properties_base.cpp # dialog_initpcb.cpp dialog_layers_setup.cpp dialog_netlist.cpp dialog_netlist_fbp.cpp dialog_pcb_text_properties.cpp Loading
pcbnew/class_board.cpp +64 −22 Original line number Diff line number Diff line Loading @@ -129,9 +129,11 @@ BOARD::~BOARD() wxString BOARD::GetLayerName( int aLayerIndex ) const { if( ! IsValidLayerIndex( aLayerIndex )) return wxEmptyString; // copper layer names are stored in the BOARD. if( (unsigned) aLayerIndex < (unsigned) GetCopperLayerCount() || aLayerIndex == LAST_COPPER_LAYER ) if( IsValidCopperLayerIndex( aLayerIndex ) && m_BoardSettings->IsLayerEnabled( aLayerIndex )) { // default names were set in BOARD::BOARD() but they may be // over-ridden by BOARD::SetLayerName() Loading @@ -144,9 +146,9 @@ wxString BOARD::GetLayerName( int aLayerIndex ) const bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) { if( (unsigned) aLayerIndex < (unsigned) GetCopperLayerCount() || aLayerIndex==LAST_COPPER_LAYER ) { if( ! IsValidCopperLayerIndex( aLayerIndex )) return false; if( aLayerName == wxEmptyString || aLayerName.Len() > 20 ) return false; Loading @@ -154,20 +156,20 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) if( aLayerName.Find( wxChar( '"' ) ) != wxNOT_FOUND ) return false; // ensure unique-ness of layer names for( int layer = 0; layer<GetCopperLayerCount() || layer==LAST_COPPER_LAYER; ) wxString NameTemp = aLayerName; // replace any spaces with underscores before we do any comparing NameTemp.Replace( wxT( " " ), wxT( "_" ) ); if( m_BoardSettings->IsLayerEnabled( aLayerIndex )) { if( layer!=aLayerIndex && aLayerName == m_Layer[layer].m_Name ) for( int i = 0; i < NB_COPPER_LAYERS; i++ ) { if( i != aLayerIndex && m_BoardSettings->IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name ) return false; if( ++layer == GetCopperLayerCount() ) layer = LAST_COPPER_LAYER; } m_Layer[aLayerIndex].m_Name = aLayerName; // replace any spaces with underscores m_Layer[aLayerIndex].m_Name.Replace( wxT( " " ), wxT( "_" ) ); m_Layer[aLayerIndex].m_Name = NameTemp; return true; } Loading @@ -178,7 +180,12 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) LAYER_T BOARD::GetLayerType( int aLayerIndex ) const { if( (unsigned) aLayerIndex < (unsigned) GetCopperLayerCount() ) if( ! IsValidCopperLayerIndex( aLayerIndex )) return LT_SIGNAL; //@@IMB: The original test was broken due to the discontinuity // in the layer sequence. if( m_BoardSettings->IsLayerEnabled( aLayerIndex )) return m_Layer[aLayerIndex].m_Type; return LT_SIGNAL; } Loading @@ -186,7 +193,12 @@ LAYER_T BOARD::GetLayerType( int aLayerIndex ) const bool BOARD::SetLayerType( int aLayerIndex, LAYER_T aLayerType ) { if( (unsigned) aLayerIndex < (unsigned) GetCopperLayerCount() ) if( ! IsValidCopperLayerIndex( aLayerIndex )) return false; //@@IMB: The original test was broken due to the discontinuity // in the layer sequence. if( m_BoardSettings->IsLayerEnabled( aLayerIndex )) { m_Layer[aLayerIndex].m_Type = aLayerType; return true; Loading Loading @@ -239,6 +251,36 @@ int BOARD::GetCopperLayerCount() const return m_BoardSettings->m_CopperLayerCount; } int BOARD::GetEnabledLayers() const { return m_BoardSettings->GetEnabledLayers(); } int BOARD::GetVisibleLayers() const { return m_BoardSettings->GetVisibleLayers(); } void BOARD::SetEnabledLayers( int aLayerMask ) { m_BoardSettings->SetEnabledLayers( aLayerMask ); } void BOARD::SetVisibleLayers( int aLayerMask ) { m_BoardSettings->SetVisibleLayers( aLayerMask ); } void BOARD::SetVisibleElements( int aMask ) { m_BoardSettings->SetVisibleElements( aMask ); } int BOARD::GetVisibleElements() const { return m_BoardSettings->GetVisibleElements(); } wxPoint& BOARD::GetPosition() { Loading
pcbnew/class_board.h +53 −4 Original line number Diff line number Diff line Loading @@ -207,6 +207,55 @@ public: */ int GetCopperLayerCount() const; /** * Function GetEnabledLayers * is a proxy function that calls the correspondent function in m_BoardSettings * Returns a bit-mask of all the layers that are enabled * @return int - the enabled layers in bit-mapped form. */ int GetEnabledLayers() const; /** * Function GetVisibleLayers * is a proxy function that calls the correspondent function in m_BoardSettings * Returns a bit-mask of all the layers that are visible * @return int - the visible layers in bit-mapped form. */ int GetVisibleLayers() const; /** * Function SetEnabledLayers * is a proxy function that calls the correspondent function in m_BoardSettings * Changes the bit-mask of enabled layers * @param aMask = The new bit-mask of enabled layers */ void SetEnabledLayers( int aLayerMask ); /** * Function SetVisibleLayers * is a proxy function that calls the correspondent function in m_BoardSettings * changes the bit-mask of visible layers * @param aMask = The new bit-mask of visible layers */ void SetVisibleLayers( int aLayerMask ); /** * Function SetVisibleElements * is a proxy function that calls the correspondent function in m_BoardSettings * changes the bit-mask of visible element categories * @param aMask = The new bit-mask of visible element categories */ void SetVisibleElements( int aMask ); /** * Function GetVisibleElements * is a proxy function that calls the correspondent function in m_BoardSettings * returns a bit-mask of all the element categories that are visible * @return int - the visible element categories in bit-mapped form. */ int GetVisibleElements() const; /** * Function GetLayerName * returns the name of the copper layer given by aLayerIndex. Loading
pcbnew/classpcb.cpp +33 −50 Original line number Diff line number Diff line Loading @@ -222,7 +222,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() //@@IMB: Not used m_PcbGridColor = DARKGRAY; // Grid color m_EnabledLayers = 0x1fffffff; // IMB: All layers enabled at first. TODO: Use a macro for the initial value. m_EnabledLayers = ALL_LAYERS; // All layers enabled at first. m_VisibleLayers = 0xffffffff; // IMB: All layers visible at first. TODO: Use a macro for the initial value. m_VisibleElements = 0x00000fff; // IMB: All elements visible at first. TODO: Use a macro for the initial value. Loading Loading @@ -252,45 +252,28 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const return m_VisibleLayers; } void EDA_BoardDesignSettings::SetVisibleLayers( int Mask ) void EDA_BoardDesignSettings::SetVisibleLayers( int aMask ) { m_VisibleLayers = Mask & 0x1fffffff; m_VisibleLayers = aMask & m_EnabledLayers & ALL_LAYERS; } /* //@@IMB: Made inline bool EDA_BoardDesignSettings::IsLayerVisible( int LayerNumber ) const void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewState ) { if( LayerNumber < 0 || LayerNumber >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers return false; return (bool)( m_VisibleLayers & 1 << LayerNumber ); } */ void EDA_BoardDesignSettings::SetLayerVisibility( int LayerNumber, bool State ) { if( LayerNumber < 0 || LayerNumber >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers // Altough Pcbnew uses only 29, Gerbview uses all 32 layers if( aLayerIndex < 0 || aLayerIndex >= 32 ) return; if( State ) m_VisibleLayers |= 1 << LayerNumber; if( aNewState && IsLayerEnabled( aLayerIndex )) m_VisibleLayers |= 1 << aLayerIndex; else m_VisibleLayers &= ~( 1 << LayerNumber ); m_VisibleLayers &= ~( 1 << aLayerIndex ); } /* //@@IMB: Made inline bool EDA_BoardDesignSettings::IsElementVisible( int ElementNumber ) const { if( ElementNumber < 0 || ElementNumber > PAD_CMP_VISIBLE ) return false; return (bool)( m_VisibleElements & 1 << ElementNumber ); } */ void EDA_BoardDesignSettings::SetElementVisibility( int ElementNumber, bool State ) void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState ) { if( ElementNumber < 0 || ElementNumber > PAD_CMP_VISIBLE ) if( aElementCategory < 0 || aElementCategory > PAD_CMP_VISIBLE ) return; if( State ) m_VisibleElements |= 1 << ElementNumber; if( aNewState ) m_VisibleElements |= 1 << aElementCategory; else m_VisibleElements &= ~( 1 << ElementNumber ); m_VisibleElements &= ~( 1 << aElementCategory ); }