本文整理汇总了C++中INSTALL_UNBUFFERED_DC函数的典型用法代码示例。如果您正苦于以下问题:C++ INSTALL_UNBUFFERED_DC函数的具体用法?C++ INSTALL_UNBUFFERED_DC怎么用?C++ INSTALL_UNBUFFERED_DC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了INSTALL_UNBUFFERED_DC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INSTALL_UNBUFFERED_DC
void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
{
INSTALL_UNBUFFERED_DC( dc, m_canvas );
m_canvas->CrossHairOff( &dc );
m_cursorShape = !m_cursorShape;
m_canvas->CrossHairOn( &dc );
}
示例2: GetClientSize
void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
{
if( m_mouseCaptureCallback == NULL ) // No command in progress.
m_requestAutoPan = false;
if( !m_enableAutoPan || !m_requestAutoPan || m_ignoreMouseEvents )
return;
// Auto pan when mouse has left the client window
// Ensure the cross_hair position is updated,
// because it will be used to center the screen.
// We use a position inside the client window
wxSize size = GetClientSize();
wxPoint cross_hair_pos = event.GetPosition();
cross_hair_pos.x = std::min( cross_hair_pos.x, size.x );
cross_hair_pos.y = std::min( cross_hair_pos.y, size.x );
cross_hair_pos.x = std::max( cross_hair_pos.x, 0 );
cross_hair_pos.y = std::max( cross_hair_pos.y, 0 );
INSTALL_UNBUFFERED_DC( dc, this );
cross_hair_pos.x = dc.DeviceToLogicalX( cross_hair_pos.x );
cross_hair_pos.y = dc.DeviceToLogicalY( cross_hair_pos.y );
GetParent()->SetCrossHairPosition( cross_hair_pos );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd );
event.Skip();
}
示例3: switch
void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
{
int localkey;
wxPoint pos;
localkey = event.GetKeyCode();
switch( localkey )
{
default:
break;
case WXK_ESCAPE:
m_abortRequest = true;
if( IsMouseCaptured() )
EndMouseCapture();
else
EndMouseCapture( ID_NO_TOOL_SELECTED, m_defaultCursor, wxEmptyString );
break;
}
/* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
* They have an ascii code from 1 to 27 remapped
* to GR_KB_CTRL + 'A' to GR_KB_CTRL + 'Z'
*/
if( event.ControlDown() && localkey >= WXK_CONTROL_A && localkey <= WXK_CONTROL_Z )
localkey += 'A' - 1;
/* Disallow shift for keys that have two keycodes on them (e.g. number and
* punctuation keys) leaving only the "letter keys" of A-Z.
* Then, you can have, e.g. Ctrl-5 and Ctrl-% (GB layout)
* and Ctrl-( and Ctrl-5 (FR layout).
* Otherwise, you'd have to have to say Ctrl-Shift-5 on a FR layout
*/
bool keyIsLetter = ( localkey >= 'A' && localkey <= 'Z' ) ||
( localkey >= 'a' && localkey <= 'z' );
if( event.ShiftDown() && ( keyIsLetter || localkey > 256 ) )
localkey |= GR_KB_SHIFT;
if( event.ControlDown() )
localkey |= GR_KB_CTRL;
if( event.AltDown() )
localkey |= GR_KB_ALT;
INSTALL_UNBUFFERED_DC( DC, this );
// Some key commands use the current mouse position: refresh it.
pos = wxGetMousePosition() - GetScreenPosition();
// Compute the cursor position in drawing units. Also known as logical units to wxDC.
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
GetParent()->SetMousePosition( pos );
if( !GetParent()->GeneralControl( &DC, pos, localkey ) )
event.Skip();
}
示例4: INSTALL_UNBUFFERED_DC
wxPoint EDA_DRAW_PANEL::ToLogicalXY( const wxPoint& pos )
{
wxPoint ret;
INSTALL_UNBUFFERED_DC( dc, this );
ret.x = dc.DeviceToLogicalX( pos.x );
ret.y = dc.DeviceToLogicalY( pos.y );
return ret;
}
示例5: GetScreen
void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
{
SCH_SCREEN* screen = GetScreen();
SCH_ITEM* item = screen->GetCurItem();
wxCHECK_RET( item != NULL && item->Type() == SCH_COMPONENT_T,
wxT( "Cannot select unit of invalid schematic item." ) );
INSTALL_UNBUFFERED_DC( dc, m_canvas );
m_canvas->MoveCursorToCrossHair();
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
int unit = aEvent.GetId() + 1 - ID_POPUP_SCH_SELECT_UNIT1;
LIB_PART* part = GetLibPart( component->GetLibId() );
if( !part )
return;
int unitCount = part->GetUnitCount();
wxCHECK_RET( (unit >= 1) && (unit <= unitCount),
wxString::Format( wxT( "Cannot select unit %d from component " ), unit ) +
part->GetName() );
if( unitCount <= 1 || component->GetUnit() == unit )
return;
if( unit > unitCount )
unit = unitCount;
STATUS_FLAGS flags = component->GetFlags();
if( !flags ) // No command in progress: save in undo list
SaveCopyInUndoList( component, UR_CHANGED );
if( flags )
component->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
component->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
/* Update the unit number. */
component->SetUnitSelection( m_CurrentSheet, unit );
component->SetUnit( unit );
component->ClearFlags();
component->SetFlags( flags ); // Restore m_Flag modified by SetUnit()
if( m_autoplaceFields )
component->AutoAutoplaceFields( GetScreen() );
if( screen->TestDanglingEnds() )
m_canvas->Refresh();
OnModify();
}
示例6: INSTALL_UNBUFFERED_DC
void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
{
INSTALL_UNBUFFERED_DC( dc, m_canvas );
m_canvas->CrossHairOff( &dc );
auto& galOpts = GetGalDisplayOptions();
galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
galOpts.NotifyChanged();
m_canvas->CrossHairOn( &dc );
}
示例7: wxCHECK_RET
void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
{
wxCHECK_RET( m_component != NULL,
wxT( "Cannot create new part from non-existent current part." ) );
INSTALL_UNBUFFERED_DC( dc, m_canvas );
m_canvas->CrossHairOff( &dc );
EditField( &m_component->GetValueField() );
m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( &dc );
}
示例8: clientRect
void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition )
{
if( GetParent()->IsGalCanvasActive() )
return;
int x, y, xPpu, yPpu;
wxPoint screenPos, drawingPos;
wxRect clientRect( wxPoint( 0, 0 ), GetClientSize() );
INSTALL_UNBUFFERED_DC( dc, this );
screenPos.x = dc.LogicalToDeviceX( aPosition.x );
screenPos.y = dc.LogicalToDeviceY( aPosition.y );
// Scroll if the requested mouse position cursor is outside the drawing area.
if( !clientRect.Contains( screenPos ) )
{
GetViewStart( &x, &y );
GetScrollPixelsPerUnit( &xPpu, &yPpu );
CalcUnscrolledPosition( screenPos.x, screenPos.y, &drawingPos.x, &drawingPos.y );
wxLogTrace( kicadTraceCoords,
wxT( "MoveCursor() initial screen position(%d, %d) " ) \
wxT( "rectangle(%d, %d, %d, %d) view(%d, %d)" ),
screenPos.x, screenPos.y, clientRect.x, clientRect.y,
clientRect.width, clientRect.height, x, y );
if( screenPos.y < clientRect.GetTop() )
y -= m_scrollIncrementY * yPpu;
else if( screenPos.y > clientRect.GetBottom() )
y += m_scrollIncrementY * yPpu;
else if( clientRect.GetRight() < screenPos.x )
x += m_scrollIncrementX * xPpu;
else
x -= m_scrollIncrementX * xPpu;
Scroll( x, y );
CalcScrolledPosition( drawingPos.x, drawingPos.y, &screenPos.x, &screenPos.y );
wxLogTrace( kicadTraceCoords,
wxT( "MoveCursor() scrolled screen position(%d, %d) view(%d, %d)" ),
screenPos.x, screenPos.y, x, y );
}
WarpPointer( screenPos.x, screenPos.y );
}
示例9: GetScreen
void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
{
SCH_ITEM * curr_item = GetScreen()->GetCurItem();
if( !curr_item || curr_item->GetFlags() )
return;
INSTALL_UNBUFFERED_DC( dc, m_canvas );
switch( curr_item->Type() )
{
case SCH_COMPONENT_T:
{
SCH_COMPONENT* newitem;
newitem = new SCH_COMPONENT( *( (SCH_COMPONENT*) curr_item ) );
newitem->SetTimeStamp( GetNewTimeStamp() );
newitem->ClearAnnotation( NULL );
newitem->SetFlags( IS_NEW );
// Draw the new part, MoveItem() expects it to be already on screen.
newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
PrepareMoveItem( newitem, &dc );
}
break;
case SCH_TEXT_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
{
SCH_TEXT* newitem = (SCH_TEXT*) curr_item->Clone();
newitem->SetFlags( IS_NEW );
// Draw the new item, MoveItem() expects it to be already on screen.
newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
PrepareMoveItem( newitem, &dc );
}
break;
default:
break;
}
}
示例10: INSTALL_UNBUFFERED_DC
bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event )
{
wxPoint pos;
wxMenu MasterMenu;
INSTALL_UNBUFFERED_DC( dc, this );
pos = event.GetLogicalPosition( dc );
if( !GetParent()->OnRightClick( pos, &MasterMenu ) )
return false;
GetParent()->AddMenuZoomAndGrid( &MasterMenu );
pos = event.GetPosition();
m_ignoreMouseEvents = true;
PopupMenu( &MasterMenu, pos );
MoveCursorToCrossHair();
m_ignoreMouseEvents = false;
return true;
}
示例11: INSTALL_UNBUFFERED_DC
void LIB_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
{
INSTALL_UNBUFFERED_DC( dc, m_canvas );
SCH_SCREEN* screen = GetScreen();
// Allows block rotate operation on hot key.
if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{
if( aEvent.GetId() == ID_LIBEDIT_MIRROR_X )
{
m_canvas->MoveCursorToCrossHair();
screen->m_BlockLocate.SetMessageBlock( this );
screen->m_BlockLocate.SetCommand( BLOCK_MIRROR_X );
HandleBlockEnd( &dc );
}
else if( aEvent.GetId() == ID_LIBEDIT_MIRROR_Y )
{
m_canvas->MoveCursorToCrossHair();
screen->m_BlockLocate.SetMessageBlock( this );
screen->m_BlockLocate.SetCommand( BLOCK_MIRROR_Y );
HandleBlockEnd( &dc );
}
}
}
示例12: INSTALL_UNBUFFERED_DC
void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos, bool aWarp )
{
// factored out of pcbnew/find.cpp
INSTALL_UNBUFFERED_DC( dc, m_canvas );
// There may be need to reframe the drawing.
if( !m_canvas->IsPointOnDisplay( aPos ) )
{
SetCrossHairPosition( aPos );
RedrawScreen( aPos, aWarp );
}
else
{
// Put cursor on item position
m_canvas->CrossHairOff( &dc );
SetCrossHairPosition( aPos );
if( aWarp )
m_canvas->MoveCursorToCrossHair();
}
m_canvas->CrossHairOn( &dc );
m_canvas->CrossHairOn( &dc );
}
示例13: GetScreen
void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
int id = event.GetId();
wxPoint pos;
SCH_SCREEN* screen = GetScreen();
SCH_ITEM* item = screen->GetCurItem();
pos = wxGetMousePosition();
pos.y += 20;
// If needed, stop the current command and deselect current tool
switch( id )
{
case wxID_CUT:
case wxID_COPY:
case ID_POPUP_CANCEL_CURRENT_COMMAND:
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
case ID_POPUP_SCH_BEGIN_WIRE:
case ID_POPUP_SCH_BEGIN_BUS:
case ID_POPUP_END_LINE:
case ID_POPUP_SCH_SET_SHAPE_TEXT:
case ID_POPUP_SCH_CLEANUP_SHEET:
case ID_POPUP_SCH_END_SHEET:
case ID_POPUP_SCH_RESIZE_SHEET:
case ID_POPUP_IMPORT_GLABEL:
case ID_POPUP_SCH_INIT_CMP:
case ID_POPUP_SCH_DISPLAYDOC_CMP:
case ID_POPUP_SCH_EDIT_CONVERT_CMP:
case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_ZOOM_BLOCK:
case ID_POPUP_DRAG_BLOCK:
case ID_POPUP_COPY_BLOCK:
case ID_POPUP_SCH_DELETE_NODE:
case ID_POPUP_SCH_DELETE_CONNECTION:
case ID_POPUP_SCH_ENTER_SHEET:
case ID_POPUP_SCH_LEAVE_SHEET:
case ID_POPUP_SCH_ADD_JUNCTION:
case ID_POPUP_SCH_ADD_LABEL:
case ID_POPUP_SCH_GETINFO_MARKER:
/* At this point: Do nothing. these commands do not need to stop the
* current command (mainly a block command) or reset the current state
* They will be executed later, in next switch structure.
*/
break;
case ID_POPUP_SCH_DELETE_CMP:
case ID_POPUP_SCH_DELETE:
// Stop the current command (if any) but keep the current tool
m_canvas->EndMouseCapture();
break;
default:
// Stop the current command and deselect the current tool
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
break;
}
INSTALL_UNBUFFERED_DC( dc, m_canvas );
item = screen->GetCurItem(); // Can be modified by previous calls.
switch( id )
{
case ID_HIERARCHY:
InstallHierarchyFrame( &dc, pos );
SetRepeatItem( NULL );
break;
case wxID_CUT:
if( screen->m_BlockLocate.GetCommand() != BLOCK_MOVE )
break;
screen->m_BlockLocate.SetCommand( BLOCK_DELETE );
screen->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc );
SetRepeatItem( NULL );
SetSheetNumberAndCount();
break;
case wxID_PASTE:
HandleBlockBegin( &dc, BLOCK_PASTE, GetCrossHairPosition() );
break;
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
m_canvas->MoveCursorToCrossHair();
SetBusEntryShape( &dc, dynamic_cast<SCH_BUS_ENTRY_BASE*>( item ), '/' );
break;
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
m_canvas->MoveCursorToCrossHair();
SetBusEntryShape( &dc, dynamic_cast<SCH_BUS_ENTRY_BASE*>( item ), '\\' );
break;
case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( m_canvas->IsMouseCaptured() )
//.........这里部分代码省略.........
示例14: wxRect
void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
{
if( m_ignoreMouseEvents )
return;
wxRect rect = wxRect( wxPoint( 0, 0 ), GetClientSize() );
// Ignore scroll events if the cursor is outside the drawing area.
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|| !rect.Contains( event.GetPosition() ) )
{
wxLogTrace( kicadTraceCoords,
wxT( "OnMouseWheel() position(%d, %d) rectangle(%d, %d, %d, %d)" ),
event.GetPosition().x, event.GetPosition().y,
rect.x, rect.y, rect.width, rect.height );
event.Skip();
return;
}
INSTALL_UNBUFFERED_DC( dc, this );
GetParent()->SetCrossHairPosition( event.GetLogicalPosition( dc ) );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
bool offCenterReq = event.ControlDown() && event.ShiftDown();
offCenterReq = offCenterReq || m_enableZoomNoCenter;
int axis = event.GetWheelAxis();
int wheelRotation = event.GetWheelRotation();
if( m_enableMousewheelPan )
{
// MousewheelPAN + Ctrl = zooming
if( event.ControlDown() && !event.ShiftDown() )
{
if( wheelRotation > 0 )
cmd.SetId( ID_POPUP_ZOOM_IN );
else if( wheelRotation < 0)
cmd.SetId( ID_POPUP_ZOOM_OUT );
}
// MousewheelPAN + Shift = horizontal scrolling
// Without modifiers MousewheelPAN - just pan
else
{
if( event.ShiftDown() && !event.ControlDown() )
axis = wxMOUSE_WHEEL_HORIZONTAL;
wxPoint newStart = GetViewStart();
wxPoint center = GetParent()->GetScrollCenterPosition();
double scale = GetParent()->GetScreen()->GetScalingFactor();
if( axis == wxMOUSE_WHEEL_HORIZONTAL )
{
newStart.x += wheelRotation;
center.x += KiROUND( (double) wheelRotation / scale );
}
else
{
newStart.y -= wheelRotation;
center.y -= KiROUND( (double) wheelRotation / scale );
}
Scroll( newStart );
GetParent()->SetScrollCenterPosition( center );
GetParent()->SetCrossHairPosition( center, true );
GetParent()->RedrawScreen( center, false );
}
}
else if( wheelRotation > 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
cmd.SetId( ID_PAN_UP );
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_LEFT );
else if( offCenterReq )
cmd.SetId( ID_OFFCENTER_ZOOM_IN );
else
cmd.SetId( ID_POPUP_ZOOM_IN );
}
else if( wheelRotation < 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
cmd.SetId( ID_PAN_DOWN );
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_RIGHT );
else if( offCenterReq )
cmd.SetId( ID_OFFCENTER_ZOOM_OUT );
else
cmd.SetId( ID_POPUP_ZOOM_OUT );
}
if( cmd.GetId() )
GetEventHandler()->ProcessEvent( cmd );
event.Skip();
}
示例15: switch
//.........这里部分代码省略.........
if( Component )
{
sheet = sheetWithComponentFound;
if( *sheet != *m_CurrentSheet )
{
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet;
m_CurrentSheet->UpdateAllScreenReferences();
centerAndRedraw = true;
}
wxPoint delta;
pos -= Component->GetPosition();
delta = Component->GetTransform().TransformCoordinate( pos );
pos = delta + Component->GetPosition();
/* There may be need to reframe the drawing */
if( ! m_canvas->IsPointOnDisplay( pos ) )
{
centerAndRedraw = true;
}
if( centerAndRedraw )
{
GetScreen()->SetCrossHairPosition(pos);
RedrawScreen( pos, aWarpMouse );
}
else
{
INSTALL_UNBUFFERED_DC( dc, m_canvas );
m_canvas->CrossHairOff( &dc );
if( aWarpMouse )
m_canvas->MoveCursor( pos );
GetScreen()->SetCrossHairPosition(pos);
m_canvas->CrossHairOn( &dc );
}
}
/* Print diag */
wxString msg_item;
msg = aReference;
switch( aSearchType )
{
default:
case FIND_COMPONENT_ONLY: // Find component only
break;
case FIND_PIN: // find a pin
msg_item = _( "Pin " ) + aSearchText;
break;
case FIND_REFERENCE: // find reference
msg_item = _( "Ref " ) + aSearchText;
break;
case FIND_VALUE: // find value