当前位置: 首页>>代码示例>>C++>>正文


C++ Prj函数代码示例

本文整理汇总了C++中Prj函数的典型用法代码示例。如果您正苦于以下问题:C++ Prj函数的具体用法?C++ Prj怎么用?C++ Prj使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Prj函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

bool FOOTPRINT_EDIT_FRAME::SaveFootprint( MODULE* aModule )
{
    wxString libraryName = aModule->GetFPID().GetLibNickname();
    wxString footprintName = aModule->GetFPID().GetLibItemName();
    bool nameChanged = m_footprintNameWhenLoaded != footprintName;

    if( aModule->GetLink() )
    {
        if( SaveFootprintToBoard( false ) )
        {
            m_footprintNameWhenLoaded = footprintName;
            return true;
        }
        else
            return false;
    }
    else if( libraryName.IsEmpty() || footprintName.IsEmpty() )
    {
        if( SaveFootprintAs( aModule ) )
        {
            m_footprintNameWhenLoaded = footprintName;
            SyncLibraryTree( true );
            return true;
        }
        else
            return false;
    }

    FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();

    // Legacy libraries are readable, but modifying legacy format is not allowed
    // So prompt the user if he try to add/replace a footprint in a legacy lib
    wxString libfullname = tbl->FindRow( libraryName )->GetFullURI();

    if( IO_MGR::GuessPluginTypeFromLibPath( libfullname ) == IO_MGR::LEGACY )
    {
        DisplayInfoMessage( this, INFO_LEGACY_LIB_WARN_EDIT );
        return false;
    }

    if( nameChanged )
    {
        LIB_ID oldFPID( libraryName, m_footprintNameWhenLoaded );
        DeleteModuleFromLibrary( oldFPID, false );
    }

    if( !saveFootprintInLibrary( aModule, libraryName ) )
        return false;

    if( nameChanged )
    {
        m_footprintNameWhenLoaded = footprintName;
        SyncLibraryTree( true );
    }

    return true;
}
开发者ID:johnbeard,项目名称:kicad,代码行数:57,代码来源:footprint_libraries_utils.cpp

示例2: Prj

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName( wxCommandEvent& event )
{
    wxString partname = chipnameTextCtrl->GetValue();
    LIB_PART* entry = Prj().SchLibs()->FindLibPart( partname );

    wxString msg;

    if( entry )
    {
        msg.Printf( _( "Component '%s' found in library '%s'" ),
                    GetChars( partname ), GetChars( entry->GetLibraryName() ) );
        wxMessageBox( msg );
        return;
    }

    msg.Printf( _( "Component '%s' not found in any library" ), GetChars( partname ) );

    // Try to find components which have a name "near" the current chip name,
    // i.e. the same name when the comparison is case insensitive.
    // Could be helpful for old designs when lower cases and upper case were
    // equivalent.
    std::vector<LIB_ALIAS*> candidates;
    Prj().SchLibs()->FindLibraryNearEntries( candidates, partname );

    if( candidates.size() == 0 )
    {
        wxMessageBox( msg );
        return;
    }

    // Some candidates are found. Show them:
    msg << wxT("\n") << _( "However, some candidates are found:" );

    // add candidate names:
    for( unsigned ii = 0; ii < candidates.size(); ii++ )
    {
        msg << wxT("\n") <<
            wxString::Format( _( "'%s' found in library '%s'" ),
                              GetChars( candidates[ii]->GetName() ),
                              GetChars( candidates[ii]->GetLibraryName() ) );
    }

    wxMessageBox( msg );
}
开发者ID:nakijun,项目名称:kicad-source-mirror,代码行数:44,代码来源:dialog_edit_component_in_schematic.cpp

示例3: fn

void KICAD_MANAGER_FRAME::SetProjectFileName( const wxString& aFullProjectProFileName )
{
    // ensure file name is absolute:
    wxFileName fn( aFullProjectProFileName );

    if( !fn.IsAbsolute() )
        fn.MakeAbsolute();

    Prj().SetProjectFullName( fn.GetFullPath() );
}
开发者ID:gronicz,项目名称:kicad-source-mirror,代码行数:10,代码来源:mainframe.cpp

