KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <[email protected]>
6 * Copyright (C) 2007-2022 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
22#include <tool/action_toolbar.h>
23#include <tool/actions.h>
24
25#include <cvpcb_id.h>
26#include <cvpcb_mainframe.h>
27#include <tools/cvpcb_actions.h>
28#include <wx/stattext.h>
29
30
32{
33 if( m_mainToolBar )
34 {
36 }
37 else
38 {
39 m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
40 KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
42 }
43
45
48
51
52
56
62
63 // Add tools for footprint names filtering:
65
66 // wxGTK with GTK3 has a serious issue with bold texts: strings are incorrectly sized
67 // and truncated after the first space.
68 // so use SetLabelMarkup is a trick to fix this issue.
69 m_mainToolBar->AddSpacer( 15 );
70 wxString msg_bold = _( "Footprint Filters:" );
71 wxStaticText* text = new wxStaticText( m_mainToolBar, wxID_ANY, msg_bold );
72 text->SetFont( m_mainToolBar->GetFont().Bold() );
73#ifdef __WXGTK3__
74 text->SetLabelMarkup( "<b>" + msg_bold + "</b>" );
75#endif
76 m_mainToolBar->AddControl( text );
77
81
83
84 m_tcFilterString = new wxTextCtrl( m_mainToolBar, wxID_ANY, wxEmptyString, wxDefaultPosition,
85 wxDefaultSize, wxTE_PROCESS_ENTER );
86
87 // Min size on Mac is (a not very useful) single character
88 m_tcFilterString->SetMinSize( wxSize( 150, -1 ) );
89
90 m_tcFilterString->Bind( wxEVT_TEXT_ENTER, &CVPCB_MAINFRAME::onTextFilterChanged, this );
91
92 m_mainToolBar->AddControl( m_tcFilterString );
93
94 // after adding the buttons to the toolbar, must call Realize() to reflect the changes
95 m_mainToolBar->Realize();
96}
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:230
static TOOL_ACTION undo
Definition: actions.h:68
static TOOL_ACTION redo
Definition: actions.h:69
Define the structure of a toolbar with buttons that invoke ACTIONs.
static constexpr bool TOGGLE
void SetAuiManager(wxAuiManager *aManager)
Set the AUI manager that this toolbar belongs to.
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
void ClearToolbar()
Clear the toolbar and remove all associated menus.
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false, bool aIsCancellable=false)
Add a TOOL_ACTION-based button to the toolbar.
static TOOL_ACTION deleteAll
Definition: cvpcb_actions.h:63
static TOOL_ACTION gotoPreviousNA
Navigate the component tree.
Definition: cvpcb_actions.h:52
static TOOL_ACTION gotoNextNA
Definition: cvpcb_actions.h:53
static TOOL_ACTION FilterFPbyLibrary
Definition: cvpcb_actions.h:69
static TOOL_ACTION filterFPbyPin
Definition: cvpcb_actions.h:68
static TOOL_ACTION autoAssociate
Footprint Association actions.
Definition: cvpcb_actions.h:61
static TOOL_ACTION FilterFPbyFPFilters
Footprint Filtering actions.
Definition: cvpcb_actions.h:67
static TOOL_ACTION saveAssociationsToSchematic
Management actions.
Definition: cvpcb_actions.h:56
static TOOL_ACTION showFootprintViewer
Open the footprint viewer.
Definition: cvpcb_actions.h:49
void onTextFilterChanged(wxCommandEvent &event)
ACTION_TOOLBAR * m_mainToolBar
wxTextCtrl * m_tcFilterString
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
wxAuiManager m_auimgr
#define _(s)
@ ID_H_TOOLBAR
Definition: id.h:99