From bf98c312685197382277ac766ed2e4ceb1e7c1f4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 15 May 2013 12:39:03 +0000 Subject: MS_MSG_SETSTATUSTEXT - new service for setting the SRMM window's status bar text git-svn-id: http://svn.miranda-ng.org/main/trunk@4656 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdmsg/src/msgdialog.cpp | 25 ++++++++++++------------- src/core/stdmsg/src/msglog.cpp | 12 ++++++------ src/core/stdmsg/src/msgs.cpp | 19 +++++++++++++++++-- src/core/stdmsg/src/msgs.h | 2 +- 4 files changed, 36 insertions(+), 22 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index c98b11ab15..59d4eb7eae 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -176,7 +176,7 @@ static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus) } } -static void ShowTime(struct SrmmWindowData *dat) +static void ShowTime(SrmmWindowData *dat) { if (dat->hwndStatus && dat->hTimeZone) { SYSTEMTIME st; @@ -192,7 +192,7 @@ static void ShowTime(struct SrmmWindowData *dat) } } -static void SetupStatusBar(HWND hwndDlg, struct SrmmWindowData *dat) +static void SetupStatusBar(HWND hwndDlg, SrmmWindowData *dat) { int icons_width, cx, i = 0, statwidths[4]; RECT rc; @@ -220,9 +220,9 @@ static void SetupStatusBar(HWND hwndDlg, struct SrmmWindowData *dat) static void SetDialogToType(HWND hwndDlg) { - struct SrmmWindowData *dat; + SrmmWindowData *dat; - dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + dat = (SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (dat->hContact) ShowMultipleControls(hwndDlg, infoLineControls, SIZEOF(infoLineControls), (g_dat.flags&SMF_SHOWINFO) ? SW_SHOW : SW_HIDE); else @@ -269,7 +269,7 @@ static void SetEditorText(HWND hwnd, const TCHAR* txt) static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - struct SrmmWindowData *pdat = (struct SrmmWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA); + SrmmWindowData *pdat = (SrmmWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA); struct MsgEditSubclassData *dat = (struct MsgEditSubclassData *) GetWindowLongPtr(hwnd, GWLP_USERDATA); switch (msg) { @@ -494,7 +494,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - struct SrmmWindowData *pdat = (struct SrmmWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA); + SrmmWindowData *pdat = (SrmmWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA); switch (msg) { case WM_NCHITTEST: @@ -529,7 +529,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc) { - struct SrmmWindowData *dat = (struct SrmmWindowData *) lParam; + SrmmWindowData *dat = (SrmmWindowData *) lParam; if ( !(g_dat.flags & SMF_SHOWINFO) && !(g_dat.flags & SMF_SHOWBTNS)) { for (int i = 0; i < SIZEOF(buttonLineControls); i++) @@ -602,7 +602,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * return RD_ANCHORX_LEFT | RD_ANCHORY_TOP; } -void ShowAvatar(HWND hwndDlg, struct SrmmWindowData *dat) +void ShowAvatar(HWND hwndDlg, SrmmWindowData *dat) { if (g_dat.flags & SMF_AVATAR) { AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)dat->hContact, 0); @@ -617,7 +617,7 @@ void ShowAvatar(HWND hwndDlg, struct SrmmWindowData *dat) SendMessage(hwndDlg, DM_AVATARSIZECHANGE, 0, 0); } -static void NotifyTyping(struct SrmmWindowData *dat, int mode) +static void NotifyTyping(SrmmWindowData *dat, int mode) { if ( !dat->hContact) return; @@ -678,15 +678,14 @@ void Window_FreeIcon_IcoLib(HWND hwndDlg) INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - struct SrmmWindowData *dat; + SrmmWindowData *dat = (SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { - struct NewMessageWindowLParam *newData = (struct NewMessageWindowLParam *) lParam; + NewMessageWindowLParam *newData = (NewMessageWindowLParam *) lParam; TranslateDialogDefault(hwndDlg); - dat = (struct SrmmWindowData *) mir_calloc(sizeof(struct SrmmWindowData)); + dat = (SrmmWindowData *) mir_calloc(sizeof(SrmmWindowData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat); dat->hContact = newData->hContact; diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index fec3d93737..51a7baad09 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -43,7 +43,7 @@ struct LogStreamData int bufferOffset, bufferLen; int eventsToInsert; int isEmpty; - struct SrmmWindowData *dlgDat; + SrmmWindowData *dlgDat; }; static char szSep2[40], szSep2_RTL[50]; @@ -183,7 +183,7 @@ static int AppendToBufferWithRTF(char **buffer, int *cbBufferEnd, int *cbBufferA #define FONT_FORMAT "{\\f%u\\fnil\\fcharset%u %S;}" -static char *CreateRTFHeader(struct SrmmWindowData *dat) +static char *CreateRTFHeader(SrmmWindowData *dat) { char *buffer; int bufferAlloced, bufferEnd; @@ -219,7 +219,7 @@ static char *CreateRTFHeader(struct SrmmWindowData *dat) } //mir_free() the return value -static char *CreateRTFTail(struct SrmmWindowData *dat) +static char *CreateRTFTail(SrmmWindowData *dat) { char *buffer; int bufferAlloced, bufferEnd; @@ -249,7 +249,7 @@ int DbEventIsForMsgWindow(DBEVENTINFO *dbei) return et && ( et->flags & DETF_MSGWINDOW ); } -int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat) +int DbEventIsShown(DBEVENTINFO * dbei, SrmmWindowData *dat) { switch (dbei->eventType) { case EVENTTYPE_MESSAGE: @@ -264,7 +264,7 @@ int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat) } //mir_free() the return value -static char *CreateRTFFromDbEvent(struct SrmmWindowData *dat, HANDLE hContact, HANDLE hDbEvent, struct LogStreamData *streamData) +static char *CreateRTFFromDbEvent(SrmmWindowData *dat, HANDLE hContact, HANDLE hDbEvent, struct LogStreamData *streamData) { char *buffer; int bufferAlloced, bufferEnd; @@ -511,7 +511,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) { EDITSTREAM stream = {0}; struct LogStreamData streamData = {0}; - struct SrmmWindowData *dat = (struct SrmmWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + SrmmWindowData *dat = (SrmmWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); CHARRANGE oldSel, sel; POINT scrollPos; BOOL bottomScroll = TRUE; diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 97de54f461..abf9b88cf9 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -81,7 +81,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) char *szProto = GetContactProto((HANDLE)wParam); if (szProto && (g_dat.openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0)))) { - struct NewMessageWindowLParam newData = { 0 }; + NewMessageWindowLParam newData = { 0 }; newData.hContact = (HANDLE) wParam; newData.noActivate = db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS); CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), NULL, DlgProcMessage, (LPARAM) & newData); @@ -133,7 +133,7 @@ INT_PTR SendMessageCmd(HANDLE hContact, char* msg, int isWchar) } else { - struct NewMessageWindowLParam newData = { 0 }; + NewMessageWindowLParam newData = { 0 }; newData.hContact = hContact; newData.szInitialText = msg; newData.isWchar = isWchar; @@ -355,6 +355,20 @@ static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam) return 0; } +static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) +{ + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + if (hwnd == NULL) + return 1; + + SrmmWindowData *dat = (SrmmWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); + if (dat == NULL) + return 1; + + SendMessage(dat->hwndStatus, SB_SETTEXT, 0, lParam); + return 0; +} + static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) { MessageWindowInputData *mwid = (MessageWindowInputData*)wParam; @@ -405,6 +419,7 @@ int LoadSendRecvMessageModule(void) CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI); CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass); CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData); + CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText); CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand); hHookWinEvt = CreateHookableEvent(ME_MSG_WINDOWEVENT); diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 1c472835a8..d459efa56f 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -116,7 +116,7 @@ struct CREOleCallback : public IRichEditOleCallback INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); int DbEventIsForMsgWindow(DBEVENTINFO *dbei); -int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat); +int DbEventIsShown(DBEVENTINFO * dbei, SrmmWindowData *dat); void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend); HANDLE SendMessageDirect(const TCHAR *szMsg, HANDLE hContact, char *szProto); -- cgit v1.2.3