int LIB_TEXT::compare( const LIB_ITEM& other ) const { wxASSERT( other.Type() == LIB_TEXT_T ); const LIB_TEXT* tmp = ( LIB_TEXT* ) &other; int result = m_Text.CmpNoCase( tmp->m_Text ); if( result != 0 ) return result; if( m_Pos.x != tmp->m_Pos.x ) return m_Pos.x - tmp->m_Pos.x; if( m_Pos.y != tmp->m_Pos.y ) return m_Pos.y - tmp->m_Pos.y; if( m_Size.x != tmp->m_Size.x ) return m_Size.x - tmp->m_Size.x; if( m_Size.y != tmp->m_Size.y ) return m_Size.y - tmp->m_Size.y; return 0; }
void LIB_EDIT_FRAME::BlockCopySelectedItems( const wxPoint& aOffset, LIB_PART* aPart, BLOCK_SELECTOR* aBlock ) { PICKED_ITEMS_LIST& aItemsList = aBlock->GetItems(); LIB_ITEM* oldItem; LIB_ITEM* newItem; for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ ) { oldItem = static_cast<LIB_ITEM*>( aItemsList.GetPickedItem( ii ) ); // We *do not* copy fields because they are unique for the whole component // so skip them (do not duplicate) if they are flagged selected. if( oldItem->Type() == LIB_FIELD_T ) oldItem->ClearFlags( SELECTED ); if( !oldItem->IsSelected() ) continue; newItem = (LIB_ITEM*) oldItem->Clone(); newItem->SetFlags( SELECTED ); oldItem->ClearFlags( SELECTED ); newItem->SetOffset( aBlock->GetMoveVector() ); aItemsList.SetPickedItem( newItem, ii ); aItemsList.SetPickedItemStatus( UR_NEW, ii ); aPart->GetDrawItems().push_back( newItem ); } }
int LIB_FIELD::compare( const LIB_ITEM& other ) const { wxASSERT( other.Type() == LIB_FIELD_T ); const LIB_FIELD* tmp = ( LIB_FIELD* ) &other; if( m_id != tmp->m_id ) return m_id - tmp->m_id; int result = m_Text.CmpNoCase( tmp->m_Text ); if( result != 0 ) return result; if( GetTextPos().x != tmp->GetTextPos().x ) return GetTextPos().x - tmp->GetTextPos().x; if( GetTextPos().y != tmp->GetTextPos().y ) return GetTextPos().y - tmp->GetTextPos().y; if( GetTextWidth() != tmp->GetTextWidth() ) return GetTextWidth() - tmp->GetTextWidth(); if( GetTextHeight() != tmp->GetTextHeight() ) return GetTextHeight() - tmp->GetTextHeight(); return 0; }
int LIB_CIRCLE::compare( const LIB_ITEM& aOther ) const { wxASSERT( aOther.Type() == LIB_CIRCLE_T ); const LIB_CIRCLE* tmp = ( LIB_CIRCLE* ) &aOther; if( m_Pos.x != tmp->m_Pos.x ) return m_Pos.x - tmp->m_Pos.x; if( m_Pos.y != tmp->m_Pos.y ) return m_Pos.y - tmp->m_Pos.y; if( m_Radius != tmp->m_Radius ) return m_Radius - tmp->m_Radius; return 0; }
bool LIB_ITEM::operator<( const LIB_ITEM& aOther ) const { int result = m_Convert - aOther.m_Convert; if( result != 0 ) return result < 0; result = m_Unit - aOther.m_Unit; if( result != 0 ) return result < 0; result = Type() - aOther.Type(); if( result != 0 ) return result < 0; return ( compare( aOther ) < 0 ); }
int LIB_RECTANGLE::compare( const LIB_ITEM& aOther ) const { wxASSERT( aOther.Type() == LIB_RECTANGLE_T ); const LIB_RECTANGLE* tmp = ( LIB_RECTANGLE* ) &aOther; if( m_Pos.x != tmp->m_Pos.x ) return m_Pos.x - tmp->m_Pos.x; if( m_Pos.y != tmp->m_Pos.y ) return m_Pos.y - tmp->m_Pos.y; if( m_End.x != tmp->m_End.x ) return m_End.x - tmp->m_End.x; if( m_End.y != tmp->m_End.y ) return m_End.y - tmp->m_End.y; return 0; }
int LIB_POLYLINE::compare( const LIB_ITEM& aOther ) const { wxASSERT( aOther.Type() == LIB_POLYLINE_T ); const LIB_POLYLINE* tmp = (LIB_POLYLINE*) &aOther; if( m_PolyPoints.size() != tmp->m_PolyPoints.size() ) return m_PolyPoints.size() - tmp->m_PolyPoints.size(); for( size_t i = 0; i < m_PolyPoints.size(); i++ ) { if( m_PolyPoints[i].x != tmp->m_PolyPoints[i].x ) return m_PolyPoints[i].x - tmp->m_PolyPoints[i].x; if( m_PolyPoints[i].y != tmp->m_PolyPoints[i].y ) return m_PolyPoints[i].y - tmp->m_PolyPoints[i].y; } return 0; }
int LIB_ARC::compare( const LIB_ITEM& aOther ) const { wxASSERT( aOther.Type() == LIB_ARC_T ); const LIB_ARC* tmp = ( LIB_ARC* ) &aOther; if( m_Pos.x != tmp->m_Pos.x ) return m_Pos.x - tmp->m_Pos.x; if( m_Pos.y != tmp->m_Pos.y ) return m_Pos.y - tmp->m_Pos.y; if( m_t1 != tmp->m_t1 ) return m_t1 - tmp->m_t1; if( m_t2 != tmp->m_t2 ) return m_t2 - tmp->m_t2; return 0; }
int LIB_BEZIER::compare( const LIB_ITEM& aOther ) const { wxASSERT( aOther.Type() == LIB_BEZIER_T ); const LIB_BEZIER* tmp = ( LIB_BEZIER* ) &aOther; if( m_BezierPoints.size() != tmp->m_BezierPoints.size() ) return m_BezierPoints.size() - tmp->m_BezierPoints.size(); for( size_t i = 0; i < m_BezierPoints.size(); i++ ) { if( m_BezierPoints[i].x != tmp->m_BezierPoints[i].x ) return m_BezierPoints[i].x - tmp->m_BezierPoints[i].x; if( m_BezierPoints[i].y != tmp->m_BezierPoints[i].y ) return m_BezierPoints[i].y - tmp->m_BezierPoints[i].y; } return 0; }
void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC ) { LIB_ITEM* item = GetDrawItem(); if( item == NULL ) return; SetCursor( wxCURSOR_HAND ); TempCopyComponent(); // For fields only, move the anchor point of the field // to the cursor position to allow user to see the text justification if( item->Type() == LIB_FIELD_T ) item->BeginEdit( IS_MOVED, item->GetPosition() ); else item->BeginEdit( IS_MOVED, GetCrossHairPosition( true ) ); m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, true ); }
LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_PART* LibEntry, wxDC* DC ) { LIB_ITEM* item = GetDrawItem(); m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn ); wxPoint drawPos = GetCrossHairPosition( true ); // no temp copy -> the current version of symbol will be used for Undo // This is normal when adding new items to the current symbol ClearTempCopyComponent(); switch( GetToolId() ) { case ID_LIBEDIT_BODY_ARC_BUTT: item = new LIB_ARC( LibEntry ); break; case ID_LIBEDIT_BODY_CIRCLE_BUTT: item = new LIB_CIRCLE( LibEntry ); break; case ID_LIBEDIT_BODY_RECT_BUTT: item = new LIB_RECTANGLE( LibEntry ); break; case ID_LIBEDIT_BODY_LINE_BUTT: item = new LIB_POLYLINE( LibEntry ); break; case ID_LIBEDIT_BODY_TEXT_BUTT: { LIB_TEXT* text = new LIB_TEXT( LibEntry ); text->SetTextSize( wxSize( m_textSize, m_textSize ) ); text->SetTextAngle( m_current_text_angle ); // Enter the graphic text info m_canvas->SetIgnoreMouseEvents( true ); EditSymbolText( NULL, text ); m_canvas->SetIgnoreMouseEvents( false ); m_canvas->MoveCursorToCrossHair(); if( text->GetText().IsEmpty() ) { delete text; item = NULL; } else { item = text; } } break; default: DisplayError( this, wxT( "LIB_EDIT_FRAME::CreateGraphicItem() error" ) ); return NULL; } if( item ) { item->BeginEdit( IS_NEW, drawPos ); // Don't set line parameters for text objects. if( item->Type() != LIB_TEXT_T ) { item->SetWidth( m_drawLineWidth ); item->SetFillMode( m_drawFillStyle ); } if( m_drawSpecificUnit ) item->SetUnit( m_unit ); if( m_drawSpecificConvert ) item->SetConvert( m_convert ); // Draw initial symbol: m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } else { m_canvas->EndMouseCapture(); return NULL; } m_canvas->MoveCursorToCrossHair(); m_canvas->SetIgnoreMouseEvents( false ); SetDrawItem( item ); return item; }
void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) { LIB_ITEM* item = m_drawItem; bool item_in_edit = item && item->InEditMode(); bool no_item_edited = !item_in_edit; LIB_PART* part = GetCurPart(); if( !part ) // No component loaded ! return; if( ( GetToolId() == ID_NO_TOOL_SELECTED ) && no_item_edited ) { item = LocateItemUsingCursor( aPosition ); if( item ) { MSG_PANEL_ITEMS items; item->GetMsgPanelInfo( items ); SetMsgPanel( items ); } else { DisplayCmpDoc(); if( m_canvas->GetAbortRequest() ) m_canvas->SetAbortRequest( false ); } } switch( GetToolId() ) { case ID_NO_TOOL_SELECTED: // If an item is currently in edit, finish edit if( item_in_edit ) { switch( item->Type() ) { case LIB_PIN_T: PlacePin(); break; default: EndDrawGraphicItem( DC ); break; } } break; case ID_LIBEDIT_PIN_BUTT: if( no_item_edited ) CreatePin( DC ); else PlacePin(); break; case ID_LIBEDIT_BODY_LINE_BUTT: case ID_LIBEDIT_BODY_ARC_BUTT: case ID_LIBEDIT_BODY_CIRCLE_BUTT: case ID_LIBEDIT_BODY_RECT_BUTT: case ID_LIBEDIT_BODY_TEXT_BUTT: if( no_item_edited ) m_drawItem = CreateGraphicItem( part, DC ); else if( m_drawItem ) { if( m_drawItem->IsNew() ) GraphicItemBeginDraw( DC ); else EndDrawGraphicItem( DC ); } break; case ID_LIBEDIT_DELETE_ITEM_BUTT: m_drawItem = LocateItemUsingCursor( aPosition ); if( m_drawItem ) deleteItem( DC ); else DisplayCmpDoc(); break; case ID_LIBEDIT_ANCHOR_ITEM_BUTT: SaveCopyInUndoList( part ); PlaceAnchor(); SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; default: wxFAIL_MSG( wxString::Format( wxT( "Unhandled command ID %d" ), GetToolId() ) ); SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; } }
bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { LIB_ITEM* item = GetDrawItem(); bool blockActive = GetScreen()->IsBlockActive(); if( blockActive ) { AddMenusForBlock( PopMenu, this ); PopMenu->AppendSeparator(); return true; } LIB_PART* part = GetCurPart(); if( !part ) return true; // If Command in progress, put menu "cancel" if( item && item->InEditMode() ) { AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel" ), KiBitmap( cancel_xpm ) ); PopMenu->AppendSeparator(); } else { item = LocateItemUsingCursor( aPosition ); // If the clarify item selection context menu is aborted, don't show the context menu. if( item == NULL && m_canvas->GetAbortRequest() ) { m_canvas->SetAbortRequest( false ); return false; } if( GetToolId() != ID_NO_TOOL_SELECTED ) { // If a tool is active, put menu "end tool" AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "End Tool" ), KiBitmap( cursor_xpm ) ); PopMenu->AppendSeparator(); } } if( item ) { MSG_PANEL_ITEMS items; item->GetMsgPanelInfo( items ); SetMsgPanel( items ); } else { return true; } m_drawItem = item; bool not_edited = !item->InEditMode(); wxString msg; switch( item->Type() ) { case LIB_PIN_T: AddMenusForPin( PopMenu, (LIB_PIN*) item, this ); break; case LIB_ARC_T: if( not_edited ) { msg = AddHotkeyName( _( "Move Arc" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_arc_xpm ) ); msg = AddHotkeyName( _( "Drag Arc Size" ), g_Libedit_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_arc_xpm ) ); } msg = AddHotkeyName( _( "Edit Arc Options" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_arc_xpm ) ); if( not_edited ) { msg = AddHotkeyName( _( "Delete Arc" ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_arc_xpm ) ); } break; case LIB_CIRCLE_T: if( not_edited ) { msg = AddHotkeyName( _( "Move Circle" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_circle_xpm ) ); msg = AddHotkeyName( _( "Drag Circle Outline" ), g_Libedit_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_rectangle_xpm ) ); } msg = AddHotkeyName( _( "Edit Circle Options" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_circle_xpm ) ); if( not_edited ) { msg = AddHotkeyName( _( "Delete Circle" ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_circle_xpm ) ); } break; case LIB_RECTANGLE_T: if( not_edited ) { msg = AddHotkeyName( _( "Move Rectangle" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_rectangle_xpm ) ); } msg = AddHotkeyName( _( "Edit Rectangle Options" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_rectangle_xpm ) ); if( not_edited ) { msg = AddHotkeyName( _( "Drag Rectangle Edge" ), g_Libedit_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_rectangle_xpm ) ); msg = AddHotkeyName( _( "Delete Rectangle" ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_rectangle_xpm ) ); } break; case LIB_TEXT_T: if( not_edited ) { msg = AddHotkeyName( _( "Move Text" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_text_xpm ) ); } msg = AddHotkeyName( _( "Edit Text" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); msg = AddHotkeyName( _( "Rotate Text" ), g_Libedit_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( edit_text_xpm ) ); if( not_edited ) { msg = AddHotkeyName( _( "Delete Text" ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_text_xpm ) ); } break; case LIB_POLYLINE_T: if( not_edited ) { msg = AddHotkeyName( _( "Move Line" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_line_xpm ) ); msg = AddHotkeyName( _( "Drag Edge Point" ), g_Libedit_Hokeys_Descr, HK_DRAG ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_line_xpm ) ); } if( item->IsNew() ) { AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_END_CREATE_ITEM, _( "Line End" ), KiBitmap( checked_ok_xpm ) ); } msg = AddHotkeyName( _( "Edit Line Options" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_segment_xpm ) ); if( not_edited ) { msg = AddHotkeyName( _( "Delete Line " ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_segment_xpm ) ); } if( item->IsNew() ) { if( ( (LIB_POLYLINE*) item )->GetCornerCount() > 2 ) { msg = AddHotkeyName( _( "Delete Segment" ), g_Libedit_Hokeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT, msg, KiBitmap( delete_segment_xpm ) ); } } break; case LIB_FIELD_T: if( not_edited ) { msg = AddHotkeyName( _( "Move Field" ), g_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_field_xpm ) ); } msg = AddHotkeyName( _( "Field Rotate" ), g_Libedit_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( rotate_field_xpm ) ); msg = AddHotkeyName( _( "Field Edit" ), g_Libedit_Hokeys_Descr, HK_EDIT ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); break; default: wxFAIL_MSG( wxString::Format( wxT( "Unknown library item type %d" ), item->Type() ) ); m_drawItem = NULL; break; } PopMenu->AppendSeparator(); return true; }
void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) { LIB_ITEM* item = m_drawItem; if( m_component == NULL ) // No component loaded ! return; if( item == NULL || item->GetFlags() == 0 ) { item = LocateItemUsingCursor( aPosition ); if( item ) { item->DisplayInfo( this ); } else { DisplayCmpDoc(); if( m_canvas->GetAbortRequest() ) m_canvas->SetAbortRequest( false ); } } switch( GetToolId() ) { case ID_NO_TOOL_SELECTED: if( item && item->GetFlags() ) // moved object { switch( item->Type() ) { case LIB_PIN_T: PlacePin( DC ); break; default: EndDrawGraphicItem( DC ); break; } } break; case ID_LIBEDIT_PIN_BUTT: if( m_drawItem == NULL || m_drawItem->GetFlags() == 0 ) { CreatePin( DC ); } else { PlacePin( DC ); } break; case ID_LIBEDIT_BODY_LINE_BUTT: case ID_LIBEDIT_BODY_ARC_BUTT: case ID_LIBEDIT_BODY_CIRCLE_BUTT: case ID_LIBEDIT_BODY_RECT_BUTT: case ID_LIBEDIT_BODY_TEXT_BUTT: if( m_drawItem == NULL || m_drawItem->GetFlags() == 0 ) { m_drawItem = CreateGraphicItem( m_component, DC ); } else if( m_drawItem ) { if( m_drawItem->IsNew() ) GraphicItemBeginDraw( DC ); else EndDrawGraphicItem( DC ); } break; case ID_LIBEDIT_DELETE_ITEM_BUTT: m_drawItem = LocateItemUsingCursor( aPosition ); if( m_drawItem ) deleteItem( DC ); else DisplayCmpDoc(); break; case ID_LIBEDIT_ANCHOR_ITEM_BUTT: SaveCopyInUndoList( m_component ); PlaceAnchor(); SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; default: wxFAIL_MSG( wxString::Format( wxT( "Unhandled command ID %d" ), GetToolId() ) ); SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; } }
/* * Called on a double click: * If an editable item (field, pin, graphic): * Call the suitable dialog editor. */ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition ) { LIB_PART* part = GetCurPart(); LIB_ITEM* item = GetDrawItem(); if( !part ) return; if( !item || !item->InEditMode() ) { // We can locate an item item = LocateItemUsingCursor( aPosition, LIB_COLLECTOR::DoubleClickItems ); if( item == NULL ) { // The user canceled the disambiguation menu if( m_canvas->GetAbortRequest() ) m_canvas->SetAbortRequest( false ); else { // If there is only a random double-click, we allow the use to edit the part wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetId( ID_LIBEDIT_GET_FRAME_EDIT_PART ); GetEventHandler()->ProcessEvent( cmd ); } } } if( item ) SetMsgPanel( item ); else return; m_canvas->SetIgnoreMouseEvents( true ); bool not_edited = !item->InEditMode(); switch( item->Type() ) { case LIB_PIN_T: if( not_edited ) { SetDrawItem( item ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetId( ID_LIBEDIT_EDIT_PIN ); GetEventHandler()->ProcessEvent( cmd ); } break; case LIB_ARC_T: case LIB_CIRCLE_T: case LIB_RECTANGLE_T: if( not_edited ) EditGraphicSymbol( DC, item ); break; case LIB_POLYLINE_T: if( not_edited ) EditGraphicSymbol( DC, item ); else if( item->IsNew() ) EndDrawGraphicItem( DC ); break; case LIB_TEXT_T: if( not_edited ) EditSymbolText( DC, item ); break; case LIB_FIELD_T: if( not_edited ) EditField( (LIB_FIELD*) item ); break; default: wxFAIL_MSG( wxT( "Unhandled item <" ) + item->GetClass() + wxT( ">" ) ); break; } m_canvas->MoveCursorToCrossHair(); m_canvas->SetIgnoreMouseEvents( false ); }