/* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2011 Wayne Stambaugh * Copyright (C) 2007-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ /** * @file tool_cvpcb.cpp */ #include #include #include #include #include #include void CVPCB_MAINFRAME::ReCreateHToolbar() { if( m_mainToolBar ) m_mainToolBar->ClearToolbar(); else m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT ); m_mainToolBar->Add( CVPCB_ACTIONS::saveAssociations ); m_mainToolBar->AddScaledSeparator( this ); m_mainToolBar->Add( ACTIONS::showFootprintLibTable ); m_mainToolBar->AddScaledSeparator( this ); m_mainToolBar->Add( CVPCB_ACTIONS::showFootprintViewer ); m_mainToolBar->AddScaledSeparator( this ); m_mainToolBar->Add( CVPCB_ACTIONS::gotoPreviousNA ); m_mainToolBar->Add( CVPCB_ACTIONS::gotoNextNA ); m_mainToolBar->AddScaledSeparator( this ); m_mainToolBar->Add( ACTIONS::undo ); m_mainToolBar->Add( ACTIONS::redo ); m_mainToolBar->Add( CVPCB_ACTIONS::autoAssociate ); m_mainToolBar->Add( CVPCB_ACTIONS::deleteAll ); // Add tools for footprint names filtering: m_mainToolBar->AddScaledSeparator( this ); // wxGTK with GTK3 has a serious issue with bold texts: strings are incorrectly sized // and truncated after the first space. // so use SetLabelMarkup is a trick to fix this issue. m_mainToolBar->AddSpacer( 15 ); wxString msg_bold = _( "Footprint Filters:" ); wxStaticText* text = new wxStaticText( m_mainToolBar, wxID_ANY, msg_bold ); text->SetFont( m_mainToolBar->GetFont().Bold() ); #ifdef __WXGTK3__ text->SetLabelMarkup( "" + msg_bold + "" ); #endif m_mainToolBar->AddControl( text ); m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyFPFilters, true ); m_mainToolBar->Add( CVPCB_ACTIONS::filterFPbyPin, true ); m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyLibrary, true ); m_mainToolBar->AddScaledSeparator( this ); m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyTextPattern, true ); m_tcFilterString = new wxTextCtrl( m_mainToolBar, ID_CVPCB_FILTER_TEXT_EDIT ); m_mainToolBar->AddControl( m_tcFilterString ); // after adding the buttons to the toolbar, must call Realize() to reflect the changes m_mainToolBar->Realize(); } void CVPCB_MAINFRAME::SyncToolbars() { #define filterActive( filter ) ( m_filteringOptions & filter ) m_mainToolBar->Toggle( CVPCB_ACTIONS::saveAssociations, IsContentModified() ); m_mainToolBar->Toggle( ACTIONS::undo, m_undoList.size() > 0 ); m_mainToolBar->Toggle( ACTIONS::redo, m_redoList.size() > 0 ); m_mainToolBar->Toggle( CVPCB_ACTIONS::FilterFPbyFPFilters, filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_FP_FILTERS ) ); m_mainToolBar->Toggle( CVPCB_ACTIONS::FilterFPbyLibrary, filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) ); m_mainToolBar->Toggle( CVPCB_ACTIONS::filterFPbyPin, filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) ); m_mainToolBar->Toggle( CVPCB_ACTIONS::FilterFPbyTextPattern, filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN ) ); m_mainToolBar->Refresh(); }