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


C++ GetCurPart函数代码示例

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


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

示例1: Prj

bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( const wxString& aAliasName, int aUnit,
                                                  int aConvert )
{
    LIB_ALIAS* alias = nullptr;

    try
    {
        alias = Prj().SchSymbolLibTable()->LoadSymbol( GetCurLib(), aAliasName );
    }
    catch( const IO_ERROR& ioe )
    {
        wxString msg;

        msg.Printf( _( "Error occurred loading symbol \"%s\" from library \"%s\"." ),
                    aAliasName, GetCurLib() );
        DisplayErrorMessage( this, msg, ioe.What() );
        return false;
    }

    if( !alias || !LoadOneLibraryPartAux( alias, GetCurLib(), aUnit, aConvert ) )
        return false;

    // Enable synchronized pin edit mode for symbols with interchangeable units
    m_syncPinEdit = !GetCurPart()->UnitsLocked();

    GetScreen()->ClearUndoRedoList();
    Zoom_Automatique( false );
    SetShowDeMorgan( GetCurPart()->HasConversion() );

    if( aUnit > 0 )
        UpdatePartSelectList();

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

示例2: return

bool LIB_EDIT_FRAME::isCurrentPart( const LIB_ID& aLibId ) const
{
    // This will return the root part of any alias
    LIB_PART* part = m_libMgr->GetBufferedPart( aLibId.GetLibItemName(), aLibId.GetLibNickname() );
    // Now we can compare the libId of the current part and the root part
    return ( part && GetCurPart() && part->GetLibId() == GetCurPart()->GetLibId() );
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:7,代码来源:lib_edit_frame.cpp

示例3: Kiway

void LIB_EDIT_FRAME::OnAddPartToSchematic( wxCommandEvent& event )
{
    if( GetCurPart() )
    {
        SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false );

        if( schframe == NULL )      // happens when the schematic editor is not active (or closed)
        {
            DisplayErrorMessage( this, _( "No schematic currently open." ) );
            return;
        }

        SCH_COMPONENT* component = new SCH_COMPONENT( *GetCurPart(), GetCurPart()->GetLibId(),
                                                      g_CurrentSheet, GetUnit(), GetConvert() );

        // Be sure the link to the corresponding LIB_PART is OK:
        component->Resolve( *Prj().SchSymbolLibTable() );

        if( schframe->GetAutoplaceFields() )
            component->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );

        schframe->Raise();
        schframe->GetToolManager()->RunAction( EE_ACTIONS::placeSymbol, true, component );
    }
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:25,代码来源:lib_edit_frame.cpp

示例4: progressDlg

void LIB_EDIT_FRAME::SyncLibraries( bool aShowProgress )
{
    LIB_ID selected;

    if( m_treePane )
        selected = m_treePane->GetLibTree()->GetSelectedLibId();

    if( aShowProgress )
    {
        wxProgressDialog progressDlg( _( "Loading Symbol Libraries" ), wxEmptyString,
                                      m_libMgr->GetAdapter()->GetLibrariesCount(), this );

        m_libMgr->Sync( true, [&]( int progress, int max, const wxString& libName )
        {
            progressDlg.Update( progress, wxString::Format( _( "Loading library \"%s\"" ), libName ) );
        } );
    }
    else
    {
        m_libMgr->Sync( true );
    }

    if( m_treePane )
    {
        wxDataViewItem found;

        if( selected.IsValid() )
        {
            // Check if the previously selected item is still valid,
            // if not - it has to be unselected to prevent crash
            found = m_libMgr->GetAdapter()->FindItem( selected );

            if( !found )
                m_treePane->GetLibTree()->Unselect();
        }

        m_treePane->Regenerate();

        // Try to select the parent library, in case the part is not found
        if( !found && selected.IsValid() )
        {
            selected.SetLibItemName( "" );
            found = m_libMgr->GetAdapter()->FindItem( selected );

            if( found )
                m_treePane->GetLibTree()->SelectLibId( selected );
        }

        // If no selection, see if there's a current part to centre
        if( !selected.IsValid() && GetCurPart() )
        {
            LIB_ID current( GetCurLib(), GetCurPart()->GetName() );
            m_treePane->GetLibTree()->CenterLibId( current );
        }
    }
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:56,代码来源:lib_edit_frame.cpp

示例5: GetCurLib

void LIB_EDIT_FRAME::updateTitle()
{
    wxString lib = GetCurLib();
    wxString title = _( "Symbol Editor" );

    if( GetCurPart() )
        title += wxT( " \u2014 " ) + GetCurPart()->GetLibId().Format();

    SetTitle( title );
}
开发者ID:johnbeard,项目名称:kicad,代码行数:10,代码来源:libedit.cpp

示例6: GetCurPart

LIB_ID LIB_EDIT_FRAME::getTargetLibId() const
{
    LIB_ID   id = m_treePane->GetLibTree()->GetSelectedLibId();
    wxString nickname = id.GetLibNickname();

    if( nickname.IsEmpty() && GetCurPart() )
        id = GetCurPart()->GetLibId();

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

示例7: getTargetLibId

void LIB_EDIT_FRAME::OnRevert( wxCommandEvent& aEvent )
{
    LIB_ID libId = getTargetLibId();
    const wxString& libName = libId.GetLibNickname();
    const wxString& partName = libId.GetLibItemName();  // Empty if this is the library itself that is selected

    wxString msg = wxString::Format( _( "Revert \"%s\" to last version saved?" ),
                                     partName.IsEmpty() ? libName : partName );

    if( !ConfirmRevertDialog( this, msg ) )
        return;

    bool reload_currentPart = false;
    wxString curr_partName = partName;

    if( GetCurPart() )
    {
        // the library itself is reverted: the current part will be reloaded only if it is
        // owned by this library
        if( partName.IsEmpty() )
        {
            LIB_ID curr_libId = GetCurPart()->GetLibId();
            reload_currentPart = libName == curr_libId.GetLibNickname();

            if( reload_currentPart )
                curr_partName = curr_libId.GetLibItemName();
        }
        else
            reload_currentPart = isCurrentPart( libId );
    }

    int unit = m_unit;

    if( reload_currentPart )
        emptyScreen();

    if( partName.IsEmpty() )
    {
        m_libMgr->RevertLibrary( libName );
    }
    else
    {
        libId = m_libMgr->RevertPart( libId.GetLibItemName(), libId.GetLibNickname() );

        m_treePane->GetLibTree()->SelectLibId( libId );
        m_libMgr->ClearPartModified( libId.GetLibItemName(), libId.GetLibNickname() );
    }

    if( reload_currentPart && m_libMgr->PartExists( curr_partName, libName ) )
        loadPart( curr_partName, libName, unit );

    m_treePane->Refresh();
    refreshSchematic();
}
开发者ID:johnbeard,项目名称:kicad,代码行数:54,代码来源:libedit.cpp

示例8: GetCurPart

bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( LIB_ALIAS* aLibEntry )
{
    if( !LoadOneLibraryPartAux( aLibEntry, GetCurLib() ) )
        return false;

    m_editPinsPerPartOrConvert = GetCurPart()->UnitsLocked() ? true : false;

    GetScreen()->ClearUndoRedoList();
    Zoom_Automatique( false );
    SetShowDeMorgan( GetCurPart()->HasConversion() );

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

示例9: GetCurPart

bool LIB_EDIT_FRAME::SaveOnePart( PART_LIB* aLib, bool aPromptUser )
{
    wxString    msg;
    LIB_PART*   part = GetCurPart();

    GetScreen()->ClrModify();

    LIB_PART* old_part = aLib->FindPart( part->GetName() );

    if( old_part && aPromptUser )
    {
        msg.Printf( _( "Part '%s' already exists. Change it?" ),
                    GetChars( part->GetName() ) );

        if( !IsOK( this, msg ) )
            return false;
    }

    m_drawItem = m_lastDrawItem = NULL;

    if( old_part )
        aLib->ReplacePart( old_part, part );
    else
        aLib->AddPart( part );

    msg.Printf( _( "Part '%s' saved in library '%s'" ),
                GetChars( part->GetName() ),
                GetChars( aLib->GetName() ) );

    SetStatusText( msg );

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

示例10: GetCurPart

void LIB_EDIT_FRAME::copySelectedItems()
{
    LIB_PART* part = GetCurPart();

    if( !part )
        return;

    m_clipboard.ClearListAndDeleteItems();   // delete previous saved list, if exists
    m_clipboard.SetLastCursorPosition( GetScreen()->m_BlockLocate.GetEnd() );    // store the reference point

    for( LIB_ITEM& item : part->GetDrawItems() )
    {
        // We *do not* copy fields because they are unique for the whole component
        // so skip them (do not duplicate) if they are flagged selected.
        if( item.Type() == LIB_FIELD_T )
            item.ClearFlags( SELECTED );

        if( !item.IsSelected() )
            continue;

        // Do not clear the 'selected' flag. It is required to have items drawn when they are pasted.
        LIB_ITEM* copy = (LIB_ITEM*) item.Clone();
        copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
        ITEM_PICKER picker( copy, UR_NEW );
        m_clipboard.PushItem( picker );
    }
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:27,代码来源:block_libedit.cpp

示例11: GetCurPart

bool LIB_EDIT_FRAME::SynchronizePins()
{
    LIB_PART*      part = GetCurPart();

    return !m_editPinsPerPartOrConvert && ( part &&
        ( part->HasConversion() || part->IsMulti() ) );
}
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:7,代码来源:libeditframe.cpp

示例12: GetCurPart

bool LIB_EDIT_FRAME::saveCurrentPart()
{
    if( GetCurPart() )
    {
        LIB_ID libId = GetCurPart()->GetLibId();
        const wxString& libName = libId.GetLibNickname();
        const wxString& partName = libId.GetLibItemName();

        if( m_libMgr->FlushPart( partName, libName ) )
        {
            m_libMgr->ClearPartModified( partName, libName );
            return true;
        }
    }

    return false;
}
开发者ID:johnbeard,项目名称:kicad,代码行数:17,代码来源:libedit.cpp

示例13: TempCopyComponent

void LIB_EDIT_FRAME::TempCopyComponent()
{
    delete m_tempCopyComponent;

    if( LIB_PART* part = GetCurPart() )
        // clone it and own the clone.
        m_tempCopyComponent = new LIB_PART( *part );
    else
        // clear it, there was no CurPart
        m_tempCopyComponent = NULL;
}
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:11,代码来源:libeditframe.cpp

示例14: wxCHECK_RET

void LIB_EDIT_FRAME::deleteItem( wxDC* aDC )
{
    wxCHECK_RET( m_drawItem != NULL, wxT( "No drawing item selected to delete." ) );

    m_canvas->CrossHairOff( aDC );

    LIB_PART*      part = GetCurPart();

    SaveCopyInUndoList( part );

    if( m_drawItem->Type() == LIB_PIN_T )
    {
        LIB_PIN*    pin = (LIB_PIN*) m_drawItem;
        wxPoint     pos = pin->GetPosition();

        part->RemoveDrawItem( (LIB_ITEM*) pin, m_canvas, aDC );

        if( SynchronizePins() )
        {
            LIB_PIN* tmp = part->GetNextPin();

            while( tmp != NULL )
            {
                pin = tmp;
                tmp = part->GetNextPin( pin );

                if( pin->GetPosition() != pos )
                    continue;

                part->RemoveDrawItem( (LIB_ITEM*) pin );
            }
        }

        m_canvas->Refresh();
    }
    else
    {
        if( m_canvas->IsMouseCaptured() )
        {
            m_canvas->CallEndMouseCapture( aDC );
        }
        else
        {
            part->RemoveDrawItem( m_drawItem, m_canvas, aDC );
            m_canvas->Refresh();
        }
    }

    m_drawItem = NULL;
    m_lastDrawItem = NULL;
    OnModify();
    m_canvas->CrossHairOn( aDC );
}
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:53,代码来源:libeditframe.cpp

示例15: dlg

void LIB_EDIT_FRAME::InstallFieldsEditorDialog( wxCommandEvent& event )
{
    if( !GetCurPart() )
        return;

    m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );

    DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, GetCurPart() );

    // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
    // frame. Therefore this dialog as a modal frame parent, MUST be run under
    // quasimodal mode for the quasimodal frame support to work.  So don't use
    // the QUASIMODAL macros here.
    if( dlg.ShowQuasiModal() != wxID_OK )
        return;

    UpdateAliasSelectList();
    UpdatePartSelectList();
    DisplayLibInfos();
    Refresh();
}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:21,代码来源:dialog_edit_libentry_fields_in_lib.cpp


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