mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-11 09:40:09 +00:00
Remember the size/pos of the new proj from template
Stores the new project window position and size in the KiCad prefrences for use between sessions Fixes https://gitlab.com/kicad/code/kicad/-/issues/12920
This commit is contained in:
parent
16c87f4914
commit
e54cf6c834
common/settings
include/settings
kicad
@ -20,6 +20,7 @@
|
||||
|
||||
#include "settings/kicad_settings.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <settings/aui_settings.h>
|
||||
#include <settings/parameters.h>
|
||||
|
||||
|
||||
@ -55,6 +56,11 @@ KICAD_SETTINGS::KICAD_SETTINGS() :
|
||||
m_params.emplace_back( new PARAM<bool>( "system.check_for_kicad_updates", &m_KiCadUpdateCheck,
|
||||
true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<wxPoint>( "template.window.pos", &m_TemplateWindowPos,
|
||||
wxDefaultPosition ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<wxSize>( "template.window.size", &m_TemplateWindowSize, wxDefaultSize ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>(
|
||||
"pcm.repositories",
|
||||
[&]() -> nlohmann::json
|
||||
|
@ -58,6 +58,11 @@ public:
|
||||
wxString m_lastUpdateCheckTime;
|
||||
wxString m_lastReceivedUpdate;
|
||||
|
||||
// Last position of the template window
|
||||
wxPoint m_TemplateWindowPos;
|
||||
// Last size of the template window
|
||||
wxSize m_TemplateWindowSize;
|
||||
|
||||
protected:
|
||||
virtual std::string getLegacyFrameName() const override { return "KicadFrame"; }
|
||||
};
|
||||
|
@ -141,8 +141,8 @@ void DIALOG_TEMPLATE_SELECTOR::OnPageChange( wxNotebookEvent& event )
|
||||
}
|
||||
|
||||
|
||||
DIALOG_TEMPLATE_SELECTOR::DIALOG_TEMPLATE_SELECTOR( wxWindow* aParent ) :
|
||||
DIALOG_TEMPLATE_SELECTOR_BASE( aParent )
|
||||
DIALOG_TEMPLATE_SELECTOR::DIALOG_TEMPLATE_SELECTOR( wxWindow* aParent, const wxPoint& aPos, const wxSize& aSize ) :
|
||||
DIALOG_TEMPLATE_SELECTOR_BASE( aParent, wxID_ANY, wxEmptyString, aPos, aSize )
|
||||
{
|
||||
m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
|
||||
m_reloadButton->SetBitmap( KiBitmapBundle( BITMAPS::small_refresh ) );
|
||||
|
@ -90,7 +90,7 @@ protected:
|
||||
class DIALOG_TEMPLATE_SELECTOR : public DIALOG_TEMPLATE_SELECTOR_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_TEMPLATE_SELECTOR( wxWindow* aParent );
|
||||
DIALOG_TEMPLATE_SELECTOR( wxWindow* aParent, const wxPoint& aPos, const wxSize& aSize );
|
||||
|
||||
/**
|
||||
* Add a new page with \a aTitle, populated with templates from \a aPath
|
||||
|
@ -225,7 +225,9 @@ int KICAD_MANAGER_CONTROL::NewJobsetFile( const TOOL_EVENT& aEvent )
|
||||
|
||||
int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
DIALOG_TEMPLATE_SELECTOR* ps = new DIALOG_TEMPLATE_SELECTOR( m_frame );
|
||||
KICAD_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<KICAD_SETTINGS>();
|
||||
DIALOG_TEMPLATE_SELECTOR* ps = new DIALOG_TEMPLATE_SELECTOR( m_frame, settings->m_TemplateWindowPos,
|
||||
settings->m_TemplateWindowSize );
|
||||
|
||||
wxFileName templatePath;
|
||||
|
||||
@ -252,6 +254,9 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
||||
if( ps->ShowModal() != wxID_OK )
|
||||
return -1;
|
||||
|
||||
settings->m_TemplateWindowPos = ps->GetPosition();
|
||||
settings->m_TemplateWindowSize = ps->GetSize();
|
||||
|
||||
if( !ps->GetSelectedTemplate() )
|
||||
{
|
||||
wxMessageBox( _( "No project template was selected. Cannot generate new project." ),
|
||||
|
Loading…
Reference in New Issue
Block a user