Exemple #1
0
void KICAD_MANAGER_FRAME::Execute( wxWindow* frame, const wxString& execFile,
                                   wxString params )
{
    if( params.size() )
        AddDelimiterString( params );

    TERMINATE_HANDLER* callback = new TERMINATE_HANDLER( execFile );

    long pid = ExecuteFile( frame, execFile, params, callback );

    if( pid > 0 )
    {
        wxString msg = wxString::Format( _( "%s %s opened [pid=%ld]\n" ),
                                         GetChars( execFile ), GetChars( params ), pid );

        PrintMsg( msg );

#ifdef __WXMAC__
        msg.Printf( "osascript -e 'activate application \"%s\"' ", execFile );
        system( msg.c_str() );
#endif
    }
    else
    {
        delete callback;
    }
}
Exemple #2
0
void KICAD_MANAGER_FRAME::OnBrowseInFileExplorer( wxCommandEvent& event )
{
    // open project directory in host OS's file explorer
    wxString project_dir = Prj().GetProjectPath();

#ifdef __WXMAC__
    wxString msg;

    // Quote in case there are spaces in the path.
    msg.Printf( "open \"%s\"", project_dir );

    system( msg.c_str() );
#else
    // Quote in case there are spaces in the path.
    AddDelimiterString( project_dir );

    wxLaunchDefaultApplication( project_dir );
#endif
}
void KICAD_MANAGER_FRAME::Execute( wxWindow* frame, const wxString& execFile,
                                   wxString params )
{
    if( params.size() )
        AddDelimiterString( params );

    TERMINATE_HANDLER* callback = new TERMINATE_HANDLER( execFile );

    long pid = ExecuteFile( frame, execFile, params, callback );

    if( pid > 0 )
    {
        wxString msg = wxString::Format( _( "%s opened [pid=%ld]\n" ),
                GetChars( execFile ), pid );

        PrintMsg( msg );
    }
    else
    {
        delete callback;
    }
}
bool OpenPDF( const wxString& file )
{
    wxString command;
    wxString filename = file;
    wxString type;
    bool     success = false;

    Pgm().ReadPdfBrowserInfos();

    if( !Pgm().UseSystemPdfBrowser() )    //  Run the preferred PDF Browser
    {
        AddDelimiterString( filename );
        command = Pgm().GetPdfBrowserName() + wxT( " " ) + filename;
    }
    else
    {
        wxFileType* filetype = NULL;
        wxFileType::MessageParameters params( filename, type );
        filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );

        if( filetype )
            success = filetype->GetOpenCommand( &command, params );

        delete filetype;

#ifndef __WINDOWS__

        // Bug ? under linux wxWidgets returns acroread as PDF viewer, even if
        // it does not exist.
        if( command.StartsWith( wxT( "acroread" ) ) ) // Workaround
            success = false;
#endif

        if( success && !command.IsEmpty() )
        {
            success = ProcessExecute( command );

            if( success )
                return success;
        }

        success = false;
        command.clear();

        if( !success )
        {
#if !defined(__WINDOWS__)
            AddDelimiterString( filename );

            // here is a list of PDF viewers candidates
            static const wxChar* tries[] =
            {
                wxT( "/usr/bin/evince" ),
                wxT( "/usr/bin/okular" ),
                wxT( "/usr/bin/gpdf" ),
                wxT( "/usr/bin/konqueror" ),
                wxT( "/usr/bin/kpdf" ),
                wxT( "/usr/bin/xpdf" ),
                wxT( "/usr/bin/open" ),     // BSD and OSX file & dir opener
                wxT( "/usr/bin/xdg-open" ), // Freedesktop file & dir opener
            };

            for( unsigned ii = 0;  ii<DIM(tries);  ii++ )
            {
                if( wxFileExists( tries[ii] ) )
                {
                    command = tries[ii];
                    command += wxT( ' ' );
                    command += filename;
                    break;
                }
            }
#endif
        }
    }

    if( !command.IsEmpty() )
    {
        success = ProcessExecute( command );

        if( !success )
        {
            wxString msg;
            msg.Printf( _( "Problem while running the PDF viewer\nCommand is '%s'" ),
                        GetChars( command ) );
            DisplayError( NULL, msg );
        }
    }
    else
    {
        wxString msg;
        msg.Printf( _( "Unable to find a PDF viewer for <%s>" ), GetChars( filename ) );
        DisplayError( NULL, msg );
        success = false;
    }

    return success;
}
int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
                                       wxString*                 aFullFileName )
{
    wxString msg;
    wxString keyname, infokey;

    msg = wxT( "$hotkey list\n" );

    // Print the current hotkey list
    EDA_HOTKEY** list;

    for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
    {
        if( aDescList->m_Title )
        {
            msg += wxT( "# " );
            msg += *aDescList->m_Title;
            msg += wxT( "\n" );
        }

        msg += *aDescList->m_SectionTag;
        msg += wxT( "\n" );

        list = aDescList->m_HK_InfoList;

        for( ; *list != NULL; list++ )
        {
            EDA_HOTKEY* hk_decr = *list;
            msg    += wxT( "shortcut   " );
            keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
            AddDelimiterString( keyname );
            infokey = hk_decr->m_InfoMsg;
            AddDelimiterString( infokey );
            msg += keyname + wxT( ":    " ) + infokey + wxT( "\n" );
        }
    }

    msg += wxT( "$Endlist\n" );

    if( aFullFileName )
    {
        FILE* file = wxFopen( *aFullFileName, wxT( "wt" ) );

        if( file )
        {
            fputs( TO_UTF8( msg ), file );
            fclose( file );
        }
        else
        {
            msg.Printf( wxT( "Unable to write file %s" ), GetChars( *aFullFileName ) );
            return 0;
        }
    }
    else
    {
        wxFileName fn( GetName() );
        fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
        wxConfigBase* config = GetNewConfig( fn.GetFullPath() );
        config->Write( HOTKEYS_CONFIG_KEY, msg );
        delete config;
    }

    return 1;
}
Exemple #6
0
bool OpenPDF( const wxString& file )
{
    wxString command;
    wxString filename = file;
    wxString type;
    bool     success = false;

    wxGetApp().ReadPdfBrowserInfos();

    if( !wxGetApp().UseSystemPdfBrowser() )    //  Run the preferred PDF Browser
    {
        AddDelimiterString( filename );
        command = wxGetApp().GetPdfBrowserFileName() + wxT( " " ) + filename;
    }
    else
    {
        wxFileType* filetype = NULL;
        wxFileType::MessageParameters params( filename, type );
        filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );

        if( filetype )
            success = filetype->GetOpenCommand( &command, params );

        delete filetype;

#ifndef __WINDOWS__

        // Bug ? under linux wxWidgets returns acroread as PDF viewer, even if
        // it does not exist.
        if( command.StartsWith( wxT( "acroread" ) ) ) // Workaround
            success = false;
#endif

        if( success && !command.IsEmpty() )
        {
            success = ProcessExecute( command );

            if( success )
                return success;
        }

        success = false;
        command.Empty();

        if( !success )
        {
#ifndef __WINDOWS__
            AddDelimiterString( filename );

            /* here is a list of PDF viewers candidates */
            const static wxString tries[] =
            {
                wxT( "/usr/bin/evince" ),
                wxT( "/usr/bin/gpdf" ),
                wxT( "/usr/bin/konqueror" ),
                wxT( "/usr/bin/kpdf" ),
                wxT( "/usr/bin/xpdf" ),
                wxT( "/usr/bin/open" ),     // BSD and OSX file & dir opener
                wxT( "/usr/bin/xdg-open" ), // Freedesktop file & dir opener
                wxT( "" ),
            };

            for( int ii = 0; ; ii++ )
            {
                if( tries[ii].IsEmpty() )
                    break;

                if( wxFileExists( tries[ii] ) )
                {
                    command = tries[ii] + wxT( " " ) + filename;
                    break;
                }
            }

#endif
        }
    }

    if( !command.IsEmpty() )
    {
        success = ProcessExecute( command );

        if( !success )
        {
            wxString msg = _( "Problem while running the PDF viewer" );
            msg << _( "\n command is " ) << command;
            DisplayError( NULL, msg );
        }
    }
    else
    {
        wxString msg = _( "Unable to find a PDF viewer for" );
        msg << wxT( " " ) << filename;
        DisplayError( NULL, msg );
        success = false;
    }

    return success;
}
void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* aTreePrjFrame )
{
    wxString        sep = wxFileName().GetPathSeparator();
    wxString        fullFileName = GetFileName();
    wxTreeItemId    id = GetId();

    KICAD_MANAGER_FRAME* frame = aTreePrjFrame->m_Parent;
    KIWAY&               kiway = frame->Kiway();

    switch( GetType() )
    {
    case TREE_PROJECT:
        // Select a new project if this is not the current project:
        if( id != aTreePrjFrame->m_TreeProject->GetRootItem() )
            frame->LoadProject( fullFileName );
        break;

    case TREE_DIRECTORY:
        m_parent->Toggle( id );
        break;

    case TREE_SCHEMA:
        if( fullFileName == frame->SchFileName() )
        {
            // the project's schematic is opened using the *.kiface as part of this process.
            // We do not call frame->RunEeschema( fullFileName ),
            // because after the double click, for some reason,
            // the tree project frame is brought to the foreground after Eeschema is called from here.
            // Instead, we post an event, equivalent to click on the eeschema tool in command frame
            wxCommandEvent evt( wxEVT_COMMAND_TOOL_CLICKED, ID_TO_SCH );
            wxPostEvent( frame, evt );
        }
        else
        {
            // schematics not part of the project are opened in a separate process.
            frame->Execute( m_parent, EESCHEMA_EXE, fullFileName );
        }
        break;

    case TREE_LEGACY_PCB:
    case TREE_SEXP_PCB:
        if( fullFileName == frame->PcbFileName() || fullFileName == frame->PcbLegacyFileName() )
        {
            // the project's BOARD is opened using the *.kiface as part of this process.
            // We do not call frame->RunPcbNew( fullFileName ),
            // because after the double click, for some reason,
            // the tree project frame is brought to the foreground after PcbNew is called from here.
            // Instead, we post an event, equivalent to simple click on the pcb editor tool in command frame
            wxCommandEvent evt( wxEVT_COMMAND_TOOL_CLICKED, ID_TO_PCB );
            wxPostEvent( frame, evt );
        }
        else
        {
            // boards not part of the project are opened in a separate process.
            frame->Execute( m_parent, PCBNEW_EXE, fullFileName );
        }
        break;

    case TREE_GERBER:
        frame->Execute( m_parent, GERBVIEW_EXE, fullFileName );
        break;

    case TREE_HTML:
        wxLaunchDefaultBrowser( fullFileName );
        break;

    case TREE_PDF:
        OpenPDF( fullFileName );
        break;

    case TREE_NET:
    case TREE_DRILL:
    case TREE_TXT:
    case TREE_REPORT:
        {
            wxString editorname = Pgm().GetEditorName();

            if( !editorname.IsEmpty() )
                frame->Execute( m_parent, editorname, fullFileName );
        }
        break;

    case TREE_PAGE_LAYOUT_DESCR:
        frame->Execute( m_parent, PL_EDITOR_EXE, fullFileName );
        break;

    case TREE_FOOTPRINT_FILE:
        {
            wxCommandEvent dummy;
            frame->OnRunPcbFpEditor( dummy );
            kiway.ExpressMail( FRAME_PCB_MODULE_EDITOR, MAIL_FP_EDIT, fullFileName.ToStdString() );
        }
        break;

    case TREE_SCHEMATIC_LIBFILE:
        {
            wxCommandEvent dummy;
            frame->OnRunSchLibEditor( dummy );
            kiway.ExpressMail( FRAME_SCH_LIB_EDITOR, MAIL_LIB_EDIT, fullFileName.ToStdString() );
        }
        break;

    default:
        AddDelimiterString( fullFileName );
        OpenFile( fullFileName );
        break;
    }
}
void WinEDA_MainFrame::Process_Fct(wxCommandEvent& event)
/*********************************************************/
{
int id = event.GetId();
wxString FullFileName = m_PrjFileName;


	switch (id)
		{
		case ID_TO_PCB:
			ChangeFileNameExt(FullFileName, g_BoardExtBuffer);
			AddDelimiterString(FullFileName);
			ExecuteFile(this, PCBNEW_EXE, FullFileName);
			break;

		case ID_TO_CVPCB:
			ChangeFileNameExt(FullFileName, g_NetlistExtBuffer);
			AddDelimiterString(FullFileName);
			ExecuteFile(this, CVPCB_EXE, FullFileName);
			break;

		case ID_TO_EESCHEMA:
			ChangeFileNameExt(FullFileName, g_SchExtBuffer);
			AddDelimiterString(FullFileName);
			ExecuteFile(this, EESCHEMA_EXE, FullFileName);
			break;

		case ID_TO_GERBVIEW:
			FullFileName = wxGetCwd() + STRING_DIR_SEP;
			AddDelimiterString(FullFileName);
			ExecuteFile(this, GERBVIEW_EXE, FullFileName);
			break;

		case ID_TO_EDITOR:
		{
			wxString editorname = GetEditorName();
			if ( !editorname.IsEmpty() )
				ExecuteFile(this, editorname, wxEmptyString);
		}
			break;

		case ID_BROWSE_AN_SELECT_FILE:
			{
			wxString mask(wxT("*")), extension;
#ifdef __WINDOWS__
			mask += wxT(".*");
			extension = wxT(".*");
#endif
			FullFileName = EDA_FileSelector( _("Load file:"),
					wxGetCwd(),		  	/* Defualt path */
					wxEmptyString,		/* default filename */
					extension,			/* default ext. */
					mask,				/* mask for filename filter */
					this,
					wxOPEN,
					TRUE
					);
			if ( ! FullFileName.IsEmpty() )
				{
				wxString fullnamewithquotes;
				fullnamewithquotes = wxT("\"") + FullFileName;
				fullnamewithquotes += wxT("\"");
				wxString editorname = GetEditorName();
				if ( ! editorname.IsEmpty() )
					ExecuteFile(this, editorname, fullnamewithquotes);
				}
			}
			break;

			break;
		default: DisplayError(this, wxT("WinEDA_MainFrame::Process_Fct Internal Error"));
			break;
		}

}
void DIALOG_BUILD_BOM::Create_BOM_Lists( int  aTypeFile,
                                         bool aIncludeSubComponents,
                                         char aExportSeparatorSymbol,
                                         bool aRunBrowser )
{
    wxString    wildcard;

    static wxFileName fn;

    wxFileName  current = g_RootSheet->GetScreen()->GetFileName();

    s_ExportSeparatorSymbol = aExportSeparatorSymbol;

    if( !fn.HasName() || fn.GetName()==NAMELESS_PROJECT )
    {
        fn.SetName( current.GetName() );
    }
    // else use a previous run's name, because fn was set before and user
    // is probably just iteratively refining the BOM.

    if( fn.GetPath().IsEmpty() )
    {
        fn.SetPath( current.GetPath() );
    }
    // else use a previous run's path, because fn was set before and user
    // is probably just iteratively refining the BOM.

    wxString bomDesc = _( "Bill of Materials" );    // translate once, use twice.

    if( aTypeFile == 0 )
    {
        fn.SetExt( wxT( "lst" ) );
        wildcard = bomDesc + wxT( " (*.lst)|*.lst" );
    }
    else
    {
        fn.SetExt( wxT( "csv" ) );
        wildcard = bomDesc + wxT( " (*.csv)|*.csv" );
    }

    wxFileDialog dlg( this, bomDesc, fn.GetPath(),
                      fn.GetFullName(), wildcard, wxFD_SAVE );

    if( dlg.ShowModal() == wxID_CANCEL )
        return;

    fn = dlg.GetPath();        // remember path+filename+ext for subsequent runs.

    m_listFileName = dlg.GetPath();

    // Close dialog, then show the list (if so requested)

    switch( aTypeFile )
    {
    case 0: // list
        CreatePartsAndLabelsFullList( aIncludeSubComponents );
        break;

    case 1: // spreadsheet, Single Part per line
        CreateSpreadSheetPartsFullList( aIncludeSubComponents, s_Add_Location, false );
        break;

    case 2: // spreadsheet, group Part with same fields per line
        CreateSpreadSheetPartsFullList( aIncludeSubComponents, s_Add_Location, true );
        break;

    case 3: // spreadsheet, one value per line and no sub-component
        CreateSpreadSheetPartsShortList();
        break;
    }

    EndModal( 1 );

    if( aRunBrowser )
    {
        wxString editorname = wxGetApp().GetEditorName();
        wxString filename   = m_listFileName;
        AddDelimiterString( filename );
        ExecuteFile( this, editorname, filename );
    }
}
void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
{
    wxString        sep = wxFileName().GetPathSeparator();
    wxString        fullFileName = GetFileName();
    wxTreeItemId    id = GetId();

    KICAD_MANAGER_FRAME* frame = prjframe->m_Parent;
    wxASSERT( frame );

    switch( GetType() )
    {
    case TREE_PROJECT:
        break;

    case TREE_DIRECTORY:
        m_parent->Toggle( id );
        break;

    case TREE_SCHEMA:
        if( fullFileName == frame->SchFileName() )
        {
            // the project's schematic is opened using the *.kiface as part of this process.
            // We do not call frame->RunEeschema( fullFileName ),
            // because after the double click, for some reason,
            // the tree project frame is brought to the foreground after Eeschema is called from here.
            // Instead, we post an event, equivalent to click on the eeschema tool in command frame
            wxCommandEvent evt( wxEVT_COMMAND_TOOL_CLICKED, ID_TO_SCH );
            wxPostEvent( frame, evt );
        }
        else
        {
            // schematics not part of the project are opened in a separate process.
            frame->Execute( m_parent, EESCHEMA_EXE, fullFileName );
        }
        break;

    case TREE_LEGACY_PCB:
    case TREE_SEXP_PCB:
        if( fullFileName == frame->PcbFileName() || fullFileName == frame->PcbLegacyFileName() )
        {
            // the project's BOARD is opened using the *.kiface as part of this process.
            // We do not call frame->RunPcbNew( fullFileName ),
            // because after the double click, for some reason,
            // the tree project frame is brought to the foreground after PcbNew is called from here.
            // Instead, we post an event, equivalent to simple click on the pcb editor tool in command frame
            wxCommandEvent evt( wxEVT_COMMAND_TOOL_CLICKED, ID_TO_PCB );
            wxPostEvent( frame, evt );
        }
        else
        {
            // boards not part of the project are opened in a separate process.
            frame->Execute( m_parent, PCBNEW_EXE, fullFileName );
        }
        break;

    case TREE_GERBER:
        frame->Execute( m_parent, GERBVIEW_EXE, fullFileName );
        break;

    case TREE_HTML:
        wxLaunchDefaultBrowser( fullFileName );
        break;

    case TREE_PDF:
        OpenPDF( fullFileName );
        break;

    case TREE_NET:
        // Nothing to do ( can be read only by Pcbnew, or by a text editor)
        break;

    case TREE_TXT:
        {
            wxString editorname = Pgm().GetEditorName();

            if( !editorname.IsEmpty() )
                frame->Execute( m_parent, editorname, fullFileName );
        }
        break;

    case TREE_PAGE_LAYOUT_DESCR:
        frame->Execute( m_parent, PL_EDITOR_EXE, fullFileName );
        break;

    default:
        AddDelimiterString( fullFileName );
        OpenFile( fullFileName );
        break;
    }
}
void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
{
    wxString        sep = wxFileName().GetPathSeparator();
    wxString        fullFileName = GetFileName();
    wxTreeItemId    id = GetId();

    KICAD_MANAGER_FRAME* frame = (KICAD_MANAGER_FRAME*) Pgm().App().GetTopWindow();

    switch( GetType() )
    {
    case TREE_PROJECT:
        break;

    case TREE_DIRECTORY:
        m_parent->Toggle( id );
        break;

    case TREE_SCHEMA:
        if( fullFileName == frame->SchFileName() )
        {
            // the project's schematic is opened using the *.kiface as part of this process.
            frame->RunEeschema( fullFileName );
        }
        else
        {
            // schematics not part of the project are opened in a separate process.
            frame->Execute( m_parent, EESCHEMA_EXE, fullFileName );
        }
        break;

    case TREE_LEGACY_PCB:
    case TREE_SEXP_PCB:
        if( fullFileName == frame->PcbFileName() || fullFileName == frame->PcbLegacyFileName() )
        {
            // the project's BOARD is opened using the *.kiface as part of this process.
            frame->RunPcbNew( fullFileName );
        }
        else
        {
            // boards not part of the project are opened in a separate process.
            frame->Execute( m_parent, PCBNEW_EXE, fullFileName );
        }
        break;

    case TREE_GERBER:
        frame->Execute( m_parent, GERBVIEW_EXE, fullFileName );
        break;

    case TREE_HTML:
        wxLaunchDefaultBrowser( fullFileName );
        break;

    case TREE_PDF:
        OpenPDF( fullFileName );
        break;

/*  No, use a text editor.  Netlists can only be handled sanely now from within
    eeschema's launcher for the *.kiface, NOT THE EXE which is now gone.
    case TREE_NET:
        frame->Execute( m_parent, CVPCB_EXE, fullFileName );
        break;
*/

    case TREE_TXT:
        {
            wxString editorname = Pgm().GetEditorName();

            if( !editorname.IsEmpty() )
                frame->Execute( m_parent, editorname, fullFileName );
        }
        break;

    case TREE_PAGE_LAYOUT_DESCR:
        frame->Execute( m_parent, PL_EDITOR_EXE, fullFileName );
        break;

    default:
        AddDelimiterString( fullFileName );
        OpenFile( fullFileName );
        break;
    }
}
Exemple #12
0
void WinEDA_ErcFrame::TestErc(wxCommandEvent& event)
/**************************************************/
{
    ObjetNetListStruct * NetItemRef, * OldItem, * StartNet, * Lim;
    int NetNbItems, MinConn;

    if ( ! DiagErcTableInit )
    {
        memcpy(DiagErc, DefaultDiagErc, sizeof (DefaultDiagErc));
        DiagErcTableInit = TRUE;
    }

    WriteFichierERC = m_WriteResultOpt->GetValue();

    if( CheckAnnotate(m_Parent, 0) )
    {
        DisplayError(this, _("Annotation Required!") );
        return;
    }

    /* Effacement des anciens marqueurs DRC */
    DelERCMarkers(event);

    wxClientDC dc(m_Parent->DrawPanel);

    m_Parent->DrawPanel->PrepareGraphicContext(&dc);

    g_EESchemaVar.NbErrorErc = 0;
    g_EESchemaVar.NbWarningErc = 0;

    SchematicCleanUp(&dc);

    BuildNetList(m_Parent, ScreenSch);

    /* Analyse de la table des connexions : */
    Lim = g_TabObjNet + g_NbrObjNet;

    /* Reset du flag m_FlagOfConnection, utilise par la suite */
    for (NetItemRef = g_TabObjNet; NetItemRef < Lim; NetItemRef ++ )
        NetItemRef->m_FlagOfConnection = (IsConnectType) 0;

    NetNbItems = 0;
    MinConn = NOC;
    StartNet = OldItem = NetItemRef = g_TabObjNet;
    for ( ; NetItemRef < Lim; NetItemRef ++ )
    {
        /* Tst changement de net */
        if( OldItem->m_NetCode != NetItemRef->m_NetCode)
        {
            MinConn = NOC;
            NetNbItems = 0;
            StartNet = NetItemRef;
        }

        switch ( NetItemRef->m_Type )
        {
        case NET_SEGMENT:
        case NET_BUS:
        case NET_JONCTION:
        case NET_LABEL:
        case NET_BUSLABELMEMBER:
        case NET_PINLABEL:
            break;

        case NET_GLOBLABEL:
        case NET_GLOBBUSLABELMEMBER:
        case NET_SHEETLABEL:
        case NET_SHEETBUSLABELMEMBER:
            TestLabel(m_Parent->DrawPanel, &dc, NetItemRef, StartNet);
            break;

        case NET_NOCONNECT:
            MinConn = NET_NC;
            if( NetNbItems != 0 )
                Diagnose(m_Parent->DrawPanel, &dc, NetItemRef, NULL, MinConn, UNC);
            break;

        case NET_PIN:
            TestOthersItems(m_Parent->DrawPanel, &dc,
                            NetItemRef, StartNet, &NetNbItems , &MinConn);
            break;
        }
        OldItem = NetItemRef;
    }

    FreeTabNetList(g_TabObjNet, g_NbrObjNet );

    wxString num;
    num.Printf(wxT("%d"), g_EESchemaVar.NbErrorErc);
    m_TotalErrCount->SetLabel(num);

    num.Printf(wxT("%d"), g_EESchemaVar.NbErrorErc-g_EESchemaVar.NbWarningErc);
    m_LastErrCount->SetLabel(num);

    num.Printf(wxT("%d"), g_EESchemaVar.NbWarningErc);
    m_LastWarningCount->SetLabel(num);

    /* Generation ouverture fichier diag */
    if( WriteFichierERC == TRUE )
    {
        wxString ErcFullFileName;
        ErcFullFileName = ScreenSch->m_FileName;
        ChangeFileNameExt(ErcFullFileName, wxT(".erc"));
        ErcFullFileName = EDA_FileSelector(_("ERC file:"),
                                           wxEmptyString,					/* Chemin par defaut */
                                           ErcFullFileName,	/* nom fichier par defaut */
                                           wxT(".erc"),				/* extension par defaut */
                                           wxT("*.erc"),			/* Masque d'affichage */
                                           this,
                                           wxSAVE,
                                           TRUE
                                          );
        if ( ErcFullFileName.IsEmpty()) return;

        if ( WriteDiagnosticERC(ErcFullFileName) )
        {
            Close(TRUE);
            wxString editorname = GetEditorName();
            AddDelimiterString(ErcFullFileName);
            ExecuteFile(this, editorname, ErcFullFileName);
        }
    }
}