Pcbnew: fix broken board ratsnest visibility storage behavior.

* The board ratsnest visibility state was being saved in both the board file
  and the Pcbnew configuration files causing visibility state issues.  Use the
  board file to save the board ratsnest visibility state.
* Remove all of the board ratsnest save visibility state to configuration file
  code.
* Add code to set the board modified property when layer visibility states
  change to give the user a chance to save the state in the board file.
* Some minor code cleaning and coding policy fixes.
This commit is contained in:
Wayne Stambaugh 2015-10-14 14:12:17 -04:00
parent 014f0eb61f
commit bc6e9e855c
6 changed files with 143 additions and 158 deletions

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr * Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2010-2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -54,7 +54,7 @@
/// This is a read only template that is copied and modified before adding to LAYER_WIDGET /// This is a read only template that is copied and modified before adding to LAYER_WIDGET
const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = { const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width #define RR LAYER_WIDGET::ROW // Render Row abbreviation to reduce source width
// text id color tooltip // text id color tooltip
RR( _( "Through Via" ), VIA_THROUGH_VISIBLE, WHITE, _( "Show through vias" ) ), RR( _( "Through Via" ), VIA_THROUGH_VISIBLE, WHITE, _( "Show through vias" ) ),
@ -85,6 +85,7 @@ static int s_allowed_in_FpEditor[] =
GRID_VISIBLE, MOD_VALUES_VISIBLE, MOD_REFERENCES_VISIBLE GRID_VISIBLE, MOD_VALUES_VISIBLE, MOD_REFERENCES_VISIBLE
}; };
PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner,
int aPointSize, bool aFpEditorMode ) : int aPointSize, bool aFpEditorMode ) :
LAYER_WIDGET( aParent, aFocusOwner, aPointSize ), LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
@ -113,9 +114,6 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwn
} }
/* return true if item aId has meaning in footprint editor mode,
* i.e. is in s_allowed_in_FpEditor and therefore is shown in render panel
*/
bool PCB_LAYER_WIDGET::isAllowedInFpMode( int aId ) bool PCB_LAYER_WIDGET::isAllowedInFpMode( int aId )
{ {
for( unsigned ii = 0; ii < DIM( s_allowed_in_FpEditor ); ii++ ) for( unsigned ii = 0; ii < DIM( s_allowed_in_FpEditor ); ii++ )
@ -125,12 +123,7 @@ bool PCB_LAYER_WIDGET::isAllowedInFpMode( int aId )
return false; return false;
} }
/* return true if item aId has meaning in footprint editor mode,
* i.e. is in s_allowed_in_FpEditor and therefore is shown in render panel
* Note: User layers, which are not paired, are not shown in layers manager.
* However a not listed layer can be reachable in the graphic item proprerties
* dialog.
*/
bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( LAYER_ID aLayer ) bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( LAYER_ID aLayer )
{ {
static LSET allowed = LSET::AllTechMask(); static LSET allowed = LSET::AllTechMask();
@ -140,9 +133,11 @@ bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( LAYER_ID aLayer )
return allowed.test( aLayer ); return allowed.test( aLayer );
} }
void PCB_LAYER_WIDGET::installRightLayerClickHandler() void PCB_LAYER_WIDGET::installRightLayerClickHandler()
{ {
int rowCount = GetLayerRowCount(); int rowCount = GetLayerRowCount();
for( int row=0; row < rowCount; ++row ) for( int row=0; row < rowCount; ++row )
{ {
for( int col=0; col<LYR_COLUMN_COUNT; ++col ) for( int col=0; col<LYR_COLUMN_COUNT; ++col )
@ -250,7 +245,7 @@ void PCB_LAYER_WIDGET::ReFillRender()
ClearRenderRows(); ClearRenderRows();
// Add "Render" tab rows to LAYER_WIDGET, after setting color and checkbox state. // Add "Render" tab rows to LAYER_WIDGET, after setting color and checkbox state.
// Because s_render_rows is created static, we must explicitely call // Because s_render_rows is created static, we must explicitly call
// wxGetTranslation for texts which are internationalized (tool tips // wxGetTranslation for texts which are internationalized (tool tips
// and item names) // and item names)
for( unsigned row=0; row<DIM(s_render_rows); ++row ) for( unsigned row=0; row<DIM(s_render_rows); ++row )
@ -330,15 +325,15 @@ void PCB_LAYER_WIDGET::ReFill()
switch( layer ) switch( layer )
{ {
case F_Cu: case F_Cu:
dsc = _("Front copper layer"); dsc = _( "Front copper layer" );
break; break;
case B_Cu: case B_Cu:
dsc = _("Back copper layer"); dsc = _( "Back copper layer" );
break; break;
default: default:
dsc = _("Inner copper layer"); dsc = _( "Inner copper layer" );
break; break;
} }
@ -356,7 +351,7 @@ void PCB_LAYER_WIDGET::ReFill()
// technical layers are shown in this order: // technical layers are shown in this order:
// Because they are static, wxGetTranslation must be explicitely // Because they are static, wxGetTranslation must be explicitly
// called for tooltips. // called for tooltips.
static const struct { static const struct {
LAYER_ID layerId; LAYER_ID layerId;
@ -382,7 +377,7 @@ void PCB_LAYER_WIDGET::ReFill()
{ B_Fab, _( "Footprint assembly on board's back" ) } { B_Fab, _( "Footprint assembly on board's back" ) }
}; };
for( unsigned i=0; i<DIM(non_cu_seq); ++i ) for( unsigned i=0; i<DIM( non_cu_seq ); ++i )
{ {
LAYER_ID layer = non_cu_seq[i].layerId; LAYER_ID layer = non_cu_seq[i].layerId;
@ -404,6 +399,7 @@ void PCB_LAYER_WIDGET::ReFill()
installRightLayerClickHandler(); installRightLayerClickHandler();
} }
//-----<LAYER_WIDGET callbacks>------------------------------------------- //-----<LAYER_WIDGET callbacks>-------------------------------------------
void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
@ -468,6 +464,7 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal
brd->SetVisibleLayers( visibleLayers ); brd->SetVisibleLayers( visibleLayers );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas(); EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas ) if( galCanvas )
{ {
KIGFX::VIEW* view = galCanvas->GetView(); KIGFX::VIEW* view = galCanvas->GetView();
@ -491,6 +488,14 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{ {
BOARD* brd = myframe->GetBoard(); BOARD* brd = myframe->GetBoard();
LSET visibleLayers = brd->GetVisibleLayers();
visibleLayers.set( aId, isEnabled );
// The layer visibility status is saved in the board file so set the board modified
// state so the user has the option to save the changes.
if( brd->IsElementVisible( aId ) != isEnabled )
myframe->OnModify();
brd->SetElementVisibility( aId, isEnabled ); brd->SetElementVisibility( aId, isEnabled );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas(); EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr * Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2010-2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -35,7 +35,7 @@
/** /**
* Class PCB_LAYER_WIDGET * Class PCB_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they * is here to implement the abstract functions of LAYER_WIDGET so they
* may be tied into the PCB_EDIT_FRAME's data and so we can add a popup * may be tied into the PCB_EDIT_FRAME's data and so we can add a popup
* menu which is specific to PCBNEW's needs. * menu which is specific to PCBNEW's needs.
*/ */
@ -48,7 +48,7 @@ public:
* @param aParent is the parent window * @param aParent is the parent window
* @param aFocusOwner is the window that should be sent the focus after * @param aFocusOwner is the window that should be sent the focus after
* @param aPointSize is the font point size to use within the widget. This * @param aPointSize is the font point size to use within the widget. This
* effectively sets the overal size of the widget via the row height and bitmap * effectively sets the overall size of the widget via the row height and bitmap
* button sizes. * button sizes.
* @param aFpEditorMode false for the board editor (default), true for fp editor * @param aFpEditorMode false for the board editor (default), true for fp editor
* when true, some options or layers which cannot be used in editor mode are not * when true, some options or layers which cannot be used in editor mode are not
@ -132,6 +132,10 @@ protected:
/** /**
* Function isLayerAllowedInFpMode * Function isLayerAllowedInFpMode
*
* User layers, which are not paired, are not shown in layers manager. However a not
* listed layer can be reachable in the graphic item properties dialog.
*
* @param aLayer is the layer id to test * @param aLayer is the layer id to test
* @return true if LAYER_ID aLayer has meaning in footprint editor mode. * @return true if LAYER_ID aLayer has meaning in footprint editor mode.
* and therefore is shown in render panel * and therefore is shown in render panel

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -42,6 +42,7 @@
#include <collectors.h> #include <collectors.h>
#include <dialog_general_options.h> #include <dialog_general_options.h>
DIALOG_GENERALOPTIONS::DIALOG_GENERALOPTIONS( PCB_EDIT_FRAME* parent ) : DIALOG_GENERALOPTIONS::DIALOG_GENERALOPTIONS( PCB_EDIT_FRAME* parent ) :
DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( parent ) DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( parent )
{ {
@ -89,10 +90,8 @@ void DIALOG_GENERALOPTIONS::init()
m_OptMiddleButtonPanLimited->Enable( m_MiddleButtonPANOpt->GetValue() ); m_OptMiddleButtonPanLimited->Enable( m_MiddleButtonPANOpt->GetValue() );
m_AutoPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableAutoPan() ); m_AutoPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableAutoPan() );
m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild ); m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild );
m_MagneticPadOptCtrl->SetSelection( g_MagneticPadOption ); m_MagneticPadOptCtrl->SetSelection( g_MagneticPadOption );
m_MagneticTrackOptCtrl->SetSelection( g_MagneticTrackOption ); m_MagneticTrackOptCtrl->SetSelection( g_MagneticTrackOption );
m_DumpZonesWhenFilling->SetValue ( g_DumpZonesWhenFilling ); m_DumpZonesWhenFilling->SetValue ( g_DumpZonesWhenFilling );
} }
@ -127,8 +126,9 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() ) if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() )
{ {
GetParent()->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() ); GetParent()->SetElementVisibility( RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() );
GetParent()->GetCanvas()->Refresh( ); GetParent()->GetCanvas()->Refresh();
GetParent()->OnModify();
} }
displ_opts->m_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue(); displ_opts->m_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
@ -148,104 +148,3 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
EndModal( wxID_OK ); EndModal( wxID_OK );
} }
/* Must be called on a click on the left toolbar (options toolbar
* Update variables according to tools states
*/
void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
bool state = event.IsChecked();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
switch( id )
{
case ID_TB_OPTIONS_DRC_OFF:
g_Drc_On = !state;
if( GetToolId() == ID_TRACK_BUTT )
{
if( g_Drc_On )
m_canvas->SetCursor( wxCURSOR_PENCIL );
else
m_canvas->SetCursor( wxCURSOR_QUESTION_ARROW );
}
break;
case ID_TB_OPTIONS_SHOW_RATSNEST:
SetElementVisibility( RATSNEST_VISIBLE, state );
if( state && (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
Compile_Ratsnest( NULL, true );
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
displ_opts->m_Show_Module_Ratsnest = state; // TODO: see if we can use the visibility list
break;
case ID_TB_OPTIONS_AUTO_DEL_TRACK:
g_AutoDeleteOldTrack = state;
break;
case ID_TB_OPTIONS_SHOW_ZONES:
displ_opts->m_DisplayZonesMode = 0;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
displ_opts->m_DisplayZonesMode = 1;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
displ_opts->m_DisplayZonesMode = 2;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
displ_opts->m_DisplayViaFill = !state;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
displ_opts->m_DisplayPcbTrackFill = !state;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
{
displ_opts->m_ContrastModeDisplay = state;
m_canvas->Refresh();
break;
}
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE:
m_show_microwave_tools = state;
m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools );
m_auimgr.Update();
GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR,
m_show_microwave_tools ?
_( "Hide Microwave Toolbar" ): _( "Show Microwave Toolbar" ));
break;
case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR:
// show auxiliary Vertical layers and visibility manager toolbar
m_show_layer_manager_tools = state;
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update();
GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
m_show_layer_manager_tools ?
_( "Hide &Layers Manager" ) : _( "Show &Layers Manager" ) );
break;
default:
DisplayError( this,
wxT( "PCB_EDIT_FRAME::OnSelectOptionToolbar error \n (event not handled!)" ) );
break;
}
}

View File

@ -4,7 +4,7 @@
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2013 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2013-2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -82,7 +82,6 @@
// Keys used in read/write config // Keys used in read/write config
#define OPTKEY_DEFAULT_LINEWIDTH_VALUE wxT( "PlotLineWidth_mm" ) #define OPTKEY_DEFAULT_LINEWIDTH_VALUE wxT( "PlotLineWidth_mm" )
#define PCB_SHOW_FULL_RATSNET_OPT wxT( "PcbFullRatsnest" )
#define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" ) #define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" )
#define PCB_MAGNETIC_TRACKS_OPT wxT( "PcbMagTrackOpt" ) #define PCB_MAGNETIC_TRACKS_OPT wxT( "PcbMagTrackOpt" )
#define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" ) #define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" )
@ -740,11 +739,6 @@ void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
g_DrawDefaultLineThickness = Millimeter2iu( dtmp ); g_DrawDefaultLineThickness = Millimeter2iu( dtmp );
long tmp;
aCfg->Read( PCB_SHOW_FULL_RATSNET_OPT, &tmp );
GetBoard()->SetElementVisibility(RATSNEST_VISIBLE, tmp);
aCfg->Read( PCB_MAGNETIC_PADS_OPT, &g_MagneticPadOption ); aCfg->Read( PCB_MAGNETIC_PADS_OPT, &g_MagneticPadOption );
aCfg->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption ); aCfg->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption );
aCfg->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools ); aCfg->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools );
@ -759,10 +753,7 @@ void PCB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); wxConfigSaveSetups( aCfg, GetConfigurationSettings() );
// This value is stored in mm ) // This value is stored in mm )
aCfg->Write( OPTKEY_DEFAULT_LINEWIDTH_VALUE, aCfg->Write( OPTKEY_DEFAULT_LINEWIDTH_VALUE, MM_PER_IU * g_DrawDefaultLineThickness );
MM_PER_IU * g_DrawDefaultLineThickness );
long tmp = GetBoard()->IsElementVisible(RATSNEST_VISIBLE);
aCfg->Write( PCB_SHOW_FULL_RATSNET_OPT, tmp );
aCfg->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption ); aCfg->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption );
aCfg->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption ); aCfg->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption );
aCfg->Write( SHOW_MICROWAVE_TOOLS, (long) m_show_microwave_tools ); aCfg->Write( SHOW_MICROWAVE_TOOLS, (long) m_show_microwave_tools );

