Eeschema: Fix incorrect display refresh when editing the reference of a component from the popup menu.

This commit is contained in:
jean-pierre charras 2012-06-03 13:16:08 +02:00
parent 2455a6cc3b
commit 20a6b7ea70
4 changed files with 16 additions and 12 deletions

View File

@ -35,14 +35,13 @@
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <general.h> #include <general.h>
#include <protos.h>
#include <class_library.h> #include <class_library.h>
#include <sch_component.h> #include <sch_component.h>
#include <dialog_edit_one_field.h> #include <dialog_edit_one_field.h>
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, wxCHECK_RET( aField != NULL && aField->Type() == SCH_FIELD_T,
wxT( "Cannot edit invalid schematic field." ) ); wxT( "Cannot edit invalid schematic field." ) );
@ -81,7 +80,6 @@ create a new power component with the new value." ), GetChars( entry->GetName()
wxString title; wxString title;
title.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) ); 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 if( aField->GetText().IsEmpty() ) // Means the field was not already in use
{ {
aField->m_Pos = component->GetPosition(); aField->m_Pos = component->GetPosition();
@ -104,7 +102,7 @@ create a new power component with the new value." ), GetChars( entry->GetName()
{ {
if( fieldNdx == REFERENCE ) if( fieldNdx == REFERENCE )
{ {
// Test is reference is acceptable: // Test if the reference string is valid:
if( SCH_COMPONENT::IsReferenceStringValid( newtext ) ) if( SCH_COMPONENT::IsReferenceStringValid( newtext ) )
{ {
component->SetRef( m_CurrentSheet, 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 ) if( can_update )
{ {
aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
dlg.TransfertDataToField(); dlg.TransfertDataToField();
aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
OnModify(); OnModify();
m_canvas->Refresh();
} }
component->DisplayInfo( this ); component->DisplayInfo( this );

View File

@ -363,7 +363,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
break; break;
case SCH_FIELD_T: case SCH_FIELD_T:
EditComponentFieldText( (SCH_FIELD*) item, aDC ); EditComponentFieldText( (SCH_FIELD*) item );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;

View File

@ -811,15 +811,15 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
switch( aEvent.GetId() ) switch( aEvent.GetId() )
{ {
case ID_SCH_EDIT_COMPONENT_REFERENCE: case ID_SCH_EDIT_COMPONENT_REFERENCE:
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ), &dc ); EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ) );
break; break;
case ID_SCH_EDIT_COMPONENT_VALUE: case ID_SCH_EDIT_COMPONENT_VALUE:
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ), &dc ); EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ) );
break; break;
case ID_SCH_EDIT_COMPONENT_FOOTPRINT: case ID_SCH_EDIT_COMPONENT_FOOTPRINT:
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ), &dc ); EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ) );
break; break;
case ID_SCH_EDIT_ITEM: case ID_SCH_EDIT_ITEM:
@ -850,7 +850,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
break; break;
case SCH_FIELD_T: case SCH_FIELD_T:
EditComponentFieldText( (SCH_FIELD*) item, &dc ); EditComponentFieldText( (SCH_FIELD*) item );
break; break;
case SCH_BITMAP_T: case SCH_BITMAP_T:

View File

@ -963,7 +963,14 @@ private:
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC ); void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
void SetInitCmp( 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 ); void RotateField( SCH_FIELD* aField, wxDC* aDC );
/** /**