KiCad PCB EDA Suite
toolbars_symbol_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) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2020 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 <eeschema_id.h>
27 #include <symbol_edit_frame.h>
28 #include <sch_painter.h>
29 #include <bitmaps.h>
30 #include <symbol_library_manager.h>
31 #include <tool/action_toolbar.h>
32 #include <tool/tool_manager.h>
33 #include <tools/ee_actions.h>
35 
36 #ifdef __UNIX__
37 #define LISTBOX_WIDTH 140
38 #else
39 #define LISTBOX_WIDTH 120
40 #endif
41 
42 
44 {
45  if( m_drawToolBar )
46  {
48  }
49  else
50  {
51  m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
52  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
54  }
55 
56  // Set up toolbar
58 
68 
69  m_drawToolBar->Realize();
70 }
71 
72 
74 {
75  if( m_mainToolBar )
76  {
78  }
79  else
80  {
81  m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
82  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
84  }
85 
86  // Set up toolbar
88 
89  if( !IsSymbolFromSchematic() )
91  else
93 
97 
104 
110 
114 
118 
122 
124 
125  if( m_unitSelectBox == nullptr )
127  wxEmptyString, wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ), 0,
128  nullptr, wxCB_READONLY );
129  m_mainToolBar->AddControl( m_unitSelectBox );
130 
133 
136 
137  // after adding the buttons to the toolbar, must call Realize() to reflect the changes
138  m_mainToolBar->Realize();
139 }
140 
141 
143 {
144  if( m_optionsToolBar )
145  {
147  }
148  else
149  {
151  wxDefaultPosition, wxDefaultSize,
152  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
154  }
155 
163 
165  std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
166  gridMenu->Add( ACTIONS::gridProperties );
167  m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
168 
169  m_optionsToolBar->Realize();
170 }
static TOOL_ACTION pinTable
Definition: ee_actions.h:142
static TOOL_ACTION showDatasheet
Inspection and Editing.
Definition: ee_actions.h:136
static TOOL_ACTION placeSymbolText
Definition: ee_actions.h:98
Define the structure of a toolbar with buttons that invoke ACTIONs.
static TOOL_ACTION drawSymbolLines
Definition: ee_actions.h:102
static TOOL_ACTION zoomInCenter
Definition: actions.h:93
void AddToolContextMenu(const TOOL_ACTION &aAction, std::unique_ptr< ACTION_MENU > aMenu)
Add a context menu to a specific tool item on the toolbar.
ACTION_TOOLBAR * m_optionsToolBar
static TOOL_ACTION showSymbolTree
Definition: ee_actions.h:200
static constexpr bool TOGGLE
static TOOL_ACTION zoomTool
Definition: actions.h:99
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false, bool aIsCancellable=false)
Add a TOOL_ACTION-based button to the toolbar.
static TOOL_ACTION zoomFitScreen
Definition: actions.h:96
static TOOL_ACTION millimetersUnits
Definition: actions.h:146
void SetAuiManager(wxAuiManager *aManager)
Set the AUI manager that this toolbar belongs to.
wxAuiManager m_auimgr
ACTION_TOOLBAR * m_mainToolBar
static TOOL_ACTION mirrorH
Definition: ee_actions.h:116
static TOOL_ACTION checkSymbol
Definition: ee_actions.h:152
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:124
bool IsSymbolFromSchematic() const
static TOOL_ACTION zoomOutCenter
Definition: actions.h:94
static TOOL_ACTION mirrorV
Definition: ee_actions.h:115
static TOOL_ACTION rotateCW
Definition: ee_actions.h:113
static TOOL_ACTION drawSymbolRectangle
Definition: ee_actions.h:99
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:114
static constexpr bool CANCEL
static TOOL_ACTION placeSymbolPin
Definition: ee_actions.h:97
static TOOL_ACTION toggleGrid
Definition: actions.h:140
static TOOL_ACTION inchesUnits
Definition: actions.h:144
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION symbolProperties
Definition: ee_actions.h:141
static TOOL_ACTION drawSymbolCircle
Definition: ee_actions.h:100
void ReCreateHToolbar() override
static TOOL_ACTION addSymbolToSchematic
Definition: ee_actions.h:163
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:123
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:199
static TOOL_ACTION milsUnits
Definition: actions.h:145
static TOOL_ACTION newSymbol
Definition: ee_actions.h:168
static TOOL_ACTION redo
Definition: actions.h:65
void ReCreateOptToolbar() override
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:158
#define LISTBOX_WIDTH
static TOOL_ACTION zoomRedraw
Definition: actions.h:90
static TOOL_ACTION drawSymbolArc
Definition: ee_actions.h:101
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
void ReCreateVToolbar() override
static TOOL_ACTION gridProperties
Definition: actions.h:141
static TOOL_ACTION deleteTool
Definition: actions.h:73
static TOOL_ACTION toggleSyncedPinsMode
Definition: ee_actions.h:193
static TOOL_ACTION undo
Definition: actions.h:64
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:102
static TOOL_ACTION saveAll
Definition: actions.h:54
static TOOL_ACTION placeSymbolAnchor
Definition: ee_actions.h:103
static TOOL_ACTION selectionTool
Definition: actions.h:153
wxComboBox * m_unitSelectBox
void ClearToolbar()
Clear the toolbar and remove all associated menus.
ACTION_TOOLBAR * m_drawToolBar