Eeschema:

* Fix bug in draw reference for multiunit component
* Code cleanup for drag item
This commit is contained in:
Andrey Fedorushkov 2011-10-24 17:11:11 +04:00
parent 4e626d44b9
commit 8e584fc233
5 changed files with 14 additions and 17 deletions

View File

@ -94,8 +94,7 @@ enum id_eeschema_frm
ID_POPUP_SCH_DELETE_CONNECTION, ID_POPUP_SCH_DELETE_CONNECTION,
ID_POPUP_SCH_DELETE_NODE, ID_POPUP_SCH_DELETE_NODE,
ID_POPUP_SCH_DELETE_CMP, ID_POPUP_SCH_DELETE_CMP,
ID_POPUP_SCH_DRAG_CMP_REQUEST, ID_POPUP_SCH_DRAG_ITEM_REQUEST,
ID_POPUP_SCH_DRAG_WIRE_REQUEST,
ID_POPUP_SCH_UNUSED_2, ID_POPUP_SCH_UNUSED_2,
ID_POPUP_SCH_ENTRY_SELECT_SLASH, ID_POPUP_SCH_ENTRY_SELECT_SLASH,
ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH, ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH,

View File

@ -165,7 +165,7 @@ static EDA_HOTKEY HkCopyComponentOrText( wxT( "Copy Component or Label" ),
ID_POPUP_SCH_COPY_ITEM ); ID_POPUP_SCH_COPY_ITEM );
static EDA_HOTKEY HkDrag( wxT( "Drag Schematic Item" ), HK_DRAG, 'G', static EDA_HOTKEY HkDrag( wxT( "Drag Schematic Item" ), HK_DRAG, 'G',
ID_POPUP_SCH_DRAG_CMP_REQUEST ); ID_POPUP_SCH_DRAG_ITEM_REQUEST );
static EDA_HOTKEY HkMove2Drag( wxT( "Move Block -> Drag Block" ), static EDA_HOTKEY HkMove2Drag( wxT( "Move Block -> Drag Block" ),
HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' ); HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' );
static EDA_HOTKEY HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT ); static EDA_HOTKEY HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
@ -717,7 +717,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case SCH_JUNCTION_T: case SCH_JUNCTION_T:
if( ((SCH_ITEM*) aItem )->GetLayer() != LAYER_BUS ) if( ((SCH_ITEM*) aItem )->GetLayer() != LAYER_BUS )
{ {
cmd.SetId( ID_POPUP_SCH_DRAG_WIRE_REQUEST ); cmd.SetId( hotKey->m_IdMenuEvent );
wxPostEvent( this, cmd ); wxPostEvent( this, cmd );
} }

View File

