Eeschema: hotkey enhancement while moving a block or an item.

This commit is contained in:
Jacobo Aragunde Perez 2013-01-21 21:16:04 +01:00 committed by jean-pierre charras
parent 9ededca9d7
commit 03ffc93786
5 changed files with 29 additions and 15 deletions

View File

@ -223,7 +223,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
} }
// save old cmp in undo list if not already in edit, or moving ... // save old cmp in undo list if not already in edit, or moving ...
if( m_Cmp->m_Flags == 0 ) // or the component to be edited is part of a block
if( m_Cmp->m_Flags == 0 ||
m_Parent->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
m_Parent->SaveCopyInUndoList( m_Cmp, UR_CHANGED ); m_Parent->SaveCopyInUndoList( m_Cmp, UR_CHANGED );
copyPanelToOptions(); copyPanelToOptions();

View File

@ -247,7 +247,9 @@ void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent )
int value; int value;
/* save old text in undo list if not already in edit */ /* save old text in undo list if not already in edit */
if( m_CurrentText->GetFlags() == 0 ) /* or the label to be edited is part of a block */
if( m_CurrentText->GetFlags() == 0 ||
m_Parent->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
m_Parent->SaveCopyInUndoList( m_CurrentText, UR_CHANGED ); m_Parent->SaveCopyInUndoList( m_CurrentText, UR_CHANGED );
m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() ); m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );

View File

@ -187,7 +187,10 @@ void SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem )
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return; return;
if( aItem->GetFlags( ) == 0 ) // save old image in undo list if not already in edit
// or the image to be edited is part of a block
if( aItem->GetFlags() == 0 ||
GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
SaveCopyInUndoList( aItem, UR_CHANGED ); SaveCopyInUndoList( aItem, UR_CHANGED );
dlg.TransfertToImage(aItem->m_Image); dlg.TransfertToImage(aItem->m_Image);

View File

@ -491,10 +491,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_DRAG: // Start drag case HK_DRAG: // Start drag
case HK_MOVE_COMPONENT_OR_ITEM: // Start move schematic item. case HK_MOVE_COMPONENT_OR_ITEM: // Start move schematic item.
case HK_EDIT_COMPONENT_VALUE: // Edit component value field.
case HK_EDIT_COMPONENT_REFERENCE: // Edit component value reference.
case HK_EDIT_COMPONENT_FOOTPRINT: // Edit component footprint field.
// These commands are allowed only when no item currently edited.
if( ! notBusy ) if( ! notBusy )
break; break;
@ -506,12 +502,13 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
// Fall through // Fall through
case HK_EDIT_COMPONENT_VALUE: // Edit component value field.
case HK_EDIT_COMPONENT_REFERENCE: // Edit component value reference.
case HK_EDIT_COMPONENT_FOOTPRINT: // Edit component footprint field.
case HK_MIRROR_Y_COMPONENT: // Mirror Y case HK_MIRROR_Y_COMPONENT: // Mirror Y
case HK_MIRROR_X_COMPONENT: // Mirror X case HK_MIRROR_X_COMPONENT: // Mirror X
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component) case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
case HK_ROTATE: // Rotate schematic item. case HK_ROTATE: // Rotate schematic item.
if( blocInProgress )
break;
{ {
// force a new item search on hot keys at current position, // force a new item search on hot keys at current position,
// if there is no currently edited item, // if there is no currently edited item,

View File

@ -123,6 +123,12 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
break; break;
case SCH_BITMAP_T:
msg = AddHotkeyName( _( "Edit Image" ), s_Schematic_Hokeys_Descr, HK_EDIT );
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
PopMenu->AppendSeparator();
break;
default: default:
break; break;
} }
@ -819,8 +825,8 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
msg = AddHotkeyName( _( "Mirror Block --" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Mirror Block --" ), s_Schematic_Hokeys_Descr,
HK_MIRROR_X_COMPONENT ); HK_MIRROR_X_COMPONENT );
AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) ); AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, _( "Rotate Block ccw" ), msg = AddHotkeyName( _( "Rotate Block ccw" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
KiBitmap( rotate_ccw_xpm ) ); AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
#if 0 #if 0
#ifdef __WINDOWS__ #ifdef __WINDOWS__
@ -851,13 +857,17 @@ void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
msg = AddHotkeyName( _( "Rotate Image" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); msg = AddHotkeyName( _( "Rotate Image" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) ); AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, _( "Mirror --" ), KiBitmap( mirror_v_xpm ) ); msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hokeys_Descr,
AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, _( "Mirror ||" ), KiBitmap( mirror_h_xpm ) ); HK_MIRROR_X_COMPONENT );
AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hokeys_Descr,
HK_MIRROR_Y_COMPONENT );
AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
msg = AddHotkeyName( _( "Edit Image" ), s_Schematic_Hokeys_Descr, HK_EDIT );
AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
if( aBitmap->GetFlags() == 0 ) if( aBitmap->GetFlags() == 0 )
{ {
msg = AddHotkeyName( _( "Edit Image" ), s_Schematic_Hokeys_Descr, HK_EDIT );
AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
msg = AddHotkeyName( _( "Delete Image" ), s_Schematic_Hokeys_Descr, HK_DELETE ); msg = AddHotkeyName( _( "Delete Image" ), s_Schematic_Hokeys_Descr, HK_DELETE );
AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );