]> git.saurik.com Git - wxWidgets.git/commitdiff
move wxMGL's wxTimer to src/generic
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 17 Feb 2002 14:55:41 +0000 (14:55 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 17 Feb 2002 14:55:41 +0000 (14:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

29 files changed:
distrib/msw/tmake/filelist.txt
include/wx/generic/timer.h [new file with mode: 0644]
include/wx/mgl/timer.h [deleted file]
include/wx/x11/timer.h [deleted file]
src/files.lst
src/generic/timer.cpp [new file with mode: 0644]
src/gtk/files.lst
src/gtk1/files.lst
src/mac/carbon/files.lst
src/mac/files.lst
src/mgl/files.lst
src/mgl/makefile.wat
src/mgl/timer.cpp [deleted file]
src/microwin/files.lst
src/motif/files.lst
src/msw/files.lst
src/msw/makefile.b32
src/msw/makefile.bcc
src/msw/makefile.dos
src/msw/makefile.g95
src/msw/makefile.sc
src/msw/makefile.vc
src/msw/makefile.wat
src/univ/files.lst
src/wxBase.dsp
src/wxUniv.dsp
src/wxWindows.dsp
src/x11/files.lst
src/x11/timer.cpp [deleted file]

index 1f578eaf8b1e02ea86a595f425a25edf27e238ff..246786f91864353c1a7fbb5966a6fd2c370fefe6 100644 (file)
@@ -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/generic/timer.h b/include/wx/generic/timer.h
new file mode 100644 (file)
index 0000000..3c38177
--- /dev/null
@@ -0,0 +1,49 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        timer.h
+// Purpose:     Generic implementation of wxTimer class
+// Author:      Vaclav Slavik
+// Id:          $Id$
+// Copyright:   (c) 2001-2002 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/include/wx/mgl/timer.h b/include/wx/mgl/timer.h
deleted file mode 100644 (file)
index 320496e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        timer.h
-// Purpose:     wxTimer class
-// Author:      Vaclav Slavik
-// Id:          $Id$
-// Copyright:   (c) 2001-2002 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/include/wx/x11/timer.h b/include/wx/x11/timer.h
deleted file mode 100644 (file)
index 680fc17..0000000
+++ /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__
index 4fd21e70edba8212aa19dddfac76a069b07212a3..ab056d5b03ca476aee907ec14e5fcab70d6d730e 100644 (file)
@@ -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/generic/timer.cpp b/src/generic/timer.cpp
new file mode 100644 (file)
index 0000000..39974a6
--- /dev/null
@@ -0,0 +1,232 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        mgl/timer.cpp
+// Purpose:     wxTimer implementation
+// Author:      Vaclav Slavik
+// Id:          $Id$
+// Copyright:   (c) 2001-2002 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
+
+// ----------------------------------------------------------------------------
+// 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"
+
+// ----------------------------------------------------------------------------
+// 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
+// ----------------------------------------------------------------------------
+
+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 )
+        when = GetMillisecondsTime() + desc->timer->GetInterval();
+    desc->shotTime = when;
+    desc->running = TRUE;
+
+    wxLogTrace("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 = GetMillisecondsTime();
+        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("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("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("timer", "    ...done destroying timer %p...", this);
+}
+
+bool wxTimer::IsRunning() const
+{
+    return m_desc->running;
+}
+
+bool wxTimer::Start(int millisecs, bool oneShot)
+{
+    wxLogTrace("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
index 316069547d20686a53aef340ecfae916a089c421..a1d9b3173beb27060e22ff3e04b5c67fe29313d3 100644 (file)
@@ -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 \
index 316069547d20686a53aef340ecfae916a089c421..a1d9b3173beb27060e22ff3e04b5c67fe29313d3 100644 (file)
@@ -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 \
index 181ed9de94e1c9de4420f9e774e881f7727a0dc4..259e2d48defbb2d01e03dbaa1fbc1690441c69c0 100644 (file)
@@ -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 \
index 181ed9de94e1c9de4420f9e774e881f7727a0dc4..259e2d48defbb2d01e03dbaa1fbc1690441c69c0 100644 (file)
@@ -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 \
index be66b6479998ee0e3c23ee721b0bfbed2990f087..0c866513948295d52071393ddff91f1858cebdd4 100644 (file)
@@ -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
index 40f1caf6c499f726eedd2db7a1664c47e6ac14e7..05ce7a849412c399e86e23e2a8ba4bed705253c4 100644 (file)
@@ -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/mgl/timer.cpp b/src/mgl/timer.cpp
deleted file mode 100644 (file)
index 1ab1a19..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        mgl/timer.cpp
-// Purpose:     wxTimer implementation
-// Author:      Vaclav Slavik
-// Id:          $Id$
-// Copyright:   (c) 2001-2002 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/mgl/private.h"
-
-extern "C" ulong _EVT_getTicks();
-
-// ----------------------------------------------------------------------------
-// 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 )
-        when = _EVT_getTicks() + 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 = _EVT_getTicks();
-        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
index 8989eb774ae001794e36058fe91347805e0543da..7f43e3e584918de209e60ed88a80724d95004613 100644 (file)
@@ -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 \
index 28b9f83177c79c39ef6b8042140a2688789dd672..9487be7c065137572cd94c7f5f2038fdba529168 100644 (file)
@@ -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 \
index ff8f90d8a36adb568ba34d2e0920c2f49b1dc46d..38148cdac4145e29cb1fe1f6a742bd891b050217 100644 (file)
@@ -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
 
index 842b28ac72dff2091631c3639f9737d24e20d221..f395edd2324d13c2edd34fad374f0a4a035049c6 100644 (file)
@@ -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)
index bdbc667a9e69694c53d5cdf23f24ffad51c2f094..6ec16f2814f8e0e26ed5e221e21a9aae5c932f6b 100644 (file)
@@ -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)
index 657335adff19abbe40fd73af3c222311d1df799e..30ccd68365d261a5af5328bee72ac68dc975c9a9 100644 (file)
@@ -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)
index 52686b073123117fe4619560bd3dd44b823b0840..59b8a9c1fffab66c00247d42b5aebaf67dcce26d 100644 (file)
@@ -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) \
index 921389e58c1dfbaa289862d11a9d3f503cd2d203..a7a3ae40e19c01edd33bd6f5623d834e02997a6d 100644 (file)
@@ -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
 
index f4062f56b6d65e6a792ac8a581799bfd2f1834be..b12c0ffbbcbf0a2f9ba5c8f19881127961824bae 100644 (file)
@@ -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
 
index 7f9244b131095e3c6c2bdddd9fc413015a0223ed..5f2d58f03ffb33171c04880306fb7f24d0ec3125 100644 (file)
@@ -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) $<
 
index 215c7f4e39d157c2d09f5e5da6682b730b5f0262..4cb6f59e7fea7dad273b771ac7e56d0f6359d1b2 100644 (file)
@@ -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 \
index 0a13f847d4ee14b0c855f854eb0e81da5bb267ce..ba205f9d637d47e3116d362632961bcdf3476ac2 100644 (file)
@@ -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
index cf14747a7e309b625db668ee70c2f95e7e4a64e0..635fb3f7793ee358c877a64d5e3a689e729b5849 100644 (file)
@@ -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
index 28c8b9c5c25c27ca6e60679a0915375714ca116a..753b51cf44e44be9b235a7755c8be987337d93ec 100644 (file)
@@ -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
index f94664ef0e174091db21e684297df961975e112e..e2c29117d2cba0247887baae8733921764333e85 100644 (file)
@@ -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 (file)
index adf095d..0000000
+++ /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