示例4: wxCHECK_MSG

bool DIALOG_SYMBOL_REMAP::remapSymbolToLibTable( SCH_COMPONENT* aSymbol )
{
    wxCHECK_MSG( aSymbol != NULL, false, "Null pointer passed to remapSymbolToLibTable." );
    wxCHECK_MSG( aSymbol->GetLibId().GetLibNickname().empty(), false,
                 "Cannot remap symbol that is already mapped." );
    wxCHECK_MSG( !aSymbol->GetLibId().GetLibItemName().empty(), false,
                 "The symbol LIB_ID name is empty." );

    PART_LIBS* libs = Prj().SchLibs();

    for( PART_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
    {
        // Ignore the cache library.
        if( it->IsCache() )
            continue;

        LIB_ALIAS* alias = it->FindAlias( aSymbol->GetLibId().GetLibItemName().wx_str() );

        // Found in the same library as the old look up method assuming the user didn't
        // change the libraries or library ordering since the last time the schematic was
        // loaded.
        if( alias )
        {
            // Find the same library in the symbol library table using the full path and file name.
            wxString libFileName = it->GetFullFileName();

            const LIB_TABLE_ROW* row = Prj().SchSymbolLibTable()->FindRowByURI( libFileName );

            if( row )
            {
                LIB_ID id = aSymbol->GetLibId();

                id.SetLibNickname( row->GetNickName() );

                // Don't resolve symbol library links now.
                aSymbol->SetLibId( id, nullptr, nullptr );
                return true;
            }
        }
    }

    return false;
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:43,代码来源:dialog_symbol_remap.cpp

示例5: Prj

void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& event )
{
    PROJECT&        prj = Prj();
    SEARCH_STACK*   search = prj.SchSearchS();

    wxString    mask = wxT( "*" );
    wxString    docpath = prj.GetRString( PROJECT::DOC_PATH );

    if( !docpath )
        docpath = search->LastVisitedPath( wxT( "doc" ) );

    wxString    fullFileName = EDA_FILE_SELECTOR( _( "Doc Files" ),
                                                  docpath,
                                                  wxEmptyString,
                                                  wxEmptyString,
                                                  mask,
                                                  this,
                                                  wxFD_OPEN,
                                                  true );
    if( fullFileName.IsEmpty() )
        return;

    /* If the path is already in the library search paths
     * list, just add the library name to the list.  Otherwise, add
     * the library name with the full or relative path.
     * the relative path, when possible is preferable,
     * because it preserve use of default libraries paths, when the path is a sub path of
     * these default paths
     */
    wxFileName fn = fullFileName;

    prj.SetRString( PROJECT::DOC_PATH, fn.GetPath() );

    wxString filename = search->FilenameWithRelativePathInSearchList(
            fullFileName, wxPathOnly( Prj().GetProjectFullName() ) );

    // Filenames are always stored in unix like mode, ie separator "\" is stored as "/"
    // to ensure files are identical under unices and windows
#ifdef __WINDOWS__
    filename.Replace( wxT( "\\" ), wxT( "/" ) );
#endif
    m_DocfileCtrl->SetValue( filename );
}
开发者ID:asutp,项目名称:kicad-source-mirror,代码行数:43,代码来源:dialog_edit_component_in_lib.cpp

示例6: wxLogDebug

bool PCB_EDIT_FRAME::LoadProjectSettings()
{
    wxLogDebug( wxT( "Loading project '%s' settings." ),
            GetChars( Prj().GetProjectFullName() ) );

    bool rc = Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_PCB, GetProjectFileParameters() );

    // Load the page layout decr file, from the filename stored in
    // BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
    // If empty, or not existing, the default descr is loaded
    WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
    wxString pg_fullfilename = WORKSHEET_LAYOUT::MakeFullFileName(
                                    BASE_SCREEN::m_PageLayoutDescrFileName,
                                    Prj().GetProjectPath() );

    pglayout.SetPageLayout( pg_fullfilename );

    return rc;
}
开发者ID:PatMart,项目名称:kicad-source-mirror,代码行数:19,代码来源:pcbnew_config.cpp

