Eeschema: Speed up global changes in DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS.

Previously, OnModify() was called for a lot of items, even when not modified.
For large schematics, the calculation time was unreasonable ( several minutes)
It is now called only a few times.
This commit is contained in:
jean-pierre charras 2020-02-04 14:01:06 +01:00
parent ac875e26a8
commit 0049185d06
5 changed files with 2334 additions and 2301 deletions

View File

@ -461,7 +461,7 @@ bool CINFO3D_VISU::createBoardPolygon()
wxString errmsg;
return m_board->GetBoardPolygonOutlines( m_board_poly, /*allLayerHoles,*/ &errmsg );
return m_board->GetBoardPolygonOutlines( m_board_poly, &errmsg );
}

View File

@ -64,6 +64,8 @@ class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS : public DIALOG_GLOBAL_EDIT_TEXT_AND_
UNIT_BINDER m_textSize;
UNIT_BINDER m_lineWidth;
bool m_hasChange;
public:
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( SCH_EDIT_FRAME* parent );
~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS() override;
@ -93,6 +95,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( SCH_
m_lineWidth( parent, m_lineWidthLabel, m_LineWidthCtrl, m_lineWidthUnits, true )
{
m_parent = parent;
m_hasChange = false;
// TODO(JE) remove once real-time connectivity is a given
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
@ -202,22 +205,40 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aS
if( eda_text )
{
if( !m_textSize.IsIndeterminate() )
{
eda_text->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) );
m_hasChange = true;
}
if( m_hAlign->GetStringSelection() != INDETERMINATE )
{
eda_text->SetHorizJustify( EDA_TEXT::MapHorizJustify( m_hAlign->GetSelection() - 1 ) );
m_hasChange = true;
}
if( m_hAlign->GetStringSelection() != INDETERMINATE )
{
eda_text->SetVertJustify( EDA_TEXT::MapVertJustify( m_vAlign->GetSelection() - 1 ) );
m_hasChange = true;
}
if( m_Visible->Get3StateValue() != wxCHK_UNDETERMINED )
{
eda_text->SetVisible( m_Visible->GetValue() );
m_hasChange = true;
}
if( m_Italic->Get3StateValue() != wxCHK_UNDETERMINED )
{
eda_text->SetItalic( m_Visible->GetValue() );
m_hasChange = true;
}
if( m_Bold->Get3StateValue() != wxCHK_UNDETERMINED )
{
eda_text->SetBold( m_Visible->GetValue() );
m_hasChange = true;
}
}
// No else! Labels are both.
@ -226,25 +247,33 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aS
if( m_orientation->GetStringSelection() != INDETERMINATE )
{
sch_text->SetLabelSpinStyle( m_orientation->GetSelection() );
m_hasChange = true;
}
}
if( lineItem )
{
if( !m_lineWidth.IsIndeterminate() )
{
lineItem->SetLineWidth( m_lineWidth.GetValue() );
m_hasChange = true;
}
if( lineItem->GetLayer() == LAYER_NOTES )
{
if( m_lineStyle->GetStringSelection() != INDETERMINATE )
{
lineItem->SetLineStyle( m_lineStyle->GetSelection() );
m_hasChange = true;
}
if( m_setColor->GetValue() )
{
lineItem->SetLineColor( m_color->GetColour() );
m_hasChange = true;
}
}
}
m_parent->OnModify();
}
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aSheetPath,
@ -346,12 +375,18 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
if( screen )
{
m_hasChange = false;
for( auto item : screen->Items() )
visitItem( sheetPath, item );
}
}
if( m_hasChange )
{
m_parent->OnModify();
m_parent->HardRedraw();
}
}
}
return true;
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Jul 10 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Jul 10 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE_H__
#define __DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -100,4 +99,3 @@ class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM
};
#endif //__DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE_H__