2011-12-16 13:32:23 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-02-25 09:52:29 +00:00
|
|
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2011-12-16 13:32:23 +00:00
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
2019-03-18 17:49:52 +00:00
|
|
|
* Copyright (C) 2007-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-12-16 13:32:23 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* 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.
|
2011-12-16 13:32:23 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* 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.
|
2011-12-16 13:32:23 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2011-12-16 13:32:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file tool_cvpcb.cpp
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2019-07-18 21:47:01 +00:00
|
|
|
#include <bitmaps.h>
|
|
|
|
#include <tool/action_toolbar.h>
|
|
|
|
#include <tool/actions.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
|
|
|
|
#include <cvpcb_id.h>
|
2019-07-18 21:47:01 +00:00
|
|
|
#include <cvpcb_mainframe.h>
|
|
|
|
#include <tools/cvpcb_actions.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::ReCreateHToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2018-01-08 04:05:03 +00:00
|
|
|
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 );
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2019-07-18 21:47:01 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::showFootprintLibTable );
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2019-07-18 21:47:01 +00:00
|
|
|
m_mainToolBar->Add( CVPCB_ACTIONS::showFootprintViewer );
|
2008-12-08 15:27:13 +00:00
|
|
|
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2019-07-18 21:47:01 +00:00
|
|
|
m_mainToolBar->Add( CVPCB_ACTIONS::gotoPreviousNA );
|
|
|
|
m_mainToolBar->Add( CVPCB_ACTIONS::gotoNextNA );
|
2015-01-11 17:22:45 +00:00
|
|
|
|
2019-07-18 21:47:01 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2019-07-26 18:58:20 +00:00
|
|
|
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 );
|
2011-12-16 13:32:23 +00:00
|
|
|
|
2019-03-18 17:49:52 +00:00
|
|
|
// Add tools for footprint names filtering:
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2019-03-18 17:49:52 +00:00
|
|
|
m_mainToolBar->AddSpacer( 15 );
|
|
|
|
wxStaticText* text = new wxStaticText( m_mainToolBar, wxID_ANY,
|
|
|
|
_( "Footprint Filters:" ) );
|
|
|
|
text->SetFont( m_mainToolBar->GetFont().Bold() );
|
|
|
|
m_mainToolBar->AddControl( text );
|
|
|
|
|
2019-09-03 18:32:39 +00:00
|
|
|
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyFPFilters, true );
|
2019-07-18 21:47:01 +00:00
|
|
|
m_mainToolBar->Add( CVPCB_ACTIONS::filterFPbyPin, true );
|
2019-09-03 18:32:39 +00:00
|
|
|
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyLibrary, true );
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2019-09-03 18:32:39 +00:00
|
|
|
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyTextPattern, true );
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2016-02-25 18:48:47 +00:00
|
|
|
m_tcFilterString = new wxTextCtrl( m_mainToolBar, ID_CVPCB_FILTER_TEXT_EDIT );
|
2016-02-25 13:57:59 +00:00
|
|
|
|
|
|
|
m_mainToolBar->AddControl( m_tcFilterString );
|
|
|
|
|
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->Realize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2019-07-18 21:47:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::SyncToolbars()
|
|
|
|
{
|
2019-09-03 18:28:54 +00:00
|
|
|
#define filterActive( filter ) ( m_filteringOptions & filter )
|
2019-07-18 21:47:01 +00:00
|
|
|
|
2019-07-26 18:58:20 +00:00
|
|
|
m_mainToolBar->Toggle( ACTIONS::undo, m_undoList.size() > 0 );
|
|
|
|
m_mainToolBar->Toggle( ACTIONS::redo, m_redoList.size() > 0 );
|
|
|
|
|
2019-09-03 18:32:39 +00:00
|
|
|
m_mainToolBar->Toggle( CVPCB_ACTIONS::FilterFPbyFPFilters,
|
2019-09-03 18:28:54 +00:00
|
|
|
filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_FP_FILTERS ) );
|
2019-09-03 18:32:39 +00:00
|
|
|
m_mainToolBar->Toggle( CVPCB_ACTIONS::FilterFPbyLibrary,
|
2019-09-03 18:28:54 +00:00
|
|
|
filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) );
|
2019-07-18 21:47:01 +00:00
|
|
|
m_mainToolBar->Toggle( CVPCB_ACTIONS::filterFPbyPin,
|
2019-09-03 18:28:54 +00:00
|
|
|
filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) );
|
2019-09-03 18:32:39 +00:00
|
|
|
m_mainToolBar->Toggle( CVPCB_ACTIONS::FilterFPbyTextPattern,
|
2019-09-03 18:28:54 +00:00
|
|
|
filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN ) );
|
2019-07-18 21:47:01 +00:00
|
|
|
m_mainToolBar->Refresh();
|
|
|
|
}
|