[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : alex
Repository : xara
Revision : 1062
Date : Mon May 15 22:16:01 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/dialogop.cpp
M /Trunk/XaraLX/Kernel/dialogop.h
M /Trunk/XaraLX/Kernel/finfodlg.cpp
M /Trunk/XaraLX/wxOil/dlgevt.cpp
M /Trunk/XaraLX/wxOil/dlgevt.h
M /Trunk/XaraLX/wxOil/dlgmgr.cpp
M /Trunk/XaraLX/wxOil/dlgmgr.h
M /Trunk/XaraLX/wxOil/ktimer.h
Implement dialog timers
Diff:
Index: Trunk/XaraLX/Kernel/finfodlg.cpp
===================================================================
--- Trunk/XaraLX/Kernel/finfodlg.cpp (revision 1061)
+++ Trunk/XaraLX/Kernel/finfodlg.cpp (revision 1062)
@@ -110,7 +110,7 @@
//#include "mario.h" // for string resource
//#include "peter.h" // for string resources
-#include "reshlpid.h" // for help resources
+//#include "reshlpid.h" // for help resources
//#include "peterdlg.h" // for dialogue resources
#include "document.h" // for reading and setting document attributes
@@ -129,10 +129,12 @@
//#include "barsdlgs.h" // for the document info file bar controls
#include "fontman.h"
#include "bubbleid.h"
-#include "customlist.h"
+//#include "customlist.h"
//#include "richard.h"
//#include "will2.h"
+#include "opdesc.h"
+#include "ophist.h"
// Required for the document font combo box handling
#include "fontman.h"
@@ -474,9 +476,9 @@
// check the style
INT32 Style = FontItem->GetFontStyle();
if (Style & 1)
- strName += " -Bold";
+ strName += _T(" -Bold");
if (Style & 2)
- strName += " -Italic";
+ strName += _T(" -Italic");
if (Handle > 0)
{
@@ -554,6 +556,8 @@
List ItemList;
+PORTNOTE("other", "Disabled bitmap effects")
+#ifndef EXCLUDE_FROM_XARALX
ListRange* pEffectList = pWorkDoc->GetEffectsList(500000); // Arbitrary large number
if (pEffectList)
{
@@ -620,7 +624,7 @@
delete pEffectList;
pEffectList = NULL;
}
-
+#endif
// Put the sorted items in the list gadget
RefItem* pRefItem = (RefItem*)ItemList.GetHead();
while (pRefItem)
@@ -690,23 +694,23 @@
if (WorkDoc == NULL)
{
String_8 DashString(_R(IDS_K_FINFODLG_DASH));
- String_8 NullString = "";
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_UNDOSIZE), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_UNDOSTEPS), &DashString);
-// UpdateStringGadgetValue(this, _R(IDC_FILEINFO_SPREADS), &DashString);
-// UpdateStringGadgetValue(this, _R(IDC_FILEINFO_PAGES), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_NUMOBJECTS), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_NUMSELOBJECTS), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_LOCATION), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_FILENAME), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_FILESIZE), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_NUMBITMAPS), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_BITMAPSIZE), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_FRACTALS), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_FRACTALSIZE), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_CREATIONDATE), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_LASTSAVEDATE), &DashString);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_COMMENT), &NullString);
+ String_8 NullString = _T("");
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_UNDOSIZE), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_UNDOSTEPS), &DashString);
+// UpdateStringGadgetValue(_R(IDC_FILEINFO_SPREADS), &DashString);
+// UpdateStringGadgetValue(_R(IDC_FILEINFO_PAGES), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMOBJECTS), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMSELOBJECTS), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_LOCATION), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_FILENAME), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_FILESIZE), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMBITMAPS), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_BITMAPSIZE), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_FRACTALS), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_FRACTALSIZE), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_CREATIONDATE), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_LASTSAVEDATE), &DashString);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_COMMENT), &NullString);
return TRUE;
}
@@ -729,7 +733,7 @@
String2.MakeMsg(_R(IDS_FILEINFO_REDUCED));
String += String2;
}
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_UNDOSIZE), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_UNDOSIZE), &String);
// Now calculate the number of undo and redo steps
UINT32 UndoSteps = WorkDoc->GetOpHistory().GetNumUndoSteps();
@@ -748,7 +752,7 @@
{
String_256 String3;
String2.MakeMsg(_R(IDS_FILEINFO_REDOSTEPS), RedoSteps);
- if (String.CompareTo("") != 0)
+ if (String.CompareTo(_T("")) != 0)
String += String_64(_R(IDS_K_FINFODLG_SEPERATOR));
if (RedoSteps == 1)
String3.MakeMsg(_R(IDS_FILEINFO_STEP));
@@ -757,14 +761,14 @@
String += String2;
String += String3;
}
- if (String.CompareTo("") == 0)
+ if (String.CompareTo(_T("")) == 0)
{
String.MakeMsg(_R(IDS_FILEINFO_NOSTEPS));
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_UNDOSTEPS), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_UNDOSTEPS), &String);
}
else
{
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_UNDOSTEPS), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_UNDOSTEPS), &String);
}
// --
@@ -775,7 +779,7 @@
if (UpdateComment)
{
String = WorkDoc->GetComment();
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_COMMENT), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_COMMENT), &String);
}
// Now scan the document for the various object counts
@@ -897,19 +901,19 @@
// No longer required as only one spread in version 1.0
// String._MakeMsg("#1%lu", Spreads);
-// UpdateStringGadgetValue(this, _R(IDC_FILEINFO_SPREADS), &String);
+// UpdateStringGadgetValue(_R(IDC_FILEINFO_SPREADS), &String);
// String._MakeMsg("#1%lu", Pages);
-// UpdateStringGadgetValue(this, _R(IDC_FILEINFO_PAGES), &String);
+// UpdateStringGadgetValue(_R(IDC_FILEINFO_PAGES), &String);
// --
// -- Display number of objects and number of selected objects
// --
// Show some of the information that we found
- String._MakeMsg("#1%lu", Objects);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_NUMOBJECTS), &String);
- String._MakeMsg("#1%lu", SelObjects);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_NUMSELOBJECTS), &String);
+ String._MakeMsg(_T("#1%lu"), Objects);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMOBJECTS), &String);
+ String._MakeMsg(_T("#1%lu"), SelObjects);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMSELOBJECTS), &String);
// --
// -- Display count and size of fractals in the document
@@ -925,10 +929,10 @@
if (FracList)
FracList->GetDocumentFractalData(WorkDoc,&FracData);
}
- String._MakeMsg("#1%lu", FracData.Count);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_FRACTALS), &String);
+ String._MakeMsg(_T("#1%lu"), FracData.Count);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_FRACTALS), &String);
Convert::BytesToString(&String, FracData.Size);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_FRACTALSIZE), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_FRACTALSIZE), &String);
// --
// -- Display count and size of bitmaps in the document
@@ -946,11 +950,11 @@
}
}
//String._MakeMsg("#1%lu", Bitmaps);
- String._MakeMsg("#1%lu", BitmapsCount);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_NUMBITMAPS), &String);
+ String._MakeMsg(_T("#1%lu"), BitmapsCount);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMBITMAPS), &String);
//BytesToString(&String, BitmapSize);
Convert::BytesToString(&String, BitmapsSize);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_BITMAPSIZE), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_BITMAPSIZE), &String);
// Now show our final size
// Add in the number of bitmaps that we found as these will be saved with the
@@ -960,7 +964,7 @@
Size += BitmapsSize;
Size += FracData.Size;
Convert::BytesToString(&String, Size);
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_FILESIZE), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_FILESIZE), &String);
// --
// -- Display Location and Filename of document
@@ -976,12 +980,12 @@
// No pathname yet, so put in a nice message
String.MakeMsg(_R(IDS_FILEINFO_UNSAVED));
}
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_LOCATION), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_LOCATION), &String);
// Now show the current filename
String.Empty();
String = WorkDoc->GetTitle();
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_FILENAME), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_FILENAME), &String);
// --
// -- Display Creation and Save times for the document
@@ -992,23 +996,23 @@
TimeData = WorkDoc->GetCreationTime();
LocalEnvironment::SystemTimeToString(&String, &TimeData);
LocalEnvironment::SystemDateToString(&String2, &TimeData);
- String += " ";
+ String += _T(" ");
String += String2;
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_CREATIONDATE), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_CREATIONDATE), &String);
TimeData = WorkDoc->GetLastSaveTime();
if (TimeData != 0)
{
LocalEnvironment::SystemTimeToString(&String, &TimeData);
LocalEnvironment::SystemDateToString(&String2, &TimeData);
- String += " ";
+ String += _T(" ");
String += String2;
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_LASTSAVEDATE), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_LASTSAVEDATE), &String);
}
else
{
String.MakeMsg(_R(IDS_FILEINFO_UNSAVED));
- UpdateStringGadgetValue(this, _R(IDC_FILEINFO_LASTSAVEDATE), &String);
+ UpdateStringGadgetValue(_R(IDC_FILEINFO_LASTSAVEDATE), &String);
}
#ifdef STANDALONE
Index: Trunk/XaraLX/Kernel/dialogop.cpp
===================================================================
--- Trunk/XaraLX/Kernel/dialogop.cpp (revision 1061)
+++ Trunk/XaraLX/Kernel/dialogop.cpp (revision 1062)
@@ -3314,36 +3314,33 @@
/********************************************************************************************
-> BOOL DialogOp::SetTimer(UINT32 nIDEvent, UINT32 nElapse,
- void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT32, UINT32, DWORD) = NULL)
+> UINT32 DialogOp::SetTimer(UINT32 nIDEvent, UINT32 nElapse,
+ void (* lpfnTimer)(void *) = NULL,
+ void * param = NULL,
+ BOOL OneShot = FALSE)
Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xxxxxxxx>
Created: 15/4/97
Inputs: nIDEvent Specifies a nonzero timer identifier.
nElapse Specifies the time-out value, in milliseconds.
+ param An opaque parameter sent to the timer function (along with nIDEvent)
Returns: The timer identifier of the new timer if Nonzero, Zero means a problem.
Purpose: Allows the user access to setting a timer caller back or event for a dialog box.
The caller can either specify a call back procedure to be called when the timer
goes off or if null is specified, a DIM_TIMER message will be sent.
- This maps onto the Windows API/CWnd call.
The return value is effectively the handle onto the timer system. It must be
passed to the KillTimer member function to kill the timer. A Nonzero value
indicates successful allocation of the timer; non-zero implies a problem.
- Note: DIM_TIMER code is not tested.
-
SeeAlso: DialogOp::KillTimer; DialogManager::SetTimer;
********************************************************************************************/
-PORTNOTE("dialog","Removed DialogOp::SetTimer - HWND and timer usage")
-#ifndef EXCLUDE_FROM_XARALX
-UINT32 DialogOp::SetTimer(UINT32 nIDEvent, UINT32 nElapse, void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT32, UINT32, DWORD))
+UINT32 DialogOp::SetTimer(UINT32 nIDEvent, UINT32 nElapse, void (* lpfnTimer)(void *)/* = NULL*/, void * param/*=NULL*/, BOOL OneShot /*=FALSE*/)
{
// Call the Dialog Manager
- return DialogManager::SetTimer( GetReadWriteWindowID(), nIDEvent, nElapse, lpfnTimer );
+ return DialogManager::SetTimer( this, GetReadWriteWindowID(), nIDEvent, nElapse, lpfnTimer, param, OneShot );
}
-#endif
/********************************************************************************************
@@ -3362,14 +3359,11 @@
********************************************************************************************/
-PORTNOTE("dialog","Removed DialogOp::KillTimer - HWND and timer usage")
-#ifndef EXCLUDE_FROM_XARALX
BOOL DialogOp::KillTimer(INT32 nIDEvent)
{
// Call the Dialog Manager
- return DialogManager::KillTimer( GetReadWriteWindowID(), nIDEvent );
+ return DialogManager::KillTimer( this, GetReadWriteWindowID(), nIDEvent );
}
-#endif
/********************************************************************************************
Index: Trunk/XaraLX/Kernel/dialogop.h
===================================================================
--- Trunk/XaraLX/Kernel/dialogop.h (revision 1061)
+++ Trunk/XaraLX/Kernel/dialogop.h (revision 1062)
@@ -494,11 +494,8 @@
public:
// Setting up and killing timer events for dialog boxes
-PORTNOTE("dialog","Removed HWND and timer usage")
-#ifndef EXCLUDE_FROM_XARALX
- UINT32 SetTimer(UINT32 nIDEvent, UINT32 nElapse, void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT32, UINT32, DWORD) = NULL);
+ UINT32 SetTimer(UINT32 nIDEvent, UINT32 nElapse, void (* lpfnTimer)(void *) = NULL, void * param=NULL, BOOL OneShot=FALSE);
BOOL KillTimer(INT32 nIDEvent);
-#endif
// Get and set the position of a window or a gadget
BOOL GetWindowPosition( wxRect *pRect );
Index: Trunk/XaraLX/wxOil/ktimer.h
===================================================================
--- Trunk/XaraLX/wxOil/ktimer.h (revision 1061)
+++ Trunk/XaraLX/wxOil/ktimer.h (revision 1062)
@@ -165,7 +165,7 @@
MyClass * m_pOwner;
};
MyTimer m_Timer;
- }
+ };
********************************************************************************************/
Index: Trunk/XaraLX/wxOil/dlgevt.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dlgevt.cpp (revision 1061)
+++ Trunk/XaraLX/wxOil/dlgevt.cpp (revision 1062)
@@ -171,8 +171,39 @@
DEFINE_EVENT_TYPE(wxEVT_CAMDIALOG_REDRAW)
IMPLEMENT_DYNAMIC_CLASS( wxCamDialogEvent, wxEvent )
+CC_IMPLEMENT_DYNAMIC(DlgEvtTimer, KernelTimer);
+
+
/********************************************************************************************
+> void DialogEvtTimer::OnNotify()
+
+ Author: Alex_Bligh <alex@xxxxxxxxxxx>
+ Created: 15/05/2005
+ Inputs: None
+ Outputs: None
+ Returns: -
+ Purpose: Act on a timer event
+ Errors: -
+ SeeAlso: -
+
+********************************************************************************************/
+
+void DlgEvtTimer::Notify()
+{
+ if (m_lpfnTimer)
+ {
+ (*m_lpfnTimer)(m_Param);
+ }
+ else
+ {
+ // We need to send a DIM_TIMER to the DialogOp
+ BROADCAST_TO_CLASS(DialogMsg(m_pEvtHandler->pwxWindow, DIM_TIMER, 0, (UINT_PTR)m_IDEvent, 0), DialogOp);
+ }
+}
+
+/********************************************************************************************
+
> DialogEventHandler::DialogEventHandler()
@@ -220,6 +251,7 @@
ID=0;
wxAUImanaged=FALSE;
m_GrimReaperSent=FALSE;
+ m_TimerHash.clear();
}
/********************************************************************************************
@@ -243,6 +275,17 @@
DialogEventHandler::~DialogEventHandler()
{
+ // clear out the kernel timers so they don't go off - this should have been done by Destroy()
+ while (!m_TimerHash.empty())
+ {
+ IntegerToKernelTimer::iterator current = m_TimerHash.begin();
+ DlgEvtTimer * t=current->second;
+ m_TimerHash.erase(current);
+ if (t)
+ delete t;
+ }
+ // for good measure
+ m_TimerHash.clear();
}
/********************************************************************************************
@@ -276,6 +319,18 @@
if (!m_GrimReaperSent)
{
+ // clear out the kernel timers so they don't go off after Destroy()
+ while (!m_TimerHash.empty())
+ {
+ IntegerToKernelTimer::iterator current = m_TimerHash.begin();
+ DlgEvtTimer * t=current->second;
+ m_TimerHash.erase(current);
+ if (t)
+ delete t;
+ }
+ // for good measure
+ m_TimerHash.clear();
+
// Disconnect from the DialogOp
if (pDialogOp)
pDialogOp->pEvtHandler=NULL;
@@ -874,3 +929,58 @@
pHash=NULL;
}
}
+
+/********************************************************************************************
+
+> UINT32 DialogEventHandler::AddTimer((DialogOp * pDialogOp, UINT32 nIDEvent, UINT32 nElapse,
+ void (* lpfnTimer)(void *) = NULL, void * param=NULL, BOOL OneShot=FALSE)
+
+
+ Author: Alex_Bligh <alex@xxxxxxxxxxx>
+ Created: 02/12/2005
+ Inputs: parameters for the timer
+ Outputs: None
+ Returns: TRUE if succeeded, FALSE if fails
+ Purpose: Initialize resources
+ Errors: via wxMessageBox
+ SeeAlso: -
+
+********************************************************************************************/
+
+UINT32 DialogEventHandler::AddTimer(DialogOp * pDialogOp, UINT32 nIDEvent, UINT32 nElapse,
+ void (* lpfnTimer)(void *) /*= NULL*/, void * param/*=NULL*/, BOOL OneShot/*=FALSE*/)
+{
+ DeleteTimer(nIDEvent); // delete any previous timer
+ DlgEvtTimer * pTimer = new DlgEvtTimer(this, pDialogOp, nIDEvent, lpfnTimer, param);
+ if (!pTimer)
+ return 0;
+
+ m_TimerHash[nIDEvent]=pTimer;
+ pTimer->Start(nElapse, OneShot);
+ return nIDEvent;
+}
+
+/********************************************************************************************
+
+> UINT32 DialogEventHandler::DeleteTimer(UINT32 nIDEvent)
+
+
+ Author: Alex_Bligh <alex@xxxxxxxxxxx>
+ Created: 02/12/2005
+ Inputs: ID of the timer
+ Outputs: None
+ Returns: TRUE if succeeded, FALSE if fails
+ Purpose: Deletes a timer
+ Errors: -
+ SeeAlso: -
+
+********************************************************************************************/
+
+BOOL DialogEventHandler::DeleteTimer(UINT32 nIDEvent)
+{
+ IntegerToKernelTimer::iterator i=m_TimerHash.find(nIDEvent);
+ if (i==m_TimerHash.end())
+ return FALSE;
+ m_TimerHash.erase(nIDEvent);
+ return TRUE;
+}
Index: Trunk/XaraLX/wxOil/dlgmgr.h
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.h (revision 1061)
+++ Trunk/XaraLX/wxOil/dlgmgr.h (revision 1062)
@@ -730,12 +730,9 @@
static CWindowID GetWindowUnderPointer(WinCoord * wc = NULL);
public:
-PORTNOTE("dialog","Removed HWND and timer usage")
-#ifndef EXCLUDE_FROM_XARALX
// Setting up and killing timer events for dialog boxes
- static UINT32 SetTimer( CWindowID hWnd, UINT32 nIDEvent, UINT32 nElapse, void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT32, UINT32, DWORD) = NULL);
- static BOOL KillTimer( CWindowID hWnd, INT32 nIDEvent);
-#endif
+ static UINT32 SetTimer(DialogOp *pDialogOp, CWindowID WindowID, UINT32 nIDEvent, UINT32 nElapse, void (* lpfnTimer)(void *) = NULL, void * param=NULL, BOOL OneShot=FALSE);
+ static BOOL KillTimer( DialogOp * pDialogOp, CWindowID WindowID, INT32 nIDEvent);
// Get and set the position of a window or a gadget
static BOOL GetWindowPosition(CWindowID WindowID, wxRect *pRect);
Index: Trunk/XaraLX/wxOil/dlgevt.h
===================================================================
--- Trunk/XaraLX/wxOil/dlgevt.h (revision 1061)
+++ Trunk/XaraLX/wxOil/dlgevt.h (revision 1062)
@@ -103,6 +103,7 @@
#include "ccobject.h"
#include "dlgtypes.h"
#include "msg.h"
+#include "ktimer.h"
class DialogManager;
class DialogOp;
@@ -113,6 +114,33 @@
// Declare the hash map from ResourceID to String
WX_DECLARE_HASH_MAP( WXTYPE, EventNameString, wxIntegerHash, wxIntegerEqual, EventNumberToName );
+class DialogEventHandler;
+
+class DlgEvtTimer : public KernelTimer
+{
+ CC_DECLARE_DYNAMIC(DlgEvtTimer);
+friend class DialogEventHandler;
+public:
+ DlgEvtTimer(DialogEventHandler * pEvtHandler=NULL, DialogOp * pDialogOp=NULL, UINT32 IDEvent=NULL,
+ void (* lpfnTimer)(void *) = NULL, void * Param=NULL) :
+ m_pEvtHandler(pEvtHandler),
+ m_pDialogOp(pDialogOp),
+ m_IDEvent(IDEvent),
+ m_lpfnTimer(lpfnTimer),
+ m_Param(Param) {}
+ ~DlgEvtTimer() {}
+protected:
+ virtual void Notify();
+ DialogEventHandler * m_pEvtHandler;
+ DialogOp *m_pDialogOp;
+ UINT32 m_IDEvent;
+ void (* m_lpfnTimer)(void *);
+ void * m_Param;
+};
+
+// Declare the hash map from integers to timers - note this CONTAINS the timers themselves
+WX_DECLARE_HASH_MAP( UINT32, DlgEvtTimer*, wxIntegerHash, wxIntegerEqual, IntegerToKernelTimer );
+
class wxCamDialogEvent;
/*******************************************************************************************
@@ -130,6 +158,7 @@
class DialogEventHandler : public wxEvtHandler
{
friend class DialogManager;
+ friend class DlgEvtTimer;
public:
DialogEventHandler();
@@ -149,6 +178,9 @@
void GrimReaperEvent(wxCamDialogEvent &event);
+ UINT32 AddTimer(DialogOp * pDialogOp, UINT32 nIDEvent, UINT32 nElapse, void (* lpfnTimer)(void *) = NULL, void * param=NULL, BOOL OneShot=FALSE);
+ BOOL DeleteTimer(UINT32 nIDEvent);
+
static inline const TCHAR * GetEventName(WXTYPE EventNum) // Return the EventName
{
if (!pHash) return DefaultString;
@@ -169,6 +201,8 @@
BOOL wxAUImanaged;
BOOL m_GrimReaperSent;
+ IntegerToKernelTimer m_TimerHash;
+
static EventNumberToName * pHash;
static const TCHAR * DefaultString;
Index: Trunk/XaraLX/wxOil/dlgmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.cpp (revision 1061)
+++ Trunk/XaraLX/wxOil/dlgmgr.cpp (revision 1062)
@@ -6737,8 +6737,8 @@
/********************************************************************************************
-> static BOOL DialogManager::SetTimer(HWND hWnd, UINT32 nIDEvent, UINT32 nElapse,
- void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT32, UINT32, DWORD) = NULL)
+> static BOOL DialogManager::SetTimer(DialogOp *pDialogOp, CWindowID WindowID, UINT32 nIDEvent, UINT32 nElapse,
+ void (* lpfnTimer)(void *) = NULL, void * param=NULL, BOOL OneShot =FALSE)
Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xxxxxxxx>
Created: 15/4/97
@@ -6760,18 +6760,14 @@
********************************************************************************************/
-PORTNOTE("dialog","Removed DialogManager::KillTimer - HWND and timer usage")
-#ifndef EXCLUDE_FROM_XARALX
-UINT32 DialogManager::SetTimer( CWindowID hWnd, UINT32 nIDEvent, UINT32 nElapse,
- void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT32, UINT32, DWORD))
+UINT32 DialogManager::SetTimer( DialogOp *pDialogOp, CWindowID WindowID, UINT32 nIDEvent, UINT32 nElapse,
+ void (* lpfnTimer)(void *)/* = NULL*/, void * param/*=NULL*/, BOOL OneShot /*=FALSE*/)
{
- // Call the Windows API
- PORTNOTETRACE("dialog","DialogManager::SetTimer - do nothing");
-// return ::SetTimer(hWnd, nIDEvent, nElapse, lpfnTimer);
+ if (!pDialogOp || !pDialogOp->pEvtHandler)
+ return 0;
- return 0;
+ return pDialogOp->pEvtHandler->AddTimer(pDialogOp, nIDEvent, nElapse, lpfnTimer, param, OneShot);
}
-#endif
/********************************************************************************************
@@ -6791,17 +6787,13 @@
********************************************************************************************/
-PORTNOTE("dialog","Removed DialogManager::KillTimer - HWND and timer usage")
-#ifndef EXCLUDE_FROM_XARALX
-BOOL DialogManager::KillTimer( CWindowID Wnd, INT32 nIDEvent )
+BOOL DialogManager::KillTimer( DialogOp *pDialogOp, CWindowID Wnd, INT32 nIDEvent )
{
- // Call the Windows API
- PORTNOTETRACE("dialog","DialogManager::KillTimer - do nothing");
-// return ::KillTimer(hWnd, nIDEvent);
+ if (!pDialogOp || !pDialogOp->pEvtHandler)
+ return 0;
- return 0;
+ return pDialogOp->pEvtHandler->DeleteTimer(nIDEvent);
}
-#endif
/********************************************************************************************
Xara