コード例 #1
0
void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC )
{
    /* Setup the netlist file name to the last net list file read or the board file
     * name if no last file read is not set.
     */
    wxFileName fn = GetLastNetListRead();
    wxString lastNetlistName = GetLastNetListRead();

    if( !fn.FileExists() )
    {
        fn = GetScreen()->GetFileName();
        fn.SetExt( NetlistFileExtension );
        lastNetlistName = fn.GetFullPath();
    }

    DIALOG_NETLIST frame( this, DC, lastNetlistName );

    frame.ShowModal();

    // Save project settings if needed.
    // Project settings are saved in the corresponding <board name>.pro file
    if( lastNetlistName != GetLastNetListRead() &&
        !GetScreen()->GetFileName().IsEmpty() &&
        IsOK(NULL, _("Project config has changed. Save it ?") ) )
    {
        wxFileName fn = GetScreen()->GetFileName();
        fn.SetExt( ProjectFileExtension );
        wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP,
                                       GetProjectFileParameters() );
    }
}
コード例 #2
0
void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC )
{
    /* Setup the netlist file name to the last netlist file read,
     * or the board file name if the last filename is empty or last file not existing.
     */
    wxString netlistName = GetLastNetListRead();

    wxFileName fn = netlistName;

    if( !fn.IsOk() || !fn.FileExists() )
    {
        fn = GetBoard()->GetFileName();
        fn.SetExt( NetlistFileExtension );

        if( fn.GetName().IsEmpty() )
            netlistName.Clear();
        else
            netlistName = fn.GetFullPath();
    }

    DIALOG_NETLIST dlg( this, DC, netlistName );

    dlg.ShowModal();

    // Save project settings if needed.
    // Project settings are saved in the corresponding <board name>.pro file
    bool configChanged = !GetLastNetListRead().IsEmpty() && ( netlistName != GetLastNetListRead() );

    if( configChanged && !GetBoard()->GetFileName().IsEmpty()
            && IsOK( NULL, _( "The project configuration has changed.  Do you want to save it?" ) ) )
    {
        fn = Prj().AbsolutePath( GetBoard()->GetFileName() );
        fn.SetExt( ProjectFileExtension );

        wxString pro_name = fn.GetFullPath();

        Prj().ConfigSave( Kiface().KifaceSearch(), GROUP_PCB,
                          GetProjectFileParameters(), pro_name );
    }
}