Move Kicad Manager launch bar to ACTIONs.
Also fixes a bug where hotkeys weren't getting put in menus.
This commit is contained in:
parent
31ee95c683
commit
620395608c
|
@ -70,7 +70,7 @@ void HOTKEY_STORE::Init( std::vector<TOOL_MANAGER*> aToolManagerList )
|
||||||
for( const auto& entry : toolMgr->GetActions() )
|
for( const auto& entry : toolMgr->GetActions() )
|
||||||
{
|
{
|
||||||
// Internal actions probably shouldn't be allowed hotkeys
|
// Internal actions probably shouldn't be allowed hotkeys
|
||||||
if( entry.second->GetMenuItem().IsEmpty() )
|
if( entry.second->GetLabel().IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
masterMap[ entry.first ] = entry.second;
|
masterMap[ entry.first ] = entry.second;
|
||||||
|
|
|
@ -52,6 +52,19 @@ void ACTION_TOOLBAR::Add( const TOOL_ACTION& aAction, bool aIsToggleEntry )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ACTION_TOOLBAR::AddButton( const TOOL_ACTION& aAction )
|
||||||
|
{
|
||||||
|
EDA_BASE_FRAME* editFrame = m_toolManager->GetEditFrame();
|
||||||
|
int toolId = aAction.GetId() + ACTION_ID;
|
||||||
|
|
||||||
|
AddTool( toolId, wxEmptyString, KiScaledBitmap( aAction.GetIcon(), editFrame ),
|
||||||
|
aAction.GetName(), wxITEM_NORMAL );
|
||||||
|
|
||||||
|
m_toolKinds[ toolId ] = false;
|
||||||
|
m_toolActions[ toolId ] = &aAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ACTION_TOOLBAR::Toggle( const TOOL_ACTION& aAction, bool aState )
|
void ACTION_TOOLBAR::Toggle( const TOOL_ACTION& aAction, bool aState )
|
||||||
{
|
{
|
||||||
int toolId = aAction.GetId() + ACTION_ID;
|
int toolId = aAction.GetId() + ACTION_ID;
|
||||||
|
|
|
@ -26,22 +26,24 @@
|
||||||
#include <tool/action_manager.h>
|
#include <tool/action_manager.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <hotkeys_basic.h>
|
||||||
|
|
||||||
TOOL_ACTION::TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope,
|
TOOL_ACTION::TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope,
|
||||||
int aDefaultHotKey, const std::string& aLegacyHotKeyName,
|
int aDefaultHotKey, const std::string& aLegacyHotKeyName,
|
||||||
const wxString& aMenuText, const wxString& aTooltip,
|
const wxString& aLabel, const wxString& aTooltip,
|
||||||
const BITMAP_OPAQUE* aIcon, TOOL_ACTION_FLAGS aFlags, void* aParam ) :
|
const BITMAP_OPAQUE* aIcon, TOOL_ACTION_FLAGS aFlags, void* aParam ) :
|
||||||
m_name( aName ),
|
m_name( aName ),
|
||||||
m_scope( aScope ),
|
m_scope( aScope ),
|
||||||
m_defaultHotKey( aDefaultHotKey ),
|
m_defaultHotKey( aDefaultHotKey ),
|
||||||
m_legacyName( aLegacyHotKeyName ),
|
m_legacyName( aLegacyHotKeyName ),
|
||||||
m_menuText( aMenuText ),
|
m_label( aLabel ),
|
||||||
m_tooltip( aTooltip ),
|
m_tooltip( aTooltip ),
|
||||||
m_icon( aIcon ),
|
m_icon( aIcon ),
|
||||||
m_id( -1 ),
|
m_id( -1 ),
|
||||||
m_flags( aFlags ),
|
m_flags( aFlags ),
|
||||||
m_param( aParam )
|
m_param( aParam )
|
||||||
{
|
{
|
||||||
|
SetHotKey( aDefaultHotKey );
|
||||||
ACTION_MANAGER::GetActionList().push_back( this );
|
ACTION_MANAGER::GetActionList().push_back( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +54,13 @@ TOOL_ACTION::~TOOL_ACTION()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TOOL_ACTION::SetHotKey( int aKeycode )
|
||||||
|
{
|
||||||
|
m_hotKey = aKeycode;
|
||||||
|
m_menuItem = AddHotkeyName( m_label, m_hotKey, IS_HOTKEY );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string TOOL_ACTION::GetToolName() const
|
std::string TOOL_ACTION::GetToolName() const
|
||||||
{
|
{
|
||||||
int dotCount = std::count( m_name.begin(), m_name.end(), '.' );
|
int dotCount = std::count( m_name.begin(), m_name.end(), '.' );
|
||||||
|
|
|
@ -249,7 +249,7 @@ public:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Match in the (translated) filter string
|
// Match in the (translated) filter string
|
||||||
const auto normedInfo = wxGetTranslation( aHotkey.m_Parent->GetMenuItem() ).Upper();
|
const auto normedInfo = wxGetTranslation( aHotkey.m_Parent->GetLabel() ).Upper();
|
||||||
if( normedInfo.Contains( m_normalised_filter_str ) )
|
if( normedInfo.Contains( m_normalised_filter_str ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ void WIDGET_HOTKEY_LIST::UpdateFromClientData()
|
||||||
if( hkdata )
|
if( hkdata )
|
||||||
{
|
{
|
||||||
const auto& changed_hk = hkdata->GetChangedHotkey();
|
const auto& changed_hk = hkdata->GetChangedHotkey();
|
||||||
wxString label = changed_hk.m_Parent->GetMenuItem();
|
wxString label = changed_hk.m_Parent->GetLabel();
|
||||||
wxString key_text = KeyNameFromKeyCode( changed_hk.m_EditKeycode );
|
wxString key_text = KeyNameFromKeyCode( changed_hk.m_EditKeycode );
|
||||||
|
|
||||||
if( label.IsEmpty() )
|
if( label.IsEmpty() )
|
||||||
|
@ -460,7 +460,7 @@ bool WIDGET_HOTKEY_LIST::ResolveKeyConflicts( TOOL_ACTION* aAction, long aKey )
|
||||||
wxString msg = wxString::Format( _( "\"%s\" is already assigned to \"%s\" in section \"%s\". "
|
wxString msg = wxString::Format( _( "\"%s\" is already assigned to \"%s\" in section \"%s\". "
|
||||||
"Are you sure you want to change its assignment?" ),
|
"Are you sure you want to change its assignment?" ),
|
||||||
KeyNameFromKeyCode( aKey ),
|
KeyNameFromKeyCode( aKey ),
|
||||||
conflictingAction->GetMenuItem(),
|
conflictingAction->GetLabel(),
|
||||||
HOTKEY_STORE::GetSectionName( conflictingAction ) );
|
HOTKEY_STORE::GetSectionName( conflictingAction ) );
|
||||||
|
|
||||||
wxMessageDialog dlg( GetParent(), msg, _( "Confirm change" ), wxYES_NO | wxNO_DEFAULT );
|
wxMessageDialog dlg( GetParent(), msg, _( "Confirm change" ), wxYES_NO | wxNO_DEFAULT );
|
||||||
|
|
|
@ -52,6 +52,13 @@ public:
|
||||||
* a TOOL_EVENT command containing name of the action is sent.
|
* a TOOL_EVENT command containing name of the action is sent.
|
||||||
*/
|
*/
|
||||||
void Add( const TOOL_ACTION& aAction, bool aIsToggleEntry = false );
|
void Add( const TOOL_ACTION& aAction, bool aIsToggleEntry = false );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function AddButton()
|
||||||
|
* Adds a large button such as used in the Kicad Manager Frame's launch bar.
|
||||||
|
* @param aAction
|
||||||
|
*/
|
||||||
|
void AddButton( const TOOL_ACTION& aAction );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies the default toggle action. For checked items this is check/uncheck; for
|
* Applies the default toggle action. For checked items this is check/uncheck; for
|
||||||
|
|
|
@ -84,7 +84,7 @@ public:
|
||||||
* Returns the hotkey keycode which initiates the action.
|
* Returns the hotkey keycode which initiates the action.
|
||||||
*/
|
*/
|
||||||
int GetHotKey() const { return m_hotKey; }
|
int GetHotKey() const { return m_hotKey; }
|
||||||
void SetHotKey( int aKeycode ) { m_hotKey = aKeycode; }
|
void SetHotKey( int aKeycode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetId()
|
* Function GetId()
|
||||||
|
@ -110,8 +110,9 @@ public:
|
||||||
return TOOL_EVENT( TC_COMMAND, TA_ACTION, m_name, m_scope, m_param );
|
return TOOL_EVENT( TC_COMMAND, TA_ACTION, m_name, m_scope, m_param );
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString& GetMenuItem() const { return m_menuText; }
|
const wxString& GetLabel() const { return m_label; }
|
||||||
void SetMenuItem( const wxString& aItem ) { m_menuText = aItem; }
|
|
||||||
|
const wxString& GetMenuItem() const { return m_menuItem; }
|
||||||
|
|
||||||
const wxString& GetDescription() const { return m_tooltip; }
|
const wxString& GetDescription() const { return m_tooltip; }
|
||||||
void SetDescription( const wxString& aDescription ) { m_tooltip = aDescription; }
|
void SetDescription( const wxString& aDescription ) { m_tooltip = aDescription; }
|
||||||
|
@ -160,7 +161,8 @@ private:
|
||||||
int m_hotKey; // The curret hotkey (post-user-settings-application)
|
int m_hotKey; // The curret hotkey (post-user-settings-application)
|
||||||
const std::string m_legacyName; // Name for reading legacy hotkey settings
|
const std::string m_legacyName; // Name for reading legacy hotkey settings
|
||||||
|
|
||||||
wxString m_menuText;
|
const wxString m_label;
|
||||||
|
wxString m_menuItem; // Label + hotkey text for menus
|
||||||
wxString m_tooltip;
|
wxString m_tooltip;
|
||||||
const BITMAP_OPAQUE* m_icon; // Icon for the menu entry
|
const BITMAP_OPAQUE* m_icon; // Icon for the menu entry
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ include_directories(
|
||||||
|
|
||||||
|
|
||||||
set( KICAD_SRCS
|
set( KICAD_SRCS
|
||||||
commandframe.cpp
|
|
||||||
dialogs/dialog_template_selector_base.cpp
|
dialogs/dialog_template_selector_base.cpp
|
||||||
dialogs/dialog_template_selector.cpp
|
dialogs/dialog_template_selector.cpp
|
||||||
files-io.cpp
|
files-io.cpp
|
||||||
|
|
|
@ -1,146 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file commandframe.cpp
|
|
||||||
* @brief Frame showing fast launch buttons and messages box
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <bitmaps.h>
|
|
||||||
#include <wx/statline.h>
|
|
||||||
|
|
||||||
#include "kicad_manager_frame.h"
|
|
||||||
#include "kicad_id.h"
|
|
||||||
|
|
||||||
// Amount of clearance between tool buttons
|
|
||||||
const int BUTTON_SEPARATION = 5;
|
|
||||||
|
|
||||||
// Buttons are larger than images by this amount
|
|
||||||
const int BUTTON_EXPANSION = 6;
|
|
||||||
|
|
||||||
LAUNCHER_PANEL::LAUNCHER_PANEL( wxWindow* parent ) :
|
|
||||||
wxPanel( parent, wxID_ANY ),
|
|
||||||
m_buttonSizer( nullptr )
|
|
||||||
{
|
|
||||||
|
|
||||||
// Add bitmap buttons to launch KiCad utilities:
|
|
||||||
ReCreateCommandToolbar();
|
|
||||||
}
|
|
||||||
|
|
||||||
int LAUNCHER_PANEL::GetPanelHeight() const
|
|
||||||
{
|
|
||||||
return m_height + 2 * BUTTON_SEPARATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LAUNCHER_PANEL::GetPanelWidth() const
|
|
||||||
{
|
|
||||||
return m_width + BUTTON_SEPARATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add application launcher buttons
|
|
||||||
* e.g. Eeschema, CvPcb, Pcbnew, GerbView
|
|
||||||
*/
|
|
||||||
void LAUNCHER_PANEL::ReCreateCommandToolbar()
|
|
||||||
{
|
|
||||||
if( m_buttonSizer )
|
|
||||||
m_buttonSizer->Clear( true );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_buttonSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
SetSizer( m_buttonSizer );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxStaticLine* separator;
|
|
||||||
|
|
||||||
AddButton( ID_TO_SCH,
|
|
||||||
KiBitmap( icon_eeschema_xpm ),
|
|
||||||
_( "Schematic Layout Editor" ) );
|
|
||||||
|
|
||||||
AddButton( ID_TO_SCH_LIB_EDITOR,
|
|
||||||
KiBitmap( icon_libedit_xpm ),
|
|
||||||
_( "Symbol Editor" ) );
|
|
||||||
|
|
||||||
separator = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
|
|
||||||
m_buttonSizer->Add( separator, 0, wxEXPAND | wxALL, 8 );
|
|
||||||
|
|
||||||
AddButton( ID_TO_PCB,
|
|
||||||
KiBitmap( icon_pcbnew_xpm ),
|
|
||||||
_( "PCB Layout Editor" ) );
|
|
||||||
|
|
||||||
AddButton( ID_TO_PCB_FP_EDITOR,
|
|
||||||
KiBitmap( icon_modedit_xpm ),
|
|
||||||
_( "Footprint Editor" ) );
|
|
||||||
|
|
||||||
separator = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
|
|
||||||
m_buttonSizer->Add( separator, 0, wxEXPAND | wxALL, 8 );
|
|
||||||
|
|
||||||
AddButton( ID_TO_GERBVIEW,
|
|
||||||
KiBitmap( icon_gerbview_xpm ),
|
|
||||||
_( "Gerber Viewer" ) );
|
|
||||||
|
|
||||||
AddButton( ID_TO_BITMAP_CONVERTER,
|
|
||||||
KiBitmap( icon_bitmap2component_xpm ),
|
|
||||||
_( "Bitmap to Component Converter\n"
|
|
||||||
"Convert bitmap images to schematic or PCB components" ) );
|
|
||||||
|
|
||||||
AddButton( ID_TO_PCB_CALCULATOR,
|
|
||||||
KiBitmap( icon_pcbcalculator_xpm ),
|
|
||||||
_( "PCB Calculator\n"
|
|
||||||
"Run component calculations, track width calculations, etc." ) );
|
|
||||||
|
|
||||||
AddButton( ID_TO_PL_EDITOR,
|
|
||||||
KiBitmap( icon_pagelayout_editor_xpm ),
|
|
||||||
_( "Page Layout Editor\n"
|
|
||||||
"Edit worksheet graphics and text" ) );
|
|
||||||
|
|
||||||
// Add a stretchy spacer to make button bar fill the entire screen
|
|
||||||
m_buttonSizer->AddStretchSpacer();
|
|
||||||
|
|
||||||
Layout();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
void LAUNCHER_PANEL::AddButton( wxWindowID aId, const wxBitmap& aBitmap, const wxString& aToolTip )
|
|
||||||
{
|
|
||||||
wxSize buttSize( aBitmap.GetWidth() + 2 * BUTTON_EXPANSION,
|
|
||||||
aBitmap.GetHeight() + 2 * BUTTON_EXPANSION );
|
|
||||||
|
|
||||||
if( m_height < buttSize.y )
|
|
||||||
m_height = buttSize.y;
|
|
||||||
|
|
||||||
m_width += buttSize.x + BUTTON_SEPARATION;
|
|
||||||
|
|
||||||
auto btn = new wxBitmapButton( this, aId, aBitmap, wxDefaultPosition, buttSize );
|
|
||||||
|
|
||||||
btn->SetToolTip( aToolTip );
|
|
||||||
|
|
||||||
m_buttonSizer->Add( btn, 0, wxALL | wxEXPAND, BUTTON_SEPARATION );
|
|
||||||
}
|
|
|
@ -74,7 +74,7 @@ enum id_kicad_frm {
|
||||||
ID_TO_PL_EDITOR,
|
ID_TO_PL_EDITOR,
|
||||||
|
|
||||||
ID_TO_TEXT_EDITOR,
|
ID_TO_TEXT_EDITOR,
|
||||||
ID_BROWSE_AN_SELECT_FILE,
|
ID_EDIT_LOCAL_FILE_IN_TEXT_EDITOR,
|
||||||
ID_BROWSE_IN_FILE_EXPLORER,
|
ID_BROWSE_IN_FILE_EXPLORER,
|
||||||
ID_SAVE_AND_ZIP_FILES,
|
ID_SAVE_AND_ZIP_FILES,
|
||||||
ID_READ_ZIP_ARCHIVE,
|
ID_READ_ZIP_ARCHIVE,
|
||||||
|
|
|
@ -49,13 +49,41 @@
|
||||||
|
|
||||||
#define TREE_FRAME_WIDTH_ENTRY wxT( "LeftWinWidth" )
|
#define TREE_FRAME_WIDTH_ENTRY wxT( "LeftWinWidth" )
|
||||||
|
|
||||||
|
// Menubar and toolbar event table
|
||||||
|
BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
|
||||||
|
// Window events
|
||||||
|
EVT_SIZE( KICAD_MANAGER_FRAME::OnSize )
|
||||||
|
EVT_CLOSE( KICAD_MANAGER_FRAME::OnCloseWindow )
|
||||||
|
|
||||||
|
// Menu events
|
||||||
|
EVT_MENU( wxID_EXIT, KICAD_MANAGER_FRAME::OnExit )
|
||||||
|
EVT_MENU( ID_EDIT_LOCAL_FILE_IN_TEXT_EDITOR, KICAD_MANAGER_FRAME::OnOpenFileInTextEditor )
|
||||||
|
EVT_MENU( ID_BROWSE_IN_FILE_EXPLORER, KICAD_MANAGER_FRAME::OnBrowseInFileExplorer )
|
||||||
|
EVT_MENU( ID_SAVE_AND_ZIP_FILES, KICAD_MANAGER_FRAME::OnArchiveFiles )
|
||||||
|
EVT_MENU( ID_READ_ZIP_ARCHIVE, KICAD_MANAGER_FRAME::OnUnarchiveFiles )
|
||||||
|
EVT_MENU( ID_IMPORT_EAGLE_PROJECT, KICAD_MANAGER_FRAME::OnImportEagleFiles )
|
||||||
|
|
||||||
|
// Range menu events
|
||||||
|
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
|
||||||
|
KICAD_MANAGER_FRAME::language_change )
|
||||||
|
|
||||||
|
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, KICAD_MANAGER_FRAME::OnFileHistory )
|
||||||
|
|
||||||
|
// Special functions
|
||||||
|
EVT_MENU( ID_INIT_WATCHED_PATHS, KICAD_MANAGER_FRAME::OnChangeWatchedPaths )
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
|
KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
|
||||||
const wxPoint& pos, const wxSize& size ) :
|
const wxPoint& pos, const wxSize& size ) :
|
||||||
EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size,
|
EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size,
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE, KICAD_MANAGER_FRAME_NAME, &::Kiway )
|
KICAD_DEFAULT_DRAWFRAME_STYLE, KICAD_MANAGER_FRAME_NAME, &::Kiway ),
|
||||||
|
m_leftWin( nullptr ),
|
||||||
|
m_launcher( nullptr ),
|
||||||
|
m_messagesBox( nullptr ),
|
||||||
|
m_mainToolBar( nullptr )
|
||||||
{
|
{
|
||||||
m_active_project = false;
|
m_active_project = false;
|
||||||
m_mainToolBar = nullptr;
|
|
||||||
m_leftWinWidth = 60;
|
m_leftWinWidth = 60;
|
||||||
m_AboutTitle = "KiCad";
|
m_AboutTitle = "KiCad";
|
||||||
|
|
||||||
|
@ -75,13 +103,10 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
|
|
||||||
// Left window: is the box which display tree project
|
// Left window: is the box which display tree project
|
||||||
m_LeftWin = new TREE_PROJECT_FRAME( this );
|
m_leftWin = new TREE_PROJECT_FRAME( this );
|
||||||
|
|
||||||
// Right top Window: buttons to launch applications
|
|
||||||
m_Launcher = new LAUNCHER_PANEL( this );
|
|
||||||
|
|
||||||
// Add the wxTextCtrl showing all messages from KiCad:
|
// Add the wxTextCtrl showing all messages from KiCad:
|
||||||
m_MessagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
|
m_messagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxTE_MULTILINE | wxTE_READONLY | wxBORDER_NONE );
|
wxTE_MULTILINE | wxTE_READONLY | wxBORDER_NONE );
|
||||||
|
|
||||||
|
@ -96,20 +121,20 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
|
||||||
m_toolManager->InitTools();
|
m_toolManager->InitTools();
|
||||||
|
|
||||||
RecreateBaseHToolbar();
|
RecreateBaseHToolbar();
|
||||||
|
RecreateLauncher();
|
||||||
ReCreateMenuBar();
|
ReCreateMenuBar();
|
||||||
|
|
||||||
m_auimgr.SetManagedWindow( this );
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
|
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
|
||||||
|
|
||||||
m_auimgr.AddPane( m_LeftWin, EDA_PANE().Palette().Name( "ProjectTree" ).Left().Layer(3)
|
m_auimgr.AddPane( m_leftWin, EDA_PANE().Palette().Name( "ProjectTree" ).Left().Layer(3)
|
||||||
.CaptionVisible( false ).PaneBorder( false )
|
.CaptionVisible( false ).PaneBorder( false )
|
||||||
.MinSize( 150, -1 ).BestSize( m_leftWinWidth, -1 ) );
|
.MinSize( 150, -1 ).BestSize( m_leftWinWidth, -1 ) );
|
||||||
|
|
||||||
m_auimgr.AddPane( m_Launcher, EDA_PANE().HToolbar().Name( "Launcher" ).Top().Layer(1)
|
m_auimgr.AddPane( m_launcher, EDA_PANE().HToolbar().Name( "Launcher" ).Top().Layer(1) );
|
||||||
.MinSize( m_Launcher->GetPanelWidth(), m_Launcher->GetPanelHeight() ) );
|
|
||||||
|
|
||||||
m_auimgr.AddPane( m_MessagesBox, EDA_PANE().Messages().Name( "MsgPanel" ).Center() );
|
m_auimgr.AddPane( m_messagesBox, EDA_PANE().Messages().Name( "MsgPanel" ).Center() );
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
|
@ -186,7 +211,7 @@ const wxString KICAD_MANAGER_FRAME::PcbLegacyFileName()
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::ReCreateTreePrj()
|
void KICAD_MANAGER_FRAME::ReCreateTreePrj()
|
||||||
{
|
{
|
||||||
m_LeftWin->ReCreateTreePrj();
|
m_leftWin->ReCreateTreePrj();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -204,7 +229,7 @@ wxString KICAD_MANAGER_FRAME::help_name()
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::PrintMsg( const wxString& aText )
|
void KICAD_MANAGER_FRAME::PrintMsg( const wxString& aText )
|
||||||
{
|
{
|
||||||
m_MessagesBox->AppendText( aText );
|
m_messagesBox->AppendText( aText );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,7 +264,7 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
|
|
||||||
Event.SetCanVeto( true );
|
Event.SetCanVeto( true );
|
||||||
|
|
||||||
m_LeftWin->Show( false );
|
m_leftWin->Show( false );
|
||||||
|
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
@ -252,234 +277,6 @@ void KICAD_MANAGER_FRAME::OnExit( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::TERMINATE_HANDLER::OnTerminate( int pid, int status )
|
|
||||||
{
|
|
||||||
wxString msg = wxString::Format( _( "%s closed [pid=%d]\n" ),
|
|
||||||
m_appName,
|
|
||||||
pid );
|
|
||||||
|
|
||||||
wxWindow* window = wxWindow::FindWindowByName( KICAD_MANAGER_FRAME_NAME );
|
|
||||||
|
|
||||||
if( window ) // Should always happen.
|
|
||||||
{
|
|
||||||
// Be sure the kicad frame manager is found
|
|
||||||
// This dynamic cast is not really mandatory, but ...
|
|
||||||
KICAD_MANAGER_FRAME* frame = dynamic_cast<KICAD_MANAGER_FRAME*> (window);
|
|
||||||
|
|
||||||
if( frame )
|
|
||||||
frame->PrintMsg( msg );
|
|
||||||
}
|
|
||||||
|
|
||||||
delete this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::Execute( wxWindow* frame, const wxString& execFile, wxString params )
|
|
||||||
{
|
|
||||||
if( params.size() )
|
|
||||||
AddDelimiterString( params );
|
|
||||||
|
|
||||||
TERMINATE_HANDLER* callback = new TERMINATE_HANDLER( execFile );
|
|
||||||
|
|
||||||
long pid = ExecuteFile( frame, execFile, params, callback );
|
|
||||||
|
|
||||||
if( pid > 0 )
|
|
||||||
{
|
|
||||||
wxString msg = wxString::Format( _( "%s %s opened [pid=%ld]\n" ),
|
|
||||||
execFile,
|
|
||||||
params,
|
|
||||||
pid );
|
|
||||||
PrintMsg( msg );
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
|
||||||
msg.Printf( "osascript -e 'activate application \"%s\"' ", execFile );
|
|
||||||
system( msg.c_str() );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delete callback;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::RunEeschema( const wxString& aProjectSchematicFileName )
|
|
||||||
{
|
|
||||||
KIWAY_PLAYER* frame;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
frame = Kiway().Player( FRAME_SCH, true );
|
|
||||||
}
|
|
||||||
catch( const IO_ERROR& err )
|
|
||||||
{
|
|
||||||
wxMessageBox( _( "Eeschema failed to load:\n" ) + err.What(),
|
|
||||||
_( "KiCad Error" ), wxOK | wxICON_ERROR, this );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !frame->IsShown() ) // A hidden frame might not have the project loaded.
|
|
||||||
{
|
|
||||||
if( !frame->OpenProjectFiles( std::vector<wxString>( 1, aProjectSchematicFileName ) ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
frame->Show( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
// On Windows, Raise() does not bring the window on screen, when iconized or not shown
|
|
||||||
// On linux, Raise() brings the window on screen, but this code works fine
|
|
||||||
if( frame->IsIconized() )
|
|
||||||
{
|
|
||||||
frame->Iconize( false );
|
|
||||||
// If an iconized frame was created by Pcbnew, Iconize( false ) is not enough
|
|
||||||
// to show the frame at its normal size: Maximize should be called.
|
|
||||||
frame->Maximize( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
frame->Raise();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnRunEeschema( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
wxFileName fn( GetProjectFileName() );
|
|
||||||
fn.SetExt( SchematicFileExtension );
|
|
||||||
RunEeschema( fn.GetFullPath() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnRunSchLibEditor( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
KIWAY_PLAYER* frame;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
frame = Kiway().Player( FRAME_SCH_LIB_EDITOR, true );
|
|
||||||
}
|
|
||||||
catch( const IO_ERROR& err )
|
|
||||||
{
|
|
||||||
wxMessageBox( _( "Component library editor failed to load:\n" ) + err.What(),
|
|
||||||
_( "KiCad Error" ), wxOK | wxICON_ERROR, this );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !frame->IsShown() )
|
|
||||||
frame->Show( true );
|
|
||||||
|
|
||||||
// On Windows, Raise() does not bring the window on screen, when iconized
|
|
||||||
if( frame->IsIconized() )
|
|
||||||
frame->Iconize( false );
|
|
||||||
|
|
||||||
frame->Raise();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::RunPcbNew( const wxString& aProjectBoardFileName )
|
|
||||||
{
|
|
||||||
KIWAY_PLAYER* frame;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
frame = Kiway().Player( FRAME_PCB, true );
|
|
||||||
}
|
|
||||||
catch( const IO_ERROR& err )
|
|
||||||
{
|
|
||||||
wxMessageBox( _( "Pcbnew failed to load:\n" ) + err.What(), _( "KiCad Error" ),
|
|
||||||
wxOK | wxICON_ERROR, this );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !frame->IsVisible() ) // A hidden frame might not have the board loaded.
|
|
||||||
{
|
|
||||||
if( !frame->OpenProjectFiles( std::vector<wxString>( 1, aProjectBoardFileName ) ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
frame->Show( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
// On Windows, Raise() does not bring the window on screen, when iconized
|
|
||||||
if( frame->IsIconized() )
|
|
||||||
frame->Iconize( false );
|
|
||||||
|
|
||||||
frame->Raise();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnRunPcbNew( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
wxFileName kicad_board( PcbFileName() );
|
|
||||||
wxFileName legacy_board( PcbLegacyFileName() );
|
|
||||||
|
|
||||||
wxFileName& board = ( !legacy_board.FileExists() || kicad_board.FileExists() ) ?
|
|
||||||
kicad_board : legacy_board;
|
|
||||||
|
|
||||||
RunPcbNew( board.GetFullPath() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnRunPcbFpEditor( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
KIWAY_PLAYER* frame;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
frame = Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
|
|
||||||
}
|
|
||||||
catch( const IO_ERROR& err )
|
|
||||||
{
|
|
||||||
wxMessageBox( _( "Footprint library editor failed to load:\n" ) + err.What(),
|
|
||||||
_( "KiCad Error" ), wxOK | wxICON_ERROR, this );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !frame->IsShown() )
|
|
||||||
frame->Show( true );
|
|
||||||
|
|
||||||
// On Windows, Raise() does not bring the window on screen, when iconized
|
|
||||||
if( frame->IsIconized() )
|
|
||||||
frame->Iconize( false );
|
|
||||||
|
|
||||||
frame->Raise();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnRunBitmapConverter( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
Execute( this, BITMAPCONVERTER_EXE );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnRunPcbCalculator( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
Execute( this, PCB_CALCULATOR_EXE );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnRunPageLayoutEditor( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
Execute( this, PL_EDITOR_EXE );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnRunGerbview( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
// Gerbview is called without any file to open, because we do not know
|
|
||||||
// the list and the name of files to open (if any...).
|
|
||||||
// however we run it in the path of the project
|
|
||||||
Execute( this, GERBVIEW_EXE, Prj().GetProjectPath() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnOpenTextEditor( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
wxString editorname = Pgm().GetEditorName();
|
|
||||||
|
|
||||||
if( !editorname.IsEmpty() )
|
|
||||||
Execute( this, editorname, wxEmptyString );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor( wxCommandEvent& event )
|
void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// show all files in file dialog (in Kicad all files are editable texts):
|
// show all files in file dialog (in Kicad all files are editable texts):
|
||||||
|
@ -497,7 +294,7 @@ void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor( wxCommandEvent& event )
|
||||||
filename += dlg.GetPath() + wxT( "\"" );
|
filename += dlg.GetPath() + wxT( "\"" );
|
||||||
|
|
||||||
if( !dlg.GetPath().IsEmpty() && !Pgm().GetEditorName().IsEmpty() )
|
if( !dlg.GetPath().IsEmpty() && !Pgm().GetEditorName().IsEmpty() )
|
||||||
Execute( this, Pgm().GetEditorName(), filename );
|
m_toolManager->RunAction( KICAD_MANAGER_ACTIONS::openTextEditor, true, &filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnBrowseInFileExplorer( wxCommandEvent& event )
|
void KICAD_MANAGER_FRAME::OnBrowseInFileExplorer( wxCommandEvent& event )
|
||||||
|
@ -523,7 +320,7 @@ void KICAD_MANAGER_FRAME::OnBrowseInFileExplorer( wxCommandEvent& event )
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::RefreshProjectTree()
|
void KICAD_MANAGER_FRAME::RefreshProjectTree()
|
||||||
{
|
{
|
||||||
m_LeftWin->ReCreateTreePrj();
|
m_leftWin->ReCreateTreePrj();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -541,7 +338,7 @@ void KICAD_MANAGER_FRAME::ShowChangedLanguage()
|
||||||
|
|
||||||
// tooltips in toolbars
|
// tooltips in toolbars
|
||||||
RecreateBaseHToolbar();
|
RecreateBaseHToolbar();
|
||||||
m_Launcher->ReCreateCommandToolbar();
|
RecreateLauncher();
|
||||||
|
|
||||||
PrintPrjInfo();
|
PrintPrjInfo();
|
||||||
}
|
}
|
||||||
|
@ -557,7 +354,7 @@ void KICAD_MANAGER_FRAME::CommonSettingsChanged()
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::ClearMsg()
|
void KICAD_MANAGER_FRAME::ClearMsg()
|
||||||
{
|
{
|
||||||
m_MessagesBox->Clear();
|
m_messagesBox->Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -571,7 +368,7 @@ void KICAD_MANAGER_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
void KICAD_MANAGER_FRAME::SaveSettings( wxConfigBase* aCfg )
|
void KICAD_MANAGER_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
{
|
{
|
||||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||||
aCfg->Write( TREE_FRAME_WIDTH_ENTRY, m_LeftWin->GetSize().x );
|
aCfg->Write( TREE_FRAME_WIDTH_ENTRY, m_leftWin->GetSize().x );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,16 +86,6 @@ public:
|
||||||
void OnArchiveFiles( wxCommandEvent& event );
|
void OnArchiveFiles( wxCommandEvent& event );
|
||||||
void OnUnarchiveFiles( wxCommandEvent& event );
|
void OnUnarchiveFiles( wxCommandEvent& event );
|
||||||
|
|
||||||
void OnRunEeschema( wxCommandEvent& event );
|
|
||||||
void OnRunSchLibEditor( wxCommandEvent& event );
|
|
||||||
void OnRunPcbNew( wxCommandEvent& event );
|
|
||||||
void OnRunPcbFpEditor( wxCommandEvent& event );
|
|
||||||
void OnRunGerbview( wxCommandEvent& event );
|
|
||||||
void OnRunBitmapConverter( wxCommandEvent& event );
|
|
||||||
void OnRunPcbCalculator( wxCommandEvent& event );
|
|
||||||
void OnRunPageLayoutEditor( wxCommandEvent& event );
|
|
||||||
|
|
||||||
void OnOpenTextEditor( wxCommandEvent& event );
|
|
||||||
void OnOpenFileInTextEditor( wxCommandEvent& event );
|
void OnOpenFileInTextEditor( wxCommandEvent& event );
|
||||||
void OnBrowseInFileExplorer( wxCommandEvent& event );
|
void OnBrowseInFileExplorer( wxCommandEvent& event );
|
||||||
|
|
||||||
|
@ -104,6 +94,7 @@ public:
|
||||||
|
|
||||||
void ReCreateMenuBar() override;
|
void ReCreateMenuBar() override;
|
||||||
void RecreateBaseHToolbar();
|
void RecreateBaseHToolbar();
|
||||||
|
void RecreateLauncher();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open dialog to import Eagle schematic and board files.
|
* Open dialog to import Eagle schematic and board files.
|
||||||
|
@ -150,30 +141,6 @@ public:
|
||||||
void ShowChangedLanguage() override;
|
void ShowChangedLanguage() override;
|
||||||
void CommonSettingsChanged() override;
|
void CommonSettingsChanged() override;
|
||||||
|
|
||||||
/**
|
|
||||||
* Open another KiCad application and logs a message.
|
|
||||||
*
|
|
||||||
* @param frame = owner frame.
|
|
||||||
* @param execFile = name of the executable file.
|
|
||||||
* @param param = parameters to be passed to the executable.
|
|
||||||
*/
|
|
||||||
void Execute( wxWindow* frame, const wxString& execFile,
|
|
||||||
wxString param = wxEmptyString );
|
|
||||||
|
|
||||||
class TERMINATE_HANDLER : public wxProcess
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
wxString m_appName;
|
|
||||||
|
|
||||||
public:
|
|
||||||
TERMINATE_HANDLER( const wxString& appName ) :
|
|
||||||
m_appName( appName )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnTerminate( int pid, int status ) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by sending a event with id = ID_INIT_WATCHED_PATHS
|
* Called by sending a event with id = ID_INIT_WATCHED_PATHS
|
||||||
* rebuild the list of wahtched paths
|
* rebuild the list of wahtched paths
|
||||||
|
@ -192,63 +159,28 @@ public:
|
||||||
|
|
||||||
void ReCreateTreePrj();
|
void ReCreateTreePrj();
|
||||||
|
|
||||||
/// Call this only for a PCB associated with the current project. That is,
|
|
||||||
/// it must have the same path and name as the project *.pro file.
|
|
||||||
void RunPcbNew( const wxString& aProjectBoardFileName );
|
|
||||||
|
|
||||||
/// Call this only for a SCH associated with the current project. That is,
|
|
||||||
/// it must have the same path and name as the project *.pro file.
|
|
||||||
void RunEeschema( const wxString& aProjectSchematicFileName );
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxConfigBase* config() override;
|
wxConfigBase* config() override;
|
||||||
|
|
||||||
const SEARCH_STACK& sys_search() override;
|
const SEARCH_STACK& sys_search() override;
|
||||||
|
|
||||||
wxString help_name() override;
|
wxString help_name() override;
|
||||||
|
|
||||||
TREE_PROJECT_FRAME* m_LeftWin;
|
|
||||||
LAUNCHER_PANEL* m_Launcher;
|
|
||||||
wxTextCtrl* m_MessagesBox;
|
|
||||||
ACTION_TOOLBAR* m_mainToolBar;
|
|
||||||
|
|
||||||
int m_leftWinWidth;
|
|
||||||
|
|
||||||
void language_change( wxCommandEvent& event );
|
void language_change( wxCommandEvent& event );
|
||||||
|
|
||||||
bool m_active_project;
|
private:
|
||||||
|
TREE_PROJECT_FRAME* m_leftWin;
|
||||||
|
ACTION_TOOLBAR* m_launcher;
|
||||||
|
wxTextCtrl* m_messagesBox;
|
||||||
|
ACTION_TOOLBAR* m_mainToolBar;
|
||||||
|
|
||||||
|
int m_leftWinWidth;
|
||||||
|
bool m_active_project;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** class LAUNCHER_PANEL
|
|
||||||
*/
|
|
||||||
class LAUNCHER_PANEL : public wxPanel
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
wxBoxSizer* m_buttonSizer;
|
|
||||||
|
|
||||||
int m_height = 0;
|
|
||||||
int m_width = 0;
|
|
||||||
|
|
||||||
public: LAUNCHER_PANEL( wxWindow* parent );
|
|
||||||
~LAUNCHER_PANEL() { };
|
|
||||||
|
|
||||||
int GetPanelHeight() const;
|
|
||||||
int GetPanelWidth() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function CreateCommandToolbar
|
|
||||||
* creates the main tool bar buttons (fast launch buttons)
|
|
||||||
*/
|
|
||||||
void ReCreateCommandToolbar();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void AddButton( wxWindowID aId, const wxBitmap& aBitmap, const wxString& aToolTip );
|
|
||||||
};
|
|
||||||
|
|
||||||
// The C++ project manager includes a single PROJECT in its link image.
|
// The C++ project manager includes a single PROJECT in its link image.
|
||||||
class PROJECT;
|
class PROJECT;
|
||||||
extern PROJECT& Prj();
|
extern PROJECT& Prj();
|
||||||
|
|
|
@ -35,112 +35,6 @@
|
||||||
#include "kicad_id.h"
|
#include "kicad_id.h"
|
||||||
|
|
||||||
|
|
||||||
// Menubar and toolbar event table
|
|
||||||
BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
|
|
||||||
// Window events
|
|
||||||
EVT_SIZE( KICAD_MANAGER_FRAME::OnSize )
|
|
||||||
EVT_CLOSE( KICAD_MANAGER_FRAME::OnCloseWindow )
|
|
||||||
|
|
||||||
// Menu events
|
|
||||||
EVT_MENU( wxID_EXIT, KICAD_MANAGER_FRAME::OnExit )
|
|
||||||
EVT_MENU( ID_TO_TEXT_EDITOR, KICAD_MANAGER_FRAME::OnOpenTextEditor )
|
|
||||||
EVT_MENU( ID_BROWSE_AN_SELECT_FILE, KICAD_MANAGER_FRAME::OnOpenFileInTextEditor )
|
|
||||||
EVT_MENU( ID_BROWSE_IN_FILE_EXPLORER, KICAD_MANAGER_FRAME::OnBrowseInFileExplorer )
|
|
||||||
EVT_MENU( ID_SAVE_AND_ZIP_FILES, KICAD_MANAGER_FRAME::OnArchiveFiles )
|
|
||||||
EVT_MENU( ID_READ_ZIP_ARCHIVE, KICAD_MANAGER_FRAME::OnUnarchiveFiles )
|
|
||||||
EVT_MENU( ID_IMPORT_EAGLE_PROJECT, KICAD_MANAGER_FRAME::OnImportEagleFiles )
|
|
||||||
|
|
||||||
// Range menu events
|
|
||||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
|
|
||||||
KICAD_MANAGER_FRAME::language_change )
|
|
||||||
|
|
||||||
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, KICAD_MANAGER_FRAME::OnFileHistory )
|
|
||||||
|
|
||||||
// Special functions
|
|
||||||
EVT_MENU( ID_INIT_WATCHED_PATHS, KICAD_MANAGER_FRAME::OnChangeWatchedPaths )
|
|
||||||
|
|
||||||
// Button events (in command frame), and menu events equivalent to buttons
|
|
||||||
EVT_BUTTON( ID_TO_SCH, KICAD_MANAGER_FRAME::OnRunEeschema )
|
|
||||||
EVT_MENU( ID_TO_SCH, KICAD_MANAGER_FRAME::OnRunEeschema )
|
|
||||||
|
|
||||||
EVT_BUTTON( ID_TO_SCH_LIB_EDITOR, KICAD_MANAGER_FRAME::OnRunSchLibEditor )
|
|
||||||
EVT_MENU( ID_TO_SCH_LIB_EDITOR, KICAD_MANAGER_FRAME::OnRunSchLibEditor )
|
|
||||||
|
|
||||||
EVT_BUTTON( ID_TO_PCB, KICAD_MANAGER_FRAME::OnRunPcbNew )
|
|
||||||
EVT_MENU( ID_TO_PCB, KICAD_MANAGER_FRAME::OnRunPcbNew )
|
|
||||||
|
|
||||||
EVT_BUTTON( ID_TO_PCB_FP_EDITOR, KICAD_MANAGER_FRAME::OnRunPcbFpEditor )
|
|
||||||
EVT_MENU( ID_TO_PCB_FP_EDITOR, KICAD_MANAGER_FRAME::OnRunPcbFpEditor )
|
|
||||||
|
|
||||||
EVT_BUTTON( ID_TO_GERBVIEW, KICAD_MANAGER_FRAME::OnRunGerbview )
|
|
||||||
EVT_MENU( ID_TO_GERBVIEW, KICAD_MANAGER_FRAME::OnRunGerbview )
|
|
||||||
|
|
||||||
EVT_BUTTON( ID_TO_BITMAP_CONVERTER, KICAD_MANAGER_FRAME::OnRunBitmapConverter )
|
|
||||||
EVT_MENU( ID_TO_BITMAP_CONVERTER, KICAD_MANAGER_FRAME::OnRunBitmapConverter )
|
|
||||||
|
|
||||||
EVT_BUTTON( ID_TO_PCB_CALCULATOR, KICAD_MANAGER_FRAME::OnRunPcbCalculator )
|
|
||||||
EVT_MENU( ID_TO_PCB_CALCULATOR, KICAD_MANAGER_FRAME::OnRunPcbCalculator )
|
|
||||||
|
|
||||||
EVT_BUTTON( ID_TO_PL_EDITOR, KICAD_MANAGER_FRAME::OnRunPageLayoutEditor )
|
|
||||||
EVT_MENU( ID_TO_PL_EDITOR, KICAD_MANAGER_FRAME::OnRunPageLayoutEditor )
|
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
enum hotkey_id_command
|
|
||||||
{
|
|
||||||
HK_RUN_EESCHEMA = 0,
|
|
||||||
HK_RUN_LIBEDIT,
|
|
||||||
HK_RUN_PCBNEW,
|
|
||||||
HK_RUN_FPEDITOR,
|
|
||||||
HK_RUN_GERBVIEW,
|
|
||||||
HK_RUN_BM2COMPONENT,
|
|
||||||
HK_RUN_PCBCALCULATOR,
|
|
||||||
HK_RUN_PLEDITOR
|
|
||||||
};
|
|
||||||
|
|
||||||
///////////// Hotkeys management ///////////////////////////////////////
|
|
||||||
|
|
||||||
// Remark: the hotkey message info is used as keyword in hotkey config files and
|
|
||||||
// as comments in help windows, therefore translated only when displayed
|
|
||||||
// they are marked _HKI to be extracted by translation tools
|
|
||||||
// See hotkeys_basic.h for more info
|
|
||||||
|
|
||||||
// hotkeys command:
|
|
||||||
static EDA_HOTKEY HkRunEeschema( _HKI( "Run Eeschema" ), HK_RUN_EESCHEMA, 'E' + GR_KB_CTRL, 0 );
|
|
||||||
static EDA_HOTKEY HkRunLibedit( _HKI( "Run LibEdit" ), HK_RUN_LIBEDIT, 'L' + GR_KB_CTRL, 0 );
|
|
||||||
static EDA_HOTKEY HkRunPcbnew( _HKI( "Run Pcbnew" ), HK_RUN_PCBNEW, 'P' + GR_KB_CTRL, 0 );
|
|
||||||
static EDA_HOTKEY HkRunModedit( _HKI( "Run FpEditor" ), HK_RUN_FPEDITOR, 'F' + GR_KB_CTRL, 0 );
|
|
||||||
static EDA_HOTKEY HkRunGerbview( _HKI( "Run Gerbview" ), HK_RUN_GERBVIEW, 'G' + GR_KB_CTRL, 0 );
|
|
||||||
static EDA_HOTKEY HkRunBm2Cmp( _HKI( "Run Bitmap2Component" ),
|
|
||||||
HK_RUN_BM2COMPONENT, 'B' + GR_KB_CTRL, 0 );
|
|
||||||
static EDA_HOTKEY HkRunPcbCalc( _HKI( "Run PcbCalculator" ),
|
|
||||||
HK_RUN_PCBCALCULATOR, 'A' + GR_KB_CTRL, 0 );
|
|
||||||
static EDA_HOTKEY HkRunPleditor( _HKI( "Run PlEditor" ), HK_RUN_PLEDITOR, 'Y' + GR_KB_CTRL, 0 );
|
|
||||||
|
|
||||||
// List of hotkey descriptors
|
|
||||||
EDA_HOTKEY* common_Hotkey_List[] =
|
|
||||||
{
|
|
||||||
&HkRunEeschema, &HkRunLibedit,
|
|
||||||
&HkRunPcbnew, &HkRunModedit, &HkRunGerbview,
|
|
||||||
&HkRunBm2Cmp, &HkRunPcbCalc, &HkRunPleditor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
// list of sections and corresponding hotkey list for Kicad
|
|
||||||
// (used to create an hotkey config file, and edit hotkeys )
|
|
||||||
// here we have only one section.
|
|
||||||
static wxString sectionTitle( _HKI( "Kicad Manager Hotkeys" ) );
|
|
||||||
|
|
||||||
struct EDA_HOTKEY_CONFIG kicad_Manager_Hotkeys_Descr[] = {
|
|
||||||
{ &g_CommonSectionTag, common_Hotkey_List, §ionTitle },
|
|
||||||
{ nullptr, nullptr, nullptr }
|
|
||||||
};
|
|
||||||
///////////// End hotkeys management ///////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief (Re)Create the menubar
|
|
||||||
*/
|
|
||||||
void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
||||||
{
|
{
|
||||||
KICAD_MANAGER_CONTROL* controlTool = m_toolManager->GetTool<KICAD_MANAGER_CONTROL>();
|
KICAD_MANAGER_CONTROL* controlTool = m_toolManager->GetTool<KICAD_MANAGER_CONTROL>();
|
||||||
|
@ -198,20 +92,14 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
||||||
//-- View menu -----------------------------------------------------------
|
//-- View menu -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, controlTool );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, controlTool );
|
||||||
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
|
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AddSeparator();
|
||||||
viewMenu->AddItem( ID_TO_TEXT_EDITOR,
|
viewMenu->AddItem( KICAD_MANAGER_ACTIONS::openTextEditor, SELECTION_CONDITIONS::ShowAlways );
|
||||||
_( "Open Text Editor" ), _( "Launch preferred text editor" ),
|
|
||||||
editor_xpm, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
viewMenu->AddItem( ID_BROWSE_AN_SELECT_FILE,
|
|
||||||
_( "Open Local File..." ), _( "Edit local file" ),
|
|
||||||
browse_files_xpm, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
viewMenu->AddItem( ID_BROWSE_IN_FILE_EXPLORER,
|
viewMenu->AddItem( ID_BROWSE_IN_FILE_EXPLORER,
|
||||||
_( "Browse Project Files" ), _( "Open project directory in file browser" ),
|
_( "Browse Project Files" ), _( "Open project directory in file browser" ),
|
||||||
directory_browser_xpm, SELECTION_CONDITIONS::ShowAlways );
|
directory_browser_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AddSeparator();
|
||||||
|
@ -221,42 +109,25 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
||||||
|
|
||||||
//-- Tools menu -----------------------------------------------
|
//-- Tools menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
wxMenu* toolsMenu = new wxMenu;
|
CONDITIONAL_MENU* toolsMenu = new CONDITIONAL_MENU( false, controlTool );
|
||||||
wxString msg;
|
|
||||||
msg = AddHotkeyName( _( "Edit Schematic" ), kicad_Manager_Hotkeys_Descr, HK_RUN_EESCHEMA );
|
|
||||||
AddMenuItem( toolsMenu, ID_TO_SCH, msg, KiBitmap( eeschema_xpm ) );
|
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Edit Schematic Symbols" ),
|
toolsMenu->AddItem( KICAD_MANAGER_ACTIONS::editSchematic, SELECTION_CONDITIONS::ShowAlways );
|
||||||
kicad_Manager_Hotkeys_Descr, HK_RUN_LIBEDIT );
|
toolsMenu->AddItem( KICAD_MANAGER_ACTIONS::editSymbols, SELECTION_CONDITIONS::ShowAlways );
|
||||||
AddMenuItem( toolsMenu, ID_TO_SCH_LIB_EDITOR, msg, KiBitmap( libedit_xpm ) );
|
toolsMenu->AddItem( KICAD_MANAGER_ACTIONS::editPCB, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
toolsMenu->AddItem( KICAD_MANAGER_ACTIONS::editFootprints, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Edit PCB" ),
|
toolsMenu->AddSeparator();
|
||||||
kicad_Manager_Hotkeys_Descr, HK_RUN_PCBNEW );
|
toolsMenu->AddItem( KICAD_MANAGER_ACTIONS::viewGerbers, SELECTION_CONDITIONS::ShowAlways );
|
||||||
AddMenuItem( toolsMenu, ID_TO_PCB, msg, KiBitmap( pcbnew_xpm ) );
|
toolsMenu->AddItem( KICAD_MANAGER_ACTIONS::convertImage, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
toolsMenu->AddItem( KICAD_MANAGER_ACTIONS::showCalculator, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
toolsMenu->AddItem( KICAD_MANAGER_ACTIONS::editWorksheet, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Edit PCB Footprints" ),
|
toolsMenu->AddSeparator();
|
||||||
kicad_Manager_Hotkeys_Descr, HK_RUN_FPEDITOR );
|
toolsMenu->AddItem( ID_EDIT_LOCAL_FILE_IN_TEXT_EDITOR,
|
||||||
AddMenuItem( toolsMenu, ID_TO_PCB_FP_EDITOR, msg, KiBitmap( module_editor_xpm ) );
|
_( "Edit Local File..." ), _( "Edit local file in text editor" ),
|
||||||
|
browse_files_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
msg = AddHotkeyName( _( "View Gerber Files" ),
|
|
||||||
kicad_Manager_Hotkeys_Descr, HK_RUN_GERBVIEW );
|
toolsMenu->Resolve();
|
||||||
AddMenuItem( toolsMenu, ID_TO_GERBVIEW, msg, KiBitmap( icon_gerbview_small_xpm ) );
|
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Convert Image" ),
|
|
||||||
kicad_Manager_Hotkeys_Descr, HK_RUN_BM2COMPONENT );
|
|
||||||
AddMenuItem( toolsMenu, ID_TO_BITMAP_CONVERTER, msg,
|
|
||||||
_( "Convert bitmap images to schematic or PCB components." ),
|
|
||||||
KiBitmap( bitmap2component_xpm ) );
|
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Calculator Tools" ), kicad_Manager_Hotkeys_Descr, HK_RUN_PCBCALCULATOR );
|
|
||||||
AddMenuItem( toolsMenu, ID_TO_PCB_CALCULATOR, msg,
|
|
||||||
_( "Run component calculations, track width calculations, etc." ),
|
|
||||||
KiBitmap( calculator_xpm ) );
|
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Edit Worksheet" ), kicad_Manager_Hotkeys_Descr, HK_RUN_PLEDITOR );
|
|
||||||
AddMenuItem( toolsMenu, ID_TO_PL_EDITOR, msg,
|
|
||||||
_( "Edit worksheet graphics and text" ),
|
|
||||||
KiBitmap( pagelayout_load_xpm ) );
|
|
||||||
|
|
||||||
//-- Preferences menu -----------------------------------------------
|
//-- Preferences menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
|
@ -272,6 +143,8 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
||||||
|
|
||||||
prefsMenu->AddSeparator();
|
prefsMenu->AddSeparator();
|
||||||
Pgm().AddMenuLanguageList( prefsMenu );
|
Pgm().AddMenuLanguageList( prefsMenu );
|
||||||
|
|
||||||
|
prefsMenu->Resolve();
|
||||||
|
|
||||||
//-- Menubar -------------------------------------------------------------
|
//-- Menubar -------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
@ -324,13 +197,39 @@ void KICAD_MANAGER_FRAME::RecreateBaseHToolbar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::SyncMenusAndToolbars()
|
void KICAD_MANAGER_FRAME::RecreateLauncher()
|
||||||
{
|
{
|
||||||
m_mainToolBar->ToggleTool( ID_TO_SCH, m_active_project );
|
if( m_launcher )
|
||||||
m_mainToolBar->ToggleTool( ID_TO_SCH_LIB_EDITOR, m_active_project );
|
m_launcher->Clear();
|
||||||
m_mainToolBar->ToggleTool( ID_TO_PCB, m_active_project );
|
else
|
||||||
m_mainToolBar->ToggleTool( ID_TO_PCB_FP_EDITOR, m_active_project );
|
m_launcher = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
||||||
m_mainToolBar->Refresh();
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
||||||
|
|
||||||
|
m_launcher->Add( KICAD_MANAGER_ACTIONS::editSchematic );
|
||||||
|
m_launcher->Add( KICAD_MANAGER_ACTIONS::editSymbols );
|
||||||
|
|
||||||
|
KiScaledSeparator( m_launcher, this );
|
||||||
|
m_launcher->Add( KICAD_MANAGER_ACTIONS::editPCB );
|
||||||
|
m_launcher->Add( KICAD_MANAGER_ACTIONS::editFootprints );
|
||||||
|
|
||||||
|
KiScaledSeparator( m_launcher, this );
|
||||||
|
m_launcher->Add( KICAD_MANAGER_ACTIONS::viewGerbers );
|
||||||
|
m_launcher->Add( KICAD_MANAGER_ACTIONS::convertImage );
|
||||||
|
m_launcher->Add( KICAD_MANAGER_ACTIONS::showCalculator );
|
||||||
|
m_launcher->Add( KICAD_MANAGER_ACTIONS::editWorksheet );
|
||||||
|
|
||||||
|
// Create mlauncher
|
||||||
|
m_launcher->Realize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KICAD_MANAGER_FRAME::SyncMenusAndToolbars()
|
||||||
|
{
|
||||||
|
m_launcher->Toggle( KICAD_MANAGER_ACTIONS::editSchematic, m_active_project );
|
||||||
|
m_launcher->Toggle( KICAD_MANAGER_ACTIONS::editSymbols, m_active_project );
|
||||||
|
m_launcher->Toggle( KICAD_MANAGER_ACTIONS::editPCB, m_active_project );
|
||||||
|
m_launcher->Toggle( KICAD_MANAGER_ACTIONS::editFootprints, m_active_project );
|
||||||
|
m_launcher->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ void KICAD_MANAGER_FRAME::LoadProject( const wxFileName& aProjectFileName )
|
||||||
|
|
||||||
UpdateFileHistory( aProjectFileName.GetFullPath(), &PgmTop().GetFileHistory() );
|
UpdateFileHistory( aProjectFileName.GetFullPath(), &PgmTop().GetFileHistory() );
|
||||||
|
|
||||||
m_LeftWin->ReCreateTreePrj();
|
m_leftWin->ReCreateTreePrj();
|
||||||
|
|
||||||
// Rebuild the list of watched paths.
|
// Rebuild the list of watched paths.
|
||||||
// however this is possible only when the main loop event handler is running,
|
// however this is possible only when the main loop event handler is running,
|
||||||
|
|
|
@ -40,10 +40,19 @@ public:
|
||||||
static TOOL_ACTION newProject;
|
static TOOL_ACTION newProject;
|
||||||
static TOOL_ACTION newFromTemplate;
|
static TOOL_ACTION newFromTemplate;
|
||||||
static TOOL_ACTION openProject;
|
static TOOL_ACTION openProject;
|
||||||
static TOOL_ACTION importEagle;
|
|
||||||
|
|
||||||
static TOOL_ACTION archiveProject;
|
static TOOL_ACTION editSchematic;
|
||||||
static TOOL_ACTION unarchiveProject;
|
static TOOL_ACTION editSymbols;
|
||||||
|
static TOOL_ACTION editPCB;
|
||||||
|
static TOOL_ACTION editFootprints;
|
||||||
|
static TOOL_ACTION viewGerbers;
|
||||||
|
static TOOL_ACTION convertImage;
|
||||||
|
static TOOL_ACTION showCalculator;
|
||||||
|
static TOOL_ACTION editWorksheet;
|
||||||
|
static TOOL_ACTION openTextEditor;
|
||||||
|
|
||||||
|
static TOOL_ACTION editOtherSch;
|
||||||
|
static TOOL_ACTION editOtherPCB;
|
||||||
|
|
||||||
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
||||||
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override
|
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override
|
||||||
|
|
|
@ -17,17 +17,20 @@
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <kicad_manager_frame.h>
|
#include <gestfich.h>
|
||||||
#include <bitmaps.h>
|
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
#include <executable_names.h>
|
||||||
|
#include <pgm_base.h>
|
||||||
|
#include <kiway.h>
|
||||||
|
#include <kicad_manager_frame.h>
|
||||||
|
#include <confirm.h>
|
||||||
|
#include <bitmaps.h>
|
||||||
#include <tool/selection.h>
|
#include <tool/selection.h>
|
||||||
#include <tool/tool_event.h>
|
#include <tool/tool_event.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tools/kicad_manager_actions.h>
|
#include <tools/kicad_manager_actions.h>
|
||||||
#include <tools/kicad_manager_control.h>
|
#include <tools/kicad_manager_control.h>
|
||||||
#include <confirm.h>
|
|
||||||
#include <dialogs/dialog_template_selector.h>
|
#include <dialogs/dialog_template_selector.h>
|
||||||
#include <pgm_base.h>
|
|
||||||
|
|
||||||
TOOL_ACTION KICAD_MANAGER_ACTIONS::newProject( "kicad.Control.newProject",
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::newProject( "kicad.Control.newProject",
|
||||||
AS_GLOBAL,
|
AS_GLOBAL,
|
||||||
|
@ -47,6 +50,66 @@ TOOL_ACTION KICAD_MANAGER_ACTIONS::openProject( "kicad.Control.openProject",
|
||||||
_( "Open Project..." ), _( "Open an existing project" ),
|
_( "Open Project..." ), _( "Open an existing project" ),
|
||||||
open_project_xpm );
|
open_project_xpm );
|
||||||
|
|
||||||
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::editSchematic( "kicad.Control.editSchematic",
|
||||||
|
AS_GLOBAL,
|
||||||
|
MD_CTRL + 'E', LEGACY_HK_NAME( "Run Eeschema" ),
|
||||||
|
_( "Edit Schematic" ), "",
|
||||||
|
icon_eeschema_xpm );
|
||||||
|
|
||||||
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::editSymbols( "kicad.Control.editSymbols",
|
||||||
|
AS_GLOBAL,
|
||||||
|
MD_CTRL + 'L', LEGACY_HK_NAME( "Run LibEdit" ),
|
||||||
|
_( "Edit Schematic Symbols" ), "",
|
||||||
|
icon_libedit_xpm );
|
||||||
|
|
||||||
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::editPCB( "kicad.Control.editPCB",
|
||||||
|
AS_GLOBAL,
|
||||||
|
MD_CTRL + 'P', LEGACY_HK_NAME( "Run Pcbnew" ),
|
||||||
|
_( "Edit PCB" ), "",
|
||||||
|
icon_pcbnew_xpm );
|
||||||
|
|
||||||
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::editFootprints( "kicad.Control.editFootprints",
|
||||||
|
AS_GLOBAL,
|
||||||
|
MD_CTRL + 'F', LEGACY_HK_NAME( "Run FpEditor" ),
|
||||||
|
_( "Edit PCB Footprints" ), "",
|
||||||
|
icon_modedit_xpm );
|
||||||
|
|
||||||
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::viewGerbers( "kicad.Control.viewGerbers",
|
||||||
|
AS_GLOBAL,
|
||||||
|
MD_CTRL + 'G', LEGACY_HK_NAME( "Run Gerbview" ),
|
||||||
|
_( "View Gerber Files" ), "",
|
||||||
|
icon_gerbview_xpm );
|
||||||
|
|
||||||
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::convertImage( "kicad.Control.convertImage",
|
||||||
|
AS_GLOBAL,
|
||||||
|
MD_CTRL + 'B', LEGACY_HK_NAME( "Run Bitmap2Component" ),
|
||||||
|
_( "Convert Image" ), _( "Convert bitmap images to schematic or PCB components" ),
|
||||||
|
icon_bitmap2component_xpm );
|
||||||
|
|
||||||
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::showCalculator( "kicad.Control.showCalculator",
|
||||||
|
AS_GLOBAL,
|
||||||
|
MD_CTRL + 'A', LEGACY_HK_NAME( "Run PcbCalculator" ),
|
||||||
|
_( "Calculator Tools" ), _( "Run component calculations, track width calculations, etc." ),
|
||||||
|
icon_pcbcalculator_xpm );
|
||||||
|
|
||||||
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::editWorksheet( "kicad.Control.editWorksheet",
|
||||||
|
AS_GLOBAL,
|
||||||
|
MD_CTRL + 'Y', LEGACY_HK_NAME( "Run PlEditor" ),
|
||||||
|
_( "Edit Worksheet" ), _( "Edit worksheet graphics and text" ),
|
||||||
|
icon_pagelayout_editor_xpm );
|
||||||
|
|
||||||
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::openTextEditor( "kicad.Control.openTextEditor",
|
||||||
|
AS_GLOBAL,
|
||||||
|
0, "",
|
||||||
|
_( "Open Text Editor" ), _( "Launch preferred text editor" ),
|
||||||
|
editor_xpm );
|
||||||
|
|
||||||
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::editOtherSch( "kicad.Control.editOtherSch",
|
||||||
|
AS_GLOBAL );
|
||||||
|
|
||||||
|
TOOL_ACTION KICAD_MANAGER_ACTIONS::editOtherPCB( "kicad.Control.editOtherPCB",
|
||||||
|
AS_GLOBAL );
|
||||||
|
|
||||||
|
|
||||||
///> Helper widget to select whether a new directory should be created for a project
|
///> Helper widget to select whether a new directory should be created for a project
|
||||||
class DIR_CHECKBOX : public wxPanel
|
class DIR_CHECKBOX : public wxPanel
|
||||||
|
@ -183,11 +246,10 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
||||||
if( ps->ShowModal() != wxID_OK )
|
if( ps->ShowModal() != wxID_OK )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( ps->GetSelectedTemplate() == NULL )
|
if( !ps->GetSelectedTemplate() )
|
||||||
{
|
{
|
||||||
wxMessageBox( _( "No project template was selected. Cannot generate new project." ),
|
wxMessageBox( _( "No project template was selected. Cannot generate new project." ),
|
||||||
_( "Error" ),
|
_( "Error" ), wxOK | wxICON_ERROR, m_frame );
|
||||||
wxOK | wxICON_ERROR, m_frame );
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -336,11 +398,188 @@ int KICAD_MANAGER_CONTROL::Refresh( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int KICAD_MANAGER_CONTROL::ShowPlayer( const TOOL_EVENT& aEvent )
|
||||||
|
{
|
||||||
|
FRAME_T playerType = FRAME_SCH_VIEWER;
|
||||||
|
|
||||||
|
if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::editSchematic ) )
|
||||||
|
playerType = FRAME_SCH;
|
||||||
|
else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::editSymbols ) )
|
||||||
|
playerType = FRAME_SCH_LIB_EDITOR;
|
||||||
|
else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::editPCB ) )
|
||||||
|
playerType = FRAME_PCB;
|
||||||
|
else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::editFootprints ) )
|
||||||
|
playerType = FRAME_PCB_MODULE_EDITOR;
|
||||||
|
else
|
||||||
|
wxFAIL_MSG( "ShowPlayer(): unexpected request" );
|
||||||
|
|
||||||
|
KIWAY_PLAYER* player;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
player = m_frame->Kiway().Player( playerType, true );
|
||||||
|
}
|
||||||
|
catch( const IO_ERROR& err )
|
||||||
|
{
|
||||||
|
wxMessageBox( _( "Application failed to load:\n" ) + err.What(), _( "KiCad Error" ),
|
||||||
|
wxOK | wxICON_ERROR, m_frame );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !player->IsVisible() ) // A hidden frame might not have the document loaded.
|
||||||
|
{
|
||||||
|
wxString filepath;
|
||||||
|
|
||||||
|
if( playerType == FRAME_SCH )
|
||||||
|
{
|
||||||
|
filepath = m_frame->SchFileName();
|
||||||
|
}
|
||||||
|
else if( playerType == FRAME_PCB )
|
||||||
|
{
|
||||||
|
wxFileName kicad_board( m_frame->PcbFileName() );
|
||||||
|
wxFileName legacy_board( m_frame->PcbLegacyFileName() );
|
||||||
|
|
||||||
|
if( !legacy_board.FileExists() || kicad_board.FileExists() )
|
||||||
|
filepath = kicad_board.GetFullPath();
|
||||||
|
else
|
||||||
|
filepath = legacy_board.GetFullPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !filepath.IsEmpty() )
|
||||||
|
{
|
||||||
|
if( !player->OpenProjectFiles( std::vector<wxString>( 1, filepath ) ) )
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
player->Show( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Needed on Windows, other platforms do not use it, but it creates no issue
|
||||||
|
if( player->IsIconized() )
|
||||||
|
player->Iconize( false );
|
||||||
|
|
||||||
|
player->Raise();
|
||||||
|
|
||||||
|
// Raising the window does not set the focus on Linux. This should work on
|
||||||
|
// any platform.
|
||||||
|
if( wxWindow::FindFocus() != player )
|
||||||
|
player->SetFocus();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TERMINATE_HANDLER : public wxProcess
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
wxString m_appName;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TERMINATE_HANDLER( const wxString& appName ) :
|
||||||
|
m_appName( appName )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnTerminate( int pid, int status ) override
|
||||||
|
{
|
||||||
|
wxString msg = wxString::Format( _( "%s closed [pid=%d]\n" ),
|
||||||
|
m_appName,
|
||||||
|
pid );
|
||||||
|
|
||||||
|
wxWindow* window = wxWindow::FindWindowByName( KICAD_MANAGER_FRAME_NAME );
|
||||||
|
|
||||||
|
if( window ) // Should always happen.
|
||||||
|
{
|
||||||
|
// Be sure the kicad frame manager is found
|
||||||
|
// This dynamic cast is not really mandatory, but ...
|
||||||
|
KICAD_MANAGER_FRAME* frame = dynamic_cast<KICAD_MANAGER_FRAME*>( window );
|
||||||
|
|
||||||
|
if( frame )
|
||||||
|
frame->PrintMsg( msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int KICAD_MANAGER_CONTROL::Execute( const TOOL_EVENT& aEvent )
|
||||||
|
{
|
||||||
|
wxString execFile;
|
||||||
|
wxString params;
|
||||||
|
|
||||||
|
if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::viewGerbers ) )
|
||||||
|
execFile = GERBVIEW_EXE;
|
||||||
|
else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::convertImage ) )
|
||||||
|
execFile = BITMAPCONVERTER_EXE;
|
||||||
|
else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::showCalculator ) )
|
||||||
|
execFile = PCB_CALCULATOR_EXE;
|
||||||
|
else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::editWorksheet ) )
|
||||||
|
execFile = PL_EDITOR_EXE;
|
||||||
|
else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::openTextEditor ) )
|
||||||
|
execFile = Pgm().GetEditorName();
|
||||||
|
else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::editOtherSch ) )
|
||||||
|
execFile = EESCHEMA_EXE;
|
||||||
|
else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::editOtherPCB ) )
|
||||||
|
execFile = PCBNEW_EXE;
|
||||||
|
else
|
||||||
|
wxFAIL_MSG( "Execute(): unexpected request" );
|
||||||
|
|
||||||
|
if( execFile.IsEmpty() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if( aEvent.Parameter<wxString*>() )
|
||||||
|
params = *aEvent.Parameter<wxString*>();
|
||||||
|
else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::viewGerbers ) )
|
||||||
|
params = m_frame->Prj().GetProjectPath();
|
||||||
|
|
||||||
|
if( !params.empty() )
|
||||||
|
AddDelimiterString( params );
|
||||||
|
|
||||||
|
TERMINATE_HANDLER* callback = new TERMINATE_HANDLER( execFile );
|
||||||
|
|
||||||
|
long pid = ExecuteFile( m_frame, execFile, params, callback );
|
||||||
|
|
||||||
|
if( pid > 0 )
|
||||||
|
{
|
||||||
|
wxString msg = wxString::Format( _( "%s %s opened [pid=%ld]\n" ),
|
||||||
|
execFile,
|
||||||
|
params,
|
||||||
|
pid );
|
||||||
|
m_frame->PrintMsg( msg );
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
msg.Printf( "osascript -e 'activate application \"%s\"' ", execFile );
|
||||||
|
system( msg.c_str() );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_CONTROL::setTransitions()
|
void KICAD_MANAGER_CONTROL::setTransitions()
|
||||||
{
|
{
|
||||||
Go( &KICAD_MANAGER_CONTROL::NewProject, KICAD_MANAGER_ACTIONS::newProject.MakeEvent() );
|
Go( &KICAD_MANAGER_CONTROL::NewProject, KICAD_MANAGER_ACTIONS::newProject.MakeEvent() );
|
||||||
Go( &KICAD_MANAGER_CONTROL::NewFromTemplate, KICAD_MANAGER_ACTIONS::newFromTemplate.MakeEvent() );
|
Go( &KICAD_MANAGER_CONTROL::NewFromTemplate, KICAD_MANAGER_ACTIONS::newFromTemplate.MakeEvent() );
|
||||||
Go( &KICAD_MANAGER_CONTROL::OpenProject, KICAD_MANAGER_ACTIONS::openProject.MakeEvent() );
|
Go( &KICAD_MANAGER_CONTROL::OpenProject, KICAD_MANAGER_ACTIONS::openProject.MakeEvent() );
|
||||||
|
|
||||||
Go( &KICAD_MANAGER_CONTROL::Refresh, ACTIONS::zoomRedraw.MakeEvent() );
|
Go( &KICAD_MANAGER_CONTROL::Refresh, ACTIONS::zoomRedraw.MakeEvent() );
|
||||||
|
|
||||||
|
Go( &KICAD_MANAGER_CONTROL::ShowPlayer, KICAD_MANAGER_ACTIONS::editSchematic.MakeEvent() );
|
||||||
|
Go( &KICAD_MANAGER_CONTROL::ShowPlayer, KICAD_MANAGER_ACTIONS::editSymbols.MakeEvent() );
|
||||||
|
Go( &KICAD_MANAGER_CONTROL::ShowPlayer, KICAD_MANAGER_ACTIONS::editPCB.MakeEvent() );
|
||||||
|
Go( &KICAD_MANAGER_CONTROL::ShowPlayer, KICAD_MANAGER_ACTIONS::editFootprints.MakeEvent() );
|
||||||
|
Go( &KICAD_MANAGER_CONTROL::Execute, KICAD_MANAGER_ACTIONS::viewGerbers.MakeEvent() );
|
||||||
|
Go( &KICAD_MANAGER_CONTROL::Execute, KICAD_MANAGER_ACTIONS::convertImage.MakeEvent() );
|
||||||
|
Go( &KICAD_MANAGER_CONTROL::Execute, KICAD_MANAGER_ACTIONS::showCalculator.MakeEvent() );
|
||||||
|
Go( &KICAD_MANAGER_CONTROL::Execute, KICAD_MANAGER_ACTIONS::editWorksheet.MakeEvent() );
|
||||||
|
Go( &KICAD_MANAGER_CONTROL::Execute, KICAD_MANAGER_ACTIONS::openTextEditor.MakeEvent() );
|
||||||
|
|
||||||
|
Go( &KICAD_MANAGER_CONTROL::Execute, KICAD_MANAGER_ACTIONS::editOtherSch.MakeEvent() );
|
||||||
|
Go( &KICAD_MANAGER_CONTROL::Execute, KICAD_MANAGER_ACTIONS::editOtherPCB.MakeEvent() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,9 @@ public:
|
||||||
|
|
||||||
int Refresh( const TOOL_EVENT& aEvent );
|
int Refresh( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
|
int ShowPlayer( const TOOL_EVENT& aEvent );
|
||||||
|
int Execute( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
///> Sets up handlers for various events.
|
///> Sets up handlers for various events.
|
||||||
void setTransitions() override;
|
void setTransitions() override;
|
||||||
|
|
||||||
|
|
|
@ -1129,5 +1129,5 @@ void TREE_PROJECT_FRAME::FileWatcherReset()
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnChangeWatchedPaths( wxCommandEvent& aEvent )
|
void KICAD_MANAGER_FRAME::OnChangeWatchedPaths( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
m_LeftWin->FileWatcherReset();
|
m_leftWin->FileWatcherReset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
#include <executable_names.h>
|
#include <executable_names.h>
|
||||||
#include <kiway.h>
|
#include <kiway.h>
|
||||||
|
#include <tool/tool_manager.h>
|
||||||
|
#include <tools/kicad_manager_actions.h>
|
||||||
#include "treeprojectfiles.h"
|
#include "treeprojectfiles.h"
|
||||||
#include "pgm_kicad.h"
|
#include "pgm_kicad.h"
|
||||||
#include "tree_project_frame.h"
|
#include "tree_project_frame.h"
|
||||||
|
@ -104,10 +106,9 @@ bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check )
|
||||||
|
|
||||||
if( check && !ext.IsEmpty() && !reg.Matches( newFile ) )
|
if( check && !ext.IsEmpty() && !reg.Matches( newFile ) )
|
||||||
{
|
{
|
||||||
wxMessageDialog dialog( m_parent, _(
|
wxMessageDialog dialog( m_parent, _( "Changing file extension will change file type.\n"
|
||||||
"Changing file extension will change file type.\n Do you want to continue ?" ),
|
"Do you want to continue ?" ),
|
||||||
_( "Rename File" ),
|
_( "Rename File" ), wxYES_NO | wxICON_QUESTION );
|
||||||
wxYES_NO | wxICON_QUESTION );
|
|
||||||
|
|
||||||
if( wxID_YES != dialog.ShowModal() )
|
if( wxID_YES != dialog.ShowModal() )
|
||||||
return false;
|
return false;
|
||||||
|
@ -115,8 +116,8 @@ bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check )
|
||||||
|
|
||||||
if( !wxRenameFile( GetFileName(), newFile, false ) )
|
if( !wxRenameFile( GetFileName(), newFile, false ) )
|
||||||
{
|
{
|
||||||
wxMessageDialog( m_parent, _( "Unable to rename file ... " ),
|
wxMessageDialog( m_parent, _( "Unable to rename file ... " ), _( "Permission error?" ),
|
||||||
_( "Permission error ?" ), wxICON_ERROR | wxOK );
|
wxICON_ERROR | wxOK );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,13 +129,8 @@ bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check )
|
||||||
|
|
||||||
bool TREEPROJECT_ITEM::Delete( bool check )
|
bool TREEPROJECT_ITEM::Delete( bool check )
|
||||||
{
|
{
|
||||||
wxString msg = wxString::Format( _(
|
wxString msg = wxString::Format( _( "Are you sure you want to delete '%s'?" ), GetFileName() );
|
||||||
"Do you really want to delete \"%s\"" ),
|
wxMessageDialog dialog( m_parent, msg, _( "Delete File" ), wxYES_NO | wxICON_QUESTION );
|
||||||
GetChars( GetFileName() )
|
|
||||||
);
|
|
||||||
|
|
||||||
wxMessageDialog dialog( m_parent, msg,
|
|
||||||
_( "Delete File" ), wxYES_NO | wxICON_QUESTION );
|
|
||||||
|
|
||||||
if( !check || wxID_YES == dialog.ShowModal() )
|
if( !check || wxID_YES == dialog.ShowModal() )
|
||||||
{
|
{
|
||||||
|
@ -166,11 +162,13 @@ bool TREEPROJECT_ITEM::Delete( bool check )
|
||||||
|
|
||||||
void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* aTreePrjFrame )
|
void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* aTreePrjFrame )
|
||||||
{
|
{
|
||||||
wxString sep = wxFileName().GetPathSeparator();
|
wxString sep = wxFileName::GetPathSeparator();
|
||||||
wxString fullFileName = GetFileName();
|
wxString fullFileName = GetFileName();
|
||||||
wxTreeItemId id = GetId();
|
wxTreeItemId id = GetId();
|
||||||
|
std::string packet;
|
||||||
|
|
||||||
KICAD_MANAGER_FRAME* frame = aTreePrjFrame->m_Parent;
|
KICAD_MANAGER_FRAME* frame = aTreePrjFrame->m_Parent;
|
||||||
|
TOOL_MANAGER* toolMgr = frame->GetToolManager();
|
||||||
KIWAY& kiway = frame->Kiway();
|
KIWAY& kiway = frame->Kiway();
|
||||||
|
|
||||||
switch( GetType() )
|
switch( GetType() )
|
||||||
|
@ -188,18 +186,12 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* aTreePrjFrame )
|
||||||
case TREE_SCHEMA:
|
case TREE_SCHEMA:
|
||||||
if( fullFileName == frame->SchFileName() )
|
if( fullFileName == frame->SchFileName() )
|
||||||
{
|
{
|
||||||
// the project's schematic is opened using the *.kiface as part of this process.
|
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editSchematic, true );
|
||||||
// We do not call frame->RunEeschema( fullFileName ),
|
|
||||||
// because after the double click, for some reason,
|
|
||||||
// the tree project frame is brought to the foreground after Eeschema is called from here.
|
|
||||||
// Instead, we post an event, equivalent to click on the eeschema tool in command frame
|
|
||||||
wxCommandEvent evt( wxEVT_COMMAND_TOOL_CLICKED, ID_TO_SCH );
|
|
||||||
wxPostEvent( frame, evt );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// schematics not part of the project are opened in a separate process.
|
// schematics not part of the project are opened in a separate process.
|
||||||
frame->Execute( m_parent, EESCHEMA_EXE, fullFileName );
|
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editOtherSch, true, &fullFileName );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -207,18 +199,12 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* aTreePrjFrame )
|
||||||
case TREE_SEXP_PCB:
|
case TREE_SEXP_PCB:
|
||||||
if( fullFileName == frame->PcbFileName() || fullFileName == frame->PcbLegacyFileName() )
|
if( fullFileName == frame->PcbFileName() || fullFileName == frame->PcbLegacyFileName() )
|
||||||
{
|
{
|
||||||
// the project's BOARD is opened using the *.kiface as part of this process.
|
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editPCB, true );
|
||||||
// We do not call frame->RunPcbNew( fullFileName ),
|
|
||||||
// because after the double click, for some reason,
|
|
||||||
// the tree project frame is brought to the foreground after PcbNew is called from here.
|
|
||||||
// Instead, we post an event, equivalent to simple click on the pcb editor tool in command frame
|
|
||||||
wxCommandEvent evt( wxEVT_COMMAND_TOOL_CLICKED, ID_TO_PCB );
|
|
||||||
wxPostEvent( frame, evt );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// boards not part of the project are opened in a separate process.
|
// boards not part of the project are opened in a separate process.
|
||||||
frame->Execute( m_parent, PCBNEW_EXE, fullFileName );
|
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editOtherPCB, true, &fullFileName );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -226,7 +212,7 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* aTreePrjFrame )
|
||||||
case TREE_DRILL:
|
case TREE_DRILL:
|
||||||
case TREE_DRILL_NC:
|
case TREE_DRILL_NC:
|
||||||
case TREE_DRILL_XNC:
|
case TREE_DRILL_XNC:
|
||||||
frame->Execute( m_parent, GERBVIEW_EXE, fullFileName );
|
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::viewGerbers, true, &fullFileName );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TREE_HTML:
|
case TREE_HTML:
|
||||||
|
@ -240,36 +226,23 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* aTreePrjFrame )
|
||||||
case TREE_NET:
|
case TREE_NET:
|
||||||
case TREE_TXT:
|
case TREE_TXT:
|
||||||
case TREE_REPORT:
|
case TREE_REPORT:
|
||||||
{
|
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::openTextEditor, true, &fullFileName );
|
||||||
wxString editorname = Pgm().GetEditorName();
|
|
||||||
|
|
||||||
if( !editorname.IsEmpty() )
|
|
||||||
frame->Execute( m_parent, editorname, fullFileName );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TREE_PAGE_LAYOUT_DESCR:
|
case TREE_PAGE_LAYOUT_DESCR:
|
||||||
frame->Execute( m_parent, PL_EDITOR_EXE, fullFileName );
|
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editWorksheet, true, &fullFileName );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TREE_FOOTPRINT_FILE:
|
case TREE_FOOTPRINT_FILE:
|
||||||
{
|
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editFootprints, true );
|
||||||
wxCommandEvent dummy;
|
packet = fullFileName.ToStdString();
|
||||||
frame->OnRunPcbFpEditor( dummy );
|
kiway.ExpressMail( FRAME_PCB_MODULE_EDITOR, MAIL_FP_EDIT, packet );
|
||||||
|
|
||||||
std::string packet = fullFileName.ToStdString();
|
|
||||||
kiway.ExpressMail( FRAME_PCB_MODULE_EDITOR, MAIL_FP_EDIT, packet );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TREE_SCHEMATIC_LIBFILE:
|
case TREE_SCHEMATIC_LIBFILE:
|
||||||
{
|
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editSymbols, true );
|
||||||
wxCommandEvent dummy;
|
packet = fullFileName.ToStdString();
|
||||||
frame->OnRunSchLibEditor( dummy );
|
kiway.ExpressMail( FRAME_SCH_LIB_EDITOR, MAIL_LIB_EDIT, packet );
|
||||||
|
|
||||||
std::string packet = fullFileName.ToStdString();
|
|
||||||
kiway.ExpressMail( FRAME_SCH_LIB_EDITOR, MAIL_LIB_EDIT, packet );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue