Esempio n. 1
0
void SettingsDialog::OnRestoreDefaults( wxCommandEvent& args )
{

    wxMessageDialog dialog( this, wxT( "Are you sure you want to reset these settings to the default values?" ), wxT( "Confirm Default Settings" ), wxYES_NO );
    if ( dialog.ShowModal() == wxID_NO )
    {
        return;
    }

    if ( !m_CurrentSetting )
    {
        return;
    }

    Reflect::ObjectPtr defaultElement = Reflect::SafeCast<Reflect::Object>( Reflect::Registry::GetInstance()->CreateInstance( m_CurrentSetting->m_Clone->GetClass() ) );
    if ( !defaultElement )
    {
        return;
    }

    if ( !defaultElement->Equals( m_CurrentSetting->m_Clone ) )
    {
        defaultElement->CopyTo( m_CurrentSetting->m_Clone );
        m_CurrentSetting->m_Clone->RaiseChanged();
        m_CurrentSetting->m_Canvas->Read();
    }
}
Esempio n. 2
0
bool Helium::Material::LoadPersistentResourceObject( Reflect::ObjectPtr &_object )
{
    HELIUM_ASSERT(_object.ReferencesObject());
    if (!_object.ReferencesObject())
    {
        return false;
    }

    _object->CopyTo(&m_persistentResourceData);

    return true;
}
Esempio n. 3
0
bool Helium::Font::LoadPersistentResourceObject( Reflect::ObjectPtr &_object )
{
    HELIUM_ASSERT(_object.ReferencesObject());
    if (!_object.ReferencesObject())
    {
        return false;
    }

    _object->CopyTo(&m_persistentResourceData);

    uint_fast32_t characterCount = static_cast<uint_fast32_t>(m_persistentResourceData.m_characters.GetSize());
    uint_fast8_t textureCount = m_persistentResourceData.m_textureCount;

    delete [] m_persistentResourceData.m_pspTextures;
    m_persistentResourceData.m_pspTextures = NULL;

    delete [] m_persistentResourceData.m_pTextureLoadIds;
    m_persistentResourceData.m_pTextureLoadIds = NULL;

    if( textureCount != 0 )
    {
        m_persistentResourceData.m_pspTextures = new RTexture2dPtr [ textureCount ];
        HELIUM_ASSERT( m_persistentResourceData.m_pspTextures );

        if( m_persistentResourceData.m_pspTextures )
        {
            m_persistentResourceData.m_pTextureLoadIds = new size_t [ textureCount ];
            HELIUM_ASSERT( m_persistentResourceData.m_pTextureLoadIds );

            if( m_persistentResourceData.m_pTextureLoadIds )
            {
                MemorySet(
                    m_persistentResourceData.m_pTextureLoadIds,
                    0xff,
                    static_cast< size_t >( textureCount ) * sizeof( m_persistentResourceData.m_pTextureLoadIds[ 0 ] ) );
            }
            else
            {
                delete [] m_persistentResourceData.m_pspTextures;
                m_persistentResourceData.m_pspTextures = NULL;
            }
        }

        if( !m_persistentResourceData.m_pspTextures )
        {
            m_persistentResourceData.m_textureCount = 0;
        }
    }

    return true;
}
Esempio n. 4
0
bool Helium::Mesh::LoadPersistentResourceObject( Reflect::ObjectPtr &_object )
{    
    m_spVertexBuffer.Release();
    m_spIndexBuffer.Release();

    HELIUM_ASSERT(_object.ReferencesObject());
    if (!_object.ReferencesObject())
    {
        return false;
    }

    _object->CopyTo(&m_persistentResourceData);

    return true;
}