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


C++ BASE_SCREEN类代码示例

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


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

示例1: Show_Pad_Move

/* Draw in drag mode when moving a pad.
 */
static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
                           bool aErase )
{
    TRACK*       Track;
    BASE_SCREEN* screen = aPanel->GetScreen();
    D_PAD*       pad    = s_CurrentSelectedPad;

    if( pad == NULL )       // Should not occur
        return;

    if( aErase )
        pad->Draw( aPanel, aDC, GR_XOR );

    pad->SetPosition( screen->GetCrossHairPosition() );
    pad->Draw( aPanel, aDC, GR_XOR );

    for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
    {
        Track = g_DragSegmentList[ii].m_Track;

        if( aErase )
            Track->Draw( aPanel, aDC, GR_XOR );

        g_DragSegmentList[ii].SetTrackEndsCoordinates( wxPoint(0, 0) );

        Track->Draw( aPanel, aDC, GR_XOR );
    }
}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:30,代码来源:move-drag_pads.cpp

示例2: GetScreen

void EDA_DRAW_FRAME::SetPresetGrid( int aIndex )
{
    BASE_SCREEN * screen = GetScreen();

    if( ! screen->GridExists( aIndex + ID_POPUP_GRID_LEVEL_1000 ) )
        aIndex = screen->GetGrids()[0].m_CmdId;

    // aIndex is a Command Id relative to ID_POPUP_GRID_LEVEL_1000 comand id code.
    // we need an index in grid list (the cmd id in list is is screen->GetGrids()[0].m_CmdId):
    int glistIdx = aIndex + ID_POPUP_GRID_LEVEL_1000 - screen->GetGrids()[0].m_CmdId;

    if( m_gridSelectBox )
    {
        if( glistIdx < 0 || glistIdx >= (int) m_gridSelectBox->GetCount() )
        {
            wxASSERT_MSG( false, "Invalid grid index" );
            return;
        }

        m_gridSelectBox->SetSelection( glistIdx );
    }

    // Be sure m_LastGridSizeId is up to date.
    m_LastGridSizeId = aIndex;
    GetScreen()->SetGrid( aIndex + ID_POPUP_GRID_LEVEL_1000 );

    // Put cursor on new grid
    SetCrossHairPosition( RefPos( true ) );
}
开发者ID:cpavlina,项目名称:kicad,代码行数:29,代码来源:draw_frame.cpp

示例3: AbortMoveAndEditTarget

static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
    BASE_SCREEN* screen  = Panel->GetScreen();
    PCB_TARGET*  target = (PCB_TARGET*) screen->GetCurItem();

    ( (PCB_EDIT_FRAME*) Panel->GetParent() )->SetCurItem( NULL );

    Panel->SetMouseCapture( NULL, NULL );

    if( target == NULL )
        return;

    target->Draw( Panel, DC, GR_XOR );

    if( target->IsNew() )     // If it is new, delete it
    {
        target->Draw( Panel, DC, GR_XOR );
        target->DeleteStructure();
        target = NULL;
    }
    else    // it is an existing item: retrieve initial values of parameters
    {
        if( ( target->GetFlags() & (IN_EDIT | IS_MOVED) ) )
        {
            target->SetPosition( s_TargetCopy.GetPosition() );
            target->SetWidth( s_TargetCopy.GetWidth() );
            target->SetSize( s_TargetCopy.GetSize() );
            target->SetShape( s_TargetCopy.GetShape() );
        }

        target->ClearFlags();
        target->Draw( Panel, DC, GR_OR );
    }
}
开发者ID:asutp,项目名称:kicad-source-mirror,代码行数:34,代码来源:target_edit.cpp

示例4: AbortMoveTextModule

/**
 * Abort text move in progress.
 *
 * If a text is selected, its initial coordinates are regenerated.
 */
static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
    BASE_SCREEN*  screen = Panel->GetScreen();
    TEXTE_MODULE* Text   = static_cast<TEXTE_MODULE*>( screen->GetCurItem() );
    MODULE*       Module;

    Panel->SetMouseCapture( NULL, NULL );

    if( Text == NULL )
        return;

    Module = static_cast<MODULE*>( Text->GetParent() );

    Text->DrawUmbilical( Panel, DC, GR_XOR, -MoveVector );
    Text->Draw( Panel, DC, GR_XOR, MoveVector );

    // If the text was moved (the move does not change internal data)
    // it could be rotated while moving. So set old value for orientation
    if( Text->IsMoving() )
        Text->SetTextAngle( TextInitialOrientation );

    // Redraw the text
    Panel->RefreshDrawingRect( Text->GetBoundingBox() );

    // leave it at (0,0) so we can use it Rotate when not moving.
    MoveVector.x = MoveVector.y = 0;

    Text->ClearFlags();
    Module->ClearFlags();

    screen->SetCurItem( NULL );
}
开发者ID:johnbeard,项目名称:kicad,代码行数:37,代码来源:edtxtmod.cpp

