KiCad PCB EDA Suite
toolbars_sch_editor.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include <fctsys.h>
27 #include <sch_draw_panel.h>
28 #include <sch_edit_frame.h>
29 #include <kiface_i.h>
30 #include <bitmaps.h>
31 #include <ee_hotkeys.h>
32 #include <eeschema_id.h>
33 #include <tool/tool_manager.h>
34 #include <tool/action_toolbar.h>
35 #include <help_common_strings.h>
36 #include <tools/ee_actions.h>
37 
38 /* Create the main Horizontal Toolbar for the schematic editor
39  */
41 {
42  if( m_mainToolBar )
43  m_mainToolBar->Clear();
44  else
46  wxDefaultPosition, wxDefaultSize,
47  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
48  wxString msg;
49 
50  // Set up toolbar
51  if( Kiface().IsSingle() ) // not when under a project mgr
52  {
53  // These 2 menus have meaning only outside a project, i.e. not under a project manager:
54  m_mainToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString,
55  KiScaledBitmap( new_document_xpm, this ),
56  _( "New schematic" ) );
57 
58  m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString,
59  KiScaledBitmap( open_document_xpm, this ),
60  _( "Open schematic" ) );
61  }
62 
63  m_mainToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString,
64  KiScaledBitmap( save_xpm, this ),
65  _( "Save (all sheets)" ) );
66 
68 
69  m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiScaledBitmap( sheetset_xpm, this ),
70  _( "Edit Page settings" ) );
71 
72  m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiScaledBitmap( print_button_xpm, this ),
73  _( "Print schematic" ) );
74 
75  m_mainToolBar->AddTool( ID_GEN_PLOT_SCHEMATIC, wxEmptyString, KiScaledBitmap( plot_xpm, this ),
76  _( "Plot schematic" ) );
77 
78  m_mainToolBar->AddSeparator();
80 
81  m_mainToolBar->AddSeparator();
84 
86 
88  m_mainToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiScaledBitmap( find_xpm, this ), msg );
89 
90  m_mainToolBar->AddTool( wxID_REPLACE, wxEmptyString, KiScaledBitmap( find_replace_xpm, this ),
91  wxNullBitmap, wxITEM_NORMAL, _( "Find and replace text" ),
92  HELP_REPLACE, nullptr );
93 
94  m_mainToolBar->AddSeparator();
100 
101  m_mainToolBar->AddSeparator();
104 
105  m_mainToolBar->AddSeparator();
108 
109  // modedit is with libedit in a "library section" because the user must have footprints before
110  // they can be assigned.
111  m_mainToolBar->AddTool( ID_RUN_PCB_MODULE_EDITOR, wxEmptyString,
112  KiScaledBitmap( module_editor_xpm, this ),
113  _( "Footprint Editor - Create/edit footprints" ) );
114 
116 
117  m_mainToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, KiScaledBitmap( annotate_xpm, this ),
118  HELP_ANNOTATE );
119 
120  m_mainToolBar->AddTool( ID_GET_ERC, wxEmptyString, KiScaledBitmap( erc_xpm, this ),
121  _( "Perform electrical rules check" ) );
122 
123  m_mainToolBar->AddTool( ID_RUN_CVPCB, wxEmptyString, KiScaledBitmap( cvpcb_xpm, this ),
124  _( "Assign PCB footprints to schematic symbols" ) );
125 
126  m_mainToolBar->AddTool( ID_OPEN_CMP_TABLE, wxEmptyString,
127  KiScaledBitmap( spreadsheet_xpm, this ), _( "Edit symbol fields" ) );
128 
129 
130  m_mainToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, KiScaledBitmap( bom_xpm, this ),
132 
134 
135  m_mainToolBar->AddTool( ID_RUN_PCB, wxEmptyString, KiScaledBitmap( pcbnew_xpm, this ),
136  _( "Run Pcbnew to layout printed circuit board" ) );
137 
138  m_mainToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString,
139  KiScaledBitmap( import_footprint_names_xpm, this ),
141 
142  // after adding the tools to the toolbar, must call Realize() to reflect the changes
143  m_mainToolBar->Realize();
144 }
145 
146 
147 /* Create Vertical Right Toolbar
148  */
150 {
151  if( m_drawToolBar )
152  m_drawToolBar->Clear();
153  else
154  m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
155  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
156 
157  // Set up toolbar
178 
179  m_drawToolBar->Realize();
180 }
181 
182 
183 /* Create Vertical Left Toolbar (Option Toolbar)
184  */
186 {
187  if( m_optionsToolBar )
188  m_optionsToolBar->Clear();
189  else
191  wxDefaultPosition, wxDefaultSize,
192  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
193 
200 
201  m_optionsToolBar->Realize();
202 }
203 
204 
206 {
208  m_mainToolBar->Refresh();
209 
213 
216 
219 
220  m_optionsToolBar->Refresh();
221 
242 
243  m_drawToolBar->Refresh();
244 }
Class ACTION_TOOLBAR.
static TOOL_ACTION deleteItemCursor
Definition: ee_actions.h:167
static TOOL_ACTION navigateHierarchy
Definition: ee_actions.h:162
static TOOL_ACTION zoomInCenter
Definition: actions.h:60
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
Definition: draw_frame.h:949
ACTION_TOOLBAR * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:166
static const bool TOGGLE
static TOOL_ACTION zoomTool
Definition: actions.h:65
virtual bool IsGridVisible() const
Definition: draw_frame.h:533
static TOOL_ACTION placeJunction
Definition: ee_actions.h:86
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false)
Function Add() Adds a TOOL_ACTION-based button to the toolbar.
static TOOL_ACTION zoomFitScreen
Definition: actions.h:63
static TOOL_ACTION placeBusBusEntry
Definition: ee_actions.h:88
static TOOL_ACTION placeBusWireEntry
Definition: ee_actions.h:87
Definition: id.h:66
ACTION_TOOLBAR * m_mainToolBar
Definition: draw_frame.h:156
wxBitmap KiScaledBitmap(BITMAP_DEF aBitmap, EDA_BASE_FRAME *aWindow)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Definition: bitmap.cpp:116
static TOOL_ACTION imperialUnits
Definition: actions.h:102
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
static TOOL_ACTION zoomOutCenter
Definition: actions.h:61
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:161
static TOOL_ACTION drawSheet
Definition: ee_actions.h:92
void ReCreateHToolbar() override
static TOOL_ACTION placePower
Definition: ee_actions.h:79
static TOOL_ACTION drawWire
Definition: ee_actions.h:81
static TOOL_ACTION placeSheetPin
Definition: ee_actions.h:93
static TOOL_ACTION toggleGrid
Definition: actions.h:98
bool GetForceHVLines() const
strings common to toolbars and menubar
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:289
Definition: common.h:158
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:95
#define HELP_REPLACE
static TOOL_ACTION placeImage
Definition: ee_actions.h:98
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:94
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:78
static TOOL_ACTION placeHierarchicalLabel
Definition: ee_actions.h:91
static TOOL_ACTION highlightNetCursor
Definition: ee_actions.h:185
#define HELP_IMPORT_FOOTPRINTS
static TOOL_ACTION drawBus
Definition: ee_actions.h:83
static TOOL_ACTION placeLabel
Definition: ee_actions.h:89
static TOOL_ACTION metricUnits
Definition: actions.h:103
static TOOL_ACTION redo
Definition: actions.h:51
static TOOL_ACTION showLibraryBrowser
Definition: ee_actions.h:152
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value)
static TOOL_ACTION showSymbolEditor
Definition: ee_actions.h:150
struct EDA_HOTKEY_CONFIG g_Schematic_Hotkeys_Descr[]
Definition: ee_hotkeys.cpp:398
static TOOL_ACTION toggleHiddenPins
Definition: ee_actions.h:164
static TOOL_ACTION zoomRedraw
Definition: actions.h:57
static TOOL_ACTION placeNoConnect
Definition: ee_actions.h:85
void Toggle(const TOOL_ACTION &aAction, bool aState)
void KiScaledSeparator(wxAuiToolBar *aToolbar, EDA_BASE_FRAME *aWindow)
Add a separator to the given toolbar scaled the same way as KiScaledBitmap.
Definition: bitmap.cpp:167
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
static TOOL_ACTION undo
Definition: actions.h:50
static TOOL_ACTION drawLines
Definition: ee_actions.h:97
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:68
static TOOL_ACTION selectionTool
Definition: ee_actions.h:76
#define HELP_GENERATE_BOM
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:90
static TOOL_ACTION toggleForceHV
Definition: ee_actions.h:175
#define HELP_FIND
bool m_fullscreenCursor
Fullscreen crosshair or small cross
static TOOL_ACTION paste
Definition: actions.h:54
bool GetShowAllPins() const override
Allow some frames to show/hide hidden pins.
#define HELP_ANNOTATE
int GetToolId() const
Definition: draw_frame.h:524
void SyncMenusAndToolbars() override
Update the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller ...
void ReCreateVToolbar() override
ACTION_TOOLBAR * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:163