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


C++ Pgm函数代码示例

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


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

示例1: DisplayError

void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event )
{
    bool select = event.GetId() == ID_SELECT_PREFERED_PDF_BROWSER_NAME;

    if( !Pgm().GetPdfBrowserName() && !select )
    {
        DisplayError( this,
                      _( "You must choose a PDF viewer before using this option." ) );
    }

    wxString mask( wxT( "*" ) );

#ifdef __WINDOWS__
    mask += wxT( ".exe" );
#endif

    wxString wildcard = _( "Executable files (" ) + mask + wxT( ")|" ) + mask;

    Pgm().ReadPdfBrowserInfos();
    wxFileName fn = Pgm().GetPdfBrowserName();

    wxFileDialog dlg( this, _( "Select Preferred Pdf Browser" ), fn.GetPath(),
                      fn.GetFullPath(), wildcard,
                      wxFD_OPEN | wxFD_FILE_MUST_EXIST );

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

    Pgm().SetPdfBrowserName( dlg.GetPath() );
    Pgm().WritePdfBrowserInfos();
}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:31,代码来源:preferences.cpp

示例2: Pgm

void KIWAY::SetLanguage( int aLanguage )
{
    Pgm().SetLanguageIdentifier( aLanguage );
    Pgm().SetLanguage();

#if 1
    // This is a risky hack that goes away if we allow the language to be
    // set only from the top most frame if !Kiface.IsSingle()

    // Only for the C++ project manager, and not for the python one and not for
    // single_top do we look for the EDA_BASE_FRAME as the top level window.
    // For single_top this is not needed because that window is registered in
    // the array below.
    if( m_ctl & KFCTL_CPP_PROJECT_SUITE )
    {
        // A dynamic_cast could be better, but creates link issues
        // (some basic_frame functions not found) on some platforms,
        // so a static_cast is used.
        EDA_BASE_FRAME* top = static_cast<EDA_BASE_FRAME*>( m_top );

        if( top )
            top->ShowChangedLanguage();
    }
#endif

    for( unsigned i=0;  i < KIWAY_PLAYER_COUNT;  ++i )
    {
        KIWAY_PLAYER* frame = GetPlayerFrame( ( FRAME_T )i );

        if( frame )
        {
            frame->ShowChangedLanguage();
        }
    }
}
开发者ID:PatMart,项目名称:kicad-source-mirror,代码行数:35,代码来源:kiway.cpp

示例3: OnInit

    bool OnInit()           // overload wxApp virtual
    {
        try
        {
            return Pgm().OnPgmInit( this );
        }
        catch( const std::exception& e )
        {
            wxLogError( wxT( "Unhandled exception class: %s  what: %s" ),
                GetChars( FROM_UTF8( typeid(e).name() )),
                GetChars( FROM_UTF8( e.what() ) ) );
        }
        catch( const IO_ERROR& ioe )
        {
            wxLogError( GetChars( ioe.errorText ) );
        }
        catch(...)
        {
            wxLogError( wxT( "Unhandled exception of unknown type" ) );
        }

        Pgm().OnPgmExit();

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

示例4: _

CMP_TREE_NODE_UNIT::CMP_TREE_NODE_UNIT( CMP_TREE_NODE* aParent, int aUnit )
{
    static void* locale = nullptr;
    static wxString namePrefix;

    // Fetching translations can take a surprising amount of time when loading libraries,
    // so only do it when necessary.
    if( Pgm().GetLocale() != locale )
    {
        namePrefix = _( "Unit" );
        locale = Pgm().GetLocale();
    }

    Parent = aParent;
    Type = UNIT;

    Unit = aUnit;
    LibId = aParent->LibId;

    Name = namePrefix + " " + LIB_PART::SubReference( aUnit, false );
    Desc = wxEmptyString;
    MatchName = wxEmptyString;

    IntrinsicRank = -aUnit;
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:25,代码来源:cmp_tree_model.cpp

示例5: wxScrolledWindow

EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
                                const wxPoint& pos, const wxSize& size ) :
    wxScrolledWindow( parent, id, pos, size, drawPanelStyle )
{
    wxASSERT( parent );

    ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
    DisableKeyboardScrolling();

    m_scrollIncrementX = std::min( size.x / 8, 10 );
    m_scrollIncrementY = std::min( size.y / 8, 10 );

    SetLayoutDirection( wxLayout_LeftToRight );

    SetBackgroundColour( parent->GetDrawBgColor().ToColour() );

#if KICAD_USE_BUFFERED_DC || KICAD_USE_BUFFERED_PAINTDC
    SetBackgroundStyle( wxBG_STYLE_CUSTOM );
#endif

    m_ClipBox.SetSize( size );
    m_ClipBox.SetX( 0 );
    m_ClipBox.SetY( 0 );
    m_canStartBlock = -1;       // Command block can start if >= 0
    m_abortRequest = false;
    m_enableMousewheelPan = false;
    m_enableZoomNoCenter = false;
    m_enableAutoPan = true;
    m_ignoreMouseEvents = false;
    // Be sure a mouse release button event will be ignored when creating the canvas
    // if the mouse click was not made inside the canvas (can happen sometimes, when
    // launching a editor from a double click made in another frame)
    m_ignoreNextLeftButtonRelease = true;

    m_mouseCaptureCallback = NULL;
    m_endMouseCaptureCallback = NULL;

    Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false );
    Pgm().CommonSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
    Pgm().CommonSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );

    m_requestAutoPan = false;
    m_enableBlockCommands = false;
    m_minDragEventCount = 0;

