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 #include <wx/stattext.h>
34 
35 
37 {
38  if( m_mainToolBar )
39  {
41  }
42  else
43  {
44  m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
45  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
47  }
48 
50 
53 
56 
57 
61 
67 
68  // Add tools for footprint names filtering:
70 
71  // wxGTK with GTK3 has a serious issue with bold texts: strings are incorrectly sized
72  // and truncated after the first space.
73  // so use SetLabelMarkup is a trick to fix this issue.
74  m_mainToolBar->AddSpacer( 15 );
75  wxString msg_bold = _( "Footprint Filters:" );
76  wxStaticText* text = new wxStaticText( m_mainToolBar, wxID_ANY, msg_bold );
77  text->SetFont( m_mainToolBar->GetFont().Bold() );
78 #ifdef __WXGTK3__
79  text->SetLabelMarkup( "<b>" + msg_bold + "</b>" );
80 #endif
81  m_mainToolBar->AddControl( text );
82 
86 
88 
89  m_tcFilterString = new wxTextCtrl( m_mainToolBar, ID_CVPCB_FILTER_TEXT_EDIT, wxEmptyString,
90  wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
91 
92  m_tcFilterString->Bind( wxEVT_TEXT_ENTER, &CVPCB_MAINFRAME::OnEnterFilteringText, this );
93 
94  m_mainToolBar->AddControl( m_tcFilterString );
95 
96  // after adding the buttons to the toolbar, must call Realize() to reflect the changes
97  m_mainToolBar->Realize();
98 }
static TOOL_ACTION showFootprintViewer
Open the footprint viewer.
Definition: cvpcb_actions.h:49
Define the structure of a toolbar with buttons that invoke ACTIONs.
static TOOL_ACTION FilterFPbyFPFilters
Footprint Filtering actions.
Definition: cvpcb_actions.h:66
static TOOL_ACTION gotoNextNA
Definition: cvpcb_actions.h:53
static constexpr bool TOGGLE
static TOOL_ACTION gotoPreviousNA
Navigate the component tree.
Definition: cvpcb_actions.h:52
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:68
wxTextCtrl * m_tcFilterString
static TOOL_ACTION deleteAll
Definition: cvpcb_actions.h:62
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:175
ACTION_TOOLBAR * m_mainToolBar
#define _(s)
static TOOL_ACTION saveAssociations
Management actions.
Definition: cvpcb_actions.h:56
static TOOL_ACTION autoAssociate
Footprint Association actions.
Definition: cvpcb_actions.h:60
static TOOL_ACTION redo
Definition: actions.h:65
static TOOL_ACTION filterFPbyPin
Definition: cvpcb_actions.h:67
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
static TOOL_ACTION undo
Definition: actions.h:64
void OnEnterFilteringText(wxCommandEvent &event)
Called each time the text of m_tcFilterString is changed.
void ClearToolbar()
Clear the toolbar and remove all associated menus.