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.

98 lines
3.5 KiB

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