KiCad PCB EDA Suite
commandframe.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2004-2012 Jean-Pierre Charras
5  * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
31 #include <bitmaps.h>
32 #include <wx/statline.h>
33 
34 #include "kicad.h"
35 
36 // Amount of clearance between tool buttons
37 const int BUTTON_SEPARATION = 5;
38 
39 // Buttons are larger than images by this amount
40 const int BUTTON_EXPANSION = 6;
41 
42 LAUNCHER_PANEL::LAUNCHER_PANEL( wxWindow* parent ) :
43  wxPanel( parent, wxID_ANY )
44 {
45 
46  // Add bitmap buttons to launch KiCad utilities:
48 }
49 
51 {
52  return m_height + 2 * BUTTON_SEPARATION;
53 }
54 
56 {
57  return m_width + BUTTON_SEPARATION;
58 }
59 
65 {
66  wxStaticLine* separator;
67 
68  m_buttonSizer = new wxBoxSizer( wxHORIZONTAL );
69 
71  KiBitmap( icon_eeschema_xpm ),
72  _( "Schematic layout editor" ) );
73 
75  KiBitmap( icon_libedit_xpm ),
76  _( "Symbol library editor" ) );
77 
78  separator = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
79  m_buttonSizer->Add( separator, 0, wxEXPAND | wxALL, 8 );
80 
82  KiBitmap( icon_pcbnew_xpm ),
83  _( "PCB layout editor" ) );
84 
86  KiBitmap( icon_modedit_xpm ),
87  _( "Footprint library editor" ) );
88 
89  separator = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
90  m_buttonSizer->Add( separator, 0, wxEXPAND | wxALL, 8 );
91 
93  KiBitmap( icon_gerbview_xpm ),
94  _( "Gerber viewer" ) );
95 
97  KiBitmap( icon_bitmap2component_xpm ),
98  _( "Import bitmap\n"
99  "Convert bitmap images to schematic or PCB elements" ) );
100 
102  KiBitmap( icon_pcbcalculator_xpm ),
103  _( "Calculator tools" ) );
104 
106  KiBitmap( icon_pagelayout_editor_xpm ),
107  _( "Worksheet layout editor" ) );
108 
109  // Add a stretchy spacer to make button bar fill the entire screen
110  m_buttonSizer->AddStretchSpacer();
111 
112  SetSizer( m_buttonSizer );
113 }
114 
121 void LAUNCHER_PANEL::AddButton( wxWindowID aId, const wxBitmap& aBitmap, const wxString& aToolTip )
122 {
123  wxSize buttSize( aBitmap.GetWidth() + 2 * BUTTON_EXPANSION,
124  aBitmap.GetHeight() + 2 * BUTTON_EXPANSION );
125 
126  if( m_height < buttSize.y )
127  m_height = buttSize.y;
128 
129  m_width += buttSize.x + BUTTON_SEPARATION;
130 
131  auto btn = new wxBitmapButton( this, aId, aBitmap, wxDefaultPosition, buttSize );
132 
133  btn->SetToolTip( aToolTip );
134 
135  m_buttonSizer->Add( btn,
136  0,
137  wxALL | wxEXPAND,
139 }
int m_width
Definition: kicad.h:312
int m_height
Definition: kicad.h:311
void AddButton(wxWindowID aId, const wxBitmap &aBitmap, const wxString &aToolTip)
Add a single button to the toolbar.
const int BUTTON_SEPARATION
void CreateCommandToolbar(void)
Function CreateCommandToolbar creates the main tool bar buttons (fast launch buttons) ...
int GetPanelHeight() const
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
KICAD_MANAGER_FRAME is the KiCad main frame.
const int BUTTON_EXPANSION
LAUNCHER_PANEL(wxWindow *parent)
wxBoxSizer * m_buttonSizer
Definition: kicad.h:309
int GetPanelWidth() const