diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/SmileyAdd/src/AniSmileyObject.cpp | 6 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/dlgboxsubclass.cpp | 4 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/general.h | 4 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/richcall.cpp | 68 | ||||
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 217 |
5 files changed, 146 insertions, 153 deletions
diff --git a/plugins/SmileyAdd/src/AniSmileyObject.cpp b/plugins/SmileyAdd/src/AniSmileyObject.cpp index 42a63d3549..0412aa5cd8 100644 --- a/plugins/SmileyAdd/src/AniSmileyObject.cpp +++ b/plugins/SmileyAdd/src/AniSmileyObject.cpp @@ -440,11 +440,13 @@ static void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) void DestroyAniSmileys(void)
{
- if (timerId && (timerId+1))
- {
+ if (timerId && (timerId+1)) {
KillTimer(NULL, timerId);
timerId = 0;
}
+
+ for (int i=0; i < regAniSmileys.getCount(); i++)
+ delete regAniSmileys[i];
regAniSmileys.destroy();
}
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index 9184bf10ab..656c7130cf 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -506,8 +506,8 @@ static int MsgDlgHook(WPARAM, LPARAM lParam) case MSG_WINDOW_EVT_CLOSE:
if (wndEvtData->cbSize >= sizeof(MessageWindowEventData) && wndEvtData->hwndLog)
{
- CloseRichCallback(wndEvtData->hwndLog, true);
- CloseRichOwnerCallback(wndEvtData->hwndWindow, true);
+ CloseRichCallback(wndEvtData->hwndLog);
+ CloseRichOwnerCallback(wndEvtData->hwndWindow);
}
break;
}
diff --git a/plugins/SmileyAdd/src/general.h b/plugins/SmileyAdd/src/general.h index 8cc13c5619..93d9a2e7d6 100644 --- a/plugins/SmileyAdd/src/general.h +++ b/plugins/SmileyAdd/src/general.h @@ -216,8 +216,8 @@ void DestroyGdiPlus(void); void ReportError(const TCHAR* errmsg);
HICON GetDefaultIcon(bool copy = true);
-void CloseRichCallback(HWND hwnd, bool force);
-void CloseRichOwnerCallback(HWND hwnd, bool force);
+void CloseRichCallback(HWND hwnd);
+void CloseRichOwnerCallback(HWND hwnd);
bool SetRichCallback(HWND hwnd, HANDLE hContact, bool subany, bool subnew);
void SetRichOwnerCallback(HWND hwnd, HWND hwndInput, HWND hwndLog);
void ProcessAllInputAreas(bool restoreText);
diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp index 463276baf4..23c1383f9f 100644 --- a/plugins/SmileyAdd/src/richcall.cpp +++ b/plugins/SmileyAdd/src/richcall.cpp @@ -217,7 +217,7 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP switch(uMsg) {
case WM_DESTROY:
- CloseRichCallback(hwnd, false);
+ CloseRichCallback(hwnd);
break;
case WM_COPY:
@@ -261,10 +261,6 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP LRESULT result = mir_callNextSubclass(hwnd, RichEditSubclass, uMsg, wParam, lParam);
switch(uMsg) {
- case WM_DESTROY:
- CloseRichCallback(hwnd, true);
- break;
-
case WM_MOUSEMOVE:
SetTooltip(LOWORD(lParam), HIWORD(lParam), hwnd, rdt);
break;
@@ -348,16 +344,14 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP return result;
}
-void CloseRichCallback(HWND hwnd, bool force)
+void CloseRichCallback(HWND hwnd)
{
int ind = g_RichEditList.getIndex((RichEditData*)&hwnd);
if ( ind != -1 ) {
RichEditData* rdt = g_RichEditList[ind];
- if (force) {
- if (rdt->hToolTip) DestroyWindow(rdt->hToolTip);
- delete rdt;
- g_RichEditList.remove(ind);
- }
+ if (rdt->hToolTip) DestroyWindow(rdt->hToolTip);
+ delete rdt;
+ g_RichEditList.remove(ind);
}
}
@@ -400,6 +394,17 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara return 0;
switch(uMsg) {
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
+ RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
+ if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
+ rdt->dontReplace = true;
+ CHARRANGE sel = allsel;
+ ReplaceSmileysWithText(rdt->hwnd, sel, false);
+ }
+ }
+ break;
+
case WM_DESTROY:
if ( !Miranda_Terminated()) {
CHARRANGE sel = allsel;
@@ -408,36 +413,21 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara if (rdto->hwndLog)
ReplaceSmileysWithText(rdto->hwndLog, sel, false);
}
- else {
- RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
- if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
- CHARRANGE sel = allsel;
- rdt->dontReplace = true;
- ReplaceSmileysWithText(rdt->hwnd, sel, false);
- }
- }
- CloseRichOwnerCallback(hwnd, false);
- break;
- case WM_COMMAND:
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
- RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
- if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
- rdt->dontReplace = true;
- CHARRANGE sel = allsel;
- ReplaceSmileysWithText(rdt->hwnd, sel, false);
- }
+ RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
+ if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
+ CHARRANGE sel = allsel;
+ rdt->dontReplace = true;
+ ReplaceSmileysWithText(rdt->hwnd, sel, false);
}
+
+ CloseRichOwnerCallback(hwnd);
break;
}
LRESULT result = mir_callNextSubclass(hwnd, RichEditOwnerSubclass, uMsg, wParam, lParam);
switch(uMsg) {
- case WM_DESTROY:
- CloseRichOwnerCallback(hwnd, true);
- break;
-
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
@@ -452,16 +442,16 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara return result;
}
-void CloseRichOwnerCallback(HWND hwnd, bool force)
+void CloseRichOwnerCallback(HWND hwnd)
{
int ind = g_RichEditOwnerList.getIndex((RichEditOwnerData*)&hwnd);
if (ind == -1)
return;
RichEditOwnerData* rdto = g_RichEditOwnerList[ind];
- if (rdto && force) {
- CloseRichCallback(rdto->hwndInput, true);
- CloseRichCallback(rdto->hwndLog, true);
+ if (rdto) {
+ CloseRichCallback(rdto->hwndInput);
+ CloseRichCallback(rdto->hwndLog);
delete rdto;
g_RichEditOwnerList.remove(ind);
@@ -504,10 +494,10 @@ void RichEditData_Destroy(void) {
int i;
for (i=g_RichEditList.getCount(); i--; )
- CloseRichCallback(g_RichEditList[i]->hwnd, true);
+ CloseRichCallback(g_RichEditList[i]->hwnd);
g_RichEditList.destroy();
for (i=g_RichEditOwnerList.getCount(); i--; )
- CloseRichOwnerCallback(g_RichEditOwnerList[i]->hwnd, true);
+ CloseRichOwnerCallback(g_RichEditOwnerList[i]->hwnd);
g_RichEditOwnerList.destroy();
}
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 9568e34161..f1a3aa3ade 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -66,66 +66,69 @@ static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, HAN void TSAPI SetAeroMargins(TContainerData *pContainer)
{
- if (M->isAero() && pContainer && !CSkin::m_skinEnabled) {
- MARGINS m;
- TWindowData *dat = (TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- RECT rcWnd;
- POINT pt;
- LONG sbar_left = 0, sbar_right = 0;
-
- if (dat) {
- if (dat->bType == SESSIONTYPE_IM) {
- if (dat->Panel->isActive())
- GetWindowRect(GetDlgItem(dat->hwnd, IDC_LOG), &rcWnd);
- else
- GetWindowRect(dat->hwnd, &rcWnd);
- }
- else {
- if (dat->Panel->isActive())
- GetWindowRect(GetDlgItem(dat->hwnd, IDC_CHAT_LOG), &rcWnd);
- else
- GetWindowRect(dat->hwnd, &rcWnd);
- }
-
- pt.x = rcWnd.left;
- pt.y = rcWnd.top;
- ScreenToClient(pContainer->hwnd, &pt);
- m.cyTopHeight = pt.y;
- pContainer->MenuBar->setAero(true);
+ if ( !M->isAero() || !pContainer || CSkin::m_skinEnabled) {
+ pContainer->MenuBar->setAero(false);
+ return;
+ }
- /*
- * bottom part
- */
+ TWindowData *dat = (TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ if (!dat)
+ return;
+ RECT rcWnd;
+ if (dat->bType == SESSIONTYPE_IM) {
+ if (dat->Panel->isActive())
+ GetWindowRect(GetDlgItem(dat->hwnd, IDC_LOG), &rcWnd);
+ else
GetWindowRect(dat->hwnd, &rcWnd);
- pt.x = rcWnd.left;
- if (!pContainer->SideBar->isActive())
- pt.y = rcWnd.bottom + ((pContainer->iChilds > 1 || !(pContainer->dwFlags & CNT_HIDETABS)) ? pContainer->tBorder : 0);
- else {
- pt.y = rcWnd.bottom;
- sbar_left = (pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT ? pContainer->SideBar->getWidth() : 0);
- sbar_right = (pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_RIGHT ? pContainer->SideBar->getWidth() : 0);
- }
- ScreenToClient(pContainer->hwnd, &pt);
- GetClientRect(pContainer->hwnd, &rcWnd);
- m.cyBottomHeight = (rcWnd.bottom - pt.y);
+ }
+ else {
+ if (dat->Panel->isActive())
+ GetWindowRect(GetDlgItem(dat->hwnd, IDC_CHAT_LOG), &rcWnd);
+ else
+ GetWindowRect(dat->hwnd, &rcWnd);
+ }
- if (m.cyBottomHeight < 0 || m.cyBottomHeight >= rcWnd.bottom)
- m.cyBottomHeight = 0;
+ POINT pt = { rcWnd.left, rcWnd.top };
+ ScreenToClient(pContainer->hwnd, &pt);
- m.cxLeftWidth = pContainer->tBorder_outer_left;
- m.cxRightWidth = pContainer->tBorder_outer_right;
- m.cxLeftWidth += sbar_left;
- m.cxRightWidth += sbar_right;
+ MARGINS m;
+ m.cyTopHeight = pt.y;
+ pContainer->MenuBar->setAero(true);
- if (memcmp(&m, &pContainer->mOld, sizeof(MARGINS)) != 0) {
- pContainer->mOld = m;
- CMimAPI::m_pfnDwmExtendFrameIntoClientArea(pContainer->hwnd, &m);
- }
- }
+ /*
+ * bottom part
+ */
+
+ GetWindowRect(dat->hwnd, &rcWnd);
+ pt.x = rcWnd.left;
+
+ LONG sbar_left, sbar_right;
+ if (!pContainer->SideBar->isActive()) {
+ pt.y = rcWnd.bottom + ((pContainer->iChilds > 1 || !(pContainer->dwFlags & CNT_HIDETABS)) ? pContainer->tBorder : 0);
+ sbar_left = 0, sbar_right = 0;
+ }
+ else {
+ pt.y = rcWnd.bottom;
+ sbar_left = (pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT ? pContainer->SideBar->getWidth() : 0);
+ sbar_right = (pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_RIGHT ? pContainer->SideBar->getWidth() : 0);
+ }
+ ScreenToClient(pContainer->hwnd, &pt);
+ GetClientRect(pContainer->hwnd, &rcWnd);
+ m.cyBottomHeight = (rcWnd.bottom - pt.y);
+
+ if (m.cyBottomHeight < 0 || m.cyBottomHeight >= rcWnd.bottom)
+ m.cyBottomHeight = 0;
+
+ m.cxLeftWidth = pContainer->tBorder_outer_left;
+ m.cxRightWidth = pContainer->tBorder_outer_right;
+ m.cxLeftWidth += sbar_left;
+ m.cxRightWidth += sbar_right;
+
+ if (memcmp(&m, &pContainer->mOld, sizeof(MARGINS)) != 0) {
+ pContainer->mOld = m;
+ CMimAPI::m_pfnDwmExtendFrameIntoClientArea(pContainer->hwnd, &m);
}
- else
- pContainer->MenuBar->setAero(false);
}
/*
@@ -137,76 +140,74 @@ void TSAPI SetAeroMargins(TContainerData *pContainer) * pointer and for removing the struct from the linked list.
*/
-struct TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDLE hContactFrom) {
- DBVARIANT dbv;
- char szCounter[10];
+struct TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDLE hContactFrom)
+{
char *szKey = "TAB_ContainersW";
- int i, iFirstFree = -1, iFound = FALSE;
+ int iFirstFree = -1, iFound = FALSE;
- struct TContainerData *pContainer = (struct TContainerData *)malloc(sizeof(struct TContainerData));
- if (pContainer) {
- ZeroMemory((void*)pContainer, sizeof(struct TContainerData));
- _tcsncpy(pContainer->szName, name, CONTAINER_NAMELEN + 1);
- AppendToContainerList(pContainer);
+ struct TContainerData *pContainer = (struct TContainerData *)calloc(sizeof(struct TContainerData), 1);
+ if (!pContainer)
+ return NULL;
- if (M->GetByte("limittabs", 0) && !_tcscmp(name, _T("default")))
- iTemp |= CNT_CREATEFLAG_CLONED;
- /*
- * save container name to the db
- */
- i = 0;
- if (!M->GetByte("singlewinmode", 0)) {
- do {
- _snprintf(szCounter, 8, "%d", i);
- if (M->GetTString(NULL, szKey, szCounter, &dbv)) {
- if (iFirstFree != -1) {
- pContainer->iContainerIndex = iFirstFree;
- _snprintf(szCounter, 8, "%d", iFirstFree);
- }
- else {
- pContainer->iContainerIndex = i;
- }
- M->WriteTString(NULL, szKey, szCounter, name);
- BuildContainerMenu();
- break;
+ _tcsncpy(pContainer->szName, name, CONTAINER_NAMELEN + 1);
+ AppendToContainerList(pContainer);
+
+ if (M->GetByte("limittabs", 0) && !_tcscmp(name, _T("default")))
+ iTemp |= CNT_CREATEFLAG_CLONED;
+ /*
+ * save container name to the db
+ */
+ int i = 0;
+ if (!M->GetByte("singlewinmode", 0)) {
+ do {
+ char szCounter[10];
+ _snprintf(szCounter, 8, "%d", i);
+
+ DBVARIANT dbv;
+ if (M->GetTString(NULL, szKey, szCounter, &dbv)) {
+ if (iFirstFree != -1) {
+ pContainer->iContainerIndex = iFirstFree;
+ _snprintf(szCounter, 8, "%d", iFirstFree);
}
- else {
- if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
- if (!_tcsncmp(dbv.ptszVal, name, CONTAINER_NAMELEN)) {
- pContainer->iContainerIndex = i;
- iFound = TRUE;
- }
- else if (!_tcsncmp(dbv.ptszVal, _T("**free**"), CONTAINER_NAMELEN))
- iFirstFree = i;
+ else pContainer->iContainerIndex = i;
+
+ M->WriteTString(NULL, szKey, szCounter, name);
+ BuildContainerMenu();
+ break;
+ }
+ else {
+ if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
+ if (!_tcsncmp(dbv.ptszVal, name, CONTAINER_NAMELEN)) {
+ pContainer->iContainerIndex = i;
+ iFound = TRUE;
}
- DBFreeVariant(&dbv);
+ else if (!_tcsncmp(dbv.ptszVal, _T("**free**"), CONTAINER_NAMELEN))
+ iFirstFree = i;
}
+ DBFreeVariant(&dbv);
}
- while (++i && iFound == FALSE);
- }
- else {
- iTemp |= CNT_CREATEFLAG_CLONED;
- pContainer->iContainerIndex = 1;
}
+ while (++i && iFound == FALSE);
+ }
+ else {
+ iTemp |= CNT_CREATEFLAG_CLONED;
+ pContainer->iContainerIndex = 1;
+ }
- if (iTemp & CNT_CREATEFLAG_MINIMIZED)
- pContainer->dwFlags = CNT_CREATE_MINIMIZED;
- if (iTemp & CNT_CREATEFLAG_CLONED) {
- pContainer->dwFlags |= CNT_CREATE_CLONED;
- pContainer->hContactFrom = hContactFrom;
- }
- pContainer->hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGCONTAINER), NULL, DlgProcContainer, (LPARAM) pContainer);
- return pContainer;
+ if (iTemp & CNT_CREATEFLAG_MINIMIZED)
+ pContainer->dwFlags = CNT_CREATE_MINIMIZED;
+ if (iTemp & CNT_CREATEFLAG_CLONED) {
+ pContainer->dwFlags |= CNT_CREATE_CLONED;
+ pContainer->hContactFrom = hContactFrom;
}
- return NULL;
+ pContainer->hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGCONTAINER), NULL, DlgProcContainer, (LPARAM) pContainer);
+ return pContainer;
}
static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- BOOL bSkinned;
-
struct TContainerData *pContainer = (struct TContainerData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- bSkinned = CSkin::m_skinEnabled ? TRUE : FALSE;
+ BOOL bSkinned = CSkin::m_skinEnabled ? TRUE : FALSE;
switch (msg) {
case WM_NCPAINT: {
|