#ifdef __WXMAC__
    m_defaultCursor = m_currentCursor = wxCURSOR_CROSS;
    m_showCrossHair = false;
#else
    m_defaultCursor = m_currentCursor = wxCURSOR_ARROW;
    m_showCrossHair = true;
#endif

    m_cursorLevel = 0;
    m_PrintIsMirrored = false;

    m_ClickTimer = (wxTimer*) NULL;
    m_doubleClickInterval = 250;
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:59,代码来源:eda_draw_panel.cpp

示例6: Pgm

void EDA_BASE_FRAME::SetLanguage( wxCommandEvent& event )
{
    int id = event.GetId();

    Pgm().SetLanguageIdentifier( id );
    Pgm().SetLanguage();
    ReCreateMenuBar();
    GetMenuBar()->Refresh();
}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:9,代码来源:basicframe.cpp

示例7: InitKiCadAboutNew

/**
 * Initializes the <code>AboutAppInfo</code> object with application specific information.
 *
 * This the object which holds all information about the application
 */
static void InitKiCadAboutNew( AboutAppInfo& info )
{
    // Set application specific icon
    const wxTopLevelWindow* const tlw = wxDynamicCast( Pgm().App().GetTopWindow(), wxTopLevelWindow );

    if( tlw )
        info.SetIcon( tlw->GetIcon() );
    else
    {
        wxBitmap    bitmap = KiBitmap( icon_kicad_xpm  );
        wxIcon      icon;

        icon.CopyFromBitmap( bitmap );

        info.SetIcon( icon );
    }

    /* Set title */
    info.SetAppName( wxT( ".: " ) + Pgm().App().GetAppName() + wxT( " :." ) );

    /* Copyright information */
    info.SetCopyright( wxT( "(C) 1992-2015 KiCad Developers Team" ) );

    /* KiCad build version */
    wxString version;
    version << wxT( "Version: " ) << GetBuildVersion()
#ifdef DEBUG
            << wxT( ", debug" )
#else
            << wxT( ", release" )
#endif
            << wxT( " build" );

    info.SetBuildVersion( version );

    /* wxWidgets version */
    wxString libVersion;
    libVersion
        << wxT( "wxWidgets " )
        << wxMAJOR_VERSION << wxT( "." )
        << wxMINOR_VERSION << wxT( "." )
        << wxRELEASE_NUMBER

    /* Unicode or ANSI version */
#if wxUSE_UNICODE
        << wxT( " Unicode " );
#else
        << wxT( " ANSI " );
开发者ID:sabas1080,项目名称:kicad-source-mirror,代码行数:53,代码来源:AboutDialog_main.cpp

示例8: cfg

void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aGroupName,
        const PARAM_CFG_ARRAY& aParams, const wxString& aFileName )
{
    std::unique_ptr<wxConfigBase> cfg( configCreate( aSList, aGroupName, aFileName ) );

    if( !cfg.get() )
    {
        // could not find template
        return;
    }

    cfg->SetPath( wxT( "/" ) );

    cfg->Write( wxT( "update" ), DateAndTime() );

    // @todo: pass in aLastClient wxString:
    cfg->Write( wxT( "last_client" ), Pgm().App().GetAppName() );

    // Save parameters
    cfg->DeleteGroup( aGroupName );     // Erase all data
    cfg->Flush();

    cfg->SetPath( aGroupName );
    cfg->Write( wxT( "version" ), CONFIG_VERSION );

    cfg->SetPath( wxT( "/" ) );

    wxConfigSaveParams( cfg.get(), aParams, aGroupName );

    cfg->SetPath( wxT( "/" ) );

    // cfg is deleted here by std::unique_ptr, that saves the *.pro file to disk
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:33,代码来源:project.cpp

示例9: DIALOG_MODULE_BOARD_EDITOR_BASE

DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME*  aParent,
                                                        MODULE*          aModule,
                                                        wxDC*            aDC ) :
    DIALOG_MODULE_BOARD_EDITOR_BASE( aParent ),
    m_OrientValidator( 1, &m_OrientValue )
{
    m_Parent = aParent;
    m_DC     = aDC;
    m_CurrentModule = aModule;

    // Give an icon
    wxIcon  icon;
    icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
    SetIcon( icon );

    m_OrientValidator.SetRange( -360.0, 360.0 );
    m_OrientValueCtrl->SetValidator( m_OrientValidator );
    m_OrientValidator.SetWindow( m_OrientValueCtrl );

    aParent->Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &Pgm() );
    m_PreviewPane = new PANEL_PREV_3D( m_Panel3D, aParent->Prj().Get3DCacheManager() );
    bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 );

    m_NoteBook->SetSelection( m_page );
    m_sdbSizerStdButtonsOK->SetDefault();

    GetSizer()->SetSizeHints( this );
    Centre();
    Layout();
}
开发者ID:PatMart,项目名称:kicad-source-mirror,代码行数:30,代码来源:dialog_edit_module_for_BoardEditor.cpp

