Fix assert in Graphic Item Properties.

Fixes: lp:1792201
* https://bugs.launchpad.net/kicad/+bug/1792201
This commit is contained in:
Jeff Young 2018-09-12 20:39:37 +01:00
parent 46426f1196
commit 42ee4f79e4
6 changed files with 10 additions and 29 deletions

View File

@ -46,7 +46,6 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES : public DIALOG_GRAPHIC_ITEM_PROPERTIES_BAS
{ {
private: private:
PCB_BASE_EDIT_FRAME* m_parent; PCB_BASE_EDIT_FRAME* m_parent;
wxDC* m_DC;
DRAWSEGMENT* m_item; DRAWSEGMENT* m_item;
EDGE_MODULE* m_moduleItem; EDGE_MODULE* m_moduleItem;
@ -61,7 +60,7 @@ private:
double m_AngleValue; double m_AngleValue;
public: public:
DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem, wxDC* aDC ); DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem );
~DIALOG_GRAPHIC_ITEM_PROPERTIES() {}; ~DIALOG_GRAPHIC_ITEM_PROPERTIES() {};
private: private:
@ -81,7 +80,7 @@ private:
}; };
DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent,
BOARD_ITEM* aItem, wxDC* aDC ): BOARD_ITEM* aItem ):
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( aParent ), DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( aParent ),
m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ), m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ),
m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ), m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ),
@ -97,7 +96,6 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
m_AngleValue( 0.0 ) m_AngleValue( 0.0 )
{ {
m_parent = aParent; m_parent = aParent;
m_DC = aDC;
m_item = dynamic_cast<DRAWSEGMENT*>( aItem ); m_item = dynamic_cast<DRAWSEGMENT*>( aItem );
m_moduleItem = dynamic_cast<EDGE_MODULE*>( aItem ); m_moduleItem = dynamic_cast<EDGE_MODULE*>( aItem );
@ -120,23 +118,16 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
} }
void PCB_BASE_EDIT_FRAME::InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem, wxDC* aDC ) void PCB_BASE_EDIT_FRAME::InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem )
{ {
wxCHECK_RET( aItem != NULL, wxT( "InstallGraphicItemPropertiesDialog() error: NULL item" ) ); wxCHECK_RET( aItem != NULL, wxT( "InstallGraphicItemPropertiesDialog() error: NULL item" ) );
#ifdef USE_WX_OVERLAY
// #1277772 - Draw into dialog converted in refresh request
aDC = nullptr;
#endif
m_canvas->SetIgnoreMouseEvents( true ); m_canvas->SetIgnoreMouseEvents( true );
DIALOG_GRAPHIC_ITEM_PROPERTIES dlg( this, aItem, aDC ); DIALOG_GRAPHIC_ITEM_PROPERTIES dlg( this, aItem );
dlg.ShowModal(); dlg.ShowModal();
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false ); m_canvas->SetIgnoreMouseEvents( false );
m_canvas->Refresh();
if( !aDC )
m_canvas->Refresh();
} }
@ -234,11 +225,6 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
BOARD_COMMIT commit( m_parent ); BOARD_COMMIT commit( m_parent );
commit.Modify( m_item ); commit.Modify( m_item );
wxString msg;
if( m_DC )
m_item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR );
m_item->SetStartX( m_startX.GetValue() ); m_item->SetStartX( m_startX.GetValue() );
m_item->SetStartY( m_startY.GetValue() ); m_item->SetStartY( m_startY.GetValue() );
@ -277,17 +263,12 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
m_item->SetLayer( ToLAYER_ID( layer ) ); m_item->SetLayer( ToLAYER_ID( layer ) );
if( m_item->GetShape() == S_ARC ) if( m_item->GetShape() == S_ARC )
{
m_item->SetAngle( m_AngleValue * 10.0 ); m_item->SetAngle( m_AngleValue * 10.0 );
}
m_item->RebuildBezierToSegmentsPointsList( m_item->GetWidth() ); m_item->RebuildBezierToSegmentsPointsList( m_item->GetWidth() );
commit.Push( _( "Modify drawing properties" ) ); commit.Push( _( "Modify drawing properties" ) );
if( m_DC )
m_item->Draw( m_parent->GetCanvas(), m_DC, GR_OR );
m_parent->SetMsgPanel( m_item ); m_parent->SetMsgPanel( m_item );
return true; return true;

View File

@ -1119,7 +1119,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_EDIT_DRAWING: case ID_POPUP_PCB_EDIT_DRAWING:
InstallGraphicItemPropertiesDialog( GetCurItem(), &dc ); InstallGraphicItemPropertiesDialog( GetCurItem() );
break; break;
case ID_POPUP_PCB_MOVE_DRAWING_REQUEST: case ID_POPUP_PCB_MOVE_DRAWING_REQUEST:

View File

@ -534,7 +534,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
break; break;
case PCB_MODULE_EDGE_T : case PCB_MODULE_EDGE_T :
InstallGraphicItemPropertiesDialog( aItem, nullptr ); InstallGraphicItemPropertiesDialog( aItem );
break; break;
default: default:

View File

@ -714,7 +714,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_MODEDIT_EDIT_BODY_ITEM : case ID_POPUP_MODEDIT_EDIT_BODY_ITEM :
InstallGraphicItemPropertiesDialog( GetScreen()->GetCurItem(), nullptr ); InstallGraphicItemPropertiesDialog( GetScreen()->GetCurItem() );
break; break;
case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE: case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:

View File

@ -608,7 +608,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
break; break;
case PCB_LINE_T: case PCB_LINE_T:
InstallGraphicItemPropertiesDialog( aItem, aDC ); InstallGraphicItemPropertiesDialog( aItem );
break; break;
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:

View File

@ -164,7 +164,7 @@ public:
void SetRotationAngle( int aRotationAngle ); void SetRotationAngle( int aRotationAngle );
void InstallTextOptionsFrame( BOARD_ITEM* aText, wxDC* aDC ); void InstallTextOptionsFrame( BOARD_ITEM* aText, wxDC* aDC );
void InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem, wxDC* aDC ); void InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem );
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas() ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
void UseGalCanvas( bool aEnable ) override; void UseGalCanvas( bool aEnable ) override;