2011-12-16 08:32:23 -05:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-06-05 20:16:07 +02:00
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2012-06-08 11:56:42 +02:00
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2018-11-28 09:58:41 -05:00
|
|
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
|
2025-01-01 13:30:11 -08:00
|
|
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
2011-12-16 08:32:23 -05: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 14:29:17 +02:00
|
|
|
#include <memory>
|
2025-02-20 02:53:15 +00:00
|
|
|
#include <string>
|
2020-10-02 14:29:17 +02:00
|
|
|
|
2021-07-26 18:56:11 +01:00
|
|
|
#include <advanced_config.h>
|
2024-01-13 23:14:02 -05:00
|
|
|
#include <api/api_plugin_manager.h>
|
2020-01-12 20:44:19 -05:00
|
|
|
#include <bitmaps.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
2021-06-06 15:03:10 -04:00
|
|
|
#include <board_design_settings.h>
|
2021-09-14 23:45:14 +01:00
|
|
|
#include <kiface_base.h>
|
2024-01-13 23:14:02 -05:00
|
|
|
#include <kiplatform/ui.h>
|
2021-03-20 11:35:37 -04:00
|
|
|
#include <macros.h>
|
2018-01-29 21:58:58 +01:00
|
|
|
#include <pcb_edit_frame.h>
|
2020-01-12 20:44:19 -05:00
|
|
|
#include <pcb_layer_box_selector.h>
|
|
|
|
#include <pcbnew_id.h>
|
|
|
|
#include <pcbnew_settings.h>
|
|
|
|
#include <pgm_base.h>
|
2020-06-23 11:44:39 +01:00
|
|
|
#include <router/pns_routing_settings.h>
|
|
|
|
#include <router/router_tool.h>
|
2020-01-12 20:44:19 -05:00
|
|
|
#include <settings/color_settings.h>
|
2019-06-09 22:57:23 +01:00
|
|
|
#include <tool/action_toolbar.h>
|
2019-05-14 20:21:10 +01:00
|
|
|
#include <tool/actions.h>
|
2020-10-05 20:26:33 +01:00
|
|
|
#include <tool/common_tools.h>
|
2020-06-23 11:44:39 +01:00
|
|
|
#include <tool/tool_manager.h>
|
2020-01-12 20:44:19 -05:00
|
|
|
#include <tools/pcb_actions.h>
|
2020-12-16 13:31:32 +00:00
|
|
|
#include <tools/pcb_selection_tool.h>
|
2021-08-19 21:15:14 -04:00
|
|
|
#include <widgets/appearance_controls.h>
|
2024-07-24 13:32:21 +08:00
|
|
|
#include <widgets/layer_box_selector.h>
|
2024-08-07 06:46:57 +08:00
|
|
|
#include <widgets/layer_presentation.h>
|
2022-11-27 18:23:07 -05:00
|
|
|
#include <widgets/pcb_properties_panel.h>
|
2024-03-04 23:00:26 +00:00
|
|
|
#include <widgets/net_inspector_panel.h>
|
2022-09-14 02:59:57 +00:00
|
|
|
#include <widgets/pcb_search_pane.h>
|
2021-08-19 21:15:14 -04:00
|
|
|
#include <widgets/wx_aui_utils.h>
|
2012-01-22 22:33:36 -06:00
|
|
|
#include <wx/wupdlock.h>
|
2023-03-09 23:49:01 +00:00
|
|
|
#include <wx/combobox.h>
|
2011-09-16 14:54:04 -04:00
|
|
|
|
2021-03-08 06:54:22 -08:00
|
|
|
#include "../scripting/python_scripting.h"
|
2015-07-09 18:44:23 +02:00
|
|
|
|
2011-09-16 14:54:04 -04:00
|
|
|
|
2007-06-13 15:35:40 +00:00
|
|
|
/* Data to build the layer pair indicator button */
|
2018-01-07 21:05:03 -07:00
|
|
|
static std::unique_ptr<wxBitmap> LayerPairBitmap;
|
2007-09-11 04:17:46 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2019-07-29 00:39:24 +02:00
|
|
|
void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
|
2007-06-13 15:35:40 +00:00
|
|
|
{
|
2021-01-04 11:54:30 +00:00
|
|
|
COLOR4D top_color, bottom_color, background_color;
|
2019-07-29 00:39:24 +02:00
|
|
|
bool change = aForceRebuild;
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2023-10-21 15:30:56 -04:00
|
|
|
int requested_scale = KiIconScale( this );
|
2018-01-07 21:05:03 -07:00
|
|
|
|
2019-08-05 17:10:58 +02:00
|
|
|
if( m_prevIconVal.previous_requested_scale != requested_scale )
|
2018-01-07 21:05:03 -07:00
|
|
|
{
|
2019-08-05 17:10:58 +02:00
|
|
|
m_prevIconVal.previous_requested_scale = requested_scale;
|
2019-07-28 17:37:19 -06:00
|
|
|
change = true;
|
2018-01-07 21:05:03 -07:00
|
|
|
}
|
|
|
|
|
2020-05-16 13:15:43 -04:00
|
|
|
top_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_TOP );
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2019-08-05 17:10:58 +02:00
|
|
|
if( m_prevIconVal.previous_Route_Layer_TOP_color != top_color )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2019-08-05 17:10:58 +02:00
|
|
|
m_prevIconVal.previous_Route_Layer_TOP_color = top_color;
|
2019-07-28 17:37:19 -06:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2020-05-16 13:15:43 -04:00
|
|
|
bottom_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_BOTTOM );
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2019-08-05 17:10:58 +02:00
|
|
|
if( m_prevIconVal.previous_Route_Layer_BOTTOM_color != bottom_color )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2019-08-05 17:10:58 +02:00
|
|
|
m_prevIconVal.previous_Route_Layer_BOTTOM_color = bottom_color;
|
2019-07-28 17:37:19 -06:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2020-05-16 13:15:43 -04:00
|
|
|
background_color = GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND );
|
2018-01-14 19:41:01 +00:00
|
|
|
|
2019-08-05 17:10:58 +02:00
|
|
|
if( m_prevIconVal.previous_background_color != background_color )
|
2018-01-14 19:41:01 +00:00
|
|
|
{
|
2019-08-05 17:10:58 +02:00
|
|
|
m_prevIconVal.previous_background_color = background_color;
|
2019-07-28 17:37:19 -06:00
|
|
|
change = true;
|
2018-01-14 19:41:01 +00:00
|
|
|
}
|
|
|
|
|
2019-07-28 17:37:19 -06:00
|
|
|
if( change || !LayerPairBitmap )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2019-07-28 16:19:25 -06:00
|
|
|
const int scale = ( requested_scale <= 0 ) ? KiIconScale( this ) : requested_scale;
|
2024-07-24 13:32:21 +08:00
|
|
|
LayerPairBitmap = LAYER_PRESENTATION::CreateLayerPairIcon( background_color, top_color,
|
|
|
|
bottom_color, scale );
|
2018-01-07 21:05:03 -07:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
if( m_tbTopAux )
|
2020-08-17 12:37:25 +01:00
|
|
|
{
|
2025-02-20 02:53:15 +00:00
|
|
|
m_tbTopAux->SetToolBitmap( PCB_ACTIONS::selectLayerPair, *LayerPairBitmap );
|
|
|
|
m_tbTopAux->Refresh();
|
2020-08-17 12:37:25 +01:00
|
|
|
}
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2007-06-13 15:35:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
std::optional<TOOLBAR_CONFIGURATION> PCB_EDIT_FRAME::DefaultLeftToolbarConfig()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2025-02-20 02:53:15 +00:00
|
|
|
TOOLBAR_CONFIGURATION config;
|
2019-01-18 17:24:40 +01:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
// clang-format off
|
|
|
|
config.AppendAction( ACTIONS::toggleGrid )
|
|
|
|
.AppendAction( ACTIONS::toggleGridOverrides )
|
|
|
|
.AppendAction( PCB_ACTIONS::togglePolarCoords )
|
|
|
|
.AppendAction( ACTIONS::inchesUnits )
|
|
|
|
.AppendAction( ACTIONS::milsUnits )
|
|
|
|
.AppendAction( ACTIONS::millimetersUnits )
|
|
|
|
.AppendAction( ACTIONS::toggleCursorStyle );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( PCB_ACTIONS::toggleHV45Mode );
|
2022-05-29 21:28:10 +01:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( PCB_ACTIONS::showRatsnest )
|
|
|
|
.AppendAction( PCB_ACTIONS::ratsnestLineMode );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( ACTIONS::highContrastMode )
|
|
|
|
.AppendAction( PCB_ACTIONS::toggleNetHighlight );
|
2021-05-29 11:53:55 -04:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( PCB_ACTIONS::zoneDisplayFilled )
|
|
|
|
.AppendAction( PCB_ACTIONS::zoneDisplayOutline );
|
2021-07-26 18:56:11 +01:00
|
|
|
|
|
|
|
if( ADVANCED_CFG::GetCfg().m_ExtraZoneDisplayModes )
|
|
|
|
{
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendAction( PCB_ACTIONS::zoneDisplayFractured );
|
|
|
|
config.AppendAction( PCB_ACTIONS::zoneDisplayTriangulated );
|
2021-07-26 18:56:11 +01:00
|
|
|
}
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( PCB_ACTIONS::padDisplayMode )
|
|
|
|
.AppendAction( PCB_ACTIONS::viaDisplayMode )
|
|
|
|
.AppendAction( PCB_ACTIONS::trackDisplayMode );
|
2009-06-19 20:13:22 +00:00
|
|
|
|
2022-01-17 11:55:55 +00:00
|
|
|
if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendAction( ACTIONS::toggleBoundingBoxes );
|
2022-01-17 11:55:55 +00:00
|
|
|
|
2010-01-24 13:46:01 +00:00
|
|
|
// Tools to show/hide toolbars:
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( PCB_ACTIONS::showLayersManager )
|
|
|
|
.AppendAction( ACTIONS::showProperties );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
/* TODO (ISM): Support context menus in toolbars
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
|
2020-09-27 18:27:25 +01:00
|
|
|
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
|
|
|
gridMenu->Add( ACTIONS::gridProperties );
|
2023-08-26 13:29:24 +01:00
|
|
|
gridMenu->Add( ACTIONS::gridOrigin );
|
2025-02-20 02:53:15 +00:00
|
|
|
m_tbLeft->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
|
|
|
|
*/
|
2020-09-27 18:27:25 +01:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
// clang-format on
|
|
|
|
return config;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
std::optional<TOOLBAR_CONFIGURATION> PCB_EDIT_FRAME::DefaultRightToolbarConfig()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2025-02-20 02:53:15 +00:00
|
|
|
TOOLBAR_CONFIGURATION config;
|
2021-05-07 15:44:47 +02:00
|
|
|
|
2024-09-25 21:41:32 +01:00
|
|
|
// clang-format off
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendAction( ACTIONS::selectionTool )
|
|
|
|
.AppendAction( PCB_ACTIONS::localRatsnestTool );
|
|
|
|
|
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( PCB_ACTIONS::placeFootprint )
|
|
|
|
.AppendGroup( TOOLBAR_GROUP_CONFIG( "group.pcbRouting" )
|
|
|
|
.AddAction( PCB_ACTIONS::routeSingleTrack )
|
|
|
|
.AddAction( PCB_ACTIONS::routeDiffPair ) )
|
|
|
|
.AppendGroup( TOOLBAR_GROUP_CONFIG( "group.pcbTune" )
|
|
|
|
.AddAction( PCB_ACTIONS::tuneSingleTrack )
|
|
|
|
.AddAction( PCB_ACTIONS::tuneDiffPair )
|
|
|
|
.AddAction( PCB_ACTIONS::tuneSkew ) )
|
|
|
|
.AppendAction( PCB_ACTIONS::drawVia )
|
|
|
|
.AppendAction( PCB_ACTIONS::drawZone )
|
|
|
|
.AppendAction( PCB_ACTIONS::drawRuleArea );
|
|
|
|
|
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( PCB_ACTIONS::drawLine )
|
|
|
|
.AppendAction( PCB_ACTIONS::drawArc )
|
|
|
|
.AppendAction( PCB_ACTIONS::drawRectangle )
|
|
|
|
.AppendAction( PCB_ACTIONS::drawCircle )
|
|
|
|
.AppendAction( PCB_ACTIONS::drawPolygon )
|
|
|
|
.AppendAction( PCB_ACTIONS::drawBezier )
|
|
|
|
.AppendAction( PCB_ACTIONS::placeReferenceImage )
|
|
|
|
.AppendAction( PCB_ACTIONS::placeText )
|
|
|
|
.AppendAction( PCB_ACTIONS::drawTextBox )
|
|
|
|
.AppendAction( PCB_ACTIONS::drawTable )
|
|
|
|
.AppendGroup( TOOLBAR_GROUP_CONFIG( "group.pcbDimensions" )
|
|
|
|
.AddAction( PCB_ACTIONS::drawOrthogonalDimension )
|
|
|
|
.AddAction( PCB_ACTIONS::drawAlignedDimension )
|
|
|
|
.AddAction( PCB_ACTIONS::drawCenterDimension )
|
|
|
|
.AddAction( PCB_ACTIONS::drawRadialDimension )
|
|
|
|
.AddAction( PCB_ACTIONS::drawLeader ) )
|
|
|
|
.AppendAction( ACTIONS::deleteTool );
|
|
|
|
|
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendGroup( TOOLBAR_GROUP_CONFIG( "group.pcbOrigins" )
|
|
|
|
.AddAction( ACTIONS::gridSetOrigin )
|
|
|
|
.AddAction( PCB_ACTIONS::tuneDiffPair )
|
|
|
|
.AddAction( PCB_ACTIONS::drillOrigin ) )
|
|
|
|
.AppendAction( ACTIONS::measureTool );
|
|
|
|
|
|
|
|
/* TODO (ISM): Support context menus
|
|
|
|
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
|
2020-10-01 22:55:17 +01:00
|
|
|
|
2022-12-05 21:27:00 +03:00
|
|
|
auto makeArcMenu = [&]()
|
|
|
|
{
|
|
|
|
std::unique_ptr<ACTION_MENU> arcMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
2021-04-22 21:37:15 -04:00
|
|
|
|
2022-12-05 21:27:00 +03:00
|
|
|
arcMenu->Add( PCB_ACTIONS::pointEditorArcKeepCenter, ACTION_MENU::CHECK );
|
|
|
|
arcMenu->Add( PCB_ACTIONS::pointEditorArcKeepEndpoint, ACTION_MENU::CHECK );
|
2021-04-22 21:37:15 -04:00
|
|
|
|
2022-12-05 21:27:00 +03:00
|
|
|
return arcMenu;
|
|
|
|
};
|
2021-04-22 21:37:15 -04:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
m_tbRight->AddToolContextMenu( PCB_ACTIONS::drawArc, makeArcMenu() );
|
2022-12-05 21:27:00 +03:00
|
|
|
|
|
|
|
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-22 21:37:15 -04:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
m_tbRight->AddToolContextMenu( PCB_ACTIONS::routeSingleTrack, makeRouteMenu() );
|
|
|
|
m_tbRight->AddToolContextMenu( PCB_ACTIONS::routeDiffPair, makeRouteMenu() );
|
2020-06-23 11:44:39 +01:00
|
|
|
|
2020-10-01 22:55:17 +01:00
|
|
|
std::unique_ptr<ACTION_MENU> zoneMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
2020-08-14 00:09:17 +01:00
|
|
|
zoneMenu->Add( PCB_ACTIONS::zoneFillAll );
|
|
|
|
zoneMenu->Add( PCB_ACTIONS::zoneUnfillAll );
|
2025-02-20 02:53:15 +00:00
|
|
|
m_tbRight->AddToolContextMenu( PCB_ACTIONS::drawZone, std::move( zoneMenu ) );
|
2020-06-23 11:44:39 +01:00
|
|
|
|
2021-02-06 00:43:32 +01:00
|
|
|
std::unique_ptr<ACTION_MENU> lineMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
2025-02-20 02:53:15 +00:00
|
|
|
m_tbRight->AddToolContextMenu( PCB_ACTIONS::drawLine, std::move( lineMenu ) );
|
|
|
|
*/
|
2021-02-06 00:43:32 +01:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
// clang-format on
|
|
|
|
return config;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
std::optional<TOOLBAR_CONFIGURATION> PCB_EDIT_FRAME::DefaultTopMainToolbarConfig()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2025-02-20 02:53:15 +00:00
|
|
|
TOOLBAR_CONFIGURATION config;
|
2010-07-27 14:47:08 +02:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
// clang-format off
|
|
|
|
if( Kiface().IsSingle() )
|
2021-03-27 21:49:38 +00:00
|
|
|
{
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendAction( ACTIONS::doNew );
|
|
|
|
config.AppendAction( ACTIONS::open );
|
2015-01-05 14:20:04 +01:00
|
|
|
}
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendAction( ACTIONS::save );
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( PCB_ACTIONS::boardSetup );
|
2019-01-18 17:24:40 +01:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( ACTIONS::pageSettings )
|
|
|
|
.AppendAction( ACTIONS::print )
|
|
|
|
.AppendAction( ACTIONS::plot );
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( ACTIONS::undo )
|
|
|
|
.AppendAction( ACTIONS::redo );
|
2021-04-25 19:58:11 -04:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( ACTIONS::find );
|
2021-04-25 19:58:11 -04:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( ACTIONS::zoomRedraw )
|
|
|
|
.AppendAction( ACTIONS::zoomInCenter )
|
|
|
|
.AppendAction( ACTIONS::zoomOutCenter )
|
|
|
|
.AppendAction( ACTIONS::zoomFitScreen )
|
|
|
|
.AppendAction( ACTIONS::zoomFitObjects )
|
|
|
|
.AppendAction( ACTIONS::zoomTool );
|
2019-01-28 06:15:32 -08:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( PCB_ACTIONS::rotateCcw )
|
|
|
|
.AppendAction( PCB_ACTIONS::rotateCw )
|
|
|
|
.AppendAction( PCB_ACTIONS::mirrorV )
|
|
|
|
.AppendAction( PCB_ACTIONS::mirrorH )
|
|
|
|
.AppendAction( PCB_ACTIONS::group )
|
|
|
|
.AppendAction( PCB_ACTIONS::ungroup )
|
|
|
|
.AppendAction( PCB_ACTIONS::lock )
|
|
|
|
.AppendAction( PCB_ACTIONS::unlock );
|
2019-01-18 17:24:40 +01:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( ACTIONS::showFootprintEditor )
|
|
|
|
.AppendAction( ACTIONS::showFootprintBrowser )
|
|
|
|
.AppendAction( ACTIONS::show3DViewer );
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator();
|
2023-06-05 20:16:07 +02:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
if( !Kiface().IsSingle() )
|
|
|
|
config.AppendAction( ACTIONS::updatePcbFromSchematic );
|
|
|
|
else
|
|
|
|
config.AppendAction( PCB_ACTIONS::importNetlist );
|
2023-06-05 20:16:07 +02:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendAction( PCB_ACTIONS::runDRC );
|
2023-06-05 20:16:07 +02:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendAction( PCB_ACTIONS::showEeschema );
|
|
|
|
|
|
|
|
config.AppendControl( "control.PCBPlugin" );
|
2023-06-05 20:16:07 +02:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
// clang-format on
|
|
|
|
return config;
|
|
|
|
}
|
2019-01-18 17:24:40 +01:00
|
|
|
|
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
std::optional<TOOLBAR_CONFIGURATION> PCB_EDIT_FRAME::DefaultTopAuxToolbarConfig()
|
|
|
|
{
|
|
|
|
TOOLBAR_CONFIGURATION config;
|
2018-11-28 09:58:41 -05:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
// clang-format off
|
|
|
|
config.AppendControl( "control.PCBTrackWidth" );
|
|
|
|
|
|
|
|
/* TODO (ISM): Turn this into an action
|
|
|
|
m_tbTopAux->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, wxEmptyString,
|
|
|
|
KiBitmapBundle( BITMAPS::auto_track_width ),
|
|
|
|
_( "When routing from an existing track use its width instead "
|
|
|
|
"of the current width setting" ),
|
|
|
|
wxITEM_CHECK );
|
|
|
|
*/
|
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendControl( "control.PCBViaDia" );
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendControl( m_tbPcbLayerSelectorName )
|
|
|
|
.AppendAction( PCB_ACTIONS::selectLayerPair );
|
2019-01-18 17:24:40 +01:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
// TODO (ISM): Figure out this part
|
|
|
|
PrepareLayerIndicator( true ); // Force rebuild of the bitmap with the active layer colors
|
2019-01-18 17:24:40 +01:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendControl( m_tbGridSelectName );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
config.AppendSeparator()
|
|
|
|
.AppendControl( m_tbZoomSelectName );
|
2021-03-27 21:49:38 +00:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
// clang-format on
|
|
|
|
return config;
|
2011-02-21 08:54:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
void PCB_EDIT_FRAME::configureToolbars()
|
2021-03-27 21:49:38 +00:00
|
|
|
{
|
2025-02-20 02:53:15 +00:00
|
|
|
PCB_BASE_FRAME::configureToolbars();
|
2021-03-27 21:49:38 +00:00
|
|
|
|
2025-02-20 02:53:15 +00:00
|
|
|
// Box to display and choose track widths
|
|
|
|
auto trackWidthSelectorFactory = [this]( ACTION_TOOLBAR* aToolbar )
|
|
|
|
{
|
|
|
|
if( !m_SelTrackWidthBox )
|
|
|
|
{
|
|
|
|
m_SelTrackWidthBox = new wxChoice( aToolbar, ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0, nullptr );
|
|
|
|
}
|
|
|
|
|
|
|
|
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." ) );
|
|
|
|
|
|
|
|
UpdateTrackWidthSelectBox( m_SelTrackWidthBox, true, true );
|
|
|
|
|
|
|
|
aToolbar->Add( m_SelTrackWidthBox );
|
|
|
|
};
|
|
|
|
|
|
|
|
RegisterCustomToolbarControlFactory( "control.PCBTrackWidth", _( "Track width selector" ),
|
|
|
|
_( "Control to select the track width" ),
|
|
|
|
trackWidthSelectorFactory );
|
|
|
|
|
|
|
|
|
|
|
|
// Box to display and choose vias diameters
|
|
|
|
auto viaDiaSelectorFactory = [this]( ACTION_TOOLBAR* aToolbar )
|
|
|
|
{
|
|
|
|
if( !m_SelViaSizeBox )
|
|
|
|
{
|
|
|
|
m_SelViaSizeBox = new wxChoice( aToolbar, ID_AUX_TOOLBAR_PCB_VIA_SIZE,
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0, nullptr );
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdateViaSizeSelectBox( m_SelViaSizeBox, true, true );
|
|
|
|
aToolbar->Add( m_SelViaSizeBox );
|
|
|
|
};
|
|
|
|
|
|
|
|
RegisterCustomToolbarControlFactory( "control.PCBViaDia", _( "Via diameter selector" ),
|
|
|
|
_( "Control to select the via diameter" ),
|
|
|
|
viaDiaSelectorFactory );
|
|
|
|
|
|
|
|
// IPC/Scripting plugin control
|
|
|
|
// TODO (ISM): Clean this up to make IPC actions just normal tool actions to get rid of this entire
|
|
|
|
// control
|
|
|
|
auto pluginControlFactory = [this]( ACTION_TOOLBAR* aToolbar )
|
|
|
|
{
|
|
|
|
// Add scripting console and API plugins
|
|
|
|
bool scriptingAvailable = SCRIPTING::IsWxAvailable();
|
|
|
|
|
|
|
|
#ifdef KICAD_IPC_API
|
|
|
|
bool haveApiPlugins = Pgm().GetCommonSettings()->m_Api.enable_server &&
|
|
|
|
!Pgm().GetPluginManager().GetActionsForScope( PluginActionScope() ).empty();
|
|
|
|
#else
|
|
|
|
bool haveApiPlugins = false;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if( scriptingAvailable || haveApiPlugins )
|
|
|
|
{
|
|
|
|
aToolbar->AddScaledSeparator( aToolbar->GetParent() );
|
|
|
|
|
|
|
|
if( scriptingAvailable )
|
|
|
|
{
|
|
|
|
aToolbar->Add( PCB_ACTIONS::showPythonConsole );
|
|
|
|
addActionPluginTools( aToolbar );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( haveApiPlugins )
|
|
|
|
AddApiPluginTools( aToolbar );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
RegisterCustomToolbarControlFactory( "control.PCBPlugin", _( "IPC/Scripting plugins" ),
|
|
|
|
_( "Region to hold the IPC/Scripting action buttons" ),
|
|
|
|
pluginControlFactory );
|
2021-03-27 21:49:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-05 20:26:33 +01: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 20:26:33 +01:00
|
|
|
}
|
|
|
|
|
2022-09-16 04:38:10 +00:00
|
|
|
text.Printf( format, EDA_UNIT_UTILS::UI::ToUserUnit( pcbIUScale, aUnits, aValue ) );
|
2020-10-05 20:26:33 +01:00
|
|
|
|
|
|
|
if( aIncludeLabel )
|
2022-09-19 10:25:20 +01:00
|
|
|
text += EDA_UNIT_UTILS::GetText( aUnits, EDA_DATA_TYPE::DISTANCE );
|
2020-10-05 20:26:33 +01:00
|
|
|
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-03-12 22:14:15 +00:00
|
|
|
void PCB_EDIT_FRAME::UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, bool aShowNetclass,
|
|
|
|
bool aShowEdit )
|
2011-02-21 08:54:29 -05:00
|
|
|
{
|
2021-07-19 19:56:05 -04:00
|
|
|
if( aTrackWidthSelectBox == nullptr )
|
2011-02-21 08:54:29 -05:00
|
|
|
return;
|
|
|
|
|
2020-10-05 20:26:33 +01:00
|
|
|
EDA_UNITS primaryUnit;
|
|
|
|
EDA_UNITS secondaryUnit;
|
|
|
|
|
|
|
|
GetUnitPair( primaryUnit, secondaryUnit );
|
|
|
|
|
2011-02-21 08:54:29 -05:00
|
|
|
wxString msg;
|
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
aTrackWidthSelectBox->Clear();
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2024-03-12 22:14:15 +00:00
|
|
|
if( aShowNetclass )
|
|
|
|
aTrackWidthSelectBox->Append( _( "Track: use netclass width" ) );
|
2020-10-10 19:29:41 +01:00
|
|
|
|
|
|
|
for( unsigned ii = 1; ii < GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
2010-07-12 09:07:09 -05:00
|
|
|
{
|
2015-01-05 14:20:04 +01:00
|
|
|
int size = GetDesignSettings().m_TrackWidthList[ii];
|
|
|
|
|
2020-10-05 20:26:33 +01:00
|
|
|
msg.Printf( _( "Track: %s (%s)" ), ComboBoxUnits( primaryUnit, size ),
|
|
|
|
ComboBoxUnits( secondaryUnit, size ) );
|
2015-01-05 14:20:04 +01:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
aTrackWidthSelectBox->Append( msg );
|
2010-07-12 09:07:09 -05:00
|
|
|
}
|
2011-03-01 14:26:17 -05:00
|
|
|
|
2024-03-12 22:14:15 +00:00
|
|
|
if( aShowEdit )
|
2019-02-08 05:50:20 -08:00
|
|
|
{
|
|
|
|
aTrackWidthSelectBox->Append( wxT( "---" ) );
|
2020-04-08 22:34:18 +01:00
|
|
|
aTrackWidthSelectBox->Append( _( "Edit Pre-defined Sizes..." ) );
|
2019-02-08 05:50:20 -08:00
|
|
|
}
|
2018-11-17 00:33:20 +00:00
|
|
|
|
2014-05-13 11:22:51 +02:00
|
|
|
if( GetDesignSettings().GetTrackWidthIndex() >= GetDesignSettings().m_TrackWidthList.size() )
|
|
|
|
GetDesignSettings().SetTrackWidthIndex( 0 );
|
2013-01-09 13:52:44 -05:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
aTrackWidthSelectBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
|
2011-02-21 08:54:29 -05:00
|
|
|
}
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2024-03-12 22:14:15 +00:00
|
|
|
void PCB_EDIT_FRAME::UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool aShowNetclass,
|
|
|
|
bool aShowEdit )
|
2011-02-21 08:54:29 -05:00
|
|
|
{
|
2021-07-19 19:56:05 -04:00
|
|
|
if( aViaSizeSelectBox == nullptr )
|
2011-02-21 08:54:29 -05:00
|
|
|
return;
|
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
aViaSizeSelectBox->Clear();
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2020-10-05 20:26:33 +01:00
|
|
|
COMMON_TOOLS* cmnTool = m_toolManager->GetTool<COMMON_TOOLS>();
|
|
|
|
|
|
|
|
EDA_UNITS primaryUnit = GetUserUnits();
|
|
|
|
EDA_UNITS secondaryUnit = EDA_UNITS::MILS;
|
|
|
|
|
2020-10-24 10:45:37 -04:00
|
|
|
if( EDA_UNIT_UTILS::IsImperialUnit( primaryUnit ) )
|
2020-10-05 20:26:33 +01: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 08:54:29 -05:00
|
|
|
|
2024-03-12 22:14:15 +00:00
|
|
|
if( aShowNetclass )
|
|
|
|
aViaSizeSelectBox->Append( _( "Via: use netclass sizes" ) );
|
2020-10-10 19:29:41 +01:00
|
|
|
|
2020-10-15 15:31:23 +02:00
|
|
|
for( unsigned ii = 1; ii < GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2018-04-28 16:22:25 +01:00
|
|
|
VIA_DIMENSION viaDimension = GetDesignSettings().m_ViasDimensionsList[ii];
|
2020-10-05 20:26:33 +01:00
|
|
|
wxString msg, priStr, secStr;
|
2015-01-05 14:20:04 +01:00
|
|
|
|
2020-10-05 20:26:33 +01:00
|
|
|
double diam = viaDimension.m_Diameter;
|
|
|
|
double hole = viaDimension.m_Drill;
|
2015-01-05 14:20:04 +01:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
if( hole > 0 )
|
2020-10-05 20:26:33 +01:00
|
|
|
{
|
2022-02-04 22:44:59 +00:00
|
|
|
priStr = ComboBoxUnits( primaryUnit, diam, false ) + wxT( " / " )
|
2020-10-20 18:09:00 +01:00
|
|
|
+ ComboBoxUnits( primaryUnit, hole, true );
|
2022-02-04 22:44:59 +00:00
|
|
|
secStr = ComboBoxUnits( secondaryUnit, diam, false ) + wxT( " / " )
|
2020-10-20 18:09:00 +01:00
|
|
|
+ ComboBoxUnits( secondaryUnit, hole, true );
|
2020-10-05 20:26:33 +01:00
|
|
|
}
|
2018-04-28 16:22:25 +01:00
|
|
|
else
|
2020-10-05 20:26:33 +01:00
|
|
|
{
|
2020-10-20 18:09:00 +01:00
|
|
|
priStr = ComboBoxUnits( primaryUnit, diam, true );
|
|
|
|
secStr = ComboBoxUnits( secondaryUnit, diam, true );
|
2020-10-05 20:26:33 +01:00
|
|
|
}
|
2018-04-28 16:22:25 +01:00
|
|
|
|
2020-10-05 20:26:33 +01:00
|
|
|
msg.Printf( _( "Via: %s (%s)" ), priStr, secStr );
|
2008-12-05 16:03:05 +00:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
aViaSizeSelectBox->Append( msg );
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2011-03-01 14:26:17 -05:00
|
|
|
|
2024-03-12 22:14:15 +00:00
|
|
|
if( aShowEdit )
|
2019-02-08 05:50:20 -08:00
|
|
|
{
|
|
|
|
aViaSizeSelectBox->Append( wxT( "---" ) );
|
2020-04-08 22:34:18 +01:00
|
|
|
aViaSizeSelectBox->Append( _( "Edit Pre-defined Sizes..." ) );
|
2019-02-08 05:50:20 -08:00
|
|
|
}
|
2018-11-17 00:33:20 +00:00
|
|
|
|
2014-05-13 11:22:51 +02:00
|
|
|
if( GetDesignSettings().GetViaSizeIndex() >= GetDesignSettings().m_ViasDimensionsList.size() )
|
|
|
|
GetDesignSettings().SetViaSizeIndex( 0 );
|
2011-12-16 08:32:23 -05:00
|
|
|
|
2018-04-28 16:22:25 +01:00
|
|
|
aViaSizeSelectBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
|
2011-02-21 08:54:29 -05:00
|
|
|
}
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2013-09-02 17:26:52 +02:00
|
|
|
void PCB_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2025-02-20 02:53:15 +00:00
|
|
|
if( m_SelLayerBox == nullptr || m_tbTopAux == nullptr )
|
2013-09-02 17:26:52 +02:00
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2013-09-02 17:26:52 +02:00
|
|
|
m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
|
2010-11-03 00:13:56 +01:00
|
|
|
m_SelLayerBox->Resync();
|
2008-04-29 13:35:26 +00:00
|
|
|
|
2013-09-02 17:26:52 +02:00
|
|
|
if( aForceResizeToolbar )
|
2021-04-02 21:33:31 +01:00
|
|
|
UpdateToolbarControlSizes();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2015-10-14 14:12:17 -04:00
|
|
|
|
|
|
|
|
2019-06-04 22:29:51 +01:00
|
|
|
void PCB_EDIT_FRAME::ToggleLayersManager()
|
2015-10-14 14:12:17 -04:00
|
|
|
{
|
2021-08-19 21:15:14 -04:00
|
|
|
PCBNEW_SETTINGS* settings = GetPcbNewSettings();
|
2024-12-29 08:02:08 -05:00
|
|
|
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( AppearancePanelName() );
|
2021-10-30 23:21:15 +01:00
|
|
|
wxAuiPaneInfo& selectionFilter = m_auimgr.GetPane( "SelectionFilter" );
|
2021-08-19 21:15:14 -04:00
|
|
|
|
2019-06-04 22:29:51 +01:00
|
|
|
// show auxiliary Vertical layers and visibility manager toolbar
|
2024-12-29 08:02:08 -05:00
|
|
|
m_show_layer_manager_tools = layersManager.IsShown();
|
|
|
|
|
2019-06-04 22:29:51 +01:00
|
|
|
m_show_layer_manager_tools = !m_show_layer_manager_tools;
|
2020-10-18 21:57:18 -04:00
|
|
|
|
2021-08-19 21:15:14 -04:00
|
|
|
layersManager.Show( m_show_layer_manager_tools );
|
2021-10-30 23:21:15 +01:00
|
|
|
selectionFilter.Show( m_show_layer_manager_tools );
|
2021-08-19 21:15:14 -04: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 22:29:51 +01:00
|
|
|
}
|
2015-10-14 14:12:17 -04:00
|
|
|
|
2020-02-04 09:40:25 +01:00
|
|
|
|
2024-03-04 23:00:26 +00:00
|
|
|
void PCB_EDIT_FRAME::ToggleNetInspector()
|
|
|
|
{
|
|
|
|
PCBNEW_SETTINGS* settings = GetPcbNewSettings();
|
|
|
|
wxAuiPaneInfo& netInspectorPanel = m_auimgr.GetPane( NetInspectorPanelName() );
|
|
|
|
|
2024-12-29 08:02:08 -05:00
|
|
|
m_show_net_inspector = netInspectorPanel.IsShown();
|
|
|
|
|
2024-03-04 23:00:26 +00:00
|
|
|
m_show_net_inspector = !m_show_net_inspector;
|
|
|
|
|
|
|
|
netInspectorPanel.Show( m_show_net_inspector );
|
|
|
|
|
|
|
|
if( m_show_net_inspector )
|
|
|
|
{
|
|
|
|
SetAuiPaneSize( m_auimgr, netInspectorPanel, settings->m_AuiPanels.net_inspector_width,
|
|
|
|
-1 );
|
2024-03-24 07:56:53 +00:00
|
|
|
m_netInspectorPanel->OnShowPanel();
|
2024-03-04 23:00:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_netInspectorPanel->SaveSettings();
|
|
|
|
settings->m_AuiPanels.net_inspector_width = m_netInspectorPanel->GetSize().x;
|
|
|
|
m_auimgr.Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-14 02:59:57 +00:00
|
|
|
void PCB_EDIT_FRAME::ToggleSearch()
|
|
|
|
{
|
2022-11-25 09:11:20 -05:00
|
|
|
PCBNEW_SETTINGS* settings = GetPcbNewSettings();
|
|
|
|
|
2022-10-02 10:20:26 +02: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 09:11:20 -05:00
|
|
|
wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
|
|
|
|
searchPaneInfo.Show( m_show_search );
|
2024-12-29 08:02:08 -05:00
|
|
|
|
2022-09-14 02:59:57 +00:00
|
|
|
if( m_show_search )
|
|
|
|
{
|
2023-05-18 22:03:33 +02: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 09:11:20 -05:00
|
|
|
else
|
2024-12-29 08:02:08 -05:00
|
|
|
{
|
2022-11-25 09:11:20 -05:00
|
|
|
settings->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
|
2023-05-18 22:03:33 +02:00
|
|
|
settings->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
|
|
|
|
settings->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
|
2022-11-25 09:11:20 -05:00
|
|
|
m_auimgr.Update();
|
2024-10-21 20:32:53 +00:00
|
|
|
GetCanvas()->SetFocus();
|
2022-11-25 09:11:20 -05:00
|
|
|
}
|
2022-09-14 02:59:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-15 23:49:48 +01:00
|
|
|
void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_TRACK_WIDTH )
|
|
|
|
{
|
2020-10-10 19:29:41 +01:00
|
|
|
BOARD_DESIGN_SETTINGS& bds = GetDesignSettings();
|
|
|
|
int sel;
|
|
|
|
|
2020-10-12 21:00:13 +01:00
|
|
|
if( bds.UseCustomTrackViaSize() )
|
2020-10-10 19:29:41 +01:00
|
|
|
sel = wxNOT_FOUND;
|
|
|
|
else
|
|
|
|
sel = bds.GetTrackWidthIndex();
|
|
|
|
|
|
|
|
if( m_SelTrackWidthBox->GetSelection() != sel )
|
|
|
|
m_SelTrackWidthBox->SetSelection( sel );
|
2019-05-15 23:49:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_VIA_SIZE )
|
|
|
|
{
|
2020-10-10 19:29:41 +01: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 23:49:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-10 19:29:41 +01:00
|
|
|
void PCB_EDIT_FRAME::OnUpdateSelectAutoWidth( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
BOARD_DESIGN_SETTINGS& bds = GetDesignSettings();
|
|
|
|
|
2021-12-15 10:48:34 -05:00
|
|
|
aEvent.Check( bds.m_UseConnectedTrackWidth );
|
2020-10-10 19:29:41 +01:00
|
|
|
}
|