示例10: _

void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
    m_canvas->SetAbortRequest( true );

    if( GetScreen()->IsModify() )
    {
        wxString msg = wxString::Format( _(
                "Save the changes in\n"
                "'%s'\n"
                "before closing?" ),
                GetChars( GetBoard()->GetFileName() )
                );

        int ii = DisplayExitDialog( this, msg );
        switch( ii )
        {
        case wxID_CANCEL:
            Event.Veto();
            return;

        case wxID_NO:
            break;

        case wxID_YES:
            // save the board. if the board has no name,
            // the ID_SAVE_BOARD_AS will actually made
            Files_io_from_id( ID_SAVE_BOARD );
            break;
        }
    }

    GetGalCanvas()->StopDrawing();

    // Delete the auto save file if it exists.
    wxFileName fn = GetBoard()->GetFileName();

    // Auto save file name is the normal file name prefixed with a '$'.
    fn.SetName( wxT( "$" ) + fn.GetName() );

    // Remove the auto save file on a normal close of Pcbnew.
    if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
    {
        wxString msg = wxString::Format( _(
                "The auto save file '%s' could not be removed!" ),
                GetChars( fn.GetFullPath() )
                );

        wxMessageBox( msg, Pgm().App().GetAppName(), wxOK | wxICON_ERROR, this );
    }

    // Delete board structs and undo/redo lists, to avoid crash on exit
    // when deleting some structs (mainly in undo/redo lists) too late
    Clear_Pcb( false );

    // do not show the window because ScreenPcb will be deleted and we do not
    // want any paint event
    Show( false );

    Destroy();
}
开发者ID:khaterahmohammadi,项目名称:kicad-source-mirror,代码行数:60,代码来源:pcbframe.cpp

示例11: PANEL_PREV_3D_BASE

PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aModule,
                              std::vector<MODULE_3D_SETTINGS> *aParentModelList ) :
    PANEL_PREV_3D_BASE( aParent, wxID_ANY )
{
    m_userUnits = aFrame->GetUserUnits();

    initPanel();

    // Initialize the color settings to draw the board and the footprint
    m_dummyBoard->SetColorsSettings( &aFrame->Settings().Colors() );

    m_parentModelList = aParentModelList;

    m_dummyModule = new MODULE( *aModule );
    m_dummyBoard->Add( m_dummyModule );

    // Set 3d viewer configuration for preview
    m_settings3Dviewer = new CINFO3D_VISU();

    bool option;
    Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false );
    m_settings3Dviewer->SetFlag( FL_MOUSEWHEEL_PANNING, option );

    // Create the 3D canvas
    m_previewPane = new EDA_3D_CANVAS( this, COGL_ATT_LIST::GetAttributesList( true ),
                                       m_dummyBoard, *m_settings3Dviewer,
                                       aFrame->Prj().Get3DCacheManager() );

    m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 );
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:30,代码来源:panel_prev_model.cpp

