kicad/cvpcb/toolbars_cvpcb.cpp

105 lines
3.9 KiB
C++
Raw Normal View History

/*
* 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 <stambaughw@verizon.net>
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* @file tool_cvpcb.cpp
*/
2019-07-18 21:47:01 +00:00
#include <bitmaps.h>
#include <tool/action_toolbar.h>
#include <tool/actions.h>
#include <cvpcb_id.h>
2019-07-18 21:47:01 +00:00
#include <cvpcb_mainframe.h>
#include <tools/cvpcb_actions.h>
void CVPCB_MAINFRAME::ReCreateHToolbar()
{
if( m_mainToolBar )
m_mainToolBar->Clear();
else
2019-07-18 21:47:01 +00:00
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 );
KiScaledSeparator( m_mainToolBar, this );
2019-07-18 21:47:01 +00:00
m_mainToolBar->Add( ACTIONS::showFootprintLibTable );
KiScaledSeparator( m_mainToolBar, this );
2019-07-18 21:47:01 +00:00
m_mainToolBar->Add( CVPCB_ACTIONS::showFootprintViewer );
KiScaledSeparator( m_mainToolBar, this );
2019-07-18 21:47:01 +00:00
m_mainToolBar->Add( CVPCB_ACTIONS::gotoPreviousNA );
m_mainToolBar->Add( CVPCB_ACTIONS::gotoNextNA );
2019-07-18 21:47:01 +00:00
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
2019-07-18 21:47:01 +00:00
m_mainToolBar->Add( CVPCB_ACTIONS::autoAssociate );
m_mainToolBar->Add( CVPCB_ACTIONS::deleteAll );
// Add tools for footprint names filtering:
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddSpacer( 15 );
wxStaticText* text = new wxStaticText( m_mainToolBar, wxID_ANY,
_( "Footprint Filters:" ) );
text->SetFont( m_mainToolBar->GetFont().Bold() );
m_mainToolBar->AddControl( text );
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyFPFilters, true );
2019-07-18 21:47:01 +00:00
m_mainToolBar->Add( CVPCB_ACTIONS::filterFPbyPin, true );
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyLibrary, true );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyTextPattern, true );
2016-02-25 18:48:47 +00:00
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();
}
2019-07-18 21:47:01 +00:00
void CVPCB_MAINFRAME::SyncToolbars()
{
#define filterActive( filter ) ( m_filteringOptions & filter )
2019-07-18 21:47:01 +00:00
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 ) );
2019-07-18 21:47:01 +00:00
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 ) );
2019-07-18 21:47:01 +00:00
m_mainToolBar->Refresh();
}