2011-12-16 13:32:23 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-06-05 18:16:07 +00:00
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2012-06-08 09:56:42 +00:00
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2018-11-28 14:58:41 +00:00
|
|
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
|
2023-06-05 18:16:07 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-12-16 13:32:23 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2020-10-02 12:29:17 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2021-07-26 17:56:11 +00:00
|
|
|
#include <advanced_config.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <bitmaps.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
2021-06-06 19:03:10 +00:00
|
|
|
#include <board_design_settings.h>
|
2021-09-14 22:45:14 +00:00
|
|
|
#include <kiface_base.h>
|
2021-03-20 15:35:37 +00:00
|
|
|
#include <macros.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <pcb_layer_box_selector.h>
|
|
|
|
#include <pcbnew_id.h>
|
|
|
|
#include <pcbnew_settings.h>
|
|
|
|
#include <pgm_base.h>
|
2020-06-23 10:44:39 +00:00
|
|
|
#include <router/pns_routing_settings.h>
|
|
|
|
#include <router/router_tool.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <settings/color_settings.h>
|
2019-06-09 21:57:23 +00:00
|
|
|
#include <tool/action_toolbar.h>
|
2019-05-14 19:21:10 +00:00
|
|
|
#include <tool/actions.h>
|
2020-10-05 19:26:33 +00:00
|
|
|
#include <tool/common_tools.h>
|
2020-06-23 10:44:39 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <tools/pcb_actions.h>
|
2020-12-16 13:31:32 +00:00
|
|
|
#include <tools/pcb_selection_tool.h>
|
2021-08-20 01:15:14 +00:00
|
|
|
#include <widgets/appearance_controls.h>
|
2022-11-27 23:23:07 +00:00
|
|
|
#include <widgets/pcb_properties_panel.h>
|
2022-09-14 02:59:57 +00:00
|
|
|
#include <widgets/pcb_search_pane.h>
|
2021-08-20 01:15:14 +00:00
|
|
|
#include <widgets/wx_aui_utils.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <wx/wupdlock.h>
|
2021-05-01 07:50:29 +00:00
|
|
|
#include <wx/dcmemory.h>
|
2023-03-09 23:49:01 +00:00
|
|
|
#include <wx/combobox.h>
|
2011-09-16 18:54:04 +00:00
|
|
|
|
2021-03-08 14:54:22 +00:00
|
|
|
#include "../scripting/python_scripting.h"
|
2015-07-09 16:44:23 +00:00
|
|
|
|
2011-09-16 18:54:04 +00:00
|
|
|
|
2007-06-13 15:35:40 +00:00
|
|
|
/* Data to build the layer pair indicator button */
|
2018-01-08 04:05:03 +00:00
|
|
|
static std::unique_ptr<wxBitmap> LayerPairBitmap;
|
2007-09-11 04:17:46 +00:00
|
|
|
|
2013-01-18 14:12:57 +00:00
|
|
|
#define BM_LAYERICON_SIZE 24
|
|
|
|
static const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE] =
|
|
|
|
{
|
2021-01-04 11:54:30 +00:00
|
|
|
// 0 = draw pixel with white
|
|
|
|
// 1 = draw pixel with black
|
|
|
|
// 2 = draw pixel with top layer from router pair
|
|
|
|
// 3 = draw pixel with bottom layer from router pair
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
|
|
|
{ 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
|
2007-06-13 15:35:40 +00:00
|
|
|
};
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2021-01-04 11:54:30 +00:00
|
|
|
static COLOR4D ICON_WHITE { 0.86, 0.86, 0.86, 1.0 };
|
|
|
|
static COLOR4D ICON_BLACK { 0.28, 0.28, 0.28, 1.0 };
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2019-07-28 22:39:24 +00:00
|
|
|
void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
|
2007-06-13 15:35:40 +00:00
|
|
|
{
|
2019-07-28 23:37:19 +00:00
|
|
|
int ii, jj;
|
2021-01-04 11:54:30 +00:00
|
|
|
COLOR4D top_color, bottom_color, background_color;
|
2019-07-28 22:39:24 +00:00
|
|
|
bool change = aForceRebuild;
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2023-10-21 19:30:56 +00:00
|
|
|
int requested_scale = KiIconScale( this );
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2019-08-05 15:10:58 +00:00
|
|
|
if( m_prevIconVal.previous_requested_scale != requested_scale )
|
2018-01-08 04:05:03 +00:00
|
|
|
{
|
2019-08-05 15:10:58 +00:00
|
|
|
m_prevIconVal.previous_requested_scale = requested_scale;
|
2019-07-28 23:37:19 +00:00
|
|
|
change = true;
|
2018-01-08 04:05:03 +00:00
|
|
|
}
|
|
|
|
|
2020-05-16 17:15:43 +00:00
|
|
|
top_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_TOP );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2019-08-05 15:10:58 +00:00
|
|
|
if( m_prevIconVal.previous_Route_Layer_TOP_color != top_color )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2019-08-05 15:10:58 +00:00
|
|
|
m_prevIconVal.previous_Route_Layer_TOP_color = top_color;
|
2019-07-28 23:37:19 +00:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2020-05-16 17:15:43 +00:00
|
|
|
bottom_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_BOTTOM );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2019-08-05 15:10:58 +00:00
|
|
|
if( m_prevIconVal.previous_Route_Layer_BOTTOM_color != bottom_color )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2019-08-05 15:10:58 +00:00
|
|
|
m_prevIconVal.previous_Route_Layer_BOTTOM_color = bottom_color;
|
2019-07-28 23:37:19 +00:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2020-05-16 17:15:43 +00:00
|
|
|
background_color = GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND );
|
2018-01-14 19:41:01 +00:00
|
|
|
|
2019-08-05 15:10:58 +00:00
|
|
|
if( m_prevIconVal.previous_background_color != background_color )
|
2018-01-14 19:41:01 +00:00
|
|
|
{
|
2019-08-05 15:10:58 +00:00
|
|
|
m_prevIconVal.previous_background_color = background_color;
|
2019-07-28 23:37:19 +00:00
|
|
|
change = true;
|
2018-01-14 19:41:01 +00:00
|
|
|
}
|
|
|
|
|
2019-07-28 23:37:19 +00:00
|
|
|
if( change || !LayerPairBitmap )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2019-07-28 22:19:25 +00:00
|
|
|
LayerPairBitmap = std::make_unique<wxBitmap>( 24, 24 );
|
|
|
|
|
2021-01-04 11:54:30 +00:00
|
|
|
// Draw the icon, with colors according to the router's layer pair
|
2019-07-28 22:19:25 +00:00
|
|
|
wxMemoryDC iconDC;
|
|
|
|
iconDC.SelectObject( *LayerPairBitmap );
|
|
|
|
wxBrush brush;
|
|
|
|
wxPen pen;
|
|
|
|
int buttonColor = -1;
|
|
|
|
|
|
|
|
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
|
|
|
brush.SetColour( background_color.WithAlpha(1.0).ToColour() );
|
|
|
|
iconDC.SetBrush( brush );
|
|
|
|
iconDC.DrawRectangle( 0, 0, BM_LAYERICON_SIZE, BM_LAYERICON_SIZE );
|
|
|
|
|
|
|
|
for( ii = 0; ii < BM_LAYERICON_SIZE; ii++ )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2019-07-28 22:19:25 +00:00
|
|
|
for( jj = 0; jj < BM_LAYERICON_SIZE; jj++ )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2019-07-28 22:19:25 +00:00
|
|
|
if( s_BitmapLayerIcon[ii][jj] != buttonColor )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2019-07-28 22:19:25 +00:00
|
|
|
switch( s_BitmapLayerIcon[ii][jj] )
|
|
|
|
{
|
|
|
|
default:
|
2021-01-04 11:54:30 +00:00
|
|
|
case 0: pen.SetColour( ICON_WHITE.ToColour() ); break;
|
|
|
|
case 1: pen.SetColour( ICON_BLACK.ToColour() ); break;
|
|
|
|
case 2: pen.SetColour( top_color.ToColour() ); break;
|
|
|
|
case 3: pen.SetColour( bottom_color.ToColour() ); break;
|
2019-07-28 22:19:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
buttonColor = s_BitmapLayerIcon[ii][jj];
|
|
|
|
iconDC.SetPen( pen );
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
|
|
|
|
2019-07-28 22:19:25 +00:00
|
|
|
iconDC.DrawPoint( jj, ii );
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-28 22:19:25 +00:00
|
|
|
// Deselect the bitmap from the DC in order to delete the MemoryDC safely without
|
|
|
|
// deleting the bitmap
|
|
|
|
iconDC.SelectObject( wxNullBitmap );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2019-07-28 22:19:25 +00:00
|
|
|
// Scale the bitmap
|
|
|
|
const int scale = ( requested_scale <= 0 ) ? KiIconScale( this ) : requested_scale;
|
|
|
|
wxImage image = LayerPairBitmap->ConvertToImage();
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2019-07-28 22:19:25 +00:00
|
|
|
// "NEAREST" causes less mixing of colors
|
|
|
|
image.Rescale( scale * image.GetWidth() / 4, scale * image.GetHeight() / 4,
|
|
|
|
wxIMAGE_QUALITY_NEAREST );
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2019-07-28 22:19:25 +00:00
|
|
|
LayerPairBitmap = std::make_unique<wxBitmap>( image );
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2023-06-05 18:16:07 +00:00
|
|
|
if( m_auxiliaryToolBar )
|
2020-08-17 11:37:25 +00:00
|
|
|
{
|
2023-06-05 18:16:07 +00:00
|
|
|
m_auxiliaryToolBar->SetToolBitmap( PCB_ACTIONS::selectLayerPair, *LayerPairBitmap );
|
|
|
|
m_auxiliaryToolBar->Refresh();
|
2020-08-17 11:37:25 +00:00
|
|
|
}
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2007-06-13 15:35:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::ReCreateHToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2019-01-18 16:24:40 +00:00
|
|
|
// Note:
|
|
|
|
// To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
|
|
|
|
// all wxAuiToolBarItems.
|
|
|
|
// However the wxAuiToolBarItems are not the owners of controls managed by
|
|
|
|
// them and therefore do not delete them
|
|
|
|
// So we do not recreate them after clearing the tools.
|
|
|
|
|
2018-10-13 12:49:49 +00:00
|
|
|
wxWindowUpdateLocker dummy( this );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
if( m_mainToolBar )
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2020-06-23 10:42:23 +00:00
|
|
|
m_mainToolBar->ClearToolbar();
|
2020-09-26 23:55:59 +00:00
|
|
|
}
|
2018-01-08 04:05:03 +00:00
|
|
|
else
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2019-05-14 19:21:10 +00:00
|
|
|
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
2021-07-19 23:56:05 +00:00
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT |
|
|
|
|
wxAUI_TB_HORIZONTAL );
|
2020-09-26 23:55:59 +00:00
|
|
|
m_mainToolBar->SetAuiManager( &m_auimgr );
|
|
|
|
}
|
2010-02-08 18:15:42 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
// Set up toolbar
|
2014-06-11 05:18:41 +00:00
|
|
|
if( Kiface().IsSingle() )
|
|
|
|
{
|
2019-05-26 15:36:40 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::doNew );
|
|
|
|
m_mainToolBar->Add( ACTIONS::open );
|
2014-06-11 05:18:41 +00:00
|
|
|
}
|
|
|
|
|
2019-05-26 15:36:40 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::save );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-06-04 20:59:59 +00:00
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::boardSetup );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-05-26 15:36:40 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::pageSettings );
|
|
|
|
m_mainToolBar->Add( ACTIONS::print );
|
|
|
|
m_mainToolBar->Add( ACTIONS::plot );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-05-15 22:49:48 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::undo );
|
|
|
|
m_mainToolBar->Add( ACTIONS::redo );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-05-15 22:49:48 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::find );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-05-14 19:21:10 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::zoomRedraw );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomInCenter );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
|
2020-09-25 07:31:56 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::zoomFitObjects );
|
2020-09-05 00:48:22 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE, ACTION_TOOLBAR::CANCEL );
|
2017-06-06 13:35:20 +00:00
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::rotateCcw );
|
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::rotateCw );
|
2022-09-22 14:05:06 +00:00
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::mirrorV );
|
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::mirrorH );
|
2021-02-16 20:45:25 +00:00
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::group );
|
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::ungroup );
|
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::lock );
|
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::unlock );
|
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-06-06 11:45:28 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::showFootprintEditor );
|
2020-10-11 19:16:40 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::showFootprintBrowser );
|
2023-01-26 18:05:26 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::show3DViewer );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2021-03-27 21:49:38 +00:00
|
|
|
|
2021-02-22 22:45:29 +00:00
|
|
|
if( !Kiface().IsSingle() )
|
|
|
|
m_mainToolBar->Add( ACTIONS::updatePcbFromSchematic );
|
|
|
|
else
|
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::importNetlist );
|
|
|
|
|
2019-06-03 13:49:17 +00:00
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::runDRC );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-07-08 23:43:08 +00:00
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::showEeschema );
|
2018-07-22 21:33:01 +00:00
|
|
|
|
2012-08-10 21:53:50 +00:00
|
|
|
// Access to the scripting console
|
2021-03-18 13:28:04 +00:00
|
|
|
if( SCRIPTING::IsWxAvailable() )
|
2015-07-09 16:44:23 +00:00
|
|
|
{
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-06-03 13:49:17 +00:00
|
|
|
m_mainToolBar->Add( PCB_ACTIONS::showPythonConsole, ACTION_TOOLBAR::TOGGLE );
|
2018-08-15 09:26:32 +00:00
|
|
|
AddActionPluginTools();
|
2015-07-09 16:44:23 +00:00
|
|
|
}
|
2014-06-17 18:31:27 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
2020-11-06 01:56:02 +00:00
|
|
|
m_mainToolBar->KiRealize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::ReCreateOptToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2019-01-18 16:24:40 +00:00
|
|
|
// Note:
|
|
|
|
// To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
|
|
|
|
// all wxAuiToolBarItems.
|
|
|
|
// However the wxAuiToolBarItems are not the owners of controls managed by
|
|
|
|
// them and therefore do not delete them
|
|
|
|
// So we do not recreate them after clearing the tools.
|
|
|
|
|
2018-10-13 12:49:49 +00:00
|
|
|
wxWindowUpdateLocker dummy( this );
|
2010-07-27 12:47:08 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
if( m_optionsToolBar )
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2020-06-23 10:42:23 +00:00
|
|
|
m_optionsToolBar->ClearToolbar();
|
2020-09-26 23:55:59 +00:00
|
|
|
}
|
2018-01-08 04:05:03 +00:00
|
|
|
else
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2019-05-14 19:21:10 +00:00
|
|
|
m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
|
2020-09-26 23:55:59 +00:00
|
|
|
m_optionsToolBar->SetAuiManager( &m_auimgr );
|
|
|
|
}
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2019-06-04 21:29:51 +00:00
|
|
|
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
|
2023-08-24 14:13:59 +00:00
|
|
|
m_optionsToolBar->Add( ACTIONS::toggleGridOverrides, ACTION_TOOLBAR::TOGGLE );
|
2019-05-14 19:21:10 +00:00
|
|
|
|
2019-06-04 21:29:51 +00:00
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE );
|
2020-10-03 23:34:23 +00:00
|
|
|
m_optionsToolBar->Add( ACTIONS::inchesUnits, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( ACTIONS::milsUnits, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( ACTIONS::millimetersUnits, ACTION_TOOLBAR::TOGGLE );
|
2019-06-04 21:29:51 +00:00
|
|
|
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2022-05-29 20:28:10 +00:00
|
|
|
m_optionsToolBar->AddScaledSeparator( this );
|
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::toggleHV45Mode, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_optionsToolBar->AddScaledSeparator( this );
|
2019-06-04 21:29:51 +00:00
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::showRatsnest, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::ratsnestLineMode, ACTION_TOOLBAR::TOGGLE );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2021-05-29 15:53:55 +00:00
|
|
|
m_optionsToolBar->AddScaledSeparator( this );
|
|
|
|
m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::toggleNetHighlight, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_optionsToolBar->AddScaledSeparator( this );
|
2021-07-26 17:56:11 +00:00
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayFilled, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayOutline, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
|
|
|
|
if( ADVANCED_CFG::GetCfg().m_ExtraZoneDisplayModes )
|
|
|
|
{
|
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayFractured, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayTriangulated, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
}
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_optionsToolBar->AddScaledSeparator( this );
|
2019-06-04 21:29:51 +00:00
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::viaDisplayMode, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::trackDisplayMode, ACTION_TOOLBAR::TOGGLE );
|
2009-06-19 20:13:22 +00:00
|
|
|
|
2022-01-17 11:55:55 +00:00
|
|
|
if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
|
|
|
|
m_optionsToolBar->Add( ACTIONS::toggleBoundingBoxes, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
|
2010-01-24 13:46:01 +00:00
|
|
|
// Tools to show/hide toolbars:
|
2020-06-17 11:03:25 +00:00
|
|
|
m_optionsToolBar->AddScaledSeparator( this );
|
2022-12-08 22:38:36 +00:00
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::showProperties, ACTION_TOOLBAR::TOGGLE );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
|
2020-09-27 17:27:25 +00:00
|
|
|
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
|
|
|
gridMenu->Add( ACTIONS::gridProperties );
|
2023-08-26 12:29:24 +00:00
|
|
|
gridMenu->Add( ACTIONS::gridOrigin );
|
2020-09-27 17:27:25 +00:00
|
|
|
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
|
|
|
|
|
2020-11-06 01:56:02 +00:00
|
|
|
m_optionsToolBar->KiRealize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::ReCreateVToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2018-10-13 12:49:49 +00:00
|
|
|
wxWindowUpdateLocker dummy( this );
|
2010-07-27 12:47:08 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
if( m_drawToolBar )
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2020-06-23 10:42:23 +00:00
|
|
|
m_drawToolBar->ClearToolbar();
|
2020-09-26 23:55:59 +00:00
|
|
|
}
|
2018-01-08 04:05:03 +00:00
|
|
|
else
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2019-05-14 19:21:10 +00:00
|
|
|
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
|
2020-09-26 23:55:59 +00:00
|
|
|
m_drawToolBar->SetAuiManager( &m_auimgr );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Groups contained on this toolbar
|
|
|
|
static ACTION_GROUP* dimensionGroup = nullptr;
|
|
|
|
static ACTION_GROUP* originGroup = nullptr;
|
|
|
|
static ACTION_GROUP* routingGroup = nullptr;
|
2021-05-07 13:44:47 +00:00
|
|
|
static ACTION_GROUP* tuneGroup = nullptr;
|
2020-09-26 23:55:59 +00:00
|
|
|
|
|
|
|
if( !dimensionGroup )
|
|
|
|
{
|
|
|
|
dimensionGroup = new ACTION_GROUP( "group.pcbDimensions",
|
|
|
|
{ &PCB_ACTIONS::drawAlignedDimension,
|
|
|
|
&PCB_ACTIONS::drawOrthogonalDimension,
|
|
|
|
&PCB_ACTIONS::drawCenterDimension,
|
2021-07-13 18:46:33 +00:00
|
|
|
&PCB_ACTIONS::drawRadialDimension,
|
2020-09-26 23:55:59 +00:00
|
|
|
&PCB_ACTIONS::drawLeader } );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !originGroup )
|
|
|
|
{
|
|
|
|
originGroup = new ACTION_GROUP( "group.pcbOrigins",
|
2023-08-22 12:47:25 +00:00
|
|
|
{ &PCB_ACTIONS::gridSetOrigin,
|
|
|
|
&PCB_ACTIONS::drillOrigin } );
|
2020-09-26 23:55:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !routingGroup )
|
|
|
|
{
|
|
|
|
routingGroup = new ACTION_GROUP( "group.pcbRouting",
|
|
|
|
{ &PCB_ACTIONS::routeSingleTrack,
|
|
|
|
&PCB_ACTIONS::routeDiffPair } );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2021-05-07 13:44:47 +00:00
|
|
|
if( !tuneGroup )
|
|
|
|
{
|
2021-06-06 19:03:10 +00:00
|
|
|
tuneGroup = new ACTION_GROUP( "group.pcbTune",
|
2024-02-08 14:21:28 +00:00
|
|
|
{ &PCB_ACTIONS::tuneSingleTrack,
|
|
|
|
&PCB_ACTIONS::tuneDiffPair,
|
2023-10-11 16:10:48 +00:00
|
|
|
&PCB_ACTIONS::tuneSkew } );
|
2021-05-07 13:44:47 +00:00
|
|
|
}
|
|
|
|
|
2019-06-24 15:27:05 +00:00
|
|
|
m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
|
2019-05-15 22:49:48 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::localRatsnestTool, ACTION_TOOLBAR::TOGGLE );
|
2012-07-13 18:55:29 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_drawToolBar->AddScaledSeparator( this );
|
2021-01-25 13:58:30 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::placeFootprint, ACTION_TOOLBAR::TOGGLE );
|
2020-09-26 23:55:59 +00:00
|
|
|
m_drawToolBar->AddGroup( routingGroup, ACTION_TOOLBAR::TOGGLE );
|
2021-05-07 13:44:47 +00:00
|
|
|
m_drawToolBar->AddGroup( tuneGroup, ACTION_TOOLBAR::TOGGLE );
|
2019-05-15 22:49:48 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::drawVia, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::drawZone, ACTION_TOOLBAR::TOGGLE );
|
2020-09-21 23:32:07 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::drawRuleArea, ACTION_TOOLBAR::TOGGLE );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_drawToolBar->AddScaledSeparator( this );
|
2019-05-15 22:49:48 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE );
|
2020-12-13 12:00:40 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE );
|
2020-07-01 12:28:10 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE );
|
2019-05-15 22:49:48 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE );
|
2023-10-23 17:23:24 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::placeReferenceImage, ACTION_TOOLBAR::TOGGLE );
|
2019-05-15 22:49:48 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE );
|
2022-01-30 10:52:52 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::drawTextBox, ACTION_TOOLBAR::TOGGLE );
|
2024-01-15 17:29:55 +00:00
|
|
|
m_drawToolBar->Add( PCB_ACTIONS::drawTable, ACTION_TOOLBAR::TOGGLE );
|
2020-09-26 23:55:59 +00:00
|
|
|
m_drawToolBar->AddGroup( dimensionGroup, ACTION_TOOLBAR::TOGGLE );
|
2019-07-31 12:10:13 +00:00
|
|
|
m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_drawToolBar->AddScaledSeparator( this );
|
2020-09-26 23:55:59 +00:00
|
|
|
m_drawToolBar->AddGroup( originGroup, ACTION_TOOLBAR::TOGGLE );
|
2019-06-03 01:46:08 +00:00
|
|
|
m_drawToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
|
2017-03-09 09:09:13 +00:00
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
|
2020-10-01 21:55:17 +00:00
|
|
|
|
2022-12-05 18:27:00 +00:00
|
|
|
auto makeArcMenu = [&]()
|
|
|
|
{
|
|
|
|
std::unique_ptr<ACTION_MENU> arcMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
2021-04-23 01:37:15 +00:00
|
|
|
|
2022-12-05 18:27:00 +00:00
|
|
|
arcMenu->Add( PCB_ACTIONS::pointEditorArcKeepCenter, ACTION_MENU::CHECK );
|
|
|
|
arcMenu->Add( PCB_ACTIONS::pointEditorArcKeepEndpoint, ACTION_MENU::CHECK );
|
2021-04-23 01:37:15 +00:00
|
|
|
|
2022-12-05 18:27:00 +00:00
|
|
|
return arcMenu;
|
|
|
|
};
|
2021-04-23 01:37:15 +00:00
|
|
|
|
2022-12-05 18:27:00 +00:00
|
|
|
m_drawToolBar->AddToolContextMenu( PCB_ACTIONS::drawArc, makeArcMenu() );
|
|
|
|
|
|
|
|
auto makeRouteMenu = [&]()
|
|
|
|
{
|
|
|
|
std::unique_ptr<ACTION_MENU> routeMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
|
|
|
|
|
|
|
routeMenu->Add( PCB_ACTIONS::routerHighlightMode, ACTION_MENU::CHECK );
|
|
|
|
routeMenu->Add( PCB_ACTIONS::routerShoveMode, ACTION_MENU::CHECK );
|
|
|
|
routeMenu->Add( PCB_ACTIONS::routerWalkaroundMode, ACTION_MENU::CHECK );
|
|
|
|
|
|
|
|
routeMenu->AppendSeparator();
|
|
|
|
routeMenu->Add( PCB_ACTIONS::routerSettingsDialog );
|
|
|
|
|
|
|
|
return routeMenu;
|
|
|
|
};
|
2021-04-23 01:37:15 +00:00
|
|
|
|
|
|
|
m_drawToolBar->AddToolContextMenu( PCB_ACTIONS::routeSingleTrack, makeRouteMenu() );
|
|
|
|
m_drawToolBar->AddToolContextMenu( PCB_ACTIONS::routeDiffPair, makeRouteMenu() );
|
2020-06-23 10:44:39 +00:00
|
|
|
|
2020-10-01 21:55:17 +00:00
|
|
|
std::unique_ptr<ACTION_MENU> zoneMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
2020-08-13 23:09:17 +00:00
|
|
|
zoneMenu->Add( PCB_ACTIONS::zoneFillAll );
|
|
|
|
zoneMenu->Add( PCB_ACTIONS::zoneUnfillAll );
|
2020-10-01 21:55:17 +00:00
|
|
|
m_drawToolBar->AddToolContextMenu( PCB_ACTIONS::drawZone, std::move( zoneMenu ) );
|
2020-06-23 10:44:39 +00:00
|
|
|
|
2021-02-05 23:43:32 +00:00
|
|
|
std::unique_ptr<ACTION_MENU> lineMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
|
|
|
m_drawToolBar->AddToolContextMenu( PCB_ACTIONS::drawLine, std::move( lineMenu ) );
|
|
|
|
|
2020-11-06 01:56:02 +00:00
|
|
|
m_drawToolBar->KiRealize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2018-10-13 12:49:49 +00:00
|
|
|
wxWindowUpdateLocker dummy( this );
|
2010-07-27 12:47:08 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_auxiliaryToolBar )
|
2015-01-05 13:20:04 +00:00
|
|
|
{
|
2021-03-27 21:49:38 +00:00
|
|
|
m_auxiliaryToolBar->ClearToolbar();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
m_auxiliaryToolBar = new ACTION_TOOLBAR( this, ID_AUX_TOOLBAR, wxDefaultPosition,
|
|
|
|
wxDefaultSize,
|
2021-03-27 21:49:38 +00:00
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
2023-06-05 18:16:07 +00:00
|
|
|
|
|
|
|
// The layer indicator is special, so we register a callback directly that will
|
|
|
|
// regenerate the bitmap instead of using the conditions system.
|
|
|
|
auto layerIndicatorUpdate =
|
|
|
|
[this] ( wxUpdateUIEvent& )
|
|
|
|
{
|
|
|
|
PrepareLayerIndicator();
|
|
|
|
};
|
|
|
|
|
|
|
|
Bind( wxEVT_UPDATE_UI, layerIndicatorUpdate, PCB_ACTIONS::selectLayerPair.GetUIId() );
|
|
|
|
|
2021-03-27 21:49:38 +00:00
|
|
|
m_auxiliaryToolBar->SetAuiManager( &m_auimgr );
|
2015-01-05 13:20:04 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
/* Set up toolbar items */
|
|
|
|
|
|
|
|
// Creates box to display and choose tracks widths:
|
2019-01-18 16:24:40 +00:00
|
|
|
if( m_SelTrackWidthBox == nullptr )
|
2023-04-09 21:59:01 +00:00
|
|
|
m_SelTrackWidthBox = new wxChoice( m_auxiliaryToolBar, ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0, nullptr );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
UpdateTrackWidthSelectBox( m_SelTrackWidthBox );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_auxiliaryToolBar->AddControl( m_SelTrackWidthBox );
|
2021-07-03 17:36:18 +00:00
|
|
|
m_SelTrackWidthBox->SetToolTip( _( "Select the default width for new tracks. Note that this "
|
|
|
|
"width can be overridden by the board minimum width, or by "
|
|
|
|
"the width of an existing track if the 'Use Existing Track "
|
|
|
|
"Width' feature is enabled." ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2021-04-25 23:58:11 +00:00
|
|
|
m_auxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, wxEmptyString,
|
|
|
|
KiScaledBitmap( BITMAPS::auto_track_width, this ),
|
|
|
|
_( "When routing from an existing track use its width instead "
|
|
|
|
"of the current width setting" ),
|
|
|
|
wxITEM_CHECK );
|
|
|
|
|
|
|
|
m_auxiliaryToolBar->AddScaledSeparator( this );
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
// Creates box to display and choose vias diameters:
|
2019-01-28 14:15:32 +00:00
|
|
|
|
2019-01-18 16:24:40 +00:00
|
|
|
if( m_SelViaSizeBox == nullptr )
|
2023-04-09 21:59:01 +00:00
|
|
|
m_SelViaSizeBox = new wxChoice( m_auxiliaryToolBar, ID_AUX_TOOLBAR_PCB_VIA_SIZE,
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0, nullptr );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
UpdateViaSizeSelectBox( m_SelViaSizeBox );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_auxiliaryToolBar->AddControl( m_SelViaSizeBox );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2023-06-05 18:16:07 +00:00
|
|
|
m_auxiliaryToolBar->AddScaledSeparator( this );
|
|
|
|
|
|
|
|
if( m_SelLayerBox == nullptr )
|
|
|
|
{
|
|
|
|
m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( m_auxiliaryToolBar, ID_TOOLBARH_PCB_SELECT_LAYER );
|
|
|
|
m_SelLayerBox->SetBoardFrame( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
ReCreateLayerBox( false );
|
|
|
|
m_auxiliaryToolBar->AddControl( m_SelLayerBox );
|
|
|
|
|
|
|
|
m_auxiliaryToolBar->Add( PCB_ACTIONS::selectLayerPair );
|
|
|
|
PrepareLayerIndicator( true ); // Force rebuild of the bitmap with the active layer colors
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
// Add the box to display and select the current grid size:
|
2020-06-17 11:03:25 +00:00
|
|
|
m_auxiliaryToolBar->AddScaledSeparator( this );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
|
|
|
if( m_gridSelectBox == nullptr )
|
2023-04-09 21:59:01 +00:00
|
|
|
m_gridSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_GRID_SELECT,
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0, nullptr );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
2018-11-23 23:33:02 +00:00
|
|
|
UpdateGridSelectBox();
|
2018-11-28 14:58:41 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_auxiliaryToolBar->AddControl( m_gridSelectBox );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
// Add the box to display and select the current Zoom
|
2020-06-17 11:03:25 +00:00
|
|
|
m_auxiliaryToolBar->AddScaledSeparator( this );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
|
|
|
if( m_zoomSelectBox == nullptr )
|
2023-04-09 21:59:01 +00:00
|
|
|
m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_ZOOM_SELECT,
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0, nullptr );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
2020-06-14 15:08:47 +00:00
|
|
|
UpdateZoomSelectBox();
|
2015-01-05 13:20:04 +00:00
|
|
|
m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2021-03-27 21:49:38 +00:00
|
|
|
// Go through and ensure the comboboxes are the correct size, since the strings in the
|
|
|
|
// box could have changed widths.
|
|
|
|
m_auxiliaryToolBar->UpdateControlWidth( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH );
|
|
|
|
m_auxiliaryToolBar->UpdateControlWidth( ID_AUX_TOOLBAR_PCB_VIA_SIZE );
|
|
|
|
m_auxiliaryToolBar->UpdateControlWidth( ID_ON_ZOOM_SELECT );
|
|
|
|
m_auxiliaryToolBar->UpdateControlWidth( ID_ON_GRID_SELECT );
|
2023-06-05 18:16:07 +00:00
|
|
|
m_auxiliaryToolBar->UpdateControlWidth( ID_TOOLBARH_PCB_SELECT_LAYER );
|
2021-03-27 21:49:38 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
// after adding the buttons to the toolbar, must call Realize()
|
2020-11-06 01:56:02 +00:00
|
|
|
m_auxiliaryToolBar->KiRealize();
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-27 21:49:38 +00:00
|
|
|
void PCB_EDIT_FRAME::UpdateToolbarControlSizes()
|
|
|
|
{
|
|
|
|
if( m_mainToolBar )
|
|
|
|
{
|
|
|
|
// Update the item widths
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_auxiliaryToolBar )
|
|
|
|
{
|
|
|
|
// Update the item widths
|
|
|
|
m_auxiliaryToolBar->UpdateControlWidth( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH );
|
|
|
|
m_auxiliaryToolBar->UpdateControlWidth( ID_AUX_TOOLBAR_PCB_VIA_SIZE );
|
|
|
|
m_auxiliaryToolBar->UpdateControlWidth( ID_ON_ZOOM_SELECT );
|
|
|
|
m_auxiliaryToolBar->UpdateControlWidth( ID_ON_GRID_SELECT );
|
2023-06-05 18:16:07 +00:00
|
|
|
m_auxiliaryToolBar->UpdateControlWidth( ID_TOOLBARH_PCB_SELECT_LAYER );
|
2021-03-27 21:49:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-05 19:26:33 +00:00
|
|
|
static wxString ComboBoxUnits( EDA_UNITS aUnits, double aValue, bool aIncludeLabel = true )
|
|
|
|
{
|
|
|
|
wxString text;
|
|
|
|
const wxChar* format;
|
|
|
|
|
|
|
|
switch( aUnits )
|
|
|
|
{
|
2022-02-04 22:44:59 +00:00
|
|
|
default:
|
|
|
|
wxASSERT_MSG( false, wxT( "Invalid unit" ) );
|
|
|
|
KI_FALLTHROUGH;
|
|
|
|
case EDA_UNITS::UNSCALED: format = wxT( "%.0f" ); break;
|
|
|
|
case EDA_UNITS::MILLIMETRES: format = wxT( "%.3f" ); break;
|
|
|
|
case EDA_UNITS::MILS: format = wxT( "%.2f" ); break;
|
|
|
|
case EDA_UNITS::INCHES: format = wxT( "%.5f" ); break;
|
2020-10-05 19:26:33 +00:00
|
|
|
}
|
|
|
|
|
2022-09-16 04:38:10 +00:00
|
|
|
text.Printf( format, EDA_UNIT_UTILS::UI::ToUserUnit( pcbIUScale, aUnits, aValue ) );
|
2020-10-05 19:26:33 +00:00
|
|
|
|
|
|
|
if( aIncludeLabel )
|
2022-09-19 09:25:20 +00:00
|
|
|
text += EDA_UNIT_UTILS::GetText( aUnits, EDA_DATA_TYPE::DISTANCE );
|
2020-10-05 19:26:33 +00:00
|
|
|
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-09 21:59:01 +00:00
|
|
|
void PCB_EDIT_FRAME::UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, bool aEdit )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
if( aTrackWidthSelectBox == nullptr )
|
2011-02-21 13:54:29 +00:00
|
|
|
return;
|
|
|
|
|
2020-10-05 19:26:33 +00:00
|
|
|
EDA_UNITS primaryUnit;
|
|
|
|
EDA_UNITS secondaryUnit;
|
|
|
|
|
|
|
|
GetUnitPair( primaryUnit, secondaryUnit );
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
wxString msg;
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aTrackWidthSelectBox->Clear();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2020-10-10 18:29:41 +00:00
|
|
|
aTrackWidthSelectBox->Append( _( "Track: use netclass width" ) );
|
|
|
|
|
|
|
|
for( unsigned ii = 1; ii < GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
2010-07-12 14:07:09 +00:00
|
|
|
{
|
2015-01-05 13:20:04 +00:00
|
|
|
int size = GetDesignSettings().m_TrackWidthList[ii];
|
|
|
|
|
2020-10-05 19:26:33 +00:00
|
|
|
msg.Printf( _( "Track: %s (%s)" ), ComboBoxUnits( primaryUnit, size ),
|
|
|
|
ComboBoxUnits( secondaryUnit, size ) );
|
2015-01-05 13:20:04 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aTrackWidthSelectBox->Append( msg );
|
2010-07-12 14:07:09 +00:00
|
|
|
}
|
2011-03-01 19:26:17 +00:00
|
|
|
|
2019-02-08 13:50:20 +00:00
|
|
|
if( aEdit )
|
|
|
|
{
|
|
|
|
aTrackWidthSelectBox->Append( wxT( "---" ) );
|
2020-04-08 21:34:18 +00:00
|
|
|
aTrackWidthSelectBox->Append( _( "Edit Pre-defined Sizes..." ) );
|
2019-02-08 13:50:20 +00:00
|
|
|
}
|
2018-11-17 00:33:20 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
if( GetDesignSettings().GetTrackWidthIndex() >= GetDesignSettings().m_TrackWidthList.size() )
|
|
|
|
GetDesignSettings().SetTrackWidthIndex( 0 );
|
2013-01-09 18:52:44 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aTrackWidthSelectBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2023-04-09 21:59:01 +00:00
|
|
|
void PCB_EDIT_FRAME::UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool aEdit )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
if( aViaSizeSelectBox == nullptr )
|
2011-02-21 13:54:29 +00:00
|
|
|
return;
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aViaSizeSelectBox->Clear();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2020-10-05 19:26:33 +00:00
|
|
|
COMMON_TOOLS* cmnTool = m_toolManager->GetTool<COMMON_TOOLS>();
|
|
|
|
|
|
|
|
EDA_UNITS primaryUnit = GetUserUnits();
|
|
|
|
EDA_UNITS secondaryUnit = EDA_UNITS::MILS;
|
|
|
|
|
2020-10-24 14:45:37 +00:00
|
|
|
if( EDA_UNIT_UTILS::IsImperialUnit( primaryUnit ) )
|
2020-10-05 19:26:33 +00:00
|
|
|
{
|
|
|
|
if( cmnTool )
|
|
|
|
secondaryUnit = cmnTool->GetLastMetricUnits();
|
|
|
|
else
|
|
|
|
secondaryUnit = EDA_UNITS::MILLIMETRES;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( cmnTool )
|
|
|
|
secondaryUnit = cmnTool->GetLastImperialUnits();
|
|
|
|
else
|
|
|
|
secondaryUnit = EDA_UNITS::MILS;
|
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2020-10-10 18:29:41 +00:00
|
|
|
aViaSizeSelectBox->Append( _( "Via: use netclass sizes" ) );
|
|
|
|
|
2020-10-15 13:31:23 +00:00
|
|
|
for( unsigned ii = 1; ii < GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
VIA_DIMENSION viaDimension = GetDesignSettings().m_ViasDimensionsList[ii];
|
2020-10-05 19:26:33 +00:00
|
|
|
wxString msg, priStr, secStr;
|
2015-01-05 13:20:04 +00:00
|
|
|
|
2020-10-05 19:26:33 +00:00
|
|
|
double diam = viaDimension.m_Diameter;
|
|
|
|
double hole = viaDimension.m_Drill;
|
2015-01-05 13:20:04 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
if( hole > 0 )
|
2020-10-05 19:26:33 +00:00
|
|
|
{
|
2022-02-04 22:44:59 +00:00
|
|
|
priStr = ComboBoxUnits( primaryUnit, diam, false ) + wxT( " / " )
|
2020-10-20 17:09:00 +00:00
|
|
|
+ ComboBoxUnits( primaryUnit, hole, true );
|
2022-02-04 22:44:59 +00:00
|
|
|
secStr = ComboBoxUnits( secondaryUnit, diam, false ) + wxT( " / " )
|
2020-10-20 17:09:00 +00:00
|
|
|
+ ComboBoxUnits( secondaryUnit, hole, true );
|
2020-10-05 19:26:33 +00:00
|
|
|
}
|
2018-04-28 15:22:25 +00:00
|
|
|
else
|
2020-10-05 19:26:33 +00:00
|
|
|
{
|
2020-10-20 17:09:00 +00:00
|
|
|
priStr = ComboBoxUnits( primaryUnit, diam, true );
|
|
|
|
secStr = ComboBoxUnits( secondaryUnit, diam, true );
|
2020-10-05 19:26:33 +00:00
|
|
|
}
|
2018-04-28 15:22:25 +00:00
|
|
|
|
2020-10-05 19:26:33 +00:00
|
|
|
msg.Printf( _( "Via: %s (%s)" ), priStr, secStr );
|
2008-12-05 16:03:05 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aViaSizeSelectBox->Append( msg );
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2011-03-01 19:26:17 +00:00
|
|
|
|
2019-02-08 13:50:20 +00:00
|
|
|
if( aEdit )
|
|
|
|
{
|
|
|
|
aViaSizeSelectBox->Append( wxT( "---" ) );
|
2020-04-08 21:34:18 +00:00
|
|
|
aViaSizeSelectBox->Append( _( "Edit Pre-defined Sizes..." ) );
|
2019-02-08 13:50:20 +00:00
|
|
|
}
|
2018-11-17 00:33:20 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
if( GetDesignSettings().GetViaSizeIndex() >= GetDesignSettings().m_ViasDimensionsList.size() )
|
|
|
|
GetDesignSettings().SetViaSizeIndex( 0 );
|
2011-12-16 13:32:23 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aViaSizeSelectBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2013-09-02 15:26:52 +00:00
|
|
|
void PCB_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2023-06-05 18:16:07 +00:00
|
|
|
if( m_SelLayerBox == nullptr || m_auxiliaryToolBar == nullptr )
|
2013-09-02 15:26:52 +00:00
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2013-09-02 15:26:52 +00:00
|
|
|
m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
|
2010-11-02 23:13:56 +00:00
|
|
|
m_SelLayerBox->Resync();
|
2008-04-29 13:35:26 +00:00
|
|
|
|
2013-09-02 15:26:52 +00:00
|
|
|
if( aForceResizeToolbar )
|
2021-04-02 20:33:31 +00:00
|
|
|
UpdateToolbarControlSizes();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2015-10-14 18:12:17 +00:00
|
|
|
|
|
|
|
|
2019-06-04 21:29:51 +00:00
|
|
|
void PCB_EDIT_FRAME::ToggleLayersManager()
|
2015-10-14 18:12:17 +00:00
|
|
|
{
|
2021-08-20 01:15:14 +00:00
|
|
|
PCBNEW_SETTINGS* settings = GetPcbNewSettings();
|
|
|
|
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
|
2021-10-30 22:21:15 +00:00
|
|
|
wxAuiPaneInfo& selectionFilter = m_auimgr.GetPane( "SelectionFilter" );
|
2021-08-20 01:15:14 +00:00
|
|
|
|
2019-06-04 21:29:51 +00:00
|
|
|
// show auxiliary Vertical layers and visibility manager toolbar
|
|
|
|
m_show_layer_manager_tools = !m_show_layer_manager_tools;
|
2020-10-19 01:57:18 +00:00
|
|
|
|
2021-08-20 01:15:14 +00:00
|
|
|
layersManager.Show( m_show_layer_manager_tools );
|
2021-10-30 22:21:15 +00:00
|
|
|
selectionFilter.Show( m_show_layer_manager_tools );
|
2021-08-20 01:15:14 +00:00
|
|
|
|
|
|
|
if( m_show_layer_manager_tools )
|
|
|
|
{
|
|
|
|
SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
settings->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
|
|
|
|
m_auimgr.Update();
|
|
|
|
}
|
2019-06-04 21:29:51 +00:00
|
|
|
}
|
2015-10-14 18:12:17 +00:00
|
|
|
|
2020-02-04 08:40:25 +00:00
|
|
|
|
2022-09-14 02:59:57 +00:00
|
|
|
void PCB_EDIT_FRAME::ToggleSearch()
|
|
|
|
{
|
2022-11-25 14:11:20 +00:00
|
|
|
PCBNEW_SETTINGS* settings = GetPcbNewSettings();
|
|
|
|
|
2022-10-02 08:20:26 +00:00
|
|
|
// Ensure m_show_search is up to date (the pane can be closed outside the menu)
|
|
|
|
m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
|
|
|
|
|
2022-09-14 02:59:57 +00:00
|
|
|
m_show_search = !m_show_search;
|
|
|
|
|
2022-11-25 14:11:20 +00:00
|
|
|
wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
|
|
|
|
searchPaneInfo.Show( m_show_search );
|
2022-09-14 02:59:57 +00:00
|
|
|
|
|
|
|
if( m_show_search )
|
|
|
|
{
|
2023-05-18 20:03:33 +00:00
|
|
|
searchPaneInfo.Direction( settings->m_AuiPanels.search_panel_dock_direction );
|
|
|
|
|
|
|
|
if( settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
|
|
|
|
|| settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM )
|
|
|
|
{
|
|
|
|
SetAuiPaneSize( m_auimgr, searchPaneInfo,
|
|
|
|
-1, settings->m_AuiPanels.search_panel_height );
|
|
|
|
}
|
|
|
|
else if( settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
|
|
|
|
|| settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT )
|
|
|
|
{
|
|
|
|
SetAuiPaneSize( m_auimgr, searchPaneInfo,
|
|
|
|
settings->m_AuiPanels.search_panel_width, -1 );
|
|
|
|
}
|
2022-09-14 02:59:57 +00:00
|
|
|
m_searchPane->FocusSearch();
|
|
|
|
}
|
2022-11-25 14:11:20 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
settings->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
|
2023-05-18 20:03:33 +00:00
|
|
|
settings->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
|
|
|
|
settings->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
|
2022-11-25 14:11:20 +00:00
|
|
|
m_auimgr.Update();
|
|
|
|
}
|
2022-09-14 02:59:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-15 22:49:48 +00:00
|
|
|
void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_TRACK_WIDTH )
|
|
|
|
{
|
2020-10-10 18:29:41 +00:00
|
|
|
BOARD_DESIGN_SETTINGS& bds = GetDesignSettings();
|
|
|
|
int sel;
|
|
|
|
|
2020-10-12 20:00:13 +00:00
|
|
|
if( bds.UseCustomTrackViaSize() )
|
2020-10-10 18:29:41 +00:00
|
|
|
sel = wxNOT_FOUND;
|
|
|
|
else
|
|
|
|
sel = bds.GetTrackWidthIndex();
|
|
|
|
|
|
|
|
if( m_SelTrackWidthBox->GetSelection() != sel )
|
|
|
|
m_SelTrackWidthBox->SetSelection( sel );
|
2019-05-15 22:49:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_VIA_SIZE )
|
|
|
|
{
|
2020-10-10 18:29:41 +00:00
|
|
|
BOARD_DESIGN_SETTINGS& bds = GetDesignSettings();
|
|
|
|
int sel = 0;
|
|
|
|
|
|
|
|
if( bds.UseCustomTrackViaSize() )
|
|
|
|
sel = wxNOT_FOUND;
|
|
|
|
else
|
|
|
|
sel = bds.GetViaSizeIndex();
|
|
|
|
|
|
|
|
if( m_SelViaSizeBox->GetSelection() != sel )
|
|
|
|
m_SelViaSizeBox->SetSelection( sel );
|
2019-05-15 22:49:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-10 18:29:41 +00:00
|
|
|
void PCB_EDIT_FRAME::OnUpdateSelectAutoWidth( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
BOARD_DESIGN_SETTINGS& bds = GetDesignSettings();
|
|
|
|
|
2021-12-15 15:48:34 +00:00
|
|
|
aEvent.Check( bds.m_UseConnectedTrackWidth );
|
2020-10-10 18:29:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-15 22:49:48 +00:00
|
|
|
void PCB_EDIT_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
2020-08-17 11:37:25 +00:00
|
|
|
if( m_SelLayerBox->GetLayerSelection() != GetActiveLayer() )
|
|
|
|
m_SelLayerBox->SetLayerSelection( GetActiveLayer() );
|
2019-05-15 22:49:48 +00:00
|
|
|
}
|