This keyword is not expanded by Git which means it's not replaced with the correct revision value in the releases made using git-based scripts and it's confusing to have lines with unexpanded "$Id$" in the released files. As expanding them with Git is not that simple (it could be done with git archive and export-subst attribute) and there are not many benefits in having them in the first place, just remove all these lines. If nothing else, this will make an eventual transition to Git simpler. Closes #14487. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
107 lines
3.4 KiB
C++
107 lines
3.4 KiB
C++
/////////////////////////////////////////////////////////////////////////////
|
|
// Name: src/common/animatecmn.cpp
|
|
// Purpose: wxAnimation and wxAnimationCtrl
|
|
// Author: Francesco Montorsi
|
|
// Modified By:
|
|
// Created: 24/09/2006
|
|
// Copyright: (c) Francesco Montorsi
|
|
// Licence: wxWindows licence
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// headers
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// For compilers that support precompilation, includes "wx.h".
|
|
#include "wx/wxprec.h"
|
|
|
|
#ifdef __BORLANDC__
|
|
#pragma hdrstop
|
|
#endif
|
|
|
|
#if wxUSE_ANIMATIONCTRL
|
|
|
|
#include "wx/animate.h"
|
|
#include "wx/bitmap.h"
|
|
#include "wx/log.h"
|
|
#include "wx/brush.h"
|
|
#include "wx/image.h"
|
|
#include "wx/dcmemory.h"
|
|
|
|
const char wxAnimationCtrlNameStr[] = "animationctrl";
|
|
|
|
// global object
|
|
wxAnimation wxNullAnimation;
|
|
|
|
IMPLEMENT_ABSTRACT_CLASS(wxAnimationBase, wxObject)
|
|
IMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl)
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// wxAnimationCtrlBase
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void wxAnimationCtrlBase::UpdateStaticImage()
|
|
{
|
|
if (!m_bmpStaticReal.IsOk() || !m_bmpStatic.IsOk())
|
|
return;
|
|
|
|
// if given bitmap is not of the right size, recreate m_bmpStaticReal accordingly
|
|
const wxSize &sz = GetClientSize();
|
|
if (sz.GetWidth() != m_bmpStaticReal.GetWidth() ||
|
|
sz.GetHeight() != m_bmpStaticReal.GetHeight())
|
|
{
|
|
if (!m_bmpStaticReal.IsOk() ||
|
|
m_bmpStaticReal.GetWidth() != sz.GetWidth() ||
|
|
m_bmpStaticReal.GetHeight() != sz.GetHeight())
|
|
{
|
|
// need to (re)create m_bmpStaticReal
|
|
if (!m_bmpStaticReal.Create(sz.GetWidth(), sz.GetHeight(),
|
|
m_bmpStatic.GetDepth()))
|
|
{
|
|
wxLogDebug(wxT("Cannot create the static bitmap"));
|
|
m_bmpStatic = wxNullBitmap;
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (m_bmpStatic.GetWidth() <= sz.GetWidth() &&
|
|
m_bmpStatic.GetHeight() <= sz.GetHeight())
|
|
{
|
|
// clear the background of m_bmpStaticReal
|
|
wxBrush brush(GetBackgroundColour());
|
|
wxMemoryDC dc;
|
|
dc.SelectObject(m_bmpStaticReal);
|
|
dc.SetBackground(brush);
|
|
dc.Clear();
|
|
|
|
// center the user-provided bitmap in m_bmpStaticReal
|
|
dc.DrawBitmap(m_bmpStatic,
|
|
(sz.GetWidth()-m_bmpStatic.GetWidth())/2,
|
|
(sz.GetHeight()-m_bmpStatic.GetHeight())/2,
|
|
true /* use mask */ );
|
|
}
|
|
else
|
|
{
|
|
// the user-provided bitmap is bigger than our control, strech it
|
|
wxImage temp(m_bmpStatic.ConvertToImage());
|
|
temp.Rescale(sz.GetWidth(), sz.GetHeight(), wxIMAGE_QUALITY_HIGH);
|
|
m_bmpStaticReal = wxBitmap(temp);
|
|
}
|
|
}
|
|
}
|
|
|
|
void wxAnimationCtrlBase::SetInactiveBitmap(const wxBitmap &bmp)
|
|
{
|
|
m_bmpStatic = bmp;
|
|
m_bmpStaticReal = bmp;
|
|
|
|
// if not playing, update the control now
|
|
// NOTE: DisplayStaticImage() will call UpdateStaticImage automatically
|
|
if ( !IsPlaying() )
|
|
DisplayStaticImage();
|
|
}
|
|
|
|
#endif // wxUSE_ANIMATIONCTRL
|