KiCad PCB EDA Suite
toolbars_cvpcb.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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
6  * Copyright (C) 2007-2019 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
26 #include <bitmaps.h>
27 #include <tool/action_toolbar.h>
28 #include <tool/actions.h>
29 
30 #include <cvpcb_id.h>
31 #include <cvpcb_mainframe.h>
32 #include <tools/cvpcb_actions.h>
33 
34 
36 {
37  if( m_mainToolBar )
38  {
40  }
41  else
42  {
43  m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
44  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
46  }
47 
49 
52 
55 
56 
60 
66 
67  // Add tools for footprint names filtering:
69 
70  // wxGTK with GTK3 has a serious issue with bold texts: strings are incorrectly sized
71  // and truncated after the first space.
72  // so use SetLabelMarkup is a trick to fix this issue.
73  m_mainToolBar->AddSpacer( 15 );
74  wxString msg_bold = _( "Footprint Filters:" );
75  wxStaticText* text = new wxStaticText( m_mainToolBar, wxID_ANY, msg_bold );
76  text->SetFont( m_mainToolBar->GetFont().Bold() );
77 #ifdef __WXGTK3__
78  text->SetLabelMarkup( "<b>" + msg_bold + "</b>" );
79 #endif
80  m_mainToolBar->AddControl( text );
81 
85 
87 
88  m_tcFilterString = new wxTextCtrl( m_mainToolBar, ID_CVPCB_FILTER_TEXT_EDIT, wxEmptyString,
89  wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
90 
91  m_tcFilterString->Bind( wxEVT_TEXT_ENTER, &CVPCB_MAINFRAME::OnEnterFilteringText, this );
92 
93  m_mainToolBar->AddControl( m_tcFilterString );
94 
95  // after adding the buttons to the toolbar, must call Realize() to reflect the changes
96  m_mainToolBar->Realize();
97 }
static TOOL_ACTION showFootprintViewer
Open the footprint viewer.
Definition: cvpcb_actions.h:52
Define the structure of a toolbar with buttons that invoke ACTIONs.
static TOOL_ACTION FilterFPbyFPFilters
Footprint Filtering actions.
Definition: cvpcb_actions.h:69
static TOOL_ACTION gotoNextNA
Definition: cvpcb_actions.h:56
static constexpr bool TOGGLE
static TOOL_ACTION gotoPreviousNA
Navigate the component tree.
Definition: cvpcb_actions.h:55
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.
void SetAuiManager(wxAuiManager *aManager)
Set the AUI manager that this toolbar belongs to.
wxAuiManager m_auimgr
static TOOL_ACTION FilterFPbyLibrary
Definition: cvpcb_actions.h:71
wxTextCtrl * m_tcFilterString
static TOOL_ACTION deleteAll
Definition: cvpcb_actions.h:65
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:177
ACTION_TOOLBAR * m_mainToolBar
static TOOL_ACTION saveAssociations
Management actions.
Definition: cvpcb_actions.h:59
static TOOL_ACTION autoAssociate
Footprint Association actions.
Definition: cvpcb_actions.h:63
static TOOL_ACTION redo
Definition: actions.h:68
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION filterFPbyPin
Definition: cvpcb_actions.h:70
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
static TOOL_ACTION undo
Definition: actions.h:67
void OnEnterFilteringText(wxCommandEvent &event)
Function OnEnterFilteringText Is called each time the text of m_tcFilterString is changed.
void ClearToolbar()
Clear the toolbar and remove all associated menus.