Commit 25973e56 authored by dickelbeck's avatar dickelbeck

Isaac's next layer selection and configuration work step

parent 07ae1615
...@@ -149,7 +149,38 @@ enum ELEMENTS_NUMBERS ...@@ -149,7 +149,38 @@ enum ELEMENTS_NUMBERS
PAD_CMP_VISIBLE 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 for handle current printed board design settings
class EDA_BoardDesignSettings class EDA_BoardDesignSettings
...@@ -176,25 +207,17 @@ public: ...@@ -176,25 +207,17 @@ public:
int m_MaskMargin; // Solder mask margin int m_MaskMargin; // Solder mask margin
int m_LayerThickness; // Layer Thickness for 3D viewer int m_LayerThickness; // Layer Thickness for 3D viewer
// Color options for screen display of the Printed Board: protected:
//@@IMB: Not used int m_PcbGridColor; // Grid color int m_EnabledLayers; // Bit-mask for layer enabling
int m_VisibleLayers; // Bit-mask for layer visibility
int m_EnabledLayers; // IMB: Paving the road int m_VisibleElements; // Bit-mask for element category visibility
int m_VisibleLayers; // IMB: Bit-mask for layer visibility
int m_VisibleElements; // IMB: Bit-mask for elements visibility
public:
// Color options for screen display of the Printed Board:
int m_LayerColor[32]; // Layer colors (tracks and graphic items) int m_LayerColor[32]; // Layer colors (tracks and graphic items)
int m_ViaColor[4]; // Via color (depending on is type) 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) // Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors)
int m_RatsnestColor; // Ratsnest color int m_RatsnestColor; // Ratsnest color
...@@ -205,40 +228,134 @@ public: ...@@ -205,40 +228,134 @@ public:
/** /**
* Function GetVisibleLayers * 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. * @return int - the visible layers in bit-mapped form.
*/ */
int GetVisibleLayers() const; 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 * 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. * @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 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 * Function IsElementVisible
* @param ElementNumber The number of the element to be tested. * tests whether a given element category is visible
* @return bool - true if the elememt 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 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;
} }
void SetElementVisibility( int ElementNumber, bool State ); /**
* 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 );
}
/**
* 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;
}
}; };
......
...@@ -25,8 +25,8 @@ set(PCBNEW_SRCS ...@@ -25,8 +25,8 @@ set(PCBNEW_SRCS
cross-probing.cpp cross-probing.cpp
debug_kbool_key_file_fct.cpp debug_kbool_key_file_fct.cpp
deltrack.cpp deltrack.cpp
dialog_copper_layers_setup_base.cpp # dialog_copper_layers_setup_base.cpp
dialog_copper_layers_setup.cpp # dialog_copper_layers_setup.cpp
dialog_copper_zones.cpp dialog_copper_zones.cpp
dialog_copper_zones_base.cpp dialog_copper_zones_base.cpp
dialog_design_rules.cpp dialog_design_rules.cpp
...@@ -50,6 +50,7 @@ set(PCBNEW_SRCS ...@@ -50,6 +50,7 @@ set(PCBNEW_SRCS
dialog_graphic_item_properties.cpp dialog_graphic_item_properties.cpp
dialog_graphic_item_properties_base.cpp dialog_graphic_item_properties_base.cpp
# dialog_initpcb.cpp # dialog_initpcb.cpp
dialog_layers_setup.cpp
dialog_netlist.cpp dialog_netlist.cpp
dialog_netlist_fbp.cpp dialog_netlist_fbp.cpp
dialog_pcb_text_properties.cpp dialog_pcb_text_properties.cpp
......
...@@ -129,9 +129,11 @@ BOARD::~BOARD() ...@@ -129,9 +129,11 @@ BOARD::~BOARD()
wxString BOARD::GetLayerName( int aLayerIndex ) const wxString BOARD::GetLayerName( int aLayerIndex ) const
{ {
if( ! IsValidLayerIndex( aLayerIndex ))
return wxEmptyString;
// copper layer names are stored in the BOARD. // copper layer names are stored in the BOARD.
if( (unsigned) aLayerIndex < (unsigned) GetCopperLayerCount() if( IsValidCopperLayerIndex( aLayerIndex ) && m_BoardSettings->IsLayerEnabled( aLayerIndex ))
|| aLayerIndex == LAST_COPPER_LAYER )
{ {
// default names were set in BOARD::BOARD() but they may be // default names were set in BOARD::BOARD() but they may be
// over-ridden by BOARD::SetLayerName() // over-ridden by BOARD::SetLayerName()
...@@ -144,30 +146,30 @@ wxString BOARD::GetLayerName( int aLayerIndex ) const ...@@ -144,30 +146,30 @@ wxString BOARD::GetLayerName( int aLayerIndex ) const
bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
{ {
if( (unsigned) aLayerIndex < (unsigned) GetCopperLayerCount() if( ! IsValidCopperLayerIndex( aLayerIndex ))
|| aLayerIndex==LAST_COPPER_LAYER ) return false;
{
if( aLayerName == wxEmptyString || aLayerName.Len() > 20 ) if( aLayerName == wxEmptyString || aLayerName.Len() > 20 )
return false; return false;
// no quote chars in the name allowed
if( aLayerName.Find( wxChar( '"' ) ) != wxNOT_FOUND )
return false;
// no quote chars in the name allowed wxString NameTemp = aLayerName;
if( aLayerName.Find( wxChar( '"' ) ) != wxNOT_FOUND )
return false;
// ensure unique-ness of layer names // replace any spaces with underscores before we do any comparing
for( int layer = 0; layer<GetCopperLayerCount() || layer==LAST_COPPER_LAYER; ) NameTemp.Replace( wxT( " " ), wxT( "_" ) );
if( m_BoardSettings->IsLayerEnabled( aLayerIndex ))
{
for( int i = 0; i < NB_COPPER_LAYERS; i++ )
{ {
if( layer!=aLayerIndex && aLayerName == m_Layer[layer].m_Name ) if( i != aLayerIndex && m_BoardSettings->IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name )
return false; return false;
if( ++layer == GetCopperLayerCount() )
layer = LAST_COPPER_LAYER;
} }
m_Layer[aLayerIndex].m_Name = aLayerName; m_Layer[aLayerIndex].m_Name = NameTemp;
// replace any spaces with underscores
m_Layer[aLayerIndex].m_Name.Replace( wxT( " " ), wxT( "_" ) );
return true; return true;
} }
...@@ -178,7 +180,12 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) ...@@ -178,7 +180,12 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
LAYER_T BOARD::GetLayerType( int aLayerIndex ) const 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 m_Layer[aLayerIndex].m_Type;
return LT_SIGNAL; return LT_SIGNAL;
} }
...@@ -186,7 +193,12 @@ LAYER_T BOARD::GetLayerType( int aLayerIndex ) const ...@@ -186,7 +193,12 @@ LAYER_T BOARD::GetLayerType( int aLayerIndex ) const
bool BOARD::SetLayerType( int aLayerIndex, LAYER_T aLayerType ) 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; m_Layer[aLayerIndex].m_Type = aLayerType;
return true; return true;
...@@ -239,6 +251,36 @@ int BOARD::GetCopperLayerCount() const ...@@ -239,6 +251,36 @@ int BOARD::GetCopperLayerCount() const
return m_BoardSettings->m_CopperLayerCount; 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() wxPoint& BOARD::GetPosition()
{ {
......
...@@ -207,6 +207,55 @@ public: ...@@ -207,6 +207,55 @@ public:
*/ */
int GetCopperLayerCount() const; 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 * Function GetLayerName
* returns the name of the copper layer given by aLayerIndex. * returns the name of the copper layer given by aLayerIndex.
...@@ -555,10 +604,10 @@ public: ...@@ -555,10 +604,10 @@ public:
* @param bMessageBoxInt == true, shows message when clipping occurs. * @param bMessageBoxInt == true, shows message when clipping occurs.
* @param bMessageBoxArc == true, shows message when clipping can't be done due to arcs. * @param bMessageBoxArc == true, shows message when clipping can't be done due to arcs.
* @param bRetainArcs = true to handle arcs (not really used in kicad) * @param bRetainArcs = true to handle arcs (not really used in kicad)
* @return: * @return :
* -1 if arcs intersect other sides, so polygon can't be clipped * -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides * 0 if no intersecting sides
* 1 if intersecting sides * 1 if intersecting sides
* Also sets areas->utility1 flags if areas are modified * Also sets areas->utility1 flags if areas are modified
*/ */
int ClipAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, int ClipAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList,
......
/**********************************************************************/ /**********************************************************************/
/* fonctions membres des classes utilisees dans pcbnew (voir pcbstruct.h */ /* fonctions membres des classes utilisees dans pcbnew (voir pcbstruct.h */
/* sauf routines relatives aux pistes (voir class_track.cpp) */ /* sauf routines relatives aux pistes (voir class_track.cpp) */
/**********************************************************************/ /**********************************************************************/
#include "fctsys.h" #include "fctsys.h"
...@@ -198,31 +198,31 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -198,31 +198,31 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
LIGHTGRAY LIGHTGRAY
}; };
m_CopperLayerCount = 2; // Default design is a double sided board m_CopperLayerCount = 2; // Default design is a double sided board
m_ViaDrill = 250; // defualt via drill (for the entire board) m_ViaDrill = 250; // defualt via drill (for the entire board)
m_ViaDrillCustomValue = 250; // via drill for vias which must have a defined drill value m_ViaDrillCustomValue = 250; // via drill for vias which must have a defined drill value
m_CurrentViaSize = 450; // Current via size m_CurrentViaSize = 450; // Current via size
m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA) m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
m_CurrentTrackWidth = 170; // current track width m_CurrentTrackWidth = 170; // current track width
m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width
m_MicroViaDrill = 50; // micro via drill (for the entire board) m_MicroViaDrill = 50; // micro via drill (for the entire board)
m_CurrentMicroViaSize = 150; // Current micro via size m_CurrentMicroViaSize = 150; // Current micro via size
m_MicroViasAllowed = false; // true to allow micro vias m_MicroViasAllowed = false; // true to allow micro vias
m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer) m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer)
m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only) m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only)
m_PcbTextWidth = 100; // current Pcb (not module) Text width m_PcbTextWidth = 100; // current Pcb (not module) Text width
m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size
m_TrackClearance = 100; // track to track and track to pads clearance m_TrackClearance = 100; // track to track and track to pads clearance
m_TrackMinWidth = 80; // track min value for width ((min copper size value m_TrackMinWidth = 80; // track min value for width ((min copper size value
m_ViasMinSize = 350; // vias (not micro vias) min diameter m_ViasMinSize = 350; // vias (not micro vias) min diameter
m_MicroViasMinSize = 200; // micro vias (not vias) min diameter m_MicroViasMinSize = 200; // micro vias (not vias) min diameter
m_MaskMargin = 150; // Solder mask margin m_MaskMargin = 150; // Solder mask margin
/* Color options for screen display of the Printed Board: */ /* Color options for screen display of the Printed Board: */
//@@IMB: Not used m_PcbGridColor = DARKGRAY; // Grid color //@@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_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. m_VisibleElements = 0x00000fff; // IMB: All elements visible at first. TODO: Use a macro for the initial value.
...@@ -252,45 +252,28 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const ...@@ -252,45 +252,28 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const
return m_VisibleLayers; 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 void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewState )
bool EDA_BoardDesignSettings::IsLayerVisible( int LayerNumber ) const
{ {
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
return false; if( aLayerIndex < 0 || aLayerIndex >= 32 )
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
return; return;
if( State ) if( aNewState && IsLayerEnabled( aLayerIndex ))
m_VisibleLayers |= 1 << LayerNumber; m_VisibleLayers |= 1 << aLayerIndex;
else 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; return;
if( State ) if( aNewState )
m_VisibleElements |= 1 << ElementNumber; m_VisibleElements |= 1 << aElementCategory;
else else
m_VisibleElements &= ~( 1 << ElementNumber ); m_VisibleElements &= ~( 1 << aElementCategory );
} }
...@@ -45,6 +45,7 @@ void Dialog_GeneralOptions::init() ...@@ -45,6 +45,7 @@ void Dialog_GeneralOptions::init()
wxString timevalue; wxString timevalue;
timevalue << g_TimeOut / 60; timevalue << g_TimeOut / 60;
m_SaveTime->SetValue( timevalue ); m_SaveTime->SetValue( timevalue );
/*
int layer_count[] = {1,2,4,6,8,10,12,14,16}; int layer_count[] = {1,2,4,6,8,10,12,14,16};
m_LayerNumber->SetSelection(1); m_LayerNumber->SetSelection(1);
for ( unsigned ii = 0; ii < sizeof(layer_count); ii++ ) for ( unsigned ii = 0; ii < sizeof(layer_count); ii++ )
...@@ -54,7 +55,7 @@ void Dialog_GeneralOptions::init() ...@@ -54,7 +55,7 @@ void Dialog_GeneralOptions::init()
m_LayerNumber->SetSelection(ii); m_LayerNumber->SetSelection(ii);
break; break;
} }
*/
m_MaxShowLinks->SetValue( g_MaxLinksShowed ); m_MaxShowLinks->SetValue( g_MaxLinksShowed );
m_DrcOn->SetValue( Drc_On ); m_DrcOn->SetValue( Drc_On );
...@@ -103,10 +104,11 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) ...@@ -103,10 +104,11 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
g_TimeOut = 60 * m_SaveTime->GetValue(); g_TimeOut = 60 * m_SaveTime->GetValue();
/* Mise a jour de la combobox d'affichage de la couche active */ /* Mise a jour de la combobox d'affichage de la couche active */
/*
int layer_count[] = {1,2,4,6,8,10,12,14,16}; int layer_count[] = {1,2,4,6,8,10,12,14,16};
g_DesignSettings.m_CopperLayerCount = layer_count[m_LayerNumber->GetSelection()]; g_DesignSettings.m_CopperLayerCount = layer_count[m_LayerNumber->GetSelection()];
m_Parent->ReCreateLayerBox( NULL ); m_Parent->ReCreateLayerBox( NULL );
*/
g_MaxLinksShowed = m_MaxShowLinks->GetValue(); g_MaxLinksShowed = m_MaxShowLinks->GetValue();
Drc_On = m_DrcOn->GetValue(); Drc_On = m_DrcOn->GetValue();
if( g_Show_Ratsnest != m_ShowGlobalRatsnest->GetValue() ) if( g_Show_Ratsnest != m_ShowGlobalRatsnest->GetValue() )
......
...@@ -31,55 +31,55 @@ ...@@ -31,55 +31,55 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DialogGeneralOptionsBoardEditor_base : public wxDialog class DialogGeneralOptionsBoardEditor_base : public wxDialog
{ {
private: private:
protected: protected:
enum enum
{ {
wxID_POLAR_CTRL = 1000, wxID_POLAR_CTRL = 1000,
wxID_UNITS, wxID_UNITS,
wxID_CURSOR_SHAPE, wxID_CURSOR_SHAPE,
wxID_LAYER_NUMBER, // wxID_LAYER_NUMBER,
wxID_DRC_ONOFF, wxID_DRC_ONOFF,
wxID_GENERAL_RATSNEST, wxID_GENERAL_RATSNEST,
wxID_RATSNEST_MODULE, wxID_RATSNEST_MODULE,
wxID_TRACK_AUTODEL, wxID_TRACK_AUTODEL,
wxID_TRACKS45, wxID_TRACKS45,
wxID_SEGMENTS45, wxID_SEGMENTS45,
wxID_AUTOPAN, wxID_AUTOPAN,
wxID_MAGNETIC_TRACKS, wxID_MAGNETIC_TRACKS,
}; };
wxRadioBox* m_PolarDisplay; wxRadioBox* m_PolarDisplay;
wxRadioBox* m_UnitsSelection; wxRadioBox* m_UnitsSelection;
wxRadioBox* m_CursorShape; wxRadioBox* m_CursorShape;
wxRadioBox* m_LayerNumber; //wxRadioBox* m_LayerNumber;
wxStaticText* m_staticTextmaxlinks; wxStaticText* m_staticTextmaxlinks;
wxSpinCtrl* m_MaxShowLinks; wxSpinCtrl* m_MaxShowLinks;
wxStaticText* m_staticTextautosave; wxStaticText* m_staticTextautosave;
wxSpinCtrl* m_SaveTime; wxSpinCtrl* m_SaveTime;
wxCheckBox* m_DrcOn; wxCheckBox* m_DrcOn;
wxCheckBox* m_ShowGlobalRatsnest; wxCheckBox* m_ShowGlobalRatsnest;
wxCheckBox* m_ShowModuleRatsnest; wxCheckBox* m_ShowModuleRatsnest;
wxCheckBox* m_TrackAutodel; wxCheckBox* m_TrackAutodel;
wxCheckBox* m_Track_45_Only_Ctrl; wxCheckBox* m_Track_45_Only_Ctrl;
wxCheckBox* m_Segments_45_Only_Ctrl; wxCheckBox* m_Segments_45_Only_Ctrl;
wxCheckBox* m_AutoPANOpt; wxCheckBox* m_AutoPANOpt;
wxCheckBox* m_Track_DoubleSegm_Ctrl; wxCheckBox* m_Track_DoubleSegm_Ctrl;
wxRadioBox* m_MagneticPadOptCtrl; wxRadioBox* m_MagneticPadOptCtrl;
wxRadioBox* m_MagneticTrackOptCtrl; wxRadioBox* m_MagneticTrackOptCtrl;
wxButton* m_buttonOK; wxButton* m_buttonOK;
wxButton* m_buttonCANCEL; wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
public: public:
DialogGeneralOptionsBoardEditor_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("General settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 585,280 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DialogGeneralOptionsBoardEditor_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("General settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 585,280 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DialogGeneralOptionsBoardEditor_base(); ~DialogGeneralOptionsBoardEditor_base();
}; };
#endif //__dialog_general_options_BoardEditor_base__ #endif //__dialog_general_options_BoardEditor_base__
/********************************************************************/ /********************************************************************/
/* Routines de lecture et sauvegarde des structures en format ASCii */ /* Routines de lecture et sauvegarde des structures en format ASCii */
/* Fichier common a PCBNEW et CVPCB */ /* Fichier common a PCBNEW et CVPCB */
/********************************************************************/ /********************************************************************/
/* ioascii.cpp */ /* ioascii.cpp */
...@@ -32,12 +32,12 @@ ...@@ -32,12 +32,12 @@
$PAD $PAD
Sh "name" forme dimv dimH dV dH orient :forme generale dV, dH = delta dimensions Sh "name" forme dimv dimH dV dH orient :forme generale dV, dH = delta dimensions
Dr diam, dV dH :drill : diametre offsets de percage Dr diam, dV dH :drill : diametre offsets de percage
At type S/N layers : type standard,cms,conn,hole,meca., At type S/N layers : type standard,cms,conn,hole,meca.,
Stack/Normal, Stack/Normal,
Hexadecimal 32 bits: occupation des couches Hexadecimal 32 bits: occupation des couches
Nm net_code netname Nm net_code netname
Po posrefX posrefy : position refX,Y (= position orient 0 / ancre) Po posrefX posrefy : position refX,Y (= position orient 0 / ancre)
$EndPAD $EndPAD
****** Structure module *********** ****** Structure module ***********
...@@ -51,12 +51,12 @@ ...@@ -51,12 +51,12 @@
m_TimeCode a usage interne (groupements) m_TimeCode a usage interne (groupements)
Li <namelib> Li <namelib>
Cd <text> Description du composant (Composant Doc) Cd <text> Description du composant (Composant Doc)
Kw <text> Liste des mots cle Kw <text> Liste des mots cle
Sc schematimestamp de reference schematique Sc schematimestamp de reference schematique
Op rot90 rot180 Options de placement auto (cout rot 90, 180 ) Op rot90 rot180 Options de placement auto (cout rot 90, 180 )
rot90 est sur 2x4 bits: rot90 est sur 2x4 bits:
lsb = cout rot 90, msb = cout rot -90; lsb = cout rot 90, msb = cout rot -90;
...@@ -70,9 +70,9 @@ ...@@ -70,9 +70,9 @@
edge: segment coord ox,oy a fx,fy, relatives edge: segment coord ox,oy a fx,fy, relatives
a l'ancre et orient 0 a l'ancre et orient 0
epaisseur w epaisseur w
DC ox oy fx fy w descr cercle (centre, 1 point, epaisseur) DC ox oy fx fy w descr cercle (centre, 1 point, epaisseur)
$PAD $PAD
$EndPAD section pads s'il y en a $EndPAD section pads s'il y en a
$EndMODULE $EndMODULE
*/ */
...@@ -196,7 +196,7 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum ) ...@@ -196,7 +196,7 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum )
sscanf( data, "%X", &EnabledLayers ); sscanf( data, "%X", &EnabledLayers );
// Setup layer visibility // Setup layer visibility
GetBoard()->m_BoardSettings->m_EnabledLayers = EnabledLayers; GetBoard()->SetEnabledLayers( EnabledLayers );
continue; continue;
} }
...@@ -208,7 +208,7 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum ) ...@@ -208,7 +208,7 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum )
sscanf( data, "%X", &VisibleLayers ); sscanf( data, "%X", &VisibleLayers );
// Setup layer visibility // Setup layer visibility
GetBoard()->m_BoardSettings->m_VisibleLayers = VisibleLayers; GetBoard()->SetVisibleLayers( VisibleLayers );
continue; continue;
} }
...@@ -220,7 +220,7 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum ) ...@@ -220,7 +220,7 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum )
sscanf( data, "%X", &VisibleElements ); sscanf( data, "%X", &VisibleElements );
// Setup elements visibility // Setup elements visibility
GetBoard()->m_BoardSettings->m_VisibleElements = VisibleElements; GetBoard()->SetVisibleElements( VisibleElements );
continue; continue;
} }
...@@ -665,9 +665,9 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File ) ...@@ -665,9 +665,9 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File )
// Write old format for Layer count (for compatibility with old versions of pcbnew // Write old format for Layer count (for compatibility with old versions of pcbnew
fprintf( File, "Ly %8X\n", g_TabAllCopperLayerMask[NbLayers - 1] | ALL_NO_CU_LAYERS ); // For compatibility with old version of pcbnew fprintf( File, "Ly %8X\n", g_TabAllCopperLayerMask[NbLayers - 1] | ALL_NO_CU_LAYERS ); // For compatibility with old version of pcbnew
fprintf( File, "EnabledLayers %08X\n", GetBoard()->m_BoardSettings->m_EnabledLayers ); fprintf( File, "EnabledLayers %08X\n", GetBoard()->GetEnabledLayers() );
fprintf( File, "VisibleLayers %08X\n", GetBoard()->m_BoardSettings->m_VisibleLayers ); fprintf( File, "VisibleLayers %08X\n", GetBoard()->GetVisibleLayers() );
fprintf( File, "VisibleElements %08X\n", GetBoard()->m_BoardSettings->m_VisibleElements ); fprintf( File, "VisibleElements %08X\n", GetBoard()->GetVisibleElements() );
fprintf( File, "Links %d\n", GetBoard()->GetRatsnestsCount() ); fprintf( File, "Links %d\n", GetBoard()->GetRatsnestsCount() );
fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect ); fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect );
......
...@@ -213,10 +213,18 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -213,10 +213,18 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item->SetBitmap( hammer_xpm ); item->SetBitmap( hammer_xpm );
designRulesMenu->Append( item ); designRulesMenu->Append( item );
/*
item = new wxMenuItem( designRulesMenu, ID_PCB_COPPER_LAYERS_SETUP, _( "Copper &Layers" ), item = new wxMenuItem( designRulesMenu, ID_PCB_COPPER_LAYERS_SETUP, _( "Copper &Layers" ),
_( "Select copper layers count and layers names" ) ); _( "Select copper layers count and layers names" ) );
item->SetBitmap( copper_layers_setup_xpm ); item->SetBitmap( copper_layers_setup_xpm );
designRulesMenu->Append( item ); designRulesMenu->Append( item );
*/
item = new wxMenuItem( configmenu, ID_PCB_LAYERS_SETUP, _( "&Layers Setup" ),
_( "Enable and set properties of layers" ) );
item->SetBitmap( copper_layers_setup_xpm );
designRulesMenu->Append( item );
///////////////////////////// /////////////////////////////
// Ajustage de dimensions: // // Ajustage de dimensions: //
...@@ -274,10 +282,10 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -274,10 +282,10 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
postprocess_menu->Append( item ); postprocess_menu->Append( item );
item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_BOM_FILE_FROM_BOARD, item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_BOM_FILE_FROM_BOARD,
_( "Create &BOM File" ), _( "Create &BOM File" ),
_( "Recreate .csv file for CvPcb" ) ); _( "Recreate .csv file for CvPcb" ) );
item->SetBitmap( tools_xpm ); item->SetBitmap( tools_xpm );
postprocess_menu->Append( item ); postprocess_menu->Append( item );
////////////////////////// //////////////////////////
// Menu d'outils divers // // Menu d'outils divers //
......
/***********************************/ /***********************************/
/** pcbcfg() : configuration **/ /** pcbcfg() : configuration **/
/***********************************/ /***********************************/
/* lit ou met a jour la configuration de PCBNEW */ /* lit ou met a jour la configuration de PCBNEW */
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "pcbnew_id.h" #include "pcbnew_id.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "protos.h" #include "protos.h"
#include "dialog_copper_layers_setup.h" //#include "dialog_copper_layers_setup.h"
/* Routines Locales */ /* Routines Locales */
...@@ -49,12 +49,18 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event ) ...@@ -49,12 +49,18 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
DisplayColorSetupFrame( this, pos ); DisplayColorSetupFrame( this, pos );
break; break;
/*
case ID_PCB_COPPER_LAYERS_SETUP: case ID_PCB_COPPER_LAYERS_SETUP:
{ {
DIALOG_COPPER_LAYERS_SETUP dialog( this ); DIALOG_COPPER_LAYERS_SETUP dialog( this );
dialog.ShowModal(); dialog.ShowModal();
} }
break; break;
*/
case ID_PCB_LAYERS_SETUP:
DisplayDialogLayerSetup( this );
break;
case ID_CONFIG_REQ: // Creation de la fenetre de configuration case ID_CONFIG_REQ: // Creation de la fenetre de configuration
InstallConfigFrame( pos ); InstallConfigFrame( pos );
......
...@@ -84,7 +84,8 @@ EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START, ...@@ -84,7 +84,8 @@ EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_COPPER_LAYERS_SETUP, WinEDA_PcbFrame::Process_Config ) //EVT_MENU( ID_PCB_COPPER_LAYERS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_LAYERS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
......
...@@ -23,7 +23,8 @@ enum pcbnew_ids ...@@ -23,7 +23,8 @@ enum pcbnew_ids
ID_PCB_MIRE_BUTT, ID_PCB_MIRE_BUTT,
ID_PCB_SHOW_1_RATSNEST_BUTT, ID_PCB_SHOW_1_RATSNEST_BUTT,
ID_PCB_PLACE_OFFSET_COORD_BUTT, ID_PCB_PLACE_OFFSET_COORD_BUTT,
ID_PCB_COPPER_LAYERS_SETUP, // ID_PCB_COPPER_LAYERS_SETUP,
ID_PCB_LAYERS_SETUP,
ID_PCB_ADD_LINE_BUTT, ID_PCB_ADD_LINE_BUTT,
ID_PCB_ADD_TEXT_BUTT, ID_PCB_ADD_TEXT_BUTT,
......
...@@ -385,4 +385,10 @@ void DisplayColorSetupFrame( WinEDA_PcbFrame* parent, ...@@ -385,4 +385,10 @@ void DisplayColorSetupFrame( WinEDA_PcbFrame* parent,
const wxPoint& framepos ); const wxPoint& framepos );
/***************************/
/* DIALOG_LAYERS_SETUP.CPP */
/***************************/
void DisplayDialogLayerSetup( WinEDA_PcbFrame* parent );
#endif /* #define PROTO_H */ #endif /* #define PROTO_H */
...@@ -582,7 +582,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() ...@@ -582,7 +582,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
wxSize( LISTBOX_WIDTH + 20, -1 ), wxSize( LISTBOX_WIDTH + 20, -1 ),
wxTE_READONLY ); wxTE_READONLY );
m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") ); m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") );
m_AuxiliaryToolBar->AddControl( m_ClearanceBox ); m_AuxiliaryToolBar->AddControl( m_ClearanceBox );
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
// Creates box to display the current NetClass: // Creates box to display the current NetClass:
...@@ -591,7 +591,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() ...@@ -591,7 +591,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
wxSize( LISTBOX_WIDTH, -1 ), wxSize( LISTBOX_WIDTH, -1 ),
wxTE_READONLY ); wxTE_READONLY );
m_NetClassSelectedBox->SetToolTip(_("Name of the current NetClass") ); m_NetClassSelectedBox->SetToolTip(_("Name of the current NetClass") );
m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox ); m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox );
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
// Creates box to display and choose strategy to handle tracks an // Creates box to display and choose strategy to handle tracks an
...@@ -729,11 +729,12 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) ...@@ -729,11 +729,12 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
parent->AddControl( m_SelLayerBox ); parent->AddControl( m_SelLayerBox );
} }
/*
int layer_mask = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1]; int layer_mask = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
layer_mask |= ALL_NO_CU_LAYERS; layer_mask |= ALL_NO_CU_LAYERS;
*/
int layer_mask = g_DesignSettings.GetEnabledLayers();
unsigned length = 0; unsigned length = 0;
m_SelLayerBox->Clear(); m_SelLayerBox->Clear();
......
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