projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use locale-specific decimal point in wxNumericPropertyValidator (fixes #12790)
[wxWidgets.git]
/
src
/
generic
/
animateg.cpp
diff --git
a/src/generic/animateg.cpp
b/src/generic/animateg.cpp
index f69ba2dd86936eca5fcdfa1455de0cbf0e15efe8..aa531dc103d17541c8d9cae2aea528cb1476fbc9 100644
(file)
--- a/
src/generic/animateg.cpp
+++ b/
src/generic/animateg.cpp
@@
-15,7
+15,7
@@
#pragma hdrstop
#endif //__BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__
-#if wxUSE_ANIMATIONCTRL
&& (!defined(__WXGTK20__) || defined(__WXUNIVERSAL__))
+#if wxUSE_ANIMATIONCTRL
#include "wx/animate.h"
#include "wx/animate.h"
@@
-42,7
+42,7
@@
wxAnimationDecoderList wxAnimation::sm_handlers;
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxAnimationBase)
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxAnimationBase)
-#define M_ANIMDATA
wx_static_cast(wxAnimationDecoder*,
m_refData)
+#define M_ANIMDATA
static_cast<wxAnimationDecoder*>(
m_refData)
wxSize wxAnimation::GetSize() const
{
wxSize wxAnimation::GetSize() const
{
@@
-51,14
+51,14
@@
wxSize wxAnimation::GetSize() const
return M_ANIMDATA->GetAnimationSize();
}
return M_ANIMDATA->GetAnimationSize();
}
-
size_
t wxAnimation::GetFrameCount() const
+
unsigned in
t wxAnimation::GetFrameCount() const
{
wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") );
return M_ANIMDATA->GetFrameCount();
}
{
wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") );
return M_ANIMDATA->GetFrameCount();
}
-wxImage wxAnimation::GetFrame(
size_
t i) const
+wxImage wxAnimation::GetFrame(
unsigned in
t i) const
{
wxCHECK_MSG( IsOk(), wxNullImage, wxT("invalid animation") );
{
wxCHECK_MSG( IsOk(), wxNullImage, wxT("invalid animation") );
@@
-68,35
+68,35
@@
wxImage wxAnimation::GetFrame(size_t i) const
return ret;
}
return ret;
}
-int wxAnimation::GetDelay(
size_
t i) const
+int wxAnimation::GetDelay(
unsigned in
t i) const
{
wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") );
return M_ANIMDATA->GetDelay(i);
}
{
wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") );
return M_ANIMDATA->GetDelay(i);
}
-wxPoint wxAnimation::GetFramePosition(
size_
t frame) const
+wxPoint wxAnimation::GetFramePosition(
unsigned in
t frame) const
{
wxCHECK_MSG( IsOk(), wxDefaultPosition, wxT("invalid animation") );
return M_ANIMDATA->GetFramePosition(frame);
}
{
wxCHECK_MSG( IsOk(), wxDefaultPosition, wxT("invalid animation") );
return M_ANIMDATA->GetFramePosition(frame);
}
-wxSize wxAnimation::GetFrameSize(
size_
t frame) const
+wxSize wxAnimation::GetFrameSize(
unsigned in
t frame) const
{
wxCHECK_MSG( IsOk(), wxDefaultSize, wxT("invalid animation") );
return M_ANIMDATA->GetFrameSize(frame);
}
{
wxCHECK_MSG( IsOk(), wxDefaultSize, wxT("invalid animation") );
return M_ANIMDATA->GetFrameSize(frame);
}
-wxAnimationDisposal wxAnimation::GetDisposalMethod(
size_
t frame) const
+wxAnimationDisposal wxAnimation::GetDisposalMethod(
unsigned in
t frame) const
{
wxCHECK_MSG( IsOk(), wxANIM_UNSPECIFIED, wxT("invalid animation") );
return M_ANIMDATA->GetDisposalMethod(frame);
}
{
wxCHECK_MSG( IsOk(), wxANIM_UNSPECIFIED, wxT("invalid animation") );
return M_ANIMDATA->GetDisposalMethod(frame);
}
-wxColour wxAnimation::GetTransparentColour(
size_
t frame) const
+wxColour wxAnimation::GetTransparentColour(
unsigned in
t frame) const
{
wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid animation") );
{
wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid animation") );
@@
-138,7
+138,6
@@
bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type)
m_refData = handler->Clone();
return M_ANIMDATA->Load(stream);
}
m_refData = handler->Clone();
return M_ANIMDATA->Load(stream);
}
-
}
wxLogWarning( _("No handler found for animation type.") );
}
wxLogWarning( _("No handler found for animation type.") );
@@
-147,10
+146,6
@@
bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type)
handler = FindHandler(type);
handler = FindHandler(type);
- // do a copy of the handler from the static list which we will own
- // as our reference data
- m_refData = handler->Clone();
-
if (handler == NULL)
{
wxLogWarning( _("No animation handler for type %ld defined."), type );
if (handler == NULL)
{
wxLogWarning( _("No animation handler for type %ld defined."), type );
@@
-158,6
+153,11
@@
bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type)
return false;
}
return false;
}
+
+ // do a copy of the handler from the static list which we will own
+ // as our reference data
+ m_refData = handler->Clone();
+
if (stream.IsSeekable() && !M_ANIMDATA->CanRead(stream))
{
wxLogError(_("Animation file is not of type %ld."), type);
if (stream.IsSeekable() && !M_ANIMDATA->CanRead(stream))
{
wxLogError(_("Animation file is not of type %ld."), type);
@@
-186,7
+186,7
@@
void wxAnimation::AddHandler( wxAnimationDecoder *handler )
// a good reason to add and remove duplicate handlers (and they
// may) we should probably refcount the duplicates.
// a good reason to add and remove duplicate handlers (and they
// may) we should probably refcount the duplicates.
- wxLogDebug(
_
T("Adding duplicate animation handler for '%d' type"),
+ wxLogDebug(
wx
T("Adding duplicate animation handler for '%d' type"),
handler->GetType() );
delete handler;
}
handler->GetType() );
delete handler;
}
@@
-202,7
+202,7
@@
void wxAnimation::InsertHandler( wxAnimationDecoder *handler )
else
{
// see AddHandler for additional comments.
else
{
// see AddHandler for additional comments.
- wxLogDebug(
_
T("Inserting duplicate animation handler for '%d' type"),
+ wxLogDebug(
wx
T("Inserting duplicate animation handler for '%d' type"),
handler->GetType() );
delete handler;
}
handler->GetType() );
delete handler;
}
@@
-254,8
+254,8
@@
class wxAnimationModule: public wxModule
DECLARE_DYNAMIC_CLASS(wxAnimationModule)
public:
wxAnimationModule() {}
DECLARE_DYNAMIC_CLASS(wxAnimationModule)
public:
wxAnimationModule() {}
- bool OnInit() { wxAnimation::InitStandardHandlers(); return true; }
;
- void OnExit() { wxAnimation::CleanUpHandlers(); }
;
+ bool OnInit() { wxAnimation::InitStandardHandlers(); return true; }
+ void OnExit() { wxAnimation::CleanUpHandlers(); }
};
IMPLEMENT_DYNAMIC_CLASS(wxAnimationModule, wxModule)
};
IMPLEMENT_DYNAMIC_CLASS(wxAnimationModule, wxModule)
@@
-306,10
+306,17
@@
wxAnimationCtrl::~wxAnimationCtrl()
}
bool wxAnimationCtrl::LoadFile(const wxString& filename, wxAnimationType type)
}
bool wxAnimationCtrl::LoadFile(const wxString& filename, wxAnimationType type)
+{
+ wxFileInputStream fis(filename);
+ if (!fis.Ok())
+ return false;
+ return Load(fis, type);
+}
+
+bool wxAnimationCtrl::Load(wxInputStream& stream, wxAnimationType type)
{
wxAnimation anim;
{
wxAnimation anim;
- if (!anim.LoadFile(filename, type) ||
- !anim.IsOk())
+ if ( !anim.Load(stream, type) || !anim.IsOk() )
return false;
SetAnimation(anim);
return false;
SetAnimation(anim);
@@
-417,7
+424,7
@@
bool wxAnimationCtrl::Play(bool looped)
int delay = m_animation.GetDelay(0);
if (delay == 0)
delay = 1; // 0 is invalid timeout for wxTimer.
int delay = m_animation.GetDelay(0);
if (delay == 0)
delay = 1; // 0 is invalid timeout for wxTimer.
- m_timer.Start(delay);
+ m_timer.Start(delay
, true
);
return true;
}
return true;
}
@@
-428,7
+435,7
@@
bool wxAnimationCtrl::Play(bool looped)
// wxAnimationCtrl - rendering methods
// ----------------------------------------------------------------------------
// wxAnimationCtrl - rendering methods
// ----------------------------------------------------------------------------
-bool wxAnimationCtrl::RebuildBackingStoreUpToFrame(
size_
t frame)
+bool wxAnimationCtrl::RebuildBackingStoreUpToFrame(
unsigned in
t frame)
{
// if we've not created the backing store yet or it's too
// small, then recreate it
{
// if we've not created the backing store yet or it's too
// small, then recreate it
@@
-451,7
+458,7
@@
bool wxAnimationCtrl::RebuildBackingStoreUpToFrame(size_t frame)
DisposeToBackground(dc);
// Draw all intermediate frames that haven't been removed from the animation
DisposeToBackground(dc);
// Draw all intermediate frames that haven't been removed from the animation
- for (
size_
t i = 0; i < frame; i++)
+ for (
unsigned in
t i = 0; i < frame; i++)
{
if (m_animation.GetDisposalMethod(i) == wxANIM_DONOTREMOVE ||
m_animation.GetDisposalMethod(i) == wxANIM_UNSPECIFIED)
{
if (m_animation.GetDisposalMethod(i) == wxANIM_DONOTREMOVE ||
m_animation.GetDisposalMethod(i) == wxANIM_UNSPECIFIED)
@@
-557,7
+564,7
@@
void wxAnimationCtrl::DisplayStaticImage()
Refresh();
}
Refresh();
}
-void wxAnimationCtrl::DrawFrame(wxDC &dc,
size_
t frame)
+void wxAnimationCtrl::DrawFrame(wxDC &dc,
unsigned in
t frame)
{
// PERFORMANCE NOTE:
// this draw stuff is not as fast as possible: the wxAnimationDecoder
{
// PERFORMANCE NOTE:
// this draw stuff is not as fast as possible: the wxAnimationDecoder
@@
-588,7
+595,7
@@
void wxAnimationCtrl::DisposeToBackground()
}
void wxAnimationCtrl::DisposeToBackground(wxDC& dc)
}
void wxAnimationCtrl::DisposeToBackground(wxDC& dc)
-{
+{
wxColour col = IsUsingWindowBackgroundColour()
? GetBackgroundColour()
: m_animation.GetBackgroundColour();
wxColour col = IsUsingWindowBackgroundColour()
? GetBackgroundColour()
: m_animation.GetBackgroundColour();
@@
-621,7
+628,7
@@
void wxAnimationCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
if ( m_backingStore.IsOk() )
{
// NOTE: we draw the bitmap explicitely ignoring the mask (if any);
if ( m_backingStore.IsOk() )
{
// NOTE: we draw the bitmap explicitely ignoring the mask (if any);
- // i.e. we don't want to combine the backing store with the
+ // i.e. we don't want to combine the backing store with the
// possibly wrong preexisting contents of the window!
dc.DrawBitmap(m_backingStore, 0, 0, false /* no mask */);
}
// possibly wrong preexisting contents of the window!
dc.DrawBitmap(m_backingStore, 0, 0, false /* no mask */);
}
@@
-662,7
+669,7
@@
void wxAnimationCtrl::OnTimer(wxTimerEvent &WXUNUSED(event))
int delay = m_animation.GetDelay(m_currentFrame);
if (delay == 0)
delay = 1; // 0 is invalid timeout for wxTimer.
int delay = m_animation.GetDelay(m_currentFrame);
if (delay == 0)
delay = 1; // 0 is invalid timeout for wxTimer.
- m_timer.Start(delay);
+ m_timer.Start(delay
, true
);
}
void wxAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
}
void wxAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
@@
-674,9
+681,9
@@
void wxAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
// when using them inside sizers.
if (m_animation.IsOk())
{
// when using them inside sizers.
if (m_animation.IsOk())
{
- // be careful to change the backing store *only* if we are
- // playing the animation as otherwise we may be displaying
- // the inactive bitmap and overwriting the backing store
+ // be careful to change the backing store *only* if we are
+ // playing the animation as otherwise we may be displaying
+ // the inactive bitmap and overwriting the backing store
// with the last played frame is wrong in this case
if (IsPlaying())
{
// with the last played frame is wrong in this case
if (IsPlaying())
{
@@
-686,5
+693,5
@@
void wxAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
}
}
}
}
-#endif
// wxUSE_ANIMATIONCTRL
+#endif // wxUSE_ANIMATIONCTRL