diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index ff87ad21bb..76e409f1af 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -305,8 +305,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow() if( !m_grid->CommitPendingChanges() ) return false; - // We need to keep the name and the value the same at the moment! - wxString newName = EscapeString( m_fields->at( VALUE_FIELD ).GetText(), CTX_LIBID ); + wxString newName = EscapeString( m_SymbolNameCtrl->GetValue(), CTX_LIBID ); wxString oldName = m_libEntry->GetName(); if( oldName != newName ) @@ -363,7 +362,6 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow() m_libEntry->SetParent( newParent ); } - // We need to keep the name and the value the same at the moment! m_libEntry->SetName( newName ); m_libEntry->SetDescription( m_DescCtrl->GetValue() ); m_libEntry->SetKeyWords( m_KeywordCtrl->GetValue() ); @@ -374,9 +372,15 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow() m_Parent->SetShowDeMorgan( m_AsConvertButt->GetValue() ); if( m_OptionPower->GetValue() ) + { m_libEntry->SetPower(); + // Power symbols must have value matching name for now + m_libEntry->GetValueField().SetText( newName ); + } else + { m_libEntry->SetNormal(); + } m_libEntry->SetIncludeInBom( !m_excludeFromBomCheckBox->GetValue() ); m_libEntry->SetIncludeOnBoard( !m_excludeFromBoardCheckBox->GetValue() ); @@ -442,10 +446,6 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnGridCellChanging( wxGridEvent& event ) } } } - else if( event.GetRow() == VALUE_FIELD && event.GetCol() == FDC_VALUE ) - { - m_SymbolNameCtrl->ChangeValue( event.GetString() ); - } editor->DecRef(); } @@ -453,7 +453,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnGridCellChanging( wxGridEvent& event ) void DIALOG_LIB_SYMBOL_PROPERTIES::OnSymbolNameText( wxCommandEvent& event ) { - if( !m_Parent->IsSymbolFromSchematic() || m_OptionPower->IsChecked() ) + if( m_OptionPower->IsChecked() ) m_grid->SetCellValue( VALUE_FIELD, FDC_VALUE, m_SymbolNameCtrl->GetValue() ); } @@ -736,7 +736,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event ) int row = m_grid->GetGridCursorRow(); int col = m_grid->GetGridCursorCol(); - if( row == VALUE_FIELD && col == FDC_VALUE ) + if( row == VALUE_FIELD && col == FDC_VALUE && m_OptionPower->IsChecked() ) { wxGridCellEditor* editor = m_grid->GetCellEditor( row, col ); m_SymbolNameCtrl->ChangeValue( editor->GetValue() ); diff --git a/eeschema/dialogs/dialog_symbol_properties.cpp b/eeschema/dialogs/dialog_symbol_properties.cpp index e10496f1db..01cdd428bd 100644 --- a/eeschema/dialogs/dialog_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_symbol_properties.cpp @@ -681,11 +681,6 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow() for( unsigned i = 0; i < m_fields->size(); ++i ) m_fields->at( i ).Offset( m_symbol->GetPosition() ); - LIB_SYMBOL* entry = GetParent()->GetLibSymbol( m_symbol->GetLibId() ); - - if( entry && entry->IsPower() ) - m_fields->at( VALUE_FIELD ).SetText( m_symbol->GetLibId().GetLibItemName() ); - SCH_FIELDS& fields = m_symbol->GetFields(); fields.clear(); diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 13978bc9d2..5644d3bed3 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -365,7 +365,8 @@ void LIB_SYMBOL::SetName( const wxString& aName ) m_name = aName; m_libId.SetLibItemName( aName ); - GetValueField().SetText( aName ); + if( IsPower() ) + GetValueField().SetText( aName ); } diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index 74a60d15ba..cefb12b754 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -871,10 +871,7 @@ void SCH_SYMBOL::UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, b } else if( id == VALUE_FIELD ) { - if( aResetOtherFields ) - SetValue( aPath, UnescapeString( m_lib_id.GetLibItemName() ) ); // alias-specific value - else - SetValue( aPath, UnescapeString( libField->GetText() ) ); + SetValue( aPath, UnescapeString( libField->GetText() ) ); } else if( id == FOOTPRINT_FIELD ) { diff --git a/eeschema/symbol_editor/symbol_editor.cpp b/eeschema/symbol_editor/symbol_editor.cpp index ef957f8b04..5456aa65d0 100644 --- a/eeschema/symbol_editor/symbol_editor.cpp +++ b/eeschema/symbol_editor/symbol_editor.cpp @@ -480,7 +480,8 @@ void SYMBOL_EDIT_FRAME::CreateNewSymbol() break; case VALUE_FIELD: - field->SetText( name ); + if( parent->IsPower() ) + field->SetText( name ); break; case FOOTPRINT_FIELD: diff --git a/eeschema/tools/symbol_editor_edit_tool.cpp b/eeschema/tools/symbol_editor_edit_tool.cpp index ff0f94a021..a041eaefc0 100644 --- a/eeschema/tools/symbol_editor_edit_tool.cpp +++ b/eeschema/tools/symbol_editor_edit_tool.cpp @@ -527,11 +527,7 @@ void SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField ) LIB_SYMBOL* parent = aField->GetParent(); wxCHECK( parent, /* void */ ); - // Editing the symbol value field is equivalent to creating a new symbol based on the - // current symbol. Set the dialog message to inform the user. - if( aField->GetId() == VALUE_FIELD ) - caption = _( "Edit Symbol Name" ); - else if( aField->GetId() < MANDATORY_FIELDS ) + if( aField->GetId() < MANDATORY_FIELDS ) caption.Printf( _( "Edit %s Field" ), TitleCaps( aField->GetName() ) ); else caption.Printf( _( "Edit '%s' Field" ), aField->GetName() ); @@ -545,27 +541,15 @@ void SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField ) wxString newFieldValue = EscapeString( dlg.GetText(), CTX_LIBID ); wxString oldFieldValue = aField->GetFullText( m_frame->GetUnit() ); - bool renamed = aField->GetId() == VALUE_FIELD && newFieldValue != oldFieldValue; - if( renamed ) - saveCopyInUndoList( parent, UNDO_REDO::LIB_RENAME ); - else - saveCopyInUndoList( parent, UNDO_REDO::LIBEDIT ); + saveCopyInUndoList( parent, UNDO_REDO::LIBEDIT ); dlg.UpdateField( aField ); - if( renamed ) - { - parent->SetName( newFieldValue ); - m_frame->UpdateAfterSymbolProperties( &oldFieldValue ); - } - else - { - updateItem( aField, true ); - m_frame->GetCanvas()->Refresh(); - m_frame->OnModify(); - m_frame->UpdateSymbolMsgPanelInfo(); - } + updateItem( aField, true ); + m_frame->GetCanvas()->Refresh(); + m_frame->OnModify(); + m_frame->UpdateSymbolMsgPanelInfo(); }