示例12: AddMenuItem

wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
                         const wxString& aHelpText, const wxBitmap& aImage,
                         wxItemKind aType = wxITEM_NORMAL )
{
    wxMenuItem* item;

    item = new wxMenuItem( aMenu, aId, aText, aHelpText, aType );

    // Retrieve the global applicaton show icon option:
    bool useImagesInMenus;
    Pgm().CommonSettings()->Read( USE_ICONS_IN_MENUS_KEY, &useImagesInMenus );

    if( useImagesInMenus )
    {
        if( aType == wxITEM_CHECK || aType == wxITEM_RADIO )
        {
    #if defined(  __WINDOWS__ )
            item->SetBitmaps( KiBitmap( checked_ok_xpm ), aImage );
            // A workaround to a strange bug on Windows, wx Widgets 3.0:
            // size of bitmaps is not taken in account for wxITEM_{CHECK,RADIO} menu
            // unless we call SetFont
            item->SetFont( *wxNORMAL_FONT );
    #endif
        }
        else if( aType != wxITEM_RADIO )
        {
            item->SetBitmap( aImage );
        }
    }

    aMenu->Append( item );

    return item;
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:34,代码来源:bitmap.cpp

示例13: OnRun

    int OnRun()             // overload wxApp virtual
    {
        int ret = -1;

        try
        {
            ret = wxApp::OnRun();
        }
        catch( const std::exception& e )
        {
            wxLogError( wxT( "Unhandled exception class: %s  what: %s" ),
                GetChars( FROM_UTF8( typeid(e).name() )),
                GetChars( FROM_UTF8( e.what() ) ) );;
        }
        catch( const IO_ERROR& ioe )
        {
            wxLogError( GetChars( ioe.errorText ) );
        }
        catch(...)
        {
            wxLogError( wxT( "Unhandled exception of unknown type" ) );
        }

        Pgm().OnPgmExit();

        return ret;
    }
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:27,代码来源:single_top.cpp

示例14: Pgm

void EDA_DRAW_FRAME::CommonSettingsChanged()
{
    EDA_BASE_FRAME::CommonSettingsChanged();

    wxConfigBase* settings = Pgm().CommonSettings();

    int autosaveInterval;
    settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval );
    SetAutoSaveInterval( autosaveInterval );

    int historySize;
    settings->Read( FILE_HISTORY_SIZE_KEY, &historySize, DEFAULT_FILE_HISTORY_SIZE );
    Kiface().GetFileHistory().SetMaxFiles( (unsigned) std::max( 0, historySize ) );

    bool option;
    settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option );
    m_canvas->SetEnableMousewheelPan( option );

    settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option );
    m_canvas->SetEnableZoomNoCenter( option );

    settings->Read( ENBL_AUTO_PAN_KEY, &option );
    m_canvas->SetEnableAutoPan( option );

    m_galDisplayOptions.ReadCommonConfig( *settings, this );
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:26,代码来源:eda_draw_frame.cpp

示例15: CreateHeaderInfoData

// Creates the header section
static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame )
{
    wxString    msg;
    BOARD *board = aFrame->GetBoard();

    fputs( "$HEADER\n", aFile );
    fputs( "GENCAD 1.4\n", aFile );

    // Please note: GenCAD syntax requires quoted strings if they can contain spaces
    msg.Printf( wxT( "USER \"%s %s\"\n" ),
               GetChars( Pgm().App().GetAppName() ),
               GetChars( GetBuildVersion() ) );
    fputs( TO_UTF8( msg ), aFile );

    msg = wxT( "DRAWING \"" ) + board->GetFileName() + wxT( "\"\n" );
    fputs( TO_UTF8( msg ), aFile );

    const TITLE_BLOCK&  tb = aFrame->GetTitleBlock();

    msg = wxT( "REVISION \"" ) + tb.GetRevision() + wxT( " " ) + tb.GetDate() + wxT( "\"\n" );

    fputs( TO_UTF8( msg ), aFile );
    fputs( "UNITS INCH\n", aFile );

    msg.Printf( wxT( "ORIGIN %g %g\n" ),
                MapXTo( aFrame->GetAuxOrigin().x ),
                MapYTo( aFrame->GetAuxOrigin().y ) );
    fputs( TO_UTF8( msg ), aFile );

    fputs( "INTERTRACK 0\n", aFile );
    fputs( "$ENDHEADER\n\n", aFile );

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


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