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


C++ TEXTE_MODULE::Flip方法代码示例

本文整理汇总了C++中TEXTE_MODULE::Flip方法的典型用法代码示例。如果您正苦于以下问题:C++ TEXTE_MODULE::Flip方法的具体用法?C++ TEXTE_MODULE::Flip怎么用?C++ TEXTE_MODULE::Flip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TEXTE_MODULE的用法示例。


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

示例1: placeTextModule

int DRAWING_TOOL::placeTextModule()
{
    TEXTE_MODULE* text = new TEXTE_MODULE( NULL );
    const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();

    assert( m_editModules );

    // Add a VIEW_GROUP that serves as a preview for the new item
    KIGFX::VIEW_GROUP preview( m_view );
    m_view->Add( &preview );

    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
    m_controls->ShowCursor( true );
    m_controls->SetSnapping( true );
    // do not capture or auto-pan until we start placing some text

    Activate();
    m_frame->SetToolID( ID_MODEDIT_TEXT_TOOL, wxCURSOR_PENCIL, _( "Add text" ) );
    bool placing = false;

    // Main loop: keep receiving events
    while( OPT_TOOL_EVENT evt = Wait() )
    {
        VECTOR2I cursorPos = m_controls->GetCursorPosition();

        if( evt->IsCancel() || evt->IsActivate() )
        {
            preview.Clear();
            preview.ViewUpdate();
            m_controls->SetAutoPan( false );
            m_controls->CaptureCursor( false );
            m_controls->ShowCursor( true );

            if( !placing || evt->IsActivate() )
            {
                delete text;
                break;
            }
            else
            {
                placing = false;  // start from the beginning
            }
        }

        else if( text && evt->Category() == TC_COMMAND )
        {
            if( evt->IsAction( &COMMON_ACTIONS::rotate ) )
            {
                text->Rotate( text->GetPosition(), m_frame->GetRotationAngle() );
                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
            }
            else if( evt->IsAction( &COMMON_ACTIONS::flip ) )
            {
                text->Flip( text->GetPosition() );
                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
            }
        }

        else if( evt->IsClick( BUT_LEFT ) )
        {
            if( !placing )
            {
                text->SetSize( dsnSettings.m_ModuleTextSize );
                text->SetThickness( dsnSettings.m_ModuleTextWidth );
                text->SetTextPosition( wxPoint( cursorPos.x, cursorPos.y ) );

                DialogEditModuleText textDialog( m_frame, text, NULL );
                placing = textDialog.ShowModal() && ( text->GetText().Length() > 0 );

                if( !placing )
                    continue;

                m_controls->CaptureCursor( true );
                m_controls->SetAutoPan( true );
                m_controls->ShowCursor( false );
                text->SetParent( m_board->m_Modules );  // it has to set after the settings dialog
                                                        // otherwise the dialog stores it in undo buffer
                preview.Add( text );
            }
            else
            {
                assert( text->GetText().Length() > 0 );
                assert( text->GetSize().x > 0 && text->GetSize().y > 0 );

                text->SetLocalCoord();
                text->ClearFlags();

                // Module has to be saved before any modification is made
                m_frame->SaveCopyInUndoList( m_board->m_Modules, UR_MODEDIT );
                m_board->m_Modules->SetLastEditTime();
                m_board->m_Modules->GraphicalItems().PushFront( text );

                m_view->Add( text );
                text->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );

                m_frame->OnModify();

                preview.Remove( text );
                m_controls->CaptureCursor( false );
                m_controls->SetAutoPan( false );
//.........这里部分代码省略.........
开发者ID:hzeller,项目名称:kicad-source-mirror,代码行数:101,代码来源:drawing_tool.cpp


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