summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/container.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM/src/container.cpp')
-rw-r--r--plugins/TabSRMM/src/container.cpp1523
1 files changed, 701 insertions, 822 deletions
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index fa55f0bf70..021783da7c 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -564,7 +564,8 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
hwndTab = GetDlgItem(hwndDlg, IDC_MSGTABS);
switch (msg) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
+ {
DWORD ws;
HMENU hSysmenu;
DWORD dwCreateFlags;
@@ -615,7 +616,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
pContainer->buttonItems = g_ButtonSet.items;
pContainer->dwFlags = ((pContainer->dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT)) ?
- pContainer->dwFlags | CNT_SIDEBAR : pContainer->dwFlags & ~CNT_SIDEBAR);
+ pContainer->dwFlags | CNT_SIDEBAR : pContainer->dwFlags & ~CNT_SIDEBAR);
pContainer->SideBar = new CSideBar(pContainer);
pContainer->MenuBar = new CMenuBar(hwndDlg, pContainer);
@@ -628,8 +629,8 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
SetClassLongPtr(hwndDlg, GCL_STYLE, GetClassLongPtr(hwndDlg, GCL_STYLE) & ~CS_DROPSHADOW);
/*
- * additional system menu items...
- */
+ * additional system menu items...
+ */
hSysmenu = GetSystemMenu(hwndDlg, FALSE);
iMenuItems = GetMenuItemCount(hSysmenu);
@@ -644,8 +645,8 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)PluginConfig.g_iconContainer);
/*
- * make the tab control the controlling parent window for all message dialogs
- */
+ * make the tab control the controlling parent window for all message dialogs
+ */
ws = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_EXSTYLE);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_EXSTYLE, ws | WS_EX_CONTROLPARENT);
@@ -663,21 +664,20 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
SendMessage(hwndDlg, DM_CONFIGURECONTAINER, 0, 10);
/*
- * context menu
- */
+ * context menu
+ */
pContainer->hMenuContext = PluginConfig.g_hMenuContext;
/*
- * tab tooltips...
- */
+ * tab tooltips...
+ */
if (!fHaveTipper || M->GetByte("d_tooltips", 0) == 0) {
pContainer->hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, NULL, g_hInst, (LPVOID) NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, NULL, g_hInst, (LPVOID) NULL);
if (pContainer->hwndTip) {
SetWindowPos(pContainer->hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
TabCtrl_SetToolTips(GetDlgItem(hwndDlg, IDC_MSGTABS), pContainer->hwndTip);
}
-
}
else
pContainer->hwndTip = 0;
@@ -687,9 +687,9 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
wp.length = sizeof(wp);
- SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) & ~WS_VISIBLE);
+ SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) & ~WS_VISIBLE);
ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE);
- SendMessage(hwndDlg, DM_RESTOREWINDOWPOS, 0, 0);
+ SendMessage(hwndDlg, DM_RESTOREWINDOWPOS, 0, 0);
//GetClientRect(hwndDlg, &pContainer->rcSaved);
ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE);
GetWindowPlacement(hwndDlg, &wp);
@@ -701,22 +701,24 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
SendMessage(hwndDlg, DM_RESTOREWINDOWPOS, 0, 0);
ShowWindow(hwndDlg, SW_SHOWNORMAL);
}
+ }
- /*
- * prevent ugly back background being visible while tabbed clients are created
- */
- if (M->isAero()) {
- MARGINS m = {-1};
- CMimAPI::m_pfnDwmExtendFrameIntoClientArea(hwndDlg, &m);
- }
- return TRUE;
+ /*
+ * prevent ugly back background being visible while tabbed clients are created
+ */
+ if (M->isAero()) {
+ MARGINS m = {-1};
+ CMimAPI::m_pfnDwmExtendFrameIntoClientArea(hwndDlg, &m);
}
- case DM_RESTOREWINDOWPOS: {
+ return TRUE;
+
+ case DM_RESTOREWINDOWPOS:
+ {
char *szSetting = "CNTW_";
char szCName[CONTAINER_NAMELEN + 20];
/*
- * retrieve the container window geometry information from the database.
- */
+ * retrieve the container window geometry information from the database.
+ */
if (pContainer->isCloned && pContainer->hContactFrom != 0 && !(pContainer->dwFlags & CNT_GLOBALSIZE)) {
if (Utils_RestoreWindowPosition(hwndDlg, pContainer->hContactFrom, SRMSGMOD_T, "split")) {
if (Utils_RestoreWindowPositionNoMove(hwndDlg, pContainer->hContactFrom, SRMSGMOD_T, "split"))
@@ -741,10 +743,13 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
}
}
}
- return 0;
}
+ return 0;
- case WM_SIZE: {
+ case WM_SIZE:
+ if (IsIconic(hwndDlg))
+ pContainer->dwFlags |= CNT_DEFERREDSIZEREQUEST;
+ else {
RECT rcClient, rcUnadjusted;
int i = 0;
TCITEM item = {0};
@@ -752,11 +757,6 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
LONG sbarWidth, sbarWidth_left;
BOOL sizeChanged = FALSE;
- if (IsIconic(hwndDlg)) {
- pContainer->dwFlags |= CNT_DEFERREDSIZEREQUEST;
- break;
- }
-
GetClientRect(hwndDlg, &rcClient);
pContainer->MenuBar->getClientRect();
@@ -788,23 +788,23 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
DWORD dwSWPFlags = SWP_NOACTIVATE|SWP_NOZORDER |SWP_DEFERERASE | SWP_NOCOPYBITS; // | SWP_NOSENDCHANGING | SWP_ASYNCWINDOWPOS;
if (pContainer->dwFlags & CNT_TABSBOTTOM)
SetWindowPos(hwndTab, 0, pContainer->tBorder_outer_left + sbarWidth_left, pContainer->tBorder_outer_top + rebarHeight,
- (rcClient.right - rcClient.left) - (pContainer->tBorder_outer_left + pContainer->tBorder_outer_right + sbarWidth),
- (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight, dwSWPFlags);
+ (rcClient.right - rcClient.left) - (pContainer->tBorder_outer_left + pContainer->tBorder_outer_right + sbarWidth),
+ (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight, dwSWPFlags);
else
SetWindowPos(hwndTab, 0, pContainer->tBorder_outer_left + sbarWidth_left, pContainer->tBorder_outer_top + rebarHeight,
- (rcClient.right - rcClient.left) - (pContainer->tBorder_outer_left + pContainer->tBorder_outer_right + sbarWidth),
- (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight, dwSWPFlags);
+ (rcClient.right - rcClient.left) - (pContainer->tBorder_outer_left + pContainer->tBorder_outer_right + sbarWidth),
+ (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight, dwSWPFlags);
}
pContainer->SideBar->resizeScrollWnd(sbarWidth_left ? pContainer->tBorder_outer_left : rcClient.right - pContainer->tBorder_outer_right - (sbarWidth - 2),
- pContainer->tBorder_outer_top + rebarHeight,
- 0,
- (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight);
+ pContainer->tBorder_outer_top + rebarHeight,
+ 0,
+ (rcClient.bottom - rcClient.top) - pContainer->statusBarHeight - (pContainer->tBorder_outer_top + pContainer->tBorder_outer_bottom) - rebarHeight);
AdjustTabClientRect(pContainer, &rcClient);
sizeChanged = (((rcClient.right - rcClient.left) != pContainer->preSIZE.cx) ||
- ((rcClient.bottom - rcClient.top) != pContainer->preSIZE.cy));
+ ((rcClient.bottom - rcClient.top) != pContainer->preSIZE.cy));
if (sizeChanged) {
pContainer->preSIZE.cx = rcClient.right - rcClient.left;
pContainer->preSIZE.cy = rcClient.bottom - rcClient.top;
@@ -812,10 +812,10 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
/*
- * we care about all client sessions, but we really resize only the active tab (hwndActive)
- * we tell inactive tabs to resize theirselves later when they get activated (DM_CHECKSIZE
- * just queues a resize request)
- */
+ * we care about all client sessions, but we really resize only the active tab (hwndActive)
+ * we tell inactive tabs to resize theirselves later when they get activated (DM_CHECKSIZE
+ * just queues a resize request)
+ */
int nCount = TabCtrl_GetItemCount(hwndTab);
for (i=0; i < nCount; i++) {
@@ -823,7 +823,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
TabCtrl_GetItem(hwndTab, i, &item);
if ((HWND)item.lParam == pContainer->hwndActive) {
SetWindowPos((HWND)item.lParam, 0, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top),
- SWP_NOSENDCHANGING|SWP_NOACTIVATE/*|SWP_NOCOPYBITS*/);
+ SWP_NOSENDCHANGING|SWP_NOACTIVATE/*|SWP_NOCOPYBITS*/);
if (!pContainer->bSizingLoop && sizeChanged) {
TWindowData *dat = (TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DM_ScrollToBottom(dat, 0, 1);
@@ -863,195 +863,193 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
if (CSkin::m_bRoundedCorner)
rgn = CreateRoundRectRgn(clip, clip, (rcWindow.right - rcWindow.left) - clip + 1,
- (rcWindow.bottom - rcWindow.top) - clip + 1, CSkin::m_bRoundedCorner + clip, CSkin::m_bRoundedCorner + clip);
+ (rcWindow.bottom - rcWindow.top) - clip + 1, CSkin::m_bRoundedCorner + clip, CSkin::m_bRoundedCorner + clip);
else
rgn = CreateRectRgn(clip, clip, (rcWindow.right - rcWindow.left) - clip, (rcWindow.bottom - rcWindow.top) - clip);
SetWindowRgn(hwndDlg, rgn, TRUE);
}
else if (CSkin::m_frameSkins)
SetWindowRgn(hwndDlg, NULL, TRUE);
-
- break;
}
+ break;
- case WM_NOTIFY: {
- if (pContainer->MenuBar) {
- LRESULT processed = pContainer->MenuBar->processMsg(msg, wParam, lParam);
- if (processed != -1) {
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, processed);
- return(processed);
- }
+ case WM_NOTIFY:
+ if (pContainer->MenuBar) {
+ LRESULT processed = pContainer->MenuBar->processMsg(msg, wParam, lParam);
+ if (processed != -1) {
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, processed);
+ return(processed);
}
- NMHDR* pNMHDR = (NMHDR*) lParam;
- if (pContainer != NULL && pContainer->hwndStatus != 0 && ((LPNMHDR)lParam)->hwndFrom == pContainer->hwndStatus) {
- switch (((LPNMHDR)lParam)->code) {
- case NM_CLICK:
- case NM_RCLICK: {
- unsigned int nParts, nPanel;
- NMMOUSE *nm = (NMMOUSE*)lParam;
- RECT rc;
+ }
- nParts = SendMessage(pContainer->hwndStatus, SB_GETPARTS, 0, 0);
- if (nm->dwItemSpec == 0xFFFFFFFE) {
- nPanel = 2;
- SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
- if (nm->pt.x > rc.left && nm->pt.x < rc.right)
- goto panel_found;
- else
- return FALSE;
- }
- else
- nPanel = nm->dwItemSpec;
+ if (pContainer != NULL && pContainer->hwndStatus != 0 && ((LPNMHDR)lParam)->hwndFrom == pContainer->hwndStatus) {
+ switch (((LPNMHDR)lParam)->code) {
+ case NM_CLICK:
+ case NM_RCLICK: {
+ unsigned int nParts, nPanel;
+ NMMOUSE *nm = (NMMOUSE*)lParam;
+ RECT rc;
+
+ nParts = SendMessage(pContainer->hwndStatus, SB_GETPARTS, 0, 0);
+ if (nm->dwItemSpec == 0xFFFFFFFE) {
+ nPanel = 2;
+ SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
+ if (nm->pt.x > rc.left && nm->pt.x < rc.right)
+ goto panel_found;
+ else
+ return FALSE;
+ }
+ else
+ nPanel = nm->dwItemSpec;
panel_found:
- if (nPanel == 2) {
- struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
- if (dat)
- SI_CheckStatusIconClick(dat, pContainer->hwndStatus, nm->pt, rc, 2, ((LPNMHDR)lParam)->code);
- }
- else if (((LPNMHDR)lParam)->code == NM_RCLICK) {
- POINT pt;
- HANDLE hContact = 0;
- HMENU hMenu;
-
- GetCursorPos(&pt);
- SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- if (hContact) {
- int iSel = 0;
- hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) hContact, 0);
- iSel = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- if (iSel)
- CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(iSel), MPCF_CONTACTMENU), (LPARAM) hContact);
- DestroyMenu(hMenu);
- }
- }
- return TRUE;
+ if (nPanel == 2) {
+ struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
+ if (dat)
+ SI_CheckStatusIconClick(dat, pContainer->hwndStatus, nm->pt, rc, 2, ((LPNMHDR)lParam)->code);
+ }
+ else if (((LPNMHDR)lParam)->code == NM_RCLICK) {
+ POINT pt;
+ HANDLE hContact = 0;
+ HMENU hMenu;
+
+ GetCursorPos(&pt);
+ SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ if (hContact) {
+ int iSel = 0;
+ hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) hContact, 0);
+ iSel = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ if (iSel)
+ CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(iSel), MPCF_CONTACTMENU), (LPARAM) hContact);
+ DestroyMenu(hMenu);
}
}
- break;
+ return TRUE;
+ }
}
- switch (pNMHDR->code) {
- case TCN_SELCHANGE: {
- ZeroMemory((void*)&item, sizeof(item));
- iItem = TabCtrl_GetCurSel(hwndTab);
- item.mask = TCIF_PARAM;
- if (TabCtrl_GetItem(hwndTab, iItem, &item)) {
- if ((HWND)item.lParam != pContainer->hwndActive) {
- if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
- ShowWindow(pContainer->hwndActive, SW_HIDE);
- }
- pContainer->hwndActive = (HWND) item.lParam;
- SendMessage((HWND)item.lParam, DM_SAVESIZE, 0, 1);
- ShowWindow((HWND)item.lParam, SW_SHOW);
- if (!IsIconic(hwndDlg))
- SetFocus(pContainer->hwndActive);
- }
- SendMessage(hwndTab, EM_VALIDATEBOTTOM, 0, 0);
- return 0;
+ break;
+ }
+
+ switch (((LPNMHDR)lParam)->code) {
+ case TCN_SELCHANGE:
+ ZeroMemory((void*)&item, sizeof(item));
+ iItem = TabCtrl_GetCurSel(hwndTab);
+ item.mask = TCIF_PARAM;
+ if (TabCtrl_GetItem(hwndTab, iItem, &item)) {
+ if ((HWND)item.lParam != pContainer->hwndActive) {
+ if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
+ ShowWindow(pContainer->hwndActive, SW_HIDE);
}
- /*
- * tooltips
- */
- case NM_RCLICK: {
- HMENU subMenu;
- POINT pt, pt1;
- int iSelection, iItem;
- TCITEM item = {0};
- struct TWindowData *dat = 0;
- bool fFromSidebar = false;
+ pContainer->hwndActive = (HWND) item.lParam;
+ SendMessage((HWND)item.lParam, DM_SAVESIZE, 0, 1);
+ ShowWindow((HWND)item.lParam, SW_SHOW);
+ if (!IsIconic(hwndDlg))
+ SetFocus(pContainer->hwndActive);
+ }
+ SendMessage(hwndTab, EM_VALIDATEBOTTOM, 0, 0);
+ return 0;
- GetCursorPos(&pt);
- pt1 = pt;
- subMenu = GetSubMenu(pContainer->hMenuContext, 0);
+ /*
+ * tooltips
+ */
+ case NM_RCLICK:
+ {
+ HMENU subMenu;
+ int iSelection, iItem;
+ TCITEM item = {0};
+ struct TWindowData *dat = 0;
+ bool fFromSidebar = false;
+
+ POINT pt, pt1;
+ GetCursorPos(&pt);
+ pt1 = pt;
+ subMenu = GetSubMenu(pContainer->hMenuContext, 0);
- if (pNMHDR->idFrom == IDC_MSGTABS) {
- if ((iItem = GetTabItemFromMouse(hwndTab, &pt)) == -1)
- break;
+ if (((LPNMHDR)lParam)->idFrom == IDC_MSGTABS) {
+ if ((iItem = GetTabItemFromMouse(hwndTab, &pt)) == -1)
+ break;
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, iItem, &item);
- if (item.lParam && IsWindow((HWND)item.lParam))
- dat = (struct TWindowData *)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
- }
- /*
- * sent from a sidebar button (RMB click) instead of the tab control
- */
- else if (pNMHDR->idFrom == 5000) {
- TSideBarNotify* n = reinterpret_cast<TSideBarNotify *>(lParam);
- dat = const_cast<TWindowData *>(n->dat);
- fFromSidebar = true;
- }
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, iItem, &item);
+ if (item.lParam && IsWindow((HWND)item.lParam))
+ dat = (struct TWindowData *)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ }
+ /*
+ * sent from a sidebar button (RMB click) instead of the tab control
+ */
+ else if (((LPNMHDR)lParam)->idFrom == 5000) {
+ TSideBarNotify* n = reinterpret_cast<TSideBarNotify *>(lParam);
+ dat = const_cast<TWindowData *>(n->dat);
+ fFromSidebar = true;
+ }
- if (dat)
- MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
-
- iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt1.x, pt1.y, 0, hwndDlg, NULL);
- if (iSelection >= IDM_CONTAINERMENU) {
- DBVARIANT dbv = {0};
- char szIndex[10];
- char *szKey = "TAB_ContainersW";
- mir_snprintf(szIndex, 8, "%d", iSelection - IDM_CONTAINERMENU);
- if (iSelection - IDM_CONTAINERMENU >= 0) {
- if (!M->GetTString(NULL, szKey, szIndex, &dbv)) {
- SendMessage((HWND)item.lParam, DM_CONTAINERSELECTED, 0, (LPARAM) dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
+ if (dat)
+ MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
+
+ iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt1.x, pt1.y, 0, hwndDlg, NULL);
+ if (iSelection >= IDM_CONTAINERMENU) {
+ DBVARIANT dbv = {0};
+ char szIndex[10];
+ char *szKey = "TAB_ContainersW";
+ mir_snprintf(szIndex, 8, "%d", iSelection - IDM_CONTAINERMENU);
+ if (iSelection - IDM_CONTAINERMENU >= 0) {
+ if (!M->GetTString(NULL, szKey, szIndex, &dbv)) {
+ SendMessage((HWND)item.lParam, DM_CONTAINERSELECTED, 0, (LPARAM) dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
- return 1;
}
- switch (iSelection) {
- case ID_TABMENU_CLOSETAB:
- if (fFromSidebar)
- SendMessage(dat->hwnd, WM_CLOSE, 1, 0);
- else
- SendMessage(hwndDlg, DM_CLOSETABATMOUSE, 0, (LPARAM)&pt1);
- break;
- case ID_TABMENU_CLOSEOTHERTABS:
- CloseOtherTabs(hwndTab, *dat);
- break;
- case ID_TABMENU_SAVETABPOSITION:
- M->WriteDword(dat->hContact, SRMSGMOD_T, "tabindex", dat->iTabID * 100);
- break;
- case ID_TABMENU_CLEARSAVEDTABPOSITION:
- DBDeleteContactSetting(dat->hContact, SRMSGMOD_T, "tabindex");
- break;
- case ID_TABMENU_LEAVECHATROOM: {
- if (dat && dat->bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
- if (si && dat->hContact) {
- char* szProto = GetContactProto(dat->hContact);
- if ( szProto )
- CallProtoService( szProto, PS_LEAVECHAT, (WPARAM)dat->hContact, 0 );
- }
- }
- break;
+ return 1;
+ }
+ switch (iSelection) {
+ case ID_TABMENU_CLOSETAB:
+ if (fFromSidebar)
+ SendMessage(dat->hwnd, WM_CLOSE, 1, 0);
+ else
+ SendMessage(hwndDlg, DM_CLOSETABATMOUSE, 0, (LPARAM)&pt1);
+ break;
+ case ID_TABMENU_CLOSEOTHERTABS:
+ CloseOtherTabs(hwndTab, *dat);
+ break;
+ case ID_TABMENU_SAVETABPOSITION:
+ M->WriteDword(dat->hContact, SRMSGMOD_T, "tabindex", dat->iTabID * 100);
+ break;
+ case ID_TABMENU_CLEARSAVEDTABPOSITION:
+ db_unset(dat->hContact, SRMSGMOD_T, "tabindex");
+ break;
+ case ID_TABMENU_LEAVECHATROOM:
+ if (dat && dat->bType == SESSIONTYPE_CHAT) {
+ SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ if (si && dat->hContact) {
+ char* szProto = GetContactProto(dat->hContact);
+ if ( szProto )
+ CallProtoService( szProto, PS_LEAVECHAT, (WPARAM)dat->hContact, 0 );
}
- case ID_TABMENU_ATTACHTOCONTAINER:
- if ((iItem = GetTabItemFromMouse(hwndTab, &pt1)) == -1)
- break;
- ZeroMemory((void*)&item, sizeof(item));
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, iItem, &item);
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), hwndDlg, SelectContainerDlgProc, (LPARAM) item.lParam);
- break;
- case ID_TABMENU_CONTAINEROPTIONS: {
- if (pContainer->hWndOptions == 0)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM) pContainer);
- break;
- case ID_TABMENU_CLOSECONTAINER:
- SendMessage(hwndDlg, WM_CLOSE, 0, 0);
- break;
- }
}
- InvalidateRect(hwndTab, NULL, FALSE);
- return 1;
+ break;
+ case ID_TABMENU_ATTACHTOCONTAINER:
+ if ((iItem = GetTabItemFromMouse(hwndTab, &pt1)) == -1)
+ break;
+ ZeroMemory((void*)&item, sizeof(item));
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, iItem, &item);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), hwndDlg, SelectContainerDlgProc, (LPARAM) item.lParam);
+ break;
+ case ID_TABMENU_CONTAINEROPTIONS:
+ if (pContainer->hWndOptions == 0)
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM) pContainer);
+ break;
+ case ID_TABMENU_CLOSECONTAINER:
+ SendMessage(hwndDlg, WM_CLOSE, 0, 0);
+ break;
}
+ InvalidateRect(hwndTab, NULL, FALSE);
+ return 1;
}
- break;
}
+ break;
- case WM_COMMAND: {
-
+ case WM_COMMAND:
+ {
bool fProcessContactMenu = pContainer->MenuBar->isContactMenu();
bool fProcessMainMenu = pContainer->MenuBar->isMainMenu();
pContainer->MenuBar->Cancel();
@@ -1077,109 +1075,10 @@ panel_found:
SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
if (LOWORD(wParam) == IDC_TBFIRSTUID - 1)
break;
- /*
- else if (LOWORD(wParam) >= IDC_TBFIRSTUID) { // skinnable buttons handling
- ButtonItem *item = pContainer->buttonItems;
- WPARAM wwParam = 0;
- LPARAM llParam = 0;
- HANDLE hContact = dat ? dat->hContact : 0;
- int serviceFailure = FALSE;
-
- while (item) {
- if (item->uId == (DWORD)LOWORD(wParam)) {
- int contactOK = ServiceParamsOK(item, &wwParam, &llParam, hContact);
-
- if (item->dwFlags & BUTTON_ISSERVICE) {
- if (ServiceExists(item->szService) && contactOK)
- CallService(item->szService, wwParam, llParam);
- else if (contactOK)
- serviceFailure = TRUE;
- }
- else if (item->dwFlags & BUTTON_ISPROTOSERVICE) {
- if (contactOK) {
- char szFinalService[512];
-
- mir_snprintf(szFinalService, 512, "%s/%s", GetContactProto(hContact), item->szService);
- if (ServiceExists(szFinalService))
- CallService(szFinalService, wwParam, llParam);
- else
- serviceFailure = TRUE;
- }
- }
- else if (item->dwFlags & BUTTON_ISDBACTION) {
- BYTE *pValue;
- char *szModule = item->szModule;
- char *szSetting = item->szSetting;
- HANDLE finalhContact = 0;
-
- if (item->dwFlags & BUTTON_ISCONTACTDBACTION || item->dwFlags & BUTTON_DBACTIONONCONTACT) {
- contactOK = ServiceParamsOK(item, &wwParam, &llParam, hContact);
- if (contactOK && item->dwFlags & BUTTON_ISCONTACTDBACTION)
- szModule = GetContactProto(hContact);
- finalhContact = hContact;
- }
- else
- contactOK = 1;
-
- if (contactOK) {
- BOOL fDelete = FALSE;
-
- if (item->dwFlags & BUTTON_ISTOGGLE) {
- BOOL fChecked = (SendMessage(item->hWnd, BM_GETCHECK, 0, 0) == BST_UNCHECKED);
-
- pValue = fChecked ? item->bValueRelease : item->bValuePush;
- if (fChecked && pValue[0] == 0)
- fDelete = TRUE;
- }
- else
- pValue = item->bValuePush;
-
- if (fDelete)
- DBDeleteContactSetting(finalhContact, szModule, szSetting);
- else {
- switch (item->type) {
- case DBVT_BYTE:
- M->WriteByte(finalhContact, szModule, szSetting, pValue[0]);
- break;
- case DBVT_WORD:
- DBWriteContactSettingWord(finalhContact, szModule, szSetting, *((WORD *)&pValue[0]));
- break;
- case DBVT_DWORD:
- M->WriteDword(finalhContact, szModule, szSetting, *((DWORD *)&pValue[0]));
- break;
- case DBVT_ASCIIZ:
- DBWriteContactSettingString(finalhContact, szModule, szSetting, (char *)pValue);
- break;
- }
- }
- }
- else if (item->dwFlags & BUTTON_ISTOGGLE)
- SendMessage(item->hWnd, BM_SETCHECK, 0, 0);
- }
- if (!contactOK)
- MessageBox(0, _T("The requested action requires a valid contact selection. Please select a contact from the contact list and repeat"), _T("Parameter mismatch"), MB_OK);
- if (serviceFailure) {
- char szError[512];
- mir_snprintf(szError, 512, "The service %s specified by the %s button definition was not found. You may need to install additional plugins", item->szService, item->szName);
- MessageBoxA(0, szError, "Service failure", MB_OK);
- }
- goto buttons_done;
- }
- item = item->nextItem;
- }
- }
- while (pItem) {
- if (LOWORD(wParam) == pItem->uId) {
- if (pItem->pfnAction != NULL)
- pItem->pfnAction(pItem, pContainer->hwndActive, dat, GetDlgItem(hwndDlg, pItem->uId));
- }
- pItem = pItem->nextItem;
- }
-buttons_done:
- */
switch (LOWORD(wParam)) {
- case IDC_TOGGLESIDEBAR: {
+ case IDC_TOGGLESIDEBAR:
+ {
RECT rc;
LONG dwNewLeft;
BOOL skinnedMode = bSkinned;
@@ -1203,38 +1102,42 @@ buttons_done:
pContainer->oldDCSize.cx = pContainer->oldDCSize.cy = 0;
PostMessage(hwndDlg, WM_SIZE, 0, 1);
- break;
-
}
- case IDC_SIDEBARDOWN:
- case IDC_SIDEBARUP: {
+ break;
+
+ case IDC_SIDEBARDOWN:
+ case IDC_SIDEBARUP:
+ {
HWND hwnd = GetFocus();
pContainer->SideBar->processScrollerButtons(LOWORD(wParam));
- //if (lParam)
- //SetFocus(GetDlgItem(pContainer->hwndActive, lParam));
SetFocus(hwnd);
- break;
}
- default:
- Utils::CmdDispatcher(Utils::CMD_CONTAINER, hwndDlg, LOWORD(wParam), wParam, lParam, 0, pContainer);
+ break;
+
+ default:
+ Utils::CmdDispatcher(Utils::CMD_CONTAINER, hwndDlg, LOWORD(wParam), wParam, lParam, 0, pContainer);
}
if (pContainer->dwFlags != dwOldFlags)
SendMessage(hwndDlg, DM_CONFIGURECONTAINER, 0, 0);
- break;
}
- case WM_ENTERSIZEMOVE: {
+ break;
+
+ case WM_ENTERSIZEMOVE:
+ {
RECT rc;
- SIZE sz;
GetClientRect(GetDlgItem(hwndDlg, IDC_MSGTABS), &rc);
+
+ SIZE sz;
sz.cx = rc.right - rc.left;
sz.cy = rc.bottom - rc.top;
pContainer->oldSize = sz;
pContainer->bSizingLoop = TRUE;
- break;
}
- case WM_EXITSIZEMOVE: {
- RECT rc;
+ break;
+ case WM_EXITSIZEMOVE:
+ {
+ RECT rc;
GetClientRect(GetDlgItem(hwndDlg, IDC_MSGTABS), &rc);
if (!((rc.right - rc.left) == pContainer->oldSize.cx && (rc.bottom - rc.top) == pContainer->oldSize.cy)) {
TWindowData *dat = (TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
@@ -1242,20 +1145,21 @@ buttons_done:
SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);
}
pContainer->bSizingLoop = FALSE;
- break;
}
+ break;
/*
- * determine minimum and maximum size limits
- * 1) for maximizing the window when the "vertical maximize" option is set
- * 2) to limit the minimum height when manually resizing the window
- * (this avoids overlapping of controls inside the window and ensures
- * that at least 2 lines of the message log are always visible).
- */
- case WM_GETMINMAXINFO: {
+ * determine minimum and maximum size limits
+ * 1) for maximizing the window when the "vertical maximize" option is set
+ * 2) to limit the minimum height when manually resizing the window
+ * (this avoids overlapping of controls inside the window and ensures
+ * that at least 2 lines of the message log are always visible).
+ */
+ case WM_GETMINMAXINFO:
+ {
RECT rc, rcWindow, rcClient = {0};
POINT pt;
- MINMAXINFO *mmi = (MINMAXINFO *) lParam;
+ MINMAXINFO *mmi = (MINMAXINFO *) lParam;
mmi->ptMinTrackSize.x = 275;
mmi->ptMinTrackSize.y = 130;
GetClientRect(GetDlgItem(hwndDlg, IDC_MSGTABS), &rc);
@@ -1265,10 +1169,10 @@ buttons_done:
pt.y = rc.top;
TabCtrl_AdjustRect(GetDlgItem(hwndDlg, IDC_MSGTABS), FALSE, &rc);
/*
- * uChildMinHeight holds the min height for the client window only
- * so let's add the container's vertical padding (title bar, tab bar,
- * window border, status bar) to this value
- */
+ * uChildMinHeight holds the min height for the client window only
+ * so let's add the container's vertical padding (title bar, tab bar,
+ * window border, status bar) to this value
+ */
if (pContainer->hwndActive)
mmi->ptMinTrackSize.y = pContainer->uChildMinHeight + (pContainer->hwndActive ? ((rcWindow.bottom - rcWindow.top) - rcClient.bottom) : 0);
@@ -1305,8 +1209,8 @@ buttons_done:
}
/*
- * protect against invalid values...
- */
+ * protect against invalid values...
+ */
if (mmi->ptMinTrackSize.y < 50 || mmi->ptMinTrackSize.y > rcDesktop.bottom)
mmi->ptMinTrackSize.y = 130;
@@ -1319,21 +1223,24 @@ buttons_done:
}
}
}
- return 0;
}
- case WM_MOVE:
- if (PluginConfig.m_MathModAvail) {
- TMathWindowInfo mathWndInfo;
- RECT windRect;
- GetWindowRect(hwndDlg, &windRect);
- mathWndInfo.top = windRect.top;
- mathWndInfo.left = windRect.left;
- mathWndInfo.right = windRect.right;
- mathWndInfo.bottom = windRect.bottom;
- CallService(MTH_RESIZE, 0, (LPARAM) &mathWndInfo);
- }
- break;
- case DM_UPDATETITLE: {
+ return 0;
+
+ case WM_MOVE:
+ if (PluginConfig.m_MathModAvail) {
+ TMathWindowInfo mathWndInfo;
+ RECT windRect;
+ GetWindowRect(hwndDlg, &windRect);
+ mathWndInfo.top = windRect.top;
+ mathWndInfo.left = windRect.left;
+ mathWndInfo.right = windRect.right;
+ mathWndInfo.bottom = windRect.bottom;
+ CallService(MTH_RESIZE, 0, (LPARAM) &mathWndInfo);
+ }
+ break;
+
+ case DM_UPDATETITLE:
+ {
HANDLE hContact = 0;
const TCHAR *szNewTitle = NULL;
TWindowData *dat = NULL;
@@ -1341,12 +1248,12 @@ buttons_done:
if (lParam) { // lParam != 0 means sent by a chat window
TCHAR szText[512];
dat = (struct TWindowData *)GetWindowLongPtr((HWND)wParam, GWLP_USERDATA);
- GetWindowText((HWND)wParam, szText, SIZEOF(szText));
- szText[SIZEOF(szText)-1] = 0;
- SetWindowText(hwndDlg, szText);
- if (dat)
- SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hTabIcon != dat->hTabStatusIcon ? dat->hTabIcon : dat->hTabStatusIcon));
- return 0;
+ GetWindowText((HWND)wParam, szText, SIZEOF(szText));
+ szText[SIZEOF(szText)-1] = 0;
+ SetWindowText(hwndDlg, szText);
+ if (dat)
+ SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hTabIcon != dat->hTabStatusIcon ? dat->hTabIcon : dat->hTabStatusIcon));
+ return 0;
}
if (wParam == 0) { // no hContact given - obtain the hContact for the active tab
if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
@@ -1376,194 +1283,164 @@ buttons_done:
free((void*)szNewTitle);
}
}
- return 0;
}
+ return 0;
+ case WM_TIMER:
+ if (wParam == TIMERID_HEARTBEAT) {
+ TWindowData *dat = 0;
+ if (GetForegroundWindow() != hwndDlg && (pContainer->settings->autoCloseSeconds > 0) && !pContainer->fHidden) {
+ BOOL fResult = TRUE;
+ BroadCastContainer(pContainer, DM_CHECKAUTOHIDE, (WPARAM)pContainer->settings->autoCloseSeconds, (LPARAM)&fResult);
- case WM_TIMER:
- if (wParam == TIMERID_HEARTBEAT) {
- /*
- int i;
- TCITEM item = {0};
- DWORD dwTimeout;
- */
- struct TWindowData *dat = 0;
- /*
- item.mask = TCIF_PARAM;
- if ((dwTimeout = PluginConfig.m_TabAutoClose) > 0) {
- int clients = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_MSGTABS));
- HWND *hwndClients = (HWND *)mir_alloc(sizeof(HWND) * (clients + 1));
- for (i=0; i < clients; i++) {
- TabCtrl_GetItem(hwndTab, i, &item);
- hwndClients[i] = (HWND)item.lParam;
- }
- for (i=0; i < clients; i++) {
- if (IsWindow(hwndClients[i])) {
- if ((HWND)hwndClients[i] != pContainer->hwndActive)
- pContainer->bDontSmartClose = TRUE;
- SendMessage((HWND)hwndClients[i], DM_CHECKAUTOCLOSE, (WPARAM)(dwTimeout * 60), 0);
- pContainer->bDontSmartClose = FALSE;
- }
- }
- mir_free(hwndClients);
- }
- */
- if (GetForegroundWindow() != hwndDlg && (pContainer->settings->autoCloseSeconds > 0) && !pContainer->fHidden) {
- BOOL fResult = TRUE;
- BroadCastContainer(pContainer, DM_CHECKAUTOHIDE, (WPARAM)pContainer->settings->autoCloseSeconds, (LPARAM)&fResult);
-
- if (fResult && 0 == pContainer->hWndOptions)
- PostMessage(hwndDlg, WM_CLOSE, 1, 0);
- }
- dat = (TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- if (dat && dat->bType == SESSIONTYPE_IM) {
- if (dat->idle && pContainer->hwndActive && IsWindow(pContainer->hwndActive))
- dat->Panel->Invalidate(TRUE);
- }
- else if (dat)
- SendMessage(dat->hwnd, GC_UPDATESTATUSBAR, 0, 0);
+ if (fResult && 0 == pContainer->hWndOptions)
+ PostMessage(hwndDlg, WM_CLOSE, 1, 0);
}
- else if (wParam == TIMERID_HOVER) {
- RECT rcWindow;
- GetWindowRect(hwndDlg, &rcWindow);
+ dat = (TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ if (dat && dat->bType == SESSIONTYPE_IM) {
+ if (dat->idle && pContainer->hwndActive && IsWindow(pContainer->hwndActive))
+ dat->Panel->Invalidate(TRUE);
}
+ else if (dat)
+ SendMessage(dat->hwnd, GC_UPDATESTATUSBAR, 0, 0);
+ }
+ else if (wParam == TIMERID_HOVER) {
+ RECT rcWindow;
+ GetWindowRect(hwndDlg, &rcWindow);
+ }
+ break;
+
+ case WM_SYSCOMMAND:
+ switch (wParam) {
+ case IDM_STAYONTOP:
+ SetWindowPos(hwndDlg, (pContainer->dwFlags & CNT_STICKY) ? HWND_NOTOPMOST : HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_STAYONTOP, (pContainer->dwFlags & CNT_STICKY) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
+ ApplyContainerSetting(pContainer, CNT_STICKY, pContainer->dwFlags & CNT_STICKY ? 0 : 1, false);
break;
- case WM_SYSCOMMAND:
- switch (wParam) {
- case IDM_STAYONTOP:
- SetWindowPos(hwndDlg, (pContainer->dwFlags & CNT_STICKY) ? HWND_NOTOPMOST : HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_STAYONTOP, (pContainer->dwFlags & CNT_STICKY) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
- ApplyContainerSetting(pContainer, CNT_STICKY, pContainer->dwFlags & CNT_STICKY ? 0 : 1, false);
- break;
- case IDM_NOTITLE: {
- pContainer->oldSize.cx = 0;
- pContainer->oldSize.cy = 0;
+ case IDM_NOTITLE:
+ pContainer->oldSize.cx = 0;
+ pContainer->oldSize.cy = 0;
- CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_NOTITLE, (pContainer->dwFlags & CNT_NOTITLE) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
- ApplyContainerSetting(pContainer, CNT_NOTITLE, pContainer->dwFlags & CNT_NOTITLE ? 0 : 1, false);
- break;
- }
- case IDM_MOREOPTIONS:
- if (IsIconic(pContainer->hwnd))
- SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
- if (pContainer->hWndOptions == 0)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM)pContainer);
- break;
- case SC_MAXIMIZE:
- pContainer->oldSize.cx = pContainer->oldSize.cy = 0;
- break;
- case SC_RESTORE:
- pContainer->oldSize.cx = pContainer->oldSize.cy = 0;
- memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS));
- break;
- case SC_MINIMIZE: {
- TWindowData* dat = reinterpret_cast<TWindowData *>(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA));
- if (dat) {
- //GetWindowRect(GetDlgItem(pContainer->hwndActive, dat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &pContainer->rcLogSaved);
- GetWindowRect(pContainer->hwndActive, &pContainer->rcLogSaved);
- pContainer->ptLogSaved.x = pContainer->rcLogSaved.left;
- pContainer->ptLogSaved.y = pContainer->rcLogSaved.top;
- ScreenToClient(hwndDlg, &pContainer->ptLogSaved);
- }
- break;
- }
- }
+ CheckMenuItem(GetSystemMenu(hwndDlg, FALSE), IDM_NOTITLE, (pContainer->dwFlags & CNT_NOTITLE) ? MF_BYCOMMAND | MF_UNCHECKED : MF_BYCOMMAND | MF_CHECKED);
+ ApplyContainerSetting(pContainer, CNT_NOTITLE, pContainer->dwFlags & CNT_NOTITLE ? 0 : 1, false);
+ break;
+ case IDM_MOREOPTIONS:
+ if (IsIconic(pContainer->hwnd))
+ SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
+ if (pContainer->hWndOptions == 0)
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM)pContainer);
+ break;
+ case SC_MAXIMIZE:
+ pContainer->oldSize.cx = pContainer->oldSize.cy = 0;
break;
- case DM_SELECTTAB: {
- switch (wParam) {
- int iItems, iCurrent, iNewTab;
- TCITEM item;
+ case SC_RESTORE:
+ pContainer->oldSize.cx = pContainer->oldSize.cy = 0;
+ memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS));
+ break;
+ case SC_MINIMIZE:
+ TWindowData* dat = reinterpret_cast<TWindowData *>(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA));
+ if (dat) {
+ //GetWindowRect(GetDlgItem(pContainer->hwndActive, dat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &pContainer->rcLogSaved);
+ GetWindowRect(pContainer->hwndActive, &pContainer->rcLogSaved);
+ pContainer->ptLogSaved.x = pContainer->rcLogSaved.left;
+ pContainer->ptLogSaved.y = pContainer->rcLogSaved.top;
+ ScreenToClient(hwndDlg, &pContainer->ptLogSaved);
+ }
+ }
+ break;
- case DM_SELECT_BY_HWND:
- ActivateTabFromHWND(hwndTab, (HWND) lParam);
- break;
- case DM_SELECT_NEXT:
- case DM_SELECT_PREV:
- case DM_SELECT_BY_INDEX:
- iItems = TabCtrl_GetItemCount(hwndTab);
- iCurrent = TabCtrl_GetCurSel(hwndTab);
+ case DM_SELECTTAB:
+ switch (wParam) {
+ int iItems, iCurrent, iNewTab;
+ TCITEM item;
- if (iItems == 1)
- break;
- if (wParam == DM_SELECT_PREV)
- iNewTab = iCurrent ? iCurrent - 1 : iItems - 1; // cycle if current is already the leftmost tab..
- else if (wParam == DM_SELECT_NEXT)
- iNewTab = (iCurrent == (iItems - 1)) ? 0 : iCurrent + 1;
- else if (wParam == DM_SELECT_BY_INDEX) {
- if ((int)lParam > iItems)
- break;
- iNewTab = lParam - 1;
- }
+ case DM_SELECT_BY_HWND:
+ ActivateTabFromHWND(hwndTab, (HWND) lParam);
+ break;
+ case DM_SELECT_NEXT:
+ case DM_SELECT_PREV:
+ case DM_SELECT_BY_INDEX:
+ iItems = TabCtrl_GetItemCount(hwndTab);
+ iCurrent = TabCtrl_GetCurSel(hwndTab);
- if (iNewTab != iCurrent) {
- struct TabControlData *tabdat = (struct TabControlData *)GetWindowLongPtr(hwndTab, GWLP_USERDATA);
- ZeroMemory((void*)&item, sizeof(item));
- item.mask = TCIF_PARAM;
- if (TabCtrl_GetItem(hwndTab, iNewTab, &item)) {
- TabCtrl_SetCurSel(hwndTab, iNewTab);
- ShowWindow(pContainer->hwndActive, SW_HIDE);
- pContainer->hwndActive = (HWND) item.lParam;
- ShowWindow((HWND)item.lParam, SW_SHOW);
- SetFocus(pContainer->hwndActive);
- }
- }
+ if (iItems == 1)
+ break;
+ if (wParam == DM_SELECT_PREV)
+ iNewTab = iCurrent ? iCurrent - 1 : iItems - 1; // cycle if current is already the leftmost tab..
+ else if (wParam == DM_SELECT_NEXT)
+ iNewTab = (iCurrent == (iItems - 1)) ? 0 : iCurrent + 1;
+ else if (wParam == DM_SELECT_BY_INDEX) {
+ if ((int)lParam > iItems)
break;
+ iNewTab = lParam - 1;
+ }
+
+ if (iNewTab != iCurrent) {
+ struct TabControlData *tabdat = (struct TabControlData *)GetWindowLongPtr(hwndTab, GWLP_USERDATA);
+ ZeroMemory((void*)&item, sizeof(item));
+ item.mask = TCIF_PARAM;
+ if (TabCtrl_GetItem(hwndTab, iNewTab, &item)) {
+ TabCtrl_SetCurSel(hwndTab, iNewTab);
+ ShowWindow(pContainer->hwndActive, SW_HIDE);
+ pContainer->hwndActive = (HWND) item.lParam;
+ ShowWindow((HWND)item.lParam, SW_SHOW);
+ SetFocus(pContainer->hwndActive);
+ }
}
break;
}
- case WM_INITMENUPOPUP:
- pContainer->MenuBar->setActive(reinterpret_cast<HMENU>(wParam));
- break;
+ break;
- case WM_LBUTTONDOWN: {
- POINT pt;
+ case WM_INITMENUPOPUP:
+ pContainer->MenuBar->setActive(reinterpret_cast<HMENU>(wParam));
+ break;
- if (pContainer->dwFlags & CNT_NOTITLE) {
- GetCursorPos(&pt);
- return SendMessage(hwndDlg, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
- }
- break;
+ case WM_LBUTTONDOWN:
+ if (pContainer->dwFlags & CNT_NOTITLE) {
+ POINT pt;
+ GetCursorPos(&pt);
+ return SendMessage(hwndDlg, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
+ break;
+
/*
- * pass the WM_ACTIVATE msg to the active message dialog child
- */
+ * pass the WM_ACTIVATE msg to the active message dialog child
+ */
+ case WM_NCACTIVATE:
+ if (IsWindowVisible(hwndDlg))
+ pContainer->fHidden = false;
+ break;
- case WM_NCACTIVATE:
- if (IsWindowVisible(hwndDlg))
- pContainer->fHidden = false;
+ case WM_ACTIVATE:
+ if (pContainer == NULL)
break;
- case WM_ACTIVATE:
- if (pContainer == NULL)
- break;
-
- if (LOWORD(wParam == WA_INACTIVE)) {
- BroadCastContainer(pContainer, DM_CHECKINFOTIP, wParam, lParam);
- if (PluginConfig.m_MathModAvail)
- CallService(MTH_HIDE, 0, 0);
- }
+ if (LOWORD(wParam == WA_INACTIVE)) {
+ BroadCastContainer(pContainer, DM_CHECKINFOTIP, wParam, lParam);
+ if (PluginConfig.m_MathModAvail)
+ CallService(MTH_HIDE, 0, 0);
+ }
- if (LOWORD(wParam == WA_INACTIVE) && (HWND)lParam != PluginConfig.g_hwndHotkeyHandler && GetParent((HWND)lParam) != hwndDlg) {
- BOOL fTransAllowed = !bSkinned || PluginConfig.m_bIsVista;
+ if (LOWORD(wParam == WA_INACTIVE) && (HWND)lParam != PluginConfig.g_hwndHotkeyHandler && GetParent((HWND)lParam) != hwndDlg) {
+ BOOL fTransAllowed = !bSkinned || PluginConfig.m_bIsVista;
- if (pContainer->dwFlags & CNT_TRANSPARENCY && CMimAPI::m_pSetLayeredWindowAttributes != NULL && fTransAllowed) {
- CMimAPI::m_pSetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)HIWORD(pContainer->settings->dwTransparency), (pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
- }
+ if (pContainer->dwFlags & CNT_TRANSPARENCY && CMimAPI::m_pSetLayeredWindowAttributes != NULL && fTransAllowed) {
+ CMimAPI::m_pSetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)HIWORD(pContainer->settings->dwTransparency), (pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
}
- pContainer->hwndSaved = 0;
+ }
+ pContainer->hwndSaved = 0;
- if (LOWORD(wParam) != WA_ACTIVE) {
- pContainer->MenuBar->Cancel();
- break;
- }
- case WM_MOUSEACTIVATE: {
+ if (LOWORD(wParam) != WA_ACTIVE) {
+ pContainer->MenuBar->Cancel();
+ break;
+ }
+
+ case WM_MOUSEACTIVATE:
+ if (pContainer != NULL) {
TCITEM item;
int curItem = 0;
BOOL fTransAllowed = !bSkinned || PluginConfig.m_WinVerMajor >= 6;
- if (pContainer == NULL)
- break;
-
FlashContainer(pContainer, 0, 0);
pContainer->dwFlashingStarted = 0;
pLastActiveContainer = pContainer;
@@ -1613,18 +1490,17 @@ buttons_done:
}
else if (curItem >= 0)
SendMessage((HWND) item.lParam, WM_ACTIVATE, WA_ACTIVE, 0);
- break;
}
- case DM_CLOSETABATMOUSE: {
- HWND hwndCurrent;
- POINT *pt = (POINT *)lParam;
- int iItem;
- TCITEM item = {0};
+ break;
- hwndCurrent = pContainer->hwndActive;
+ case DM_CLOSETABATMOUSE:
+ {
+ HWND hwndCurrent = pContainer->hwndActive;
+ POINT *pt = (POINT *)lParam;
if ((iItem = GetTabItemFromMouse(hwndTab, pt)) == -1)
break;
- ZeroMemory((void*)&item, sizeof(item));
+
+ TCITEM item = {0};
item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, iItem, &item);
if (item.lParam) {
@@ -1637,35 +1513,30 @@ buttons_done:
else
SendMessage((HWND) item.lParam, WM_CLOSE, 0, 1);
}
- break;
}
- case WM_PAINT: {
- bool fAero = M->isAero();
+ break;
- if (bSkinned || fAero) {
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint(hwndDlg, &ps);
- EndPaint(hwndDlg, &ps);
- return 0;
- }
- break;
+ case WM_PAINT:
+ if (bSkinned || M->isAero()) {
+ PAINTSTRUCT ps;
+ HDC hdc = BeginPaint(hwndDlg, &ps);
+ EndPaint(hwndDlg, &ps);
+ return 0;
}
- case WM_ERASEBKGND: {
- /*
- * avoid flickering of the menu bar when aero is active
- */
- if (!pContainer)
- break;
+ break;
- HDC hdc = (HDC)wParam;
+ case WM_ERASEBKGND:
+ /*
+ * avoid flickering of the menu bar when aero is active
+ */
+ if (pContainer) {
+ HDC hdc = (HDC)wParam;
RECT rc;
GetClientRect(hwndDlg, &rc);
if (M->isAero()) {
- HDC hdcMem;
- HANDLE hbp;
-
- hbp = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rc, BPBF_TOPDOWNDIB, 0, &hdcMem);
+ HDC hdcMem;
+ HANDLE hbp = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rc, BPBF_TOPDOWNDIB, 0, &hdcMem);
FillRect(hdcMem, &rc, CSkin::m_BrushBack);
CSkin::FinalizeBufferedPaint(hbp, &rc);
}
@@ -1679,7 +1550,7 @@ buttons_done:
HPEN hPen = ::CreatePen(PS_SOLID, 1, PluginConfig.m_cRichBorders ? PluginConfig.m_cRichBorders : ::GetSysColor(COLOR_3DSHADOW));
HPEN hOldPen = reinterpret_cast<HPEN>(::SelectObject(hdc, hPen));
LONG x = (pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT ? pContainer->SideBar->getWidth() - 2 + pContainer->tBorder_outer_left :
- rc.right - pContainer->SideBar->getWidth() + 1 - pContainer->tBorder_outer_right);
+ rc.right - pContainer->SideBar->getWidth() + 1 - pContainer->tBorder_outer_right);
::MoveToEx(hdc, x, rc.top, 0);
::LineTo(hdc, x, rc.bottom);
::SelectObject(hdc, hOldPen);
@@ -1691,7 +1562,10 @@ buttons_done:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 1);
return TRUE;
}
- case DM_OPTIONSAPPLIED: {
+ break;
+
+ case DM_OPTIONSAPPLIED:
+ {
char szCname[40];
TCHAR szTitleFormat[200];
TCHAR* szThemeName = NULL;
@@ -1733,20 +1607,24 @@ buttons_done:
pContainer->szAbsThemeFile[0] = pContainer->szRelThemeFile[0] = 0;
pContainer->ltr_templates = pContainer->rtl_templates = 0;
- break;
}
- case DM_STATUSBARCHANGED: {
+ break;
+
+ case DM_STATUSBARCHANGED:
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ {
RECT rc;
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
GetWindowRect(hwndDlg, &rc);
SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, (rc.bottom - rc.top) + 1, SWP_NOZORDER | SWP_NOACTIVATE);
SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER | SWP_NOACTIVATE);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
- if (pContainer->hwndStatus != 0 && pContainer->hwndActive != 0)
- PostMessage(pContainer->hwndActive, DM_STATUSBARCHANGED, 0, 0);
- return 0;
}
- case DM_CONFIGURECONTAINER: {
+ if (pContainer->hwndStatus != 0 && pContainer->hwndActive != 0)
+ PostMessage(pContainer->hwndActive, DM_STATUSBARCHANGED, 0, 0);
+ return 0;
+
+ case DM_CONFIGURECONTAINER:
+ {
DWORD ws, wsold, ex = 0, exold = 0;
HMENU hSysmenu = GetSystemMenu(hwndDlg, FALSE);
HANDLE hContact = 0;
@@ -1757,8 +1635,8 @@ buttons_done:
ws = wsold = GetWindowLongPtr(hwndDlg, GWL_STYLE);
if (!CSkin::m_frameSkins) {
ws = (pContainer->dwFlags & CNT_NOTITLE) ?
- ((IsWindowVisible(hwndDlg) ? WS_VISIBLE : 0) | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_THICKFRAME | (CSkin::m_frameSkins ? WS_SYSMENU : WS_SYSMENU | WS_SIZEBOX)) :
- ws | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
+ ((IsWindowVisible(hwndDlg) ? WS_VISIBLE : 0) | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_THICKFRAME | (CSkin::m_frameSkins ? WS_SYSMENU : WS_SYSMENU | WS_SIZEBOX)) :
+ ws | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
}
SetWindowLongPtr(hwndDlg, GWL_STYLE, ws);
@@ -1805,7 +1683,7 @@ buttons_done:
}
pContainer->dwFlags = ((pContainer->dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT)) ?
- pContainer->dwFlags | CNT_SIDEBAR : pContainer->dwFlags & ~CNT_SIDEBAR);
+ pContainer->dwFlags | CNT_SIDEBAR : pContainer->dwFlags & ~CNT_SIDEBAR);
pContainer->SideBar->Init();
@@ -1841,14 +1719,15 @@ buttons_done:
}
SendMessage(hwndDlg, WM_SIZE, 0, 1);
BroadCastContainer(pContainer, DM_CONFIGURETOOLBAR, 0, 1);
- return 0;
}
+ return 0;
/*
- * search the first and most recent unread events in all client tabs...
- * return all information via a RECENTINFO structure (tab indices,
- * window handles and timestamps).
- */
- case DM_QUERYRECENT: {
+ * search the first and most recent unread events in all client tabs...
+ * return all information via a RECENTINFO structure (tab indices,
+ * window handles and timestamps).
+ */
+ case DM_QUERYRECENT:
+ {
int i;
int iItems = TabCtrl_GetItemCount(hwndTab);
RECENTINFO *ri = (RECENTINFO *)lParam;
@@ -1875,16 +1754,17 @@ buttons_done:
}
}
}
- return 0;
}
+ return 0;
/*
- * search tab with either next or most recent unread message and select it
- */
- case DM_QUERYPENDING: {
- NMHDR nmhdr;
+ * search tab with either next or most recent unread message and select it
+ */
+ case DM_QUERYPENDING:
+ {
RECENTINFO ri;
-
SendMessage(hwndDlg, DM_QUERYRECENT, 0, (LPARAM)&ri);
+
+ NMHDR nmhdr;
nmhdr.code = TCN_SELCHANGE;
if (wParam == DM_QUERY_NEXT && ri.iFirstIndex != -1) {
@@ -1895,10 +1775,11 @@ buttons_done:
TabCtrl_SetCurSel(hwndTab, ri.iMostRecent);
SendMessage(hwndDlg, WM_NOTIFY, 0, (LPARAM) &nmhdr);
}
- return 0;
}
+ return 0;
- case DM_SETICON: {
+ case DM_SETICON:
+ {
HICON hIconMsg = PluginConfig.g_IconMsgEvent;
TWindowData* dat = (TWindowData *)wParam;
HICON hIconBig = (dat && dat->cache) ? LoadSkinnedProtoIconBig(dat->cache->getActiveProto(), dat->cache->getActiveStatus()) : 0;
@@ -1946,8 +1827,8 @@ buttons_done:
}
}
/*
- * default handling (no win7 taskbar)
- */
+ * default handling (no win7 taskbar)
+ */
if ((HICON)lParam == PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]) { // always set typing icon, but don't save it...
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)PluginConfig.g_IconTypingEventBig);
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, lParam);
@@ -1964,9 +1845,11 @@ buttons_done:
if (0 != hIconBig && reinterpret_cast<HICON>(CALLSERVICE_NOTFOUND) != hIconBig)
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(hIconBig));
pContainer->hIcon = (lParam == (LPARAM)hIconMsg) ? STICK_ICON_MSG : 0;
- return 0;
}
- case WM_DRAWITEM: {
+ return 0;
+
+ case WM_DRAWITEM:
+ {
int cx = PluginConfig.m_smcxicon;
int cy = PluginConfig.m_smcyicon;
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
@@ -1978,12 +1861,14 @@ buttons_done:
DrawStatusIcons(dat, dis->hDC, dis->rcItem, 2);
return TRUE;
}
- return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- }
- case WM_MEASUREITEM: {
- return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
}
- case DM_QUERYCLIENTAREA: {
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+
+ case WM_MEASUREITEM:
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+
+ case DM_QUERYCLIENTAREA:
+ {
RECT *rc = (RECT *)lParam;
if (rc) {
if (!IsIconic(hwndDlg))
@@ -1992,210 +1877,203 @@ buttons_done:
CopyRect(rc, &pContainer->rcSaved);
AdjustTabClientRect(pContainer, rc);
}
- return 0;
}
- case WM_DESTROY: {
- int i = 0;
- TCITEM item;
- SESSION_INFO *node = m_WndList;
+ return 0;
- if (PluginConfig.g_FlashAvatarAvail) { // destroy own flash avatar
- FLASHAVATAR fa = {0};
- struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ case WM_DESTROY:
+ if (PluginConfig.g_FlashAvatarAvail) { // destroy own flash avatar
+ FLASHAVATAR fa = {0};
+ struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- fa.id = 25367;
- fa.cProto = dat ? dat->szProto : NULL;
- CallService(MS_FAVATAR_DESTROY, (WPARAM)&fa, 0);
- }
- ZeroMemory((void*)&item, sizeof(item));
- pContainer->hwnd = 0;
- pContainer->hwndActive = 0;
- pContainer->hMenuContext = 0;
- if (pContainer->hwndStatus)
- DestroyWindow(pContainer->hwndStatus);
-
- // free private theme...
- if (pContainer->theme.isPrivate) {
- free(pContainer->ltr_templates);
- free(pContainer->rtl_templates);
- free(pContainer->theme.logFonts);
- free(pContainer->theme.fontColors);
- free(pContainer->theme.rtfFonts);
- }
+ fa.id = 25367;
+ fa.cProto = dat ? dat->szProto : NULL;
+ CallService(MS_FAVATAR_DESTROY, (WPARAM)&fa, 0);
+ }
+ ZeroMemory((void*)&item, sizeof(item));
+ pContainer->hwnd = 0;
+ pContainer->hwndActive = 0;
+ pContainer->hMenuContext = 0;
+ if (pContainer->hwndStatus)
+ DestroyWindow(pContainer->hwndStatus);
+
+ // free private theme...
+ if (pContainer->theme.isPrivate) {
+ free(pContainer->ltr_templates);
+ free(pContainer->rtl_templates);
+ free(pContainer->theme.logFonts);
+ free(pContainer->theme.fontColors);
+ free(pContainer->theme.rtfFonts);
+ }
- if (pContainer->hwndTip)
- DestroyWindow(pContainer->hwndTip);
- RemoveContainerFromList(pContainer);
- if (PluginConfig.m_MathModAvail)
- CallService(MTH_HIDE, 0, 0);
+ if (pContainer->hwndTip)
+ DestroyWindow(pContainer->hwndTip);
+ RemoveContainerFromList(pContainer);
+ if (PluginConfig.m_MathModAvail)
+ CallService(MTH_HIDE, 0, 0);
+ {
+ SESSION_INFO *node = m_WndList;
while (node) {
- if (node->pContainer == pContainer) {
+ if (node->pContainer == pContainer)
node->pContainer = 0;
- }
node = node->next;
}
- if (pContainer->cachedDC) {
- SelectObject(pContainer->cachedDC, pContainer->oldHBM);
- DeleteObject(pContainer->cachedHBM);
- DeleteDC(pContainer->cachedDC);
- }
- if (pContainer->cachedToolbarDC) {
- SelectObject(pContainer->cachedToolbarDC, pContainer->oldhbmToolbarBG);
- DeleteObject(pContainer->hbmToolbarBG);
- DeleteDC(pContainer->cachedToolbarDC);
- }
- return 0;
}
+ if (pContainer->cachedDC) {
+ SelectObject(pContainer->cachedDC, pContainer->oldHBM);
+ DeleteObject(pContainer->cachedHBM);
+ DeleteDC(pContainer->cachedDC);
+ }
+ if (pContainer->cachedToolbarDC) {
+ SelectObject(pContainer->cachedToolbarDC, pContainer->oldhbmToolbarBG);
+ DeleteObject(pContainer->hbmToolbarBG);
+ DeleteDC(pContainer->cachedToolbarDC);
+ }
+ return 0;
+
+ case WM_NCDESTROY:
+ if (pContainer) {
+ delete pContainer->MenuBar;
+ delete pContainer->SideBar;
+ if (pContainer->settings != &PluginConfig.globalContainerSettings)
+ free(pContainer->settings);
+ free(pContainer);
+ }
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ break;
- case WM_NCDESTROY:
- if (pContainer) {
- delete pContainer->MenuBar;
- delete pContainer->SideBar;
- if (pContainer->settings != &PluginConfig.globalContainerSettings)
- free(pContainer->settings);
- free(pContainer);
- }
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- break;
+ case WM_CLOSE:
+ if (PluginConfig.m_HideOnClose && !lParam) {
+ ShowWindow(hwndDlg, SW_HIDE);
+ pContainer->fHidden = true;
+ }
+ else {
+ WINDOWPLACEMENT wp;
+ char szCName[40];
+ char *szSetting = "CNTW_";
- case WM_CLOSE: {
- //mad
- if (PluginConfig.m_HideOnClose && !lParam) {
- ShowWindow(hwndDlg, SW_HIDE);
- pContainer->fHidden = true;
+ if (TabCtrl_GetItemCount(hwndTab) > 1) {
+ LRESULT res = CWarning::show(CWarning::WARN_CLOSEWINDOW, MB_YESNOCANCEL|MB_ICONQUESTION);
+ if (IDNO == res || IDCANCEL == res)
+ break;
}
- else {
- WINDOWPLACEMENT wp;
- char szCName[40];
- char *szSetting = "CNTW_";
- if (TabCtrl_GetItemCount(hwndTab) > 1) {
- LRESULT res = CWarning::show(CWarning::WARN_CLOSEWINDOW, MB_YESNOCANCEL|MB_ICONQUESTION);
- if (IDNO == res || IDCANCEL == res)
- break;
- }
-
- if (lParam == 0 && TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_MSGTABS)) > 0) { // dont ask if container is empty (no tabs)
- int clients = TabCtrl_GetItemCount(hwndTab), i;
- TCITEM item = {0};
- int iOpenJobs = 0;
+ if (lParam == 0 && TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_MSGTABS)) > 0) { // dont ask if container is empty (no tabs)
+ int clients = TabCtrl_GetItemCount(hwndTab), i;
+ TCITEM item = {0};
+ int iOpenJobs = 0;
- item.mask = TCIF_PARAM;
- for (i=0; i < clients; i++) {
- TabCtrl_GetItem(hwndTab, i, &item);
- if (item.lParam && IsWindow((HWND)item.lParam)) {
- SendMessage((HWND)item.lParam, DM_CHECKQUEUEFORCLOSE, 0, (LPARAM)&iOpenJobs);
- }
+ item.mask = TCIF_PARAM;
+ for (i=0; i < clients; i++) {
+ TabCtrl_GetItem(hwndTab, i, &item);
+ if (item.lParam && IsWindow((HWND)item.lParam)) {
+ SendMessage((HWND)item.lParam, DM_CHECKQUEUEFORCLOSE, 0, (LPARAM)&iOpenJobs);
}
- if (iOpenJobs && pContainer) {
- LRESULT result;
+ }
+ if (iOpenJobs && pContainer) {
+ LRESULT result;
- if (pContainer->exFlags & CNT_EX_CLOSEWARN)
- return TRUE;
+ if (pContainer->exFlags & CNT_EX_CLOSEWARN)
+ return TRUE;
- pContainer->exFlags |= CNT_EX_CLOSEWARN;
- result = SendQueue::WarnPendingJobs(iOpenJobs);
- pContainer->exFlags &= ~CNT_EX_CLOSEWARN;
- if (result == IDNO)
- return TRUE;
- }
+ pContainer->exFlags |= CNT_EX_CLOSEWARN;
+ result = SendQueue::WarnPendingJobs(iOpenJobs);
+ pContainer->exFlags &= ~CNT_EX_CLOSEWARN;
+ if (result == IDNO)
+ return TRUE;
}
+ }
- ZeroMemory((void*)&wp, sizeof(wp));
- wp.length = sizeof(wp);
- /*
- * save geometry information to the database...
- */
- if (!(pContainer->dwFlags & CNT_GLOBALSIZE)) {
- if (GetWindowPlacement(hwndDlg, &wp) != 0) {
- if (pContainer->isCloned && pContainer->hContactFrom != 0) {
- HANDLE hContact;
- int i;
- TCITEM item = {0};
-
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, TabCtrl_GetCurSel(hwndTab), &item);
- SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- M->WriteByte(hContact, SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd==SW_SHOWMAXIMIZED)?1:0));
-
- for (i=0; i < TabCtrl_GetItemCount(hwndTab); i++) {
- if (TabCtrl_GetItem(hwndTab, i, &item)) {
- SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- M->WriteDword(hContact, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left);
- M->WriteDword(hContact, SRMSGMOD_T, "splity", wp.rcNormalPosition.top);
- M->WriteDword(hContact, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left);
- M->WriteDword(hContact, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
- }
+ ZeroMemory((void*)&wp, sizeof(wp));
+ wp.length = sizeof(wp);
+ /*
+ * save geometry information to the database...
+ */
+ if (!(pContainer->dwFlags & CNT_GLOBALSIZE)) {
+ if (GetWindowPlacement(hwndDlg, &wp) != 0) {
+ if (pContainer->isCloned && pContainer->hContactFrom != 0) {
+ HANDLE hContact;
+ int i;
+ TCITEM item = {0};
+
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, TabCtrl_GetCurSel(hwndTab), &item);
+ SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ M->WriteByte(hContact, SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd==SW_SHOWMAXIMIZED)?1:0));
+
+ for (i=0; i < TabCtrl_GetItemCount(hwndTab); i++) {
+ if (TabCtrl_GetItem(hwndTab, i, &item)) {
+ SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ M->WriteDword(hContact, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left);
+ M->WriteDword(hContact, SRMSGMOD_T, "splity", wp.rcNormalPosition.top);
+ M->WriteDword(hContact, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left);
+ M->WriteDword(hContact, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
}
}
- else {
- _snprintf(szCName, 40, "%s%dx", szSetting, pContainer->iContainerIndex);
- M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.left);
- _snprintf(szCName, 40, "%s%dy", szSetting, pContainer->iContainerIndex);
- M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.top);
- _snprintf(szCName, 40, "%s%dwidth", szSetting, pContainer->iContainerIndex);
- M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
- _snprintf(szCName, 40, "%s%dheight", szSetting, pContainer->iContainerIndex);
- M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
-
- M->WriteByte(SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd==SW_SHOWMAXIMIZED)?1:0));
- }
+ }
+ else {
+ _snprintf(szCName, 40, "%s%dx", szSetting, pContainer->iContainerIndex);
+ M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.left);
+ _snprintf(szCName, 40, "%s%dy", szSetting, pContainer->iContainerIndex);
+ M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.top);
+ _snprintf(szCName, 40, "%s%dwidth", szSetting, pContainer->iContainerIndex);
+ M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
+ _snprintf(szCName, 40, "%s%dheight", szSetting, pContainer->iContainerIndex);
+ M->WriteDword(SRMSGMOD_T, szCName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
+
+ M->WriteByte(SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd==SW_SHOWMAXIMIZED)?1:0));
}
}
- // clear temp flags which should NEVER be saved...
+ }
+ // clear temp flags which should NEVER be saved...
- if (pContainer->isCloned && pContainer->hContactFrom != 0) {
- HANDLE hContact;
- int i;
- TCITEM item = {0};
+ if (pContainer->isCloned && pContainer->hContactFrom != 0) {
+ HANDLE hContact;
+ int i;
+ TCITEM item = {0};
- item.mask = TCIF_PARAM;
- pContainer->dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED);
- for (i=0; i < TabCtrl_GetItemCount(hwndTab); i++) {
- if (TabCtrl_GetItem(hwndTab, i, &item)) {
- SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- //Utils::WriteContainerSettingsToDB(hContact, pContainer->settings);
-
- mir_snprintf(szCName, 40, "%s_theme", szSetting);
- if (lstrlen(pContainer->szRelThemeFile) > 1) {
- if (pContainer->fPrivateThemeChanged == TRUE) {
- M->pathToRelative(pContainer->szRelThemeFile, pContainer->szAbsThemeFile);
- M->WriteTString(hContact, SRMSGMOD_T, szCName, pContainer->szRelThemeFile);
- pContainer->fPrivateThemeChanged = FALSE;
- }
- }
- else {
- DBDeleteContactSetting(hContact, SRMSGMOD_T, szCName);
+ item.mask = TCIF_PARAM;
+ pContainer->dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED);
+ for (i=0; i < TabCtrl_GetItemCount(hwndTab); i++) {
+ if (TabCtrl_GetItem(hwndTab, i, &item)) {
+ SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ //Utils::WriteContainerSettingsToDB(hContact, pContainer->settings);
+
+ mir_snprintf(szCName, 40, "%s_theme", szSetting);
+ if (lstrlen(pContainer->szRelThemeFile) > 1) {
+ if (pContainer->fPrivateThemeChanged == TRUE) {
+ M->pathToRelative(pContainer->szRelThemeFile, pContainer->szAbsThemeFile);
+ M->WriteTString(hContact, SRMSGMOD_T, szCName, pContainer->szRelThemeFile);
pContainer->fPrivateThemeChanged = FALSE;
}
-
}
+ else {
+ db_unset(hContact, SRMSGMOD_T, szCName);
+ pContainer->fPrivateThemeChanged = FALSE;
+ }
+
}
}
- else
- Utils::SaveContainerSettings(pContainer, szSetting);
- DestroyWindow(hwndDlg);
}
- break;
+ else
+ Utils::SaveContainerSettings(pContainer, szSetting);
+ DestroyWindow(hwndDlg);
}
- default:
- return FALSE;
}
return FALSE;
}
/*
- * search the list of tabs and return the tab (by index) which "belongs" to the given
- * hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
- * the dialog handle is stored in the TCITEM.lParam field, because we need
- * to know the owner of the tab.
- *
- * hwndTab: handle of the tab control itself.
- * hwnd: handle of a message dialog.
- *
- * returns the tab index (zero based), -1 if no tab is found (which SHOULD not
- * really happen, but who knows... ;))
- */
+* search the list of tabs and return the tab (by index) which "belongs" to the given
+* hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
+* the dialog handle is stored in the TCITEM.lParam field, because we need
+* to know the owner of the tab.
+*
+* hwndTab: handle of the tab control itself.
+* hwnd: handle of a message dialog.
+*
+* returns the tab index (zero based), -1 if no tab is found (which SHOULD not
+* really happen, but who knows... ;))
+*/
int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd)
{
@@ -2219,17 +2097,17 @@ int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd)
/*
- * search the list of tabs and return the tab (by index) which "belongs" to the given
- * hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
- * the dialog handle is stored in the TCITEM.lParam field, because we need
- * to know the owner of the tab.
- *
- * hwndTab: handle of the tab control itself.
- * hwnd: handle of a message dialog.
- *
- * returns the tab index (zero based), -1 if no tab is found (which SHOULD not
- * really happen, but who knows... ;))
- */
+* search the list of tabs and return the tab (by index) which "belongs" to the given
+* hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
+* the dialog handle is stored in the TCITEM.lParam field, because we need
+* to know the owner of the tab.
+*
+* hwndTab: handle of the tab control itself.
+* hwnd: handle of a message dialog.
+*
+* returns the tab index (zero based), -1 if no tab is found (which SHOULD not
+* really happen, but who knows... ;))
+*/
HWND TSAPI GetHWNDFromTabIndex(HWND hwndTab, int idx)
{
@@ -2243,19 +2121,19 @@ HWND TSAPI GetHWNDFromTabIndex(HWND hwndTab, int idx)
item.mask = TCIF_PARAM;
for (i=0; i < iItems; i++)
- {
+ {
TabCtrl_GetItem(hwndTab, i, &item);
- if (i == idx)
- return (HWND)item.lParam;
+ if (i == idx)
+ return (HWND)item.lParam;
}
return NULL;
}
/*
- * activates the tab belonging to the given client HWND (handle of the actual
- * message window.
- */
+* activates the tab belonging to the given client HWND (handle of the actual
+* message window.
+*/
int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd)
{
@@ -2273,10 +2151,10 @@ int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd)
}
/*
- * returns the index of the tab under the mouse pointer. Used for
- * context menu popup and tooltips
- * pt: mouse coordinates, obtained from GetCursorPos()
- */
+* returns the index of the tab under the mouse pointer. Used for
+* context menu popup and tooltips
+* pt: mouse coordinates, obtained from GetCursorPos()
+*/
int TSAPI GetTabItemFromMouse(HWND hwndTab, POINT *pt)
{
@@ -2292,26 +2170,26 @@ int TSAPI GetTabItemFromMouse(HWND hwndTab, POINT *pt)
/*enumerates tabs and closes all of them, but the one in dat */
void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat)
{
- for (int idxt = 0; idxt < dat.pContainer->iChilds; )
- {
- HWND otherTab = GetHWNDFromTabIndex(hwndTab, idxt);
- if (otherTab != NULL && otherTab != dat.hwnd)
- {
- SendMessage(otherTab, WM_CLOSE, 1, 0);
- }
- else
- ++idxt;
- }
+ for (int idxt = 0; idxt < dat.pContainer->iChilds; )
+ {
+ HWND otherTab = GetHWNDFromTabIndex(hwndTab, idxt);
+ if (otherTab != NULL && otherTab != dat.hwnd)
+ {
+ SendMessage(otherTab, WM_CLOSE, 1, 0);
+ }
+ else
+ ++idxt;
+ }
}
/*
- * cut off contact name to the option value set via Options->Tabbed messaging
- * some people were requesting this, because really long contact list names
- * are causing extraordinary wide tabs and these are looking ugly and wasting
- * screen space.
- *
- * size = max length of target string
- */
+* cut off contact name to the option value set via Options->Tabbed messaging
+* some people were requesting this, because really long contact list names
+* are causing extraordinary wide tabs and these are looking ugly and wasting
+* screen space.
+*
+* size = max length of target string
+*/
int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size)
{
@@ -2331,8 +2209,8 @@ int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size
}
/*
- * functions for handling the linked list of struct ContainerWindowData *foo
- */
+* functions for handling the linked list of struct ContainerWindowData *foo
+*/
static struct TContainerData* TSAPI AppendToContainerList(struct TContainerData *pContainer) {
struct TContainerData *pCurrent = 0;
@@ -2399,11 +2277,11 @@ static struct TContainerData* TSAPI RemoveContainerFromList(struct TContainerDat
}
/*
- * calls the TabCtrl_AdjustRect to calculate the "real" client area of the tab.
- * also checks for the option "hide tabs when only one tab open" and adjusts
- * geometry if necessary
- * rc is the RECT obtained by GetClientRect(hwndTab)
- */
+* calls the TabCtrl_AdjustRect to calculate the "real" client area of the tab.
+* also checks for the option "hide tabs when only one tab open" and adjusts
+* geometry if necessary
+* rc is the RECT obtained by GetClientRect(hwndTab)
+*/
void TSAPI AdjustTabClientRect(struct TContainerData *pContainer, RECT *rc)
{
@@ -2463,9 +2341,9 @@ void TSAPI AdjustTabClientRect(struct TContainerData *pContainer, RECT *rc)
}
/*
- * retrieve the container name for the given contact handle.
- * if none is assigned, return the name of the default container
- */
+* retrieve the container name for the given contact handle.
+* if none is assigned, return the name of the default container
+*/
int TSAPI GetContainerNameForContact(HANDLE hContact, TCHAR *szName, int iNameLen)
{
@@ -2504,7 +2382,8 @@ int TSAPI GetContainerNameForContact(HANDLE hContact, TCHAR *szName, int iNameLe
return 0;
}
-void TSAPI DeleteContainer(int iIndex) {
+void TSAPI DeleteContainer(int iIndex)
+{
DBVARIANT dbv;
char szIndex[10], szSetting[CONTAINER_NAMELEN + 30];
char *szKey = "TAB_ContainersW";
@@ -2525,29 +2404,30 @@ void TSAPI DeleteContainer(int iIndex) {
if (!M->GetTString(hhContact, SRMSGMOD_T, szSubKey, &dbv_c)) {
TCHAR *wszString = dbv_c.ptszVal;
if (_tcscmp(wszString, wszContainerName) && lstrlen(wszString) == lstrlen(wszContainerName))
- DBDeleteContactSetting(hhContact, SRMSGMOD_T, "containerW");
+ db_unset(hhContact, SRMSGMOD_T, "containerW");
DBFreeVariant(&dbv_c);
}
hhContact = db_find_next(hhContact);
}
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%d_Flags", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%d_Trans", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dwidth", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dheight", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dx", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%dy", szSettingP, iIndex);
- DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
+ db_unset(NULL, SRMSGMOD_T, szSetting);
}
DBFreeVariant(&dbv);
}
}
-void TSAPI RenameContainer(int iIndex, const TCHAR *szNew) {
+void TSAPI RenameContainer(int iIndex, const TCHAR *szNew)
+{
DBVARIANT dbv;
char *szKey = "TAB_ContainersW";
char *szSettingP = "CNTW_";
@@ -2608,7 +2488,7 @@ HMENU TSAPI BuildContainerMenu()
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
if (_tcsncmp(dbv.ptszVal, _T("**free**"), CONTAINER_NAMELEN))
AppendMenu(hMenu, MF_STRING, IDM_CONTAINERMENU + i, !_tcscmp(dbv.ptszVal, _T("default")) ?
- TranslateT("Default container") : dbv.ptszVal);
+ TranslateT("Default container") : dbv.ptszVal);
}
DBFreeVariant(&dbv);
i++;
@@ -2620,7 +2500,8 @@ HMENU TSAPI BuildContainerMenu()
return hMenu;
}
-HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) {
+HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg)
+{
HMENU hMCContextMenu = 0, hMCSubForce = 0, hMCSubDefault = 0, hMenu = 0;
DBVARIANT dbv;
int iNumProtos = 0, i = 0, iDefaultProtoByNum = 0;
@@ -2669,7 +2550,7 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) {
szStatusText = (TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR);
}
mir_sntprintf(szMenuLine, SIZEOF(szMenuLine), _T("%s: %s [%s] %s"), acc->tszAccountName, nick, szStatusText,
- i == isForced ? TranslateT("(Forced)") : _T(""));
+ i == isForced ? TranslateT("(Forced)") : _T(""));
iChecked = MF_UNCHECKED;
if (hContactMostOnline != 0 && hContactMostOnline == handle)
iChecked = MF_CHECKED;
@@ -2687,10 +2568,10 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) {
}
/*
- * flashes the container
- * iMode != 0: turn on flashing
- * iMode == 0: turn off flashing
- */
+* flashes the container
+* iMode != 0: turn on flashing
+* iMode == 0: turn off flashing
+*/
void TSAPI FlashContainer(struct TContainerData *pContainer, int iMode, int iCount) {
FLASHWINFO fwi;
@@ -2713,15 +2594,15 @@ void TSAPI FlashContainer(struct TContainerData *pContainer, int iMode, int iCou
fwi.dwTimeout = M->GetDword("flashinterval", 1000);
}
- else
- fwi.dwFlags = FLASHW_STOP;
+ else fwi.dwFlags = FLASHW_STOP;
fwi.hwnd = pContainer->hwnd;
pContainer->dwFlashingStarted = GetTickCount();
CMimAPI::m_MyFlashWindowEx(&fwi);
}
-void TSAPI ReflashContainer(struct TContainerData *pContainer) {
+void TSAPI ReflashContainer(struct TContainerData *pContainer)
+{
DWORD dwStartTime = pContainer->dwFlashingStarted;
if (GetForegroundWindow() == pContainer->hwnd || GetActiveWindow() == pContainer->hwnd) // dont care about active windows
@@ -2749,20 +2630,18 @@ void TSAPI ReflashContainer(struct TContainerData *pContainer) {
}
/*
- * broadcasts a message to all child windows (tabs/sessions)
- */
-
-void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam, BYTE bType) {
- int i;
- TCITEM item;
+* broadcasts a message to all child windows (tabs/sessions)
+*/
+void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam, BYTE bType)
+{
HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS);
- ZeroMemory((void*)&item, sizeof(item));
+ TCITEM item = { 0 };
item.mask = TCIF_PARAM;
int nCount = TabCtrl_GetItemCount(hwndTab);
- for (i=0; i < nCount; i++) {
+ for (int i=0; i < nCount; i++) {
TabCtrl_GetItem(hwndTab, i, &item);
if (IsWindow((HWND)item.lParam)) {
if (bType == SESSIONTYPE_ANY)