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.

130 lines
5.4 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
  5. * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
  6. * Copyright (C) 2007-2011 KiCad Developers, see AUTHORS.txt for contributors.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. /**
  26. * @file tool_cvpcb.cpp
  27. */
  28. #include <fctsys.h>
  29. #include <appl_wxstruct.h>
  30. #include <common.h>
  31. #include <bitmaps.h>
  32. #include <cvpcb.h>
  33. #include <cvpcb_mainframe.h>
  34. #include <cvpcb_id.h>
  35. #include <common_help_msg.h>
  36. void CVPCB_MAINFRAME::ReCreateHToolbar()
  37. {
  38. wxConfig* config = wxGetApp().GetSettings();
  39. if( m_mainToolBar != NULL )
  40. return;
  41. m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
  42. wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
  43. m_mainToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxEmptyString,
  44. KiBitmap( open_document_xpm ), LOAD_FILE_HELP );
  45. m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_xpm ),
  46. SAVE_HLP_MSG );
  47. m_mainToolBar->AddSeparator();
  48. m_mainToolBar->AddTool( ID_CVPCB_CREATE_CONFIGWINDOW, wxEmptyString,
  49. KiBitmap( config_xpm ),
  50. _( "Configuration" ) );
  51. m_mainToolBar->AddSeparator();
  52. m_mainToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString,
  53. KiBitmap( show_footprint_xpm ),
  54. _( "View selected footprint" ) );
  55. m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString,
  56. KiBitmap( auto_associe_xpm ),
  57. _( "Perform automatic footprint association" ) );
  58. m_mainToolBar->AddSeparator();
  59. m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString,
  60. KiBitmap( left_xpm ),
  61. _( "Select previous free component" ) );
  62. m_mainToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString,
  63. KiBitmap( right_xpm ),
  64. _( "Select next free component" ) );
  65. m_mainToolBar->AddSeparator();
  66. m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString,
  67. KiBitmap( delete_association_xpm ),
  68. _( "Delete all associations" ) );
  69. m_mainToolBar->AddSeparator();
  70. m_mainToolBar->AddTool( ID_CVPCB_CREATE_STUFF_FILE, wxEmptyString,
  71. KiBitmap( export_footprint_names_xpm ),
  72. _( "Create export file (component/footprint list, \
  73. used by Eeschema to fill the footprint field of components)" ) );
  74. m_mainToolBar->AddSeparator();
  75. m_mainToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC, wxEmptyString,
  76. KiBitmap( datasheet_xpm ),
  77. _( "Display footprints list documentation" ) );
  78. m_mainToolBar->AddSeparator();
  79. m_mainToolBar->AddSeparator();
  80. m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
  81. KiBitmap( module_filtered_list_xpm ),
  82. wxNullBitmap,
  83. true, NULL,
  84. _( "Display the filtered footprint list for the current component" ),
  85. wxEmptyString );
  86. m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
  87. KiBitmap( module_pin_filtered_list_xpm ),
  88. wxNullBitmap,
  89. true, NULL,
  90. _( "Display the filtered footprint list by pin count for the current component" ),
  91. wxEmptyString );
  92. m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
  93. KiBitmap( module_full_list_xpm ),
  94. wxNullBitmap, true, NULL,
  95. _( "Display the full footprint list (without filtering)" ),
  96. wxEmptyString );
  97. if( config )
  98. {
  99. wxString key = wxT( FILTERFOOTPRINTKEY );
  100. int opt = config->Read( key, (long) 1 );
  101. m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, opt == 2 );
  102. m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt == 1 );
  103. m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, opt == 0 );
  104. }
  105. // after adding the buttons to the toolbar, must call Realize() to reflect the changes
  106. m_mainToolBar->Realize();
  107. }