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 )
39  else
40  m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
41  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
42 
44 
47 
50 
51 
55 
61 
62  // Add tools for footprint names filtering:
64 
65  // wxGTK with GTK3 has a serious issue with bold texts: strings are incorrectly sized
66  // and truncated after the first space.
67  // so use SetLabelMarkup is a trick to fix this issue.
68  m_mainToolBar->AddSpacer( 15 );
69  wxString msg_bold = _( "Footprint Filters:" );
70  wxStaticText* text = new wxStaticText( m_mainToolBar, wxID_ANY, msg_bold );
71  text->SetFont( m_mainToolBar->GetFont().Bold() );
72 #ifdef __WXGTK3__
73  text->SetLabelMarkup( "<b>" + msg_bold + "</b>" );
74 #endif
75  m_mainToolBar->AddControl( text );
76 
80 
82 
83  m_tcFilterString = new wxTextCtrl( m_mainToolBar, ID_CVPCB_FILTER_TEXT_EDIT, wxEmptyString,
84  wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
85 
86  m_tcFilterString->Bind( wxEVT_TEXT_ENTER, &CVPCB_MAINFRAME::OnEnterFilteringText, this );
87 
88  m_mainToolBar->AddControl( m_tcFilterString );
89 
90  // after adding the buttons to the toolbar, must call Realize() to reflect the changes
91  m_mainToolBar->Realize();
92 }
93 
94 
96 {
97 #define filterActive( filter ) ( m_filteringOptions & filter )
98 
102 
109  m_mainToolBar->Refresh();
110 }
static TOOL_ACTION showFootprintViewer
Open the footprint viewer.
Definition: cvpcb_actions.h:52
ACTION_TOOLBAR.
static TOOL_ACTION FilterFPbyFPFilters
Footprint Filtering actions.
Definition: cvpcb_actions.h:69
static TOOL_ACTION gotoNextNA
Definition: cvpcb_actions.h:56
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)
Function Add() Adds a TOOL_ACTION-based button to the toolbar.
void SyncToolbars() override
Syncronize the toolbar state with the current tool state.
static TOOL_ACTION FilterFPbyLibrary
Definition: cvpcb_actions.h:71
bool IsContentModified() override
Get if the current associations have been modified but not saved.
wxTextCtrl * m_tcFilterString
static TOOL_ACTION deleteAll
Definition: cvpcb_actions.h:65
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:169
ACTION_TOOLBAR * m_mainToolBar
CVPCB_UNDO_REDO_LIST m_undoList
#define filterActive(filter)
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
CVPCB_UNDO_REDO_LIST m_redoList
void Toggle(const TOOL_ACTION &aAction, bool aState)
Applies the default toggle action.
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.