bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
{
    wxLogDebug( wxT( "Loading project '%s' settings." ), GetChars( aProjectFileName ) );

    wxFileName  fn = aProjectFileName;

    if( fn.GetExt() != ProjectFileExtension )
        fn.SetExt( ProjectFileExtension );

    // was: wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
    Prj().ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );

    // Dick 5-Feb-2012: I don't agree with this, the BOARD contents should dictate
    // what is visible or not, even initially.  And since PCB_EDIT_FRAME projects settings
    // have no control over what is visible (see PCB_EDIT_FRAME::GetProjectFileParameters())
    // this is recklessly turning on things the user may not want to see.
#if 0

    /* Reset the items visibility flag when loading a new configuration because it could
     * create SERIOUS mistakes for the user if board items are not visible after loading
     * a board.  Grid and ratsnest can be left to their previous state.
     */
    bool showGrid = IsElementVisible( GRID_VISIBLE );
    bool showRats = IsElementVisible( RATSNEST_VISIBLE );

    SetVisibleAlls();

    SetElementVisibility( GRID_VISIBLE, showGrid );
    SetElementVisibility( RATSNEST_VISIBLE, showRats );
#endif

    wxString projectFpLibTableFileName = Prj().FootprintLibTblName();

    FootprintLibs()->Clear();

    try
    {
        FootprintLibs()->Load( projectFpLibTableFileName );
    }
    catch( const IO_ERROR& ioe )
    {
        DisplayError( this, ioe.errorText );
    }

    // Load the page layout decr file, from the filename stored in
    // BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
    // If empty, the default descr is loaded
    WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
    pglayout.SetPageLayout( BASE_SCREEN::m_PageLayoutDescrFileName );

    return true;
}
示例#2
0
bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
{
    wxFileName fn = aProjectFileName;

    if( fn.GetExt() != ProjectFileExtension )
        fn.SetExt( ProjectFileExtension );

    wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );

    // Initialize default values.
    g_LibraryNames.Clear();

    wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );

    // User library path takes precedent over default library search paths.
    wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );

    // Dick 5-Feb-2012: I don't agree with this, the BOARD contents should dictate
    // what is visible or not, even initially.  And since PCB_EDIT_FRAME projects settings
    // have no control over what is visible (see PCB_EDIT_FRAME::GetProjectFileParameters())
    // this is recklessly turning on things the user may not want to see.
#if 0

    /* Reset the items visibility flag when loading a new configuration because it could
     * create SERIOUS mistakes for the user if board items are not visible after loading
     * a board.  Grid and ratsnest can be left to their previous state.
     */
    bool showGrid = IsElementVisible( GRID_VISIBLE );
    bool showRats = IsElementVisible( RATSNEST_VISIBLE );

    SetVisibleAlls();

    SetElementVisibility( GRID_VISIBLE, showGrid );
    SetElementVisibility( RATSNEST_VISIBLE, showRats );
#endif

    return true;
}