2011-10-27 07:43:44 +02:00
|
|
|
/**
|
|
|
|
* @file commandframe.cpp
|
|
|
|
* @brief Frame showing fast launch buttons and messages box
|
|
|
|
*/
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2012-04-16 14:56:01 +02:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004-2012 Jean-Pierre Charras
|
|
|
|
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2012-01-22 22:33:36 -06:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <macros.h>
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2012-01-22 22:33:36 -06:00
|
|
|
#include <kicad.h>
|
2012-04-09 11:16:47 +02:00
|
|
|
#include <menus_helpers.h>
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2010-07-11 18:24:44 +02:00
|
|
|
|
2014-02-01 19:27:18 +01:00
|
|
|
LAUNCHER_PANEL::LAUNCHER_PANEL( wxWindow* parent ) :
|
|
|
|
wxPanel( parent, wxID_ANY )
|
2009-11-18 20:12:11 +00:00
|
|
|
{
|
2011-09-09 21:30:59 +02:00
|
|
|
m_bitmapButtons_maxHeigth = 0;
|
2014-02-01 19:27:18 +01:00
|
|
|
m_buttonSeparation = 10; // control of command buttons position
|
|
|
|
m_buttonsListPosition.x = m_buttonSeparation;
|
|
|
|
m_buttonsListPosition.y = m_buttonSeparation;
|
|
|
|
m_buttonLastPosition = m_buttonsListPosition;
|
2011-09-09 21:30:59 +02:00
|
|
|
|
2011-09-30 14:15:37 -04:00
|
|
|
// Add bitmap buttons to launch KiCad utilities:
|
2009-11-18 20:12:11 +00:00
|
|
|
CreateCommandToolbar();
|
2010-10-04 14:58:07 +02:00
|
|
|
}
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2014-02-01 19:27:18 +01:00
|
|
|
int LAUNCHER_PANEL::GetPanelHeight() const
|
2007-10-31 18:56:11 +00:00
|
|
|
{
|
2014-02-01 19:27:18 +01:00
|
|
|
int height = m_buttonsListPosition.y + m_bitmapButtons_maxHeigth
|
|
|
|
+ m_buttonSeparation;
|
|
|
|
return height;
|
2007-10-31 18:56:11 +00:00
|
|
|
}
|
|
|
|
|
2010-11-12 10:36:43 -06:00
|
|
|
/**
|
|
|
|
* Function CreateCommandToolbar
|
2011-09-30 14:15:37 -04:00
|
|
|
* create the buttons to call Eeschema CvPcb, Pcbnew and GerbView
|
2007-10-31 18:56:11 +00:00
|
|
|
*/
|
2014-02-01 19:27:18 +01:00
|
|
|
void LAUNCHER_PANEL::CreateCommandToolbar( void )
|
2007-10-31 18:56:11 +00:00
|
|
|
{
|
|
|
|
wxBitmapButton* btn;
|
|
|
|
|
2011-08-28 15:02:27 -05:00
|
|
|
btn = AddBitmapButton( ID_TO_EESCHEMA, KiBitmap( icon_eeschema_xpm ) );
|
2014-02-21 08:54:13 +01:00
|
|
|
btn->SetToolTip( _( "Eeschema - Electronic schematic editor" ) );
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2011-08-28 15:02:27 -05:00
|
|
|
btn = AddBitmapButton( ID_TO_CVPCB, KiBitmap( icon_cvpcb_xpm ) );
|
2014-02-21 08:54:13 +01:00
|
|
|
btn->SetToolTip( _( "CvPcb - Associate footprint to components" ) );
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2011-09-08 00:58:45 -05:00
|
|
|
btn = AddBitmapButton( ID_TO_PCB, KiBitmap( icon_pcbnew_xpm ) );
|
2014-02-21 08:54:13 +01:00
|
|
|
btn->SetToolTip( _( "Pcbnew - Printed circuit board editor" ) );
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2011-08-28 15:02:27 -05:00
|
|
|
btn = AddBitmapButton( ID_TO_GERBVIEW, KiBitmap( icon_gerbview_xpm ) );
|
2014-02-21 08:54:13 +01:00
|
|
|
btn->SetToolTip( _( "GerbView - Gerber viewer" ) );
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2011-09-08 16:27:02 -04:00
|
|
|
btn = AddBitmapButton( ID_TO_BITMAP_CONVERTER, KiBitmap( icon_bitmap2component_xpm ) );
|
2011-09-09 21:30:59 +02:00
|
|
|
btn->SetToolTip( _(
|
2014-02-21 08:54:13 +01:00
|
|
|
"Bitmap2Component - Convert bitmap images to Eeschema\n"
|
2014-02-28 18:31:00 +01:00
|
|
|
"or Pcbnew elements" ) );
|
2011-08-05 21:53:42 +02:00
|
|
|
|
2011-09-08 16:27:02 -04:00
|
|
|
btn = AddBitmapButton( ID_TO_PCB_CALCULATOR, KiBitmap( icon_pcbcalculator_xpm ) );
|
2014-02-21 08:54:13 +01:00
|
|
|
btn->SetToolTip( _( "Pcb calculator - Calculator for components, track width, etc." ) );
|
2013-07-19 20:27:22 +02:00
|
|
|
|
|
|
|
btn = AddBitmapButton( ID_TO_PL_EDITOR, KiBitmap( icon_pagelayout_editor_xpm ) );
|
2014-02-21 08:54:13 +01:00
|
|
|
btn->SetToolTip( _( "Pl editor - Worksheet layout editor" ) );
|
2007-10-31 18:56:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-12 10:36:43 -06:00
|
|
|
/**
|
|
|
|
* Function AddBitmapButton
|
2010-07-21 11:12:25 +02:00
|
|
|
* add a Bitmap Button (fast launch button) to the buttons panel
|
|
|
|
* @param aId = the button id
|
|
|
|
* @param aBitmap = the wxBitmap used to create the button
|
2007-10-31 18:56:11 +00:00
|
|
|
*/
|
2014-02-01 19:27:18 +01:00
|
|
|
wxBitmapButton* LAUNCHER_PANEL::AddBitmapButton( wxWindowID aId, const wxBitmap& aBitmap )
|
2007-10-31 18:56:11 +00:00
|
|
|
{
|
2014-02-01 19:27:18 +01:00
|
|
|
wxPoint buttPos = m_buttonLastPosition;
|
2011-09-09 21:30:59 +02:00
|
|
|
wxSize buttSize;
|
2011-09-13 21:37:25 +02:00
|
|
|
int btn_margin = 10; // extra margin around the bitmap.
|
2011-09-09 21:30:59 +02:00
|
|
|
|
2010-07-21 11:12:25 +02:00
|
|
|
buttSize.x = aBitmap.GetWidth() + btn_margin;
|
|
|
|
buttSize.y = aBitmap.GetHeight() + btn_margin;
|
2011-09-09 21:30:59 +02:00
|
|
|
|
|
|
|
if( m_bitmapButtons_maxHeigth < buttSize.y )
|
|
|
|
m_bitmapButtons_maxHeigth = buttSize.y;
|
|
|
|
|
2014-02-01 19:27:18 +01:00
|
|
|
wxBitmapButton* btn = new wxBitmapButton( this, aId, aBitmap, buttPos, buttSize );
|
|
|
|
m_buttonLastPosition.x += buttSize.x + m_buttonSeparation;
|
2010-07-21 11:12:25 +02:00
|
|
|
|
|
|
|
return btn;
|
2007-10-31 18:56:11 +00:00
|
|
|
}
|