From 25973e56087bf6ed837031c14c7b4db8c179e154 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Sun, 18 Oct 2009 23:22:26 +0000 Subject: [PATCH] Isaac's next layer selection and configuration work step --- include/pcbstruct.h | 177 ++++++++-- pcbnew/CMakeLists.txt | 5 +- pcbnew/class_board.cpp | 88 +++-- pcbnew/class_board.h | 57 +++- pcbnew/classpcb.cpp | 83 ++--- pcbnew/dialog_general_options.cpp | 6 +- ...ialog_general_options_BoardEditor_base.cpp | 313 +++++++++--------- .../dialog_general_options_BoardEditor_base.h | 98 +++--- pcbnew/ioascii.cpp | 32 +- pcbnew/menubarpcb.cpp | 16 +- pcbnew/pcbcfg.cpp | 10 +- pcbnew/pcbframe.cpp | 3 +- pcbnew/pcbnew_id.h | 3 +- pcbnew/protos.h | 6 + pcbnew/tool_pcb.cpp | 9 +- 15 files changed, 562 insertions(+), 344 deletions(-) diff --git a/include/pcbstruct.h b/include/pcbstruct.h index 6a9f160f6d..6056eb218f 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -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 @@ -176,25 +207,17 @@ public: int m_MaskMargin; // Solder mask margin int m_LayerThickness; // Layer Thickness for 3D viewer +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: -//@@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 - 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 @@ -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 IsElementVisible - * @param ElementNumber The number of the element to be tested. - * @return bool - true if the elememt is visible. + * 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 */ - inline bool IsElementVisible( int ElementNumber ) const + 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 { - if( ElementNumber < 0 || ElementNumber > PAD_CMP_VISIBLE ) - return false; - return (bool)( m_VisibleElements & 1 << ElementNumber ); + return m_VisibleElements; } - void SetElementVisibility( int ElementNumber, 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 + * 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 aCategoryIndex ) const + { + if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE ) + return false; + 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 ); + } + + /** + * 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; + } }; diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 0e7a8e1eda..662630c137 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -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 @@ -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 diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index d8b3a717dd..135ee28e76 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -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() @@ -144,30 +146,30 @@ 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; + + // no quote chars in the name allowed + if( aLayerName.Find( wxChar( '"' ) ) != wxNOT_FOUND ) + return false; + + wxString NameTemp = aLayerName; + + // replace any spaces with underscores before we do any comparing + NameTemp.Replace( wxT( " " ), wxT( "_" ) ); + + if( m_BoardSettings->IsLayerEnabled( aLayerIndex )) { - if( aLayerName == wxEmptyString || aLayerName.Len() > 20 ) - return false; - - // no quote chars in the name allowed - if( aLayerName.Find( wxChar( '"' ) ) != wxNOT_FOUND ) - return false; - - // ensure unique-ness of layer names - for( int layer = 0; layerIsLayerEnabled( 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; } @@ -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; } @@ -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; @@ -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() { diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 4f442fd7ef..2307ff70c2 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -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. @@ -555,10 +604,10 @@ public: * @param bMessageBoxInt == true, shows message when clipping occurs. * @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) - * @return: - * -1 if arcs intersect other sides, so polygon can't be clipped - * 0 if no intersecting sides - * 1 if intersecting sides + * @return : + * -1 if arcs intersect other sides, so polygon can't be clipped + * 0 if no intersecting sides + * 1 if intersecting sides * Also sets areas->utility1 flags if areas are modified */ int ClipAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, diff --git a/pcbnew/classpcb.cpp b/pcbnew/classpcb.cpp index d0b6e9ca09..c6b00fa9b9 100644 --- a/pcbnew/classpcb.cpp +++ b/pcbnew/classpcb.cpp @@ -1,6 +1,6 @@ /**********************************************************************/ /* 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" @@ -198,31 +198,31 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() LIGHTGRAY }; - m_CopperLayerCount = 2; // Default design is a double sided 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_CurrentViaSize = 450; // Current via size - m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA) - m_CurrentTrackWidth = 170; // current track width + m_CopperLayerCount = 2; // Default design is a double sided 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_CurrentViaSize = 450; // Current via size + m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA) + 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_MicroViaDrill = 50; // micro via drill (for the entire board) - m_CurrentMicroViaSize = 150; // Current micro via size - m_MicroViasAllowed = false; // true to allow micro vias - m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer) - m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only) - m_PcbTextWidth = 100; // current Pcb (not module) Text width - m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size - m_TrackClearance = 100; // track to track and track to pads clearance - m_TrackMinWidth = 80; // track min value for width ((min copper size value - m_ViasMinSize = 350; // vias (not micro vias) min diameter - m_MicroViasMinSize = 200; // micro vias (not vias) min diameter - m_MaskMargin = 150; // Solder mask margin + m_MicroViaDrill = 50; // micro via drill (for the entire board) + m_CurrentMicroViaSize = 150; // Current micro via size + m_MicroViasAllowed = false; // true to allow micro vias + m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer) + m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only) + m_PcbTextWidth = 100; // current Pcb (not module) Text width + m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size + m_TrackClearance = 100; // track to track and track to pads clearance + m_TrackMinWidth = 80; // track min value for width ((min copper size value + m_ViasMinSize = 350; // vias (not micro vias) min diameter + m_MicroViasMinSize = 200; // micro vias (not vias) min diameter + m_MaskMargin = 150; // Solder mask margin /* Color options for screen display of the Printed Board: */ //@@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. @@ -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 +void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState ) { - if( ElementNumber < 0 || ElementNumber > PAD_CMP_VISIBLE ) - return false; - return (bool)( m_VisibleElements & 1 << ElementNumber ); -} -*/ - -void EDA_BoardDesignSettings::SetElementVisibility( int ElementNumber, bool State ) -{ - 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 ); } diff --git a/pcbnew/dialog_general_options.cpp b/pcbnew/dialog_general_options.cpp index 9569f17b9b..e5b2c63bec 100644 --- a/pcbnew/dialog_general_options.cpp +++ b/pcbnew/dialog_general_options.cpp @@ -45,6 +45,7 @@ void Dialog_GeneralOptions::init() wxString timevalue; timevalue << g_TimeOut / 60; m_SaveTime->SetValue( timevalue ); +/* int layer_count[] = {1,2,4,6,8,10,12,14,16}; m_LayerNumber->SetSelection(1); for ( unsigned ii = 0; ii < sizeof(layer_count); ii++ ) @@ -54,7 +55,7 @@ void Dialog_GeneralOptions::init() m_LayerNumber->SetSelection(ii); break; } - +*/ m_MaxShowLinks->SetValue( g_MaxLinksShowed ); m_DrcOn->SetValue( Drc_On ); @@ -103,10 +104,11 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) g_TimeOut = 60 * m_SaveTime->GetValue(); /* Mise a jour de la combobox d'affichage de la couche active */ +/* int layer_count[] = {1,2,4,6,8,10,12,14,16}; g_DesignSettings.m_CopperLayerCount = layer_count[m_LayerNumber->GetSelection()]; m_Parent->ReCreateLayerBox( NULL ); - +*/ g_MaxLinksShowed = m_MaxShowLinks->GetValue(); Drc_On = m_DrcOn->GetValue(); if( g_Show_Ratsnest != m_ShowGlobalRatsnest->GetValue() ) diff --git a/pcbnew/dialog_general_options_BoardEditor_base.cpp b/pcbnew/dialog_general_options_BoardEditor_base.cpp index 1b0fc72f1a..68d3388a5f 100644 --- a/pcbnew/dialog_general_options_BoardEditor_base.cpp +++ b/pcbnew/dialog_general_options_BoardEditor_base.cpp @@ -11,164 +11,165 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bMainSizer; - bMainSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bLeftSizer; - bLeftSizer = new wxBoxSizer( wxVERTICAL ); - - wxString m_PolarDisplayChoices[] = { _("No Display"), _("Display") }; - int m_PolarDisplayNChoices = sizeof( m_PolarDisplayChoices ) / sizeof( wxString ); - m_PolarDisplay = new wxRadioBox( this, wxID_POLAR_CTRL, _("Display Polar Coord"), wxDefaultPosition, wxDefaultSize, m_PolarDisplayNChoices, m_PolarDisplayChoices, 1, wxRA_SPECIFY_COLS ); - m_PolarDisplay->SetSelection( 1 ); - m_PolarDisplay->SetToolTip( _("Activates the display of relative coordinates from relative origin (set by the space key)\nto the cursor, in polar coordinates (angle and distance)") ); - - bLeftSizer->Add( m_PolarDisplay, 0, wxALL|wxEXPAND, 5 ); - - wxString m_UnitsSelectionChoices[] = { _("Inches"), _("Millimeters") }; - int m_UnitsSelectionNChoices = sizeof( m_UnitsSelectionChoices ) / sizeof( wxString ); - m_UnitsSelection = new wxRadioBox( this, wxID_UNITS, _("Units"), wxDefaultPosition, wxDefaultSize, m_UnitsSelectionNChoices, m_UnitsSelectionChoices, 1, wxRA_SPECIFY_COLS ); - m_UnitsSelection->SetSelection( 1 ); - m_UnitsSelection->SetToolTip( _("Selection of units used to display dimensions and positions of items") ); - - bLeftSizer->Add( m_UnitsSelection, 0, wxALL|wxEXPAND, 5 ); - - wxString m_CursorShapeChoices[] = { _("Small cross"), _("Full screen cursor") }; - int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString ); - m_CursorShape = new wxRadioBox( this, wxID_CURSOR_SHAPE, _("Cursor"), wxDefaultPosition, wxDefaultSize, m_CursorShapeNChoices, m_CursorShapeChoices, 1, wxRA_SPECIFY_COLS ); - m_CursorShape->SetSelection( 0 ); - m_CursorShape->SetToolTip( _("Main cursor shape selection (small cross or large cursor)") ); - - bLeftSizer->Add( m_CursorShape, 0, wxALL|wxEXPAND, 5 ); - - bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 ); - - wxBoxSizer* bMiddleLeftSizer; - bMiddleLeftSizer = new wxBoxSizer( wxVERTICAL ); - - wxString m_LayerNumberChoices[] = { _("1"), _("2"), _("4"), _("6"), _("8"), _("10"), _("12"), _("14"), _("16") }; - 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->SetSelection( 1 ); - m_LayerNumber->SetToolTip( _("Active copper layers count selection") ); - - bMiddleLeftSizer->Add( m_LayerNumber, 0, wxALL|wxEXPAND, 5 ); - - m_staticTextmaxlinks = new wxStaticText( this, wxID_ANY, _("Max Links:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextmaxlinks->Wrap( -1 ); - bMiddleLeftSizer->Add( m_staticTextmaxlinks, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_MaxShowLinks = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 5, 1 ); - m_MaxShowLinks->SetToolTip( _("Adjust the number of ratsnets shown from cursor to closest pads") ); - - bMiddleLeftSizer->Add( m_MaxShowLinks, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - m_staticTextautosave = new wxStaticText( this, wxID_ANY, _("Auto Save (minuts):"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextautosave->Wrap( -1 ); - bMiddleLeftSizer->Add( m_staticTextautosave, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - m_SaveTime = new wxSpinCtrl( this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 60, 0 ); - m_SaveTime->SetToolTip( _("Delay after the first change to create a backup file of the board on disk.") ); - - bMiddleLeftSizer->Add( m_SaveTime, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - bMainSizer->Add( bMiddleLeftSizer, 1, wxEXPAND, 5 ); - - wxStaticBoxSizer* bMiddleRightBoxSizer; - bMiddleRightBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL ); - - m_DrcOn = new wxCheckBox( this, wxID_DRC_ONOFF, _("Drc ON"), wxDefaultPosition, wxDefaultSize, 0 ); - m_DrcOn->SetValue(true); - - m_DrcOn->SetToolTip( _("Enable/disable the DRC control.\nWhen DRC is disable, all connections are allowed.") ); - - bMiddleRightBoxSizer->Add( m_DrcOn, 0, wxALL|wxEXPAND, 5 ); - - m_ShowGlobalRatsnest = new wxCheckBox( this, wxID_GENERAL_RATSNEST, _("Show Ratsnest"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_ShowGlobalRatsnest->SetToolTip( _("Show (or not) the full rastnest.") ); - - bMiddleRightBoxSizer->Add( m_ShowGlobalRatsnest, 0, wxALL, 5 ); - - m_ShowModuleRatsnest = new wxCheckBox( this, wxID_RATSNEST_MODULE, _("Show Mod Ratsnest"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_ShowModuleRatsnest->SetToolTip( _("Shows (or not) the local ratsnest relative to a footprint, when moving it.\nThis ratsnest is useful to place a footprint.") ); - - bMiddleRightBoxSizer->Add( m_ShowModuleRatsnest, 0, wxALL, 5 ); - - m_TrackAutodel = new wxCheckBox( this, wxID_TRACK_AUTODEL, _("Tracks Auto Del"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_TrackAutodel->SetToolTip( _("Enable/disable the automatic track deletion when recreating a track.") ); - - bMiddleRightBoxSizer->Add( m_TrackAutodel, 0, wxALL, 5 ); - - m_Track_45_Only_Ctrl = new wxCheckBox( this, wxID_TRACKS45, _("Track only 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_Track_45_Only_Ctrl->SetToolTip( _("If enabled, force tracks directions to H, V or 45 degrees, when creating a track.") ); - - bMiddleRightBoxSizer->Add( m_Track_45_Only_Ctrl, 0, wxALL, 5 ); - - m_Segments_45_Only_Ctrl = new wxCheckBox( this, wxID_SEGMENTS45, _("Segments 45 Only"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_Segments_45_Only_Ctrl->SetToolTip( _("If enabled, force segments directions to H, V or 45 degrees, when creating a segment on technical layers.") ); - - bMiddleRightBoxSizer->Add( m_Segments_45_Only_Ctrl, 0, wxALL, 5 ); - - m_AutoPANOpt = new wxCheckBox( this, wxID_AUTOPAN, _("Auto PAN"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_AutoPANOpt->SetToolTip( _("Allows auto pan when creating a track, or moving an item.") ); - - bMiddleRightBoxSizer->Add( m_AutoPANOpt, 0, wxALL, 5 ); - - m_Track_DoubleSegm_Ctrl = new wxCheckBox( this, wxID_ANY, _("Double Segm Track"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_Track_DoubleSegm_Ctrl->SetToolTip( _("If enabled, uses two track segments, with 45 degrees angle between them when creating a new track ") ); - - bMiddleRightBoxSizer->Add( m_Track_DoubleSegm_Ctrl, 0, wxALL, 5 ); - - bMainSizer->Add( bMiddleRightBoxSizer, 1, 0, 5 ); - - wxBoxSizer* bRightSizer; - bRightSizer = new wxBoxSizer( wxVERTICAL ); - - wxString m_MagneticPadOptCtrlChoices[] = { _("Never"), _("When creating tracks"), _("Always") }; - int m_MagneticPadOptCtrlNChoices = sizeof( m_MagneticPadOptCtrlChoices ) / sizeof( wxString ); - m_MagneticPadOptCtrl = new wxRadioBox( this, wxID_ANY, _("Magnetic Pads"), wxDefaultPosition, wxDefaultSize, m_MagneticPadOptCtrlNChoices, m_MagneticPadOptCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_MagneticPadOptCtrl->SetSelection( 0 ); - m_MagneticPadOptCtrl->SetToolTip( _("control the capture of the pcb cursor when the mouse cursor enters a pad area") ); - - bRightSizer->Add( m_MagneticPadOptCtrl, 0, wxALL|wxEXPAND, 5 ); - - wxString m_MagneticTrackOptCtrlChoices[] = { _("Never"), _("When creating tracks"), _("Always") }; - int m_MagneticTrackOptCtrlNChoices = sizeof( m_MagneticTrackOptCtrlChoices ) / sizeof( wxString ); - m_MagneticTrackOptCtrl = new wxRadioBox( this, wxID_MAGNETIC_TRACKS, _("Magnetic Tracks"), wxDefaultPosition, wxDefaultSize, m_MagneticTrackOptCtrlNChoices, m_MagneticTrackOptCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_MagneticTrackOptCtrl->SetSelection( 0 ); - m_MagneticTrackOptCtrl->SetToolTip( _("Control the capture of the pcb cursor when the mouse cursor enters a track") ); - - bRightSizer->Add( m_MagneticTrackOptCtrl, 0, wxALL|wxEXPAND, 5 ); - - m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonOK->SetDefault(); - bRightSizer->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_buttonCANCEL, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - - bMainSizer->Add( bRightSizer, 1, wxEXPAND, 5 ); - - this->SetSizer( bMainSizer ); - this->Layout(); - - // Connect Events - m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnOkClick ), NULL, this ); - m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnCancelClick ), NULL, this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bLeftSizer; + bLeftSizer = new wxBoxSizer( wxVERTICAL ); + + wxString m_PolarDisplayChoices[] = { _("No Display"), _("Display") }; + int m_PolarDisplayNChoices = sizeof( m_PolarDisplayChoices ) / sizeof( wxString ); + m_PolarDisplay = new wxRadioBox( this, wxID_POLAR_CTRL, _("Display Polar Coord"), wxDefaultPosition, wxDefaultSize, m_PolarDisplayNChoices, m_PolarDisplayChoices, 1, wxRA_SPECIFY_COLS ); + m_PolarDisplay->SetSelection( 1 ); + m_PolarDisplay->SetToolTip( _("Activates the display of relative coordinates from relative origin (set by the space key)\nto the cursor, in polar coordinates (angle and distance)") ); + + bLeftSizer->Add( m_PolarDisplay, 0, wxALL|wxEXPAND, 5 ); + + wxString m_UnitsSelectionChoices[] = { _("Inches"), _("Millimeters") }; + int m_UnitsSelectionNChoices = sizeof( m_UnitsSelectionChoices ) / sizeof( wxString ); + m_UnitsSelection = new wxRadioBox( this, wxID_UNITS, _("Units"), wxDefaultPosition, wxDefaultSize, m_UnitsSelectionNChoices, m_UnitsSelectionChoices, 1, wxRA_SPECIFY_COLS ); + m_UnitsSelection->SetSelection( 1 ); + m_UnitsSelection->SetToolTip( _("Selection of units used to display dimensions and positions of items") ); + + bLeftSizer->Add( m_UnitsSelection, 0, wxALL|wxEXPAND, 5 ); + + wxString m_CursorShapeChoices[] = { _("Small cross"), _("Full screen cursor") }; + int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString ); + m_CursorShape = new wxRadioBox( this, wxID_CURSOR_SHAPE, _("Cursor"), wxDefaultPosition, wxDefaultSize, m_CursorShapeNChoices, m_CursorShapeChoices, 1, wxRA_SPECIFY_COLS ); + m_CursorShape->SetSelection( 0 ); + m_CursorShape->SetToolTip( _("Main cursor shape selection (small cross or large cursor)") ); + + bLeftSizer->Add( m_CursorShape, 0, wxALL|wxEXPAND, 5 ); + + bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 ); + + wxBoxSizer* bMiddleLeftSizer; + bMiddleLeftSizer = new wxBoxSizer( wxVERTICAL ); + +/* + wxString m_LayerNumberChoices[] = { _("1"), _("2"), _("4"), _("6"), _("8"), _("10"), _("12"), _("14"), _("16") }; + 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->SetSelection( 1 ); + m_LayerNumber->SetToolTip( _("Active copper layers count selection") ); + + bMiddleLeftSizer->Add( m_LayerNumber, 0, wxALL|wxEXPAND, 5 ); +*/ + m_staticTextmaxlinks = new wxStaticText( this, wxID_ANY, _("Max Links:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextmaxlinks->Wrap( -1 ); + bMiddleLeftSizer->Add( m_staticTextmaxlinks, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_MaxShowLinks = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 5, 1 ); + m_MaxShowLinks->SetToolTip( _("Adjust the number of ratsnets shown from cursor to closest pads") ); + + bMiddleLeftSizer->Add( m_MaxShowLinks, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + m_staticTextautosave = new wxStaticText( this, wxID_ANY, _("Auto Save (minuts):"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextautosave->Wrap( -1 ); + bMiddleLeftSizer->Add( m_staticTextautosave, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + m_SaveTime = new wxSpinCtrl( this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 60, 0 ); + m_SaveTime->SetToolTip( _("Delay after the first change to create a backup file of the board on disk.") ); + + bMiddleLeftSizer->Add( m_SaveTime, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + bMainSizer->Add( bMiddleLeftSizer, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* bMiddleRightBoxSizer; + bMiddleRightBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL ); + + m_DrcOn = new wxCheckBox( this, wxID_DRC_ONOFF, _("Drc ON"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DrcOn->SetValue(true); + + m_DrcOn->SetToolTip( _("Enable/disable the DRC control.\nWhen DRC is disable, all connections are allowed.") ); + + bMiddleRightBoxSizer->Add( m_DrcOn, 0, wxALL|wxEXPAND, 5 ); + + m_ShowGlobalRatsnest = new wxCheckBox( this, wxID_GENERAL_RATSNEST, _("Show Ratsnest"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_ShowGlobalRatsnest->SetToolTip( _("Show (or not) the full rastnest.") ); + + bMiddleRightBoxSizer->Add( m_ShowGlobalRatsnest, 0, wxALL, 5 ); + + m_ShowModuleRatsnest = new wxCheckBox( this, wxID_RATSNEST_MODULE, _("Show Mod Ratsnest"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_ShowModuleRatsnest->SetToolTip( _("Shows (or not) the local ratsnest relative to a footprint, when moving it.\nThis ratsnest is useful to place a footprint.") ); + + bMiddleRightBoxSizer->Add( m_ShowModuleRatsnest, 0, wxALL, 5 ); + + m_TrackAutodel = new wxCheckBox( this, wxID_TRACK_AUTODEL, _("Tracks Auto Del"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_TrackAutodel->SetToolTip( _("Enable/disable the automatic track deletion when recreating a track.") ); + + bMiddleRightBoxSizer->Add( m_TrackAutodel, 0, wxALL, 5 ); + + m_Track_45_Only_Ctrl = new wxCheckBox( this, wxID_TRACKS45, _("Track only 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_Track_45_Only_Ctrl->SetToolTip( _("If enabled, force tracks directions to H, V or 45 degrees, when creating a track.") ); + + bMiddleRightBoxSizer->Add( m_Track_45_Only_Ctrl, 0, wxALL, 5 ); + + m_Segments_45_Only_Ctrl = new wxCheckBox( this, wxID_SEGMENTS45, _("Segments 45 Only"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_Segments_45_Only_Ctrl->SetToolTip( _("If enabled, force segments directions to H, V or 45 degrees, when creating a segment on technical layers.") ); + + bMiddleRightBoxSizer->Add( m_Segments_45_Only_Ctrl, 0, wxALL, 5 ); + + m_AutoPANOpt = new wxCheckBox( this, wxID_AUTOPAN, _("Auto PAN"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_AutoPANOpt->SetToolTip( _("Allows auto pan when creating a track, or moving an item.") ); + + bMiddleRightBoxSizer->Add( m_AutoPANOpt, 0, wxALL, 5 ); + + m_Track_DoubleSegm_Ctrl = new wxCheckBox( this, wxID_ANY, _("Double Segm Track"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_Track_DoubleSegm_Ctrl->SetToolTip( _("If enabled, uses two track segments, with 45 degrees angle between them when creating a new track ") ); + + bMiddleRightBoxSizer->Add( m_Track_DoubleSegm_Ctrl, 0, wxALL, 5 ); + + bMainSizer->Add( bMiddleRightBoxSizer, 1, 0, 5 ); + + wxBoxSizer* bRightSizer; + bRightSizer = new wxBoxSizer( wxVERTICAL ); + + wxString m_MagneticPadOptCtrlChoices[] = { _("Never"), _("When creating tracks"), _("Always") }; + int m_MagneticPadOptCtrlNChoices = sizeof( m_MagneticPadOptCtrlChoices ) / sizeof( wxString ); + m_MagneticPadOptCtrl = new wxRadioBox( this, wxID_ANY, _("Magnetic Pads"), wxDefaultPosition, wxDefaultSize, m_MagneticPadOptCtrlNChoices, m_MagneticPadOptCtrlChoices, 1, wxRA_SPECIFY_COLS ); + m_MagneticPadOptCtrl->SetSelection( 0 ); + m_MagneticPadOptCtrl->SetToolTip( _("control the capture of the pcb cursor when the mouse cursor enters a pad area") ); + + bRightSizer->Add( m_MagneticPadOptCtrl, 0, wxALL|wxEXPAND, 5 ); + + wxString m_MagneticTrackOptCtrlChoices[] = { _("Never"), _("When creating tracks"), _("Always") }; + int m_MagneticTrackOptCtrlNChoices = sizeof( m_MagneticTrackOptCtrlChoices ) / sizeof( wxString ); + m_MagneticTrackOptCtrl = new wxRadioBox( this, wxID_MAGNETIC_TRACKS, _("Magnetic Tracks"), wxDefaultPosition, wxDefaultSize, m_MagneticTrackOptCtrlNChoices, m_MagneticTrackOptCtrlChoices, 1, wxRA_SPECIFY_COLS ); + m_MagneticTrackOptCtrl->SetSelection( 0 ); + m_MagneticTrackOptCtrl->SetToolTip( _("Control the capture of the pcb cursor when the mouse cursor enters a track") ); + + bRightSizer->Add( m_MagneticTrackOptCtrl, 0, wxALL|wxEXPAND, 5 ); + + m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonOK->SetDefault(); + bRightSizer->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + bRightSizer->Add( m_buttonCANCEL, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + bMainSizer->Add( bRightSizer, 1, wxEXPAND, 5 ); + + this->SetSizer( bMainSizer ); + this->Layout(); + + // Connect Events + m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnOkClick ), NULL, this ); + m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnCancelClick ), NULL, this ); } DialogGeneralOptionsBoardEditor_base::~DialogGeneralOptionsBoardEditor_base() { - // Disconnect Events - m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnOkClick ), NULL, this ); - m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnCancelClick ), NULL, this ); + // Disconnect Events + m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnOkClick ), NULL, this ); + m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnCancelClick ), NULL, this ); } diff --git a/pcbnew/dialog_general_options_BoardEditor_base.h b/pcbnew/dialog_general_options_BoardEditor_base.h index d0e05afcf3..acfd5a2a0a 100644 --- a/pcbnew/dialog_general_options_BoardEditor_base.h +++ b/pcbnew/dialog_general_options_BoardEditor_base.h @@ -31,55 +31,55 @@ /////////////////////////////////////////////////////////////////////////////// class DialogGeneralOptionsBoardEditor_base : public wxDialog { - private: - - protected: - enum - { - wxID_POLAR_CTRL = 1000, - wxID_UNITS, - wxID_CURSOR_SHAPE, - wxID_LAYER_NUMBER, - wxID_DRC_ONOFF, - wxID_GENERAL_RATSNEST, - wxID_RATSNEST_MODULE, - wxID_TRACK_AUTODEL, - wxID_TRACKS45, - wxID_SEGMENTS45, - wxID_AUTOPAN, - wxID_MAGNETIC_TRACKS, - }; - - wxRadioBox* m_PolarDisplay; - wxRadioBox* m_UnitsSelection; - wxRadioBox* m_CursorShape; - wxRadioBox* m_LayerNumber; - wxStaticText* m_staticTextmaxlinks; - wxSpinCtrl* m_MaxShowLinks; - wxStaticText* m_staticTextautosave; - wxSpinCtrl* m_SaveTime; - wxCheckBox* m_DrcOn; - wxCheckBox* m_ShowGlobalRatsnest; - wxCheckBox* m_ShowModuleRatsnest; - wxCheckBox* m_TrackAutodel; - wxCheckBox* m_Track_45_Only_Ctrl; - wxCheckBox* m_Segments_45_Only_Ctrl; - wxCheckBox* m_AutoPANOpt; - wxCheckBox* m_Track_DoubleSegm_Ctrl; - wxRadioBox* m_MagneticPadOptCtrl; - wxRadioBox* m_MagneticTrackOptCtrl; - wxButton* m_buttonOK; - wxButton* m_buttonCANCEL; - - // Virtual event handlers, overide them in your derived class - virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } - - - 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(); - + private: + + protected: + enum + { + wxID_POLAR_CTRL = 1000, + wxID_UNITS, + wxID_CURSOR_SHAPE, +// wxID_LAYER_NUMBER, + wxID_DRC_ONOFF, + wxID_GENERAL_RATSNEST, + wxID_RATSNEST_MODULE, + wxID_TRACK_AUTODEL, + wxID_TRACKS45, + wxID_SEGMENTS45, + wxID_AUTOPAN, + wxID_MAGNETIC_TRACKS, + }; + + wxRadioBox* m_PolarDisplay; + wxRadioBox* m_UnitsSelection; + wxRadioBox* m_CursorShape; + //wxRadioBox* m_LayerNumber; + wxStaticText* m_staticTextmaxlinks; + wxSpinCtrl* m_MaxShowLinks; + wxStaticText* m_staticTextautosave; + wxSpinCtrl* m_SaveTime; + wxCheckBox* m_DrcOn; + wxCheckBox* m_ShowGlobalRatsnest; + wxCheckBox* m_ShowModuleRatsnest; + wxCheckBox* m_TrackAutodel; + wxCheckBox* m_Track_45_Only_Ctrl; + wxCheckBox* m_Segments_45_Only_Ctrl; + wxCheckBox* m_AutoPANOpt; + wxCheckBox* m_Track_DoubleSegm_Ctrl; + wxRadioBox* m_MagneticPadOptCtrl; + wxRadioBox* m_MagneticTrackOptCtrl; + wxButton* m_buttonOK; + wxButton* m_buttonCANCEL; + + // Virtual event handlers, overide them in your derived class + virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } + + + 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(); + }; #endif //__dialog_general_options_BoardEditor_base__ diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 088a633bf0..99ea6529c5 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -1,7 +1,7 @@ /********************************************************************/ /* Routines de lecture et sauvegarde des structures en format ASCii */ -/* Fichier common a PCBNEW et CVPCB */ +/* Fichier common a PCBNEW et CVPCB */ /********************************************************************/ /* ioascii.cpp */ @@ -32,12 +32,12 @@ $PAD Sh "name" forme dimv dimH dV dH orient :forme generale dV, dH = delta dimensions - Dr diam, dV dH :drill : diametre offsets de percage - At type S/N layers : type standard,cms,conn,hole,meca., + Dr diam, dV dH :drill : diametre offsets de percage + At type S/N layers : type standard,cms,conn,hole,meca., Stack/Normal, Hexadecimal 32 bits: occupation des couches 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 ****** Structure module *********** @@ -51,12 +51,12 @@ m_TimeCode a usage interne (groupements) Li - Cd Description du composant (Composant Doc) - Kw Liste des mots cle + Cd Description du composant (Composant Doc) + Kw 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: lsb = cout rot 90, msb = cout rot -90; @@ -70,9 +70,9 @@ edge: segment coord ox,oy a fx,fy, relatives a l'ancre et orient 0 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 - $EndPAD section pads s'il y en a + $EndPAD section pads s'il y en a $EndMODULE */ @@ -196,7 +196,7 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum ) sscanf( data, "%X", &EnabledLayers ); // Setup layer visibility - GetBoard()->m_BoardSettings->m_EnabledLayers = EnabledLayers; + GetBoard()->SetEnabledLayers( EnabledLayers ); continue; } @@ -208,7 +208,7 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum ) sscanf( data, "%X", &VisibleLayers ); // Setup layer visibility - GetBoard()->m_BoardSettings->m_VisibleLayers = VisibleLayers; + GetBoard()->SetVisibleLayers( VisibleLayers ); continue; } @@ -220,7 +220,7 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum ) sscanf( data, "%X", &VisibleElements ); // Setup elements visibility - GetBoard()->m_BoardSettings->m_VisibleElements = VisibleElements; + GetBoard()->SetVisibleElements( VisibleElements ); continue; } @@ -665,9 +665,9 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File ) // 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, "EnabledLayers %08X\n", GetBoard()->m_BoardSettings->m_EnabledLayers ); - fprintf( File, "VisibleLayers %08X\n", GetBoard()->m_BoardSettings->m_VisibleLayers ); - fprintf( File, "VisibleElements %08X\n", GetBoard()->m_BoardSettings->m_VisibleElements ); + fprintf( File, "EnabledLayers %08X\n", GetBoard()->GetEnabledLayers() ); + fprintf( File, "VisibleLayers %08X\n", GetBoard()->GetVisibleLayers() ); + fprintf( File, "VisibleElements %08X\n", GetBoard()->GetVisibleElements() ); fprintf( File, "Links %d\n", GetBoard()->GetRatsnestsCount() ); fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect ); diff --git a/pcbnew/menubarpcb.cpp b/pcbnew/menubarpcb.cpp index 08681854b9..e2be6f8e72 100644 --- a/pcbnew/menubarpcb.cpp +++ b/pcbnew/menubarpcb.cpp @@ -213,10 +213,18 @@ void WinEDA_PcbFrame::ReCreateMenuBar() item->SetBitmap( hammer_xpm ); designRulesMenu->Append( item ); +/* item = new wxMenuItem( designRulesMenu, ID_PCB_COPPER_LAYERS_SETUP, _( "Copper &Layers" ), _( "Select copper layers count and layers names" ) ); item->SetBitmap( copper_layers_setup_xpm ); 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: // @@ -274,10 +282,10 @@ void WinEDA_PcbFrame::ReCreateMenuBar() postprocess_menu->Append( item ); item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_BOM_FILE_FROM_BOARD, - _( "Create &BOM File" ), - _( "Recreate .csv file for CvPcb" ) ); - item->SetBitmap( tools_xpm ); - postprocess_menu->Append( item ); + _( "Create &BOM File" ), + _( "Recreate .csv file for CvPcb" ) ); + item->SetBitmap( tools_xpm ); + postprocess_menu->Append( item ); ////////////////////////// // Menu d'outils divers // diff --git a/pcbnew/pcbcfg.cpp b/pcbnew/pcbcfg.cpp index a75b39ba11..79d0d81134 100644 --- a/pcbnew/pcbcfg.cpp +++ b/pcbnew/pcbcfg.cpp @@ -1,5 +1,5 @@ /***********************************/ -/** pcbcfg() : configuration **/ +/** pcbcfg() : configuration **/ /***********************************/ /* lit ou met a jour la configuration de PCBNEW */ @@ -18,7 +18,7 @@ #include "pcbnew_id.h" #include "hotkeys.h" #include "protos.h" -#include "dialog_copper_layers_setup.h" +//#include "dialog_copper_layers_setup.h" /* Routines Locales */ @@ -49,12 +49,18 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event ) DisplayColorSetupFrame( this, pos ); break; +/* case ID_PCB_COPPER_LAYERS_SETUP: { DIALOG_COPPER_LAYERS_SETUP dialog( this ); dialog.ShowModal(); } break; +*/ + + case ID_PCB_LAYERS_SETUP: + DisplayDialogLayerSetup( this ); + break; case ID_CONFIG_REQ: // Creation de la fenetre de configuration InstallConfigFrame( pos ); diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 2d3e604eca..26c2354326 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -84,7 +84,8 @@ EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START, EVT_MENU( ID_COLORS_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_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config ) diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 56c7637005..af7dd72a9a 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -23,7 +23,8 @@ enum pcbnew_ids ID_PCB_MIRE_BUTT, ID_PCB_SHOW_1_RATSNEST_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_TEXT_BUTT, diff --git a/pcbnew/protos.h b/pcbnew/protos.h index 2287353464..7d53893646 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -385,4 +385,10 @@ void DisplayColorSetupFrame( WinEDA_PcbFrame* parent, const wxPoint& framepos ); +/***************************/ +/* DIALOG_LAYERS_SETUP.CPP */ +/***************************/ + +void DisplayDialogLayerSetup( WinEDA_PcbFrame* parent ); + #endif /* #define PROTO_H */ diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 709d039a2f..5dbb54a34f 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -582,7 +582,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() wxSize( LISTBOX_WIDTH + 20, -1 ), wxTE_READONLY ); m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") ); - m_AuxiliaryToolBar->AddControl( m_ClearanceBox ); + m_AuxiliaryToolBar->AddControl( m_ClearanceBox ); m_AuxiliaryToolBar->AddSeparator(); // Creates box to display the current NetClass: @@ -591,7 +591,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() wxSize( LISTBOX_WIDTH, -1 ), wxTE_READONLY ); m_NetClassSelectedBox->SetToolTip(_("Name of the current NetClass") ); - m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox ); + m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox ); m_AuxiliaryToolBar->AddSeparator(); // Creates box to display and choose strategy to handle tracks an @@ -729,11 +729,12 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) parent->AddControl( m_SelLayerBox ); } - +/* int layer_mask = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1]; layer_mask |= ALL_NO_CU_LAYERS; - +*/ + int layer_mask = g_DesignSettings.GetEnabledLayers(); unsigned length = 0; m_SelLayerBox->Clear();