View File

@ -3,8 +3,8 @@
* *
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012=2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -36,6 +36,8 @@
#include <class_layer_box_selector.h> #include <class_layer_box_selector.h>
#include <colors_selection.h> #include <colors_selection.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <class_board.h> #include <class_board.h>
@ -87,8 +89,6 @@ static const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE] =
}; };
/* Draw the icon for the "Select layer pair" bitmap tool
*/
void PCB_EDIT_FRAME::PrepareLayerIndicator() void PCB_EDIT_FRAME::PrepareLayerIndicator()
{ {
int ii, jj; int ii, jj;
@ -199,8 +199,6 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
} }
/* Creates or updates the main horizontal toolbar for the board editor
*/
void PCB_EDIT_FRAME::ReCreateHToolbar() void PCB_EDIT_FRAME::ReCreateHToolbar()
{ {
wxString msg; wxString msg;
@ -411,8 +409,6 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
} }
/* Create the main vertical right toolbar, showing usual tools
*/
void PCB_EDIT_FRAME::ReCreateVToolbar() void PCB_EDIT_FRAME::ReCreateVToolbar()
{ {
if( m_drawToolBar ) if( m_drawToolBar )
@ -533,15 +529,6 @@ void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar()
} }
/* Creates auxiliary horizontal toolbar
* displays:
* existing track width choice
* selection for auto track width
* existing via size choice
* Current strategy (to choose the track and via sizes)
* grid size choice
* zoom level choice
*/
void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar() void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
{ {
wxString msg; wxString msg;
@ -590,8 +577,8 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
m_auxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, m_auxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
wxEmptyString, wxEmptyString,
KiBitmap( auto_track_width_xpm ), KiBitmap( auto_track_width_xpm ),
_( "Auto track width: when starting on \ _( "Auto track width: when starting on an existing track "
an existing track use its width\notherwise, use current width setting" ), "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:
@ -614,7 +601,6 @@ an existing track use its width\notherwise, use current width setting" ),
// after adding the buttons to the toolbar, must call Realize() // after adding the buttons to the toolbar, must call Realize()
m_auxiliaryToolBar->Realize(); m_auxiliaryToolBar->Realize();
// m_auxiliaryToolBar->AddSeparator();
} }
@ -729,3 +715,102 @@ void PCB_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar )
m_auimgr.Update(); m_auimgr.Update();
} }
} }
void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
bool state = event.IsChecked();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
switch( id )
{
case ID_TB_OPTIONS_DRC_OFF:
g_Drc_On = !state;
if( GetToolId() == ID_TRACK_BUTT )
{
if( g_Drc_On )
m_canvas->SetCursor( wxCURSOR_PENCIL );
else
m_canvas->SetCursor( wxCURSOR_QUESTION_ARROW );
}
break;
case ID_TB_OPTIONS_SHOW_RATSNEST:
SetElementVisibility( RATSNEST_VISIBLE, state );
OnModify();
if( state && (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
Compile_Ratsnest( NULL, true );
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
displ_opts->m_Show_Module_Ratsnest = state; // TODO: see if we can use the visibility list
break;
case ID_TB_OPTIONS_AUTO_DEL_TRACK:
g_AutoDeleteOldTrack = state;
break;
case ID_TB_OPTIONS_SHOW_ZONES:
displ_opts->m_DisplayZonesMode = 0;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
displ_opts->m_DisplayZonesMode = 1;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
displ_opts->m_DisplayZonesMode = 2;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
displ_opts->m_DisplayViaFill = !state;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
displ_opts->m_DisplayPcbTrackFill = !state;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
{
displ_opts->m_ContrastModeDisplay = state;
m_canvas->Refresh();
break;
}
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE:
m_show_microwave_tools = state;
m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools );
m_auimgr.Update();
GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR,
m_show_microwave_tools ?
_( "Hide Microwave Toolbar" ): _( "Show Microwave Toolbar" ));
break;
case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR:
// show auxiliary Vertical layers and visibility manager toolbar
m_show_layer_manager_tools = state;
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update();
GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
m_show_layer_manager_tools ?
_( "Hide &Layers Manager" ) : _( "Show &Layers Manager" ) );
break;
default:
DisplayError( this,
wxT( "PCB_EDIT_FRAME::OnSelectOptionToolbar error \n (event not handled!)" ) );
break;
}
}

View File

@ -4,7 +4,7 @@
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2012-2015 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -114,6 +114,7 @@ void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent )
aEvent.Check( pythonPanelShown ); aEvent.Check( pythonPanelShown );
} }
void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent )
{ {
int selected = aEvent.GetId() - ID_TB_OPTIONS_SHOW_ZONES; int selected = aEvent.GetId() - ID_TB_OPTIONS_SHOW_ZONES;