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 
33 #include "kicad.h"
34 
35 // Amount of clearance between tool buttons
36 const int BUTTON_SEPARATION = 5;
37 
38 // Buttons are larger than images by this amount
39 const int BUTTON_EXPANSION = 6;
40 
41 LAUNCHER_PANEL::LAUNCHER_PANEL( wxWindow* parent ) :
42  wxPanel( parent, wxID_ANY )
43 {
44 
45  // Add bitmap buttons to launch KiCad utilities:
47 }
48 
50 {
51  return m_height + 2 * BUTTON_SEPARATION;
52 }
53 
55 {
56  return m_width + BUTTON_SEPARATION;
57 }
58 
64 {
65  m_buttonSizer = new wxBoxSizer( wxHORIZONTAL );
66 
68  KiBitmap( icon_eeschema_xpm ),
69  _( "Schematic layout editor" ) );
70 
72  KiBitmap( icon_libedit_xpm ),
73  _( "Schematic library editor" ) );
74 
76  KiBitmap( icon_pcbnew_xpm ),
77  _( "PCB layout editor" ) );
78 
80  KiBitmap( icon_modedit_xpm ),
81  _( "PCB library editor" ) );
82 
84  KiBitmap( icon_gerbview_xpm ),
85  _( "Gerber viewer" ) );
86 
88  KiBitmap( icon_bitmap2component_xpm ),
89  _( "Import bitmap\n"
90  "Convert bitmap images to schematic or PCB elements" ) );
91 
93  KiBitmap( icon_pcbcalculator_xpm ),
94  _( "Calculator tools" ) );
95 
97  KiBitmap( icon_pagelayout_editor_xpm ),
98  _( "Worksheet layout editor" ) );
99 
100  // Add a stretchy spacer to make button bar fill the entire screen
101  m_buttonSizer->AddStretchSpacer();
102 
103  SetSizer( m_buttonSizer );
104 }
105 
112 void LAUNCHER_PANEL::AddButton( wxWindowID aId, const wxBitmap& aBitmap, wxString aToolTip )
113 {
114  wxSize buttSize( aBitmap.GetWidth() + 2 * BUTTON_EXPANSION,
115  aBitmap.GetHeight() + 2 * BUTTON_EXPANSION );
116 
117  if( m_height < buttSize.y )
118  m_height = buttSize.y;
119 
120  m_width += buttSize.x + BUTTON_SEPARATION;
121 
122  auto btn = new wxBitmapButton( this, aId, aBitmap, wxDefaultPosition, buttSize );
123 
124  btn->SetToolTip( aToolTip );
125 
126  m_buttonSizer->Add( btn,
127  0,
128  wxALL | wxEXPAND,
130 }
int m_width
Definition: kicad.h:326
int m_height
Definition: kicad.h:325
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:36
void AddButton(wxWindowID aId, const wxBitmap &aBitmap, wxString aToolTip)
Add a single button to the toolbar.
KICAD_MANAGER_FRAME is the KiCad main frame.
const int BUTTON_EXPANSION
LAUNCHER_PANEL(wxWindow *parent)
wxBoxSizer * m_buttonSizer
Definition: kicad.h:323
int GetPanelWidth() const