示例7: wxCHECK_RET

void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName )
{
    wxCHECK_RET( aProjectFileName.DirExists() && aProjectFileName.IsDirWritable(),
                 "Project folder must exist and be writable to create a new project." );

    // Init project filename.  This clears all elements from the project object.
    SetProjectFileName( aProjectFileName.GetFullPath() );

    // Copy kicad.pro file from template folder.
    if( !aProjectFileName.FileExists() )
    {
        wxString srcFileName = sys_search().FindValidPath( "kicad.pro" );

        // Create a minimal project (.pro) file if the template project file could not be copied.
        if( !wxFileName::FileExists( srcFileName )
          || !wxCopyFile( srcFileName, aProjectFileName.GetFullPath() ) )
        {
            Prj().ConfigSave( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams );
        }
    }

    // Ensure a "stub" for a schematic root sheet and a board exist.
    // It will avoid messages from the schematic editor or the board editor to create a new file
    // And forces the user to create main files under the right name for the project manager
    wxFileName fn( aProjectFileName.GetFullPath() );
    fn.SetExt( SchematicFileExtension );

    // If a <project>.sch file does not exist, create a "stub" file ( minimal schematic file )
    if( !fn.FileExists() )
    {
        wxFile file( fn.GetFullPath(), wxFile::write );

        if( file.IsOpened() )
            file.Write( wxT( "EESchema Schematic File Version 2\n"
                             "EELAYER 25 0\nEELAYER END\n$EndSCHEMATC\n" ) );

        // wxFile dtor will close the file
    }

    // If a <project>.kicad_pcb or <project>.brd file does not exist,
    // create a .kicad_pcb "stub" file
    fn.SetExt( KiCadPcbFileExtension );
    wxFileName leg_fn( fn );
    leg_fn.SetExt( LegacyPcbFileExtension );

    if( !fn.FileExists() && !leg_fn.FileExists() )
    {
        wxFile file( fn.GetFullPath(), wxFile::write );

        if( file.IsOpened() )
            file.Write( wxT( "(kicad_pcb (version 4) (host kicad \"dummy file\") )\n" ) );

        // wxFile dtor will close the file
    }
}
开发者ID:johnbeard,项目名称:kicad,代码行数:55,代码来源:prjconfig.cpp

示例8: BOOST_FOREACH

bool SCH_SCREEN::Save( FILE* aFile ) const
{
    // Creates header
    if( fprintf( aFile, "%s %s %d\n", EESCHEMA_FILE_STAMP,
                 SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) < 0 )
        return false;

    BOOST_FOREACH( const PART_LIB& lib, *Prj().SchLibs() )
    {
        if( fprintf( aFile, "LIBS:%s\n", TO_UTF8( lib.GetName() ) ) < 0 )
            return false;
    }

    // This section is not used, but written for file compatibility
    if( fprintf( aFile, "EELAYER %d %d\n", LAYERSCH_ID_COUNT, 0 ) < 0
        || fprintf( aFile, "EELAYER END\n" ) < 0 )
        return false;

    /* Write page info, ScreenNumber and NumberOfScreen; not very meaningful for
     * SheetNumber and Sheet Count in a complex hierarchy, but useful in
     * simple hierarchy and flat hierarchy.  Used also to search the root
     * sheet ( ScreenNumber = 1 ) within the files
     */
    const TITLE_BLOCK& tb = GetTitleBlock();

    if( fprintf( aFile, "$Descr %s %d %d%s\n", TO_UTF8( m_paper.GetType() ),
                 m_paper.GetWidthMils(),
                 m_paper.GetHeightMils(),
                 !m_paper.IsCustom() && m_paper.IsPortrait() ?
                    " portrait" : ""
                 ) < 0
        || fprintf( aFile, "encoding utf-8\n") < 0
        || fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreens ) < 0
        || fprintf( aFile, "Title %s\n",    EscapedUTF8( tb.GetTitle() ).c_str() ) < 0
        || fprintf( aFile, "Date %s\n",     EscapedUTF8( tb.GetDate() ).c_str() ) < 0
        || fprintf( aFile, "Rev %s\n",      EscapedUTF8( tb.GetRevision() ).c_str() ) < 0
        || fprintf( aFile, "Comp %s\n",     EscapedUTF8( tb.GetCompany() ).c_str() ) < 0
        || fprintf( aFile, "Comment1 %s\n", EscapedUTF8( tb.GetComment1() ).c_str() ) < 0
        || fprintf( aFile, "Comment2 %s\n", EscapedUTF8( tb.GetComment2() ).c_str() ) < 0
        || fprintf( aFile, "Comment3 %s\n", EscapedUTF8( tb.GetComment3() ).c_str() ) < 0
        || fprintf( aFile, "Comment4 %s\n", EscapedUTF8( tb.GetComment4() ).c_str() ) < 0
        || fprintf( aFile, "$EndDescr\n" ) < 0 )
        return false;

    for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
    {
        if( !item->Save( aFile ) )
            return false;
    }

    if( fprintf( aFile, "$EndSCHEMATC\n" ) < 0 )
        return false;

    return true;
}
开发者ID:hzeller,项目名称:kicad-source-mirror,代码行数:55,代码来源:sch_screen.cpp

