tool_cvpcb.cpp 5.13 KB
Newer Older
1 2 3
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
4
 * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
5
 * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
6
 * Copyright (C) 2007-2013 KiCad Developers, see AUTHORS.txt for contributors.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
 *
 * 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 2
 * of the License, or (at your option) any later version.
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

/**
 * @file tool_cvpcb.cpp
 */
29

30
#include <fctsys.h>
31
#include <kiface_i.h>
32 33 34 35 36 37
#include <common.h>

#include <bitmaps.h>
#include <cvpcb.h>
#include <cvpcb_mainframe.h>
#include <cvpcb_id.h>
38

39 40
#include <common_help_msg.h>

41

42
void CVPCB_MAINFRAME::ReCreateHToolbar()
43
{
44
    wxConfigBase* config = Kiface().KifaceSettings();
45

46
    if( m_mainToolBar != NULL )
47 48
        return;

49 50
    m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
                                      wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
51

52 53 54 55 56 57 58
    // Open files can be used only outside a project, because opening a netlist
    // which is not the project netlist is a non sense.
    if( Kiface().IsSingle() )
    {
        m_mainToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxEmptyString,
                                KiBitmap( open_document_xpm ), LOAD_FILE_HELP );
    }
59

60
    m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_xpm ), SAVE_HLP_MSG );
61

62
    m_mainToolBar->AddSeparator();
63
    m_mainToolBar->AddTool( ID_CVPCB_LIB_TABLE_EDIT, wxEmptyString,
64
                            KiBitmap( config_xpm ),
65
                            _( "Edit footprint library table" ) );
66

67 68 69 70
    m_mainToolBar->AddSeparator();
    m_mainToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString,
                            KiBitmap( show_footprint_xpm ),
                            _( "View selected footprint" ) );
71

72 73 74
    m_mainToolBar->AddSeparator();
    m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString,
                            KiBitmap( left_xpm ),
75
                            _( "Select previous unlinked component" ) );
76

77 78
    m_mainToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString,
                            KiBitmap( right_xpm ),
79
                            _( "Select next unlinked component" ) );
80

81
    m_mainToolBar->AddSeparator();
82 83 84 85
    m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString,
                            KiBitmap( auto_associe_xpm ),
                            _( "Perform automatic footprint association" ) );

86 87
    m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString,
                            KiBitmap( delete_association_xpm ),
88
                            _( "Delete all associations (links)" ) );
89

90 91 92
    m_mainToolBar->AddSeparator();
    m_mainToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC, wxEmptyString,
                            KiBitmap( datasheet_xpm ),
93
                            _( "Display footprint documentation" ) );
94 95 96 97 98 99

    m_mainToolBar->AddSeparator();
    m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
                            KiBitmap( module_filtered_list_xpm ),
                            wxNullBitmap,
                            true, NULL,
100
                            _( "Filter footprint list by keywords" ),
101 102
                            wxEmptyString );

103 104 105 106
    m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
                            KiBitmap( module_pin_filtered_list_xpm ),
                            wxNullBitmap,
                            true, NULL,
107
                            _( "Filter footprint list by pin count" ),
108 109
                            wxEmptyString );

110 111 112
    m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
                            KiBitmap( module_library_list_xpm ),
                            wxNullBitmap, true, NULL,
113
                            _( "Filter footprint list by library" ),
114
                            wxEmptyString );
115 116 117 118 119

    if( config )
    {
        wxString key = wxT( FILTERFOOTPRINTKEY );
        int      opt = config->Read( key, (long) 1 );
120 121 122 123

        m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, opt & 4 );
        m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, opt & 2 );
        m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt & 1 );
124 125
    }

126
    // after adding the buttons to the toolbar, must call Realize() to reflect the changes
127
    m_mainToolBar->Realize();
128
}