示例5: Show_MoveTexte_Module

static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
                                   bool aErase )
{
    BASE_SCREEN*  screen = aPanel->GetScreen();
    TEXTE_MODULE* Text   = static_cast<TEXTE_MODULE*>( screen->GetCurItem() );

    if( Text == NULL )
        return;

    // Erase umbilical and text if necessary
    if( aErase )
    {
        Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );
        Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
    }

    MoveVector = TextInitialPosition - aPanel->GetParent()->GetCrossHairPosition();

    // Draw umbilical if text moved
    if( MoveVector.x || MoveVector.y )
        Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );

    // Redraw text
    Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
}
开发者ID:johnbeard,项目名称:kicad,代码行数:25,代码来源:edtxtmod.cpp

示例6: Move_Segment

static void Move_Segment(WinEDA_DrawPanel * panel, wxDC * DC, bool erase)
/************************************************************************/
/* redessin du contour du Segment Edge lors des deplacements de la souris */
{
BASE_SCREEN * screen = panel->GetScreen();
EDGE_MODULE * Edge = (EDGE_MODULE * ) screen->m_CurrentItem;

	if( Edge == NULL ) return;

MODULE * Module = (MODULE*) Edge->m_Parent;

	screen->Trace_Curseur(panel, DC);

	if( erase )
		{
		Edge->Draw(panel, DC, MoveVector, GR_XOR);
		}

	MoveVector.x = -(screen->m_Curseur.x - CursorInitialPosition.x);
	MoveVector.y = -(screen->m_Curseur.y - CursorInitialPosition.y);

 	Edge->Draw(panel, DC, MoveVector, GR_XOR);

	screen->Trace_Curseur(panel, DC);

	Module->Set_Rectangle_Encadrement();
}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:27,代码来源:edgemod.cpp

示例7: ShowEdgeModule

static void ShowEdgeModule(WinEDA_DrawPanel * panel, wxDC * DC, bool erase)
/************************************************************************/
/* Affiche le segment Edge Module en cours de trace
*/
{
BASE_SCREEN * screen = panel->GetScreen();
EDGE_MODULE * Edge = (EDGE_MODULE * ) screen->m_CurrentItem;

	if( Edge == NULL ) return;

MODULE * Module = (MODULE*) Edge->m_Parent;

	screen->Trace_Curseur(panel, DC);

 //	if( erase )
		{
		Edge->Draw(panel, DC, wxPoint(0, 0), GR_XOR);
		}

	Edge->m_End = screen->m_Curseur;

	/* Mise a jour des coord relatives */
	Edge->m_End0.x = Edge->m_End.x - Module->m_Pos.x;
	Edge->m_End0.y = Edge->m_End.y - Module->m_Pos.y ;
	RotatePoint((int*)&Edge->m_End0.x,
				(int*)&Edge->m_End0.y, - Module->m_Orient);

 	Edge->Draw(panel, DC, wxPoint(0, 0), GR_XOR);

	screen->Trace_Curseur(panel, DC);

	Module->Set_Rectangle_Encadrement();
}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:33,代码来源:edgemod.cpp

示例8: ShowNewEdgeModule

/* Redraw the current graphic item during its creation
 * Use this function to show a new outline, in begin command
 */
static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
                               bool aErase )
{
    BASE_SCREEN* screen = aPanel->GetScreen();
    EDGE_MODULE* edge   = (EDGE_MODULE*) screen->GetCurItem();

    if( edge == NULL )
        return;

    MODULE* module = (MODULE*) edge->GetParent();

    //  if( erase )
    {
        edge->Draw( aPanel, aDC, GR_XOR );
    }

    edge->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );

    // Update relative coordinate.
    edge->SetEnd0( edge->GetEnd() - module->GetPosition() );

    wxPoint pt( edge->GetEnd0() );

    RotatePoint( &pt, -module->GetOrientation() );

    edge->SetEnd0( pt );

    edge->Draw( aPanel, aDC, GR_XOR );

    module->CalculateBoundingBox();
}
开发者ID:johnbeard,项目名称:kicad,代码行数:34,代码来源:edgemod.cpp

示例9: updateGrid

