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 );
}
/**
* 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;
} }
void SetLayerVisibility( int LayerNumber, bool State ); /**
* 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 );
} }
void SetElementVisibility( int ElementNumber, bool State ); /**
* 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 );
}
/**
* 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,9 +146,9 @@ wxString BOARD::GetLayerName( int aLayerIndex ) const ...@@ -144,9 +146,9 @@ 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;
...@@ -154,20 +156,20 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) ...@@ -154,20 +156,20 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
if( aLayerName.Find( wxChar( '"' ) ) != wxNOT_FOUND ) if( aLayerName.Find( wxChar( '"' ) ) != wxNOT_FOUND )
return false; return false;
// ensure unique-ness of layer names wxString NameTemp = aLayerName;
for( int layer = 0; layer<GetCopperLayerCount() || layer==LAST_COPPER_LAYER; )
// 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; 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,7 +604,7 @@ public: ...@@ -555,7 +604,7 @@ 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
......
...@@ -222,7 +222,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -222,7 +222,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
//@@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() )
......
...@@ -48,6 +48,7 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi ...@@ -48,6 +48,7 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi
wxBoxSizer* bMiddleLeftSizer; wxBoxSizer* bMiddleLeftSizer;
bMiddleLeftSizer = new wxBoxSizer( wxVERTICAL ); bMiddleLeftSizer = new wxBoxSizer( wxVERTICAL );
/*
wxString m_LayerNumberChoices[] = { _("1"), _("2"), _("4"), _("6"), _("8"), _("10"), _("12"), _("14"), _("16") }; wxString m_LayerNumberChoices[] = { _("1"), _("2"), _("4"), _("6"), _("8"), _("10"), _("12"), _("14"), _("16") };
int m_LayerNumberNChoices = sizeof( m_LayerNumberChoices ) / sizeof( wxString ); int m_LayerNumberNChoices = sizeof( m_LayerNumberChoices ) / sizeof( wxString );
m_LayerNumber = new wxRadioBox( this, wxID_LAYER_NUMBER, _("Layers:"), wxDefaultPosition, wxDefaultSize, m_LayerNumberNChoices, m_LayerNumberChoices, 3, wxRA_SPECIFY_COLS ); m_LayerNumber = new wxRadioBox( this, wxID_LAYER_NUMBER, _("Layers:"), wxDefaultPosition, wxDefaultSize, m_LayerNumberNChoices, m_LayerNumberChoices, 3, wxRA_SPECIFY_COLS );
...@@ -55,7 +56,7 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi ...@@ -55,7 +56,7 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi
m_LayerNumber->SetToolTip( _("Active copper layers count selection") ); m_LayerNumber->SetToolTip( _("Active copper layers count selection") );
bMiddleLeftSizer->Add( m_LayerNumber, 0, wxALL|wxEXPAND, 5 ); bMiddleLeftSizer->Add( m_LayerNumber, 0, wxALL|wxEXPAND, 5 );
*/
m_staticTextmaxlinks = new wxStaticText( this, wxID_ANY, _("Max Links:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextmaxlinks = new wxStaticText( this, wxID_ANY, _("Max Links:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextmaxlinks->Wrap( -1 ); m_staticTextmaxlinks->Wrap( -1 );
bMiddleLeftSizer->Add( m_staticTextmaxlinks, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bMiddleLeftSizer->Add( m_staticTextmaxlinks, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
......
...@@ -39,7 +39,7 @@ class DialogGeneralOptionsBoardEditor_base : public wxDialog ...@@ -39,7 +39,7 @@ class DialogGeneralOptionsBoardEditor_base : public wxDialog
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,
...@@ -53,7 +53,7 @@ class DialogGeneralOptionsBoardEditor_base : public wxDialog ...@@ -53,7 +53,7 @@ class DialogGeneralOptionsBoardEditor_base : public wxDialog
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;
......
...@@ -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: //
......
...@@ -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 */
...@@ -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