示例9: sf

bool SCH_BASE_FRAME::saveSymbolLibTables( bool aGlobal, bool aProject )
{
    bool success = true;

    if( aGlobal )
    {
        try
        {
            FILE_OUTPUTFORMATTER sf( SYMBOL_LIB_TABLE::GetGlobalTableFileName() );

            SYMBOL_LIB_TABLE::GetGlobalLibTable().Format( &sf, 0 );
        }
        catch( const IO_ERROR& ioe )
        {
            success = false;
            wxString msg = wxString::Format( _( "Error occurred saving the global symbol library "
                                                "table:\n\n%s" ),
                                            GetChars( ioe.What().GetData() ) );
            wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
        }
    }

    if( aProject && !Prj().GetProjectName().IsEmpty() )
    {
        wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );

        try
        {
            Prj().SchSymbolLibTable()->Save( fn.GetFullPath() );
        }
        catch( const IO_ERROR& ioe )
        {
            success = false;
            wxString msg = wxString::Format( _( "Error occurred saving project specific "
                                                "symbol library table:\n\n%s" ),
                                             GetChars( ioe.What() ) );
            wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
        }
    }

    return success;
}
开发者ID:cpavlina,项目名称:kicad,代码行数:42,代码来源:sch_base_frame.cpp

示例10: Prj

LIB_ALIAS* LIB_VIEW_FRAME::getSelectedAlias() const
{
    LIB_ALIAS* alias = NULL;

    if( !m_libraryName.IsEmpty() && !m_entryName.IsEmpty() )
    {
        alias = Prj().SchSymbolLibTable()->LoadSymbol( m_libraryName, m_entryName );
    }

    return alias;
}
开发者ID:johnbeard,项目名称:kicad,代码行数:11,代码来源:viewlib_frame.cpp

示例11: Prj

LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponent,
                             bool aEndPointOnly ) const
{
    SCH_ITEM*       item;
    SCH_COMPONENT*  component = NULL;
    LIB_PIN*        pin = NULL;

    for( item = m_drawList.begin(); item; item = item->Next() )
    {
        if( item->Type() != SCH_COMPONENT_T )
            continue;

        component = (SCH_COMPONENT*) item;

        if( aEndPointOnly )
        {
            pin = NULL;

            LIB_PART* part = Prj().SchLibs()->FindLibPart( component->GetPartName() );

            if( !part )
                continue;

            for( pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
            {
                // Skip items not used for this part.
                if( component->GetUnit() && pin->GetUnit() &&
                    ( pin->GetUnit() != component->GetUnit() ) )
                    continue;

                if( component->GetConvert() && pin->GetConvert() &&
                    ( pin->GetConvert() != component->GetConvert() ) )
                    continue;

                if(component->GetPinPhysicalPosition( pin ) == aPosition )
                    break;
            }
            if( pin )
                break;
        }
        else
        {
            pin = (LIB_PIN*) component->GetDrawItem( aPosition, LIB_PIN_T );

            if( pin )
                break;
        }
    }

    if( pin && aComponent )
        *aComponent = component;

    return pin;
}
开发者ID:antogg,项目名称:kicad-source-mirror,代码行数:54,代码来源:sch_screen.cpp

示例12: Prj

void PCB_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
{
    wxFileName fn = Prj().GetProjectFullName();

    if( aAskForSave )
    {
        wxFileDialog dlg( this, _( "Save Project File" ),
                          fn.GetPath(), fn.GetFullName(),
                          ProjectFileWildcard, wxFD_SAVE | wxFD_CHANGE_DIR );

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

        fn = dlg.GetPath();
    }

    wxString pro_name = fn.GetFullPath();

    Prj().ConfigSave( Kiface().KifaceSearch(), GROUP_PCB, GetProjectFileParameters(), pro_name );
}
开发者ID:PatMart,项目名称:kicad-source-mirror,代码行数:20,代码来源:pcbnew_config.cpp

示例13: GetLastNetListRead

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 );
    }
}
开发者ID:pipatron,项目名称:kicad-source-mirror,代码行数:40,代码来源:dialog_netlist.cpp

