Code style
This commit is contained in:
parent
89e74140eb
commit
3673c23696
|
@ -453,6 +453,7 @@ void EDA_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
|
||||||
void EDA_BASE_FRAME::LoadWindowState( const wxString& aFileName )
|
void EDA_BASE_FRAME::LoadWindowState( const wxString& aFileName )
|
||||||
{
|
{
|
||||||
const PROJECT_FILE_STATE* state = Prj().GetLocalSettings().GetFileState( aFileName );
|
const PROJECT_FILE_STATE* state = Prj().GetLocalSettings().GetFileState( aFileName );
|
||||||
|
|
||||||
if( state != nullptr )
|
if( state != nullptr )
|
||||||
{
|
{
|
||||||
LoadWindowState( state->window );
|
LoadWindowState( state->window );
|
||||||
|
|
|
@ -430,7 +430,7 @@ void LIB_EDIT_FRAME::setupUIConditions()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_EDIT_FRAME::canCloseWindow(wxCloseEvent& aEvent)
|
bool LIB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
||||||
{
|
{
|
||||||
// Shutdown blocks must be determined and vetoed as early as possible
|
// Shutdown blocks must be determined and vetoed as early as possible
|
||||||
if( SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
|
if( SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
|
||||||
|
|
|
@ -657,7 +657,11 @@ public:
|
||||||
|
|
||||||
int GetMaxUndoItems() const { return m_UndoRedoCountMax; }
|
int GetMaxUndoItems() const { return m_UndoRedoCountMax; }
|
||||||
|
|
||||||
bool NonUserClose( bool aForce ) { m_isNonUserClose = true; return Close( aForce ); };
|
bool NonUserClose( bool aForce )
|
||||||
|
{
|
||||||
|
m_isNonUserClose = true;
|
||||||
|
return Close( aForce );
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,8 @@ c * @return true if the file was saved
|
||||||
* @param aTarget is the storage destination
|
* @param aTarget is the storage destination
|
||||||
* @return True if set, false if not
|
* @return True if set, false if not
|
||||||
*/
|
*/
|
||||||
static bool SetIfPresent( const nlohmann::json& aObj, const std::string& aPath, wxString& aTarget );
|
static bool SetIfPresent( const nlohmann::json& aObj, const std::string& aPath,
|
||||||
|
wxString& aTarget );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the given bool if the given key/path is present
|
* Sets the given bool if the given key/path is present
|
||||||
|
@ -214,7 +215,8 @@ c * @return true if the file was saved
|
||||||
* @param aTarget is the storage destination
|
* @param aTarget is the storage destination
|
||||||
* @return True if set, false if not
|
* @return True if set, false if not
|
||||||
*/
|
*/
|
||||||
static bool SetIfPresent( const nlohmann::json& aObj, const std::string& aPath, unsigned int& aTarget );
|
static bool SetIfPresent( const nlohmann::json& aObj, const std::string& aPath,
|
||||||
|
unsigned int& aTarget );
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -648,41 +648,51 @@ void KICAD_MANAGER_FRAME::PrintPrjInfo()
|
||||||
PrintMsg( msg );
|
PrintMsg( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool KICAD_MANAGER_FRAME::IsProjectActive()
|
bool KICAD_MANAGER_FRAME::IsProjectActive()
|
||||||
{
|
{
|
||||||
return m_active_project;
|
return m_active_project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
|
void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* We start loading the saved previously open windows on idle to avoid locking up the GUI earlier in project loading
|
* We start loading the saved previously open windows on idle to avoid locking up the GUI
|
||||||
* This gives us the visual effect of a opened KiCad project but with a "busy" progress reporter
|
* earlier in project loading. This gives us the visual effect of a opened KiCad project but
|
||||||
|
* with a "busy" progress reporter
|
||||||
*/
|
*/
|
||||||
if( m_openSavedWindows )
|
if( !m_openSavedWindows )
|
||||||
{
|
return;
|
||||||
|
|
||||||
m_openSavedWindows = false;
|
m_openSavedWindows = false;
|
||||||
if ( Pgm().GetCommonSettings()->m_Session.remember_open_files )
|
|
||||||
|
if( Pgm().GetCommonSettings()->m_Session.remember_open_files )
|
||||||
{
|
{
|
||||||
int previousOpenCount = std::count_if( Prj().GetLocalSettings().m_files.begin(),
|
int previousOpenCount =
|
||||||
|
std::count_if( Prj().GetLocalSettings().m_files.begin(),
|
||||||
Prj().GetLocalSettings().m_files.end(),
|
Prj().GetLocalSettings().m_files.end(),
|
||||||
[&]( const PROJECT_FILE_STATE& f )
|
[&]( const PROJECT_FILE_STATE& f )
|
||||||
{
|
{
|
||||||
return !f.fileName.EndsWith( ProjectFileExtension ) && f.open;
|
return !f.fileName.EndsWith( ProjectFileExtension ) && f.open;
|
||||||
} );
|
} );
|
||||||
if ( previousOpenCount > 0 )
|
|
||||||
|
if( previousOpenCount > 0 )
|
||||||
{
|
{
|
||||||
APP_PROGRESS_DIALOG progressReporter( _( "Restoring session" ), wxEmptyString, previousOpenCount, this );
|
APP_PROGRESS_DIALOG progressReporter( _( "Restoring session" ), wxEmptyString,
|
||||||
|
previousOpenCount, this );
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for( const PROJECT_FILE_STATE& file : Prj().GetLocalSettings().m_files )
|
for( const PROJECT_FILE_STATE& file : Prj().GetLocalSettings().m_files )
|
||||||
{
|
{
|
||||||
if( file.open )
|
if( file.open )
|
||||||
{
|
{
|
||||||
progressReporter.Update(
|
progressReporter.Update( i++,
|
||||||
i++, wxString::Format( _( "Restoring \"%s\"" ), file.fileName ) );
|
wxString::Format( _( "Restoring \"%s\"" ), file.fileName ) );
|
||||||
|
|
||||||
wxFileName fn( file.fileName );
|
wxFileName fn( file.fileName );
|
||||||
|
|
||||||
if( fn.GetExt() == LegacySchematicFileExtension
|
if( fn.GetExt() == LegacySchematicFileExtension
|
||||||
|| fn.GetExt() == KiCadSchematicFileExtension )
|
|| fn.GetExt() == KiCadSchematicFileExtension )
|
||||||
{
|
{
|
||||||
|
@ -702,5 +712,4 @@ void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
|
||||||
|
|
||||||
// clear file states regardless if we opened windows or not due to setting
|
// clear file states regardless if we opened windows or not due to setting
|
||||||
Prj().GetLocalSettings().ClearFileState();
|
Prj().GetLocalSettings().ClearFileState();
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -812,7 +812,10 @@ bool PCB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
||||||
wxString msg = _( "Save changes to \"%s\" before closing?" );
|
wxString msg = _( "Save changes to \"%s\" before closing?" );
|
||||||
|
|
||||||
if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
|
if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
|
||||||
[&]()->bool { return Files_io_from_id( ID_SAVE_BOARD ); } ) )
|
[&]() -> bool
|
||||||
|
{
|
||||||
|
return Files_io_from_id( ID_SAVE_BOARD );
|
||||||
|
} ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue