Fix for Bug #107284, need to monitor when the animation starts and stops.

This commit is contained in:
hyatt 1998-04-30 22:10:33 +00:00
Родитель 95a42732e1
Коммит 6403a164b4
7 изменённых файлов: 126 добавлений и 1 удалений

Просмотреть файл

@ -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()

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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