Commit 920186dd authored by dickelbeck's avatar dickelbeck

more layer widget incorporation

parent 2bae7624
......@@ -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) );
}
......
......@@ -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
......
......@@ -67,28 +67,17 @@ protected:
{
}
//-----<implement LAYER_WIDGET abstract functions>---
//-----<implement LAYER_WIDGET abstract callback functions>-----------
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 );
//-----</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
/**
* 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 );
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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();
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 );
}
......
......@@ -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 );
......
......@@ -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 );
}
//-----<public>-------------------------------------------------------
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)
......
......@@ -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();
}
*/
//-----<abstract functions>-------------------------------------------
/**
......
......@@ -190,7 +190,7 @@
<property name="tooltip"></property>
<property name="window_extra_style"></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="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
......@@ -307,7 +307,7 @@
<property name="tooltip"></property>
<property name="window_extra_style"></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="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
......
......@@ -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; 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)
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();
}
//-----</LAYER_WIDGET callbacks>------------------------------------------
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; 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 )
if( returncode == wxID_OK ) // New rules, or others changes.
{
ReCreateLayerBox( NULL );
// ReFillLayerWidget(); why?
GetScreen()->SetModify();
}
}
......
......@@ -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.
......
......@@ -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
......
This diff is collapsed.
......@@ -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" ) );
......
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