本文整理汇总了C++中BASE_SCREEN::GetCurItem方法的典型用法代码示例。如果您正苦于以下问题:C++ BASE_SCREEN::GetCurItem方法的具体用法?C++ BASE_SCREEN::GetCurItem怎么用?C++ BASE_SCREEN::GetCurItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BASE_SCREEN
的用法示例。
在下文中一共展示了BASE_SCREEN::GetCurItem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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 );
}
}
示例3: 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 );
}
示例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 );
}
示例5: 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 );
}
示例6: MoveOrResizeSheet
/* Move selected sheet with the cursor.
* Callback function use by m_mouseCaptureCallback.
*/
static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
wxPoint moveVector;
BASE_SCREEN* screen = aPanel->GetScreen();
SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();
if( aErase )
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
wxPoint pos = sheet->GetPosition();
if( sheet->IsResized() )
{
int width = aPanel->GetParent()->GetCrossHairPosition().x - sheet->GetPosition().x;
int height = aPanel->GetParent()->GetCrossHairPosition().y - sheet->GetPosition().y;
// If the sheet doesn't have any pins, clamp the minimum size to the default values.
width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width;
height = ( height < MIN_SHEET_HEIGHT ) ? MIN_SHEET_HEIGHT : height;
if( sheet->HasPins() )
{
int gridSizeX = KiROUND( screen->GetGridSize().x );
int gridSizeY = KiROUND( screen->GetGridSize().y );
// If the sheet has pins, use the pin positions to clamp the minimum height.
height = ( height < sheet->GetMinHeight() + gridSizeY ) ?
sheet->GetMinHeight() + gridSizeY : height;
width = ( width < sheet->GetMinWidth() + gridSizeX ) ?
sheet->GetMinWidth() + gridSizeX : width;
}
wxPoint grid = aPanel->GetParent()->GetNearestGridPosition(
wxPoint( pos.x + width, pos.y + height ) );
sheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );
}
else if( sheet->IsMoving() )
{
moveVector = aPanel->GetParent()->GetCrossHairPosition() - pos;
sheet->Move( moveVector );
}
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}
示例7: ShowCurrentOutlineWhileMoving
/* Redraw the current moved graphic item when mouse is moving
* Use this function to show an existing outline, in move command
*/
static void ShowCurrentOutlineWhileMoving( 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( aErase )
{
edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
}
MoveVector = -(aPanel->GetParent()->GetCrossHairPosition() - CursorInitialPosition);
edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
module->CalculateBoundingBox();
}
示例8: OnMouseEvent
void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{
int localbutt = 0;
BASE_SCREEN* screen = GetScreen();
if( !screen )
return;
/* Adjust value to filter mouse displacement before consider the drag
* mouse is really a drag command, not just a movement while click
*/
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5
if( event.Leaving() )
m_canStartBlock = -1;
if( !IsMouseCaptured() ) // No mouse capture in progress.
SetAutoPanRequest( false );
if( GetParent()->IsActive() )
SetFocus();
else
return;
if( !event.IsButton() && !event.Moving() && !event.Dragging() )
return;
if( event.RightDown() )
{
OnRightClick( event );
return;
}
if( m_ignoreMouseEvents )
return;
if( event.LeftDown() )
localbutt = GR_M_LEFT_DOWN;
if( event.ButtonDClick( 1 ) )
localbutt = GR_M_LEFT_DOWN | GR_M_DCLICK;
if( event.MiddleDown() )
localbutt = GR_M_MIDDLE_DOWN;
INSTALL_UNBUFFERED_DC( DC, this );
DC.SetBackground( *wxBLACK_BRUSH );
// Compute the cursor position in drawing (logical) units.
GetParent()->SetMousePosition( event.GetLogicalPosition( DC ) );
int kbstat = 0;
if( event.ShiftDown() )
kbstat |= GR_KB_SHIFT;
if( event.ControlDown() )
kbstat |= GR_KB_CTRL;
if( event.AltDown() )
kbstat |= GR_KB_ALT;
// Calling Double Click and Click functions :
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
{
if( m_ClickTimer )
{
m_ClickTimer->Stop();
wxDELETE( m_ClickTimer );
}
GetParent()->OnLeftDClick( &DC, GetParent()->RefPos( true ) );
// inhibit a response to the mouse left button release,
// because we have a double click, and we do not want a new
// OnLeftClick command at end of this Double Click
m_ignoreNextLeftButtonRelease = true;
}
else if( event.LeftUp() )
{
// A block command is in progress: a left up is the end of block
// or this is the end of a double click, already seen
// Note also m_ignoreNextLeftButtonRelease can be set by
// the call to OnLeftClick(), so do not change it after calling OnLeftClick
bool ignoreEvt = m_ignoreNextLeftButtonRelease;
m_ignoreNextLeftButtonRelease = false;
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt )
{
EDA_ITEM* item = screen->GetCurItem();
m_CursorClickPos = GetParent()->RefPos( true );
// If we have an item already selected, or we are using a tool,
// we won't use the disambiguation menu so process the click immediately
if( ( item && item->GetFlags() ) || GetParent()->GetToolId() != ID_NO_TOOL_SELECTED )
GetParent()->OnLeftClick( &DC, m_CursorClickPos );
else
{
wxDELETE( m_ClickTimer );
m_ClickTimer = new wxTimer(this, ID_MOUSE_DOUBLECLICK);
m_ClickTimer->StartOnce( m_doubleClickInterval );
//.........这里部分代码省略.........