You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
3.5 KiB

3 years ago
6 years ago
6 years ago
6 years ago
3 years ago
6 years ago
6 years ago
6 years ago
6 years ago
3 years ago
3 years ago
  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-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. #include <tool/action_toolbar.h>
  22. #include <tool/actions.h>
  23. #include <cvpcb_id.h>
  24. #include <cvpcb_mainframe.h>
  25. #include <tools/cvpcb_actions.h>
  26. #include <wx/stattext.h>
  27. void CVPCB_MAINFRAME::ReCreateHToolbar()
  28. {
  29. if( m_mainToolBar )
  30. {
  31. m_mainToolBar->ClearToolbar();
  32. }
  33. else
  34. {
  35. m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
  36. KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
  37. m_mainToolBar->SetAuiManager( &m_auimgr );
  38. }
  39. m_mainToolBar->Add( CVPCB_ACTIONS::saveAssociationsToSchematic );
  40. m_mainToolBar->AddScaledSeparator( this );
  41. m_mainToolBar->Add( ACTIONS::showFootprintLibTable );
  42. m_mainToolBar->AddScaledSeparator( this );
  43. m_mainToolBar->Add( CVPCB_ACTIONS::showFootprintViewer );
  44. m_mainToolBar->AddScaledSeparator( this );
  45. m_mainToolBar->Add( CVPCB_ACTIONS::gotoPreviousNA );
  46. m_mainToolBar->Add( CVPCB_ACTIONS::gotoNextNA );
  47. m_mainToolBar->AddScaledSeparator( this );
  48. m_mainToolBar->Add( ACTIONS::undo );
  49. m_mainToolBar->Add( ACTIONS::redo );
  50. m_mainToolBar->Add( CVPCB_ACTIONS::autoAssociate );
  51. m_mainToolBar->Add( CVPCB_ACTIONS::deleteAll );
  52. // Add tools for footprint names filtering:
  53. m_mainToolBar->AddScaledSeparator( this );
  54. // wxGTK with GTK3 has a serious issue with bold texts: strings are incorrectly sized
  55. // and truncated after the first space.
  56. // so use SetLabelMarkup is a trick to fix this issue.
  57. m_mainToolBar->AddSpacer( 15 );
  58. wxString msg_bold = _( "Footprint Filters:" );
  59. wxStaticText* text = new wxStaticText( m_mainToolBar, wxID_ANY, msg_bold );
  60. text->SetFont( m_mainToolBar->GetFont().Bold() );
  61. #ifdef __WXGTK3__
  62. text->SetLabelMarkup( "<b>" + msg_bold + "</b>" );
  63. #endif
  64. m_mainToolBar->AddControl( text );
  65. m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyFPFilters, ACTION_TOOLBAR::TOGGLE );
  66. m_mainToolBar->Add( CVPCB_ACTIONS::filterFPbyPin, ACTION_TOOLBAR::TOGGLE );
  67. m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyLibrary, ACTION_TOOLBAR::TOGGLE );
  68. m_mainToolBar->AddScaledSeparator( this );
  69. m_tcFilterString = new wxTextCtrl( m_mainToolBar, wxID_ANY, wxEmptyString, wxDefaultPosition,
  70. wxDefaultSize, wxTE_PROCESS_ENTER );
  71. m_tcFilterString->Bind( wxEVT_TEXT_ENTER, &CVPCB_MAINFRAME::onTextFilterChanged, this );
  72. m_mainToolBar->AddControl( m_tcFilterString );
  73. // after adding the buttons to the toolbar, must call Realize() to reflect the changes
  74. m_mainToolBar->Realize();
  75. }