2011-12-16 13:32:23 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2013-02-11 18:50:55 +00:00
|
|
|
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2018-03-16 12:38:36 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
2019-05-13 21:49:05 +00:00
|
|
|
* Copyright (C) 2004-2019 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
|
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2018-08-03 12:18:26 +00:00
|
|
|
#include <sch_draw_panel.h>
|
2018-01-30 10:49:51 +00:00
|
|
|
#include <sch_edit_frame.h>
|
2014-05-05 17:28:40 +00:00
|
|
|
#include <kiface_i.h>
|
2017-02-20 12:20:39 +00:00
|
|
|
#include <bitmaps.h>
|
2019-05-10 17:19:48 +00:00
|
|
|
#include <ee_hotkeys.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <eeschema_id.h>
|
2019-05-13 20:42:40 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2019-05-14 19:21:10 +00:00
|
|
|
#include <tool/action_toolbar.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <help_common_strings.h>
|
2019-05-13 20:42:40 +00:00
|
|
|
#include <tools/ee_actions.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
/* Create the main Horizontal Toolbar for the schematic editor
|
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::ReCreateHToolbar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-01-08 04:05:03 +00:00
|
|
|
if( m_mainToolBar )
|
|
|
|
m_mainToolBar->Clear();
|
|
|
|
else
|
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 );
|
2007-08-30 08:15:05 +00:00
|
|
|
wxString msg;
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
// Set up toolbar
|
2015-06-01 18:02:32 +00:00
|
|
|
if( Kiface().IsSingle() ) // not when under a project mgr
|
|
|
|
{
|
2019-05-24 23:36:31 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::doNew );
|
|
|
|
m_mainToolBar->Add( ACTIONS::open );
|
2015-06-01 18:02:32 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2019-05-24 23:36:31 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::saveAll );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2019-05-26 15:36:40 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::pageSettings );
|
2019-05-24 23:36:31 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::print );
|
|
|
|
m_mainToolBar->Add( ACTIONS::plot );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
m_mainToolBar->AddSeparator();
|
|
|
|
m_mainToolBar->Add( ACTIONS::paste );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
m_mainToolBar->AddSeparator();
|
|
|
|
m_mainToolBar->Add( ACTIONS::undo );
|
|
|
|
m_mainToolBar->Add( ACTIONS::redo );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2019-05-15 22:49:48 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::find );
|
2019-05-19 21:04:04 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::findAndReplace );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
m_mainToolBar->AddSeparator();
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomRedraw );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomInCenter );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
|
2011-08-29 20:45:22 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
m_mainToolBar->AddSeparator();
|
|
|
|
m_mainToolBar->Add( EE_ACTIONS::navigateHierarchy );
|
|
|
|
m_mainToolBar->Add( EE_ACTIONS::leaveSheet );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
m_mainToolBar->AddSeparator();
|
|
|
|
m_mainToolBar->Add( EE_ACTIONS::showSymbolEditor );
|
|
|
|
m_mainToolBar->Add( EE_ACTIONS::showLibraryBrowser );
|
2011-08-29 20:45:22 +00:00
|
|
|
|
2017-01-28 20:48:55 +00:00
|
|
|
// modedit is with libedit in a "library section" because the user must have footprints before
|
|
|
|
// they can be assigned.
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_RUN_PCB_MODULE_EDITOR, wxEmptyString,
|
|
|
|
KiScaledBitmap( module_editor_xpm, this ),
|
2017-06-02 09:51:11 +00:00
|
|
|
_( "Footprint Editor - Create/edit footprints" ) );
|
2015-06-01 18:02:32 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2011-08-29 20:45:22 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, KiScaledBitmap( annotate_xpm, this ),
|
2012-01-21 15:02:49 +00:00
|
|
|
HELP_ANNOTATE );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_GET_ERC, wxEmptyString, KiScaledBitmap( erc_xpm, this ),
|
2015-01-05 21:01:35 +00:00
|
|
|
_( "Perform electrical rules check" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_RUN_CVPCB, wxEmptyString, KiScaledBitmap( cvpcb_xpm, this ),
|
2018-06-23 20:05:16 +00:00
|
|
|
_( "Assign PCB footprints to schematic symbols" ) );
|
2017-01-28 20:48:55 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_OPEN_CMP_TABLE, wxEmptyString,
|
|
|
|
KiScaledBitmap( spreadsheet_xpm, this ), _( "Edit symbol fields" ) );
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, KiScaledBitmap( bom_xpm, this ),
|
2012-01-21 15:02:49 +00:00
|
|
|
HELP_GENERATE_BOM );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2011-08-29 20:45:22 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_RUN_PCB, wxEmptyString, KiScaledBitmap( pcbnew_xpm, this ),
|
2011-12-16 13:32:23 +00:00
|
|
|
_( "Run Pcbnew to layout printed circuit board" ) );
|
2011-08-29 20:45:22 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( import_footprint_names_xpm, this ),
|
2012-01-21 15:02:49 +00:00
|
|
|
HELP_IMPORT_FOOTPRINTS );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
// after adding the tools to the toolbar, must call Realize() to reflect the changes
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->Realize();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Create Vertical Right Toolbar
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::ReCreateVToolbar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_drawToolBar )
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->Clear();
|
|
|
|
else
|
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 );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
|
|
|
// Set up toolbar
|
2019-05-14 19:21:10 +00:00
|
|
|
m_drawToolBar->Add( EE_ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::highlightNetCursor, ACTION_TOOLBAR::TOGGLE );
|
2019-05-15 22:49:48 +00:00
|
|
|
|
|
|
|
KiScaledSeparator( m_drawToolBar, this );
|
2019-05-14 19:21:10 +00:00
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeSymbol, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placePower, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::drawWire, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::drawBus, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeBusWireEntry, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeBusBusEntry, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeNoConnect, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeJunction, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeLabel, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeGlobalLabel, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeHierarchicalLabel, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::drawSheet, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::importSheetPin, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeSheetPin, ACTION_TOOLBAR::TOGGLE );
|
2019-05-15 22:49:48 +00:00
|
|
|
|
|
|
|
KiScaledSeparator( m_drawToolBar, this );
|
2019-05-14 19:21:10 +00:00
|
|
|
m_drawToolBar->Add( EE_ACTIONS::drawLines, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeSchematicText, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::placeImage, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_drawToolBar->Add( EE_ACTIONS::deleteItemCursor, ACTION_TOOLBAR::TOGGLE );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_drawToolBar->Realize();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Create Vertical Left Toolbar (Option Toolbar)
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::ReCreateOptToolbar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_optionsToolBar )
|
2018-01-08 04:05:03 +00:00
|
|
|
m_optionsToolBar->Clear();
|
|
|
|
else
|
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 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( EE_ACTIONS::toggleHiddenPins, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( EE_ACTIONS::toggleForceHV, ACTION_TOOLBAR::TOGGLE );
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->Realize();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-13 20:42:40 +00:00
|
|
|
void SCH_EDIT_FRAME::SyncMenusAndToolbars()
|
|
|
|
{
|
|
|
|
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
|
2019-05-24 23:36:31 +00:00
|
|
|
SCH_SHEET_LIST sheetList( g_RootSheet );
|
2019-05-13 20:42:40 +00:00
|
|
|
|
2019-05-24 23:36:31 +00:00
|
|
|
m_mainToolBar->Toggle( ACTIONS::saveAll, sheetList.IsModified() );
|
2019-05-15 22:49:48 +00:00
|
|
|
m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
|
|
|
|
m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
|
|
|
|
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
|
|
|
|
m_mainToolBar->Refresh();
|
2019-05-13 20:42:40 +00:00
|
|
|
|
2019-05-15 22:49:48 +00:00
|
|
|
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
|
|
|
|
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
|
|
|
|
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
|
|
|
|
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
|
|
|
|
m_optionsToolBar->Toggle( EE_ACTIONS::toggleHiddenPins, GetShowAllPins() );
|
|
|
|
m_optionsToolBar->Toggle( EE_ACTIONS::toggleForceHV, GetForceHVLines() );
|
2019-05-13 20:42:40 +00:00
|
|
|
m_optionsToolBar->Refresh();
|
2019-05-15 22:49:48 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::highlightNetCursor, GetToolId() == ID_HIGHLIGHT_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placeSymbol, GetToolId() == ID_COMPONENT_BUTT );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placePower, GetToolId() == ID_PLACE_POWER_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::drawWire, GetToolId() == ID_WIRE_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::drawBus, GetToolId() == ID_BUS_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placeBusWireEntry, GetToolId() == ID_WIRETOBUS_ENTRY_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placeBusBusEntry, GetToolId() == ID_BUSTOBUS_ENTRY_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placeNoConnect, GetToolId() == ID_NOCONNECT_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placeJunction, GetToolId() == ID_JUNCTION_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placeLabel, GetToolId() == ID_LABEL_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placeGlobalLabel, GetToolId() == ID_GLOBALLABEL_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placeHierarchicalLabel, GetToolId() == ID_HIERLABEL_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::drawSheet, GetToolId() == ID_SHEET_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::importSheetPin, GetToolId() == ID_IMPORT_SHEETPIN_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placeSheetPin, GetToolId() == ID_SHEETPIN_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::drawLines, GetToolId() == ID_SCHEMATIC_LINE_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placeSchematicText, GetToolId() == ID_SCHEMATIC_TEXT_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::placeImage, GetToolId() == ID_PLACE_IMAGE_TOOL );
|
|
|
|
m_drawToolBar->Toggle( EE_ACTIONS::deleteItemCursor, GetToolId() == ID_DELETE_TOOL );
|
|
|
|
m_drawToolBar->Refresh();
|
2019-05-13 20:42:40 +00:00
|
|
|
}
|