本文整理汇总了C++中INSTALL_UNBUFFERED_DC函数的典型用法代码示例。如果您正苦于以下问题:C++ INSTALL_UNBUFFERED_DC函数的具体用法?C++ INSTALL_UNBUFFERED_DC怎么用?C++ INSTALL_UNBUFFERED_DC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了INSTALL_UNBUFFERED_DC函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 );
}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:7,代码来源:draw_frame.cpp
示例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();
}
开发者ID:Elphel,项目名称:kicad-source-mirror,代码行数:31,代码来源:draw_panel.cpp
示例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();
}
开发者ID:Elphel,项目名称:kicad-source-mirror,代码行数:60,代码来源:draw_panel.cpp
示例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;
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:8,代码来源:eda_draw_panel.cpp
示例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();
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:57,代码来源:getpart.cpp
示例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 );
}
开发者ID:cpavlina,项目名称:kicad,代码行数:11,代码来源:draw_frame.cpp
示例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 );
}
开发者ID:manasdas17,项目名称:kicad-source-mirror,代码行数:11,代码来源:libeditframe.cpp
示例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 );
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:45,代码来源:eda_draw_panel.cpp
示例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;
}
}
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:41,代码来源:events_called_functions_for_edit.cpp
示例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;
}
开发者ID:JOE-JOE-NGIGI,项目名称:kicad,代码行数:22,代码来源:draw_panel.cpp
示例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 );
}
}
}
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:23,代码来源:libeditframe.cpp
示例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 );
}
开发者ID:ejs-ejs,项目名称:kicad-source-mirror,代码行数:24,代码来源:basepcbframe.cpp
示例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() )
//.........这里部分代码省略.........
开发者ID:p12tic,项目名称:kicad-source-mirror,代码行数:101,代码来源:schedit.cpp
示例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();
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:96,代码来源:eda_draw_panel.cpp
示例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
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:67,代码来源:find.cpp
示例16: 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( KICAD_TRACE_COORDS,
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();
// This is a zoom in or out command
if( event.GetWheelRotation() > 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
{
if( axis == 0 )
cmd.SetId( ID_PAN_UP );
else
cmd.SetId( ID_PAN_RIGHT );
}
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( event.GetWheelRotation() < 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
{
if( axis == 0 )
cmd.SetId( ID_PAN_DOWN );
else
cmd.SetId( ID_PAN_LEFT );
}
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 );
}
GetEventHandler()->ProcessEvent( cmd );
event.Skip();
}
开发者ID:JOE-JOE-NGIGI,项目名称:kicad,代码行数:67,代码来源:draw_panel.cpp
示例17: wxGetMousePosition
void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
int id = event.GetId();
wxPoint pos;
m_canvas->SetIgnoreMouseEvents( true );
wxGetMousePosition( &pos.x, &pos.y );
pos.y += 20;
switch( id ) // Stop placement commands before handling new command.
{
case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
case ID_LIBEDIT_EDIT_PIN:
case ID_POPUP_LIBEDIT_BODY_EDIT_ITEM:
case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
case ID_POPUP_ZOOM_BLOCK:
case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_COPY_BLOCK:
case ID_POPUP_SELECT_ITEMS_BLOCK:
case ID_POPUP_MIRROR_X_BLOCK:
case ID_POPUP_MIRROR_Y_BLOCK:
case ID_POPUP_ROTATE_BLOCK:
case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
break;
case ID_POPUP_LIBEDIT_CANCEL_EDITING:
if( m_canvas->IsMouseCaptured() )
m_canvas->EndMouseCapture();
else
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
break;
case ID_POPUP_LIBEDIT_DELETE_ITEM:
m_canvas->EndMouseCapture();
break;
default:
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(),
wxEmptyString );
break;
}
INSTALL_UNBUFFERED_DC( dc, m_canvas );
switch( id )
{
case ID_POPUP_LIBEDIT_CANCEL_EDITING:
break;
case ID_LIBEDIT_SELECT_CURRENT_LIB:
SelectActiveLibrary();
break;
case ID_LIBEDIT_SAVE_CURRENT_PART:
{
LIB_PART* part = GetCurPart();
if( !part )
{
DisplayError( this, _( "No part to save." ) );
break;
}
PART_LIB* lib = GetCurLib();
if( !lib )
SelectActiveLibrary();
lib = GetCurLib();
if( !lib )
{
DisplayError( this, _( "No library specified." ) );
break;
}
SaveOnePart( lib );
}
break;
case ID_LIBEDIT_EDIT_PIN_BY_PIN:
m_editPinsPerPartOrConvert = m_mainToolBar->GetToolToggled( ID_LIBEDIT_EDIT_PIN_BY_PIN );
break;
case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
m_canvas->MoveCursorToCrossHair();
if( m_drawItem )
{
EndDrawGraphicItem( &dc );
}
break;
case ID_POPUP_LIBEDIT_BODY_EDIT_ITEM:
if( m_drawItem )
{
//.........这里部分代码省略.........
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:101,代码来源:libeditframe.cpp
示例18: wxT
void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event )
{
NETINFO_ITEM* net;
wxString netFilter;
wxArrayString list;
netFilter = wxT( "*" );
wxTextEntryDialog dlg( this, _( "Filter Net Names" ), _( "Net Filter" ), netFilter );
if( dlg.ShowModal() != wxID_OK )
return; // cancelled by user
netFilter = dlg.GetValue( );
if( netFilter.IsEmpty() )
return;
wxString Line;
for( unsigned ii = 0; ii < GetBoard()->GetNetCount(); ii++ )
{
net = GetBoard()->m_NetInfo.GetNetItem( ii );
if( !WildCompareString( netFilter, net->GetNetname(), false ) )
continue;
Line.Printf( wxT( "net %3.3d: %s" ), net->GetNet(),
GetChars( net->GetNetname() ) );
list.Add( Line );
}
wxSingleChoiceDialog choiceDlg( this, wxEmptyString, _( "Select Net" ), list );
if( (choiceDlg.ShowModal() == wxID_CANCEL) || (choiceDlg.GetSelection() == wxNOT_FOUND) )
return;
bool found = false;
unsigned netcode = (unsigned) choiceDlg.GetSelection();
// Search for the net selected.
for( unsigned ii = 0; ii < GetBoard()->GetNetCount(); ii++ )
{
net = GetBoard()->FindNet( ii );
if( !WildCompareString( netFilter, net->GetNetname(), false ) )
continue;
if( ii == netcode )
{
netcode = net->GetNet();
found = true;
break;
}
}
if( found )
{
INSTALL_UNBUFFERED_DC( dc, m_canvas );
if( GetBoard()->IsHighLightNetON() )
HighLight( &dc );
GetBoard()->SetHighLightNet( netcode );
HighLight( &dc );
}
}
开发者ID:morio,项目名称:kicad-source-mirror,代码行数:65,代码来源:highlight.cpp
示例19: GetScreen
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 );
//.........这里部分代码省略.........
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:101,代码来源:eda_draw_panel.cpp
示例20: switch
//.........这里部分代码省略.........
// Stop the current command and deselect the current tool.
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
switch( id )
{
case ID_NO_TOOL_SELECTED:
SetToolID( id, m_canvas->GetDefaultCursor(), _( "No tool selected" ) );
break;
case ID_HIERARCHY_PUSH_POP_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Descend or ascend hierarchy" ) );
break;
case ID_NOCONN_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add no connect" ) );
break;
case ID_WIRE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add wire" ) );
break;
case ID_BUS_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add bus" ) );
break;
case ID_LINE_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add lines" ) );
break;
case ID_JUNCTION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add junction" ) );
break;
case ID_LABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add label" ) );
break;
case ID_GLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add global label" ) );
break;
case ID_HIERLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add hierarchical label" ) );
break;
case ID_TEXT_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_ADD_IMAGE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add image" ) );
break;
case ID_WIRETOBUS_ENTRY_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add wire to bus entry" ) );
break;
case ID_BUSTOBUS_ENTRY_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add bus to bus entry" ) );
break;
case ID_SHEET_SYMBOL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add sheet" ) );
break;
case ID_SHEET_PIN_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add sheet pins" ) );
break;
case ID_IMPORT_HLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Import sheet pins" ) );
break;
case ID_SCH_PLACE_COMPONENT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add component" ) );
break;
case ID_PLACE_POWER_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add power" ) );
break;
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
default:
SetRepeatItem( NULL );
}
// Simulate left click event if we got here from a hot key.
if( aEvent.GetClientObject() != NULL )
{
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
wxPoint pos = data->GetPosition();
INSTALL_UNBUFFERED_DC( dc, m_canvas );
OnLeftClick( &dc, pos );
}
}
开发者ID:p12tic,项目名称:kicad-source-mirror,代码行数:101,代码来源:schedit.cpp
注:本文中的INSTALL_UNBUFFERED_DC函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论