Commit c63fa6ff authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

Add EDA_BASE_FRAME::Show() and call SaveSettings() only from there for all...

Add EDA_BASE_FRAME::Show() and call SaveSettings() only from there for all derived wxFrames.  Remove calls to SaveSettings() elsewhere.
parent 786bb81c
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -141,8 +141,6 @@ void EDA_3D_FRAME::Exit3DFrame( wxCommandEvent& event )


void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
{
    SaveSettings();

    if( Parent() )
    if( Parent() )
        Parent()->m_Draw3DFrame = NULL;
        Parent()->m_Draw3DFrame = NULL;


+28 −9
Original line number Original line Diff line number Diff line
@@ -51,13 +51,13 @@
#define DEFAULT_AUTO_SAVE_INTERVAL 600
#define DEFAULT_AUTO_SAVE_INTERVAL 600




const wxChar* traceAutoSave = wxT( "KicadAutoSave" );
const wxChar traceAutoSave[] = wxT( "KicadAutoSave" );


/// Configuration file entry name for auto save interval.
/// Configuration file entry name for auto save interval.
static const wxChar* entryAutoSaveInterval = wxT( "AutoSaveInterval" );
static const wxChar entryAutoSaveInterval[] = wxT( "AutoSaveInterval" );


/// Configuration file entry for wxAuiManger perspective.
/// Configuration file entry for wxAuiManger perspective.
static const wxChar* entryPerspective = wxT( "Perspective" );
static const wxChar entryPerspective[] = wxT( "Perspective" );






@@ -141,6 +141,19 @@ bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
}
}




bool EDA_BASE_FRAME::Show( bool show )
{
    if( !show )     // closing
    {
        SaveSettings();     // virtual, wxFrame specific
    }

    int ret = wxFrame::Show( show );

    return ret;
}


void EDA_BASE_FRAME::onAutoSaveTimer( wxTimerEvent& aEvent )
void EDA_BASE_FRAME::onAutoSaveTimer( wxTimerEvent& aEvent )
{
{
    if( !doAutoSave() )
    if( !doAutoSave() )
@@ -231,7 +244,7 @@ void EDA_BASE_FRAME::SaveSettings()
    wxString    text;
    wxString    text;
    wxConfig*   config = wxGetApp().GetSettings();
    wxConfig*   config = wxGetApp().GetSettings();


    if( ( config == NULL ) || IsIconized() )
    if( !config || IsIconized() )
        return;
        return;


    m_FrameSize = GetSize();
    m_FrameSize = GetSize();
@@ -258,10 +271,15 @@ void EDA_BASE_FRAME::SaveSettings()
        config->Write( text, m_autoSaveInterval );
        config->Write( text, m_autoSaveInterval );
    }
    }


    // Once this is fully implemented, wxAuiManager will be used to maintain the persistance of
    // Once this is fully implemented, wxAuiManager will be used to maintain
    // the main frame and all it's managed windows and all of the legacy frame persistence
    // the persistance of the main frame and all it's managed windows and
    // position code can be removed.
    // all of the legacy frame persistence position code can be removed.
    config->Write( m_FrameName + entryPerspective, m_auimgr.SavePerspective() );
    wxString perspective = m_auimgr.SavePerspective();

    // printf( "perspective(%s): %s\n",
    //    TO_UTF8( m_FrameName + entryPerspective ), TO_UTF8( perspective ) );

    config->Write( m_FrameName + entryPerspective, perspective );
}
}




@@ -270,6 +288,7 @@ void EDA_BASE_FRAME::PrintMsg( const wxString& text )
    SetStatusText( text );
    SetStatusText( text );
}
}



void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
                                        wxFileHistory * aFileHistory )
                                        wxFileHistory * aFileHistory )
{
{
+0 −1
Original line number Original line Diff line number Diff line
@@ -158,7 +158,6 @@ void DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow( wxCloseEvent& event )
    if( m_Draw3DFrame )
    if( m_Draw3DFrame )
        m_Draw3DFrame->Close( true );
        m_Draw3DFrame->Close( true );


    SaveSettings();
    Destroy();
    Destroy();
}
}


+0 −1
Original line number Original line Diff line number Diff line
@@ -337,7 +337,6 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
        m_DisplayFootprintFrame->Close( true );
        m_DisplayFootprintFrame->Close( true );


    m_modified = false;
    m_modified = false;
    SaveSettings();
    Destroy();
    Destroy();
    return;
    return;
}
}
+0 −1
Original line number Original line Diff line number Diff line
@@ -375,7 +375,6 @@ void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
        }
        }
    }
    }


    SaveSettings();
    Destroy();
    Destroy();
}
}


Loading