Pcbnew fix: "create array" extremely slow in GAL mode, due to a useless call of a time consuming method for each new item created.
This commit is contained in:
parent
01f5a129a3
commit
a35a46804e
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "array_creator.h"
|
#include "array_creator.h"
|
||||||
|
|
||||||
#include <board_commit.h>
|
#include <board_commit.h>
|
||||||
|
|
||||||
#include <dialogs/dialog_create_array.h>
|
#include <dialogs/dialog_create_array.h>
|
||||||
|
@ -41,7 +40,6 @@ void ARRAY_CREATOR::Invoke()
|
||||||
if( numItems == 0 )
|
if( numItems == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BOARD_COMMIT commit( &m_parent );
|
|
||||||
MODULE* const module = getModule();
|
MODULE* const module = getModule();
|
||||||
const bool isModuleEditor = module != NULL;
|
const bool isModuleEditor = module != NULL;
|
||||||
|
|
||||||
|
@ -56,6 +54,8 @@ void ARRAY_CREATOR::Invoke()
|
||||||
if( ret != wxID_OK || array_opts == NULL )
|
if( ret != wxID_OK || array_opts == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
BOARD_COMMIT commit( &m_parent );
|
||||||
|
|
||||||
for ( int i = 0; i < numItems; ++i )
|
for ( int i = 0; i < numItems; ++i )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = getNthItemToArray( i );
|
BOARD_ITEM* item = getNthItemToArray( i );
|
||||||
|
|
|
@ -828,7 +828,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
class GAL_ARRAY_CREATOR: public ARRAY_CREATOR
|
class GAL_ARRAY_CREATOR: public ARRAY_CREATOR
|
||||||
|
@ -873,10 +873,20 @@ private:
|
||||||
return wxPoint( rp.x, rp.y );
|
return wxPoint( rp.x, rp.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
void prePushAction( BOARD_ITEM* new_item ) override
|
void prePushAction( BOARD_ITEM* aItem ) override
|
||||||
{
|
{
|
||||||
m_parent.GetToolManager()->RunAction( PCB_ACTIONS::unselectItem,
|
// Because aItem is/can be created from a selected item, and inherits from
|
||||||
true, new_item );
|
// it this state, reset the selected stated of aItem:
|
||||||
|
aItem->ClearSelected();
|
||||||
|
|
||||||
|
if( aItem->Type() == PCB_MODULE_T )
|
||||||
|
{
|
||||||
|
static_cast<MODULE*>( aItem )->RunOnChildren( [&] ( BOARD_ITEM* item )
|
||||||
|
{
|
||||||
|
item->ClearSelected();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void postPushAction( BOARD_ITEM* new_item ) override
|
void postPushAction( BOARD_ITEM* new_item ) override
|
||||||
|
|
|
@ -906,7 +906,7 @@ int PCBNEW_CONTROL::AppendBoard( const TOOL_EVENT& aEvent )
|
||||||
board->GetRatsnest()->ProcessBoard();
|
board->GetRatsnest()->ProcessBoard();
|
||||||
|
|
||||||
// Start dragging the appended board
|
// Start dragging the appended board
|
||||||
if( selection.Front() ) // be sure at least one item is selected
|
if( selection.Size() ) // be sure at least one item is loaded
|
||||||
{
|
{
|
||||||
// Inform other potentially interested tools
|
// Inform other potentially interested tools
|
||||||
m_toolMgr->ProcessEvent( SELECTION_TOOL::SelectedEvent );
|
m_toolMgr->ProcessEvent( SELECTION_TOOL::SelectedEvent );
|
||||||
|
|
Loading…
Reference in New Issue