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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear undo and redo lists
|
// Clear undo and redo lists because we want a full deletion
|
||||||
GetScreen()->ClearUndoRedoList();
|
GetScreen()->ClearUndoRedoList();
|
||||||
|
GetScreen()->ClrModify();
|
||||||
|
|
||||||
// Delete the current footprint
|
BOARD* board = new BOARD;
|
||||||
GetBoard()->m_Modules.DeleteAll();
|
SetBoard( board );
|
||||||
|
|
||||||
// init pointeurs et variables
|
|
||||||
GetBoard()->SetFileName( wxEmptyString );
|
|
||||||
|
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
|
|
||||||
|
// clear filename, to avoid overwriting an old file
|
||||||
|
GetBoard()->SetFileName( wxEmptyString );
|
||||||
|
|
||||||
GetScreen()->InitDataPoints( GetPageSizeIU() );
|
GetScreen()->InitDataPoints( GetPageSizeIU() );
|
||||||
|
|
||||||
Zoom_Automatique( false );
|
Zoom_Automatique( false );
|
||||||
|
|
|
@ -83,68 +83,68 @@ void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
|
|
||||||
PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings()
|
PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings()
|
||||||
{
|
{
|
||||||
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
|
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) GetDisplayOptions();
|
||||||
BOARD_DESIGN_SETTINGS& settings = GetDesignSettings();
|
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 ) );
|
|
||||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
|
|
||||||
&displ_opts->m_DisplayPolarCood, false ) );
|
|
||||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
|
|
||||||
&displ_opts->m_DisplayPadFill, true ) );
|
|
||||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ),
|
|
||||||
&displ_opts->m_DisplayModEdgeFill, FILLED ) );
|
|
||||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
|
|
||||||
&displ_opts->m_DisplayModTextFill, FILLED ) );
|
|
||||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
|
|
||||||
&displ_opts->m_DisplayModTextFill, FILLED ) );
|
|
||||||
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ),
|
|
||||||
&settings.m_RefDefaultText, wxT( "REF**" ) ) );
|
|
||||||
|
|
||||||
// design settings
|
// Display options:
|
||||||
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorGrlineWidth" ),
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ),
|
||||||
&settings.m_ModuleSegmentWidth,
|
(int*)&g_UserUnit, MILLIMETRES ) );
|
||||||
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
|
||||||
Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
|
&displ_opts->m_DisplayPolarCood, false ) );
|
||||||
NULL, 1/IU_PER_MM ) );
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
|
||||||
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeH" ),
|
&displ_opts->m_DisplayPadFill, true ) );
|
||||||
&settings.m_ModuleTextSize.x,
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ),
|
||||||
Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
|
&displ_opts->m_DisplayModEdgeFill, FILLED ) );
|
||||||
Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
|
||||||
NULL, 1/IU_PER_MM ) );
|
&displ_opts->m_DisplayModTextFill, FILLED ) );
|
||||||
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeV" ),
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
|
||||||
&settings.m_ModuleTextSize.y,
|
&displ_opts->m_DisplayModTextFill, FILLED ) );
|
||||||
Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
|
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ),
|
||||||
Millimeter2iu(0.01), Millimeter2iu( 100.0 ),
|
&settings.m_RefDefaultText, wxT( "REF**" ) ) );
|
||||||
NULL, 1/IU_PER_MM ) );
|
|
||||||
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultThickness" ),
|
|
||||||
&settings.m_ModuleTextWidth,
|
|
||||||
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
|
|
||||||
Millimeter2iu( 0.01 ), Millimeter2iu( 20.0 ),
|
|
||||||
NULL, 1/IU_PER_MM ) );
|
|
||||||
|
|
||||||
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true,
|
// design settings
|
||||||
wxT( "FpEditorRefDefaultText" ),
|
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorGrlineWidth" ),
|
||||||
&settings.m_RefDefaultText, wxT( "REF**" ) ) );
|
&settings.m_ModuleSegmentWidth,
|
||||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true,
|
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
|
||||||
wxT( "FpEditorRefDefaultVisibility" ),
|
Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
|
||||||
&settings.m_RefDefaultVisibility, true ) );
|
NULL, 1/IU_PER_MM ) );
|
||||||
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ),
|
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeH" ),
|
||||||
&settings.m_RefDefaultlayer,
|
&settings.m_ModuleTextSize.x,
|
||||||
int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) );
|
Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
|
||||||
|
Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
|
||||||
|
NULL, 1/IU_PER_MM ) );
|
||||||
|
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeV" ),
|
||||||
|
&settings.m_ModuleTextSize.y,
|
||||||
|
Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
|
||||||
|
Millimeter2iu(0.01), Millimeter2iu( 100.0 ),
|
||||||
|
NULL, 1/IU_PER_MM ) );
|
||||||
|
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultThickness" ),
|
||||||
|
&settings.m_ModuleTextWidth,
|
||||||
|
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
|
||||||
|
Millimeter2iu( 0.01 ), Millimeter2iu( 20.0 ),
|
||||||
|
NULL, 1/IU_PER_MM ) );
|
||||||
|
|
||||||
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ),
|
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true,
|
||||||
&settings.m_ValueDefaultText, wxT( "" ) ) );
|
wxT( "FpEditorRefDefaultText" ),
|
||||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true,
|
&settings.m_RefDefaultText, wxT( "REF**" ) ) );
|
||||||
wxT( "FpEditorValueDefaultVisibility" ),
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true,
|
||||||
&settings.m_ValueDefaultVisibility, true ) );
|
wxT( "FpEditorRefDefaultVisibility" ),
|
||||||
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ),
|
&settings.m_RefDefaultVisibility, true ) );
|
||||||
&settings.m_ValueDefaultlayer,
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ),
|
||||||
int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) );
|
&settings.m_RefDefaultlayer,
|
||||||
}
|
int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) );
|
||||||
|
|
||||||
|
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ),
|
||||||
|
&settings.m_ValueDefaultText, wxT( "" ) ) );
|
||||||
|
m_configSettings.push_back( new PARAM_CFG_BOOL( true,
|
||||||
|
wxT( "FpEditorValueDefaultVisibility" ),
|
||||||
|
&settings.m_ValueDefaultVisibility, true ) );
|
||||||
|
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;
|
return m_configSettings;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <pcb_base_edit_frame.h>
|
#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 )
|
void PCB_BASE_EDIT_FRAME::SetRotationAngle( int aRotationAngle )
|
||||||
{
|
{
|
||||||
|
@ -56,3 +59,29 @@ void PCB_BASE_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
||||||
if( !aEnable )
|
if( !aEnable )
|
||||||
UndoRedoBlock( false );
|
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()
|
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||||
void UseGalCanvas( bool aEnable );
|
void UseGalCanvas( bool aEnable );
|
||||||
|
|
||||||
|
///> @copydoc PCB_BASE_FRAME::SetBoard()
|
||||||
|
virtual void SetBoard( BOARD* aBoard );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// User defined rotation angle (in tenths of a degree).
|
/// User defined rotation angle (in tenths of a degree).
|
||||||
int m_rotationAngle;
|
int m_rotationAngle;
|
||||||
|
|
|
@ -213,10 +213,16 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( const BOARD* aBoard )
|
||||||
m_view->Add( zone );
|
m_view->Add( zone );
|
||||||
|
|
||||||
// Ratsnest
|
// Ratsnest
|
||||||
delete m_ratsnest;
|
if( m_ratsnest )
|
||||||
|
{
|
||||||
|
m_view->Remove( m_ratsnest );
|
||||||
|
delete m_ratsnest;
|
||||||
|
}
|
||||||
|
|
||||||
m_ratsnest = new KIGFX::RATSNEST_VIEWITEM( aBoard->GetRatsnest() );
|
m_ratsnest = new KIGFX::RATSNEST_VIEWITEM( aBoard->GetRatsnest() );
|
||||||
m_view->Add( m_ratsnest );
|
m_view->Add( m_ratsnest );
|
||||||
|
|
||||||
|
// Display settings
|
||||||
UseColorScheme( aBoard->GetColorsSettings() );
|
UseColorScheme( aBoard->GetColorsSettings() );
|
||||||
|
|
||||||
PCB_BASE_FRAME* frame = dynamic_cast<PCB_BASE_FRAME*>( GetParent() );
|
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 )
|
void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
||||||
{
|
{
|
||||||
bool new_board = ( aBoard != m_Pcb );
|
PCB_BASE_EDIT_FRAME::SetBoard( aBoard );
|
||||||
|
|
||||||
PCB_BASE_FRAME::SetBoard( aBoard );
|
|
||||||
|
|
||||||
if( IsGalCanvasActive() )
|
if( IsGalCanvasActive() )
|
||||||
{
|
{
|
||||||
PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
|
|
||||||
|
|
||||||
drawPanel->DisplayBoard( aBoard );
|
|
||||||
aBoard->GetRatsnest()->Recalculate();
|
aBoard->GetRatsnest()->Recalculate();
|
||||||
|
|
||||||
// reload the worksheet
|
// reload the worksheet
|
||||||
SetPageSettings( aBoard->GetPageSettings() );
|
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
|
// fall through
|
||||||
|
|
||||||
case UR_MODEDIT:
|
case UR_MODEDIT:
|
||||||
updItem->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
updItem->ViewUpdate( KIGFX::VIEW_ITEM::ALL );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UR_DELETED:
|
case UR_DELETED:
|
||||||
|
|
Loading…
Reference in New Issue