示例14: Prj

PART_LIB* SCH_BASE_FRAME::SelectLibraryFromList()
{
    PROJECT&    prj = Prj();

    if( PART_LIBS* libs = prj.SchLibs() )
    {
        if( !libs->GetLibraryCount() )
        {
            DisplayError( this, _( "No component libraries are loaded." ) );
            return NULL;
        }

        wxArrayString headers;

        headers.Add( wxT( "Library" ) );

        wxArrayString   libNamesList = libs->GetLibraryNames();

        std::vector<wxArrayString> itemsToDisplay;

        // Conversion from wxArrayString to vector of ArrayString
        for( unsigned i = 0; i < libNamesList.GetCount(); i++ )
        {
            wxArrayString item;

            item.Add( libNamesList[i] );

            itemsToDisplay.push_back( item );
        }

        wxString old_lib_name = prj.GetRString( PROJECT::SCH_LIB_SELECT );

        EDA_LIST_DIALOG dlg( this, _( "Select Library" ), headers, itemsToDisplay, old_lib_name );

        if( dlg.ShowModal() != wxID_OK )
            return NULL;

        wxString libname = dlg.GetTextSelection();

        if( !libname )
            return NULL;

        PART_LIB* lib = libs->FindLibrary( libname );

        if( lib )
            prj.SetRString( PROJECT::SCH_LIB_SELECT, libname );

        return lib;
    }

    return NULL;
}
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:52,代码来源:selpart.cpp

示例15: switch

void LIB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
{
    const std::string& payload = mail.GetPayload();

    switch( mail.Command() )
    {
    case MAIL_LIB_EDIT:
        if( !payload.empty() )
        {
            wxString libFileName( payload );
            wxString libNickname;
            wxString msg;

            SYMBOL_LIB_TABLE*    libTable = Prj().SchSymbolLibTable();
            const LIB_TABLE_ROW* libTableRow = libTable->FindRowByURI( libFileName );

            if( !libTableRow )
            {
                msg.Printf( _( "The current configuration does not include the symbol library\n"
                               "\"%s\".\nUse Manage Symbol Libraries to edit the configuration." ),
                            libFileName );
                DisplayErrorMessage( this, _( "Library not found in symbol library table." ), msg );
                break;
            }

            libNickname = libTableRow->GetNickName();

            if( !libTable->HasLibrary( libNickname, true ) )
            {
                msg.Printf( _( "The library with the nickname \"%s\" is not enabled\n"
                               "in the current configuration.  Use Manage Symbol Libraries to\n"
                               "edit the configuration." ), libNickname );
                DisplayErrorMessage( this, _( "Symbol library not enabled." ), msg );
                break;
            }

            SetCurLib( libNickname );

            if( m_treePane )
            {
                LIB_ID id( libNickname, wxEmptyString );
                m_treePane->GetLibTree()->ExpandLibId( id );
                m_treePane->GetLibTree()->CenterLibId( id );
            }
        }

        break;

    default:
        ;
    }
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:52,代码来源:lib_edit_frame.cpp


注:本文中的Prj函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。