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 
36 LAUNCHER_PANEL::LAUNCHER_PANEL( wxWindow* parent ) :
37  wxPanel( parent, wxID_ANY )
38 {
40  m_buttonSeparation = 10; // control of command buttons position
44 
45  // Add bitmap buttons to launch KiCad utilities:
47 }
48 
50 {
53  return height;
54 }
55 
61 {
62  wxBitmapButton* btn;
63 
64  btn = AddBitmapButton( ID_TO_SCH, KiBitmap( icon_eeschema_xpm ) );
65  btn->SetToolTip( _( "Eeschema - Electronic schematic editor" ) );
66 
67  btn = AddBitmapButton( ID_TO_SCH_LIB_EDITOR, KiBitmap( icon_libedit_xpm ) );
68  btn->SetToolTip( _( "Schematic library editor" ) );
69 
70  btn = AddBitmapButton( ID_TO_PCB, KiBitmap( icon_pcbnew_xpm ) );
71  btn->SetToolTip( _( "Pcbnew - Printed circuit board editor" ) );
72 
73  btn = AddBitmapButton( ID_TO_PCB_FP_EDITOR, KiBitmap( icon_modedit_xpm ) );
74  btn->SetToolTip( _( "PCB footprint editor" ) );
75 
76  btn = AddBitmapButton( ID_TO_GERBVIEW, KiBitmap( icon_gerbview_xpm ) );
77  btn->SetToolTip( _( "GerbView - Gerber viewer" ) );
78 
79  btn = AddBitmapButton( ID_TO_BITMAP_CONVERTER, KiBitmap( icon_bitmap2component_xpm ) );
80  btn->SetToolTip( _(
81  "Bitmap2Component - Convert bitmap images to Eeschema\n"
82  "or Pcbnew elements" ) );
83 
84  btn = AddBitmapButton( ID_TO_PCB_CALCULATOR, KiBitmap( icon_pcbcalculator_xpm ) );
85  btn->SetToolTip( _( "Pcb calculator - Calculator for components, track width, etc." ) );
86 
87  btn = AddBitmapButton( ID_TO_PL_EDITOR, KiBitmap( icon_pagelayout_editor_xpm ) );
88  btn->SetToolTip( _( "Pl editor - Worksheet layout editor" ) );
89 }
90 
91 
98 wxBitmapButton* LAUNCHER_PANEL::AddBitmapButton( wxWindowID aId, const wxBitmap& aBitmap )
99 {
100  wxPoint buttPos = m_buttonLastPosition;
101  wxSize buttSize;
102  int btn_margin = 10; // extra margin around the bitmap.
103 
104  buttSize.x = aBitmap.GetWidth() + btn_margin;
105  buttSize.y = aBitmap.GetHeight() + btn_margin;
106 
107  if( m_bitmapButtons_maxHeight < buttSize.y )
108  m_bitmapButtons_maxHeight = buttSize.y;
109 
110  wxBitmapButton* btn = new wxBitmapButton( this, aId, aBitmap, buttPos, buttSize );
111  m_buttonLastPosition.x += buttSize.x + m_buttonSeparation;
112 
113  return btn;
114 }
int m_bitmapButtons_maxHeight
Definition: kicad.h:318
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
KICAD_MANAGER_FRAME is the KiCad main frame.
LAUNCHER_PANEL(wxWindow *parent)
int m_buttonSeparation
Definition: kicad.h:313
wxPoint m_buttonsListPosition
Definition: kicad.h:314
wxBitmapButton * AddBitmapButton(wxWindowID aId, const wxBitmap &aBitmap)
Function AddBitmapButton add a Bitmap Button (fast launch button) to the buttons panel.
wxPoint m_buttonLastPosition
Definition: kicad.h:317