From 14134ff1711cc416b7afdd94e008e41c50dbd506 Mon Sep 17 00:00:00 2001 From: hyatt Date: Thu, 30 Apr 1998 22:10:33 +0000 Subject: [PATCH] Fix for Bug #107284, need to monitor when the animation starts and stops. git-svn-id: svn://10.0.0.236/trunk@937 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/cmd/winfe/animbar2.cpp | 21 +++++- mozilla/cmd/winfe/dde.cpp | 86 +++++++++++++++++++++++++ mozilla/cmd/winfe/fedde.h | 1 + mozilla/cmd/winfe/mkfiles32/mozilla.mak | 1 + mozilla/cmd/winfe/mozilla.rc | 3 + mozilla/cmd/winfe/resource.h | 3 + mozilla/cmd/winfe/wfedde.h | 12 ++++ 7 files changed, 126 insertions(+), 1 deletion(-) diff --git a/mozilla/cmd/winfe/animbar2.cpp b/mozilla/cmd/winfe/animbar2.cpp index 156f0c95c70..c29a37a8de3 100644 --- a/mozilla/cmd/winfe/animbar2.cpp +++ b/mozilla/cmd/winfe/animbar2.cpp @@ -23,6 +23,7 @@ #include "prefapi.h" #include "custom.h" #include "sysinfo.h" +#include "animecho.h" #define ANIMATION_WIDTH 16 #define ANIMATION_HEIGHT 16 @@ -392,7 +393,25 @@ void CAnimation2::StopAnimation() void CAnimation2::StartAnimation() { m_iAnimationCount = 1; - m_uAnimationClock = SetTimer(WIN_ANIMATE_ICON_TIMER, ANIMATION_PERIOD/m_iFrameCount, NULL); + + if (m_uAnimationClock == 0) + { + // The animation is not currently running. + m_uAnimationClock = SetTimer(WIN_ANIMATE_ICON_TIMER, ANIMATION_PERIOD/m_iFrameCount, NULL); + + // Added by Dave (4/98). DDE Hook to listen to animation. + CFrameWnd* pFrame = GetTopLevelFrame(); + if (pFrame->IsKindOf(RUNTIME_CLASS(CGenericFrame))) + { + CGenericFrame* pGenFrame = (CGenericFrame*)pFrame; + CWinCX* pWinContext = pGenFrame->GetMainWinContext(); + if (pWinContext) + { + DWORD dwWindowID = pWinContext->GetContextID(); + CDDEAnimationEcho::Echo(dwWindowID, (DWORD)1); + } + } + } } void CAnimation2::AnimateIcon() diff --git a/mozilla/cmd/winfe/dde.cpp b/mozilla/cmd/winfe/dde.cpp index b2eb62d9e10..0f953173bde 100755 --- a/mozilla/cmd/winfe/dde.cpp +++ b/mozilla/cmd/winfe/dde.cpp @@ -32,6 +32,7 @@ #include "net.h" // Added so cache can be referenced (8/18/97) #include "mkcache.h" // Ditto #include "cxprint.h" // The printing context... used for PrintWindow and PrintURL (8/27/97) +#include "animecho.h" // Our DDE instance identifier. DWORD CDDEWrapper::m_dwidInst; @@ -345,6 +346,20 @@ void DDEStartup() DdeCreateStringHandle(CDDEWrapper::m_dwidInst, (char *)(const char *)CS, CP_WINANSI); + // Added by DWH 4/98 + CS.LoadString(IDS_DDE_REGISTERANIMATIONECHO); + CDDEWrapper::m_hsz[CDDEWrapper::m_RegisterAnimationEcho] = + DdeCreateStringHandle(CDDEWrapper::m_dwidInst, + (char *)(const char *)CS, CP_WINANSI); + CS.LoadString(IDS_DDE_UNREGISTERANIMATIONECHO); + CDDEWrapper::m_hsz[CDDEWrapper::m_UnRegisterAnimationEcho] = + DdeCreateStringHandle(CDDEWrapper::m_dwidInst, + (char *)(const char *)CS, CP_WINANSI); + CS.LoadString(IDS_DDE_ANIMATIONECHO); + CDDEWrapper::m_hsz[CDDEWrapper::m_AnimationEcho] = + DdeCreateStringHandle(CDDEWrapper::m_dwidInst, + (char *)(const char *)CS, CP_WINANSI); + // Register our Name Service with DDEML; we are prepared to rock. // Ignore any error, we could call shutdown if need really be.... DdeNameService(CDDEWrapper::m_dwidInst, @@ -1798,6 +1813,10 @@ HDDEDATA CDDEWrapper::PokeHandler(HSZ& hszTopic, HSZ& hszItem, return(RegisterURLEcho(hszItem, hData)); case m_UnRegisterURLEcho: return(UnRegisterURLEcho(hszItem, hData)); + case m_RegisterAnimationEcho: + return(RegisterAnimationEcho(hszItem, hData)); + case m_UnRegisterAnimationEcho: + return(UnRegisterAnimationEcho(hszItem, hData)); case m_WindowChange: return(WindowChange(hszItem, hData)); case m_CancelProgress: @@ -3255,6 +3274,73 @@ void CDDEWrapper::URLEcho(CDDEEchoItem *pItem, CString& csURL, CString& csMimeTy } } + +// Functions for handling animation echoing (Added by Dave Hyatt 4/98) +HDDEDATA CDDEWrapper::RegisterAnimationEcho(HSZ& hszItem, HDDEDATA& hData) +{ + // Scan in our arguments. + CString csServiceName; + ScanArgs(hszItem, "QCS", &csServiceName); + + // Have the URL echo class handle it. + CDDEAnimationEcho::DDERegister(csServiceName); + + return((HDDEDATA)DDE_FACK); +} + + +HDDEDATA CDDEWrapper::UnRegisterAnimationEcho(HSZ& hszItem, HDDEDATA& hData) +{ + // Scan in our arguments. + CString csServiceName; + ScanArgs(hszItem, "QCS", &csServiceName); + + // Have the URL echo class handle it. + if(CDDEAnimationEcho::DDEUnRegister(csServiceName) == TRUE) { + return((HDDEDATA)DDE_FACK); + } + + return((HDDEDATA)DDE_FNOTPROCESSED); +} + +void CDDEWrapper::AnimationEcho(CDDEAnimationEcho *pItem, DWORD dwWindowID, DWORD dwState) +{ + // Get the server name. + CString csServiceName = pItem->GetServiceName(); + + // Establish the connection to homeworld. + CDDEWrapper *pConv = ClientConnect(csServiceName, m_hsz[m_AnimationEcho]); + + if(pConv == NULL) + { + CDDEAnimationEcho::DDEUnRegister(csServiceName); + return; + } + + // Save the conversation, in case the DDE server disconnects behind + // our backs. + HCONV hSaveConv = pConv->m_hConv; + + // Create our argument list. + HSZ hszItem = MakeItemArgs("DW,DW", &dwWindowID, &dwState); + + // Do the transaction, expect nothing. + DdeClientTransaction(NULL, 0L, hSaveConv, hszItem, CF_TEXT, + XTYP_POKE, m_Timeout, NULL); + + // Cut the cord. + DdeFreeStringHandle(m_dwidInst, hszItem); + DdeDisconnect(hSaveConv); + + // Make sure we still have a conversation, if so, delete the object. + pConv = GetConvObj(hSaveConv); + if(pConv) + { + delete pConv; + } +} + + // Purpose: Register a DDE server to monitor a certain window's close. // Arguments: hszItem the argumetns, the server and the window // Returns: HDDEDATA TRUE or FALSE, FALSE there was no window. diff --git a/mozilla/cmd/winfe/fedde.h b/mozilla/cmd/winfe/fedde.h index e7c5a37222b..a1c646821ef 100644 --- a/mozilla/cmd/winfe/fedde.h +++ b/mozilla/cmd/winfe/fedde.h @@ -188,6 +188,7 @@ struct CDDEWrapper { // Client Window change commands. static void WindowChange(CDDEWindowChangeItem *pItem, int iChange, TwoByteBool bExiting = FALSE, DWORD dwX = 0, DWORD dwY = 0, DWORD dwCX = 0, DWORD cwCY = 0); + }; // Function declarations diff --git a/mozilla/cmd/winfe/mkfiles32/mozilla.mak b/mozilla/cmd/winfe/mkfiles32/mozilla.mak index 382e70700c4..52223c27b93 100644 --- a/mozilla/cmd/winfe/mkfiles32/mozilla.mak +++ b/mozilla/cmd/winfe/mkfiles32/mozilla.mak @@ -1208,6 +1208,7 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\cmd\winfe\animbar.cpp $(DEPTH)\cmd\winfe\animbar2.cpp $(DEPTH)\cmd\winfe\apiapi.cpp + $(DEPTH)\cmd\winfe\animecho.cpp $(DEPTH)\cmd\winfe\askmedlg.cpp $(DEPTH)\cmd\winfe\authdll.cpp $(DEPTH)\cmd\winfe\button.cpp diff --git a/mozilla/cmd/winfe/mozilla.rc b/mozilla/cmd/winfe/mozilla.rc index 1e8b3f6f5c6..94845afcf93 100644 --- a/mozilla/cmd/winfe/mozilla.rc +++ b/mozilla/cmd/winfe/mozilla.rc @@ -2877,6 +2877,9 @@ BEGIN IDS_DDE_UNREGISTERWINDOWCHANGE "WWW_UnRegisterWindowChange" IDS_DDE_BEGINPROGRESS "WWW_BeginProgress" IDS_DDE_SETPROGRESSRANGE "WWW_SetProgressRange" + IDS_DDE_REGISTERANIMATIONECHO "WWW_RegisterAnimationEcho" + IDS_DDE_UNREGISTERANIMATIONECHO "WWW_UnRegisterAnimationEcho" + IDS_DDE_ANIMATIONECHO "WWW_AnimationEcho" END STRINGTABLE DISCARDABLE diff --git a/mozilla/cmd/winfe/resource.h b/mozilla/cmd/winfe/resource.h index 524afadf07f..45741ec7610 100755 --- a/mozilla/cmd/winfe/resource.h +++ b/mozilla/cmd/winfe/resource.h @@ -3261,6 +3261,9 @@ #define IDS_DDE_QUERYURLFILE 61272 #define IDS_DDE_LISTFRAMECHILDREN 61273 #define IDS_DDE_GETFRAMEPARENT 61274 +#define IDS_DDE_REGISTERANIMATIONECHO 61275 +#define IDS_DDE_UNREGISTERANIMATIONECHO 61276 +#define IDS_DDE_ANIMATIONECHO 61277 #define IDS_HELP_REGISTRATION 61299 #define IDS_WINEXEC_XX 61300 #define IDS_WINEXEC_0_8 61301 diff --git a/mozilla/cmd/winfe/wfedde.h b/mozilla/cmd/winfe/wfedde.h index 7941e015629..d953ea0517f 100644 --- a/mozilla/cmd/winfe/wfedde.h +++ b/mozilla/cmd/winfe/wfedde.h @@ -44,6 +44,8 @@ #endif // WIN32 #include "genchrom.h" +class CDDEAnimationEcho; + // Constants // // Change this on each revision. Hiword is major, Loword is minor. @@ -117,6 +119,9 @@ struct CDDEWrapper { m_ExecuteJavaScript, m_PrintWindow, m_PrintURL, + m_RegisterAnimationEcho, // Added by DWH (4/98) + m_AnimationEcho, + m_UnRegisterAnimationEcho, // End of the new topics -- Dave Hyatt (8/13/97) m_MaxHSZ, // Where all hsz strings end, and where topics end m_Timeout = 30000, // Timeout value, in milliseconds, that the we will wait as a client. @@ -227,6 +232,10 @@ struct CDDEWrapper { HDDEDATA WindowChange(HSZ& hszItem, HDDEDATA& hData); HDDEDATA CancelProgress(HSZ& hszItem, HDDEDATA& hData); + // Server Pokes for animation changes (added 4/98 by DWH). + HDDEDATA RegisterAnimationEcho(HSZ& hszItem, HDDEDATA& hData); + HDDEDATA UnRegisterAnimationEcho(HSZ& hszItem, HDDEDATA& hData); + // Client connection establisher. static CDDEWrapper *ClientConnect(const char *cpService, HSZ& hszTopic); @@ -264,6 +273,9 @@ struct CDDEWrapper { DWORD dwCX = 0, DWORD cwCY = 0); static void StatusBarChange(CDDEStatusBarChangeItem *pItem, LPCSTR lpStatusMsg);//JOKI + + // Client animation echo commands + static void AnimationEcho(CDDEAnimationEcho* pItem, DWORD dwWindowID, DWORD dwAnimationState); }; // Global variables