From a0cb0ba509fad1fb966d4d5277ff28071d7a8477 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 17 Feb 2002 14:55:41 +0000 Subject: [PATCH] move wxMGL's wxTimer to src/generic git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/tmake/filelist.txt | 5 +- include/wx/{mgl => generic}/timer.h | 2 +- include/wx/x11/timer.h | 49 ------- src/files.lst | 7 +- src/{mgl => generic}/timer.cpp | 38 +++-- src/gtk/files.lst | 2 + src/gtk1/files.lst | 2 + src/mac/carbon/files.lst | 2 + src/mac/files.lst | 2 + src/mgl/files.lst | 6 +- src/mgl/makefile.wat | 8 +- src/microwin/files.lst | 2 + src/motif/files.lst | 2 + src/msw/files.lst | 4 + src/msw/makefile.b32 | 3 + src/msw/makefile.bcc | 3 + src/msw/makefile.dos | 6 + src/msw/makefile.g95 | 3 +- src/msw/makefile.sc | 1 + src/msw/makefile.vc | 1 + src/msw/makefile.wat | 7 +- src/univ/files.lst | 1 + src/wxBase.dsp | 8 + src/wxUniv.dsp | 12 ++ src/wxWindows.dsp | 12 ++ src/x11/files.lst | 9 +- src/x11/timer.cpp | 217 ---------------------------- 27 files changed, 120 insertions(+), 294 deletions(-) rename include/wx/{mgl => generic}/timer.h (95%) delete mode 100644 include/wx/x11/timer.h rename src/{mgl => generic}/timer.cpp (77%) delete mode 100644 src/x11/timer.cpp diff --git a/distrib/msw/tmake/filelist.txt b/distrib/msw/tmake/filelist.txt index 1f578eaf8b..246786f918 100644 --- a/distrib/msw/tmake/filelist.txt +++ b/distrib/msw/tmake/filelist.txt @@ -111,6 +111,7 @@ statusbr.cpp Generic NotMGL,NotX11,NotMicro tabg.cpp Generic NotWin32,NotOS2 tbarsmpl.cpp Generic textdlgg.cpp Generic +timer.cpp Generic LowLevel,NotMSW,NotX,NotGTK,NotOS2,NotMac,NotMicro tipdlg.cpp Generic tipwin.cpp Generic treectlg.cpp Generic @@ -630,7 +631,6 @@ popupwin.cpp X11 region.cpp X11 settings.cpp X11 toplevel.cpp X11 -timer.cpp X11 utils.cpp X11 window.cpp X11 @@ -1203,7 +1203,6 @@ print.h X11H private.h X11H region.h X11H settings.h X11H -timer.h X11H toolbar.h X11H toplevel.h X11H window.h X11H @@ -1472,6 +1471,7 @@ splitter.h GenericH statusbr.h GenericH tabg.h GenericH NotWin32 textdlgg.h GenericH +timer.h GenericH treectlg.h GenericH NotWin32 wizard.h GenericH @@ -1537,7 +1537,6 @@ dcscreen.cpp MGL LowLevel toplevel.cpp MGL LowLevel icon.cpp MGL LowLevel settings.cpp MGL LowLevel -timer.cpp MGL LowLevel window.cpp MGL LowLevel utils.cpp MGL LowLevel diff --git a/include/wx/mgl/timer.h b/include/wx/generic/timer.h similarity index 95% rename from include/wx/mgl/timer.h rename to include/wx/generic/timer.h index 320496eda6..3c381771a7 100644 --- a/include/wx/mgl/timer.h +++ b/include/wx/generic/timer.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: timer.h -// Purpose: wxTimer class +// Purpose: Generic implementation of wxTimer class // Author: Vaclav Slavik // Id: $Id$ // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) diff --git a/include/wx/x11/timer.h b/include/wx/x11/timer.h deleted file mode 100644 index 680fc17e69..0000000000 --- a/include/wx/x11/timer.h +++ /dev/null @@ -1,49 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: timer.h -// Purpose: wxTimer class -// Author: Vaclav Slavik -// Id: $Id$ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -#ifndef __WX_TIMER_H__ -#define __WX_TIMER_H__ - -#ifdef __GNUG__ - #pragma interface "timer.h" -#endif - -//----------------------------------------------------------------------------- -// wxTimer -//----------------------------------------------------------------------------- - -class wxTimerDesc; - -class WXDLLEXPORT wxTimer : public wxTimerBase -{ -public: - wxTimer() { Init(); } - wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id) - { Init(); } - ~wxTimer(); - - virtual bool Start(int millisecs = -1, bool oneShot = FALSE); - virtual void Stop(); - - virtual bool IsRunning() const; - - // implementation - static void NotifyTimers(); - -protected: - void Init(); - -private: - wxTimerDesc *m_desc; - - DECLARE_ABSTRACT_CLASS(wxTimer) -}; - -#endif // __WX_TIMER_H__ diff --git a/src/files.lst b/src/files.lst index 4fd21e70ed..ab056d5b03 100644 --- a/src/files.lst +++ b/src/files.lst @@ -83,7 +83,8 @@ ALL_SOURCES = \ msw/snglinst.cpp \ msw/thread.cpp \ msw/utils.cpp \ - msw/utilsexc.cpp + msw/utilsexc.cpp \ + msw/volume.cpp ALL_HEADERS = \ app.h \ @@ -163,6 +164,7 @@ ALL_HEADERS = \ variant.h \ vector.h \ version.h \ + volume.h \ wfstream.h \ wx.h \ wxchar.h \ @@ -266,6 +268,7 @@ BASE_MSW_OBJS = \ snglinst.o \ thread.o \ utils.o \ - utilsexc.o + utilsexc.o \ + volume.o diff --git a/src/mgl/timer.cpp b/src/generic/timer.cpp similarity index 77% rename from src/mgl/timer.cpp rename to src/generic/timer.cpp index 1ab1a19087..39974a6b8e 100644 --- a/src/mgl/timer.cpp +++ b/src/generic/timer.cpp @@ -7,7 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// - #ifdef __GNUG__ #pragma implementation "timer.h" #endif @@ -19,15 +18,33 @@ #pragma hdrstop #endif +// ---------------------------------------------------------------------------- +// NB: when using generic wxTimer implementation in your port, you *must* call +// wxTimer::NotifyTimers() often enough. The ideal place for this +// is in wxEventLoop::Dispatch(). +// ---------------------------------------------------------------------------- + #include "wx/timer.h" #if wxUSE_TIMER #include "wx/log.h" #include "wx/module.h" -#include "wx/mgl/private.h" -extern "C" ulong _EVT_getTicks(); +// ---------------------------------------------------------------------------- +// Time input function +// ---------------------------------------------------------------------------- + +#ifdef __WXMGL__ + // We take advantage of wxMGL's _EVT_getTicks because it is faster + // (especially under MS-DOS!) and more precise than wxGetLocalTimeMillis + // if we are unlucky and the latter combines information from two sources. + #include "wx/mgl/private.h" + extern "C" ulong _EVT_getTicks(); + #define GetMillisecondsTime() _EVT_getTicks() +#else + #define GetMillisecondsTime() wxGetLocalTimeMillis().ToLong() +#endif // ---------------------------------------------------------------------------- // helper structures and wxTimerScheduler @@ -66,11 +83,11 @@ void wxTimerScheduler::QueueTimer(wxTimerDesc *desc, unsigned long when) return; // already scheduled if ( when == 0 ) - when = _EVT_getTicks() + desc->timer->GetInterval(); + when = GetMillisecondsTime() + desc->timer->GetInterval(); desc->shotTime = when; desc->running = TRUE; - wxLogTrace("mgl_timer", "queued timer %p at tick %i", + wxLogTrace("timer", "queued timer %p at tick %i", desc->timer, when); if ( m_timers ) @@ -108,7 +125,7 @@ void wxTimerScheduler::NotifyTimers() { bool oneShot; volatile bool timerDeleted; - unsigned long now = _EVT_getTicks(); + unsigned long now = GetMillisecondsTime(); wxTimerDesc *desc; while ( m_timers && m_timers->shotTime <= now ) @@ -123,7 +140,7 @@ void wxTimerScheduler::NotifyTimers() if ( !timerDeleted ) { - wxLogTrace("mgl_timer", "notified timer %p sheduled for %i", + wxLogTrace("timer", "notified timer %p sheduled for %i", desc->timer, desc->shotTime); desc->deleteFlag = NULL; @@ -135,7 +152,6 @@ void wxTimerScheduler::NotifyTimers() } - // ---------------------------------------------------------------------------- // wxTimer // ---------------------------------------------------------------------------- @@ -153,7 +169,7 @@ void wxTimer::Init() wxTimer::~wxTimer() { - wxLogTrace("mgl_timer", "destroying timer %p...", this); + wxLogTrace("timer", "destroying timer %p...", this); if ( IsRunning() ) Stop(); @@ -165,7 +181,7 @@ wxTimer::~wxTimer() *m_desc->deleteFlag = TRUE; delete m_desc; - wxLogTrace("mgl_timer", " ...done destroying timer %p...", this); + wxLogTrace("timer", " ...done destroying timer %p...", this); } bool wxTimer::IsRunning() const @@ -175,7 +191,7 @@ bool wxTimer::IsRunning() const bool wxTimer::Start(int millisecs, bool oneShot) { - wxLogTrace("mgl_timer", "started timer %p: %i ms, oneshot=%i", + wxLogTrace("timer", "started timer %p: %i ms, oneshot=%i", this, millisecs, oneShot); if ( !wxTimerBase::Start(millisecs, oneShot) ) diff --git a/src/gtk/files.lst b/src/gtk/files.lst index 316069547d..a1d9b3173b 100644 --- a/src/gtk/files.lst +++ b/src/gtk/files.lst @@ -479,6 +479,7 @@ ALL_HEADERS = \ variant.h \ vector.h \ version.h \ + volume.h \ wave.h \ wfstream.h \ window.h \ @@ -592,6 +593,7 @@ ALL_HEADERS = \ generic/statusbr.h \ generic/tabg.h \ generic/textdlgg.h \ + generic/timer.h \ generic/treectlg.h \ generic/wizard.h \ unix/execute.h \ diff --git a/src/gtk1/files.lst b/src/gtk1/files.lst index 316069547d..a1d9b3173b 100644 --- a/src/gtk1/files.lst +++ b/src/gtk1/files.lst @@ -479,6 +479,7 @@ ALL_HEADERS = \ variant.h \ vector.h \ version.h \ + volume.h \ wave.h \ wfstream.h \ window.h \ @@ -592,6 +593,7 @@ ALL_HEADERS = \ generic/statusbr.h \ generic/tabg.h \ generic/textdlgg.h \ + generic/timer.h \ generic/treectlg.h \ generic/wizard.h \ unix/execute.h \ diff --git a/src/mac/carbon/files.lst b/src/mac/carbon/files.lst index 181ed9de94..259e2d48de 100644 --- a/src/mac/carbon/files.lst +++ b/src/mac/carbon/files.lst @@ -486,6 +486,7 @@ ALL_HEADERS = \ variant.h \ vector.h \ version.h \ + volume.h \ wave.h \ wfstream.h \ window.h \ @@ -619,6 +620,7 @@ ALL_HEADERS = \ generic/statusbr.h \ generic/tabg.h \ generic/textdlgg.h \ + generic/timer.h \ generic/treectlg.h \ generic/wizard.h \ unix/execute.h \ diff --git a/src/mac/files.lst b/src/mac/files.lst index 181ed9de94..259e2d48de 100644 --- a/src/mac/files.lst +++ b/src/mac/files.lst @@ -486,6 +486,7 @@ ALL_HEADERS = \ variant.h \ vector.h \ version.h \ + volume.h \ wave.h \ wfstream.h \ window.h \ @@ -619,6 +620,7 @@ ALL_HEADERS = \ generic/statusbr.h \ generic/tabg.h \ generic/textdlgg.h \ + generic/timer.h \ generic/treectlg.h \ generic/wizard.h \ unix/execute.h \ diff --git a/src/mgl/files.lst b/src/mgl/files.lst index be66b64799..0c86651394 100644 --- a/src/mgl/files.lst +++ b/src/mgl/files.lst @@ -41,6 +41,7 @@ ALL_SOURCES = \ generic/tabg.cpp \ generic/tbarsmpl.cpp \ generic/textdlgg.cpp \ + generic/timer.cpp \ generic/tipdlg.cpp \ generic/tipwin.cpp \ generic/treectlg.cpp \ @@ -193,7 +194,6 @@ ALL_SOURCES = \ mgl/pen.cpp \ mgl/region.cpp \ mgl/settings.cpp \ - mgl/timer.cpp \ mgl/toplevel.cpp \ mgl/utils.cpp \ mgl/window.cpp \ @@ -441,6 +441,7 @@ ALL_HEADERS = \ variant.h \ vector.h \ version.h \ + volume.h \ wave.h \ wfstream.h \ window.h \ @@ -492,6 +493,7 @@ ALL_HEADERS = \ generic/statusbr.h \ generic/tabg.h \ generic/textdlgg.h \ + generic/timer.h \ generic/treectlg.h \ generic/wizard.h \ unix/execute.h \ @@ -685,6 +687,7 @@ GENERICOBJS = \ tabg.o \ tbarsmpl.o \ textdlgg.o \ + timer.o \ tipdlg.o \ tipwin.o \ treectlg.o \ @@ -714,7 +717,6 @@ GUI_LOWLEVEL_OBJS = \ pen.o \ region.o \ settings.o \ - timer.o \ toplevel.o \ utils.o \ window.o diff --git a/src/mgl/makefile.wat b/src/mgl/makefile.wat index 40f1caf6c4..05ce7a8494 100644 --- a/src/mgl/makefile.wat +++ b/src/mgl/makefile.wat @@ -80,6 +80,7 @@ GENERICOBJS= accel.obj & tabg.obj & tbarsmpl.obj & textdlgg.obj & + timer.obj & tipdlg.obj & tipwin.obj & treectlg.obj & @@ -236,7 +237,6 @@ MGLOBJS = app.obj & pen.obj & region.obj & settings.obj & - timer.obj & toplevel.obj & utils.obj & window.obj @@ -394,9 +394,6 @@ region.obj: $(MGLDIR)\region.cpp settings.obj: $(MGLDIR)\settings.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< -timer.obj: $(MGLDIR)\timer.cpp - *$(CCC) $(CPPFLAGS) $(IFLAGS) $< - toplevel.obj: $(MGLDIR)\toplevel.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< @@ -1035,6 +1032,9 @@ tbarsmpl.obj: $(GENDIR)\tbarsmpl.cpp textdlgg.obj: $(GENDIR)\textdlgg.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< +timer.obj: $(GENDIR)\timer.cpp + *$(CCC) $(CPPFLAGS) $(IFLAGS) $< + tipdlg.obj: $(GENDIR)\tipdlg.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< diff --git a/src/microwin/files.lst b/src/microwin/files.lst index 8989eb774a..7f43e3e584 100644 --- a/src/microwin/files.lst +++ b/src/microwin/files.lst @@ -441,6 +441,7 @@ ALL_HEADERS = \ variant.h \ vector.h \ version.h \ + volume.h \ wave.h \ wfstream.h \ window.h \ @@ -585,6 +586,7 @@ ALL_HEADERS = \ generic/statusbr.h \ generic/tabg.h \ generic/textdlgg.h \ + generic/timer.h \ generic/treectlg.h \ generic/wizard.h \ unix/execute.h \ diff --git a/src/motif/files.lst b/src/motif/files.lst index 28b9f83177..9487be7c06 100644 --- a/src/motif/files.lst +++ b/src/motif/files.lst @@ -470,6 +470,7 @@ ALL_HEADERS = \ variant.h \ vector.h \ version.h \ + volume.h \ wave.h \ wfstream.h \ window.h \ @@ -580,6 +581,7 @@ ALL_HEADERS = \ generic/statusbr.h \ generic/tabg.h \ generic/textdlgg.h \ + generic/timer.h \ generic/treectlg.h \ generic/wizard.h \ unix/execute.h \ diff --git a/src/msw/files.lst b/src/msw/files.lst index ff8f90d8a3..38148cdac4 100644 --- a/src/msw/files.lst +++ b/src/msw/files.lst @@ -259,6 +259,7 @@ ALL_SOURCES = \ msw/utils.cpp \ msw/utilsexc.cpp \ msw/ole/uuid.cpp \ + msw/volume.cpp \ msw/wave.cpp \ msw/window.cpp \ html/helpctrl.cpp \ @@ -498,6 +499,7 @@ ALL_HEADERS = \ variant.h \ vector.h \ version.h \ + volume.h \ wave.h \ wfstream.h \ window.h \ @@ -650,6 +652,7 @@ ALL_HEADERS = \ generic/statusbr.h \ generic/tabg.h \ generic/textdlgg.h \ + generic/timer.h \ generic/treectlg.h \ generic/wizard.h \ unix/execute.h \ @@ -932,6 +935,7 @@ GUIOBJS = \ treectrl.o \ utils.o \ utilsexc.o \ + volume.o \ wave.o \ window.o diff --git a/src/msw/makefile.b32 b/src/msw/makefile.b32 index 842b28ac72..f395edd232 100644 --- a/src/msw/makefile.b32 +++ b/src/msw/makefile.b32 @@ -343,6 +343,7 @@ MSWOBJS = $(MSWDIR)\accel.obj \ $(MSWDIR)\utils.obj \ $(MSWDIR)\utilsexc.obj \ $(MSWDIR)\uuid.obj \ + $(MSWDIR)\volume.obj \ $(MSWDIR)\wave.obj \ $(MSWDIR)\window.obj @@ -633,6 +634,8 @@ $(MSWDIR)\utilsexc.obj: $(MSWDIR)\utilsexc.$(SRCSUFF) $(MSWDIR)\uuid.obj: $(OLEDIR)\uuid.$(SRCSUFF) +$(MSWDIR)\volume.obj: $(MSWDIR)\volume.$(SRCSUFF) + $(MSWDIR)\wave.obj: $(MSWDIR)\wave.$(SRCSUFF) $(MSWDIR)\window.obj: $(MSWDIR)\window.$(SRCSUFF) diff --git a/src/msw/makefile.bcc b/src/msw/makefile.bcc index bdbc667a9e..6ec16f2814 100644 --- a/src/msw/makefile.bcc +++ b/src/msw/makefile.bcc @@ -294,6 +294,7 @@ MSWOBJS = $(MSWDIR)\accel.obj \ $(MSWDIR)\toplevel.obj \ $(MSWDIR)\utils.obj \ $(MSWDIR)\utilsexc.obj \ + $(MSWDIR)\volume.obj \ $(MSWDIR)\wave.obj \ $(MSWDIR)\window.obj @@ -495,6 +496,8 @@ $(MSWDIR)\utils.obj: $(MSWDIR)\utils.$(SRCSUFF) $(MSWDIR)\utilsexc.obj: $(MSWDIR)\utilsexc.$(SRCSUFF) +$(MSWDIR)\volume.obj: $(MSWDIR)\volume.$(SRCSUFF) + $(MSWDIR)\wave.obj: $(MSWDIR)\wave.$(SRCSUFF) $(MSWDIR)\window.obj: $(MSWDIR)\window.$(SRCSUFF) diff --git a/src/msw/makefile.dos b/src/msw/makefile.dos index 657335adff..30ccd68365 100644 --- a/src/msw/makefile.dos +++ b/src/msw/makefile.dos @@ -283,6 +283,7 @@ MSWOBJS2 = $(MSWDIR)\palette.obj \ $(MSWDIR)\toplevel.obj \ $(MSWDIR)\utils.obj \ $(MSWDIR)\utilsexc.obj \ + $(MSWDIR)\volume.obj \ $(MSWDIR)\wave.obj \ $(MSWDIR)\window.obj @@ -772,6 +773,11 @@ $(MSWDIR)/utilsexc.obj: $*.$(SRCSUFF) $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) << +$(MSWDIR)/volume.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) +<< + $(MSWDIR)/wave.obj: $*.$(SRCSUFF) cl @<< $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95 index 52686b0731..59b8a9c1ff 100644 --- a/src/msw/makefile.g95 +++ b/src/msw/makefile.g95 @@ -277,7 +277,8 @@ MSWOBJS_BASE = \ $(MSWDIR)/snglinst.$(OBJSUFF) \ $(MSWDIR)/thread.$(OBJSUFF) \ $(MSWDIR)/utils.$(OBJSUFF) \ - $(MSWDIR)/utilsexc.$(OBJSUFF) + $(MSWDIR)/utilsexc.$(OBJSUFF) \ + $(MSWDIR)/volume.$(OBJSUFF) MSWOBJS = \ $(MSWOBJS_BASE) \ diff --git a/src/msw/makefile.sc b/src/msw/makefile.sc index 921389e58c..a7a3ae40e1 100644 --- a/src/msw/makefile.sc +++ b/src/msw/makefile.sc @@ -287,6 +287,7 @@ MSWOBJS = $(MSWDIR)\accel.obj \ $(MSWDIR)\utils.obj \ $(MSWDIR)\utilsexc.obj \ $(MSWDIR)\ole\uuid.obj \ + $(MSWDIR)\volume.obj \ $(MSWDIR)\wave.obj \ $(MSWDIR)\window.obj diff --git a/src/msw/makefile.vc b/src/msw/makefile.vc index f4062f56b6..b12c0ffbbc 100644 --- a/src/msw/makefile.vc +++ b/src/msw/makefile.vc @@ -364,6 +364,7 @@ MSWOBJS = $(MSWDIR)\$D\accel.obj \ $(MSWDIR)\$D\utils.obj \ $(MSWDIR)\$D\utilsexc.obj \ $(OLEDIR)\$D\uuid.obj \ + $(MSWDIR)\$D\volume.obj \ $(MSWDIR)\$D\wave.obj \ $(MSWDIR)\$D\window.obj diff --git a/src/msw/makefile.wat b/src/msw/makefile.wat index 7f9244b131..5f2d58f03f 100644 --- a/src/msw/makefile.wat +++ b/src/msw/makefile.wat @@ -92,7 +92,8 @@ NONESSENTIALOBJS= accel.obj & printps.obj & prntdlgg.obj & statline.obj & - tabg.obj + tabg.obj & + timer.obj COMMONOBJS = & y_tab.obj & @@ -329,6 +330,7 @@ MSWOBJS = accel.obj & utils.obj & utilsexc.obj & uuid.obj & + volume.obj & wave.obj & window.obj @@ -713,6 +715,9 @@ utilsexc.obj: $(MSWDIR)\utilsexc.cpp uuid.obj: $(OLEDIR)\uuid.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< +volume.obj: $(MSWDIR)\volume.cpp + *$(CCC) $(CPPFLAGS) $(IFLAGS) $< + wave.obj: $(MSWDIR)\wave.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< diff --git a/src/univ/files.lst b/src/univ/files.lst index 215c7f4e39..4cb6f59e7f 100644 --- a/src/univ/files.lst +++ b/src/univ/files.lst @@ -47,6 +47,7 @@ UNIV_HEADERS = \ univ/colschem.h \ univ/combobox.h \ univ/control.h \ + univ/dialog.h \ univ/frame.h \ univ/gauge.h \ univ/inpcons.h \ diff --git a/src/wxBase.dsp b/src/wxBase.dsp index 0a13f847d4..ba205f9d63 100644 --- a/src/wxBase.dsp +++ b/src/wxBase.dsp @@ -560,6 +560,10 @@ SOURCE=.\msw\utils.cpp SOURCE=.\msw\utilsexc.cpp # End Source File +# Begin Source File + +SOURCE=.\msw\volume.cpp +# End Source File # Begin Source File @@ -953,6 +957,10 @@ SOURCE=..\include\wx\version.h # End Source File # Begin Source File +SOURCE=..\include\wx\volume.h +# End Source File +# Begin Source File + SOURCE=..\include\wx\wfstream.h # End Source File # Begin Source File diff --git a/src/wxUniv.dsp b/src/wxUniv.dsp index cf14747a7e..635fb3f779 100644 --- a/src/wxUniv.dsp +++ b/src/wxUniv.dsp @@ -1016,6 +1016,10 @@ SOURCE=.\msw\utilsexc.cpp # End Source File # Begin Source File +SOURCE=.\msw\volume.cpp +# End Source File +# Begin Source File + SOURCE=.\msw\window.cpp # End Source File @@ -2062,6 +2066,10 @@ SOURCE=..\include\wx\version.h # End Source File # Begin Source File +SOURCE=..\include\wx\volume.h +# End Source File +# Begin Source File + SOURCE=..\include\wx\wave.h # End Source File # Begin Source File @@ -2275,6 +2283,10 @@ SOURCE=..\include\wx\generic\textdlgg.h # End Source File # Begin Source File +SOURCE=..\include\wx\generic\timer.h +# End Source File +# Begin Source File + SOURCE=..\include\wx\generic\treectlg.h # End Source File # Begin Source File diff --git a/src/wxWindows.dsp b/src/wxWindows.dsp index 28c8b9c5c2..753b51cf44 100644 --- a/src/wxWindows.dsp +++ b/src/wxWindows.dsp @@ -1361,6 +1361,10 @@ SOURCE=.\msw\utilsexc.cpp # End Source File # Begin Source File +SOURCE=.\msw\volume.cpp +# End Source File +# Begin Source File + SOURCE=.\msw\wave.cpp # End Source File # Begin Source File @@ -2338,6 +2342,10 @@ SOURCE=..\include\wx\version.h # End Source File # Begin Source File +SOURCE=..\include\wx\volume.h +# End Source File +# Begin Source File + SOURCE=..\include\wx\wave.h # End Source File # Begin Source File @@ -2920,6 +2928,10 @@ SOURCE=..\include\wx\generic\textdlgg.h # End Source File # Begin Source File +SOURCE=..\include\wx\generic\timer.h +# End Source File +# Begin Source File + SOURCE=..\include\wx\generic\treectlg.h # End Source File # Begin Source File diff --git a/src/x11/files.lst b/src/x11/files.lst index f94664ef0e..e2c29117d2 100644 --- a/src/x11/files.lst +++ b/src/x11/files.lst @@ -22,12 +22,12 @@ ALL_SOURCES = \ x11/joystick.cpp \ x11/main.cpp \ x11/minifram.cpp \ + x11/nanox.c \ x11/palette.cpp \ x11/pen.cpp \ x11/popupwin.cpp \ x11/region.cpp \ x11/settings.cpp \ - x11/timer.cpp \ x11/toplevel.cpp \ x11/utils.cpp \ x11/window.cpp \ @@ -71,6 +71,7 @@ ALL_SOURCES = \ generic/tabg.cpp \ generic/tbarsmpl.cpp \ generic/textdlgg.cpp \ + generic/timer.cpp \ generic/tipdlg.cpp \ generic/tipwin.cpp \ generic/treectlg.cpp \ @@ -447,6 +448,7 @@ ALL_HEADERS = \ variant.h \ vector.h \ version.h \ + volume.h \ wave.h \ wfstream.h \ window.h \ @@ -490,7 +492,6 @@ ALL_HEADERS = \ x11/private.h \ x11/region.h \ x11/settings.h \ - x11/timer.h \ x11/toolbar.h \ x11/toplevel.h \ x11/window.h \ @@ -567,6 +568,7 @@ ALL_HEADERS = \ generic/statusbr.h \ generic/tabg.h \ generic/textdlgg.h \ + generic/timer.h \ generic/treectlg.h \ generic/wizard.h \ unix/execute.h \ @@ -613,12 +615,12 @@ GUI_LOWLEVEL_OBJS = \ joystick.o \ main.o \ minifram.o \ + nanox.o \ palette.o \ pen.o \ popupwin.o \ region.o \ settings.o \ - timer.o \ toplevel.o \ utils.o \ window.o @@ -792,6 +794,7 @@ GENERICOBJS = \ tabg.o \ tbarsmpl.o \ textdlgg.o \ + timer.o \ tipdlg.o \ tipwin.o \ treectlg.o \ diff --git a/src/x11/timer.cpp b/src/x11/timer.cpp deleted file mode 100644 index adf095d4ab..0000000000 --- a/src/x11/timer.cpp +++ /dev/null @@ -1,217 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: x11/timer.cpp -// Purpose: wxTimer implementation -// Author: Vaclav Slavik -// Id: $Id$ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -#ifdef __GNUG__ -#pragma implementation "timer.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/timer.h" - -#if wxUSE_TIMER - -#include "wx/log.h" -#include "wx/module.h" -#include "wx/x11/private.h" - -// ---------------------------------------------------------------------------- -// helper structures and wxTimerScheduler -// ---------------------------------------------------------------------------- - -class wxTimerDesc -{ -public: - wxTimerDesc(wxTimer *t) : - timer(t), running(FALSE), next(NULL), prev(NULL), - shotTime(0), deleteFlag(NULL) {} - - wxTimer *timer; - bool running; - wxTimerDesc *next, *prev; - unsigned long shotTime; - volatile bool *deleteFlag; // see comment in ~wxTimer -}; - -class wxTimerScheduler -{ -public: - wxTimerScheduler() : m_timers(NULL) {} - - void QueueTimer(wxTimerDesc *desc, unsigned long when = 0); - void RemoveTimer(wxTimerDesc *desc); - void NotifyTimers(); - -private: - wxTimerDesc *m_timers; -}; - -void wxTimerScheduler::QueueTimer(wxTimerDesc *desc, unsigned long when) -{ - if ( desc->running ) - return; // already scheduled - - if ( when == 0 ) - { - unsigned long local = wxGetLocalTimeMillis().ToLong(); - when = local + desc->timer->GetInterval(); - } - desc->shotTime = when; - desc->running = TRUE; - - wxLogTrace("mgl_timer", "queued timer %p at tick %i", - desc->timer, when); - - if ( m_timers ) - { - wxTimerDesc *d = m_timers; - while ( d->next && d->next->shotTime < when ) d = d->next; - desc->next = d->next; - desc->prev = d; - if ( d->next ) - d->next->prev = desc; - d->next = desc; - } - else - { - m_timers = desc; - desc->prev = desc->next = NULL; - } -} - -void wxTimerScheduler::RemoveTimer(wxTimerDesc *desc) -{ - desc->running = FALSE; - if ( desc == m_timers ) - m_timers = desc->next; - if ( desc->prev ) - desc->prev->next = desc->next; - if ( desc->next ) - desc->next->prev = desc->prev; - desc->prev = desc->next = NULL; -} - -void wxTimerScheduler::NotifyTimers() -{ - if ( m_timers ) - { - bool oneShot; - volatile bool timerDeleted; - unsigned long now = wxGetLocalTimeMillis().ToLong(); - wxTimerDesc *desc; - - while ( m_timers && m_timers->shotTime <= now ) - { - desc = m_timers; - oneShot = desc->timer->IsOneShot(); - RemoveTimer(desc); - - timerDeleted = FALSE; - desc->deleteFlag = &timerDeleted; - desc->timer->Notify(); - - if ( !timerDeleted ) - { - wxLogTrace("mgl_timer", "notified timer %p sheduled for %i", - desc->timer, desc->shotTime); - - desc->deleteFlag = NULL; - if ( !oneShot ) - QueueTimer(desc, now + desc->timer->GetInterval()); - } - } - } -} - - - -// ---------------------------------------------------------------------------- -// wxTimer -// ---------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxTimer,wxObject) - -wxTimerScheduler *gs_scheduler = NULL; - -void wxTimer::Init() -{ - if ( !gs_scheduler ) - gs_scheduler = new wxTimerScheduler; - m_desc = new wxTimerDesc(this); -} - -wxTimer::~wxTimer() -{ - wxLogTrace("mgl_timer", "destroying timer %p...", this); - if ( IsRunning() ) - Stop(); - - // NB: this is a hack: wxTimerScheduler must have some way of knowing - // that wxTimer object was deleted under its hands -- this may - // happen if somebody is really nasty and deletes the timer - // from wxTimer::Notify() - if ( m_desc->deleteFlag != NULL ) - *m_desc->deleteFlag = TRUE; - - delete m_desc; - wxLogTrace("mgl_timer", " ...done destroying timer %p...", this); -} - -bool wxTimer::IsRunning() const -{ - return m_desc->running; -} - -bool wxTimer::Start(int millisecs, bool oneShot) -{ - wxLogTrace("mgl_timer", "started timer %p: %i ms, oneshot=%i", - this, millisecs, oneShot); - - if ( !wxTimerBase::Start(millisecs, oneShot) ) - return FALSE; - - gs_scheduler->QueueTimer(m_desc); - return TRUE; -} - -void wxTimer::Stop() -{ - if ( !m_desc->running ) return; - - gs_scheduler->RemoveTimer(m_desc); -} - -/*static*/ void wxTimer::NotifyTimers() -{ - if ( gs_scheduler ) - gs_scheduler->NotifyTimers(); -} - - - -// A module to deallocate memory properly: -class wxTimerModule: public wxModule -{ -DECLARE_DYNAMIC_CLASS(wxTimerModule) -public: - wxTimerModule() {} - bool OnInit() { return TRUE; } - void OnExit() { delete gs_scheduler; gs_scheduler = NULL; } -}; - -IMPLEMENT_DYNAMIC_CLASS(wxTimerModule, wxModule) - - -#endif //wxUSE_TIMER -- 2.45.2