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
|
|
|
|
*/
|
|
|
|
|
2016-02-24 16:36:52 -05:00
|
|
|
/**
|
|
|
|
* @file commandframe.cpp
|
|
|
|
* @brief Frame showing fast launch buttons and messages box
|
|
|
|
*/
|
|
|
|
|
2012-04-16 14:56:01 +02:00
|
|
|
|
2016-02-24 16:36:52 -05:00
|
|
|
#include <bitmaps.h>
|
2018-02-20 22:28:00 +00:00
|
|
|
#include <wx/statline.h>
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2016-02-24 16:36:52 -05:00
|
|
|
#include "kicad.h"
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
// Amount of clearance between tool buttons
|
|
|
|
const int BUTTON_SEPARATION = 5;
|
|
|
|
|
|
|
|
// Buttons are larger than images by this amount
|
2017-06-04 12:59:59 +10:00
|
|
|
const int BUTTON_EXPANSION = 6;
|
2010-07-11 18:24:44 +02:00
|
|
|
|
2014-02-01 19:27:18 +01:00
|
|
|
LAUNCHER_PANEL::LAUNCHER_PANEL( wxWindow* parent ) :
|
2019-05-17 01:29:55 +01:00
|
|
|
wxPanel( parent, wxID_ANY ),
|
|
|
|
m_buttonSizer( nullptr )
|
2009-11-18 20:12:11 +00:00
|
|
|
{
|
2011-09-09 21:30:59 +02:00
|
|
|
|
2011-09-30 14:15:37 -04:00
|
|
|
// Add bitmap buttons to launch KiCad utilities:
|
2019-05-17 01:29:55 +01:00
|
|
|
ReCreateCommandToolbar();
|
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
|
|
|
{
|
2017-05-24 23:51:02 +10:00
|
|
|
return m_height + 2 * BUTTON_SEPARATION;
|
2007-10-31 18:56:11 +00:00
|
|
|
}
|
|
|
|
|
2017-06-04 12:59:59 +10:00
|
|
|
int LAUNCHER_PANEL::GetPanelWidth() const
|
|
|
|
{
|
|
|
|
return m_width + BUTTON_SEPARATION;
|
|
|
|
}
|
|
|
|
|
2010-11-12 10:36:43 -06:00
|
|
|
/**
|
2017-05-24 23:51:02 +10:00
|
|
|
* Add application launcher buttons
|
|
|
|
* e.g. Eeschema, CvPcb, Pcbnew, GerbView
|
2007-10-31 18:56:11 +00:00
|
|
|
*/
|
2019-05-17 01:29:55 +01:00
|
|
|
void LAUNCHER_PANEL::ReCreateCommandToolbar()
|
2007-10-31 18:56:11 +00:00
|
|
|
{
|
2019-05-17 01:29:55 +01:00
|
|
|
if( m_buttonSizer )
|
|
|
|
m_buttonSizer->Clear( true );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_buttonSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
SetSizer( m_buttonSizer );
|
|
|
|
}
|
2018-02-20 22:28:00 +00:00
|
|
|
|
2019-05-17 01:29:55 +01:00
|
|
|
wxStaticLine* separator;
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
AddButton( ID_TO_SCH,
|
|
|
|
KiBitmap( icon_eeschema_xpm ),
|
2018-09-30 17:46:12 +01:00
|
|
|
_( "Schematic Layout Editor" ) );
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
AddButton( ID_TO_SCH_LIB_EDITOR,
|
|
|
|
KiBitmap( icon_libedit_xpm ),
|
2018-10-05 13:55:34 +01:00
|
|
|
_( "Symbol Editor" ) );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 15:28:54 -05:00
|
|
|
|
2018-02-20 22:28:00 +00:00
|
|
|
separator = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
|
|
|
|
m_buttonSizer->Add( separator, 0, wxEXPAND | wxALL, 8 );
|
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
AddButton( ID_TO_PCB,
|
|
|
|
KiBitmap( icon_pcbnew_xpm ),
|
2018-09-30 17:46:12 +01:00
|
|
|
_( "PCB Layout Editor" ) );
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
AddButton( ID_TO_PCB_FP_EDITOR,
|
|
|
|
KiBitmap( icon_modedit_xpm ),
|
2018-10-05 13:55:34 +01:00
|
|
|
_( "Footprint Editor" ) );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 15:28:54 -05:00
|
|
|
|
2018-02-20 22:28:00 +00:00
|
|
|
separator = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
|
|
|
|
m_buttonSizer->Add( separator, 0, wxEXPAND | wxALL, 8 );
|
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
AddButton( ID_TO_GERBVIEW,
|
|
|
|
KiBitmap( icon_gerbview_xpm ),
|
2018-09-30 17:46:12 +01:00
|
|
|
_( "Gerber Viewer" ) );
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
AddButton( ID_TO_BITMAP_CONVERTER,
|
|
|
|
KiBitmap( icon_bitmap2component_xpm ),
|
2018-09-30 17:46:12 +01:00
|
|
|
_( "Bitmap to Component Converter\n"
|
|
|
|
"Convert bitmap images to schematic or PCB components" ) );
|
2011-08-05 21:53:42 +02:00
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
AddButton( ID_TO_PCB_CALCULATOR,
|
|
|
|
KiBitmap( icon_pcbcalculator_xpm ),
|
2018-09-30 17:46:12 +01:00
|
|
|
_( "PCB Calculator\n"
|
|
|
|
"Run component calculations, track width calculations, etc." ) );
|
2013-07-19 20:27:22 +02:00
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
AddButton( ID_TO_PL_EDITOR,
|
|
|
|
KiBitmap( icon_pagelayout_editor_xpm ),
|
2018-09-30 17:46:12 +01:00
|
|
|
_( "Page Layout Editor\n"
|
|
|
|
"Edit worksheet graphics and text" ) );
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
// Add a stretchy spacer to make button bar fill the entire screen
|
|
|
|
m_buttonSizer->AddStretchSpacer();
|
|
|
|
|
2019-05-17 01:29:55 +01:00
|
|
|
Layout();
|
2017-05-24 23:51:02 +10:00
|
|
|
}
|
2007-10-31 18:56:11 +00:00
|
|
|
|
2010-11-12 10:36:43 -06:00
|
|
|
/**
|
2017-05-24 23:51:02 +10:00
|
|
|
* Add a single button to the toolbar
|
|
|
|
* @param aId is the ID of the button
|
|
|
|
* @param aBitmap is the image to be used
|
|
|
|
* @param aToolTip is the button mouse-over tool tip
|
2007-10-31 18:56:11 +00:00
|
|
|
*/
|
2017-09-23 11:20:10 +02:00
|
|
|
void LAUNCHER_PANEL::AddButton( wxWindowID aId, const wxBitmap& aBitmap, const wxString& aToolTip )
|
2007-10-31 18:56:11 +00:00
|
|
|
{
|
2017-06-04 12:59:59 +10:00
|
|
|
wxSize buttSize( aBitmap.GetWidth() + 2 * BUTTON_EXPANSION,
|
|
|
|
aBitmap.GetHeight() + 2 * BUTTON_EXPANSION );
|
2011-09-09 21:30:59 +02:00
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
if( m_height < buttSize.y )
|
|
|
|
m_height = buttSize.y;
|
2011-09-09 21:30:59 +02:00
|
|
|
|
2017-06-04 12:59:59 +10:00
|
|
|
m_width += buttSize.x + BUTTON_SEPARATION;
|
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
auto btn = new wxBitmapButton( this, aId, aBitmap, wxDefaultPosition, buttSize );
|
2011-09-09 21:30:59 +02:00
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
btn->SetToolTip( aToolTip );
|
2010-07-21 11:12:25 +02:00
|
|
|
|
2017-05-24 23:51:02 +10:00
|
|
|
m_buttonSizer->Add( btn,
|
|
|
|
0,
|
|
|
|
wxALL | wxEXPAND,
|
|
|
|
BUTTON_SEPARATION );
|
2007-10-31 18:56:11 +00:00
|
|
|
}
|