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.

97 lines
3.5 KiB

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