void PCBNEW_CONTROL::updateGrid()
{
    BASE_SCREEN* screen = m_frame->GetScreen();
    //GRID_TYPE grid = screen->GetGrid( idx );
    getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
    getView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
开发者ID:PatMart,项目名称:kicad-source-mirror,代码行数:7,代码来源:pcbnew_control.cpp

示例10: GetScreen

void EDA_DRAW_FRAME::SetPrevGrid()
{
    BASE_SCREEN * screen = GetScreen();
    int grid_cnt = screen->GetGridCount();

    int new_grid_idx = screen->GetGridId() - ID_POPUP_GRID_LEVEL_1000 - 1;

    if( new_grid_idx < 0 )
        new_grid_idx = grid_cnt - 1;

    SetPresetGrid( new_grid_idx );
}
开发者ID:bpasu,项目名称:kicad-source-mirror,代码行数:12,代码来源:draw_frame.cpp

示例11: GetGalCanvas

void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
{
    KIGFX::VIEW* view = GetGalCanvas()->GetView();
    KIGFX::GAL* gal = GetGalCanvas()->GetGAL();

    double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();

    // Display the same view after canvas switching
    if( aEnable )
    {
        BASE_SCREEN* screen = GetScreen();

        // Switch to GAL rendering
        if( !IsGalCanvasActive() )
        {
            // Set up viewport
            double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() );
            view->SetScale( zoom );
            view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
        }

        // Set up grid settings
        gal->SetGridVisibility( IsGridVisible() );
        gal->SetGridSize( VECTOR2D( screen->GetGridSize().x, screen->GetGridSize().y ) );
        gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) );
    }
    else
    {
        // Switch to standard rendering
        if( IsGalCanvasActive() )
        {
            // Change view settings only if GAL was active previously
            double zoom = 1.0 / ( zoomFactor * view->GetScale() );
            m_canvas->SetZoom( zoom );

            VECTOR2D center = view->GetCenter();
            RedrawScreen( wxPoint( center.x, center.y ), false );
        }
    }

    m_canvas->SetEvtHandlerEnabled( !aEnable );
    GetGalCanvas()->SetEvtHandlerEnabled( aEnable );

    // Switch panes
    m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable );
    m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable );
    m_auimgr.Update();

    // Reset current tool on switch();
    SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );

    m_galCanvasActive = aEnable;
}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:53,代码来源:draw_frame.cpp

示例12: GridPreset

int PCBNEW_CONTROL::GridPreset( const TOOL_EVENT& aEvent )
{
    long idx = aEvent.Parameter<long>();

    m_frame->SetPresetGrid( idx );
    BASE_SCREEN* screen = m_frame->GetScreen();
    GRID_TYPE grid = screen->GetGrid( idx );

    getView()->GetGAL()->SetGridSize( VECTOR2D( grid.m_Size ) );
    getView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );

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

示例13: switch

void WinEDA_DrawPanel::OnKeyEvent(wxKeyEvent& event)
/****************************************************/
{
long key, localkey;
bool escape = FALSE;

	key = localkey = event.m_keyCode;

	switch( localkey )
		{
		case WXK_CONTROL:
		case WXK_CAPITAL:
		case WXK_SHIFT:
		case WXK_NUMLOCK:
		case WXK_LBUTTON:
		case WXK_RBUTTON:
		case 0x0135:	/* Alt key */
			return;

		case WXK_ESCAPE:
			escape = m_AbortRequest = TRUE;
			break;
		}


	if( event.ControlDown() ) localkey |= GR_KB_CTRL;
	if( event.AltDown() ) localkey |= GR_KB_ALT;
	if( event.ShiftDown() && (key > 256) ) localkey |= GR_KB_SHIFT;


wxClientDC DC(this);
BASE_SCREEN * Screen = GetScreen();

	PrepareGraphicContext(&DC);

	g_KeyPressed = localkey;

	if ( escape )
	{
		if( Screen->ManageCurseur && Screen->ForceCloseManageCurseur )
		{
			SetCursor(m_PanelCursor = m_PanelDefaultCursor);
			Screen->ForceCloseManageCurseur(m_Parent, &DC);
			SetCursor(m_PanelCursor = m_PanelDefaultCursor);
		}
		else m_Parent->SetToolID(0, m_PanelCursor = m_PanelDefaultCursor = wxCURSOR_ARROW, wxEmptyString);
	}

	m_Parent->GeneralControle(&DC, Screen->m_MousePosition);
}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:50,代码来源:drawpanel.cpp

示例14: m_parent

GRID_MENU::GRID_MENU( EDA_DRAW_FRAME* aParent ) : m_parent( aParent )
{
    BASE_SCREEN* screen = aParent->GetScreen();

    SetTitle( _( "Grid" ) );
    SetIcon( grid_select_xpm );

    wxArrayString gridsList;
    screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );

    for( unsigned int i = 0; i < gridsList.GetCount(); ++i )
    {
        GRID_TYPE& grid = screen->GetGrid( i );
        Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
    }
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:16,代码来源:grid_menu.cpp

示例15: ShowTargetShapeWhileMovingMouse

// Redraw the contour of the track while moving the mouse
static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
                                             const wxPoint& aPosition, bool aErase )
{
    BASE_SCREEN* screen  = aPanel->GetScreen();
    PCB_TARGET*  target = (PCB_TARGET*) screen->GetCurItem();

    if( target == NULL )
        return;

    if( aErase )
        target->Draw( aPanel, aDC, GR_XOR );

    target->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );

    target->Draw( aPanel, aDC, GR_XOR );
}
开发者ID:asutp,项目名称:kicad-source-mirror,代码行数:17,代码来源:target_edit.cpp


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