Add a "Open Demos Project" shortcut to the kicad launcher
Small UX improvement for the new user....
This commit is contained in:
parent
7ba08962ba
commit
8921eef0be
|
@ -240,6 +240,17 @@ wxString PATHS::GetStockPlugins3DPath()
|
|||
}
|
||||
|
||||
|
||||
wxString PATHS::GetStockDemosPath()
|
||||
{
|
||||
wxFileName fn;
|
||||
|
||||
fn.AssignDir( PATHS::GetStockDataPath( false ) );
|
||||
fn.AppendDir( wxT( "demos" ) );
|
||||
|
||||
return fn.GetPathWithSep();
|
||||
}
|
||||
|
||||
|
||||
wxString PATHS::GetUserCachePath()
|
||||
{
|
||||
wxFileName tmp;
|
||||
|
|
|
@ -92,12 +92,17 @@ public:
|
|||
static wxString GetStockPluginsPath();
|
||||
|
||||
/**
|
||||
* Gets the stock (install) 3d viewer pluginspath
|
||||
* Gets the stock (install) 3d viewer plugins path
|
||||
*/
|
||||
static wxString GetStockPlugins3DPath();
|
||||
|
||||
/**
|
||||
* Gets the stock (install) 3d viewer pluginspath
|
||||
* Gets the stock (install) demos path
|
||||
*/
|
||||
static wxString GetStockDemosPath();
|
||||
|
||||
/**
|
||||
* Gets the stock (install) 3d viewer plugins path
|
||||
*/
|
||||
static wxString GetUserCachePath();
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
|||
|
||||
fileMenu->Add( KICAD_MANAGER_ACTIONS::newProject );
|
||||
fileMenu->Add( KICAD_MANAGER_ACTIONS::newFromTemplate );
|
||||
fileMenu->Add( KICAD_MANAGER_ACTIONS::openDemoProject );
|
||||
fileMenu->Add( KICAD_MANAGER_ACTIONS::openProject );
|
||||
|
||||
wxMenuItem* item = fileMenu->Add( openRecentMenu );
|
||||
|
|
|
@ -46,6 +46,12 @@ TOOL_ACTION KICAD_MANAGER_ACTIONS::newFromTemplate( "kicad.Control.newFromTempla
|
|||
MD_CTRL + 'T', LEGACY_HK_NAME( "New Project From Template" ),
|
||||
_( "New Project from Template..." ), _( "Create new project from template" ) );
|
||||
|
||||
TOOL_ACTION KICAD_MANAGER_ACTIONS::openDemoProject( "kicad.Control.openDemoProject",
|
||||
AS_GLOBAL,
|
||||
0, LEGACY_HK_NAME( "Open Demo Project" ),
|
||||
_( "Open Demo Project..." ), _( "Open a demo project" ),
|
||||
BITMAPS::directory_open );
|
||||
|
||||
TOOL_ACTION KICAD_MANAGER_ACTIONS::openProject( "kicad.Control.openProject",
|
||||
AS_GLOBAL,
|
||||
MD_CTRL + 'O', LEGACY_HK_NAME( "Open Project" ),
|
||||
|
|
|
@ -33,6 +33,7 @@ class KICAD_MANAGER_ACTIONS : public ACTIONS
|
|||
public:
|
||||
static TOOL_ACTION newProject;
|
||||
static TOOL_ACTION newFromTemplate;
|
||||
static TOOL_ACTION openDemoProject;
|
||||
static TOOL_ACTION openProject;
|
||||
static TOOL_ACTION closeProject;
|
||||
|
||||
|
|
|
@ -30,11 +30,11 @@
|
|||
#include <tools/kicad_manager_control.h>
|
||||
#include <dialogs/dialog_template_selector.h>
|
||||
#include <gestfich.h>
|
||||
#include <paths.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/filedlg.h>
|
||||
|
||||
|
||||
///< Helper widget to select whether a new directory should be created for a project.
|
||||
class DIR_CHECKBOX : public wxPanel
|
||||
{
|
||||
|
@ -286,14 +286,13 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int KICAD_MANAGER_CONTROL::OpenProject( const TOOL_EVENT& aEvent )
|
||||
int KICAD_MANAGER_CONTROL::openProject( const wxString& aDefaultDir )
|
||||
{
|
||||
wxString wildcard = AllProjectFilesWildcard() + "|" + ProjectFileWildcard() + "|"
|
||||
+ LegacyProjectFileWildcard();
|
||||
|
||||
wxString default_dir = m_frame->GetMruPath();
|
||||
wxFileDialog dlg( m_frame, _( "Open Existing Project" ), default_dir, wxEmptyString,
|
||||
wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
wxFileDialog dlg( m_frame, _( "Open Existing Project" ), aDefaultDir, wxEmptyString, wildcard,
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return -1;
|
||||
|
@ -307,10 +306,23 @@ int KICAD_MANAGER_CONTROL::OpenProject( const TOOL_EVENT& aEvent )
|
|||
return -1;
|
||||
|
||||
m_frame->LoadProject( pro );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int KICAD_MANAGER_CONTROL::OpenDemoProject( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
return openProject( PATHS::GetStockDemosPath() );
|
||||
}
|
||||
|
||||
|
||||
int KICAD_MANAGER_CONTROL::OpenProject( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
return openProject( m_frame->GetMruPath() );
|
||||
}
|
||||
|
||||
|
||||
int KICAD_MANAGER_CONTROL::CloseProject( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->CloseProject( true );
|
||||
|
@ -782,6 +794,7 @@ void KICAD_MANAGER_CONTROL::setTransitions()
|
|||
{
|
||||
Go( &KICAD_MANAGER_CONTROL::NewProject, KICAD_MANAGER_ACTIONS::newProject.MakeEvent() );
|
||||
Go( &KICAD_MANAGER_CONTROL::NewFromTemplate, KICAD_MANAGER_ACTIONS::newFromTemplate.MakeEvent() );
|
||||
Go( &KICAD_MANAGER_CONTROL::OpenDemoProject, KICAD_MANAGER_ACTIONS::openDemoProject.MakeEvent() );
|
||||
Go( &KICAD_MANAGER_CONTROL::OpenProject, KICAD_MANAGER_ACTIONS::openProject.MakeEvent() );
|
||||
Go( &KICAD_MANAGER_CONTROL::CloseProject, KICAD_MANAGER_ACTIONS::closeProject.MakeEvent() );
|
||||
Go( &KICAD_MANAGER_CONTROL::SaveProjectAs, ACTIONS::saveAs.MakeEvent() );
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
int NewProject( const TOOL_EVENT& aEvent );
|
||||
int NewFromTemplate( const TOOL_EVENT& aEvent );
|
||||
int OpenProject( const TOOL_EVENT& aEvent );
|
||||
int OpenDemoProject( const TOOL_EVENT& aEvent );
|
||||
int CloseProject( const TOOL_EVENT& aEvent );
|
||||
int SaveProjectAs( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
@ -65,6 +66,8 @@ private:
|
|||
|
||||
// Mutex to allow only a single KiFace to load at one time (released when loaded)
|
||||
std::mutex m_loading;
|
||||
|
||||
int openProject( const wxString& aDefaultDir );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue