From 38cdafd4072c2fdfa0d452ceb724297366616697 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 17 May 2019 12:57:09 +0100 Subject: [PATCH] Remove vestiges of legacy BLOCK architecture from eeschema. --- eeschema/libedit/lib_edit_frame.cpp | 7 --- eeschema/libedit/lib_edit_frame.h | 4 -- eeschema/sch_base_frame.cpp | 86 ----------------------------- eeschema/sch_base_frame.h | 3 - eeschema/sch_edit_frame.cpp | 7 --- eeschema/sch_edit_frame.h | 2 - 6 files changed, 109 deletions(-) diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp index 91b7b4be3d..0a3c0bb551 100644 --- a/eeschema/libedit/lib_edit_frame.cpp +++ b/eeschema/libedit/lib_edit_frame.cpp @@ -136,7 +136,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, LIB_EDIT_FRAME::Process_Config ) // Update user interface elements. - EVT_UPDATE_UI( wxID_PASTE, LIB_EDIT_FRAME::OnUpdatePaste ) EVT_UPDATE_UI( ID_LIBEDIT_EXPORT_PART, LIB_EDIT_FRAME::OnUpdateHavePart ) EVT_UPDATE_UI( ID_LIBEDIT_SAVE, LIB_EDIT_FRAME::OnUpdateSave ) EVT_UPDATE_UI( ID_LIBEDIT_SAVE_ALL, LIB_EDIT_FRAME::OnUpdateSave ) @@ -445,12 +444,6 @@ void LIB_EDIT_FRAME::OnUpdateEditingPart( wxUpdateUIEvent& aEvent ) } -void LIB_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event ) -{ - event.Enable( m_clipboard.GetCount() > 0 ); -} - - void LIB_EDIT_FRAME::OnUpdateSyncPinEdit( wxUpdateUIEvent& event ) { LIB_PART* part = GetCurPart(); diff --git a/eeschema/libedit/lib_edit_frame.h b/eeschema/libedit/lib_edit_frame.h index 62242ba483..f217634ba1 100644 --- a/eeschema/libedit/lib_edit_frame.h +++ b/eeschema/libedit/lib_edit_frame.h @@ -290,7 +290,6 @@ public: void OnCheckComponent( wxCommandEvent& event ); void OnSelectBodyStyle( wxCommandEvent& event ); - void OnUpdatePaste( wxUpdateUIEvent& event ); void OnUpdateEditingPart( wxUpdateUIEvent& event ); void OnUpdateHavePart( wxUpdateUIEvent& aEvent ); void OnUpdateSave( wxUpdateUIEvent& aEvent ); @@ -597,9 +596,6 @@ private: ///> Renames LIB_PART aliases to avoid conflicts before adding a component to a library void fixDuplicateAliases( LIB_PART* aPart, const wxString& aLibrary ); - ///> Clipboard buffer storing LIB_ITEMs - BLOCK_SELECTOR m_clipboard; - DECLARE_EVENT_TABLE() }; diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 5040b76b79..14910f86e1 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -503,92 +503,6 @@ KIGFX::SCH_RENDER_SETTINGS* SCH_BASE_FRAME::GetRenderSettings() } -bool SCH_BASE_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition, - int aExplicitCommand ) -{ - BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; - - if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) ) - return false; - - if( aExplicitCommand == 0 ) - block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) ); - else - block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand ); - - if( block->GetCommand() == 0 ) - return false; - - switch( block->GetCommand() ) - { - case BLOCK_IDLE: - break; - - case BLOCK_MOVE: // Move - case BLOCK_DRAG: // Drag (block defined) - case BLOCK_DRAG_ITEM: // Drag from a drag item command - case BLOCK_DUPLICATE: // Duplicate - case BLOCK_DUPLICATE_AND_INCREMENT: // Duplicate and increment relevant references - case BLOCK_DELETE: // Delete - case BLOCK_COPY: // Copy - case BLOCK_FLIP: // Flip - case BLOCK_ZOOM: // Window Zoom - case BLOCK_MIRROR_X: - case BLOCK_MIRROR_Y: // mirror - block->InitData( m_canvas, aPosition ); - GetCanvas()->GetView()->ShowSelectionArea(); - break; - - case BLOCK_PASTE: - { - block->InitData( m_canvas, aPosition ); - InitBlockPasteInfos(); - - wxRect bounds( 0, 0, 0, 0 ); - - for( unsigned i = 0; i < block->GetCount(); ++i ) - bounds.Union( block->GetItem( i )->GetBoundingBox() ); - - block->SetOrigin( bounds.GetPosition() ); - block->SetSize( bounds.GetSize() ); - block->SetLastCursorPosition( wxPoint( 0, 0 ) ); - - if( block->GetCount() == 0 ) // No data to paste - { - DisplayError( this, _( "Nothing to paste" ), 20 ); - GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE ); - m_canvas->SetMouseCaptureCallback( NULL ); - block->SetState( STATE_NO_BLOCK ); - block->SetMessageBlock( this ); - return true; - } - - if( !m_canvas->IsMouseCaptured() ) - { - block->ClearItemsList(); - wxFAIL_MSG( "SCH_BASE_FRAME::HandleBlockBegin() error: m_mouseCaptureCallback NULL" ); - block->SetState( STATE_NO_BLOCK ); - block->SetMessageBlock( this ); - return true; - } - - block->SetState( STATE_BLOCK_MOVE ); - block->SetFlags( IS_MOVED ); - m_canvas->CallMouseCapture( aDC, aPosition, false ); - m_canvas->Refresh(); - } - break; - - default: - wxFAIL_MSG( wxString::Format( "SCH_BASE_FRAME::HandleBlockBegin() unknown command: %s", - block->GetCommand() ) ); - break; - } - - block->SetMessageBlock( this ); - return true; -} - void SCH_BASE_FRAME::createCanvas() { m_canvasType = LoadCanvasTypeSetting(); diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index 3d58d2bf26..dcded1a037 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -353,9 +353,6 @@ protected: */ bool saveSymbolLibTables( bool aGlobal, bool aProject ); - virtual bool HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition, - int aExplicitCommand = 0 ) override; - }; #endif // SCH_BASE_FRAME_H_ diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 095fb4c47e..2033951a98 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -276,7 +276,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_MENU( ID_MENU_CANVAS_OPENGL, SCH_EDIT_FRAME::OnSwitchCanvas ) /* Handle user interface update events. */ - EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste ) EVT_UPDATE_UI( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnUpdateSave ) EVT_UPDATE_UI( ID_UPDATE_ONE_SHEET, SCH_EDIT_FRAME::OnUpdateSaveSheet ) EVT_UPDATE_UI( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnUpdateRemapSymbols ) @@ -734,12 +733,6 @@ void SCH_EDIT_FRAME::OnModify() } -void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event ) -{ - event.Enable( m_blockItems.GetCount() > 0 ); -} - - void SCH_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent ) { SCH_SHEET_LIST sheetList( g_RootSheet ); diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index df1092ee3b..f1324aba9e 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -119,7 +119,6 @@ private: DIALOG_SCH_FIND* m_dlgFindReplace; wxArrayString m_findStringHistoryList; wxArrayString m_replaceStringHistoryList; - BLOCK_SELECTOR m_blockItems; ///< List of selected items. SCH_ITEM* m_item_to_repeat; ///< Last item to insert by the repeat command. int m_repeatLabelDelta; ///< Repeat label number increment step. SCH_FIND_COLLECTOR m_foundItems; ///< List of find/replace items. @@ -797,7 +796,6 @@ private: void OnPreferencesOptions( wxCommandEvent& event ); /* User interface update event handlers. */ - void OnUpdatePaste( wxUpdateUIEvent& event ); void OnUpdateSave( wxUpdateUIEvent& aEvent ); void OnUpdateSaveSheet( wxUpdateUIEvent& aEvent ); void OnUpdateRemapSymbols( wxUpdateUIEvent& aEvent );