From 20a6b7ea70e741c76878f3792cfa907293a48729 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 3 Jun 2012 13:16:08 +0200 Subject: [PATCH] Eeschema: Fix incorrect display refresh when editing the reference of a component from the popup menu. --- eeschema/edit_component_in_schematic.cpp | 9 +++------ eeschema/onleftclick.cpp | 2 +- eeschema/schedit.cpp | 8 ++++---- include/wxEeschemaStruct.h | 9 ++++++++- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index c940fd2826..c56ce78a47 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -35,14 +35,13 @@ #include #include -#include #include #include #include -void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC ) +void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField ) { wxCHECK_RET( aField != NULL && aField->Type() == SCH_FIELD_T, wxT( "Cannot edit invalid schematic field." ) ); @@ -81,7 +80,6 @@ create a new power component with the new value." ), GetChars( entry->GetName() wxString title; title.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) ); -// wxTextEntryDialog dlg( this, wxEmptyString , title, newtext ); if( aField->GetText().IsEmpty() ) // Means the field was not already in use { aField->m_Pos = component->GetPosition(); @@ -104,7 +102,7 @@ create a new power component with the new value." ), GetChars( entry->GetName() { if( fieldNdx == REFERENCE ) { - // Test is reference is acceptable: + // Test if the reference string is valid: if( SCH_COMPONENT::IsReferenceStringValid( newtext ) ) { component->SetRef( m_CurrentSheet, newtext ); @@ -136,10 +134,9 @@ create a new power component with the new value." ), GetChars( entry->GetName() if( can_update ) { - aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); dlg.TransfertDataToField(); - aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); OnModify(); + m_canvas->Refresh(); } component->DisplayInfo( this ); diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index bd4c30e38f..2fc952c46e 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -363,7 +363,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) break; case SCH_FIELD_T: - EditComponentFieldText( (SCH_FIELD*) item, aDC ); + EditComponentFieldText( (SCH_FIELD*) item ); m_canvas->MoveCursorToCrossHair(); break; diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 3a95b96d18..4cba871d62 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -811,15 +811,15 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent ) switch( aEvent.GetId() ) { case ID_SCH_EDIT_COMPONENT_REFERENCE: - EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ), &dc ); + EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ) ); break; case ID_SCH_EDIT_COMPONENT_VALUE: - EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ), &dc ); + EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ) ); break; case ID_SCH_EDIT_COMPONENT_FOOTPRINT: - EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ), &dc ); + EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ) ); break; case ID_SCH_EDIT_ITEM: @@ -850,7 +850,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent ) break; case SCH_FIELD_T: - EditComponentFieldText( (SCH_FIELD*) item, &dc ); + EditComponentFieldText( (SCH_FIELD*) item ); break; case SCH_BITMAP_T: diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index b129a97b57..ac84df5a1b 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -963,7 +963,14 @@ private: void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC ); void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC ); - void EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC ); + /** + * Function EditComponentFieldText + * displays the edit field dialog to edit the parameters of \a aField. + * + * @param aField is a pointer to the SCH_FIELD object to be edited. + */ + void EditComponentFieldText( SCH_FIELD* aField ); + void RotateField( SCH_FIELD* aField, wxDC* aDC ); /**