Commit 920186dd authored by dickelbeck's avatar dickelbeck

more layer widget incorporation

parent 2bae7624
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
return false; return false;
// If a layer is disabled, it is automatically invisible // 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: ...@@ -111,28 +111,27 @@ public:
m_VisibleElements = aMask; m_VisibleElements = aMask;
} }
/** /**
* Function IsElementVisible * Function IsElementVisible
* tests whether a given element category is visible * tests whether a given element category is visible. Keep this as an
* @param aCategoryIndex = The index of the element category to be tested. * inline function.
* @param aPCB_VISIBLE is from the enum by the same name
* @return bool - true if the element is visible. * @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 bool( m_VisibleElements & (1 << aPCB_VISIBLE) );
return false;
return (bool) ( m_VisibleElements & (1 << aCategoryIndex) );
} }
/** /**
* Function SetElementVisibility * Function SetElementVisibility
* changes the visibility of an element category * 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 * @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 * Function GetEnabledLayers
...@@ -144,7 +143,6 @@ public: ...@@ -144,7 +143,6 @@ public:
return m_EnabledLayers; return m_EnabledLayers;
} }
/** /**
* Function SetEnabledLayers * Function SetEnabledLayers
* changes the bit-mask of enabled layers * changes the bit-mask of enabled layers
...@@ -152,7 +150,6 @@ public: ...@@ -152,7 +150,6 @@ public:
*/ */
void SetEnabledLayers( int aMask ); void SetEnabledLayers( int aMask );
/** /**
* Function IsLayerEnabled * Function IsLayerEnabled
* tests whether a given layer is enabled * tests whether a given layer is enabled
...@@ -161,7 +158,7 @@ public: ...@@ -161,7 +158,7 @@ public:
*/ */
bool IsLayerEnabled( int aLayerIndex ) bool IsLayerEnabled( int aLayerIndex )
{ {
return (bool) ( m_EnabledLayers & 1 << aLayerIndex ); return bool( m_EnabledLayers & (1 << aLayerIndex) );
} }
......
...@@ -93,14 +93,14 @@ ...@@ -93,14 +93,14 @@
#define LAYER_14 (1 << LAYER_N_14) ///< bit mask for layer 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_15 (1 << LAYER_N_15) ///< bit mask for layer 15
#define LAYER_FRONT (1 << LAYER_N_FRONT) ///< bit mask for component layer #define LAYER_FRONT (1 << LAYER_N_FRONT) ///< bit mask for component layer
#define ADHESIVE_LAYER_BACK (1 << ADHESIVE_N_BACK) #define ADHESIVE_LAYER_BACK (1 << ADHESIVE_N_BACK)
#define ADHESIVE_LAYER_FRONT (1 << ADHESIVE_N_FRONT) #define ADHESIVE_LAYER_FRONT (1 << ADHESIVE_N_FRONT)
#define SOLDERPASTE_LAYER_BACK (1 << SOLDERPASTE_N_BACK) #define SOLDERPASTE_LAYER_BACK (1 << SOLDERPASTE_N_BACK)
#define SOLDERPASTE_LAYER_FRONT (1 << SOLDERPASTE_N_FRONT) #define SOLDERPASTE_LAYER_FRONT (1 << SOLDERPASTE_N_FRONT)
#define SILKSCREEN_LAYER_BACK (1 << SILKSCREEN_N_BACK) #define SILKSCREEN_LAYER_BACK (1 << SILKSCREEN_N_BACK)
#define SILKSCREEN_LAYER_FRONT (1 << SILKSCREEN_N_FRONT) #define SILKSCREEN_LAYER_FRONT (1 << SILKSCREEN_N_FRONT)
#define SOLDERMASK_LAYER_BACK (1 << SOLDERMASK_N_BACK) #define SOLDERMASK_LAYER_BACK (1 << SOLDERMASK_N_BACK)
#define SOLDERMASK_LAYER_FRONT (1 << SOLDERMASK_N_FRONT) #define SOLDERMASK_LAYER_FRONT (1 << SOLDERMASK_N_FRONT)
#define DRAW_LAYER (1 << DRAW_N) #define DRAW_LAYER (1 << DRAW_N)
#define COMMENT_LAYER (1 << COMMENT_N) #define COMMENT_LAYER (1 << COMMENT_N)
#define ECO1_LAYER (1 << ECO1_N) #define ECO1_LAYER (1 << ECO1_N)
...@@ -152,21 +152,37 @@ class RATSNEST_ITEM; ...@@ -152,21 +152,37 @@ class RATSNEST_ITEM;
/* Class to handle a board */ /* Class to handle a board */
#include "class_board.h" #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, VIAS_VISIBLE,
VIA_NOT_DEFINED_VISIBLE = VIAS_VISIBLE,
VIA_MICROVIA_VISIBLE, VIA_MICROVIA_VISIBLE,
VIA_BLIND_BURIED_VISIBLE, VIA_BBLIND_VISIBLE,
VIA_THROUGH_VISIBLE, VIA_THROUGH_VISIBLE,
MODULE_TEXT_CMP_VISIBLE, MOD_TEXT_FR_VISIBLE,
MODULE_TEXT_CU_VISIBLE, MOD_TEXT_BK_VISIBLE,
MODULE_TEXT_NOV_VISIBLE, MOD_TEXT_INVISIBLE, ///< text marked as invisible
ANCHOR_VISIBLE, ANCHOR_VISIBLE,
PAD_CU_VISIBLE, PAD_FR_VISIBLE,
PAD_CMP_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 * Function IsValidLayerIndex
* tests whether a given integer is a valid layer index * tests whether a given integer is a valid layer index
......
...@@ -67,28 +67,17 @@ protected: ...@@ -67,28 +67,17 @@ protected:
{ {
} }
//-----<implement LAYER_WIDGET abstract functions>--- //-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( int aLayer, int aColor ); void OnLayerColorChange( int aLayer, int aColor );
bool OnLayerSelect( int aLayer ); bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ); void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, int aColor ); void OnRenderColorChange( int aId, int aColor );
void OnRenderEnable( int aId, bool isEnabled ); void OnRenderEnable( int aId, bool isEnabled );
//-----</implement LAYER_WIDGET abstract functions>--------------- //-----</implement LAYER_WIDGET abstract callback functions>----------
}; };
/// render rows are fixed, layer rows are dynamically determined.
static LAYER_WIDGET::ROW renderRows[];
LYRS* m_Layers; // established in constructor 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: public:
WinEDAChoiceBox* m_SelLayerBox; // a combo box to display and WinEDAChoiceBox* m_SelLayerBox; // a combo box to display and
// select active layer // select active layer
...@@ -177,6 +166,13 @@ public: ...@@ -177,6 +166,13 @@ public:
void ReCreateMenuBar(); void ReCreateMenuBar();
WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent ); 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 Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse ); void GeneralControle( wxDC* DC, wxPoint Mouse );
......
...@@ -277,9 +277,9 @@ GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide() ...@@ -277,9 +277,9 @@ GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
( (PCB_SCREEN*)GetScreen())->m_Active_Layer ); ( (PCB_SCREEN*)GetScreen())->m_Active_Layer );
// account for the globals // account for the globals
guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE )); guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE ));
guide.SetIgnoreMTextsOnCopper( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_CU_VISIBLE )); guide.SetIgnoreMTextsOnCopper( ! g_DesignSettings.IsElementVisible( MOD_TEXT_BK_VISIBLE ));
guide.SetIgnoreMTextsOnCmp( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_CMP_VISIBLE )); guide.SetIgnoreMTextsOnCmp( ! g_DesignSettings.IsElementVisible( MOD_TEXT_FR_VISIBLE ));
guide.SetIgnoreModulesOnCu( !DisplayOpt.Show_Modules_Cu ); guide.SetIgnoreModulesOnCu( !DisplayOpt.Show_Modules_Cu );
guide.SetIgnoreModulesOnCmp( !DisplayOpt.Show_Modules_Cmp ); guide.SetIgnoreModulesOnCmp( !DisplayOpt.Show_Modules_Cmp );
......
...@@ -396,11 +396,63 @@ int BOARD::GetVisibleElements() const ...@@ -396,11 +396,63 @@ int BOARD::GetVisibleElements() const
return m_BoardSettings->GetVisibleElements(); 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 ) void BOARD::SetLayerColor( int aLayer, int aColor )
{ {
m_BoardSettings->SetLayerColor( aLayer, aColor ); m_BoardSettings->SetLayerColor( aLayer, aColor );
} }
int BOARD::GetLayerColor( int aLayer ) int BOARD::GetLayerColor( int aLayer )
{ {
return m_BoardSettings->GetLayerColor( aLayer ); return m_BoardSettings->GetLayerColor( aLayer );
......
...@@ -287,7 +287,8 @@ public: ...@@ -287,7 +287,8 @@ public:
* Function GetVisibleElements * Function GetVisibleElements
* is a proxy function that calls the correspondent function in m_BoardSettings * is a proxy function that calls the correspondent function in m_BoardSettings
* returns a bit-mask of all the element categories that are visible * 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; int GetVisibleElements() const;
...@@ -295,10 +296,20 @@ public: ...@@ -295,10 +296,20 @@ public:
* Function SetVisibleElements * Function SetVisibleElements
* is a proxy function that calls the correspondent function in m_BoardSettings * is a proxy function that calls the correspondent function in m_BoardSettings
* changes the bit-mask of visible element categories * 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 ); 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 * Function GetLayerName
* returns the name of the layer given by aLayerIndex. * returns the name of the layer given by aLayerIndex.
...@@ -345,8 +356,13 @@ public: ...@@ -345,8 +356,13 @@ public:
*/ */
void SetLayerColor( int aLayer, int aColor ); void SetLayerColor( int aLayer, int aColor );
/**
* Function GetLayerColor
* gets a layer color for any valid layer, including non-copper ones.
*/
int GetLayerColor( int aLayer ); int GetLayerColor( int aLayer );
/* Functions to get some items count */ /* Functions to get some items count */
int GetNumSegmTrack(); int GetNumSegmTrack();
int GetNumSegmZone(); int GetNumSegmZone();
......
...@@ -104,7 +104,7 @@ void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewStat ...@@ -104,7 +104,7 @@ void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewStat
void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState ) void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState )
{ {
if( aElementCategory < 0 || aElementCategory > PAD_CMP_VISIBLE ) if( aElementCategory < 0 || aElementCategory >= END_VISIBLE )
return; return;
if( aNewState ) if( aNewState )
m_VisibleElements |= 1 << aElementCategory; m_VisibleElements |= 1 << aElementCategory;
......
...@@ -378,20 +378,20 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -378,20 +378,20 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
if( Module->GetLayer() == LAYER_N_BACK ) 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; return;
color = g_ModuleTextCUColor; color = g_ModuleTextCUColor;
} }
else if( Module->GetLayer() == LAYER_N_FRONT ) 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; return;
color = g_ModuleTextCMPColor; color = g_ModuleTextCMPColor;
} }
if( m_NoShow ) if( m_NoShow )
{ {
if( g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) == false ) if( g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE ) == false )
return; return;
color = g_ModuleTextNOVColor; color = g_ModuleTextNOVColor;
} }
......
...@@ -725,7 +725,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi ...@@ -725,7 +725,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
color = g_DesignSettings.m_ViaColor[m_Shape]; 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 ) && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG )
return; return;
......
...@@ -250,7 +250,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -250,7 +250,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE: 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 ) ); m_OptionsToolBar->GetToolState( id ) );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
......
...@@ -547,6 +547,7 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event ) ...@@ -547,6 +547,7 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
m_Parent->ReCreateLayerBox( NULL ); m_Parent->ReCreateLayerBox( NULL );
m_Parent->ReFillLayerWidget();
EndModal( wxID_OK ); EndModal( wxID_OK );
} }
......
...@@ -19,7 +19,7 @@ LAYER_PANEL_BASE::LAYER_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoi ...@@ -19,7 +19,7 @@ LAYER_PANEL_BASE::LAYER_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoi
wxBoxSizer* bSizer3; wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxVERTICAL ); 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_LayerScrolledWindow->SetScrollRate( 5, 5 );
m_LayersFlexGridSizer = new wxFlexGridSizer( 0, 4, 1, 3 ); m_LayersFlexGridSizer = new wxFlexGridSizer( 0, 4, 1, 3 );
m_LayersFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL ); m_LayersFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL );
...@@ -38,7 +38,7 @@ LAYER_PANEL_BASE::LAYER_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoi ...@@ -38,7 +38,7 @@ LAYER_PANEL_BASE::LAYER_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoi
wxBoxSizer* bSizer4; wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL ); 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_RenderScrolledWindow->SetScrollRate( 5, 5 );
m_RenderFlexGridSizer = new wxFlexGridSizer( 0, 2, 1, 3 ); m_RenderFlexGridSizer = new wxFlexGridSizer( 0, 2, 1, 3 );
m_RenderFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL ); m_RenderFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL );
......
...@@ -210,6 +210,8 @@ void LAYER_WIDGET::OnLeftDownLayers( wxMouseEvent& event ) ...@@ -210,6 +210,8 @@ void LAYER_WIDGET::OnLeftDownLayers( wxMouseEvent& event )
if( OnLayerSelect( row ) ) // if client allows this change. if( OnLayerSelect( row ) ) // if client allows this change.
SelectLayerRow( row ); SelectLayerRow( row );
passOnFocus();
} }
...@@ -234,6 +236,8 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& event ) ...@@ -234,6 +236,8 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& event )
// tell the client code. // tell the client code.
OnLayerColorChange( layer, newColor ); OnLayerColorChange( layer, newColor );
} }
passOnFocus();
} }
...@@ -250,6 +254,8 @@ void LAYER_WIDGET::OnRightDownLayers( wxMouseEvent& event ) ...@@ -250,6 +254,8 @@ void LAYER_WIDGET::OnRightDownLayers( wxMouseEvent& event )
_( "Hide All Cu" ) ) ); _( "Hide All Cu" ) ) );
PopupMenu( &menu ); PopupMenu( &menu );
passOnFocus();
} }
void LAYER_WIDGET::OnPopupSelection( wxCommandEvent& event ) void LAYER_WIDGET::OnPopupSelection( wxCommandEvent& event )
...@@ -307,6 +313,7 @@ void LAYER_WIDGET::OnLayerCheckBox( wxCommandEvent& event ) ...@@ -307,6 +313,7 @@ void LAYER_WIDGET::OnLayerCheckBox( wxCommandEvent& event )
wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject(); wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
int layer = getDecodedId( eventSource->GetId() ); int layer = getDecodedId( eventSource->GetId() );
OnLayerVisible( layer, eventSource->IsChecked() ); OnLayerVisible( layer, eventSource->IsChecked() );
passOnFocus();
} }
...@@ -331,6 +338,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event ) ...@@ -331,6 +338,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event )
// tell the client code. // tell the client code.
OnRenderColorChange( id, newColor ); OnRenderColorChange( id, newColor );
} }
passOnFocus();
} }
void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event ) void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event )
...@@ -338,6 +346,7 @@ void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event ) ...@@ -338,6 +346,7 @@ void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event )
wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject(); wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
int id = getDecodedId( eventSource->GetId() ); int id = getDecodedId( eventSource->GetId() );
OnRenderEnable( id, eventSource->IsChecked() ); OnRenderEnable( id, eventSource->IsChecked() );
passOnFocus();
} }
...@@ -437,6 +446,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) ...@@ -437,6 +446,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec )
col = 1; col = 1;
wxCheckBox* cb = new wxCheckBox( m_RenderScrolledWindow, encodeId( col, aSpec.id ), wxCheckBox* cb = new wxCheckBox( m_RenderScrolledWindow, encodeId( col, aSpec.id ),
aSpec.rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); aSpec.rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
cb->SetValue( aSpec.state );
cb->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, cb->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler( LAYER_WIDGET::OnRenderCheckBox ), NULL, this ); wxCommandEventHandler( LAYER_WIDGET::OnRenderCheckBox ), NULL, this );
cb->SetToolTip( aSpec.tooltip ); cb->SetToolTip( aSpec.tooltip );
...@@ -444,11 +454,22 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) ...@@ -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 );
}
//-----<public>------------------------------------------------------- //-----<public>-------------------------------------------------------
LAYER_WIDGET::LAYER_WIDGET( wxWindow* parent ) : LAYER_WIDGET::LAYER_WIDGET( wxWindow* parent ) :
LAYER_PANEL_BASE( parent ) LAYER_PANEL_BASE( parent )
{ {
m_OriginalParent = parent;
m_CurrentRow = -1; m_CurrentRow = -1;
m_RightArrowBitmap = new wxBitmap( rightarrow_xpm ); m_RightArrowBitmap = new wxBitmap( rightarrow_xpm );
...@@ -601,18 +622,16 @@ void LAYER_WIDGET::SelectLayerRow( int aRow ) ...@@ -601,18 +622,16 @@ void LAYER_WIDGET::SelectLayerRow( int aRow )
{ {
newbm->SetBitmap( *m_RightArrowBitmap ); 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. // Make sure the desired layer row is visible.
// It seems that as of 2.8.2, setting the focus // It seems that as of 2.8.2, setting the focus does this.
// does this and generally I don't expect the scrolling to be needed at all because // 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. // 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() ...@@ -649,6 +668,7 @@ void LAYER_WIDGET::UpdateLayouts()
{ {
m_LayersFlexGridSizer->Layout(); m_LayersFlexGridSizer->Layout();
m_RenderFlexGridSizer->Layout(); m_RenderFlexGridSizer->Layout();
FitInside();
} }
#if defined(STAND_ALONE) #if defined(STAND_ALONE)
......
...@@ -74,6 +74,7 @@ public: ...@@ -74,6 +74,7 @@ public:
protected: protected:
wxWindow* m_OriginalParent;
wxBitmap* m_BlankBitmap; wxBitmap* m_BlankBitmap;
wxBitmap* m_RightArrowBitmap; wxBitmap* m_RightArrowBitmap;
wxSize m_BitmapSize; wxSize m_BitmapSize;
...@@ -139,6 +140,12 @@ protected: ...@@ -139,6 +140,12 @@ protected:
void insertRenderRow( int aRow, const ROW& aSpec ); void insertRenderRow( int aRow, const ROW& aSpec );
/**
* Function passOnFocus
* gives away the keyboard focus up to the main parent window.
*/
void passOnFocus();
public: public:
/** Constructor */ /** Constructor */
...@@ -241,6 +248,22 @@ public: ...@@ -241,6 +248,22 @@ public:
void UpdateLayouts(); 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();
}
*/
//-----<abstract functions>------------------------------------------- //-----<abstract functions>-------------------------------------------
/** /**
......
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style">wxNO_BORDER|wxVSCROLL</property> <property name="window_style">wxNO_BORDER</property>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style">wxNO_BORDER|wxVSCROLL</property> <property name="window_style">wxNO_BORDER</property>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "confirm.h" #include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "pcbstruct.h" // enum PCB_VISIBLE
#include "collectors.h" #include "collectors.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "protos.h" #include "protos.h"
...@@ -210,24 +211,6 @@ END_EVENT_TABLE() ...@@ -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, WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
...@@ -246,9 +229,9 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -246,9 +229,9 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_show_layer_manager_tools = true; m_show_layer_manager_tools = true;
m_Layers = new LYRS( this ); m_Layers = new LYRS( this );
m_Layers->AppendRenderRows( renderRows, DIM(renderRows) );
SetBoard( new BOARD( NULL, this ) ); SetBoard( new BOARD( NULL, this ) );
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
m_drc = new DRC( this ); // these 2 objects point to each other m_drc = new DRC( this ); // these 2 objects point to each other
...@@ -282,6 +265,47 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -282,6 +265,47 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
ReCreateAuxVToolbar(); 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; row<DIM(renderRows); ++row )
{
if( renderRows[row].color != -1 ) // does this row show a color?
{
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRows[row].color = GetBoard()->GetVisibleElementColor( renderRows[row].id );
}
// @todo
// renderRows[row].state = GetBoard()->IsElementVisible( renderRows[row].id );
}
m_Layers->AppendRenderRows( renderRows, DIM(renderRows) );
#if defined(KICAD_AUIMANAGER) #if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
...@@ -395,19 +419,64 @@ void WinEDA_PcbFrame::LYRS::OnLayerVisible( int aLayer, bool isVisible, bool isF ...@@ -395,19 +419,64 @@ void WinEDA_PcbFrame::LYRS::OnLayerVisible( int aLayer, bool isVisible, bool isF
void WinEDA_PcbFrame::LYRS::OnRenderColorChange( int aId, int aColor ) void WinEDA_PcbFrame::LYRS::OnRenderColorChange( int aId, int aColor )
{ {
// @todo myframe->GetBoard()->SetVisibleElementColor( aId, aColor );
//myframe->GetBoard()->SetLayerColor( aId, aColor ); myframe->DrawPanel->Refresh();
//myframe->DrawPanel->Refresh();
} }
void WinEDA_PcbFrame::LYRS::OnRenderEnable( int aId, bool isEnabled ) void WinEDA_PcbFrame::LYRS::OnRenderEnable( int aId, bool isEnabled )
{ {
// @todo BOARD* brd = myframe->GetBoard();
// mframe->GetBoard()->Set
/* @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();
} }
//-----</LAYER_WIDGET callbacks>------------------------------------------ //-----</LAYER_WIDGET callbacks>------------------------------------------
void WinEDA_PcbFrame::ReFillLayerWidget() void WinEDA_PcbFrame::ReFillLayerWidget()
{ {
BOARD* brd = GetBoard(); BOARD* brd = GetBoard();
...@@ -415,7 +484,7 @@ void WinEDA_PcbFrame::ReFillLayerWidget() ...@@ -415,7 +484,7 @@ void WinEDA_PcbFrame::ReFillLayerWidget()
int enabledLayers = brd->GetEnabledLayers(); 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(); m_Layers->ClearLayerRows();
...@@ -446,7 +515,52 @@ void WinEDA_PcbFrame::ReFillLayerWidget() ...@@ -446,7 +515,52 @@ void WinEDA_PcbFrame::ReFillLayerWidget()
m_Layers->SelectLayer( LAYER_N_FRONT ); 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; i<DIM(techLayerSeq); ++i )
{
layer = techLayerSeq[i].layerId;
if( !(enabledLayers & (1 << layer)) )
continue;
m_Layers->AppendLayerRow( 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 ) ...@@ -522,6 +636,7 @@ void WinEDA_PcbFrame::ShowDesignRulesEditor( wxCommandEvent& event )
if( returncode == wxID_OK ) // New rules, or others changes. if( returncode == wxID_OK ) // New rules, or others changes.
{ {
ReCreateLayerBox( NULL ); ReCreateLayerBox( NULL );
// ReFillLayerWidget(); why?
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
} }
......
...@@ -189,13 +189,13 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName ) ...@@ -189,13 +189,13 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
DisplayOpt.Show_Modules_Cmp = true; DisplayOpt.Show_Modules_Cmp = true;
DisplayOpt.Show_Modules_Cu = true; DisplayOpt.Show_Modules_Cu = true;
g_DesignSettings.SetElementVisibility( MODULE_TEXT_NOV_VISIBLE, true ); g_DesignSettings.SetElementVisibility( MOD_TEXT_INVISIBLE, true );
g_DesignSettings.SetElementVisibility( MODULE_TEXT_CMP_VISIBLE, true ); g_DesignSettings.SetElementVisibility( MOD_TEXT_FR_VISIBLE, true );
g_DesignSettings.SetElementVisibility( MODULE_TEXT_CU_VISIBLE, true ); g_DesignSettings.SetElementVisibility( MOD_TEXT_BK_VISIBLE, true );
g_DesignSettings.SetElementVisibility( PAD_CMP_VISIBLE, true ); g_DesignSettings.SetElementVisibility( PAD_BK_VISIBLE, true );
g_DesignSettings.SetElementVisibility( PAD_CU_VISIBLE, true ); g_DesignSettings.SetElementVisibility( PAD_BK_VISIBLE, true );
g_DesignSettings.SetElementVisibility( VIA_THROUGH_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 ); g_DesignSettings.SetElementVisibility( VIA_MICROVIA_VISIBLE, true );
// Items that can remain not visible: comment them if you want. // Items that can remain not visible: comment them if you want.
......
...@@ -373,7 +373,7 @@ static ColorButton Pad_Cu_Butt = ...@@ -373,7 +373,7 @@ static ColorButton Pad_Cu_Butt =
{ {
type_element, // Toggle ITEM_NOT_SHOW bit of the color variable type_element, // Toggle ITEM_NOT_SHOW bit of the color variable
_( "Pad Back" ), // Title _( "Pad Back" ), // Title
PAD_CU_VISIBLE, PAD_BK_VISIBLE,
&g_PadCUColor // Address of optional parameter &g_PadCUColor // Address of optional parameter
}; };
...@@ -381,7 +381,7 @@ static ColorButton Pad_Cmp_Butt = ...@@ -381,7 +381,7 @@ static ColorButton Pad_Cmp_Butt =
{ {
type_element, // Toggle ITEM_NOT_SHOW bit of the color variable type_element, // Toggle ITEM_NOT_SHOW bit of the color variable
_( "Pad Front" ), // Title _( "Pad Front" ), // Title
PAD_CMP_VISIBLE, PAD_FR_VISIBLE,
&g_PadCMPColor // Address of optional parameter &g_PadCMPColor // Address of optional parameter
}; };
...@@ -389,7 +389,7 @@ static ColorButton Text_Mod_Cu_Butt = ...@@ -389,7 +389,7 @@ static ColorButton Text_Mod_Cu_Butt =
{ {
type_element, // Toggle ITEM_NOT_SHOW bit of the color variable type_element, // Toggle ITEM_NOT_SHOW bit of the color variable
_( "Text Module Back" ), // Title _( "Text Module Back" ), // Title
MODULE_TEXT_CU_VISIBLE, MOD_TEXT_BK_VISIBLE,
&g_ModuleTextCUColor // Address of optional parameter &g_ModuleTextCUColor // Address of optional parameter
}; };
...@@ -397,7 +397,7 @@ static ColorButton Text_Mod_Cmp_Butt = ...@@ -397,7 +397,7 @@ static ColorButton Text_Mod_Cmp_Butt =
{ {
type_element, // Toggle ITEM_NOT_SHOW bit of the color variable type_element, // Toggle ITEM_NOT_SHOW bit of the color variable
_( "Text Module Front" ), // Title _( "Text Module Front" ), // Title
MODULE_TEXT_CMP_VISIBLE, MOD_TEXT_FR_VISIBLE,
&g_ModuleTextCMPColor // Address of optional parameter &g_ModuleTextCMPColor // Address of optional parameter
}; };
...@@ -405,13 +405,13 @@ static ColorButton Text_Mod_NoVisible_Butt = ...@@ -405,13 +405,13 @@ static ColorButton Text_Mod_NoVisible_Butt =
{ {
type_element, // Toggle ITEM_NOT_SHOW bit of the color variable type_element, // Toggle ITEM_NOT_SHOW bit of the color variable
_( "Text Module invisible" ), // Title _( "Text Module invisible" ), // Title
MODULE_TEXT_NOV_VISIBLE, MOD_TEXT_INVISIBLE,
&g_ModuleTextNOVColor // Address of optional parameter &g_ModuleTextNOVColor // Address of optional parameter
}; };
static ColorButton Anchors_Butt = 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 _( "Anchors" ), // Title
ANCHOR_VISIBLE, ANCHOR_VISIBLE,
&g_AnchorColor // Address of optional parameter &g_AnchorColor // Address of optional parameter
......
...@@ -24,14 +24,15 @@ ...@@ -24,14 +24,15 @@
#include "hotkeys.h" #include "hotkeys.h"
#define MUWAVE_ENBL
#define SEL_LAYER_HELP _( \ #define SEL_LAYER_HELP _( \
"Show active layer selections\nand select layer pair for route and place via" ) "Show active layer selections\nand select layer pair for route and place via" )
/* Data to build the layer pair indicator button */ /* Data to build the layer pair indicator button */
static wxBitmap* LayerPairBitmap = NULL; 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 // 0 = draw pixel with active layer color
// 1 = draw pixel with top layer color (top/bottom layer used in // 1 = draw pixel with top layer color (top/bottom layer used in
// autoroute and place via) // autoroute and place via)
...@@ -69,22 +70,19 @@ void WinEDA_PcbFrame::PrepareLayerIndicator() ...@@ -69,22 +70,19 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
previous_Route_Layer_BOTTOM_color, previous_via_color; previous_Route_Layer_BOTTOM_color, previous_via_color;
/* get colors, and redraw bitmap button only on changes */ /* get colors, and redraw bitmap button only on changes */
active_layer_color = active_layer_color = g_DesignSettings.m_LayerColor[((PCB_SCREEN*)GetScreen())->m_Active_Layer];
g_DesignSettings.m_LayerColor[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
if( previous_active_layer_color != active_layer_color ) if( previous_active_layer_color != active_layer_color )
{ {
previous_active_layer_color = active_layer_color; previous_active_layer_color = active_layer_color;
change = true; change = true;
} }
Route_Layer_TOP_color = Route_Layer_TOP_color = g_DesignSettings.m_LayerColor[((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP];
g_DesignSettings.m_LayerColor[( (PCB_SCREEN*) GetScreen() )->m_Route_Layer_TOP];
if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color ) if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color )
{ {
previous_Route_Layer_TOP_color = Route_Layer_TOP_color; previous_Route_Layer_TOP_color = Route_Layer_TOP_color;
change = true; change = true;
} }
Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color = g_DesignSettings.m_LayerColor[((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM];
g_DesignSettings.m_LayerColor[( (PCB_SCREEN*) GetScreen() )->m_Route_Layer_BOTTOM];
if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color ) if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color )
{ {
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() ...@@ -179,7 +177,7 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
/* Creates or updates the main horizontal toolbar for the board editor /* Creates or updates the main horizontal toolbar for the board editor
*/ */
void WinEDA_PcbFrame::ReCreateHToolbar() void WinEDA_PcbFrame::ReCreateHToolbar()
{ {
wxString msg; wxString msg;
...@@ -194,49 +192,48 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -194,49 +192,48 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
m_HToolBar->SetRows( 1 ); m_HToolBar->SetRows( 1 );
#if !defined(KICAD_AUIMANAGER) #if !defined(KICAD_AUIMANAGER)
SetToolBar( (wxToolBar*) m_HToolBar ); SetToolBar( (wxToolBar*)m_HToolBar );
#endif #endif
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, wxBitmap( new_xpm ), m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, wxBitmap( new_xpm ),
_( "New board" ) ); _( "New board" ) );
m_HToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, wxBitmap( open_xpm ), 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 ), m_HToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, wxBitmap( save_xpm ),
_( "Save board" ) ); _( "Save board" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, wxBitmap( sheetset_xpm ), m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, wxBitmap( sheetset_xpm ),
_( "Page settings (size, texts)" ) ); _( "Page settings (size, texts)" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString,
wxBitmap( modedit_xpm ), wxBitmap( modedit_xpm ),
_( "Open module editor" ) ); _( "Open module editor" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_CUT, wxEmptyString, wxBitmap( cut_button ), m_HToolBar->AddTool( wxID_CUT, wxEmptyString, wxBitmap( cut_button ),
_( "Cut selected item" ) ); _( "Cut selected item" ) );
#if 0 #if 0
m_HToolBar->AddTool( wxID_COPY, wxEmptyString, wxBitmap( copy_button ), m_HToolBar->AddTool( wxID_COPY, wxEmptyString, wxBitmap( copy_button ),
_( "Copy selected item" ) ); _( "Copy selected item" ) );
m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, wxBitmap( paste_xpm ), m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, wxBitmap( paste_xpm ),
_( "Paste" ) ); _( "Paste" ) );
#endif #endif
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, wxBitmap( undo_xpm ), m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, wxBitmap( undo_xpm ),
_( "Undo last edition" ) ); _( "Undo last edition" ) );
m_HToolBar->AddTool( wxID_REDO, wxEmptyString, wxBitmap( redo_xpm ), m_HToolBar->AddTool( wxID_REDO, wxEmptyString, wxBitmap( redo_xpm ),
_( "Redo the last undo command" ) ); _( "Redo the last undo command" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ), m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ),
_( "Print board" ) ); _( "Print board" ) );
m_HToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, wxBitmap( plot_xpm ), 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(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom in" ), s_Board_Editor_Hokeys_Descr,
...@@ -268,9 +265,9 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -268,9 +265,9 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ), m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
_( "Read netlist" ) ); _( "Read netlist" ) );
m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, wxBitmap( erc_xpm ), m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, wxBitmap( erc_xpm ),
_( "Perform design rules check" ) ); _( "Perform design rules check" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
...@@ -292,8 +289,8 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -292,8 +289,8 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
// Fast call to FreeROUTE Web Bases router // Fast call to FreeROUTE Web Bases router
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString, m_HToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString,
wxBitmap( web_support_xpm ), wxBitmap( web_support_xpm ),
_( "Fast access to theWeb Based FreeROUTE advanced router" ) ); _( "Fast access to theWeb Based FreeROUTE advanced router" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect // after adding the buttons to the toolbar, must call Realize() to reflect
// the changes // the changes
...@@ -348,18 +345,18 @@ void WinEDA_PcbFrame::ReCreateOptToolbar() ...@@ -348,18 +345,18 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString,
wxBitmap( show_zone_xpm ), wxNullBitmap, wxBitmap( show_zone_xpm ), wxNullBitmap,
_( "Show filled areas in zones" ) ); _( "Show filled areas in zones" ) );
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
wxEmptyString, wxEmptyString,
wxBitmap( show_zone_disable_xpm ), wxBitmap( show_zone_disable_xpm ),
wxNullBitmap, wxNullBitmap,
_( "Do not show filled areas in zones" ) ); _( "Do not show filled areas in zones" ));
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
wxEmptyString, wxEmptyString,
wxBitmap( show_zone_outline_only_xpm ), wxBitmap( show_zone_outline_only_xpm ),
wxNullBitmap, wxNullBitmap,
_( "Show outlines of filled areas only in zones" ) ); _( "Show outlines of filled areas only in zones" ) );
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
...@@ -388,23 +385,17 @@ void WinEDA_PcbFrame::ReCreateOptToolbar() ...@@ -388,23 +385,17 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
_( "Show invisible text" ), _( "Show invisible text" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE, 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->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, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
wxEmptyString, wxEmptyString,
wxBitmap( mw_toolbar_xpm ), 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 ); wxITEM_CHECK );
#endif
m_OptionsToolBar->Realize(); m_OptionsToolBar->Realize();
SetToolbars(); SetToolbars();
...@@ -503,18 +494,18 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar() ...@@ -503,18 +494,18 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar()
// Set up toolbar // Set up toolbar
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString, m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString,
wxBitmap( mw_Add_Line_xpm ), wxBitmap( mw_Add_Line_xpm ),
_( "Create line of specified length for microwave applications" ) ); _( "Create line of specified length for microwave applications" ) );
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_GAP_CMD, wxEmptyString, m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_GAP_CMD, wxEmptyString,
wxBitmap( mw_Add_Gap_xpm ), wxBitmap( mw_Add_Gap_xpm ),
_( "Create gap of specified length for microwave applications" ) ); _( "Create gap of specified length for microwave applications" ) );
m_AuxVToolBar->AddSeparator(); m_AuxVToolBar->AddSeparator();
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_CMD, wxEmptyString, m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_CMD, wxEmptyString,
wxBitmap( mw_Add_Stub_xpm ), wxBitmap( mw_Add_Stub_xpm ),
_( "Create stub of specified length for microwave applications" ) ); _( "Create stub of specified length for microwave applications" ) );
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD, wxEmptyString, m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD, wxEmptyString,
wxBitmap( mw_Add_stub_arc_xpm ), wxBitmap( mw_Add_stub_arc_xpm ),
...@@ -522,8 +513,8 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar() ...@@ -522,8 +513,8 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar()
); );
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD, wxEmptyString, m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD, wxEmptyString,
wxBitmap( mw_Add_Shape_xpm ), wxBitmap( mw_Add_Shape_xpm ),
_( "Create a polynomial shape for microwave applications" ) ); _( "Create a polynomial shape for microwave applications" ) );
m_AuxVToolBar->Realize(); m_AuxVToolBar->Realize();
...@@ -556,17 +547,17 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() ...@@ -556,17 +547,17 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
// Creates box to display and choose tracks widths: // Creates box to display and choose tracks widths:
m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) ); wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox ); m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
// Creates box to display and choose vias diameters: // Creates box to display and choose vias diameters:
m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_VIA_SIZE, ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( (LISTBOX_WIDTH * 12) / 10, -1 ) ); wxSize( (LISTBOX_WIDTH*12)/10, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox ); m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox );
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
...@@ -575,7 +566,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() ...@@ -575,7 +566,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
wxEmptyString, wxPoint( -1, -1 ), wxEmptyString, wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 10, -1 ), wxSize( LISTBOX_WIDTH + 10, -1 ),
wxTE_READONLY ); wxTE_READONLY );
m_ClearanceBox->SetToolTip( _( "Current NetClass clearance value" ) ); m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") );
m_AuxiliaryToolBar->AddControl( m_ClearanceBox ); m_AuxiliaryToolBar->AddControl( m_ClearanceBox );
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
...@@ -584,7 +575,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() ...@@ -584,7 +575,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
wxEmptyString, wxPoint( -1, -1 ), wxEmptyString, wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ), wxSize( LISTBOX_WIDTH, -1 ),
wxTE_READONLY ); wxTE_READONLY );
m_NetClassSelectedBox->SetToolTip( _( "Name of the current NetClass" ) ); m_NetClassSelectedBox->SetToolTip(_("Name of the current NetClass") );
m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox ); m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox );
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
...@@ -593,37 +584,36 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() ...@@ -593,37 +584,36 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
wxEmptyString, wxEmptyString,
wxBitmap( auto_track_width_xpm ), wxBitmap( auto_track_width_xpm ),
_( _( "Auto track width: when starting on \
"Auto track width: when starting on \ an existing track use its width\notherwise, use current width setting" ),
an existing track use its width\notherwise, use current width setting" ),
wxITEM_CHECK ); wxITEM_CHECK );
// Add the box to display and select the current grid size: // Add the box to display and select the current grid size:
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT, ID_ON_GRID_SELECT,
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) ); wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelGridBox ); m_AuxiliaryToolBar->AddControl( m_SelGridBox );
// Add the box to display and select the current Zoom // Add the box to display and select the current Zoom
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_ZOOM_SELECT, ID_ON_ZOOM_SELECT,
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) ); wxSize( LISTBOX_WIDTH, -1 ) );
msg = _( "Auto" ); msg = _( "Auto" );
m_SelZoomBox->Append( msg ); 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 " ); 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; msg << GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar;
else else
{ {
wxString value; wxString value;
value.Printf( wxT( "%.1f" ), value.Printf( wxT( "%.1f" ),
(float) GetScreen()->m_ZoomList[i] / (float)GetScreen()->m_ZoomList[i] /
GetScreen()->m_ZoomScalar ); GetScreen()->m_ZoomScalar );
msg += value; msg += value;
} }
...@@ -638,7 +628,7 @@ an existing track use its width\notherwise, use current width setting" ...@@ -638,7 +628,7 @@ an existing track use its width\notherwise, use current width setting"
// Update displayed values // Update displayed values
m_SelGridBox->Clear(); m_SelGridBox->Clear();
wxString format = _( "Grid" ); wxString format = _( "Grid");
if( g_UnitMetric == INCHES ) if( g_UnitMetric == INCHES )
format += wxT( " %.1f" ); format += wxT( " %.1f" );
else else
...@@ -646,9 +636,9 @@ an existing track use its width\notherwise, use current width setting" ...@@ -646,9 +636,9 @@ an existing track use its width\notherwise, use current width setting"
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ ) for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{ {
GRID_TYPE grid = GetScreen()->m_GridList[i]; GRID_TYPE grid = GetScreen()->m_GridList[i];
double value = To_User_Unit( g_UnitMetric, grid.m_Size.x, double value = To_User_Unit( g_UnitMetric, grid.m_Size.x,
m_InternalUnits ); m_InternalUnits );
if( grid.m_Id != ID_POPUP_GRID_USER ) if( grid.m_Id != ID_POPUP_GRID_USER )
{ {
if( g_UnitMetric == INCHES ) if( g_UnitMetric == INCHES )
...@@ -665,7 +655,7 @@ an existing track use its width\notherwise, use current width setting" ...@@ -665,7 +655,7 @@ an existing track use its width\notherwise, use current width setting"
m_SelGridBox->SetSelection( i ); m_SelGridBox->SetSelection( i );
} }
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
ReCreateLayerBox( NULL ); ReCreateLayerBox( NULL );
SetToolbars(); SetToolbars();
...@@ -679,13 +669,13 @@ void WinEDA_PcbFrame::UpdateToolbarLayerInfo() ...@@ -679,13 +669,13 @@ void WinEDA_PcbFrame::UpdateToolbarLayerInfo()
// Enable the display on the correct layer // Enable the display on the correct layer
// To avoid reentrancy ( Bug wxGTK Linux version? ), the selection is // To avoid reentrancy ( Bug wxGTK Linux version? ), the selection is
// made where it is bad ( corrected on wxGTK 2.6.0 ) // made where it is bad ( corrected on wxGTK 2.6.0 )
int count = m_SelLayerBox->GetCount(); int count = m_SelLayerBox->GetCount();
int choice = m_SelLayerBox->GetChoice(); int choice = m_SelLayerBox->GetChoice();
int layer = GetScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
for( int listNdx = 0; listNdx<count; ++listNdx ) for( int listNdx=0; listNdx<count; ++listNdx )
{ {
if( (int) ( size_t ) m_SelLayerBox->GetClientData( listNdx ) == layer ) if( (int) (size_t) m_SelLayerBox->GetClientData( listNdx ) == layer )
{ {
if( listNdx != choice ) if( listNdx != choice )
m_SelLayerBox->SetSelection( listNdx ); m_SelLayerBox->SetSelection( listNdx );
...@@ -705,11 +695,11 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) ...@@ -705,11 +695,11 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
m_SelLayerBox = new WinEDAChoiceBox( parent, m_SelLayerBox = new WinEDAChoiceBox( parent,
ID_TOOLBARH_PCB_SELECT_LAYER, ID_TOOLBARH_PCB_SELECT_LAYER,
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
#if defined(__UNIX__) #if defined (__UNIX__)
// Width enough for the longest // Width enough for the longest
// string: "Component (Page Down)" // string: "Component (Page Down)"
// Maybe that string is too long? // Maybe that string is too long?
wxSize( 230, -1 ) wxSize( 230, -1 )
#else #else
wxSize( LISTBOX_WIDTH + 30, -1 ) wxSize( LISTBOX_WIDTH + 30, -1 )
...@@ -719,16 +709,20 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) ...@@ -719,16 +709,20 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
parent->AddControl( m_SelLayerBox ); parent->AddControl( m_SelLayerBox );
} }
/*
int layer_mask = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
layer_mask |= ALL_NO_CU_LAYERS;
*/
int layer_mask = g_DesignSettings.GetEnabledLayers(); int layer_mask = g_DesignSettings.GetEnabledLayers();
unsigned length = 0; unsigned length = 0;
m_SelLayerBox->Clear(); 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 // 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_COPPER,
HK_SWITCH_LAYER_TO_INNER1, HK_SWITCH_LAYER_TO_INNER1,
HK_SWITCH_LAYER_TO_INNER2, HK_SWITCH_LAYER_TO_INNER2,
...@@ -752,13 +746,10 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) ...@@ -752,13 +746,10 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
wxString msg = GetBoard()->GetLayerName( layer ); wxString msg = GetBoard()->GetLayerName( layer );
msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr,
HK_SwitchLayer[layer] ); 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 ); 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 ); m_SelLayerBox->SetClientData( listNdx, (void*) layer );
length = MAX( length, msg.Len() ); length = MAX( length, msg.Len() );
listNdx++; listNdx++;
......
...@@ -267,9 +267,9 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -267,9 +267,9 @@ void WinEDA_PcbFrame::SetToolbars()
_( "High contrast display mode" ) ); _( "High contrast display mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_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, 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" ) : _( "Hide invisible text" ) :
_( "Show invisible text" ) ); _( "Show invisible text" ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment