diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-04 07:23:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-04 07:23:42 +0000 |
commit | 66cb770a982a2502456d10d73838df2b7239fd89 (patch) | |
tree | fc419dde94a9be3ebe8f2266ff46feb90d2bcbec /plugins/Scriver | |
parent | bc256df33a57e585367edffe33d3e58d53f82ce8 (diff) |
new subclassing functions applied to all plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@3880 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver')
-rw-r--r-- | plugins/Scriver/src/chat/window.cpp | 1320 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 133 | ||||
-rw-r--r-- | plugins/Scriver/src/msgwindow.cpp | 13 | ||||
-rw-r--r-- | plugins/Scriver/src/richutil.cpp | 146 | ||||
-rw-r--r-- | plugins/Scriver/src/richutil.h | 1 |
5 files changed, 778 insertions, 835 deletions
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index ccc59410b8..540b429781 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -28,20 +28,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define WM_UNICHAR 0x0109
#endif
-extern HBRUSH hListBkgBrush;
-extern HBRUSH hListSelectedBkgBrush;
-extern HANDLE hSendEvent;
-extern CREOleCallback reOleCallback;
-extern HMENU g_hMenu;
-extern TABLIST * g_TabList;
-extern HANDLE hHookWinPopup;
-extern HCURSOR hCurSplitNS, hCurSplitWE;
+extern HBRUSH hListBkgBrush;
+extern HBRUSH hListSelectedBkgBrush;
+extern HANDLE hSendEvent;
+extern HMENU g_hMenu;
+extern TABLIST *g_TabList;
+extern HANDLE hHookWinPopup;
+extern HCURSOR hCurSplitNS, hCurSplitWE;
-static WNDPROC OldSplitterProc;
-static WNDPROC OldMessageProc;
-static WNDPROC OldNicklistProc;
-static WNDPROC OldFilterButtonProc;
-static WNDPROC OldLogProc;
+extern CREOleCallback reOleCallback;
static ToolbarButton toolbarButtons[] = {
{LPGENT("Bold"), IDC_CHAT_BOLD, 0, 4, 24},
@@ -98,7 +93,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LP PostMessage(GetParent(hwnd),WM_SIZE, 0, 0);
return 0;
}
- return CallWindowProc(OldSplitterProc,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
static void InitButtons(HWND hwndDlg, SESSION_INFO* si)
@@ -581,7 +576,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return 0;
}
- return CallWindowProc(OldMessageProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageSubclassProc, msg, wParam, lParam);
}
static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
@@ -674,7 +669,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L break;
}
- return CallWindowProc(OldFilterButtonProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ButtonSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -795,7 +790,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
}
- return CallWindowProc(OldLogProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ButtonSubclassProc, msg, wParam, lParam);
}
static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESSION_INFO * parentdat)
@@ -1082,7 +1077,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break;
}
- return CallWindowProc(OldNicklistProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, NicklistSubclassProc, msg, wParam, lParam);
}
@@ -1133,13 +1128,13 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_LOG));
RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_LIST));
- OldSplitterProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERX),GWLP_WNDPROC,(LONG_PTR)SplitterSubclassProc);
- OldNicklistProc=(WNDPROC)SetWindowLongPtr(hNickList,GWLP_WNDPROC,(LONG_PTR)NicklistSubclassProc);
- OldLogProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_LOG),GWLP_WNDPROC,(LONG_PTR)LogSubclassProc);
- OldFilterButtonProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_FILTER),GWLP_WNDPROC,(LONG_PTR)ButtonSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_COLOR),GWLP_WNDPROC,(LONG_PTR)ButtonSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR),GWLP_WNDPROC,(LONG_PTR)ButtonSubclassProc);
- OldMessageProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), GWLP_WNDPROC,(LONG_PTR)MessageSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERX), SplitterSubclassProc);
+ mir_subclassWindow( hNickList, NicklistSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_LOG), LogSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_FILTER), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_COLOR), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE), MessageSubclassProc);
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), &minEditInit);
si->windowData.minEditBoxHeight = minEditInit.bottom - minEditInit.top;
@@ -1193,102 +1188,90 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) }
break;
- case GC_SETWNDPROPS:
- {
- LoadGlobalSettings();
- InitButtons(hwndDlg, si);
-
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
-
- { // log
- //int iIndent = 0;
- //PARAFORMAT2 pf2;
- //if (g_Settings.dwIconFlags)
- // iIndent += (14*1440)/g_dat->logPixelSX;
- //if (g_Settings.ShowTime && g_Settings.LogIndentEnabled)
- // iIndent += g_Settings.LogTextIndent*1440/g_dat->logPixelSX;
- //pf2.cbSize = sizeof(pf2);
- //pf2.dwMask = PFM_OFFSET;
- //pf2.dxOffset = iIndent * 1440 / g_dat->logPixelSX;
- //SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ case GC_SETWNDPROPS:
+ {
+ LoadGlobalSettings();
+ InitButtons(hwndDlg, si);
+
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
+ SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
+
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_SETBKGNDCOLOR , 0, g_Settings.crLogBackground);
- }
-
- { //messagebox
- COLORREF crFore;
-
- CHARFORMAT2 cf;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore, FALSE);
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_COLOR|CFM_BOLD|CFM_UNDERLINE|CFM_BACKCOLOR;
- cf.dwEffects = 0;
- cf.crTextColor = crFore;
- cf.crBackColor = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_SETBKGNDCOLOR , 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETFONT, (WPARAM) g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL , (LPARAM)&cf);
- }
- { // nicklist
- int ih;
- int ih2;
- int font;
- int height;
-
- ih = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListFont,FALSE);
- ih2 = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListHeadingsFont,FALSE);
- height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
- font = ih > ih2?ih:ih2;
- // make sure we have space for icon!
- if (DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0))
- font = font > 16 ? font : 16;
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_SETITEMHEIGHT, 0, (LPARAM)height > font ? height : font);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, TRUE);
- }
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
- }
- break;
+ { //messagebox
+ COLORREF crFore;
+
+ CHARFORMAT2 cf;
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore, FALSE);
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_COLOR|CFM_BOLD|CFM_UNDERLINE|CFM_BACKCOLOR;
+ cf.dwEffects = 0;
+ cf.crTextColor = crFore;
+ cf.crBackColor = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_SETBKGNDCOLOR , 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETFONT, (WPARAM) g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL , (LPARAM)&cf);
+ }
+ { // nicklist
+ int ih;
+ int ih2;
+ int font;
+ int height;
+
+ ih = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListFont,FALSE);
+ ih2 = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListHeadingsFont,FALSE);
+ height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
+ font = ih > ih2?ih:ih2;
+ // make sure we have space for icon!
+ if (DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0))
+ font = font > 16 ? font : 16;
+
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_SETITEMHEIGHT, 0, (LPARAM)height > font ? height : font);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, TRUE);
+ }
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
+ }
+ break;
- case DM_UPDATETITLEBAR:
- {
- TitleBarData tbd = {0};
- TCHAR szTemp [100];
- if (g_dat->flags & SMF_STATUSICON) {
- MODULEINFO* mi = MM_FindModule(si->pszModule);
- tbd.hIcon = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
- tbd.hIconBig = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIconBig : mi->hOfflineIconBig;
- }
- else {
- tbd.hIcon = GetCachedIcon("chat_window");
- tbd.hIconBig = g_dat->hIconChatBig;
+ case DM_UPDATETITLEBAR:
+ {
+ TitleBarData tbd = {0};
+ TCHAR szTemp [100];
+ if (g_dat->flags & SMF_STATUSICON) {
+ MODULEINFO* mi = MM_FindModule(si->pszModule);
+ tbd.hIcon = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
+ tbd.hIconBig = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIconBig : mi->hOfflineIconBig;
+ }
+ else {
+ tbd.hIcon = GetCachedIcon("chat_window");
+ tbd.hIconBig = g_dat->hIconChatBig;
+ }
+ tbd.hIconNot = (si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL;
+
+ switch(si->iType) {
+ case GCW_CHATROOM:
+ mir_sntprintf(szTemp, SIZEOF(szTemp),
+ (si->nUsersInNicklist == 1) ? TranslateT("%s: Chat Room (%u user)") : TranslateT("%s: Chat Room (%u users)"),
+ si->ptszName, si->nUsersInNicklist);
+ break;
+ case GCW_PRIVMESS:
+ mir_sntprintf(szTemp, SIZEOF(szTemp),
+ (si->nUsersInNicklist ==1) ? TranslateT("%s: Message Session") : TranslateT("%s: Message Session (%u users)"),
+ si->ptszName, si->nUsersInNicklist);
+ break;
+ case GCW_SERVER:
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s: Server"), si->ptszName);
+ break;
+ }
+ tbd.iFlags = TBDF_TEXT | TBDF_ICON;
+ tbd.pszText = szTemp;
+ SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM) &tbd, (LPARAM) hwndDlg);
+ SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0);
}
- tbd.hIconNot = (si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL;
-
- switch(si->iType) {
- case GCW_CHATROOM:
- mir_sntprintf(szTemp, SIZEOF(szTemp),
- (si->nUsersInNicklist == 1) ? TranslateT("%s: Chat Room (%u user)") : TranslateT("%s: Chat Room (%u users)"),
- si->ptszName, si->nUsersInNicklist);
- break;
- case GCW_PRIVMESS:
- mir_sntprintf(szTemp, SIZEOF(szTemp),
- (si->nUsersInNicklist ==1) ? TranslateT("%s: Message Session") : TranslateT("%s: Message Session (%u users)"),
- si->ptszName, si->nUsersInNicklist);
- break;
- case GCW_SERVER:
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s: Server"), si->ptszName);
- break;
- }
- tbd.iFlags = TBDF_TEXT | TBDF_ICON;
- tbd.pszText = szTemp;
- SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM) &tbd, (LPARAM) hwndDlg);
- SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0);
- }
- break;
+ break;
case DM_UPDATESTATUSBAR:
{
@@ -1314,24 +1297,25 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) sid.flags = 0;
ModifyStatusIcon((WPARAM)si->windowData.hContact, (LPARAM) &sid);
- // SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)si);
}
break;
+
case DM_GETCODEPAGE:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, si->windowData.codePage);
return TRUE;
+
case DM_SETCODEPAGE:
si->windowData.codePage = (int) lParam;
si->pszHeader = Log_CreateRtfHeader(MM_FindModule(si->pszModule), si);
- SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
+ SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
break;
+
case DM_SWITCHINFOBAR:
case DM_SWITCHTOOLBAR:
SendMessage(hwndDlg, WM_SIZE, 0, 0);
break;
- case WM_SIZE:
- {
+ case WM_SIZE:
if (wParam == SIZE_MAXIMIZED)
PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
@@ -1349,215 +1333,208 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) }
MessageDialogResize(hwndDlg, si, dlgWidth, dlgHeight);
-
}
- }
- break;
+ break;
- case GC_REDRAWWINDOW:
- InvalidateRect(hwndDlg, NULL, TRUE);
- break;
+ case GC_REDRAWWINDOW:
+ InvalidateRect(hwndDlg, NULL, TRUE);
+ break;
- case GC_REDRAWLOG:
- si->LastTime = 0;
- if (si->pLog) {
- LOGINFO * pLog = si->pLog;
- if (si->iEventCount > 60) {
- int index = 0;
- while ( index < 59) {
- if (pLog->next == NULL)
- break;
-
- pLog = pLog->next;
- if (si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags&pLog->iType) != 0)
- index++;
- }
- Log_StreamInEvent(hwndDlg, pLog, si, TRUE);
- mir_forkthread(phase2, si);
- }
- else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
- }
- else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER+500, WINDOW_CLEARLOG, 0);
- break;
+ case GC_REDRAWLOG:
+ si->LastTime = 0;
+ if (si->pLog) {
+ LOGINFO * pLog = si->pLog;
+ if (si->iEventCount > 60) {
+ int index = 0;
+ while ( index < 59) {
+ if (pLog->next == NULL)
+ break;
+
+ pLog = pLog->next;
+ if (si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags&pLog->iType) != 0)
+ index++;
+ }
+ Log_StreamInEvent(hwndDlg, pLog, si, TRUE);
+ mir_forkthread(phase2, si);
+ }
+ else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
+ }
+ else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER+500, WINDOW_CLEARLOG, 0);
+ break;
- case GC_REDRAWLOG2:
- si->LastTime = 0;
- if (si->pLog)
- Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
- break;
+ case GC_REDRAWLOG2:
+ si->LastTime = 0;
+ if (si->pLog)
+ Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
+ break;
- case GC_REDRAWLOG3:
- si->LastTime = 0;
- if (si->pLog)
- Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
- break;
+ case GC_REDRAWLOG3:
+ si->LastTime = 0;
+ if (si->pLog)
+ Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
+ break;
- case GC_ADDLOG:
- if (si->pLogEnd)
- Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE);
- else
- SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER+500, WINDOW_CLEARLOG, 0);
- break;
+ case GC_ADDLOG:
+ if (si->pLogEnd)
+ Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE);
+ else
+ SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER+500, WINDOW_CLEARLOG, 0);
+ break;
- case DM_UPDATETABCONTROL:
- {
- TabControlData tcd;
- tcd.iFlags = TCDF_TEXT;
- tcd.pszText = si->ptszName;
- SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg);
+ case DM_UPDATETABCONTROL:
+ {
+ TabControlData tcd;
+ tcd.iFlags = TCDF_TEXT;
+ tcd.pszText = si->ptszName;
+ SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg);
- }
- case GC_FIXTABICONS:
- {
- TabControlData tcd;
- HICON hIcon;
- if (!(si->wState & GC_EVENT_HIGHLIGHT))
- {
- if (si->wState & STATE_TALK)
- hIcon = (si->wStatus==ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineTalkIcon : MM_FindModule(si->pszModule)->hOfflineTalkIcon;
- else
- hIcon = (si->wStatus==ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineIcon : MM_FindModule(si->pszModule)->hOfflineIcon;
- } else {
- hIcon = g_dat->hMsgIcon;
- }
- tcd.iFlags = TCDF_ICON;
- tcd.hIcon = hIcon;
- SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg);
- }
- break;
+ }
+ case GC_FIXTABICONS:
+ {
+ TabControlData tcd;
+ HICON hIcon;
+ if (!(si->wState & GC_EVENT_HIGHLIGHT))
+ {
+ if (si->wState & STATE_TALK)
+ hIcon = (si->wStatus==ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineTalkIcon : MM_FindModule(si->pszModule)->hOfflineTalkIcon;
+ else
+ hIcon = (si->wStatus==ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineIcon : MM_FindModule(si->pszModule)->hOfflineIcon;
+ } else {
+ hIcon = g_dat->hMsgIcon;
+ }
+ tcd.iFlags = TCDF_ICON;
+ tcd.hIcon = hIcon;
+ SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg);
+ }
+ break;
- case GC_SETMESSAGEHIGHLIGHT:
- {
- si->wState |= GC_EVENT_HIGHLIGHT;
- SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- if (DBGetContactSettingByte(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != GetParent(hwndDlg))
- SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
- }
- break;
+ case GC_SETMESSAGEHIGHLIGHT:
+ {
+ si->wState |= GC_EVENT_HIGHLIGHT;
+ SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
+ if (DBGetContactSettingByte(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != GetParent(hwndDlg))
+ SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
+ }
+ break;
- case GC_SETTABHIGHLIGHT:
- {
- SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- if (g_Settings.FlashWindow && GetActiveWindow() != GetParent(hwndDlg) && GetForegroundWindow() != GetParent(hwndDlg))
- SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
- }
- break;
+ case GC_SETTABHIGHLIGHT:
+ {
+ SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
+ if (g_Settings.FlashWindow && GetActiveWindow() != GetParent(hwndDlg) && GetForegroundWindow() != GetParent(hwndDlg))
+ SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
+ }
+ break;
- case DM_ACTIVATE:
- {
- if (si->wState & STATE_TALK) {
- si->wState &= ~STATE_TALK;
+ case DM_ACTIVATE:
+ {
+ if (si->wState & STATE_TALK) {
+ si->wState &= ~STATE_TALK;
- DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
- }
+ DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
+ }
- if (si->wState & GC_EVENT_HIGHLIGHT) {
- si->wState &= ~GC_EVENT_HIGHLIGHT;
+ if (si->wState & GC_EVENT_HIGHLIGHT) {
+ si->wState &= ~GC_EVENT_HIGHLIGHT;
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
- }
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
+ }
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
- if (!si->hWnd) {
- ShowRoom(si, (WPARAM)WINDOW_VISIBLE, TRUE);
- SendMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0 );
- } }
- break;
+ SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
+ if (!si->hWnd) {
+ ShowRoom(si, (WPARAM)WINDOW_VISIBLE, TRUE);
+ SendMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0 );
+ }
+ }
+ break;
+ case GC_ACKMESSAGE:
+ SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,EM_SETREADONLY,FALSE,0);
+ SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,WM_SETTEXT,0, (LPARAM)_T(""));
+ return TRUE;
+ case WM_CTLCOLORLISTBOX:
+ SetBkColor((HDC) wParam, g_Settings.crUserListBGColor);
+ return (INT_PTR) hListBkgBrush;
- case GC_ACKMESSAGE:
- SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,EM_SETREADONLY,FALSE,0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,WM_SETTEXT,0, (LPARAM)_T(""));
- return TRUE;
+ case WM_MEASUREITEM:
+ if (!MeasureMenuItem(wParam, lParam)) {
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
- case WM_CTLCOLORLISTBOX:
- SetBkColor((HDC) wParam, g_Settings.crUserListBGColor);
- return (INT_PTR) hListBkgBrush;
-
- case WM_MEASUREITEM:
- if (!MeasureMenuItem(wParam, lParam)) {
- MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
-
- if (mis->CtlType == ODT_MENU)
- {
- return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
- } else
- {
- int ih = GetTextPixelSize( _T("AQGgl'"), g_Settings.UserListFont,FALSE);
- int ih2 = GetTextPixelSize( _T("AQGg'"), g_Settings.UserListHeadingsFont,FALSE);
- int font = ih > ih2?ih:ih2;
- int height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
- // make sure we have space for icon!
- if (DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0))
- font = font > 16 ? font : 16;
- mis->itemHeight = height > font?height:font;
- }
-
- return TRUE;
- }
+ if (mis->CtlType == ODT_MENU)
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+
+ int ih = GetTextPixelSize( _T("AQGgl'"), g_Settings.UserListFont,FALSE);
+ int ih2 = GetTextPixelSize( _T("AQGg'"), g_Settings.UserListHeadingsFont,FALSE);
+ int font = ih > ih2?ih:ih2;
+ int height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
+ // make sure we have space for icon!
+ if (DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0))
+ font = font > 16 ? font : 16;
+ mis->itemHeight = height > font?height:font;
+ return TRUE;
+ }
- case WM_DRAWITEM:
- if (!DrawMenuItem(wParam, lParam)) {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
- if (dis->CtlType == ODT_MENU) {
- return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- } else
- if (dis->CtlID == IDC_CHAT_LIST) {
- HFONT hFont, hOldFont;
- HICON hIcon;
- int offset;
- int height;
- int index = dis->itemID;
- USERINFO * ui = SM_GetUserFromIndex(si->ptszID, si->pszModule, index);
- if (ui) {
- int x_offset = 2;
-
- height = dis->rcItem.bottom - dis->rcItem.top;
-
- if (height&1)
- height++;
- if (height == 10)
- offset = 0;
- else
- offset = height/2 - 5;
- hIcon = SM_GetStatusIcon(si, ui);
- hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
- hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
- SetBkMode(dis->hDC, TRANSPARENT);
-
- if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
- FillRect(dis->hDC, &dis->rcItem, hListSelectedBkgBrush);
- else //if (dis->itemState & ODS_INACTIVE)
- FillRect(dis->hDC, &dis->rcItem, hListBkgBrush);
-
- if (g_Settings.ShowContactStatus && g_Settings.ContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top+offset-3,hIcon,16,16,0,NULL, DI_NORMAL);
- Skin_ReleaseIcon(hIcon);
- x_offset += 18;
- }
- DrawIconEx(dis->hDC,x_offset, dis->rcItem.top + offset,hIcon,10,10,0,NULL, DI_NORMAL);
- x_offset += 12;
- if (g_Settings.ShowContactStatus && !g_Settings.ContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top+offset-3,hIcon,16,16,0,NULL, DI_NORMAL);
- Skin_ReleaseIcon(hIcon);
- x_offset += 18;
- }
+ case WM_DRAWITEM:
+ if (!DrawMenuItem(wParam, lParam)) {
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
+ if (dis->CtlType == ODT_MENU)
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+
+ if (dis->CtlID == IDC_CHAT_LIST) {
+ HFONT hFont, hOldFont;
+ HICON hIcon;
+ int offset;
+ int height;
+ int index = dis->itemID;
+ USERINFO * ui = SM_GetUserFromIndex(si->ptszID, si->pszModule, index);
+ if (ui) {
+ int x_offset = 2;
+
+ height = dis->rcItem.bottom - dis->rcItem.top;
+
+ if (height&1)
+ height++;
+ if (height == 10)
+ offset = 0;
+ else
+ offset = height/2 - 5;
+ hIcon = SM_GetStatusIcon(si, ui);
+ hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
+ hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
+ SetBkMode(dis->hDC, TRANSPARENT);
+
+ if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
+ FillRect(dis->hDC, &dis->rcItem, hListSelectedBkgBrush);
+ else //if (dis->itemState & ODS_INACTIVE)
+ FillRect(dis->hDC, &dis->rcItem, hListBkgBrush);
+
+ if (g_Settings.ShowContactStatus && g_Settings.ContactStatusFirst && ui->ContactStatus) {
+ HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top+offset-3,hIcon,16,16,0,NULL, DI_NORMAL);
+ Skin_ReleaseIcon(hIcon);
+ x_offset += 18;
+ }
+ DrawIconEx(dis->hDC,x_offset, dis->rcItem.top + offset,hIcon,10,10,0,NULL, DI_NORMAL);
+ x_offset += 12;
+ if (g_Settings.ShowContactStatus && !g_Settings.ContactStatusFirst && ui->ContactStatus) {
+ HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top+offset-3,hIcon,16,16,0,NULL, DI_NORMAL);
+ Skin_ReleaseIcon(hIcon);
+ x_offset += 18;
+ }
- SetTextColor(dis->hDC, ui->iStatusEx == 0?g_Settings.crUserListColor:g_Settings.crUserListHeadingsColor);
- TextOut(dis->hDC, dis->rcItem.left+x_offset, dis->rcItem.top, ui->pszNick, lstrlen(ui->pszNick));
- SelectObject(dis->hDC, hOldFont);
- }
- return TRUE;
- } }
+ SetTextColor(dis->hDC, ui->iStatusEx == 0?g_Settings.crUserListColor:g_Settings.crUserListHeadingsColor);
+ TextOut(dis->hDC, dis->rcItem.left+x_offset, dis->rcItem.top, ui->pszNick, lstrlen(ui->pszNick));
+ SelectObject(dis->hDC, hOldFont);
+ }
+ return TRUE;
+ } }
- case GC_UPDATENICKLIST:
+ case GC_UPDATENICKLIST:
{
int index=0;
SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, WM_SETREDRAW, FALSE, 0);
@@ -1582,60 +1559,60 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) }
break;
- case GC_EVENT_CONTROL + WM_USER+500:
- {
- switch(wParam) {
- case SESSION_OFFLINE:
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
- return TRUE;
+ case GC_EVENT_CONTROL + WM_USER+500:
+ {
+ switch(wParam) {
+ case SESSION_OFFLINE:
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
+ return TRUE;
- case SESSION_ONLINE:
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- return TRUE;
+ case SESSION_ONLINE:
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ return TRUE;
- case WINDOW_HIDDEN:
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
+ case WINDOW_HIDDEN:
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
+ return TRUE;
- case WINDOW_CLEARLOG:
- SetDlgItemText(hwndDlg, IDC_CHAT_LOG, _T(""));
- return TRUE;
+ case WINDOW_CLEARLOG:
+ SetDlgItemText(hwndDlg, IDC_CHAT_LOG, _T(""));
+ return TRUE;
- case SESSION_TERMINATE:
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
- si->wState &= ~STATE_TALK;
- DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
+ case SESSION_TERMINATE:
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
+ si->wState &= ~STATE_TALK;
+ DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
+ return TRUE;
- case WINDOW_MINIMIZE:
- ShowWindow(hwndDlg, SW_MINIMIZE);
- goto LABEL_SHOWWINDOW;
-
- case WINDOW_MAXIMIZE:
- ShowWindow(hwndDlg, SW_MAXIMIZE);
- goto LABEL_SHOWWINDOW;
-
- case SESSION_INITDONE:
- if (DBGetContactSettingByte(NULL, "Chat", "PopupOnJoin", 0)!=0)
- return TRUE;
- // fall through
- case WINDOW_VISIBLE:
- if (IsIconic(hwndDlg))
- ShowWindow(hwndDlg, SW_NORMAL);
+ case WINDOW_MINIMIZE:
+ ShowWindow(hwndDlg, SW_MINIMIZE);
+ goto LABEL_SHOWWINDOW;
+
+ case WINDOW_MAXIMIZE:
+ ShowWindow(hwndDlg, SW_MAXIMIZE);
+ goto LABEL_SHOWWINDOW;
+
+ case SESSION_INITDONE:
+ if (DBGetContactSettingByte(NULL, "Chat", "PopupOnJoin", 0)!=0)
+ return TRUE;
+ // fall through
+ case WINDOW_VISIBLE:
+ if (IsIconic(hwndDlg))
+ ShowWindow(hwndDlg, SW_NORMAL);
LABEL_SHOWWINDOW:
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
- SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- ShowWindow(hwndDlg, SW_SHOW);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SetForegroundWindow(hwndDlg);
- return TRUE;
- } }
- break;
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ ShowWindow(hwndDlg, SW_SHOW);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SetForegroundWindow(hwndDlg);
+ return TRUE;
+ } }
+ break;
case GC_SPLITTERMOVED:
if ((HWND)lParam==GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERX)) {
@@ -1649,12 +1626,12 @@ LABEL_SHOWWINDOW: oldSplitterX=si->iSplitterX;
si->iSplitterX=rc.right-pt.x+1;
if (si->iSplitterX < 35)
- si->iSplitterX=35;
+ si->iSplitterX=35;
if (si->iSplitterX > rc.right-rc.left-35)
- si->iSplitterX = rc.right-rc.left-35;
+ si->iSplitterX = rc.right-rc.left-35;
g_Settings.iSplitterX = si->iSplitterX;
- }
- else if ((HWND)lParam==GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERY)) {
+ }
+ else if ((HWND)lParam==GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERY)) {
POINT pt;
RECT rc;
int oldSplitterY;
@@ -1664,133 +1641,131 @@ LABEL_SHOWWINDOW: oldSplitterY=si->iSplitterY;
si->iSplitterY=rc.bottom-pt.y;
g_Settings.iSplitterY = si->iSplitterY;
- }
+ }
PostMessage(hwndDlg,WM_SIZE,0,0);
break;
- case GC_FIREHOOK:
- if (lParam) {
- GCHOOK* gch = (GCHOOK *) lParam;
- NotifyEventHooks(hSendEvent,0,(WPARAM)gch);
- if ( gch->pDest ) {
- mir_free( gch->pDest->pszID );
- mir_free( gch->pDest->pszModule );
- mir_free( gch->pDest );
- }
- mir_free( gch->ptszText );
- mir_free( gch->ptszUID );
- mir_free( gch );
- }
- break;
+ case GC_FIREHOOK:
+ if (lParam) {
+ GCHOOK* gch = (GCHOOK *) lParam;
+ NotifyEventHooks(hSendEvent,0,(WPARAM)gch);
+ if ( gch->pDest ) {
+ mir_free( gch->pDest->pszID );
+ mir_free( gch->pDest->pszModule );
+ mir_free( gch->pDest );
+ }
+ mir_free( gch->ptszText );
+ mir_free( gch->ptszUID );
+ mir_free( gch );
+ }
+ break;
- case GC_CHANGEFILTERFLAG:
- si->iLogFilterFlags = lParam;
- break;
+ case GC_CHANGEFILTERFLAG:
+ si->iLogFilterFlags = lParam;
+ break;
- case GC_SHOWFILTERMENU:
- {
- RECT rc;
- HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), hwndDlg, FilterWndProc, (LPARAM)si);
+ case GC_SHOWFILTERMENU:
+ {
+ RECT rc;
+ HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), hwndDlg, FilterWndProc, (LPARAM)si);
TranslateDialogDefault(hwnd);
- GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_FILTER), &rc);
- SetWindowPos(hwnd, HWND_TOP, rc.left-85, (IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_FILTER))||IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_BOLD)))?rc.top-206:rc.top-186, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);
- }
- break;
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_FILTER), &rc);
+ SetWindowPos(hwnd, HWND_TOP, rc.left-85, (IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_FILTER))||IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_BOLD)))?rc.top-206:rc.top-186, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);
+ }
+ break;
- case GC_SHOWCOLORCHOOSER:
- {
- HWND ColorWindow;
- RECT rc;
- BOOL bFG = lParam == IDC_CHAT_COLOR?TRUE:FALSE;
- COLORCHOOSER * pCC = (COLORCHOOSER *)mir_alloc(sizeof(COLORCHOOSER));
-
- GetWindowRect(GetDlgItem(hwndDlg, bFG?IDC_CHAT_COLOR:IDC_CHAT_BKGCOLOR), &rc);
- pCC->hWndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
- pCC->pModule = MM_FindModule(si->pszModule);
- pCC->xPosition = rc.left+3;
- pCC->yPosition = IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_COLOR))?rc.top-1:rc.top+20;
- pCC->bForeground = bFG;
- pCC->si = si;
-
- ColorWindow= CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM) pCC);
- }
- break;
+ case GC_SHOWCOLORCHOOSER:
+ {
+ HWND ColorWindow;
+ RECT rc;
+ BOOL bFG = lParam == IDC_CHAT_COLOR?TRUE:FALSE;
+ COLORCHOOSER * pCC = (COLORCHOOSER *)mir_alloc(sizeof(COLORCHOOSER));
+
+ GetWindowRect(GetDlgItem(hwndDlg, bFG?IDC_CHAT_COLOR:IDC_CHAT_BKGCOLOR), &rc);
+ pCC->hWndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
+ pCC->pModule = MM_FindModule(si->pszModule);
+ pCC->xPosition = rc.left+3;
+ pCC->yPosition = IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_COLOR))?rc.top-1:rc.top+20;
+ pCC->bForeground = bFG;
+ pCC->si = si;
+
+ ColorWindow= CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM) pCC);
+ }
+ break;
- case GC_SCROLLTOBOTTOM:
- {
- SCROLLINFO si = { 0 };
- if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_LOG), GWL_STYLE) & WS_VSCROLL) != 0){
- CHARRANGE sel;
- si.cbSize = sizeof(si);
- si.fMask = SIF_PAGE | SIF_RANGE;
- GetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &si);
- si.fMask = SIF_POS;
- si.nPos = si.nMax - si.nPage + 1;
- SetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &si, TRUE);
- sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOG), CP_ACP, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXSETSEL, 0, (LPARAM) & sel);
- PostMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
- } }
- break;
+ case GC_SCROLLTOBOTTOM:
+ {
+ SCROLLINFO si = { 0 };
+ if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_LOG), GWL_STYLE) & WS_VSCROLL) != 0){
+ CHARRANGE sel;
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_PAGE | SIF_RANGE;
+ GetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &si);
+ si.fMask = SIF_POS;
+ si.nPos = si.nMax - si.nPage + 1;
+ SetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &si, TRUE);
+ sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOG), CP_ACP, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXSETSEL, 0, (LPARAM) & sel);
+ PostMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
+ } }
+ break;
- case WM_ACTIVATE:
- if (LOWORD(wParam) != WA_ACTIVE)
- break;
+ case WM_ACTIVATE:
+ if (LOWORD(wParam) != WA_ACTIVE)
+ break;
- //fall through
- case WM_MOUSEACTIVATE:
- {
- if (uMsg != WM_ACTIVATE)
- SetFocus(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE));
+ //fall through
+ case WM_MOUSEACTIVATE:
+ {
+ if (uMsg != WM_ACTIVATE)
+ SetFocus(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE));
- SetActiveSession(si->ptszID, si->pszModule);
+ SetActiveSession(si->ptszID, si->pszModule);
- if (DBGetContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode", 0) != 0)
- DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
- }
- break;
+ if (DBGetContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode", 0) != 0)
+ DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
+ }
+ break;
- case WM_NOTIFY:
- {
- LPNMHDR pNmhdr;
-
- pNmhdr = (LPNMHDR)lParam;
- switch (pNmhdr->code) {
- case EN_REQUESTRESIZE:
- if (pNmhdr->idFrom == IDC_CHAT_MESSAGE) {
- REQRESIZE *rr = (REQRESIZE *)lParam;
- int height = rr->rc.bottom - rr->rc.top + 1;
- if (height < g_dat->minInputAreaHeight) {
- height = g_dat->minInputAreaHeight;
+ case WM_NOTIFY:
+ {
+ LPNMHDR pNmhdr = (LPNMHDR)lParam;
+ switch (pNmhdr->code) {
+ case EN_REQUESTRESIZE:
+ if (pNmhdr->idFrom == IDC_CHAT_MESSAGE) {
+ REQRESIZE *rr = (REQRESIZE *)lParam;
+ int height = rr->rc.bottom - rr->rc.top + 1;
+ if (height < g_dat->minInputAreaHeight) {
+ height = g_dat->minInputAreaHeight;
+ }
+ if (si->desiredInputAreaHeight != height) {
+ si->desiredInputAreaHeight = height;
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
+ }
}
- if (si->desiredInputAreaHeight != height) {
- si->desiredInputAreaHeight = height;
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
+ break;
+ case EN_MSGFILTER:
+ if (pNmhdr->idFrom == IDC_CHAT_LOG && ((MSGFILTER *) lParam)->msg == WM_RBUTTONUP){
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ return TRUE;
}
- }
- break;
- case EN_MSGFILTER:
- if (pNmhdr->idFrom == IDC_CHAT_LOG && ((MSGFILTER *) lParam)->msg == WM_RBUTTONUP){
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- break;
- case EN_LINK:
- if (pNmhdr->idFrom == IDC_CHAT_LOG) {
- switch (((ENLINK *) lParam)->msg) {
- case WM_RBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_LBUTTONDBLCLK:
- if (HandleLinkClick(g_hInst, hwndDlg, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE),(ENLINK*)lParam)) {
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- break;
- } }
- break;
+ break;
+ case EN_LINK:
+ if (pNmhdr->idFrom == IDC_CHAT_LOG) {
+ switch (((ENLINK *) lParam)->msg) {
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONUP:
+ case WM_LBUTTONDBLCLK:
+ if (HandleLinkClick(g_hInst, hwndDlg, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE),(ENLINK*)lParam)) {
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+ break;
+ } }
+ break;
case TTN_NEEDTEXT:
if (pNmhdr->idFrom == (UINT_PTR)GetDlgItem(hwndDlg,IDC_CHAT_LIST))
{
@@ -1811,9 +1786,9 @@ LABEL_SHOWWINDOW: TranslateT( "Unique id" ), ui->pszUID,
TranslateT( "Status" ), TM_WordToString( parentdat->pStatuses, ui->Status ));
lpttd->lpszText = ptszBuf;
- } }
+ } }
break;
- } }
+ } }
break;
case WM_COMMAND:
@@ -1855,241 +1830,241 @@ LABEL_SHOWWINDOW: RedrawWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, NULL, RDW_INVALIDATE);
break;
- case IDOK:
- {
- char* pszRtf;
- TCHAR* ptszText, *p1;
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDOK)))
- break;
+ case IDOK:
+ {
+ char* pszRtf;
+ TCHAR* ptszText, *p1;
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDOK)))
+ break;
- pszRtf = GetRichTextRTF(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- {
- TCmdList *cmdListNew = tcmdlist_last(si->windowData.cmdList);
- while (cmdListNew != NULL && cmdListNew->temporary) {
- si->windowData.cmdList = tcmdlist_remove(si->windowData.cmdList, cmdListNew);
- cmdListNew = tcmdlist_last(si->windowData.cmdList);
+ pszRtf = GetRichTextRTF(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ {
+ TCmdList *cmdListNew = tcmdlist_last(si->windowData.cmdList);
+ while (cmdListNew != NULL && cmdListNew->temporary) {
+ si->windowData.cmdList = tcmdlist_remove(si->windowData.cmdList, cmdListNew);
+ cmdListNew = tcmdlist_last(si->windowData.cmdList);
+ }
+ }
+ si->windowData.cmdList = tcmdlist_append(si->windowData.cmdList, pszRtf, 20, FALSE);
+ ptszText = DoRtfToTags(pszRtf, si);
+ p1 = _tcschr(ptszText, '\0');
+
+ //remove trailing linebreaks
+ while ( p1 > ptszText && (*p1 == '\0' || *p1 == '\r' || *p1 == '\n')) {
+ *p1 = '\0';
+ p1--;
}
- }
- si->windowData.cmdList = tcmdlist_append(si->windowData.cmdList, pszRtf, 20, FALSE);
- ptszText = DoRtfToTags(pszRtf, si);
- p1 = _tcschr(ptszText, '\0');
-
- //remove trailing linebreaks
- while ( p1 > ptszText && (*p1 == '\0' || *p1 == '\r' || *p1 == '\n')) {
- *p1 = '\0';
- p1--;
- }
- if ( MM_FindModule(si->pszModule)->bAckMsg ) {
- EnableWindow(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE),FALSE);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,EM_SETREADONLY,TRUE,0);
- }
- else SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,WM_SETTEXT,0,(LPARAM)_T(""));
+ if ( MM_FindModule(si->pszModule)->bAckMsg ) {
+ EnableWindow(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE),FALSE);
+ SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,EM_SETREADONLY,TRUE,0);
+ }
+ else SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,WM_SETTEXT,0,(LPARAM)_T(""));
- EnableWindow(GetDlgItem(hwndDlg,IDOK),FALSE);
+ EnableWindow(GetDlgItem(hwndDlg,IDOK),FALSE);
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0);
- mir_free(pszRtf);
- mir_free(ptszText);
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- }
- break;
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0);
+ mir_free(pszRtf);
+ mir_free(ptszText);
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ }
+ break;
- case IDC_CHAT_SHOWNICKLIST:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_SHOWNICKLIST)))
- break;
- if (si->iType == GCW_SERVER)
- break;
+ case IDC_CHAT_SHOWNICKLIST:
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_SHOWNICKLIST)))
+ break;
+ if (si->iType == GCW_SERVER)
+ break;
- si->bNicklistEnabled = !si->bNicklistEnabled;
+ si->bNicklistEnabled = !si->bNicklistEnabled;
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SHOWNICKLIST,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bNicklistEnabled?"chat_nicklist":"chat_nicklist2"));
- SendMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- break;
+ SendDlgItemMessage(hwndDlg,IDC_CHAT_SHOWNICKLIST,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bNicklistEnabled?"chat_nicklist":"chat_nicklist2"));
+ SendMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ break;
- case IDC_CHAT_MESSAGE:
- if (HIWORD(wParam) == EN_CHANGE) {
- si->windowData.cmdListCurrent = NULL;
- EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), si->windowData.codePage, FALSE) != 0);
- }
- break;
+ case IDC_CHAT_MESSAGE:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ si->windowData.cmdListCurrent = NULL;
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), si->windowData.codePage, FALSE) != 0);
+ }
+ break;
- case IDC_CHAT_SMILEY:
- {
- SMADD_SHOWSEL3 smaddInfo;
- RECT rc;
-
- GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_SMILEY), &rc);
-
- smaddInfo.cbSize = sizeof(SMADD_SHOWSEL3);
- smaddInfo.hwndParent = GetParent(hwndDlg);
- smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
- smaddInfo.targetMessage = EM_REPLACESEL;
- smaddInfo.targetWParam = TRUE;
- smaddInfo.Protocolname = si->pszModule;
- //smaddInfo.Direction = 3;
- smaddInfo.Direction = 0;
- smaddInfo.xPosition = rc.left;
- smaddInfo.yPosition = rc.bottom;
- smaddInfo.hContact = si->windowData.hContact;
- CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo);
- }
- break;
+ case IDC_CHAT_SMILEY:
+ {
+ SMADD_SHOWSEL3 smaddInfo;
+ RECT rc;
+
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_SMILEY), &rc);
+
+ smaddInfo.cbSize = sizeof(SMADD_SHOWSEL3);
+ smaddInfo.hwndParent = GetParent(hwndDlg);
+ smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
+ smaddInfo.targetMessage = EM_REPLACESEL;
+ smaddInfo.targetWParam = TRUE;
+ smaddInfo.Protocolname = si->pszModule;
+ //smaddInfo.Direction = 3;
+ smaddInfo.Direction = 0;
+ smaddInfo.xPosition = rc.left;
+ smaddInfo.yPosition = rc.bottom;
+ smaddInfo.hContact = si->windowData.hContact;
+ CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo);
+ }
+ break;
- case IDC_CHAT_HISTORY:
- {
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ case IDC_CHAT_HISTORY:
+ {
+ MODULEINFO * pInfo = MM_FindModule(si->pszModule);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_HISTORY)))
- break;
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_HISTORY)))
+ break;
- if ( pInfo )
- ShellExecute(hwndDlg, NULL, GetChatLogsFilename(si->windowData.hContact, 0), NULL, NULL, SW_SHOW);
- }
- break;
+ if ( pInfo )
+ ShellExecute(hwndDlg, NULL, GetChatLogsFilename(si->windowData.hContact, 0), NULL, NULL, SW_SHOW);
+ }
+ break;
- case IDC_CHAT_CHANMGR:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_CHANMGR)))
- break;
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
- break;
+ case IDC_CHAT_CHANMGR:
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_CHANMGR)))
+ break;
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
+ break;
- case IDC_CHAT_FILTER:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_FILTER)))
- break;
+ case IDC_CHAT_FILTER:
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_FILTER)))
+ break;
- si->bFilterEnabled = !si->bFilterEnabled;
- SendDlgItemMessage(hwndDlg,IDC_CHAT_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bFilterEnabled?"chat_filter":"chat_filter2"));
- if (si->bFilterEnabled && DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0) {
- SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0);
- break;
- }
- SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
- break;
+ si->bFilterEnabled = !si->bFilterEnabled;
+ SendDlgItemMessage(hwndDlg,IDC_CHAT_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bFilterEnabled?"chat_filter":"chat_filter2"));
+ if (si->bFilterEnabled && DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0) {
+ SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0);
+ break;
+ }
+ SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
+ break;
- case IDC_CHAT_BKGCOLOR:
- {
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
- CHARFORMAT2 cf;
+ case IDC_CHAT_BKGCOLOR:
+ {
+ MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwEffects = 0;
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR)))
- break;
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR)))
+ break;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BKGCOLOR)) {
- if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
- SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_BKGCOLOR);
- else if (si->bBGSet){
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BKGCOLOR)) {
+ if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
+ SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_BKGCOLOR);
+ else if (si->bBGSet){
+ cf.dwMask = CFM_BACKCOLOR;
+ cf.crBackColor = pInfo->crColors[si->iBG];
+ if (pInfo->bSingleFormat) {
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
+ } else {
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ }
+ } }
+ else {
cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = pInfo->crColors[si->iBG];
+ cf.crBackColor = (COLORREF)DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
if (pInfo->bSingleFormat) {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
} else {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
- } }
- else {
- cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = (COLORREF)DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
- if (pInfo->bSingleFormat) {
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- } else {
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- } }
- break;
+ } }
+ break;
- case IDC_CHAT_COLOR:
- {
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
+ case IDC_CHAT_COLOR:
+ {
+ MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwEffects = 0;
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_COLOR)))
- break;
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_COLOR)))
+ break;
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_COLOR)) {
+ if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
+ SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_COLOR);
+ else if (si->bFGSet) {
+ cf.dwMask = CFM_COLOR;
+ cf.crTextColor = pInfo->crColors[si->iFG];
+ if (pInfo->bSingleFormat) {
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
+ } else {
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ }
+ } }
+ else {
+ COLORREF cr;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_COLOR)) {
- if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
- SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_COLOR);
- else if (si->bFGSet) {
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr, FALSE);
cf.dwMask = CFM_COLOR;
- cf.crTextColor = pInfo->crColors[si->iFG];
+ cf.crTextColor = cr;
if (pInfo->bSingleFormat) {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
} else {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
- } }
- else {
- COLORREF cr;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr, FALSE);
- cf.dwMask = CFM_COLOR;
- cf.crTextColor = cr;
+ } }
+ break;
+
+ case IDC_CHAT_BOLD:
+ case IDC_CHAT_ITALICS:
+ case IDC_CHAT_UNDERLINE:
+
+ {
+ MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE;
+ cf.dwEffects = 0;
+
+ if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_BOLD)))
+ break;
+ if (LOWORD(wParam) == IDC_CHAT_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_ITALICS)))
+ break;
+ if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_UNDERLINE)))
+ break;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BOLD))
+ cf.dwEffects |= CFE_BOLD;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_ITALICS))
+ cf.dwEffects |= CFE_ITALIC;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_UNDERLINE))
+ cf.dwEffects |= CFE_UNDERLINE;
if (pInfo->bSingleFormat) {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
} else {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
-
- } }
- break;
-
- case IDC_CHAT_BOLD:
- case IDC_CHAT_ITALICS:
- case IDC_CHAT_UNDERLINE:
-
- {
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE;
- cf.dwEffects = 0;
-
- if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_BOLD)))
- break;
- if (LOWORD(wParam) == IDC_CHAT_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_ITALICS)))
- break;
- if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_UNDERLINE)))
- break;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BOLD))
- cf.dwEffects |= CFE_BOLD;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_ITALICS))
- cf.dwEffects |= CFE_ITALIC;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_UNDERLINE))
- cf.dwEffects |= CFE_UNDERLINE;
- if (pInfo->bSingleFormat) {
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- } else {
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
- }
- break;
+ break;
case IDCANCEL:
PostMessage(hwndDlg, WM_CLOSE, 0, 0);
- }
- break;
+ }
+ break;
- case WM_KEYDOWN:
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- break;
+ case WM_KEYDOWN:
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ break;
- case WM_GETMINMAXINFO:
- {
- MINMAXINFO* mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = si->iSplitterX + 43;
- if (mmi->ptMinTrackSize.x < 350)
- mmi->ptMinTrackSize.x = 350;
+ case WM_GETMINMAXINFO:
+ {
+ MINMAXINFO* mmi = (MINMAXINFO*)lParam;
+ mmi->ptMinTrackSize.x = si->iSplitterX + 43;
+ if (mmi->ptMinTrackSize.x < 350)
+ mmi->ptMinTrackSize.x = 350;
- mmi->ptMinTrackSize.y = si->windowData.minLogBoxHeight + TOOLBAR_HEIGHT + si->windowData.minEditBoxHeight + 5;
- }
- break;
+ mmi->ptMinTrackSize.y = si->windowData.minLogBoxHeight + TOOLBAR_HEIGHT + si->windowData.minEditBoxHeight + 5;
+ }
+ break;
case WM_LBUTTONDBLCLK:
if (LOWORD(lParam) < 30)
@@ -2120,7 +2095,7 @@ LABEL_SHOWWINDOW: mii.dwTypeData = TranslateTS((toolbarButtons[i].name));
InsertMenuItem(hToolbarMenu, i, TRUE, &mii);
}
-// TranslateMenu(hToolbarMenu);
+ // TranslateMenu(hToolbarMenu);
pt.x = (short) LOWORD(GetMessagePos());
pt.y = (short) HIWORD(GetMessagePos());
i = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
@@ -2150,27 +2125,20 @@ LABEL_SHOWWINDOW: }
break;
- case WM_CLOSE:
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- break;
+ case WM_CLOSE:
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
+ break;
- case GC_CLOSEWINDOW:
- DestroyWindow(hwndDlg);
- break;
+ case GC_CLOSEWINDOW:
+ DestroyWindow(hwndDlg);
+ break;
- case WM_DESTROY:
+ case WM_DESTROY:
NotifyLocalWinEvent(si->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING);
si->hWnd = NULL;
SetWindowLongPtr(hwndDlg,GWLP_USERDATA,0);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERY),GWLP_WNDPROC,(LONG_PTR)OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_LIST),GWLP_WNDPROC,(LONG_PTR)OldNicklistProc);
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE),GWLP_WNDPROC,(LONG_PTR)OldMessageProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_LOG),GWLP_WNDPROC,(LONG_PTR)OldLogProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_FILTER),GWLP_WNDPROC,(LONG_PTR)OldFilterButtonProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_COLOR),GWLP_WNDPROC,(LONG_PTR)OldFilterButtonProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR),GWLP_WNDPROC,(LONG_PTR)OldFilterButtonProc);
SendMessage(GetParent(hwndDlg), CM_REMOVECHILD, 0, (LPARAM) hwndDlg);
if (si->windowData.hwndLog != NULL) {
@@ -2183,6 +2151,6 @@ LABEL_SHOWWINDOW: NotifyLocalWinEvent(si->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE);
break;
- }
- return(FALSE);
+ }
+ return(FALSE);
}
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index aea89e4730..391a0ea16b 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -41,7 +41,6 @@ extern CREOleCallback reOleCallback, reOleCallback2; static void UpdateReadChars(HWND hwndDlg, struct SrmmWindowData * dat);
-static WNDPROC OldMessageEditProc, OldLogEditProc;
static ToolbarButton toolbarButtons[] = {
{LPGENT("Quote"), IDC_QUOTE, 0, 4, 24},
{LPGENT("Smiley"), IDC_SMILEYS, 0, 10, 24},
@@ -173,26 +172,26 @@ static BOOL IsUtfSendAvailable(HANDLE hContact) int RTL_Detect(WCHAR *pszwText)
{
- WORD *infoTypeC2;
- int i;
- int iLen = lstrlenW(pszwText);
+ WORD *infoTypeC2;
+ int i;
+ int iLen = lstrlenW(pszwText);
- infoTypeC2 = (WORD *)mir_alloc(sizeof(WORD) * (iLen + 2));
+ infoTypeC2 = (WORD *)mir_alloc(sizeof(WORD) * (iLen + 2));
- if (infoTypeC2) {
- ZeroMemory(infoTypeC2, sizeof(WORD) * (iLen + 2));
+ if (infoTypeC2) {
+ ZeroMemory(infoTypeC2, sizeof(WORD) * (iLen + 2));
- GetStringTypeW(CT_CTYPE2, pszwText, iLen, infoTypeC2);
+ GetStringTypeW(CT_CTYPE2, pszwText, iLen, infoTypeC2);
- for(i = 0; i < iLen; i++) {
- if (infoTypeC2[i] == C2_RIGHTTOLEFT) {
- mir_free(infoTypeC2);
- return 1;
- }
- }
- mir_free(infoTypeC2);
- }
- return 0;
+ for(i = 0; i < iLen; i++) {
+ if (infoTypeC2[i] == C2_RIGHTTOLEFT) {
+ mir_free(infoTypeC2);
+ return 1;
+ }
+ }
+ mir_free(infoTypeC2);
+ }
+ return 0;
}
static void AddToFileList(TCHAR ***pppFiles,int *totalCount,const TCHAR* szFilename)
@@ -215,7 +214,7 @@ static void AddToFileList(TCHAR ***pppFiles,int *totalCount,const TCHAR* szFilen lstrcat(szPath,fd.cFileName);
AddToFileList(pppFiles,totalCount,szPath);
}
- while( FindNextFile( hFind,&fd ));
+ while( FindNextFile( hFind,&fd ));
FindClose( hFind );
} } }
@@ -225,28 +224,27 @@ static void SetDialogToType(HWND hwndDlg) struct SrmmWindowData *dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
ParentWindowData *pdat = dat->parent;
- if (pdat->flags2 & SMF2_SHOWINFOBAR) {
+ if (pdat->flags2 & SMF2_SHOWINFOBAR)
ShowWindow(dat->infobarData->hWnd, SW_SHOW);
- } else {
+ else
ShowWindow(dat->infobarData->hWnd, SW_HIDE);
- }
+
if (dat->windowData.hContact) {
ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat->buttonVisibility, showToolbar ? SW_SHOW : SW_HIDE);
- if (!DBGetContactSettingByte(dat->windowData.hContact, "CList", "NotOnList", 0)) {
+ if (!DBGetContactSettingByte(dat->windowData.hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
- }
- if (!g_dat->smileyAddInstalled) {
+
+ if (!g_dat->smileyAddInstalled)
ShowWindow(GetDlgItem(hwndDlg, IDC_SMILEYS), SW_HIDE);
- }
- } else {
- ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat->buttonVisibility, SW_HIDE);
}
+ else ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat->buttonVisibility, SW_HIDE);
+
ShowWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), SW_SHOW);
- if (dat->windowData.hwndLog != NULL) {
+ if (dat->windowData.hwndLog != NULL)
ShowWindow (GetDlgItem(hwndDlg, IDC_LOG), SW_HIDE);
- } else {
+ else
ShowWindow (GetDlgItem(hwndDlg, IDC_LOG), SW_SHOW);
- }
+
ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SW_SHOW);
UpdateReadChars(hwndDlg, dat);
EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage, FALSE)?TRUE:FALSE);
@@ -254,36 +252,36 @@ static void SetDialogToType(HWND hwndDlg) SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
-
void SetStatusIcon(struct SrmmWindowData *dat) {
- if (dat->szProto != NULL) {
- char *szProto = dat->szProto;
- HANDLE hContact = dat->windowData.hContact;
-
- char* szMetaProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
- if ((INT_PTR)szMetaProto != CALLSERVICE_NOTFOUND && strcmp(dat->szProto, szMetaProto) == 0 &&
- DBGetContactSettingByte(NULL,"CLC","Meta",0) == 0) {
- hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)dat->windowData.hContact, 0);
- if (hContact != NULL)
- szProto = GetContactProto(hContact);
- else
- hContact = dat->windowData.hContact;
- }
+ if (dat->szProto == NULL)
+ return;
- Skin_ReleaseIcon(dat->statusIcon);
- dat->statusIcon = LoadSkinnedProtoIcon(szProto, dat->wStatus);
+ char *szProto = dat->szProto;
+ HANDLE hContact = dat->windowData.hContact;
- Skin_ReleaseIcon(dat->statusIconBig);
- dat->statusIconBig = LoadSkinnedProtoIconBig(szProto, dat->wStatus);
- if ((int)dat->statusIconBig == CALLSERVICE_NOTFOUND) {
- dat->statusIconBig = NULL;
- }
- if (dat->statusIconOverlay != NULL) DestroyIcon(dat->statusIconOverlay);
- {
- int index = ImageList_ReplaceIcon(g_dat->hHelperIconList, 0, dat->statusIcon);
- dat->statusIconOverlay = ImageList_GetIcon(g_dat->hHelperIconList, index, ILD_TRANSPARENT|INDEXTOOVERLAYMASK(1));
- }
+ char* szMetaProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
+ if ((INT_PTR)szMetaProto != CALLSERVICE_NOTFOUND && strcmp(dat->szProto, szMetaProto) == 0 &&
+ DBGetContactSettingByte(NULL,"CLC","Meta",0) == 0) {
+ hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)dat->windowData.hContact, 0);
+ if (hContact != NULL)
+ szProto = GetContactProto(hContact);
+ else
+ hContact = dat->windowData.hContact;
}
+
+ Skin_ReleaseIcon(dat->statusIcon);
+ dat->statusIcon = LoadSkinnedProtoIcon(szProto, dat->wStatus);
+
+ Skin_ReleaseIcon(dat->statusIconBig);
+ dat->statusIconBig = LoadSkinnedProtoIconBig(szProto, dat->wStatus);
+ if ((int)dat->statusIconBig == CALLSERVICE_NOTFOUND)
+ dat->statusIconBig = NULL;
+
+ if (dat->statusIconOverlay != NULL)
+ DestroyIcon(dat->statusIconOverlay);
+
+ int index = ImageList_ReplaceIcon(g_dat->hHelperIconList, 0, dat->statusIcon);
+ dat->statusIconOverlay = ImageList_GetIcon(g_dat->hHelperIconList, index, ILD_TRANSPARENT|INDEXTOOVERLAYMASK(1));
}
void GetTitlebarIcon(struct SrmmWindowData *dat, TitleBarData *tbd) {
@@ -300,15 +298,14 @@ void GetTitlebarIcon(struct SrmmWindowData *dat, TitleBarData *tbd) { }
HICON GetTabIcon(struct SrmmWindowData *dat) {
- if (dat->showTyping) {
+ if (dat->showTyping)
return GetCachedIcon("scriver_TYPING");
- } else if (dat->showUnread != 0) {
+ if (dat->showUnread != 0)
return dat->statusIconOverlay;
- }
+
return dat->statusIcon;
}
-
struct MsgEditSubclassData
{
DWORD lastEnterTime;
@@ -396,7 +393,7 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return TRUE;
}
}
- return CallWindowProc(OldLogEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, LogEditSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -449,21 +446,21 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar SendMessage(hwnd, WM_PASTE, 0, 0);
return 0;
}
-
}
break;
//fall through
case WM_MOUSEWHEEL:
- if ((GetWindowLongPtr(hwnd, GWL_STYLE) & WS_VSCROLL) == 0) {
+ if ((GetWindowLongPtr(hwnd, GWL_STYLE) & WS_VSCROLL) == 0)
SendMessage(GetDlgItem(GetParent(hwnd), IDC_LOG), WM_MOUSEWHEEL, wParam, lParam);
- }
break;
+
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_KILLFOCUS:
dat->lastEnterTime = 0;
break;
+
case WM_SYSCHAR:
dat->lastEnterTime = 0;
if ((wParam == 's' || wParam == 'S') && isAlt) {
@@ -495,27 +492,25 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar mir_free(dat);
return 0;
}
- return CallWindowProc(OldMessageEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
static void SubclassMessageEdit(HWND hwnd) {
- OldMessageEditProc = (WNDPROC) SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) MessageEditSubclassProc);
+ mir_subclassWindow(hwnd, MessageEditSubclassProc);
SendMessage(hwnd, EM_SUBCLASSED, 0, 0);
}
static void UnsubclassMessageEdit(HWND hwnd) {
SendMessage(hwnd, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) OldMessageEditProc);
}
static void SubclassLogEdit(HWND hwnd) {
- OldLogEditProc = (WNDPROC) SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) LogEditSubclassProc);
+ mir_subclassWindow(hwnd, LogEditSubclassProc);
SendMessage(hwnd, EM_SUBCLASSED, 0, 0);
}
static void UnsubclassLogEdit(HWND hwnd) {
SendMessage(hwnd, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) OldLogEditProc);
}
static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, int h) {
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index 4003851adf..93b08a0085 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -35,20 +35,18 @@ extern ITaskbarList3 * pTaskbarInterface; #define TIMERID_FLASHWND 1
#define TIMEOUT_FLASHWND 900
-static WNDPROC OldTabCtrlProc;
-static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lParam);
-BOOL CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lParam);
+LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
extern TCHAR *GetNickname(HANDLE hContact, const char* szProto);
void SubclassTabCtrl(HWND hwnd) {
- OldTabCtrlProc = (WNDPROC) SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) TabCtrlProc);
+ mir_subclassWindow(hwnd, TabCtrlProc);
SendMessage(hwnd, EM_SUBCLASSED, 0, 0);
}
void UnsubclassTabCtrl(HWND hwnd) {
SendMessage(hwnd, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) OldTabCtrlProc);
}
static const TCHAR *titleTokenNames[] = {_T("%name%"), _T("%status%"), _T("%statusmsg%"), _T("%account%")};
@@ -1278,7 +1276,7 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar }
}
-BOOL CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
TabCtrlData *dat;
dat = (TabCtrlData *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
@@ -1570,10 +1568,9 @@ BOOL CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) mir_free(dat);
return 0;
}
- return CallWindowProc(OldTabCtrlProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, TabCtrlProc, msg, wParam, lParam);
}
-
int ScriverRestoreWindowPosition(HWND hwnd,HANDLE hContact,const char *szModule,const char *szNamePrefix, int flags, int showCmd)
{
RECT rcDesktop;
diff --git a/plugins/Scriver/src/richutil.cpp b/plugins/Scriver/src/richutil.cpp index 4336b7dbe9..d5fe537adb 100644 --- a/plugins/Scriver/src/richutil.cpp +++ b/plugins/Scriver/src/richutil.cpp @@ -107,8 +107,7 @@ void RichUtil_Unload(void) int RichUtil_SubClass(HWND hwndEdit)
{
- if (IsWindow(hwndEdit))
- {
+ if (IsWindow(hwndEdit)) {
int idx;
TRichUtil *ru = (TRichUtil*)mir_calloc(sizeof(TRichUtil));
@@ -121,7 +120,7 @@ int RichUtil_SubClass(HWND hwndEdit) List_Insert(&sListInt, ru, idx);
LeaveCriticalSection(&csRich);
- ru->origProc = (WNDPROC)SetWindowLongPtr(ru->hwnd, GWLP_WNDPROC, (LONG_PTR)&RichUtil_Proc);
+ mir_subclassWindow(ru->hwnd, RichUtil_Proc);
RichUtil_ClearUglyBorder(ru);
return 1;
}
@@ -132,6 +131,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
TRichUtil *ru = NULL, tru;
int idx;
+ LRESULT ret;
tru.hwnd = hwnd;
@@ -140,72 +140,64 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ru = (TRichUtil*)sListInt.items[idx];
LeaveCriticalSection(&csRich);
- switch(msg)
- {
- case WM_THEMECHANGED:
- case WM_STYLECHANGED:
- {
- RichUtil_ClearUglyBorder(ru);
- break;
- }
+ switch(msg) {
+ case WM_THEMECHANGED:
+ case WM_STYLECHANGED:
+ RichUtil_ClearUglyBorder(ru);
+ break;
- case WM_NCPAINT:
+ case WM_NCPAINT:
+ ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
+ if (ru->hasUglyBorder && MyIsThemeActive())
{
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
- if (ru->hasUglyBorder && MyIsThemeActive())
+ HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT");
+
+ if (hTheme)
{
- HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT");
-
- if (hTheme)
- {
- RECT rcBorder;
- RECT rcClient;
- int nState;
- HDC hdc = GetWindowDC(ru->hwnd);
-
- GetWindowRect(hwnd, &rcBorder);
- rcBorder.right -= rcBorder.left; rcBorder.bottom -= rcBorder.top;
- rcBorder.left = rcBorder.top = 0;
- CopyRect(&rcClient, &rcBorder);
- rcClient.left += ru->rect.left;
- rcClient.top += ru->rect.top;
- rcClient.right -= ru->rect.right;
- rcClient.bottom -= ru->rect.bottom;
- ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
-
- if (MyIsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
- MyDrawThemeParentBackground(hwnd, hdc, &rcBorder);
-
- if (!IsWindowEnabled(hwnd))
- nState = ETS_DISABLED;
- else if (SendMessage(hwnd, EM_GETOPTIONS, 0, 0) & ECO_READONLY)
- nState = ETS_READONLY;
- else nState = ETS_NORMAL;
-
- MyDrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL);
- MyCloseThemeData(hTheme);
- ReleaseDC(hwnd, hdc);
- return 0;
- }
+ RECT rcBorder;
+ RECT rcClient;
+ int nState;
+ HDC hdc = GetWindowDC(ru->hwnd);
+
+ GetWindowRect(hwnd, &rcBorder);
+ rcBorder.right -= rcBorder.left; rcBorder.bottom -= rcBorder.top;
+ rcBorder.left = rcBorder.top = 0;
+ CopyRect(&rcClient, &rcBorder);
+ rcClient.left += ru->rect.left;
+ rcClient.top += ru->rect.top;
+ rcClient.right -= ru->rect.right;
+ rcClient.bottom -= ru->rect.bottom;
+ ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
+
+ if (MyIsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
+ MyDrawThemeParentBackground(hwnd, hdc, &rcBorder);
+
+ if (!IsWindowEnabled(hwnd))
+ nState = ETS_DISABLED;
+ else if (SendMessage(hwnd, EM_GETOPTIONS, 0, 0) & ECO_READONLY)
+ nState = ETS_READONLY;
+ else nState = ETS_NORMAL;
+
+ MyDrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL);
+ MyCloseThemeData(hTheme);
+ ReleaseDC(hwnd, hdc);
+ return 0;
}
- return ret;
}
- case WM_NCCALCSIZE:
+ return ret;
+
+ case WM_NCCALCSIZE:
{
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS*)lParam;
- if (ru->hasUglyBorder && MyIsThemeActive())
- {
+ if (ru->hasUglyBorder && MyIsThemeActive()) {
HANDLE hTheme = MyOpenThemeData(hwnd, L"EDIT");
-
- if (hTheme)
- {
+ if (hTheme) {
RECT rcClient ={0};
HDC hdc = GetDC(GetParent(hwnd));
- if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK)
- {
+ if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) {
ru->rect.left = rcClient.left-ncsParam->rgrc[0].left;
ru->rect.top = rcClient.top-ncsParam->rgrc[0].top;
ru->rect.right = ncsParam->rgrc[0].right-rcClient.right;
@@ -220,44 +212,36 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM MyCloseThemeData(hTheme);
}
}
- return ret;
}
+ return ret;
- case WM_ENABLE:
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
- break;
-
- case WM_GETDLGCODE:
- return CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam) & ~DLGC_HASSETSEL;
+ case WM_ENABLE:
+ RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
+ break;
- case WM_NCDESTROY:
- {
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ case WM_GETDLGCODE:
+ return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam) & ~DLGC_HASSETSEL;
- if (IsWindow(hwnd))
- {
- if ((WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC) == &RichUtil_Proc)
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)ru->origProc);
- }
+ case WM_NCDESTROY:
+ ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
- EnterCriticalSection(&csRich);
- List_Remove(&sListInt, idx);
- LeaveCriticalSection(&csRich);
+ EnterCriticalSection(&csRich);
+ List_Remove(&sListInt, idx);
+ LeaveCriticalSection(&csRich);
- mir_free(ru);
- return ret;
- }
+ mir_free(ru);
+ return ret;
}
- return (ru == NULL) ? 0 : CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
}
static void RichUtil_ClearUglyBorder(TRichUtil *ru)
{
- if (mTheme && MyIsThemeActive() && GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) & WS_EX_STATICEDGE)
- {
+ if (mTheme && MyIsThemeActive() && GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) & WS_EX_STATICEDGE) {
ru->hasUglyBorder = 1;
SetWindowLongPtr(ru->hwnd, GWL_EXSTYLE, GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) ^ WS_EX_STATICEDGE);
}
+
// Redraw window since the style may have changed
SetWindowPos(ru->hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
RedrawWindow(ru->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
diff --git a/plugins/Scriver/src/richutil.h b/plugins/Scriver/src/richutil.h index 75ecea16a3..07d8e06329 100644 --- a/plugins/Scriver/src/richutil.h +++ b/plugins/Scriver/src/richutil.h @@ -30,7 +30,6 @@ typedef struct { HWND hwnd;
RECT rect;
int hasUglyBorder;
- WNDPROC origProc;
} TRichUtil;
void RichUtil_Load();
|