diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index 5ae98700a..4e996d401 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -1463,7 +1463,13 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton(const wxString &Prompt, WrappedTy mpWind = pRadioButton = safenew wxRadioButton(GetParent(), miId, Prompt, wxDefaultPosition, wxDefaultSize, (mRadioCount==1)?wxRB_GROUP:0); - pRadioButton->SetValue(WrappedRef.ValuesMatch( *mRadioValue )); + + wxASSERT( WrappedRef.IsString() ); + wxASSERT( mRadioValue->IsString() ); + const bool value = + (WrappedRef.ReadAsString() == mRadioValue->ReadAsString() ); + pRadioButton->SetValue( value ); + pRadioButton->SetName(wxStripMenuCodes(Prompt)); UpdateSizers(); } @@ -1476,9 +1482,7 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton(const wxString &Prompt, WrappedTy pRadioButton = wxDynamicCast(pWnd, wxRadioButton); wxASSERT( pRadioButton ); if( pRadioButton->GetValue() ) - { - mRadioValue->WriteToAsWrappedType( WrappedRef ); - } + mRadioValue->WriteToAsString( WrappedRef.ReadAsString() ); } break; default: diff --git a/src/WrappedType.cpp b/src/WrappedType.cpp index c4f5c969b..e44b3460a 100644 --- a/src/WrappedType.cpp +++ b/src/WrappedType.cpp @@ -37,62 +37,6 @@ bool WrappedType::IsString() return eWrappedType == eWrappedString; } -/// @param W Wrapped type to compare -/// @return true iff types and values are the same. -bool WrappedType::ValuesMatch( const WrappedType & W ) -{ - if( W.eWrappedType != eWrappedType ) - return false; - switch( eWrappedType ) - { - case eWrappedString: - return *W.mpStr == *mpStr; - break; - case eWrappedInt: - return *W.mpInt == *mpInt; - break; - case eWrappedDouble: - return *W.mpDouble == *mpDouble; - break; - case eWrappedBool: - return *W.mpBool == *mpBool; - break; - case eWrappedEnum: - wxASSERT( false ); - break; - default: - wxASSERT( false ); - break; - } - return false; -} - -void WrappedType::WriteToAsWrappedType( const WrappedType & W ) -{ - wxASSERT( W.eWrappedType == eWrappedType ); - switch( eWrappedType ) - { - case eWrappedString: - *mpStr = *W.mpStr; - break; - case eWrappedInt: - *mpInt = *W.mpInt; - break; - case eWrappedDouble: - *mpDouble = *W.mpDouble; - break; - case eWrappedBool: - *mpBool = *W.mpBool; - break; - case eWrappedEnum: - wxASSERT( false ); - break; - default: - wxASSERT( false ); - break; - } -} - wxString WrappedType::ReadAsString() diff --git a/src/WrappedType.h b/src/WrappedType.h index a64f6c1cf..9d407bff8 100644 --- a/src/WrappedType.h +++ b/src/WrappedType.h @@ -59,9 +59,6 @@ public: void WriteToAsDouble( const double InDouble); void WriteToAsBool( const bool InBool); - bool ValuesMatch( const WrappedType & W ); - void WriteToAsWrappedType( const WrappedType & W ); - public : const teWrappedType eWrappedType;