2011-10-28 13:43:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
2017-12-26 14:38:45 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
2022-01-25 22:33:37 +00:00
|
|
|
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-28 13:43:37 +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
|
|
|
|
*/
|
|
|
|
|
2022-01-17 11:55:55 +00:00
|
|
|
#include <advanced_config.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <eeschema_id.h>
|
2020-10-31 01:27:16 +00:00
|
|
|
#include <symbol_edit_frame.h>
|
2020-05-22 23:11:04 +00:00
|
|
|
#include <sch_painter.h>
|
2020-10-31 01:27:16 +00:00
|
|
|
#include <symbol_library_manager.h>
|
2019-06-09 21:57:23 +00:00
|
|
|
#include <tool/action_toolbar.h>
|
2020-09-27 17:27:25 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2019-05-14 19:21:10 +00:00
|
|
|
#include <tools/ee_actions.h>
|
2020-09-27 17:27:25 +00:00
|
|
|
#include <tools/ee_selection_tool.h>
|
2010-06-30 11:15:34 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#ifdef __UNIX__
|
|
|
|
#define LISTBOX_WIDTH 140
|
|
|
|
#else
|
|
|
|
#define LISTBOX_WIDTH 120
|
|
|
|
#endif
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2020-10-31 01:27:16 +00:00
|
|
|
void SYMBOL_EDIT_FRAME::ReCreateVToolbar()
|
2007-06-05 12:10:51 +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 );
|
|
|
|
}
|
2009-09-14 13:24:17 +00:00
|
|
|
|
|
|
|
// Set up toolbar
|
2019-06-24 15:27:05 +00:00
|
|
|
m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
|
2019-05-15 22:49:48 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_drawToolBar->AddScaledSeparator( this );
|
2019-05-14 19:21:10 +00:00
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeSymbolPin, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeSymbolText, ACTION_TOOLBAR::TOGGLE );
|
2022-01-25 22:33:37 +00:00
|
|
|
m_drawToolBar->Add( EE_ACTIONS::drawSymbolTextBox, ACTION_TOOLBAR::TOGGLE );
|
2021-07-17 19:56:18 +00:00
|
|
|
m_drawToolBar->Add( EE_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE );
|
2019-05-14 19:21:10 +00:00
|
|
|
m_drawToolBar->Add( EE_ACTIONS::drawSymbolLines, ACTION_TOOLBAR::TOGGLE );
|
2023-05-07 13:51:17 +00:00
|
|
|
m_drawToolBar->Add( EE_ACTIONS::drawSymbolPolygon, ACTION_TOOLBAR::TOGGLE );
|
2019-05-14 19:21:10 +00:00
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeSymbolAnchor, ACTION_TOOLBAR::TOGGLE );
|
2019-07-31 12:10:13 +00:00
|
|
|
m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_drawToolBar->Realize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-31 01:27:16 +00:00
|
|
|
void SYMBOL_EDIT_FRAME::ReCreateHToolbar()
|
2007-08-30 08:15:05 +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,
|
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
2020-09-26 23:55:59 +00:00
|
|
|
m_mainToolBar->SetAuiManager( &m_auimgr );
|
|
|
|
}
|
2010-02-08 18:15:42 +00:00
|
|
|
|
2009-09-14 13:24:17 +00:00
|
|
|
// Set up toolbar
|
2019-06-02 18:58:09 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::newSymbol );
|
2020-08-31 15:06:23 +00:00
|
|
|
|
|
|
|
if( !IsSymbolFromSchematic() )
|
|
|
|
m_mainToolBar->Add( ACTIONS::saveAll );
|
|
|
|
else
|
2021-02-06 14:31:04 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::save );
|
2017-11-20 14:38:38 +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::undo );
|
|
|
|
m_mainToolBar->Add( ACTIONS::redo );
|
2017-11-20 14:38:38 +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-05 00:48:22 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE, ACTION_TOOLBAR::CANCEL );
|
2017-11-20 14:38:38 +00:00
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
|
|
|
m_mainToolBar->Add( EE_ACTIONS::rotateCCW );
|
|
|
|
m_mainToolBar->Add( EE_ACTIONS::rotateCW );
|
|
|
|
m_mainToolBar->Add( EE_ACTIONS::mirrorV );
|
|
|
|
m_mainToolBar->Add( EE_ACTIONS::mirrorH );
|
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-05-14 19:21:10 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::symbolProperties );
|
|
|
|
m_mainToolBar->Add( EE_ACTIONS::pinTable );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-06-01 18:36:49 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::showDatasheet );
|
2020-11-21 20:42:27 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::checkSymbol );
|
2018-07-24 21:16:59 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2020-08-06 23:03:58 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::showDeMorganStandard, ACTION_TOOLBAR::TOGGLE );
|
2019-06-01 19:48:01 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::showDeMorganAlternate, ACTION_TOOLBAR::TOGGLE );
|
2018-07-24 21:16:59 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2020-05-30 12:08:00 +00:00
|
|
|
|
|
|
|
if( m_unitSelectBox == nullptr )
|
2021-06-15 12:31:28 +00:00
|
|
|
m_unitSelectBox = new wxComboBox( m_mainToolBar, ID_LIBEDIT_SELECT_UNIT_NUMBER,
|
2020-06-03 20:57:08 +00:00
|
|
|
wxEmptyString, wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ), 0,
|
|
|
|
nullptr, wxCB_READONLY );
|
2019-06-16 18:51:47 +00:00
|
|
|
m_mainToolBar->AddControl( m_unitSelectBox );
|
2011-12-09 16:37:11 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-06-16 18:51:47 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::toggleSyncedPinsMode, ACTION_TOOLBAR::TOGGLE );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-06-16 18:51:47 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::addSymbolToSchematic );
|
2019-04-15 21:09:14 +00:00
|
|
|
|
2011-02-23 14:20:01 +00:00
|
|
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->Realize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2011-02-23 14:20:01 +00:00
|
|
|
|
|
|
|
|
2020-10-31 01:27:16 +00:00
|
|
|
void SYMBOL_EDIT_FRAME::ReCreateOptToolbar()
|
2011-02-23 14:20:01 +00:00
|
|
|
{
|
2011-12-14 20:03:15 +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 );
|
|
|
|
}
|
2011-02-23 14:20:01 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_optionsToolBar->Add( ACTIONS::toggleGrid, 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 );
|
2020-06-17 11:03:25 +00:00
|
|
|
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( EE_ACTIONS::showElectricalTypes, ACTION_TOOLBAR::TOGGLE );
|
2022-01-17 11:55:55 +00:00
|
|
|
|
|
|
|
if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
|
|
|
|
m_optionsToolBar->Add( ACTIONS::toggleBoundingBoxes, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
|
|
|
|
m_optionsToolBar->AddScaledSeparator( this );
|
2021-03-18 11:46:07 +00:00
|
|
|
m_optionsToolBar->Add( EE_ACTIONS::showSymbolTree, ACTION_TOOLBAR::TOGGLE );
|
2017-10-31 11:13:20 +00:00
|
|
|
|
2020-09-27 17:27:25 +00:00
|
|
|
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
|
|
|
|
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
|
|
|
gridMenu->Add( ACTIONS::gridProperties );
|
|
|
|
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->Realize();
|
2011-02-23 14:20:01 +00:00
|
|
|
}
|