Commit cf7ad0f5 authored by charras's avatar charras

pcbnew: More about work on color selection and items visibility

parent 560970da
...@@ -4,6 +4,12 @@ KiCad ChangeLog 2010 ...@@ -4,6 +4,12 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2010-Jan-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++ pcbnew:
More about work on color selection and items visibility
work in progress
2010-Jan-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2010-Jan-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
++ All: ++ All:
...@@ -17,7 +23,7 @@ email address. ...@@ -17,7 +23,7 @@ email address.
Now a test is made, and if there are problems relative to floats Now a test is made, and if there are problems relative to floats
(write/read conversion error), (write/read conversion error),
use the C convention (always a point as separator) use the C convention (always a point as separator)
++ eeschema: ++ eeschema:
Removed metrics grid values, that cannot be handled in schematic. Removed metrics grid values, that cannot be handled in schematic.
(because 2 items are seen as connected if they have the same coordinates (because 2 items are seen as connected if they have the same coordinates
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
/****************************************************/ /****************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "colors.h" #include "colors.h"
#include "macros.h"
#include "class_colors_design_settings.h" #include "class_colors_design_settings.h"
...@@ -64,10 +65,10 @@ static const int default_items_color[LAYERSCOLORSBUFFERSIZE] = ...@@ -64,10 +65,10 @@ static const int default_items_color[LAYERSCOLORSBUFFERSIZE] =
COLORS_DESIGN_SETTINGS:: COLORS_DESIGN_SETTINGS() COLORS_DESIGN_SETTINGS:: COLORS_DESIGN_SETTINGS()
{ {
for( unsigned ii = 0; ii < LAYERSCOLORSBUFFERSIZE; ii++ ) for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
m_LayersColors[ii] = default_layer_color[ii]; m_LayersColors[ii] = default_layer_color[ii];
for( unsigned ii = 0; ii < ITEMSCOLORSBUFFERSIZE; ii++ ) for( unsigned ii = 0; ii < DIM(m_ItemsColors); ii++ )
m_ItemsColors[ii] = default_items_color[ii]; m_ItemsColors[ii] = default_items_color[ii];
} }
...@@ -79,7 +80,7 @@ COLORS_DESIGN_SETTINGS:: COLORS_DESIGN_SETTINGS() ...@@ -79,7 +80,7 @@ COLORS_DESIGN_SETTINGS:: COLORS_DESIGN_SETTINGS()
*/ */
int COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer ) int COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer )
{ {
if( (unsigned) aLayer < LAYERSCOLORSBUFFERSIZE ) if( (unsigned) aLayer < DIM(m_LayersColors) )
{ {
return m_LayersColors[aLayer]; return m_LayersColors[aLayer];
} }
...@@ -94,7 +95,7 @@ int COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer ) ...@@ -94,7 +95,7 @@ int COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer )
*/ */
void COLORS_DESIGN_SETTINGS:: SetLayerColor( int aLayer, int aColor ) void COLORS_DESIGN_SETTINGS:: SetLayerColor( int aLayer, int aColor )
{ {
if( (unsigned) aLayer < LAYERSCOLORSBUFFERSIZE ) if( (unsigned) aLayer < DIM(m_LayersColors) )
{ {
m_LayersColors[aLayer] = aColor; m_LayersColors[aLayer] = aColor;
} }
...@@ -108,7 +109,7 @@ void COLORS_DESIGN_SETTINGS:: SetLayerColor( int aLayer, int aColor ) ...@@ -108,7 +109,7 @@ void COLORS_DESIGN_SETTINGS:: SetLayerColor( int aLayer, int aColor )
*/ */
int COLORS_DESIGN_SETTINGS:: GetItemColor( int aItemIdx ) int COLORS_DESIGN_SETTINGS:: GetItemColor( int aItemIdx )
{ {
if( (unsigned) aItemIdx < ITEMSCOLORSBUFFERSIZE ) if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
{ {
return m_ItemsColors[aItemIdx]; return m_ItemsColors[aItemIdx];
} }
...@@ -123,7 +124,7 @@ int COLORS_DESIGN_SETTINGS:: GetItemColor( int aItemIdx ) ...@@ -123,7 +124,7 @@ int COLORS_DESIGN_SETTINGS:: GetItemColor( int aItemIdx )
*/ */
void COLORS_DESIGN_SETTINGS:: SetItemColor( int aItemIdx, int aColor ) void COLORS_DESIGN_SETTINGS:: SetItemColor( int aItemIdx, int aColor )
{ {
if( (unsigned) aItemIdx < ITEMSCOLORSBUFFERSIZE ) if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
{ {
m_ItemsColors[aItemIdx] = aColor; m_ItemsColors[aItemIdx] = aColor;
} }
......
...@@ -96,8 +96,11 @@ protected: ...@@ -96,8 +96,11 @@ protected:
* <p> * <p>
* This function cannot be inline without including layer_widget.h in * This function cannot be inline without including layer_widget.h in
* here and we do not want to do that. * here and we do not want to do that.
* @param aRenderOnly: true to update render only, false (default) for full update
* if aRenderOnly = true, the page displayed by the layer manager is not changed
* if aRenderOnly = false, the page displayed after update is the layers list
*/ */
void syncLayerWidget(); void syncLayerWidget(bool aRenderOnly = false);
/** /**
* Function syncLayerBox * Function syncLayerBox
......
...@@ -390,7 +390,27 @@ void BOARD::SetVisibleLayers( int aLayerMask ) ...@@ -390,7 +390,27 @@ void BOARD::SetVisibleLayers( int aLayerMask )
void BOARD::SetVisibleElements( int aMask ) void BOARD::SetVisibleElements( int aMask )
{ {
m_BoardSettings->SetVisibleElements( aMask ); /* Call SetElementVisibility for each item,
* to ensure specific calculations that can be needed by some items
*/
for( int ii = 0; ii < PCB_VISIBLE(END_PCB_VISIBLE_LIST); ii++ )
{
int item_mask = 1 << ii;
SetElementVisibility( ii, aMask & item_mask );
}
}
// these are not tidy, since there are PCB_VISIBLEs that are not stored in the bitmap.
void BOARD::SetVisibleAlls( )
{
SetVisibleLayers( FULL_LAYERS );
/* Call SetElementVisibility for each item,
* to ensure specific calculations that can be needed by some items
*/
for( int ii = 0; ii < PCB_VISIBLE(END_PCB_VISIBLE_LIST); ii++ )
{
SetElementVisibility( ii, true );
}
} }
...@@ -420,11 +440,29 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled ) ...@@ -420,11 +440,29 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
{ {
switch( aPCB_VISIBLE ) switch( aPCB_VISIBLE )
{ {
/*
case GRID_VISIBLE: case GRID_VISIBLE:
myframe->m_Draw_Grid = isEnabled; m_PcbFrame->m_Draw_Grid = isEnabled;
m_BoardSettings->SetElementVisibility( aPCB_VISIBLE, isEnabled );
break; break;
*/
case RATSNEST_VISIBLE:
m_BoardSettings->SetElementVisibility( aPCB_VISIBLE, isEnabled );
// we must clear or set the CH_VISIBLE flags to hide/show ratsnet
// because we have a tool to show hide ratsnest relative to a pad or a module
// so the hide/show option is a per item selection
if( IsElementVisible(RATSNEST_VISIBLE) )
{
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
}
else
{
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
}
break;
default: default:
m_BoardSettings->SetElementVisibility( aPCB_VISIBLE, isEnabled ); m_BoardSettings->SetElementVisibility( aPCB_VISIBLE, isEnabled );
...@@ -478,20 +516,6 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor ) ...@@ -478,20 +516,6 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor )
g_ColorsSettings.SetItemColor( aPCB_VISIBLE, aColor ); g_ColorsSettings.SetItemColor( aPCB_VISIBLE, aColor );
break; break;
case RATSNEST_VISIBLE: case RATSNEST_VISIBLE:
// we must clear or set the CH_VISIBLE flags to hide/show ratsnet
// because we have atool to show hide ratsnest relative to a pad or a module
// so the hide/show option is a per item selection
if( IsElementVisible(RATSNEST_VISIBLE) )
{
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
}
else
{
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
}
g_ColorsSettings.SetItemColor( aPCB_VISIBLE, aColor ); g_ColorsSettings.SetItemColor( aPCB_VISIBLE, aColor );
break; break;
......
...@@ -304,6 +304,13 @@ public: ...@@ -304,6 +304,13 @@ public:
*/ */
void SetVisibleElements( int aMask ); void SetVisibleElements( int aMask );
/**
* Function SetVisibleAlls
* changes the bit-mask of visible element categories and layers
* @see enum PCB_VISIBLE
*/
void SetVisibleAlls( );
/** /**
* Function IsElementVisible * Function IsElementVisible
* tests whether a given element category is visible. Keep this as an * tests whether a given element category is visible. Keep this as an
......
...@@ -150,26 +150,29 @@ void WinEDA_ModuleEditFrame::InstallOptionsFrame( const wxPoint& pos ) ...@@ -150,26 +150,29 @@ void WinEDA_ModuleEditFrame::InstallOptionsFrame( const wxPoint& pos )
void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
bool state = m_OptionsToolBar->GetToolState( id );
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_DRC_OFF: case ID_TB_OPTIONS_DRC_OFF:
Drc_On = m_OptionsToolBar->GetToolState( id ) ? FALSE : true; Drc_On = state ? FALSE : true;
break; break;
case ID_TB_OPTIONS_SHOW_GRID: case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = m_OptionsToolBar->GetToolState( id ); GetBoard()->SetElementVisibility(GRID_VISIBLE, state);
syncLayerWidget( true );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case ID_TB_OPTIONS_SHOW_RATSNEST: case ID_TB_OPTIONS_SHOW_RATSNEST:
GetBoard()->SetElementVisibility(RATSNEST_VISIBLE, m_OptionsToolBar->GetToolState( id )); GetBoard()->SetElementVisibility(RATSNEST_VISIBLE, state);
syncLayerWidget( true );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST: case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
g_Show_Module_Ratsnest = m_OptionsToolBar->GetToolState( id ); g_Show_Module_Ratsnest = state; // TODO: use the visibility list
syncLayerWidget( true );
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_MM: case ID_TB_OPTIONS_SELECT_UNIT_MM:
...@@ -186,16 +189,16 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -186,16 +189,16 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
case ID_TB_OPTIONS_SHOW_POLAR_COORD: case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message( wxEmptyString ); Affiche_Message( wxEmptyString );
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id ); DisplayOpt.DisplayPolarCood = state;
UpdateStatusBar(); UpdateStatusBar();
break; break;
case ID_TB_OPTIONS_SELECT_CURSOR: case ID_TB_OPTIONS_SELECT_CURSOR:
m_CursorShape = m_OptionsToolBar->GetToolState( id ); m_CursorShape = state;
break; break;
case ID_TB_OPTIONS_AUTO_DEL_TRACK: case ID_TB_OPTIONS_AUTO_DEL_TRACK:
g_AutoDeleteOldTrack = m_OptionsToolBar->GetToolState( id ); g_AutoDeleteOldTrack = state;
break; break;
case ID_TB_OPTIONS_SHOW_ZONES: case ID_TB_OPTIONS_SHOW_ZONES:
...@@ -214,7 +217,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -214,7 +217,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_PADS_SKETCH: case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
if( m_OptionsToolBar->GetToolState( id ) ) if( state )
{ {
m_DisplayPadFill = DisplayOpt.DisplayPadFill = false; m_DisplayPadFill = DisplayOpt.DisplayPadFill = false;
} }
...@@ -226,7 +229,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -226,7 +229,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
if( m_OptionsToolBar->GetToolState( id ) ) if( state )
{ {
m_DisplayViaFill = DisplayOpt.DisplayViaFill = false; m_DisplayViaFill = DisplayOpt.DisplayViaFill = false;
} }
...@@ -238,19 +241,17 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -238,19 +241,17 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH: case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = !state;
!m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE: case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
DisplayOpt.ContrastModeDisplay = DisplayOpt.ContrastModeDisplay = state;
m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1: case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1:
m_show_microwave_tools = m_OptionsToolBar->GetToolState( id ); m_show_microwave_tools = state;
#if !defined(KICAD_AUIMANAGER) #if !defined(KICAD_AUIMANAGER)
// show auxiliary Vertical toolbar (Microwave tool) // show auxiliary Vertical toolbar (Microwave tool)
m_AuxVToolBar->Show(m_show_microwave_tools); m_AuxVToolBar->Show(m_show_microwave_tools);
...@@ -267,7 +268,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -267,7 +268,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR: case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR:
#if defined(KICAD_AUIMANAGER) #if defined(KICAD_AUIMANAGER)
// show auxiliary Vertical layers and visibility manager toolbar // show auxiliary Vertical layers and visibility manager toolbar
m_show_layer_manager_tools = m_OptionsToolBar->GetToolState( id ); m_show_layer_manager_tools = state;
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update(); m_auimgr.Update();
if( m_show_layer_manager_tools ) if( m_show_layer_manager_tools )
......
...@@ -259,6 +259,7 @@ this file again.")); ...@@ -259,6 +259,7 @@ this file again."));
ReCreateLayerBox( NULL ); ReCreateLayerBox( NULL );
AuxiliaryToolBar_Update_UI(); AuxiliaryToolBar_Update_UI();
syncLayerWidget( );
// Display the loaded board: // Display the loaded board:
Zoom_Automatique( false ); Zoom_Automatique( false );
......
...@@ -85,6 +85,9 @@ public: ...@@ -85,6 +85,9 @@ public:
PCB_LAYER_WIDGET( WinEDA_PcbFrame* aParent, wxWindow* aFocusOwner, int aPointSize = 10 ); PCB_LAYER_WIDGET( WinEDA_PcbFrame* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
void ReFill(); void ReFill();
// Update Show/hide checkbox state in render page
// must be called when a Show/hide option is changed outside the layer manager
void RenderSynchronize( );
//-----<implement LAYER_WIDGET abstract callback functions>----------- //-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( int aLayer, int aColor ); void OnLayerColorChange( int aLayer, int aColor );
...@@ -315,6 +318,33 @@ void PCB_LAYER_WIDGET::ReFill() ...@@ -315,6 +318,33 @@ void PCB_LAYER_WIDGET::ReFill()
// m_Layers->Thaw(); // m_Layers->Thaw();
} }
// Update the checkboxes state of each row of the render.
void PCB_LAYER_WIDGET::RenderSynchronize( )
{
BOARD* brd = myframe->GetBoard();
wxSizerItemList& sizerslist = m_RenderFlexGridSizer->GetChildren();
for( unsigned ii=0; ii< PCB_VISIBLE(END_PCB_VISIBLE_LIST); ++ii )
{
unsigned idx = ii * m_RenderFlexGridSizer->GetCols();
// idx points the first size of a m_RenderFlexGridSizer row
// the checkbox to update is managed by the second sizer
idx = idx + 1;
if( idx >= sizerslist.size() )
break; // Should not occur
// Get the sizer that manages the check box to update
wxSizerItem * sizer = sizerslist[idx];
// Get the checkbox and update its state.
wxCheckBox* cb = (wxCheckBox*)sizer->GetWindow();
if( cb )
{
// Calculate the visible item id
int id = getDecodedId(cb->GetId());
cb->SetValue(brd->IsElementVisible(id));
}
}
}
//-----<LAYER_WIDGET callbacks>------------------------------------------- //-----<LAYER_WIDGET callbacks>-------------------------------------------
...@@ -330,6 +360,9 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer ) ...@@ -330,6 +360,9 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
// false from this function. // false from this function.
myframe->setActiveLayer( aLayer, false ); myframe->setActiveLayer( aLayer, false );
myframe->syncLayerBox(); myframe->syncLayerBox();
if(DisplayOpt.ContrastModeDisplay)
myframe->DrawPanel->Refresh();
return true; return true;
} }
...@@ -362,14 +395,11 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) ...@@ -362,14 +395,11 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
/* @todo: /* @todo:
1) move: move:
RATSNEST_VISIBLE,
GRID_VISIBLE, ? maybe not this one GRID_VISIBLE, ? maybe not this one
into m_VisibleElements and get rid of globals. into m_VisibleElements and get rid of globals.
*/
2) Add IsElementVisible() & SetVisibleElement() to class BOARD
*/
switch( aId ) switch( aId )
{ {
...@@ -378,7 +408,7 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) ...@@ -378,7 +408,7 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
case GRID_VISIBLE: case GRID_VISIBLE:
// @todo, make read/write accessors for grid control so the write accessor can fire updates to // @todo, make read/write accessors for grid control so the write accessor can fire updates to
// grid state listeners. I think the grid state should be kept in the BOARD. // grid state listeners. I think the grid state should be kept in the BOARD.
myframe->m_Draw_Grid = isEnabled; brd->SetElementVisibility( aId, isEnabled ); // set visibilty flag also in list, and myframe->m_Draw_Grid
break; break;
default: default:
...@@ -643,6 +673,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -643,6 +673,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
if( DrawPanel ) if( DrawPanel )
DrawPanel->m_Block_Enable = true; DrawPanel->m_Block_Enable = true;
ReCreateMenuBar(); ReCreateMenuBar();
ReCreateHToolbar(); ReCreateHToolbar();
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
...@@ -718,8 +749,8 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -718,8 +749,8 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_AuxVToolBar->Show(m_show_microwave_tools); m_AuxVToolBar->Show(m_show_microwave_tools);
#endif #endif
SetToolbars();
ReFillLayerWidget(); // this is near end because contents establish size ReFillLayerWidget(); // this is near end because contents establish size
syncLayerWidget(); syncLayerWidget();
} }
...@@ -845,6 +876,10 @@ void WinEDA_PcbFrame::LoadSettings() ...@@ -845,6 +876,10 @@ void WinEDA_PcbFrame::LoadSettings()
config->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption ); config->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption );
config->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools ); config->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools );
config->Read( SHOW_LAYER_MANAGER_TOOLS, &m_show_layer_manager_tools ); config->Read( SHOW_LAYER_MANAGER_TOOLS, &m_show_layer_manager_tools );
// Copy grid visibility (set by LoadSetting() in visibility items list:
GetBoard()->SetElementVisibility(GRID_VISIBLE, m_Draw_Grid);
} }
...@@ -870,8 +905,10 @@ void WinEDA_PcbFrame::SaveSettings() ...@@ -870,8 +905,10 @@ void WinEDA_PcbFrame::SaveSettings()
} }
void WinEDA_PcbFrame::syncLayerWidget() void WinEDA_PcbFrame::syncLayerWidget( bool aRenderOnly)
{ {
m_Layers->SelectLayer( getActiveLayer() ); if( ! aRenderOnly )
m_Layers->SelectLayer( getActiveLayer() );
m_Layers->RenderSynchronize( );
} }
...@@ -191,9 +191,14 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName ) ...@@ -191,9 +191,14 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
/* Reset the items visibility flag when loading a new config /* Reset the items visibility flag when loading a new config
* Because it could creates SERIOUS mistakes for the user, * Because it could creates SERIOUS mistakes for the user,
* if some items are not visible after loading a board... * if board items are not visible after loading a board...
* Grid and ratsnest can be left to their previous state
*/ */
GetBoard()->m_BoardSettings->SetVisibleAlls( ); bool showGrid = GetBoard()->IsElementVisible(GRID_VISIBLE);
bool showRats = GetBoard()->IsElementVisible(RATSNEST_VISIBLE);
GetBoard()->SetVisibleAlls( );
GetBoard()->SetElementVisibility(GRID_VISIBLE, showGrid);
GetBoard()->SetElementVisibility(RATSNEST_VISIBLE, showRats);
DisplayOpt.DisplayPadNoConn = true; DisplayOpt.DisplayPadNoConn = true;
return TRUE; return TRUE;
......
...@@ -203,10 +203,9 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -203,10 +203,9 @@ void WinEDA_PcbFrame::SetToolbars()
_( "Display rectangular coordinates" ) : _( "Display rectangular coordinates" ) :
_( "Display polar coordinates" ) ); _( "Display polar coordinates" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, GetBoard()->IsElementVisible(GRID_VISIBLE) );
m_Draw_Grid );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ? GetBoard()->IsElementVisible(GRID_VISIBLE) ?
_( "Hide grid" ) : _( "Hide grid" ) :
_( "Show grid" ) ); _( "Show grid" ) );
......
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