Commit 03ffc937 authored by Jacobo Aragunde Perez's avatar Jacobo Aragunde Perez Committed by jean-pierre charras
Browse files

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

parent 9ededca9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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 ...
    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 );

    copyPanelToOptions();
+3 −1
Original line number Diff line number Diff line
@@ -247,7 +247,9 @@ void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent )
    int      value;

    /* 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->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
+4 −1
Original line number Diff line number Diff line
@@ -187,7 +187,10 @@ void SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem )
    if( dlg.ShowModal() != wxID_OK )
        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 );

    dlg.TransfertToImage(aItem->m_Image);
+3 −6
Original line number Diff line number Diff line
@@ -491,10 +491,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,

    case HK_DRAG:                           // Start drag
    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 )
            break;

@@ -506,12 +502,13 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
                break;

        // 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_X_COMPONENT:             // Mirror X
    case HK_ORIENT_NORMAL_COMPONENT:        // Orient 0, no mirror (Component)
    case HK_ROTATE:                         // Rotate schematic item.
        if( blocInProgress )
            break;
        {
            // force a new item search on hot keys at current position,
            // if there is no currently edited item,
+16 −6
Original line number Diff line number Diff line
@@ -123,6 +123,12 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
                    PopMenu->AppendSeparator();
                    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:
                    break;
            }
@@ -819,8 +825,8 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
        msg = AddHotkeyName( _( "Mirror Block --" ), s_Schematic_Hokeys_Descr,
                             HK_MIRROR_X_COMPONENT );
        AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
        AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, _( "Rotate Block ccw" ),
                     KiBitmap( rotate_ccw_xpm ) );
        msg = AddHotkeyName( _( "Rotate Block ccw" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
        AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );

#if 0
  #ifdef __WINDOWS__
@@ -851,13 +857,17 @@ void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )

    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_MIRROR_X, _( "Mirror --" ), KiBitmap( mirror_v_xpm ) );
    AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, _( "Mirror ||" ), KiBitmap( mirror_h_xpm ) );
    msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hokeys_Descr,
                         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 )
    {
        msg = AddHotkeyName( _( "Edit Image" ), s_Schematic_Hokeys_Descr, HK_EDIT );
        AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
        aPopMenu->AppendSeparator();
        msg = AddHotkeyName( _( "Delete Image" ), s_Schematic_Hokeys_Descr, HK_DELETE );
        AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );