diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index a04e19ceac..6b7c596c04 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -78,7 +78,7 @@ public: return false; // If a layer is disabled, it is automatically invisible - return (bool) ( m_VisibleLayers & m_EnabledLayers & 1 << aLayerIndex ); + return (bool) ( m_VisibleLayers & m_EnabledLayers & (1 << aLayerIndex) ); } @@ -111,28 +111,27 @@ public: m_VisibleElements = aMask; } - /** * Function IsElementVisible - * tests whether a given element category is visible - * @param aCategoryIndex = The index of the element category to be tested. + * tests whether a given element category is visible. Keep this as an + * inline function. + * @param aPCB_VISIBLE is from the enum by the same name * @return bool - true if the element is visible. + * @see enum PCB_VISIBLE */ - bool IsElementVisible( int aCategoryIndex ) const + bool IsElementVisible( int aPCB_VISIBLE ) const { - if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE ) - return false; - return (bool) ( m_VisibleElements & (1 << aCategoryIndex) ); + return bool( m_VisibleElements & (1 << aPCB_VISIBLE) ); } - /** * Function SetElementVisibility * changes the visibility of an element category - * @param aCategoryIndex = The index of the element category to be changed + * @param aPCB_VISIBLE is from the enum by the same name * @param aNewState = The new visibility state of the element category + * @see enum PCB_VISIBLE */ - void SetElementVisibility( int aCategoryIndex, bool aNewState ); + void SetElementVisibility( int aPCB_VISIBLE, bool aNewState ); /** * Function GetEnabledLayers @@ -144,7 +143,6 @@ public: return m_EnabledLayers; } - /** * Function SetEnabledLayers * changes the bit-mask of enabled layers @@ -152,7 +150,6 @@ public: */ void SetEnabledLayers( int aMask ); - /** * Function IsLayerEnabled * tests whether a given layer is enabled @@ -161,7 +158,7 @@ public: */ bool IsLayerEnabled( int aLayerIndex ) { - return (bool) ( m_EnabledLayers & 1 << aLayerIndex ); + return bool( m_EnabledLayers & (1 << aLayerIndex) ); } diff --git a/include/pcbstruct.h b/include/pcbstruct.h index 441d671c06..bbdd25c5e9 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -93,14 +93,14 @@ #define LAYER_14 (1 << LAYER_N_14) ///< bit mask for layer 14 #define LAYER_15 (1 << LAYER_N_15) ///< bit mask for layer 15 #define LAYER_FRONT (1 << LAYER_N_FRONT) ///< bit mask for component layer -#define ADHESIVE_LAYER_BACK (1 << ADHESIVE_N_BACK) -#define ADHESIVE_LAYER_FRONT (1 << ADHESIVE_N_FRONT) -#define SOLDERPASTE_LAYER_BACK (1 << SOLDERPASTE_N_BACK) -#define SOLDERPASTE_LAYER_FRONT (1 << SOLDERPASTE_N_FRONT) -#define SILKSCREEN_LAYER_BACK (1 << SILKSCREEN_N_BACK) -#define SILKSCREEN_LAYER_FRONT (1 << SILKSCREEN_N_FRONT) -#define SOLDERMASK_LAYER_BACK (1 << SOLDERMASK_N_BACK) -#define SOLDERMASK_LAYER_FRONT (1 << SOLDERMASK_N_FRONT) +#define ADHESIVE_LAYER_BACK (1 << ADHESIVE_N_BACK) +#define ADHESIVE_LAYER_FRONT (1 << ADHESIVE_N_FRONT) +#define SOLDERPASTE_LAYER_BACK (1 << SOLDERPASTE_N_BACK) +#define SOLDERPASTE_LAYER_FRONT (1 << SOLDERPASTE_N_FRONT) +#define SILKSCREEN_LAYER_BACK (1 << SILKSCREEN_N_BACK) +#define SILKSCREEN_LAYER_FRONT (1 << SILKSCREEN_N_FRONT) +#define SOLDERMASK_LAYER_BACK (1 << SOLDERMASK_N_BACK) +#define SOLDERMASK_LAYER_FRONT (1 << SOLDERMASK_N_FRONT) #define DRAW_LAYER (1 << DRAW_N) #define COMMENT_LAYER (1 << COMMENT_N) #define ECO1_LAYER (1 << ECO1_N) @@ -152,21 +152,37 @@ class RATSNEST_ITEM; /* Class to handle a board */ #include "class_board.h" -enum ELEMENTS_NUMBERS + +/** + * Enum PCB_VISIBLE + * is a set of visible PCB elements. + * @see BOARD::SetVisibleElementColor() + * @see BOARD::SetVisibleElement() + */ +enum PCB_VISIBLE { - VIAS_VISIBLE = 0, - VIA_NOT_DEFINED_VISIBLE = VIAS_VISIBLE, + VIAS_VISIBLE, VIA_MICROVIA_VISIBLE, - VIA_BLIND_BURIED_VISIBLE, + VIA_BBLIND_VISIBLE, VIA_THROUGH_VISIBLE, - MODULE_TEXT_CMP_VISIBLE, - MODULE_TEXT_CU_VISIBLE, - MODULE_TEXT_NOV_VISIBLE, + MOD_TEXT_FR_VISIBLE, + MOD_TEXT_BK_VISIBLE, + MOD_TEXT_INVISIBLE, ///< text marked as invisible ANCHOR_VISIBLE, - PAD_CU_VISIBLE, - PAD_CMP_VISIBLE + PAD_FR_VISIBLE, + PAD_BK_VISIBLE, + RATSNEST_VISIBLE, + GRID_VISIBLE, + + // the rest of these do not currently support color changes: + NO_CONNECTS_VISIBLE, ///< show a marker on pads with no nets + MOD_FR_VISIBLE, ///< show modules on front + MOD_BK_VISIBLE, ///< show modules on back + + END_VISIBLE // sentinel }; + /** * Function IsValidLayerIndex * tests whether a given integer is a valid layer index diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 3b92e26bfa..47ff1fdf9b 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -67,28 +67,17 @@ protected: { } - //-------- + //---------------- void OnLayerColorChange( int aLayer, int aColor ); bool OnLayerSelect( int aLayer ); void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ); void OnRenderColorChange( int aId, int aColor ); void OnRenderEnable( int aId, bool isEnabled ); - //-------------------- + //--------------- }; - /// render rows are fixed, layer rows are dynamically determined. - static LAYER_WIDGET::ROW renderRows[]; - LYRS* m_Layers; // established in constructor - /** - * Function ReFillLayerWidget - * changes out all the layers in m_Layers and may be called upon - * loading a new BOARD. - */ - void ReFillLayerWidget(); - - public: WinEDAChoiceBox* m_SelLayerBox; // a combo box to display and // select active layer @@ -177,6 +166,13 @@ public: void ReCreateMenuBar(); WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent ); + /** + * Function ReFillLayerWidget + * changes out all the layers in m_Layers and may be called upon + * loading a new BOARD. + */ + void ReFillLayerWidget(); + void Show3D_Frame( wxCommandEvent& event ); void GeneralControle( wxDC* DC, wxPoint Mouse ); diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index d1024ed8da..4553b1c760 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -277,9 +277,9 @@ GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide() ( (PCB_SCREEN*)GetScreen())->m_Active_Layer ); // account for the globals - guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE )); - guide.SetIgnoreMTextsOnCopper( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_CU_VISIBLE )); - guide.SetIgnoreMTextsOnCmp( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_CMP_VISIBLE )); + guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE )); + guide.SetIgnoreMTextsOnCopper( ! g_DesignSettings.IsElementVisible( MOD_TEXT_BK_VISIBLE )); + guide.SetIgnoreMTextsOnCmp( ! g_DesignSettings.IsElementVisible( MOD_TEXT_FR_VISIBLE )); guide.SetIgnoreModulesOnCu( !DisplayOpt.Show_Modules_Cu ); guide.SetIgnoreModulesOnCmp( !DisplayOpt.Show_Modules_Cmp ); diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index a37662d200..8b7bf7d0cb 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -396,11 +396,63 @@ int BOARD::GetVisibleElements() const return m_BoardSettings->GetVisibleElements(); } + +int BOARD::GetVisibleElementColor( int aPCB_VISIBLE ) +{ + int color = -1; + + // @todo move these globals into the board. + switch( aPCB_VISIBLE ) + { + case VIAS_VISIBLE: color = m_BoardSettings->m_ViaColor[VIA_THROUGH]; break; + case VIA_MICROVIA_VISIBLE: color = m_BoardSettings->m_ViaColor[VIA_MICROVIA]; break; + case VIA_BBLIND_VISIBLE: color = m_BoardSettings->m_ViaColor[VIA_BLIND_BURIED]; break; + case VIA_THROUGH_VISIBLE: color = g_ModuleTextCUColor; break; + case MOD_TEXT_FR_VISIBLE: color = g_ModuleTextCUColor; break; + case MOD_TEXT_BK_VISIBLE: color = g_ModuleTextCUColor; break; + case MOD_TEXT_INVISIBLE: color = g_ModuleTextNOVColor; break; + case ANCHOR_VISIBLE: color = g_AnchorColor; break; + case PAD_FR_VISIBLE: color = g_PadCMPColor; break; + case PAD_BK_VISIBLE: color = g_PadCUColor; break; + case RATSNEST_VISIBLE: color = m_BoardSettings->m_RatsnestColor; break; + case GRID_VISIBLE: color = g_GridColor; break; + default: + wxLogDebug("BOARD::GetVisibleElementColor(): bad arg %d", aPCB_VISIBLE ); + } + + return color; +} + + +void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor ) +{ + // @todo move these globals into the board. + switch( aPCB_VISIBLE ) + { + case VIAS_VISIBLE: m_BoardSettings->m_ViaColor[VIA_THROUGH] = aColor; break; + case VIA_MICROVIA_VISIBLE: m_BoardSettings->m_ViaColor[VIA_MICROVIA] = aColor; break; + case VIA_BBLIND_VISIBLE: m_BoardSettings->m_ViaColor[VIA_BLIND_BURIED] = aColor; break; + case VIA_THROUGH_VISIBLE: g_ModuleTextCUColor = aColor; break; + case MOD_TEXT_FR_VISIBLE: g_ModuleTextCUColor = aColor; break; + case MOD_TEXT_BK_VISIBLE: g_ModuleTextCUColor = aColor; break; + case MOD_TEXT_INVISIBLE: g_ModuleTextNOVColor = aColor; break; + case ANCHOR_VISIBLE: g_AnchorColor = aColor; break; + case PAD_FR_VISIBLE: g_PadCMPColor = aColor; break; + case PAD_BK_VISIBLE: g_PadCUColor = aColor; break; + case RATSNEST_VISIBLE: m_BoardSettings->m_RatsnestColor = aColor; break; + case GRID_VISIBLE: g_GridColor = aColor; break; + default: + wxLogDebug("BOARD::SetVisibleElementColor(): bad arg %d", aPCB_VISIBLE ); + } +} + + void BOARD::SetLayerColor( int aLayer, int aColor ) { m_BoardSettings->SetLayerColor( aLayer, aColor ); } + int BOARD::GetLayerColor( int aLayer ) { return m_BoardSettings->GetLayerColor( aLayer ); diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 5a079baee1..c6055f7caf 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -287,7 +287,8 @@ public: * 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. + * @return int - the visible element bitmap or-ed from enum PCB_VISIBLE + * @see enum PCB_VISIBLE */ int GetVisibleElements() const; @@ -295,10 +296,20 @@ public: * 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 + * @param aMask = The new bit-mask of visible element bitmap or-ed from enum PCB_VISIBLE + * @see enum PCB_VISIBLE */ void SetVisibleElements( int aMask ); + /** + * Function GetVisibleElementColor + * returns the color of a pcb visible element. + * @see enum PCB_VISIBLE + */ + int GetVisibleElementColor( int aPCB_VISIBLE ); + void SetVisibleElementColor( int aPCB_VISIBLE, int aColor ); + + /** * Function GetLayerName * returns the name of the layer given by aLayerIndex. @@ -345,8 +356,13 @@ public: */ void SetLayerColor( int aLayer, int aColor ); + /** + * Function GetLayerColor + * gets a layer color for any valid layer, including non-copper ones. + */ int GetLayerColor( int aLayer ); + /* Functions to get some items count */ int GetNumSegmTrack(); int GetNumSegmZone(); diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index 57205bf168..e8c2d6cd35 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -104,7 +104,7 @@ void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewStat void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState ) { - if( aElementCategory < 0 || aElementCategory > PAD_CMP_VISIBLE ) + if( aElementCategory < 0 || aElementCategory >= END_VISIBLE ) return; if( aNewState ) m_VisibleElements |= 1 << aElementCategory; diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 4a2f90dc2f..6b0c2abf85 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -378,20 +378,20 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, if( Module->GetLayer() == LAYER_N_BACK ) { - if( g_DesignSettings.IsElementVisible( MODULE_TEXT_CU_VISIBLE ) == false ) + if( g_DesignSettings.IsElementVisible( MOD_TEXT_BK_VISIBLE ) == false ) return; color = g_ModuleTextCUColor; } else if( Module->GetLayer() == LAYER_N_FRONT ) { - if( g_DesignSettings.IsElementVisible( MODULE_TEXT_CMP_VISIBLE ) == false ) + if( g_DesignSettings.IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false ) return; color = g_ModuleTextCMPColor; } if( m_NoShow ) { - if( g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) == false ) + if( g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE ) == false ) return; color = g_ModuleTextNOVColor; } diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 2b64d4ce03..e0796d1725 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -725,7 +725,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi color = g_DesignSettings.m_ViaColor[m_Shape]; - if( g_DesignSettings.IsElementVisible( VIAS_VISIBLE + m_Shape ) == false + if( g_DesignSettings.IsElementVisible( PCB_VISIBLE(VIAS_VISIBLE + m_Shape) ) == false && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG ) return; diff --git a/pcbnew/dialog_general_options.cpp b/pcbnew/dialog_general_options.cpp index 69d9dea946..68848fd4ca 100644 --- a/pcbnew/dialog_general_options.cpp +++ b/pcbnew/dialog_general_options.cpp @@ -250,7 +250,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) break; case ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE: - g_DesignSettings.SetElementVisibility( MODULE_TEXT_NOV_VISIBLE, + g_DesignSettings.SetElementVisibility( MOD_TEXT_INVISIBLE, m_OptionsToolBar->GetToolState( id ) ); DrawPanel->Refresh(); break; diff --git a/pcbnew/dialog_layers_setup.cpp b/pcbnew/dialog_layers_setup.cpp index 3db1d4e050..44c05230b6 100644 --- a/pcbnew/dialog_layers_setup.cpp +++ b/pcbnew/dialog_layers_setup.cpp @@ -547,6 +547,7 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event ) m_Parent->GetScreen()->SetModify(); m_Parent->ReCreateLayerBox( NULL ); + m_Parent->ReFillLayerWidget(); EndModal( wxID_OK ); } diff --git a/pcbnew/layer_panel_base.cpp b/pcbnew/layer_panel_base.cpp index 7654ca93ee..4a69e73d5a 100644 --- a/pcbnew/layer_panel_base.cpp +++ b/pcbnew/layer_panel_base.cpp @@ -19,7 +19,7 @@ LAYER_PANEL_BASE::LAYER_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoi wxBoxSizer* bSizer3; bSizer3 = new wxBoxSizer( wxVERTICAL ); - m_LayerScrolledWindow = new wxScrolledWindow( m_LayerPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxVSCROLL ); + m_LayerScrolledWindow = new wxScrolledWindow( m_LayerPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER ); m_LayerScrolledWindow->SetScrollRate( 5, 5 ); m_LayersFlexGridSizer = new wxFlexGridSizer( 0, 4, 1, 3 ); m_LayersFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL ); @@ -38,7 +38,7 @@ LAYER_PANEL_BASE::LAYER_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoi wxBoxSizer* bSizer4; bSizer4 = new wxBoxSizer( wxVERTICAL ); - m_RenderScrolledWindow = new wxScrolledWindow( m_RenderingPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxVSCROLL ); + m_RenderScrolledWindow = new wxScrolledWindow( m_RenderingPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER ); m_RenderScrolledWindow->SetScrollRate( 5, 5 ); m_RenderFlexGridSizer = new wxFlexGridSizer( 0, 2, 1, 3 ); m_RenderFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL ); diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 95cdce9313..c53a4a46b5 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -210,6 +210,8 @@ void LAYER_WIDGET::OnLeftDownLayers( wxMouseEvent& event ) if( OnLayerSelect( row ) ) // if client allows this change. SelectLayerRow( row ); + + passOnFocus(); } @@ -234,6 +236,8 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& event ) // tell the client code. OnLayerColorChange( layer, newColor ); } + + passOnFocus(); } @@ -250,6 +254,8 @@ void LAYER_WIDGET::OnRightDownLayers( wxMouseEvent& event ) _( "Hide All Cu" ) ) ); PopupMenu( &menu ); + + passOnFocus(); } void LAYER_WIDGET::OnPopupSelection( wxCommandEvent& event ) @@ -307,6 +313,7 @@ void LAYER_WIDGET::OnLayerCheckBox( wxCommandEvent& event ) wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject(); int layer = getDecodedId( eventSource->GetId() ); OnLayerVisible( layer, eventSource->IsChecked() ); + passOnFocus(); } @@ -331,6 +338,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event ) // tell the client code. OnRenderColorChange( id, newColor ); } + passOnFocus(); } void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event ) @@ -338,6 +346,7 @@ void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event ) wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject(); int id = getDecodedId( eventSource->GetId() ); OnRenderEnable( id, eventSource->IsChecked() ); + passOnFocus(); } @@ -437,6 +446,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) col = 1; wxCheckBox* cb = new wxCheckBox( m_RenderScrolledWindow, encodeId( col, aSpec.id ), aSpec.rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); + cb->SetValue( aSpec.state ); cb->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( LAYER_WIDGET::OnRenderCheckBox ), NULL, this ); cb->SetToolTip( aSpec.tooltip ); @@ -444,11 +454,22 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) } +void LAYER_WIDGET::passOnFocus() +{ + wxWindow* parent = GetParent(); + parent->SetFocus(); + +// printf( "passOnFocus() %p %p\n", parent, m_OriginalParent ); +} + + //------------------------------------------------------------ LAYER_WIDGET::LAYER_WIDGET( wxWindow* parent ) : LAYER_PANEL_BASE( parent ) { + m_OriginalParent = parent; + m_CurrentRow = -1; m_RightArrowBitmap = new wxBitmap( rightarrow_xpm ); @@ -601,18 +622,16 @@ void LAYER_WIDGET::SelectLayerRow( int aRow ) { newbm->SetBitmap( *m_RightArrowBitmap ); - // Change the focus to the wxBitmapButton in column 1 for this row. - // We really do not need or want the focus, but because we get focus - // and it changes the appearance of these wxBitmapButtons, if any focused - // button is going to look different, we want it to be the current - // row. - getLayerComp( newNdx + 1 /* 1 is column */ )->SetFocus(); - // Make sure the desired layer row is visible. - // It seems that as of 2.8.2, setting the focus - // does this and generally I don't expect the scrolling to be needed at all because - // the minimum window size may end up being established by the number of layers. + // It seems that as of 2.8.2, setting the focus does this. + // I don't expect the scrolling to be needed at all because + // the minimum window size may end up being established so that the + // scroll bars will not be visible. + getLayerComp( newNdx + 1 /* 1 is column */ )->SetFocus(); } + + // give the focus back to the app. + passOnFocus(); } @@ -649,6 +668,7 @@ void LAYER_WIDGET::UpdateLayouts() { m_LayersFlexGridSizer->Layout(); m_RenderFlexGridSizer->Layout(); + FitInside(); } #if defined(STAND_ALONE) diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h index 98545c76fc..911f60bc3d 100644 --- a/pcbnew/layer_widget.h +++ b/pcbnew/layer_widget.h @@ -74,6 +74,7 @@ public: protected: + wxWindow* m_OriginalParent; wxBitmap* m_BlankBitmap; wxBitmap* m_RightArrowBitmap; wxSize m_BitmapSize; @@ -139,6 +140,12 @@ protected: void insertRenderRow( int aRow, const ROW& aSpec ); + /** + * Function passOnFocus + * gives away the keyboard focus up to the main parent window. + */ + void passOnFocus(); + public: /** Constructor */ @@ -241,6 +248,22 @@ public: void UpdateLayouts(); +/* did not help: + void Freeze() + { + LAYER_PANEL_BASE::Freeze(); + m_LayerScrolledWindow->Freeze(); + m_RenderScrolledWindow->Freeze(); + } + + void Thaw() + { + m_RenderScrolledWindow->Thaw(); + m_LayerScrolledWindow->Thaw(); + LAYER_PANEL_BASE::Thaw(); + } +*/ + //------------------------------------------------ /** diff --git a/pcbnew/panel_layer_select.fbp b/pcbnew/panel_layer_select.fbp index e57a84e418..c2a623a39e 100644 --- a/pcbnew/panel_layer_select.fbp +++ b/pcbnew/panel_layer_select.fbp @@ -190,7 +190,7 @@ - wxNO_BORDER|wxVSCROLL + wxNO_BORDER @@ -307,7 +307,7 @@ - wxNO_BORDER|wxVSCROLL + wxNO_BORDER diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index c19088ec94..7a5f6f3030 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -9,6 +9,7 @@ #include "confirm.h" #include "pcbnew.h" #include "wxPcbStruct.h" +#include "pcbstruct.h" // enum PCB_VISIBLE #include "collectors.h" #include "bitmaps.h" #include "protos.h" @@ -210,24 +211,6 @@ END_EVENT_TABLE() ///////****************************///////////: -// the fixed "Rendering" tab rows within the LAYER_WIDGET: -LAYER_WIDGET::ROW WinEDA_PcbFrame::renderRows[] = { - // text id color tooltip checked - LAYER_WIDGET::ROW( _( "Through Via"), 0, LIGHTBLUE, _("Show through vias") ), - LAYER_WIDGET::ROW( _( "Blind/Buried Via"), 1, YELLOW, _("Show blind or buried vias") ), - LAYER_WIDGET::ROW( _( "Micro Via" ), 2, BROWN, _("Show micro vias") ), - LAYER_WIDGET::ROW( _( "Ratsnets" ), 3, BLUE, _("Show the ratsnest") ), - LAYER_WIDGET::ROW( _( "Mod Text Back" ), 4, WHITE, _("Show footprint text residing on board's back") ), - LAYER_WIDGET::ROW( _( "Mod Text Front" ), 5, WHITE, _("Show footprint text residing on board's front") ), - LAYER_WIDGET::ROW( _( "Mod Text Hide" ), 6, WHITE, _("TBD") ), - LAYER_WIDGET::ROW( _( "Anchors" ), 7, WHITE, _("TBD") ), -// LAYER_WIDGET::ROW( _( "Grid" ), 8, WHITE, _("Show grid") ), - LAYER_WIDGET::ROW( _( "Not Connecteds" ), 9, -1, _("TBD") ), - LAYER_WIDGET::ROW( _( "Modules Front" ), 10, -1, _("TBD") ), - LAYER_WIDGET::ROW( _( "Modules Back" ), 11, -1, _("TBD") ), -}; - - WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, const wxString& title, const wxPoint& pos, const wxSize& size, @@ -246,9 +229,9 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, m_show_layer_manager_tools = true; m_Layers = new LYRS( this ); - m_Layers->AppendRenderRows( renderRows, DIM(renderRows) ); SetBoard( new BOARD( NULL, this ) ); + m_TrackAndViasSizesList_Changed = true; m_drc = new DRC( this ); // these 2 objects point to each other @@ -282,6 +265,47 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ReCreateAuxVToolbar(); + // Fixed "Rendering" tab rows within the LAYER_WIDGET, only the initial color + // is changed before appending to the LAYER_WIDGET. This is an automatic variable + // not a static variable, change the color & state after copying from code to renderRows + // on the stack. + LAYER_WIDGET::ROW renderRows[14] = { + +#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width + + // text id color tooltip checked + RR( _( "Through Via" ), VIAS_VISIBLE, WHITE, _( "Show through vias" ) ), + RR( _( "Bl/Buried Via" ), VIA_MICROVIA_VISIBLE, WHITE, _( "Show blind or buried vias" ) ), + RR( _( "Micro Via" ), VIA_BBLIND_VISIBLE, WHITE, _( "Show micro vias") ), + RR( _( "Ratsnest" ), RATSNEST_VISIBLE, WHITE, _( "Show unconnected nets as a ratsnest") ), + + RR( _( "Pads Front" ), PAD_FR_VISIBLE, WHITE, _( "Show footprint pads on board's front" ) ), + RR( _( "Pads Back" ), PAD_BK_VISIBLE, WHITE, _( "Show footprint pads on board's back" ) ), + + RR( _( "Text Front" ), MOD_TEXT_FR_VISIBLE, WHITE, _( "Show footprint text on board's back" ) ), + RR( _( "Text Back" ), MOD_TEXT_BK_VISIBLE, WHITE, _( "Show footprint text on board's back" ) ), + RR( _( "Hidden Text" ), MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ), + + RR( _( "Anchors" ), ANCHOR_VISIBLE, WHITE, _( "Show footprint and text origins as a cross" ) ), + RR( _( "Grid" ), GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ), + RR( _( "No-Connects" ), NO_CONNECTS_VISIBLE, -1, _( "Show a marker on pads which have no net connected" ) ), + RR( _( "Modules Front" ), MOD_FR_VISIBLE, -1, _( "Show footprints that are on board's front") ), + RR( _( "Modules Back" ), MOD_BK_VISIBLE, -1, _( "Show footprints that are on board's back") ), + }; + + for( unsigned row=0; rowGetVisibleElementColor( renderRows[row].id ); + } + // @todo + // renderRows[row].state = GetBoard()->IsElementVisible( renderRows[row].id ); + } + + m_Layers->AppendRenderRows( renderRows, DIM(renderRows) ); + #if defined(KICAD_AUIMANAGER) m_auimgr.SetManagedWindow( this ); @@ -395,19 +419,64 @@ void WinEDA_PcbFrame::LYRS::OnLayerVisible( int aLayer, bool isVisible, bool isF void WinEDA_PcbFrame::LYRS::OnRenderColorChange( int aId, int aColor ) { - // @todo - //myframe->GetBoard()->SetLayerColor( aId, aColor ); - //myframe->DrawPanel->Refresh(); + myframe->GetBoard()->SetVisibleElementColor( aId, aColor ); + myframe->DrawPanel->Refresh(); } void WinEDA_PcbFrame::LYRS::OnRenderEnable( int aId, bool isEnabled ) { - // @todo - // mframe->GetBoard()->Set + BOARD* brd = myframe->GetBoard(); + + /* @todo: + + 1) move: + + RATSNEST_VISIBLE, + GRID_VISIBLE, ? maybe not this one + + NO_CONNECTS_VISIBLE, + MOD_FR_VISIBLE, + MOD_BK_VISIBLE, + + into m_VisibleElements and get rid of globals. + + 2) Add IsElementVisible() & SetVisibleElement() to class BOARD + */ + + switch( aId ) + { + // see todo above, don't really want anything except IsElementVisible() here. + + case GRID_VISIBLE: + myframe->m_Draw_Grid = isEnabled; + break; + + case MOD_FR_VISIBLE: + DisplayOpt.Show_Modules_Cmp = isEnabled; + break; + + case MOD_BK_VISIBLE: + DisplayOpt.Show_Modules_Cu = isEnabled; + break; + + default: + + int visibleElements = brd->GetVisibleElements(); + + if( isEnabled ) + visibleElements |= (1 << aId ); + else + visibleElements &= ~(1 << aId); + + brd->SetVisibleElements( visibleElements ); + } + + myframe->DrawPanel->Refresh(); } //----------------------------------------------- + void WinEDA_PcbFrame::ReFillLayerWidget() { BOARD* brd = GetBoard(); @@ -415,7 +484,7 @@ void WinEDA_PcbFrame::ReFillLayerWidget() int enabledLayers = brd->GetEnabledLayers(); - m_Layers->Freeze(); // no screen updates until done modifying +// m_Layers->Freeze(); // no screen updates until done modifying m_Layers->ClearLayerRows(); @@ -446,7 +515,52 @@ void WinEDA_PcbFrame::ReFillLayerWidget() m_Layers->SelectLayer( LAYER_N_FRONT ); - m_Layers->Thaw(); + // technical layers are shown in this order: + static const struct { + int layerId; + wxString tooltip; + } techLayerSeq[] = { + { ADHESIVE_N_FRONT, _("Adhesive on board's front") }, + { ADHESIVE_N_BACK, _("Adhesive on board's back") }, + { SOLDERPASTE_N_FRONT, _("Solder paste on board's front") }, + { SOLDERPASTE_N_BACK, _("Solder paste on board's back") }, + { SILKSCREEN_N_FRONT, _("Silkscreen on board's front") }, + { SILKSCREEN_N_BACK, _("Silkscreen on board's back") }, + { SOLDERMASK_N_FRONT, _("Solder mask on board's front") }, + { SOLDERMASK_N_BACK, _("Solder mask on board's back") }, + { DRAW_N, _("Explanatory drawings") }, + { COMMENT_N, _("Explanatory comments") }, + { ECO1_N, _("TDB") }, + { ECO2_N, _("TBD") }, + { EDGE_N, _("Board's perimeter definition") }, + }; + + for( unsigned i=0; iAppendLayerRow( LAYER_WIDGET::ROW( + brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), + techLayerSeq[i].tooltip, true ) ); + } + +// m_Layers->Thaw(); + + wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_Layers ); + + wxSize bestz = m_Layers->GetBestSize(); + + lyrs.MinSize( bestz ); + lyrs.BestSize( bestz ); + lyrs.FloatingSize( bestz ); + + if( lyrs.IsDocked() ) + m_auimgr.Update(); + else + m_Layers->SetSize( bestz ); } @@ -522,6 +636,7 @@ void WinEDA_PcbFrame::ShowDesignRulesEditor( wxCommandEvent& event ) if( returncode == wxID_OK ) // New rules, or others changes. { ReCreateLayerBox( NULL ); + // ReFillLayerWidget(); why? GetScreen()->SetModify(); } } diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index f0386fa49a..fb01fdee46 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -189,13 +189,13 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName ) DisplayOpt.Show_Modules_Cmp = true; DisplayOpt.Show_Modules_Cu = true; - g_DesignSettings.SetElementVisibility( MODULE_TEXT_NOV_VISIBLE, true ); - g_DesignSettings.SetElementVisibility( MODULE_TEXT_CMP_VISIBLE, true ); - g_DesignSettings.SetElementVisibility( MODULE_TEXT_CU_VISIBLE, true ); - g_DesignSettings.SetElementVisibility( PAD_CMP_VISIBLE, true ); - g_DesignSettings.SetElementVisibility( PAD_CU_VISIBLE, true ); + g_DesignSettings.SetElementVisibility( MOD_TEXT_INVISIBLE, true ); + g_DesignSettings.SetElementVisibility( MOD_TEXT_FR_VISIBLE, true ); + g_DesignSettings.SetElementVisibility( MOD_TEXT_BK_VISIBLE, true ); + g_DesignSettings.SetElementVisibility( PAD_BK_VISIBLE, true ); + g_DesignSettings.SetElementVisibility( PAD_BK_VISIBLE, true ); g_DesignSettings.SetElementVisibility( VIA_THROUGH_VISIBLE, true ); - g_DesignSettings.SetElementVisibility( VIA_BLIND_BURIED_VISIBLE, true ); + g_DesignSettings.SetElementVisibility( VIA_BBLIND_VISIBLE, true ); g_DesignSettings.SetElementVisibility( VIA_MICROVIA_VISIBLE, true ); // Items that can remain not visible: comment them if you want. diff --git a/pcbnew/set_color.h b/pcbnew/set_color.h index 6321d4c66f..9a80ccab71 100644 --- a/pcbnew/set_color.h +++ b/pcbnew/set_color.h @@ -373,7 +373,7 @@ static ColorButton Pad_Cu_Butt = { type_element, // Toggle ITEM_NOT_SHOW bit of the color variable _( "Pad Back" ), // Title - PAD_CU_VISIBLE, + PAD_BK_VISIBLE, &g_PadCUColor // Address of optional parameter }; @@ -381,7 +381,7 @@ static ColorButton Pad_Cmp_Butt = { type_element, // Toggle ITEM_NOT_SHOW bit of the color variable _( "Pad Front" ), // Title - PAD_CMP_VISIBLE, + PAD_FR_VISIBLE, &g_PadCMPColor // Address of optional parameter }; @@ -389,7 +389,7 @@ static ColorButton Text_Mod_Cu_Butt = { type_element, // Toggle ITEM_NOT_SHOW bit of the color variable _( "Text Module Back" ), // Title - MODULE_TEXT_CU_VISIBLE, + MOD_TEXT_BK_VISIBLE, &g_ModuleTextCUColor // Address of optional parameter }; @@ -397,7 +397,7 @@ static ColorButton Text_Mod_Cmp_Butt = { type_element, // Toggle ITEM_NOT_SHOW bit of the color variable _( "Text Module Front" ), // Title - MODULE_TEXT_CMP_VISIBLE, + MOD_TEXT_FR_VISIBLE, &g_ModuleTextCMPColor // Address of optional parameter }; @@ -405,13 +405,13 @@ static ColorButton Text_Mod_NoVisible_Butt = { type_element, // Toggle ITEM_NOT_SHOW bit of the color variable _( "Text Module invisible" ), // Title - MODULE_TEXT_NOV_VISIBLE, + MOD_TEXT_INVISIBLE, &g_ModuleTextNOVColor // Address of optional parameter }; static ColorButton Anchors_Butt = { - type_element, // Toggle ITEM_NOT_SHOW bit of the color variable + type_element, // Toggle ITEM_NOT_SHOW bit of the color variableg_ModuleTextNOVColor _( "Anchors" ), // Title ANCHOR_VISIBLE, &g_AnchorColor // Address of optional parameter diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 947813f5eb..eda342beb6 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -24,14 +24,15 @@ #include "hotkeys.h" +#define MUWAVE_ENBL + #define SEL_LAYER_HELP _( \ "Show active layer selections\nand select layer pair for route and place via" ) /* Data to build the layer pair indicator button */ static wxBitmap* LayerPairBitmap = NULL; -static const char s_BitmapLayerIcon[16][16] = -{ +static const char s_BitmapLayerIcon[16][16] = { // 0 = draw pixel with active layer color // 1 = draw pixel with top layer color (top/bottom layer used in // autoroute and place via) @@ -69,22 +70,19 @@ void WinEDA_PcbFrame::PrepareLayerIndicator() previous_Route_Layer_BOTTOM_color, previous_via_color; /* get colors, and redraw bitmap button only on changes */ - active_layer_color = - g_DesignSettings.m_LayerColor[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer]; + active_layer_color = g_DesignSettings.m_LayerColor[((PCB_SCREEN*)GetScreen())->m_Active_Layer]; if( previous_active_layer_color != active_layer_color ) { previous_active_layer_color = active_layer_color; change = true; } - Route_Layer_TOP_color = - g_DesignSettings.m_LayerColor[( (PCB_SCREEN*) GetScreen() )->m_Route_Layer_TOP]; + Route_Layer_TOP_color = g_DesignSettings.m_LayerColor[((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP]; if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color ) { previous_Route_Layer_TOP_color = Route_Layer_TOP_color; change = true; } - Route_Layer_BOTTOM_color = - g_DesignSettings.m_LayerColor[( (PCB_SCREEN*) GetScreen() )->m_Route_Layer_BOTTOM]; + Route_Layer_BOTTOM_color = g_DesignSettings.m_LayerColor[((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM]; if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color ) { previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color; @@ -179,7 +177,7 @@ void WinEDA_PcbFrame::PrepareLayerIndicator() /* Creates or updates the main horizontal toolbar for the board editor - */ +*/ void WinEDA_PcbFrame::ReCreateHToolbar() { wxString msg; @@ -194,49 +192,48 @@ void WinEDA_PcbFrame::ReCreateHToolbar() m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); m_HToolBar->SetRows( 1 ); #if !defined(KICAD_AUIMANAGER) - SetToolBar( (wxToolBar*) m_HToolBar ); + SetToolBar( (wxToolBar*)m_HToolBar ); #endif - // Set up toolbar m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, wxBitmap( new_xpm ), - _( "New board" ) ); + _( "New board" ) ); m_HToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, wxBitmap( open_xpm ), - _( "Open existing board" ) ); + _( "Open existing board" ) ); m_HToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, wxBitmap( save_xpm ), - _( "Save board" ) ); + _( "Save board" ) ); m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, wxBitmap( sheetset_xpm ), - _( "Page settings (size, texts)" ) ); + _( "Page settings (size, texts)" ) ); m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, - wxBitmap( modedit_xpm ), - _( "Open module editor" ) ); + wxBitmap( modedit_xpm ), + _( "Open module editor" ) ); m_HToolBar->AddSeparator(); m_HToolBar->AddTool( wxID_CUT, wxEmptyString, wxBitmap( cut_button ), - _( "Cut selected item" ) ); + _( "Cut selected item" ) ); #if 0 m_HToolBar->AddTool( wxID_COPY, wxEmptyString, wxBitmap( copy_button ), - _( "Copy selected item" ) ); + _( "Copy selected item" ) ); m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, wxBitmap( paste_xpm ), - _( "Paste" ) ); + _( "Paste" ) ); #endif m_HToolBar->AddSeparator(); m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, wxBitmap( undo_xpm ), - _( "Undo last edition" ) ); + _( "Undo last edition" ) ); m_HToolBar->AddTool( wxID_REDO, wxEmptyString, wxBitmap( redo_xpm ), - _( "Redo the last undo command" ) ); + _( "Redo the last undo command" ) ); m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ), - _( "Print board" ) ); + _( "Print board" ) ); m_HToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, wxBitmap( plot_xpm ), - _( "Plot (HPGL, PostScript, or GERBER format)" ) ); + _( "Plot (HPGL, PostScript, or GERBER format)" ) ); m_HToolBar->AddSeparator(); msg = AddHotkeyName( _( "Zoom in" ), s_Board_Editor_Hokeys_Descr, @@ -268,9 +265,9 @@ void WinEDA_PcbFrame::ReCreateHToolbar() m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ), - _( "Read netlist" ) ); + _( "Read netlist" ) ); m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, wxBitmap( erc_xpm ), - _( "Perform design rules check" ) ); + _( "Perform design rules check" ) ); m_HToolBar->AddSeparator(); @@ -292,8 +289,8 @@ void WinEDA_PcbFrame::ReCreateHToolbar() // Fast call to FreeROUTE Web Bases router m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString, - wxBitmap( web_support_xpm ), - _( "Fast access to theWeb Based FreeROUTE advanced router" ) ); + wxBitmap( web_support_xpm ), + _( "Fast access to theWeb Based FreeROUTE advanced router" ) ); // after adding the buttons to the toolbar, must call Realize() to reflect // the changes @@ -348,18 +345,18 @@ void WinEDA_PcbFrame::ReCreateOptToolbar() m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, - wxBitmap( show_zone_xpm ), wxNullBitmap, - _( "Show filled areas in zones" ) ); + wxBitmap( show_zone_xpm ), wxNullBitmap, + _( "Show filled areas in zones" ) ); m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, - wxEmptyString, - wxBitmap( show_zone_disable_xpm ), - wxNullBitmap, - _( "Do not show filled areas in zones" ) ); + wxEmptyString, + wxBitmap( show_zone_disable_xpm ), + wxNullBitmap, + _( "Do not show filled areas in zones" )); m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, - wxEmptyString, - wxBitmap( show_zone_outline_only_xpm ), - wxNullBitmap, - _( "Show outlines of filled areas only in zones" ) ); + wxEmptyString, + wxBitmap( show_zone_outline_only_xpm ), + wxNullBitmap, + _( "Show outlines of filled areas only in zones" ) ); m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString, @@ -388,23 +385,17 @@ void WinEDA_PcbFrame::ReCreateOptToolbar() _( "Show invisible text" ), wxITEM_CHECK ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE, - g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) ); + g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE )); +#ifdef MUWAVE_ENBL m_OptionsToolBar->AddSeparator(); - m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, - wxEmptyString, - wxBitmap( layers_manager_xpm ), - _( - "Display/remove auxiliary vertical toolbar (tools for micro wave applications)\n This is a experimental feature (under development)" ), - wxITEM_CHECK ); - m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, wxEmptyString, wxBitmap( mw_toolbar_xpm ), - _( - "Display/remove auxiliary vertical toolbar (tools for micro wave applications)\n This is a experimental feature (under development)" ), + _( "Display/remove auxiliary vertical toolbar (tools for micro wave applications)\n This is a experimental feature (under development)" ), wxITEM_CHECK ); +#endif m_OptionsToolBar->Realize(); SetToolbars(); @@ -503,18 +494,18 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar() // Set up toolbar m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString, - wxBitmap( mw_Add_Line_xpm ), - _( "Create line of specified length for microwave applications" ) ); + wxBitmap( mw_Add_Line_xpm ), + _( "Create line of specified length for microwave applications" ) ); m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_GAP_CMD, wxEmptyString, - wxBitmap( mw_Add_Gap_xpm ), - _( "Create gap of specified length for microwave applications" ) ); + wxBitmap( mw_Add_Gap_xpm ), + _( "Create gap of specified length for microwave applications" ) ); m_AuxVToolBar->AddSeparator(); m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_CMD, wxEmptyString, - wxBitmap( mw_Add_Stub_xpm ), - _( "Create stub of specified length for microwave applications" ) ); + wxBitmap( mw_Add_Stub_xpm ), + _( "Create stub of specified length for microwave applications" ) ); m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD, wxEmptyString, wxBitmap( mw_Add_stub_arc_xpm ), @@ -522,8 +513,8 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar() ); m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD, wxEmptyString, - wxBitmap( mw_Add_Shape_xpm ), - _( "Create a polynomial shape for microwave applications" ) ); + wxBitmap( mw_Add_Shape_xpm ), + _( "Create a polynomial shape for microwave applications" ) ); m_AuxVToolBar->Realize(); @@ -556,17 +547,17 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() // Creates box to display and choose tracks widths: m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, - ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, - wxPoint( -1, -1 ), - wxSize( LISTBOX_WIDTH, -1 ) ); + ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, + wxPoint( -1, -1 ), + wxSize( LISTBOX_WIDTH, -1 ) ); m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox ); m_AuxiliaryToolBar->AddSeparator(); // Creates box to display and choose vias diameters: m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, - ID_AUX_TOOLBAR_PCB_VIA_SIZE, - wxPoint( -1, -1 ), - wxSize( (LISTBOX_WIDTH * 12) / 10, -1 ) ); + ID_AUX_TOOLBAR_PCB_VIA_SIZE, + wxPoint( -1, -1 ), + wxSize( (LISTBOX_WIDTH*12)/10, -1 ) ); m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox ); m_AuxiliaryToolBar->AddSeparator(); @@ -575,7 +566,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() wxEmptyString, wxPoint( -1, -1 ), wxSize( LISTBOX_WIDTH + 10, -1 ), wxTE_READONLY ); - m_ClearanceBox->SetToolTip( _( "Current NetClass clearance value" ) ); + m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") ); m_AuxiliaryToolBar->AddControl( m_ClearanceBox ); m_AuxiliaryToolBar->AddSeparator(); @@ -584,7 +575,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() wxEmptyString, wxPoint( -1, -1 ), wxSize( LISTBOX_WIDTH, -1 ), 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->AddSeparator(); @@ -593,37 +584,36 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, wxEmptyString, wxBitmap( auto_track_width_xpm ), - _( - "Auto track width: when starting on \ -an existing track use its width\notherwise, use current width setting" ), + _( "Auto track width: when starting on \ +an existing track use its width\notherwise, use current width setting" ), wxITEM_CHECK ); // Add the box to display and select the current grid size: m_AuxiliaryToolBar->AddSeparator(); m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, - ID_ON_GRID_SELECT, - wxPoint( -1, -1 ), - wxSize( LISTBOX_WIDTH, -1 ) ); + ID_ON_GRID_SELECT, + wxPoint( -1, -1 ), + wxSize( LISTBOX_WIDTH, -1 ) ); m_AuxiliaryToolBar->AddControl( m_SelGridBox ); // Add the box to display and select the current Zoom m_AuxiliaryToolBar->AddSeparator(); m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, - ID_ON_ZOOM_SELECT, - wxPoint( -1, -1 ), - wxSize( LISTBOX_WIDTH, -1 ) ); + ID_ON_ZOOM_SELECT, + wxPoint( -1, -1 ), + wxSize( LISTBOX_WIDTH, -1 ) ); msg = _( "Auto" ); m_SelZoomBox->Append( msg ); - for( int i = 0; i < (int) GetScreen()->m_ZoomList.GetCount(); i++ ) + for( int i = 0; i < (int)GetScreen()->m_ZoomList.GetCount(); i++ ) { msg = _( "Zoom " ); - if( (GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar) == 0 ) + if ( (GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar) == 0 ) msg << GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar; else { wxString value; value.Printf( wxT( "%.1f" ), - (float) GetScreen()->m_ZoomList[i] / + (float)GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar ); msg += value; } @@ -638,7 +628,7 @@ an existing track use its width\notherwise, use current width setting" // Update displayed values m_SelGridBox->Clear(); - wxString format = _( "Grid" ); + wxString format = _( "Grid"); if( g_UnitMetric == INCHES ) format += wxT( " %.1f" ); else @@ -646,9 +636,9 @@ an existing track use its width\notherwise, use current width setting" for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ ) { - GRID_TYPE grid = GetScreen()->m_GridList[i]; - double value = To_User_Unit( g_UnitMetric, grid.m_Size.x, - m_InternalUnits ); + GRID_TYPE grid = GetScreen()->m_GridList[i]; + double value = To_User_Unit( g_UnitMetric, grid.m_Size.x, + m_InternalUnits ); if( grid.m_Id != ID_POPUP_GRID_USER ) { if( g_UnitMetric == INCHES ) @@ -665,7 +655,7 @@ an existing track use its width\notherwise, use current width setting" m_SelGridBox->SetSelection( i ); } - m_TrackAndViasSizesList_Changed = true; + m_TrackAndViasSizesList_Changed = true; ReCreateLayerBox( NULL ); SetToolbars(); @@ -679,13 +669,13 @@ void WinEDA_PcbFrame::UpdateToolbarLayerInfo() // Enable the display on the correct layer // To avoid reentrancy ( Bug wxGTK Linux version? ), the selection is // made where it is bad ( corrected on wxGTK 2.6.0 ) - int count = m_SelLayerBox->GetCount(); - int choice = m_SelLayerBox->GetChoice(); - int layer = GetScreen()->m_Active_Layer; + int count = m_SelLayerBox->GetCount(); + int choice = m_SelLayerBox->GetChoice(); + int layer = GetScreen()->m_Active_Layer; - for( int listNdx = 0; listNdxGetClientData( listNdx ) == layer ) + if( (int) (size_t) m_SelLayerBox->GetClientData( listNdx ) == layer ) { if( listNdx != choice ) m_SelLayerBox->SetSelection( listNdx ); @@ -705,11 +695,11 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) m_SelLayerBox = new WinEDAChoiceBox( parent, ID_TOOLBARH_PCB_SELECT_LAYER, wxPoint( -1, -1 ), -#if defined(__UNIX__) +#if defined (__UNIX__) - // Width enough for the longest - // string: "Component (Page Down)" - // Maybe that string is too long? + // Width enough for the longest + // string: "Component (Page Down)" + // Maybe that string is too long? wxSize( 230, -1 ) #else wxSize( LISTBOX_WIDTH + 30, -1 ) @@ -719,16 +709,20 @@ 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; + unsigned length = 0; m_SelLayerBox->Clear(); - for( int layer = 0, listNdx = 0; layer <= EDGE_N; layer++ ) + for( int layer=0, listNdx=0; layer <= EDGE_N; layer++ ) { // List to append hotkeys in layer box selection - static const int HK_SwitchLayer[EDGE_N + 1] = - { + static const int HK_SwitchLayer[EDGE_N + 1] = { HK_SWITCH_LAYER_TO_COPPER, HK_SWITCH_LAYER_TO_INNER1, HK_SWITCH_LAYER_TO_INNER2, @@ -752,13 +746,10 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) wxString msg = GetBoard()->GetLayerName( layer ); msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr, HK_SwitchLayer[layer] ); - - /* we are using tabs in AddHotkeyName message. - * this is not handled by m_SelLayerBox. - * so we replace them by 3 spaces - */ - msg.Replace( wxT( "\t"), wxT( " " ) ); m_SelLayerBox->Append( msg ); + + //D(printf("appending layername=%s, ndx=%d, layer=%d\n", CONV_TO_UTF8(msg), listNdx, layer );) + m_SelLayerBox->SetClientData( listNdx, (void*) layer ); length = MAX( length, msg.Len() ); listNdx++; diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index eda5f9f184..a8eb3d17c0 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -267,9 +267,9 @@ void WinEDA_PcbFrame::SetToolbars() _( "High contrast display mode" ) ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE, - g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) ); + g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE ) ); m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE, - g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) ? + g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE ) ? _( "Hide invisible text" ) : _( "Show invisible text" ) );