Fixed footprint editor crash on ref/val text layer change (GAL).
This commit is contained in:
parent
a09d6431e4
commit
0cad702fc7
|
@ -102,17 +102,18 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
|||
return false;
|
||||
}
|
||||
|
||||
// Clear undo and redo lists
|
||||
// Clear undo and redo lists because we want a full deletion
|
||||
GetScreen()->ClearUndoRedoList();
|
||||
GetScreen()->ClrModify();
|
||||
|
||||
// Delete the current footprint
|
||||
GetBoard()->m_Modules.DeleteAll();
|
||||
|
||||
// init pointeurs et variables
|
||||
GetBoard()->SetFileName( wxEmptyString );
|
||||
BOARD* board = new BOARD;
|
||||
SetBoard( board );
|
||||
|
||||
SetCurItem( NULL );
|
||||
|
||||
// clear filename, to avoid overwriting an old file
|
||||
GetBoard()->SetFileName( wxEmptyString );
|
||||
|
||||
GetScreen()->InitDataPoints( GetPageSizeIU() );
|
||||
|
||||
Zoom_Automatique( false );
|
||||
|
|
|
@ -86,8 +86,9 @@ PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings()
|
|||
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) GetDisplayOptions();
|
||||
BOARD_DESIGN_SETTINGS& settings = GetDesignSettings();
|
||||
|
||||
if( m_configSettings.empty() )
|
||||
{
|
||||
// Update everything
|
||||
m_configSettings.clear(); // boost::ptr_vector destroys the pointers inside
|
||||
|
||||
// Display options:
|
||||
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ),
|
||||
(int*)&g_UserUnit, MILLIMETRES ) );
|
||||
|
@ -144,7 +145,6 @@ PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings()
|
|||
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ),
|
||||
&settings.m_ValueDefaultlayer,
|
||||
int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) );
|
||||
}
|
||||
|
||||
return m_configSettings;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
*/
|
||||
|
||||
#include <pcb_base_edit_frame.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <class_board.h>
|
||||
|
||||
void PCB_BASE_EDIT_FRAME::SetRotationAngle( int aRotationAngle )
|
||||
{
|
||||
|
@ -56,3 +59,29 @@ void PCB_BASE_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
|||
if( !aEnable )
|
||||
UndoRedoBlock( false );
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
||||
{
|
||||
bool new_board = ( aBoard != m_Pcb );
|
||||
|
||||
// It has to be done before the previous board is destroyed by SetBoard()
|
||||
if( new_board )
|
||||
GetGalCanvas()->GetView()->Clear();
|
||||
|
||||
PCB_BASE_FRAME::SetBoard( aBoard );
|
||||
|
||||
// update the tool manager with the new board and its view.
|
||||
if( m_toolManager )
|
||||
{
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
|
||||
|
||||
drawPanel->DisplayBoard( aBoard );
|
||||
m_toolManager->SetEnvironment( aBoard, drawPanel->GetView(),
|
||||
drawPanel->GetViewControls(), this );
|
||||
|
||||
if( new_board )
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,9 @@ public:
|
|||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||
void UseGalCanvas( bool aEnable );
|
||||
|
||||
///> @copydoc PCB_BASE_FRAME::SetBoard()
|
||||
virtual void SetBoard( BOARD* aBoard );
|
||||
|
||||
protected:
|
||||
/// User defined rotation angle (in tenths of a degree).
|
||||
int m_rotationAngle;
|
||||
|
|
|
@ -213,10 +213,16 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( const BOARD* aBoard )
|
|||
m_view->Add( zone );
|
||||
|
||||
// Ratsnest
|
||||
if( m_ratsnest )
|
||||
{
|
||||
m_view->Remove( m_ratsnest );
|
||||
delete m_ratsnest;
|
||||
}
|
||||
|
||||
m_ratsnest = new KIGFX::RATSNEST_VIEWITEM( aBoard->GetRatsnest() );
|
||||
m_view->Add( m_ratsnest );
|
||||
|
||||
// Display settings
|
||||
UseColorScheme( aBoard->GetColorsSettings() );
|
||||
|
||||
PCB_BASE_FRAME* frame = dynamic_cast<PCB_BASE_FRAME*>( GetParent() );
|
||||
|
|
|
@ -476,29 +476,14 @@ PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
|
|||
|
||||
void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
||||
{
|
||||
bool new_board = ( aBoard != m_Pcb );
|
||||
|
||||
PCB_BASE_FRAME::SetBoard( aBoard );
|
||||
PCB_BASE_EDIT_FRAME::SetBoard( aBoard );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
|
||||
|
||||
drawPanel->DisplayBoard( aBoard );
|
||||
aBoard->GetRatsnest()->Recalculate();
|
||||
|
||||
// reload the worksheet
|
||||
SetPageSettings( aBoard->GetPageSettings() );
|
||||
|
||||
// update the tool manager with the new board and its view.
|
||||
if( m_toolManager )
|
||||
{
|
||||
m_toolManager->SetEnvironment( aBoard, drawPanel->GetView(),
|
||||
drawPanel->GetViewControls(), this );
|
||||
|
||||
if( new_board )
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1081,7 +1081,7 @@ void EDIT_TOOL::processPickedList( const PICKED_ITEMS_LIST* aList )
|
|||
// fall through
|
||||
|
||||
case UR_MODEDIT:
|
||||
updItem->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
updItem->ViewUpdate( KIGFX::VIEW_ITEM::ALL );
|
||||
break;
|
||||
|
||||
case UR_DELETED:
|
||||
|
|
Loading…
Reference in New Issue