@ -280,7 +280,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
msg = AddHotkeyName( msg, s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); msg = AddHotkeyName( msg, s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, HK_DRAG ); msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, HK_DRAG );
AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, KiBitmap( move_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_ITEM_REQUEST, msg, KiBitmap( move_xpm ) );
} }
wxMenu* orientmenu = new wxMenu; wxMenu* orientmenu = new wxMenu;
@ -377,7 +377,7 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
msg = AddHotkeyName( _( "Drag Global Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Drag Global Label" ), s_Schematic_Hokeys_Descr,
HK_DRAG ); HK_DRAG );
AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, KiBitmap( move_text_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_ITEM_REQUEST, msg, KiBitmap( move_text_xpm ) );
msg = AddHotkeyName( _( "Copy Global Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Copy Global Label" ), s_Schematic_Hokeys_Descr,
HK_COPY_COMPONENT_OR_LABEL ); HK_COPY_COMPONENT_OR_LABEL );
AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
@ -413,7 +413,7 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
HK_MOVE_COMPONENT_OR_ITEM ); HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
msg = AddHotkeyName( _( "Drag Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_DRAG ); msg = AddHotkeyName( _( "Drag Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_DRAG );
AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, KiBitmap( move_text_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_ITEM_REQUEST, msg, KiBitmap( move_text_xpm ) );
msg = AddHotkeyName( _( "Copy Hierarchical Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Copy Hierarchical Label" ), s_Schematic_Hokeys_Descr,
HK_COPY_COMPONENT_OR_LABEL ); HK_COPY_COMPONENT_OR_LABEL );
AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
@ -449,7 +449,7 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
HK_MOVE_COMPONENT_OR_ITEM ); HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
msg = AddHotkeyName( _( "Drag Label" ), s_Schematic_Hokeys_Descr, HK_DRAG ); msg = AddHotkeyName( _( "Drag Label" ), s_Schematic_Hokeys_Descr, HK_DRAG );
AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, KiBitmap( move_text_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_ITEM_REQUEST, msg, KiBitmap( move_text_xpm ) );
msg = AddHotkeyName( _( "Copy Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Copy Label" ), s_Schematic_Hokeys_Descr,
HK_COPY_COMPONENT_OR_LABEL ); HK_COPY_COMPONENT_OR_LABEL );
AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
@ -524,7 +524,7 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct
if( !aJunction->IsNew() ) if( !aJunction->IsNew() )
{ {
if( m_collectedItems.IsDraggableJunction() ) if( m_collectedItems.IsDraggableJunction() )
AddMenuItem( aMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, _( "Drag Junction" ), AddMenuItem( aMenu, ID_POPUP_SCH_DRAG_ITEM_REQUEST, _( "Drag Junction" ),
KiBitmap( move_xpm ) ); KiBitmap( move_xpm ) );
if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) ) if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) )
@ -556,7 +556,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
} }
msg = AddHotkeyName( _( "Drag Wire" ), s_Schematic_Hokeys_Descr, HK_DRAG ); msg = AddHotkeyName( _( "Drag Wire" ), s_Schematic_Hokeys_Descr, HK_DRAG );
AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, msg, KiBitmap( move_track_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_ITEM_REQUEST, msg, KiBitmap( move_track_xpm ) );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
msg = AddHotkeyName( _( "Delete Wire" ), s_Schematic_Hokeys_Descr, HK_DELETE ); msg = AddHotkeyName( _( "Delete Wire" ), s_Schematic_Hokeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
@ -629,7 +629,7 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_sheet_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_sheet_xpm ) );
msg = AddHotkeyName( _( "Drag Sheet" ), s_Schematic_Hokeys_Descr, HK_DRAG ); msg = AddHotkeyName( _( "Drag Sheet" ), s_Schematic_Hokeys_Descr, HK_DRAG );
AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, KiBitmap( move_sheet_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_ITEM_REQUEST, msg, KiBitmap( move_sheet_xpm ) );
} }
if( Sheet->GetFlags() ) if( Sheet->GetFlags() )

View File

@ -99,7 +99,7 @@ wxString SCH_FIELD::GetText() const
wxCHECK_MSG( component != NULL, text, wxCHECK_MSG( component != NULL, text,
wxT( "No component associated with field" ) + text ); wxT( "No component associated with field" ) + text );
if( component->GetPartCount() > 1 )
text << LIB_COMPONENT::ReturnSubReference( component->GetUnit() ); text << LIB_COMPONENT::ReturnSubReference( component->GetUnit() );
} }

View File

@ -78,8 +78,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_RESIZE_SHEET: case ID_POPUP_SCH_RESIZE_SHEET:
case ID_POPUP_IMPORT_GLABEL: case ID_POPUP_IMPORT_GLABEL:
case ID_POPUP_SCH_EDIT_SHEET_PIN: case ID_POPUP_SCH_EDIT_SHEET_PIN:
case ID_POPUP_SCH_DRAG_CMP_REQUEST: case ID_POPUP_SCH_DRAG_ITEM_REQUEST:
case ID_POPUP_SCH_DRAG_WIRE_REQUEST:
case ID_POPUP_SCH_EDIT_CMP: case ID_POPUP_SCH_EDIT_CMP:
case ID_POPUP_SCH_INIT_CMP: case ID_POPUP_SCH_INIT_CMP:
case ID_POPUP_SCH_DISPLAYDOC_CMP: case ID_POPUP_SCH_DISPLAYDOC_CMP:
@ -281,8 +280,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
EditSheetPin( (SCH_SHEET_PIN*) item, &dc ); EditSheetPin( (SCH_SHEET_PIN*) item, &dc );
break; break;
case ID_POPUP_SCH_DRAG_CMP_REQUEST: case ID_POPUP_SCH_DRAG_ITEM_REQUEST:
case ID_POPUP_SCH_DRAG_WIRE_REQUEST:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
// The easiest way to handle a drag component or sheet command // The easiest way to handle a drag component or sheet command