summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/ImageDataObject.cpp8
-rw-r--r--plugins/TabSRMM/src/ImageDataObject.h10
-rw-r--r--plugins/TabSRMM/src/TSButton.cpp41
-rw-r--r--plugins/TabSRMM/src/buttonbar.h2
-rw-r--r--plugins/TabSRMM/src/buttonsbar.cpp38
-rw-r--r--plugins/TabSRMM/src/chat/chat.h2
-rw-r--r--plugins/TabSRMM/src/chat/log.cpp541
-rw-r--r--plugins/TabSRMM/src/chat/muchighlight.cpp146
-rw-r--r--plugins/TabSRMM/src/chat/options.cpp188
-rw-r--r--plugins/TabSRMM/src/chat/tools.cpp18
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp2496
-rw-r--r--plugins/TabSRMM/src/commonheaders.h82
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp9
-rw-r--r--plugins/TabSRMM/src/container.cpp1106
-rw-r--r--plugins/TabSRMM/src/containeroptions.cpp743
-rw-r--r--plugins/TabSRMM/src/controls.cpp148
-rw-r--r--plugins/TabSRMM/src/controls.h52
-rw-r--r--plugins/TabSRMM/src/eventpopups.cpp32
-rw-r--r--plugins/TabSRMM/src/functions.h6
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.h2
-rw-r--r--plugins/TabSRMM/src/globals.cpp30
-rw-r--r--plugins/TabSRMM/src/globals.h140
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp543
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp286
-rw-r--r--plugins/TabSRMM/src/infopanel.h34
-rw-r--r--plugins/TabSRMM/src/mim.h74
-rw-r--r--plugins/TabSRMM/src/modplus.cpp34
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp6781
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp56
-rw-r--r--plugins/TabSRMM/src/msglog.cpp51
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp255
-rw-r--r--plugins/TabSRMM/src/msgs.cpp8
-rw-r--r--plugins/TabSRMM/src/msgs.h54
-rw-r--r--plugins/TabSRMM/src/selectcontainer.cpp294
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp58
-rw-r--r--plugins/TabSRMM/src/sendlater.h78
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp42
-rw-r--r--plugins/TabSRMM/src/sendqueue.h18
-rw-r--r--plugins/TabSRMM/src/sidebar.cpp92
-rw-r--r--plugins/TabSRMM/src/sidebar.h236
-rw-r--r--plugins/TabSRMM/src/srmm.cpp19
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp34
-rw-r--r--plugins/TabSRMM/src/taskbar.cpp58
-rw-r--r--plugins/TabSRMM/src/taskbar.h2
-rw-r--r--plugins/TabSRMM/src/templates.cpp156
-rw-r--r--plugins/TabSRMM/src/themeio.cpp41
-rw-r--r--plugins/TabSRMM/src/themes.cpp315
-rw-r--r--plugins/TabSRMM/src/themes.h10
-rw-r--r--plugins/TabSRMM/src/translator.cpp26
-rw-r--r--plugins/TabSRMM/src/trayicon.cpp27
-rw-r--r--plugins/TabSRMM/src/typingnotify.cpp368
-rw-r--r--plugins/TabSRMM/src/utils.cpp251
-rw-r--r--plugins/TabSRMM/src/utils.h34
53 files changed, 8106 insertions, 8069 deletions
diff --git a/plugins/TabSRMM/src/ImageDataObject.cpp b/plugins/TabSRMM/src/ImageDataObject.cpp
index dc7810d8ac..a62ab5fc28 100644
--- a/plugins/TabSRMM/src/ImageDataObject.cpp
+++ b/plugins/TabSRMM/src/ImageDataObject.cpp
@@ -54,7 +54,7 @@ int CacheIconToBMP(TLogIcon *theIcon, HICON hIcon, COLORREF backgroundColor, int
IconSizeY = sizeY;
}
RECT rc;
- BITMAPINFOHEADER bih = {0};
+ BITMAPINFOHEADER bih = { 0 };
int widthBytes;
theIcon->hBkgBrush = CreateSolidBrush(backgroundColor);
bih.biSize = sizeof(bih);
@@ -116,7 +116,7 @@ bool CImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap)
return false;
}
sc = ::StgCreateDocfileOnILockBytes(lpLockBytes,
- STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, &pStorage);
+ STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, &pStorage);
if (sc != S_OK) {
lpLockBytes = NULL;
pOleClientSite->Release();
@@ -152,7 +152,7 @@ bool CImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap)
}
reobject.clsid = clsid;
- reobject.cp = REO_CP_SELECTION ;
+ reobject.cp = REO_CP_SELECTION;
reobject.dvaspect = DVASPECT_CONTENT;
reobject.poleobj = pOleObject;
reobject.polesite = pOleClientSite;
@@ -200,7 +200,7 @@ IOleObject *CImageDataObject::GetOleObject(IOleClientSite *pOleClientSite, IStor
SCODE sc;
IOleObject *pOleObject;
sc = ::OleCreateStaticFromData(this, IID_IOleObject, OLERENDER_FORMAT,
- &m_format, pOleClientSite, pStorage, (void **) & pOleObject);
+ &m_format, pOleClientSite, pStorage, (void **)& pOleObject);
if (sc != S_OK)
pOleObject = NULL;
return pOleObject;
diff --git a/plugins/TabSRMM/src/ImageDataObject.h b/plugins/TabSRMM/src/ImageDataObject.h
index 2601c10dc6..d5342d3f05 100644
--- a/plugins/TabSRMM/src/ImageDataObject.h
+++ b/plugins/TabSRMM/src/ImageDataObject.h
@@ -22,11 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
class CImageDataObject : IDataObject
{
public:
- // returns true on success, false on failure
+ // returns true on success, false on failure
static bool InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap);
- // returns true on success, false on failure
- //static bool InsertIcon(IRichEditOle* pRichEditOle, HICON hIcon,
- //COLORREF backgroundColor, int sizeX = 0, int sizeY = 0);
+ // returns true on success, false on failure
+ //static bool InsertIcon(IRichEditOle* pRichEditOle, HICON hIcon,
+ //COLORREF backgroundColor, int sizeX = 0, int sizeY = 0);
private:
ULONG m_ulRefCnt;
@@ -124,7 +124,7 @@ public:
return E_NOTIMPL;
}
- // Other
+ // Other
void SetBitmap(HBITMAP hBitmap);
IOleObject *GetOleObject(IOleClientSite *pOleClientSite, IStorage *pStorage);
};
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp
index 9e5a7373c9..b55e8ff26e 100644
--- a/plugins/TabSRMM/src/TSButton.cpp
+++ b/plugins/TabSRMM/src/TSButton.cpp
@@ -133,7 +133,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint)
item = &SkinItems[(ctl->stateId == PBS_NORMAL || ctl->stateId == PBS_DISABLED) ? ID_EXTBKBUTTONSNPRESSED : (ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : ID_EXTBKBUTTONSPRESSED)];
realItem = item;
}
- CSkin::SkinDrawBG(ctl->hwnd, ctl->pContainer->hwnd, ctl->pContainer, &rcContent, hdcMem);
+ CSkin::SkinDrawBG(ctl->hwnd, ctl->pContainer->hwnd, ctl->pContainer, &rcContent, hdcMem);
if (!item->IGNORED) {
RECT rc1 = rcClient;
rc1.left += item->MARGIN_LEFT;
@@ -145,7 +145,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint)
else goto flat_themed;
}
else {
-flat_themed:
+ flat_themed:
int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->bIsDefault ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED;
if (ctl->bToolbarButton) {
@@ -156,7 +156,7 @@ flat_themed:
pt.x = rcWin.left;
ScreenToClient(dat->hwnd, &pt);
BitBlt(hdcMem, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
- dat->pContainer->cachedToolbarDC, pt.x, 1, SRCCOPY);
+ dat->pContainer->cachedToolbarDC, pt.x, 1, SRCCOPY);
}
}
if (ctl->hThemeToolbar && ctl->bIsThemed && 1 == dat->pContainer->bTBRenderingMode) {
@@ -189,7 +189,7 @@ flat_themed:
item = &SkinItems[(ctl->stateId == PBS_NORMAL || ctl->stateId == PBS_DISABLED) ? ID_EXTBKBUTTONSNPRESSED : (ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : ID_EXTBKBUTTONSPRESSED)];
realItem = item;
}
- CSkin::SkinDrawBG(ctl->hwnd, ctl->pContainer->hwnd, ctl->pContainer, &rcClient, hdcMem);
+ CSkin::SkinDrawBG(ctl->hwnd, ctl->pContainer->hwnd, ctl->pContainer, &rcClient, hdcMem);
if (!item->IGNORED) {
RECT rc1 = rcClient;
rc1.left += item->MARGIN_LEFT;
@@ -197,11 +197,12 @@ flat_themed:
rc1.top += item->MARGIN_TOP;
rc1.bottom -= item->MARGIN_BOTTOM;
CSkin::DrawItem(hdcMem, &rc1, item);
- } else
+ }
+ else
goto nonflat_themed;
}
else {
-nonflat_themed:
+ nonflat_themed:
int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->bIsDefault ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED;
if (ctl->hThemeButton && ctl->bIsThemed && 0 == PluginConfig.m_fillColor) {
@@ -239,7 +240,7 @@ nonflat_themed:
rcContent.right = rcContent.left;
DrawIconEx(hdcMem, rcClient.right - 15, (rcClient.bottom - rcClient.top) / 2 - (PluginConfig.m_smcyicon / 2),
- PluginConfig.g_buttonBarIcons[ICON_DEFAULT_PULLDOWN], 16, 16, 0, 0, DI_NORMAL);
+ PluginConfig.g_buttonBarIcons[ICON_DEFAULT_PULLDOWN], 16, 16, 0, 0, DI_NORMAL);
}
if (ctl->hIcon || ctl->hIconPrivate) {
@@ -268,7 +269,7 @@ nonflat_themed:
DrawIconEx(hdc_buttonglyph, 0, 0, hIconNew, 16, 16, 0, 0, DI_NORMAL);
if (ctl->overlay)
DrawIconEx(hdc_buttonglyph, 0, 0, ctl->overlay, 16, 16, 0, 0, DI_NORMAL);
- GdiAlphaBlend(hdcMem, ix, iy, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, hdc_buttonglyph, 0, 0, 16, 16, bf_buttonglyph);
+ GdiAlphaBlend(hdcMem, ix, iy, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, hdc_buttonglyph, 0, 0, 16, 16, bf_buttonglyph);
}
}
}
@@ -314,7 +315,7 @@ nonflat_themed:
}
}
-static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
TSButtonCtrl *bct = (TSButtonCtrl*)GetWindowLongPtr(hwndDlg, 0);
switch (msg) {
@@ -328,18 +329,18 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
return 0;
case WM_PAINT:
- {
- PAINTSTRUCT ps;
- HDC hdcPaint = BeginPaint(hwndDlg, &ps);
- if (hdcPaint) {
- if (bct->sitem)
- bct->sitem->RenderThis(hdcPaint);
- else
- PaintWorker(bct, hdcPaint);
- EndPaint(hwndDlg, &ps);
- }
+ {
+ PAINTSTRUCT ps;
+ HDC hdcPaint = BeginPaint(hwndDlg, &ps);
+ if (hdcPaint) {
+ if (bct->sitem)
+ bct->sitem->RenderThis(hdcPaint);
+ else
+ PaintWorker(bct, hdcPaint);
+ EndPaint(hwndDlg, &ps);
}
- return 0;
+ }
+ return 0;
case BM_SETIMAGE:
if (wParam == IMAGE_ICON) {
diff --git a/plugins/TabSRMM/src/buttonbar.h b/plugins/TabSRMM/src/buttonbar.h
index cc313c0945..ada8201f1e 100644
--- a/plugins/TabSRMM/src/buttonbar.h
+++ b/plugins/TabSRMM/src/buttonbar.h
@@ -30,7 +30,7 @@ struct CustomButtonData : public MZeroedObject
int iButtonWidth; // must be 22 for regular button and 33 for button with arrow
HANDLE hIcon; // Handle to icolib registred icon
-
+
bool bIMButton, bChatButton;
bool bCanBeHidden, bHidden, bAutoHidden, bSeparator, bDisabled, bPushButton;
bool bLSided, bRSided;
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp
index fda5d6aa7e..ecfdb438fe 100644
--- a/plugins/TabSRMM/src/buttonsbar.cpp
+++ b/plugins/TabSRMM/src/buttonsbar.cpp
@@ -18,7 +18,7 @@ static mir_cs ToolBarCS;
static void wipeList(LIST<CustomButtonData> &list)
{
- for (int i = list.getCount()-1; i >= 0; i--) {
+ for (int i = list.getCount() - 1; i >= 0; i--) {
delete list[i];
list.remove(i);
}
@@ -60,14 +60,14 @@ void CB_DeInitCustomButtons()
void CB_DestroyAllButtons(HWND hwndDlg)
{
HWND hwndBtn = NULL;
- for (int i=0; i < LButtonsList.getCount(); i++) {
+ for (int i = 0; i < LButtonsList.getCount(); i++) {
CustomButtonData *cbd = LButtonsList[i];
hwndBtn = GetDlgItem(hwndDlg, cbd->dwButtonCID);
if (hwndBtn)
DestroyWindow(hwndBtn);
}
- for (int i=0; i < RButtonsList.getCount(); i++) {
+ for (int i = 0; i < RButtonsList.getCount(); i++) {
CustomButtonData *cbd = RButtonsList[i];
hwndBtn = GetDlgItem(hwndDlg, cbd->dwButtonCID);
if (hwndBtn)
@@ -305,7 +305,7 @@ static INT_PTR CB_RemoveButton(WPARAM, LPARAM lParam)
{
mir_cslock lck(ToolBarCS);
- for (int i = LButtonsList.getCount()-1; i >= 0; i--) {
+ for (int i = LButtonsList.getCount() - 1; i >= 0; i--) {
CustomButtonData *cbd = LButtonsList[i];
if (!strcmp(cbd->pszModuleName, bbdi->pszModuleName) && cbd->dwButtonOrigID == bbdi->dwButtonID) {
tempCID = cbd->dwButtonCID;
@@ -315,7 +315,7 @@ static INT_PTR CB_RemoveButton(WPARAM, LPARAM lParam)
}
if (!tempCID) {
- for (int i = RButtonsList.getCount()-1; i >= 0; i--) {
+ for (int i = RButtonsList.getCount() - 1; i >= 0; i--) {
CustomButtonData *cbd = RButtonsList[i];
if (!strcmp(cbd->pszModuleName, bbdi->pszModuleName) && cbd->dwButtonOrigID == bbdi->dwButtonID) {
tempCID = cbd->dwButtonCID;
@@ -431,7 +431,7 @@ void TSAPI BB_InitDlgButtons(TWindowData *dat)
BOOL isThemed = TRUE;
if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKBUTTONSNPRESSED].IGNORED &&
- !SkinItems[ID_EXTBKBUTTONSPRESSED].IGNORED && !SkinItems[ID_EXTBKBUTTONSMOUSEOVER].IGNORED) {
+ !SkinItems[ID_EXTBKBUTTONSPRESSED].IGNORED && !SkinItems[ID_EXTBKBUTTONSMOUSEOVER].IGNORED) {
isThemed = FALSE;
}
@@ -489,7 +489,7 @@ void TSAPI BB_InitDlgButtons(TWindowData *dat)
if (((dat->bType == SESSIONTYPE_IM && cbd->bIMButton) || (dat->bType == SESSIONTYPE_CHAT && cbd->bChatButton))) {
if (!cbd->bSeparator && !GetDlgItem(hdlg, cbd->dwButtonCID)) {
hwndBtn = CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 2 + lwidth, splitterY,
- cbd->iButtonWidth, DPISCALEY_S(22), hdlg, (HMENU)cbd->dwButtonCID, g_hInst, NULL);
+ cbd->iButtonWidth, DPISCALEY_S(22), hdlg, (HMENU)cbd->dwButtonCID, g_hInst, NULL);
CustomizeButton(hwndBtn);
}
if (!cbd->bHidden)
@@ -705,16 +705,16 @@ void TSAPI BB_CustomButtonClick(TWindowData *dat, DWORD idFrom, HWND hwndFrom, B
if (!cbcd.pszModule)
for (i = 0; i < RButtonsList.getCount(); i++) {
- CustomButtonData* cbd = RButtonsList[i];
- if (cbd->dwButtonCID == idFrom) {
- cbcd.pszModule = cbd->pszModuleName;
- cbcd.dwButtonId = cbd->dwButtonOrigID;
- }
- else if (cbd->dwArrowCID == idFrom) {
- bFromArrow = 1;
- cbcd.pszModule = cbd->pszModuleName;
- cbcd.dwButtonId = cbd->dwButtonOrigID;
- }
+ CustomButtonData* cbd = RButtonsList[i];
+ if (cbd->dwButtonCID == idFrom) {
+ cbcd.pszModule = cbd->pszModuleName;
+ cbcd.dwButtonId = cbd->dwButtonOrigID;
+ }
+ else if (cbd->dwArrowCID == idFrom) {
+ bFromArrow = 1;
+ cbcd.pszModule = cbd->pszModuleName;
+ cbcd.dwButtonId = cbd->dwButtonOrigID;
+ }
}
cbcd.cbSize = sizeof(CustomButtonClickData);
@@ -1036,7 +1036,7 @@ static int SaveTree(HWND hToolBarTree)
if (!(cbd->opFlags & BBSF_NTBDESTRUCT))
(RSide) ? (count -= 10) : (count += 10);
}
-
+
HTREEITEM hItem = TreeView_GetNextSibling(hToolBarTree, tvi.hItem);
if (cbd->opFlags & BBSF_NTBDESTRUCT)
TreeView_DeleteItem(hToolBarTree, tvi.hItem);
@@ -1103,7 +1103,7 @@ static int BuildMenuObjectsTree(HWND hToolBarTree)
hti = TreeView_InsertItem(hToolBarTree, &tvis);
TreeView_SetCheckState(hToolBarTree, hti, 1);
- for (int i = RButtonsList.getCount()-1; i >= 0; i--) {
+ for (int i = RButtonsList.getCount() - 1; i >= 0; i--) {
CustomButtonData *cbd = RButtonsList[i];
tvis.item.lParam = (LPARAM)cbd;
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h
index 01e2481700..96564a6494 100644
--- a/plugins/TabSRMM/src/chat/chat.h
+++ b/plugins/TabSRMM/src/chat/chat.h
@@ -39,7 +39,7 @@ enum TChatStatusEx
// special service for tweaking performance
#define MS_GC_GETEVENTPTR "GChat/GetNewEventPtr"
-typedef INT_PTR (*GETEVENTFUNC)(WPARAM wParam, LPARAM lParam);
+typedef INT_PTR(*GETEVENTFUNC)(WPARAM wParam, LPARAM lParam);
typedef struct {
GETEVENTFUNC pfnAddEvent;
}GCPTRS;
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp
index b81df0ce41..7582af711f 100644
--- a/plugins/TabSRMM/src/chat/log.cpp
+++ b/plugins/TabSRMM/src/chat/log.cpp
@@ -42,279 +42,279 @@ static char *szDivider = "\\strike----------------------------------------------
/*
static char* u2a( const wchar_t* src, int codepage ) {
- int cbLen = WideCharToMultiByte( codepage, 0, src, -1, NULL, 0, NULL, NULL );
- char* result = ( char* )mir_alloc( cbLen+1 );
- if ( result == NULL )
- return NULL;
-
- WideCharToMultiByte( codepage, 0, src, -1, result, cbLen, NULL, NULL );
- result[ cbLen ] = 0;
- return result;
+int cbLen = WideCharToMultiByte( codepage, 0, src, -1, NULL, 0, NULL, NULL );
+char* result = ( char* )mir_alloc( cbLen+1 );
+if ( result == NULL )
+return NULL;
+
+WideCharToMultiByte( codepage, 0, src, -1, result, cbLen, NULL, NULL );
+result[ cbLen ] = 0;
+return result;
}
static char* t2acp( const TCHAR* src, int codepage ) {
- return u2a( src, codepage );
+return u2a( src, codepage );
}
static TCHAR *a2tcp(const char *text, int cp) {
- if ( text != NULL ) {
- int cbLen = MultiByteToWideChar( cp, 0, text, -1, NULL, 0 );
- TCHAR* result = ( TCHAR* )mir_alloc( sizeof(TCHAR)*( cbLen+1 ));
- if ( result == NULL )
- return NULL;
- MultiByteToWideChar(cp, 0, text, -1, result, cbLen);
- return result;
- }
- return NULL;
+if ( text != NULL ) {
+int cbLen = MultiByteToWideChar( cp, 0, text, -1, NULL, 0 );
+TCHAR* result = ( TCHAR* )mir_alloc( sizeof(TCHAR)*( cbLen+1 ));
+if ( result == NULL )
+return NULL;
+MultiByteToWideChar(cp, 0, text, -1, result, cbLen);
+return result;
+}
+return NULL;
}
static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, TCHAR **buffer, int *cbBufferEnd, int *cbBufferAlloced, const TCHAR *fmt, ...)
{
- va_list va;
- int lineLen, textCharsCount=0;
- TCHAR* line = (TCHAR*)_alloca( 8001 * sizeof(TCHAR));
- TCHAR* d;
- MODULEINFO *mi = pci->MM_FindModule(streamData->si->pszModule);
-
- va_start(va, fmt);
- lineLen = mir_vsntprintf( line, 8000, fmt, va);
- if (lineLen < 0)
- return 0;
- line[lineLen] = 0;
- va_end(va);
- lineLen = lineLen*9 + 8;
- if (*cbBufferEnd + lineLen > *cbBufferAlloced) {
- cbBufferAlloced[0] += (lineLen + 1024 - lineLen % 1024);
- *buffer = (TCHAR*) mir_realloc(*buffer, *cbBufferAlloced * sizeof(TCHAR));
- }
-
- d = *buffer + *cbBufferEnd;
-
- for (; *line; line++, textCharsCount++) {
- if (*line == '%' && !simpleMode ) {
- TCHAR szTemp[200];
-
- szTemp[0] = '\0';
- switch ( *++line ) {
- case '\0':
- case '%':
- *d++ = '%';
- break;
+va_list va;
+int lineLen, textCharsCount=0;
+TCHAR* line = (TCHAR*)_alloca( 8001 * sizeof(TCHAR));
+TCHAR* d;
+MODULEINFO *mi = pci->MM_FindModule(streamData->si->pszModule);
+
+va_start(va, fmt);
+lineLen = mir_vsntprintf( line, 8000, fmt, va);
+if (lineLen < 0)
+return 0;
+line[lineLen] = 0;
+va_end(va);
+lineLen = lineLen*9 + 8;
+if (*cbBufferEnd + lineLen > *cbBufferAlloced) {
+cbBufferAlloced[0] += (lineLen + 1024 - lineLen % 1024);
+*buffer = (TCHAR*) mir_realloc(*buffer, *cbBufferAlloced * sizeof(TCHAR));
+}
- case 'c':
- case 'f':
- if (!g_Settings.bStripFormat && !streamData->bStripFormat) {
- if ( line[1] != '\0' && line[2] != '\0') {
- TCHAR szTemp3[3], c = *line;
- int col;
- szTemp3[0] = line[1];
- szTemp3[1] = line[2];
- szTemp3[2] = '\0';
- col = _ttoi(szTemp3);
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c#%02X%02X%02X"), c, GetRValue(mi->crColors[col]), GetGValue(mi->crColors[col]), GetBValue(mi->crColors[col]));
- }
- }
- line += 2;
- break;
- case 'C':
- case 'F':
- if ( !g_Settings.bStripFormat && !streamData->bStripFormat) {
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c"), *line );
- }
- break;
- case 'b':
- case 'u':
- case 'i':
- case 'B':
- case 'U':
- case 'I':
- case 'r':
- if ( !streamData->bStripFormat ) {
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c"), *line );
- }
- break;
- }
+d = *buffer + *cbBufferEnd;
+
+for (; *line; line++, textCharsCount++) {
+if (*line == '%' && !simpleMode ) {
+TCHAR szTemp[200];
+
+szTemp[0] = '\0';
+switch ( *++line ) {
+case '\0':
+case '%':
+*d++ = '%';
+break;
+
+case 'c':
+case 'f':
+if (!g_Settings.bStripFormat && !streamData->bStripFormat) {
+if ( line[1] != '\0' && line[2] != '\0') {
+TCHAR szTemp3[3], c = *line;
+int col;
+szTemp3[0] = line[1];
+szTemp3[1] = line[2];
+szTemp3[2] = '\0';
+col = _ttoi(szTemp3);
+mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c#%02X%02X%02X"), c, GetRValue(mi->crColors[col]), GetGValue(mi->crColors[col]), GetBValue(mi->crColors[col]));
+}
+}
+line += 2;
+break;
+case 'C':
+case 'F':
+if ( !g_Settings.bStripFormat && !streamData->bStripFormat) {
+mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c"), *line );
+}
+break;
+case 'b':
+case 'u':
+case 'i':
+case 'B':
+case 'U':
+case 'I':
+case 'r':
+if ( !streamData->bStripFormat ) {
+mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c"), *line );
+}
+break;
+}
- if ( szTemp[0] ) {
- size_t iLen = mir_tstrlen(szTemp);
- memcpy( d, szTemp, iLen * sizeof(TCHAR));
- d += iLen;
- }
- }
- else if (*line == '%') {
- *d++ = '%';
- *d++ = (char) *line;
- }
- else {
- *d++ = (TCHAR) *line;
- }
- }
- *d = '\0';
- *cbBufferEnd = (int) (d - *buffer);
- return textCharsCount;
+if ( szTemp[0] ) {
+size_t iLen = mir_tstrlen(szTemp);
+memcpy( d, szTemp, iLen * sizeof(TCHAR));
+d += iLen;
+}
+}
+else if (*line == '%') {
+*d++ = '%';
+*d++ = (char) *line;
+}
+else {
+*d++ = (TCHAR) *line;
+}
+}
+*d = '\0';
+*cbBufferEnd = (int) (d - *buffer);
+return textCharsCount;
}
static void AddEventTextToBufferIEView(TCHAR **buffer, int *bufferEnd, int *bufferAlloced, LOGSTREAMDATA *streamData)
{
- if (streamData->lin->ptszText)
- Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T(": %s"), streamData->lin->ptszText);
+if (streamData->lin->ptszText)
+Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T(": %s"), streamData->lin->ptszText);
}
static void AddEventToBufferIEView(TCHAR **buffer, int *bufferEnd, int *bufferAlloced, LOGSTREAMDATA *streamData, TCHAR *pszNick)
{
- if ( streamData && streamData->lin ) {
- switch ( streamData->lin->iType ) {
- case GC_EVENT_MESSAGE:
- if ( streamData->lin->ptszText ) {
- TCHAR *ptszTemp = NULL;
- TCHAR *ptszText = streamData->lin->ptszText;
- if (streamData->dat->codePage != CP_ACP) {
- char *aText = t2acp(streamData->lin->ptszText, CP_ACP);
- ptszText = ptszTemp = a2tcp(aText, streamData->dat->codePage);
- mir_free(aText);
- }
- Log_AppendIEView( streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), ptszText );
- mir_free(ptszTemp);
- }
- break;
- case GC_EVENT_ACTION:
- if ( pszNick && streamData->lin->ptszText) {
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, _T("%s "), streamData->lin->ptszNick);
- Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
- }
- break;
- case GC_EVENT_JOIN:
- if (pszNick) {
- if (!streamData->lin->bIsMe)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has joined"), pszNick);
- else
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You have joined %s"), streamData->si->ptszName);
- }
- break;
- case GC_EVENT_PART:
- if (pszNick)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has left"), pszNick);
- AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
- break;
- case GC_EVENT_QUIT:
- if (pszNick)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has disconnected"), pszNick);
- AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
- break;
- case GC_EVENT_NICK:
- if (pszNick && streamData->lin->ptszText) {
- if (!streamData->lin->bIsMe)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s is now known as %s"), pszNick, streamData->lin->ptszText);
- else
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You are now known as %s"), streamData->lin->ptszText);
- }
- break;
- case GC_EVENT_KICK:
- if (pszNick && streamData->lin->ptszStatus)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s kicked %s"), streamData->lin->ptszStatus, streamData->lin->ptszNick);
- AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
- break;
- case GC_EVENT_NOTICE:
- if (pszNick && streamData->lin->ptszText) {
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("Notice from %s"), pszNick );
- AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
- }
- break;
- case GC_EVENT_TOPIC:
- if (streamData->lin->ptszText)
- Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, TranslateT("The topic is '%s%s'"), streamData->lin->ptszText, _T("%r"));
- if (pszNick)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
- streamData->lin->ptszUserInfo ? TranslateT(" (set by %s on %s)"): TranslateT(" (set by %s)"),
- pszNick, streamData->lin->ptszUserInfo);
- break;
- case GC_EVENT_INFORMATION:
- if (streamData->lin->ptszText)
- Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, (streamData->lin->bIsMe) ? _T("--> %s") : _T("%s"), streamData->lin->ptszText);
- break;
- case GC_EVENT_ADDSTATUS:
- if (pszNick && streamData->lin->ptszText && streamData->lin->ptszStatus)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s enables '%s' status for %s"), streamData->lin->ptszText, streamData->lin->ptszStatus, streamData->lin->ptszNick);
- break;
- case GC_EVENT_REMOVESTATUS:
- if (pszNick && streamData->lin->ptszText && streamData->lin->ptszStatus)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s disables '%s' status for %s"), streamData->lin->ptszText , streamData->lin->ptszStatus, streamData->lin->ptszNick);
- break;
- }
- }
+if ( streamData && streamData->lin ) {
+switch ( streamData->lin->iType ) {
+case GC_EVENT_MESSAGE:
+if ( streamData->lin->ptszText ) {
+TCHAR *ptszTemp = NULL;
+TCHAR *ptszText = streamData->lin->ptszText;
+if (streamData->dat->codePage != CP_ACP) {
+char *aText = t2acp(streamData->lin->ptszText, CP_ACP);
+ptszText = ptszTemp = a2tcp(aText, streamData->dat->codePage);
+mir_free(aText);
+}
+Log_AppendIEView( streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), ptszText );
+mir_free(ptszTemp);
+}
+break;
+case GC_EVENT_ACTION:
+if ( pszNick && streamData->lin->ptszText) {
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, _T("%s "), streamData->lin->ptszNick);
+Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
+}
+break;
+case GC_EVENT_JOIN:
+if (pszNick) {
+if (!streamData->lin->bIsMe)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has joined"), pszNick);
+else
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You have joined %s"), streamData->si->ptszName);
+}
+break;
+case GC_EVENT_PART:
+if (pszNick)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has left"), pszNick);
+AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
+break;
+case GC_EVENT_QUIT:
+if (pszNick)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has disconnected"), pszNick);
+AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
+break;
+case GC_EVENT_NICK:
+if (pszNick && streamData->lin->ptszText) {
+if (!streamData->lin->bIsMe)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s is now known as %s"), pszNick, streamData->lin->ptszText);
+else
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You are now known as %s"), streamData->lin->ptszText);
+}
+break;
+case GC_EVENT_KICK:
+if (pszNick && streamData->lin->ptszStatus)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s kicked %s"), streamData->lin->ptszStatus, streamData->lin->ptszNick);
+AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
+break;
+case GC_EVENT_NOTICE:
+if (pszNick && streamData->lin->ptszText) {
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("Notice from %s"), pszNick );
+AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
+}
+break;
+case GC_EVENT_TOPIC:
+if (streamData->lin->ptszText)
+Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, TranslateT("The topic is '%s%s'"), streamData->lin->ptszText, _T("%r"));
+if (pszNick)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
+streamData->lin->ptszUserInfo ? TranslateT(" (set by %s on %s)"): TranslateT(" (set by %s)"),
+pszNick, streamData->lin->ptszUserInfo);
+break;
+case GC_EVENT_INFORMATION:
+if (streamData->lin->ptszText)
+Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, (streamData->lin->bIsMe) ? _T("--> %s") : _T("%s"), streamData->lin->ptszText);
+break;
+case GC_EVENT_ADDSTATUS:
+if (pszNick && streamData->lin->ptszText && streamData->lin->ptszStatus)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s enables '%s' status for %s"), streamData->lin->ptszText, streamData->lin->ptszStatus, streamData->lin->ptszNick);
+break;
+case GC_EVENT_REMOVESTATUS:
+if (pszNick && streamData->lin->ptszText && streamData->lin->ptszStatus)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s disables '%s' status for %s"), streamData->lin->ptszText , streamData->lin->ptszStatus, streamData->lin->ptszNick);
+break;
+}
+}
}
static void LogEventIEView(LOGSTREAMDATA *streamData, TCHAR *ptszNick)
{
- TCHAR *buffer = NULL;
- int bufferEnd = 0;
- int bufferAlloced = 0;
- IEVIEWEVENTDATA ied;
- IEVIEWEVENT event;
- memset(&event, 0, sizeof(event));
- event.cbSize = sizeof(event);
- event.dwFlags = 0;
- event.hwnd = streamData->dat->hwndIEView ? streamData->dat->hwndIEView : streamData->dat->hwndHPP;
- event.hContact = streamData->dat->hContact;
- event.codepage = streamData->dat->codePage;
- event.pszProto = streamData->si->pszModule;
- event.iType = IEE_LOG_MEM_EVENTS;
- event.eventData = &ied;
- event.count = 1;
-
- memset(&ied, 0, sizeof(ied));
- AddEventToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData, ptszNick);
- ied.ptszNick = ptszNick;
- ied.ptszText = buffer;
- ied.time = streamData->lin->time;
- ied.bIsMe = streamData->lin->bIsMe;
-
- switch ( streamData->lin->iType ) {
- case GC_EVENT_MESSAGE:
- ied.iType = IEED_GC_EVENT_MESSAGE;
- ied.dwData = IEEDD_GC_SHOW_NICK;
- break;
- case GC_EVENT_ACTION:
- ied.iType = IEED_GC_EVENT_ACTION;
- break;
- case GC_EVENT_JOIN:
- ied.iType = IEED_GC_EVENT_JOIN;
- break;
- case GC_EVENT_PART:
- ied.iType = IEED_GC_EVENT_PART;
- break;
- case GC_EVENT_QUIT:
- ied.iType = IEED_GC_EVENT_QUIT;
- break;
- case GC_EVENT_NICK:
- ied.iType = IEED_GC_EVENT_NICK;
- break;
- case GC_EVENT_KICK:
- ied.iType = IEED_GC_EVENT_KICK;
- break;
- case GC_EVENT_NOTICE:
- ied.iType = IEED_GC_EVENT_NOTICE;
- break;
- case GC_EVENT_TOPIC:
- ied.iType = IEED_GC_EVENT_TOPIC;
- break;
- case GC_EVENT_INFORMATION:
- ied.iType = IEED_GC_EVENT_INFORMATION;
- break;
- case GC_EVENT_ADDSTATUS:
- ied.iType = IEED_GC_EVENT_ADDSTATUS;
- break;
- case GC_EVENT_REMOVESTATUS:
- ied.iType = IEED_GC_EVENT_REMOVESTATUS;
- break;
- }
- ied.dwData |= g_Settings.bShowTime ? IEEDD_GC_SHOW_TIME : 0;
- ied.dwData |= IEEDD_GC_SHOW_ICON;
- ied.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
- ied.next = NULL;
- CallService(streamData->dat->hwndIEView ? MS_IEVIEW_EVENT : MS_HPP_EG_EVENT, 0, (LPARAM)&event);
- mir_free(buffer);
+TCHAR *buffer = NULL;
+int bufferEnd = 0;
+int bufferAlloced = 0;
+IEVIEWEVENTDATA ied;
+IEVIEWEVENT event;
+memset(&event, 0, sizeof(event));
+event.cbSize = sizeof(event);
+event.dwFlags = 0;
+event.hwnd = streamData->dat->hwndIEView ? streamData->dat->hwndIEView : streamData->dat->hwndHPP;
+event.hContact = streamData->dat->hContact;
+event.codepage = streamData->dat->codePage;
+event.pszProto = streamData->si->pszModule;
+event.iType = IEE_LOG_MEM_EVENTS;
+event.eventData = &ied;
+event.count = 1;
+
+memset(&ied, 0, sizeof(ied));
+AddEventToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData, ptszNick);
+ied.ptszNick = ptszNick;
+ied.ptszText = buffer;
+ied.time = streamData->lin->time;
+ied.bIsMe = streamData->lin->bIsMe;
+
+switch ( streamData->lin->iType ) {
+case GC_EVENT_MESSAGE:
+ied.iType = IEED_GC_EVENT_MESSAGE;
+ied.dwData = IEEDD_GC_SHOW_NICK;
+break;
+case GC_EVENT_ACTION:
+ied.iType = IEED_GC_EVENT_ACTION;
+break;
+case GC_EVENT_JOIN:
+ied.iType = IEED_GC_EVENT_JOIN;
+break;
+case GC_EVENT_PART:
+ied.iType = IEED_GC_EVENT_PART;
+break;
+case GC_EVENT_QUIT:
+ied.iType = IEED_GC_EVENT_QUIT;
+break;
+case GC_EVENT_NICK:
+ied.iType = IEED_GC_EVENT_NICK;
+break;
+case GC_EVENT_KICK:
+ied.iType = IEED_GC_EVENT_KICK;
+break;
+case GC_EVENT_NOTICE:
+ied.iType = IEED_GC_EVENT_NOTICE;
+break;
+case GC_EVENT_TOPIC:
+ied.iType = IEED_GC_EVENT_TOPIC;
+break;
+case GC_EVENT_INFORMATION:
+ied.iType = IEED_GC_EVENT_INFORMATION;
+break;
+case GC_EVENT_ADDSTATUS:
+ied.iType = IEED_GC_EVENT_ADDSTATUS;
+break;
+case GC_EVENT_REMOVESTATUS:
+ied.iType = IEED_GC_EVENT_REMOVESTATUS;
+break;
+}
+ied.dwData |= g_Settings.bShowTime ? IEEDD_GC_SHOW_TIME : 0;
+ied.dwData |= IEEDD_GC_SHOW_ICON;
+ied.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
+ied.next = NULL;
+CallService(streamData->dat->hwndIEView ? MS_IEVIEW_EVENT : MS_HPP_EG_EVENT, 0, (LPARAM)&event);
+mir_free(buffer);
}
*/
@@ -432,10 +432,10 @@ static TCHAR * _tcsnrplc(TCHAR *src, size_t n, const TCHAR *ptrn, const TCHAR *r
lPtrn = mir_tstrlen(ptrn);
lRplc = mir_tstrlen(rplc);
if (lPtrn && lSrc && lSrc >= lPtrn && /* lengths are ok */
- (tszFound = _tcsstr(src, ptrn)) != NULL && /* pattern was found in string */
- (n < 0 || lSrc - lPtrn + lRplc < n) && /* there is enough room in the string */
- (tszTail = (TCHAR*) mir_alloc(sizeof(TCHAR) *
- (lSrc - (tszFound - src) - lPtrn + 1))) != NULL) {
+ (tszFound = _tcsstr(src, ptrn)) != NULL && /* pattern was found in string */
+ (n < 0 || lSrc - lPtrn + lRplc < n) && /* there is enough room in the string */
+ (tszTail = (TCHAR*)mir_alloc(sizeof(TCHAR) *
+ (lSrc - (tszFound - src) - lPtrn + 1))) != NULL) {
/* save tail */
_tcscpy(tszTail, tszFound + lPtrn);
/* write replacement string */
@@ -491,10 +491,12 @@ static int Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, char *&buff
memcpy(d, "\\par ", 5);
line++;
d += 5;
- } else if (*line == '\n') {
+ }
+ else if (*line == '\n') {
memcpy(d, "\\line ", 6);
d += 6;
- } else if (*line == '%' && !simpleMode) {
+ }
+ else if (*line == '%' && !simpleMode) {
char szTemp[200]; szTemp[0] = '\0';
switch (*++line) {
case '\0':
@@ -558,16 +560,19 @@ static int Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, char *&buff
memcpy(d, szTemp, iLen);
d += iLen;
}
- } else if (*line == '\t' && !streamData->bStripFormat) {
+ }
+ else if (*line == '\t' && !streamData->bStripFormat) {
memcpy(d, "\\tab ", 5);
d += 5;
- } else if ((*line == '\\' || *line == '{' || *line == '}') && !streamData->bStripFormat) {
+ }
+ else if ((*line == '\\' || *line == '{' || *line == '}') && !streamData->bStripFormat) {
*d++ = '\\';
- *d++ = (char) * line;
- } else if (*line > 0 && *line < 128) {
- *d++ = (char) * line;
+ *d++ = (char)* line;
+ }
+ else if (*line > 0 && *line < 128) {
+ *d++ = (char)* line;
}
- else d += sprintf(d, "\\u%u ?", (WORD) * line); //!!!!!!!!!
+ else d += sprintf(d, "\\u%u ?", (WORD)* line); //!!!!!!!!!
}
cbBufferEnd = (int)(d - buffer);
@@ -619,7 +624,7 @@ static void AddEventToBuffer(char *&buffer, size_t &bufferEnd, size_t &bufferAll
if (pszNick) {
if (!streamData->lin->bIsMe)
/* replace nick of a newcomer with a link */
- Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has joined"), pszNick);
+ Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has joined"), pszNick);
else
Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You have joined %s"), streamData->si->ptszName);
}
@@ -681,7 +686,7 @@ static void AddEventToBuffer(char *&buffer, size_t &bufferEnd, size_t &bufferAll
if (pszNick && streamData->lin->ptszText && streamData->lin->ptszStatus) {
Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
TranslateT("%s disables '%s' status for %s"),
- streamData->lin->ptszText , streamData->lin->ptszStatus, pszNick);
+ streamData->lin->ptszText, streamData->lin->ptszStatus, pszNick);
}
break;
}
@@ -808,7 +813,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
Log_Append(buffer, bufferEnd, bufferAlloced, "\\f0\\fs14");
while (bufferAlloced - bufferEnd < (pci->logIconBmpSize[0] + 20))
bufferAlloced += 4096;
- buffer = (char *) mir_realloc(buffer, bufferAlloced);
+ buffer = (char *)mir_realloc(buffer, bufferAlloced);
memcpy(buffer + bufferEnd, pci->pLogIconBmpBits[iIndex], pci->logIconBmpSize[iIndex]);
bufferEnd += pci->logIconBmpSize[iIndex];
}
@@ -821,13 +826,13 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) {
iii = lin->bIsHighlighted ? 16 : (lin->bIsMe ? 2 : 1);
mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u",
- iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0,F.lfItalic,F.lfUnderline, 2 * abs(F.lfHeight) * 74 / pci->logPixelSY);
+ iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / pci->logPixelSY);
Log_Append(buffer, bufferEnd, bufferAlloced, "%s ", szStyle);
}
else {
iii = lin->bIsHighlighted ? 16 : EventToIndex(lin);
mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u",
- iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic,F.lfUnderline ,2 * abs(F.lfHeight) * 74 / pci->logPixelSY);
+ iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / pci->logPixelSY);
Log_Append(buffer, bufferEnd, bufferAlloced, "%s ", szStyle);
}
}
@@ -926,10 +931,10 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
return 0;
}
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedraw)
+void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedraw)
{
CHARRANGE oldsel, sel, newsel;
- POINT point = {0};
+ POINT point = { 0 };
TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (hwndDlg == 0 || lin == 0 || si == 0 || dat == 0)
@@ -952,7 +957,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr
EDITSTREAM stream = { 0 };
stream.pfnCallback = Log_StreamCallback;
- stream.dwCookie = (DWORD_PTR) & streamData;
+ stream.dwCookie = (DWORD_PTR)& streamData;
SCROLLINFO scroll = { 0 };
scroll.cbSize = sizeof(SCROLLINFO);
diff --git a/plugins/TabSRMM/src/chat/muchighlight.cpp b/plugins/TabSRMM/src/chat/muchighlight.cpp
index fb03aec5d0..484065caf2 100644
--- a/plugins/TabSRMM/src/chat/muchighlight.cpp
+++ b/plugins/TabSRMM/src/chat/muchighlight.cpp
@@ -42,7 +42,7 @@ void CMUCHighlight::cleanup()
void CMUCHighlight::init()
{
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
if (m_fInitialized)
cleanup(); // clean up first, if we were already initialized
@@ -80,10 +80,10 @@ void CMUCHighlight::tokenize(TCHAR *tszString, TCHAR**& patterns, UINT& nr)
if (*p != ' ')
nr++;
- while(*p) {
+ while (*p) {
if (*p == ' ') {
p++;
- while(*p && _istspace(*p))
+ while (*p && _istspace(*p))
p++;
if (*p)
nr++;
@@ -98,10 +98,10 @@ void CMUCHighlight::tokenize(TCHAR *tszString, TCHAR**& patterns, UINT& nr)
if (*p != ' ')
patterns[nr++] = p;
- while(*p) {
+ while (*p) {
if (*p == ' ') {
*p++ = 0;
- while(*p && _istspace(*p))
+ while (*p && _istspace(*p))
p++;
if (*p)
patterns[nr++] = p;
@@ -184,17 +184,17 @@ skip_textpatterns:
INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- DBVARIANT dbv = {0};
- if ( !db_get_ts(0, CHAT_MODULE, "HighlightWords", &dbv)) {
+ DBVARIANT dbv = { 0 };
+ if (!db_get_ts(0, CHAT_MODULE, "HighlightWords", &dbv)) {
::SetDlgItemText(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN, dbv.ptszVal);
::db_free(&dbv);
}
- if ( !db_get_ts(0, CHAT_MODULE, "HighlightNames", &dbv)) {
+ if (!db_get_ts(0, CHAT_MODULE, "HighlightNames", &dbv)) {
::SetDlgItemText(hwndDlg, IDC_HIGHLIGHTNICKPATTERN, dbv.ptszVal);
::db_free(&dbv);
}
@@ -225,7 +225,7 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
return FALSE;
case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_HIGHLIGHTNICKPATTERN
+ if ((LOWORD(wParam) == IDC_HIGHLIGHTNICKPATTERN
|| LOWORD(wParam) == IDC_HIGHLIGHTTEXTPATTERN)
&& (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != ::GetFocus()))
return 0;
@@ -240,35 +240,35 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- {
- wchar_t* szBuf = 0;
- int iLen = ::GetWindowTextLength(::GetDlgItem(hwndDlg, IDC_HIGHLIGHTNICKPATTERN));
- if (iLen) {
- szBuf = reinterpret_cast<wchar_t *>(mir_alloc((iLen + 2) * sizeof(wchar_t)));
- ::GetDlgItemText(hwndDlg, IDC_HIGHLIGHTNICKPATTERN, szBuf, iLen + 1);
- db_set_ts(0, CHAT_MODULE, "HighlightNames",szBuf);
- }
-
- iLen = ::GetWindowTextLength(::GetDlgItem(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN));
- if (iLen) {
- szBuf = reinterpret_cast<TCHAR *>(mir_realloc(szBuf, sizeof(wchar_t) * (iLen + 2)));
- ::GetDlgItemText(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN, szBuf, iLen + 1);
- db_set_ts(0, CHAT_MODULE, "HighlightWords", szBuf);
- }
- else db_set_ts(0, CHAT_MODULE, "HighlightWords", L"");
-
- mir_free(szBuf);
- BYTE dwFlags = (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKENABLE) ? MATCH_NICKNAME : 0) |
- (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTTEXTENABLE) ? MATCH_TEXT : 0);
-
- if (dwFlags & MATCH_NICKNAME)
- dwFlags |= (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKUID) ? MATCH_UIN : 0);
-
- db_set_b(0, CHAT_MODULE, "HighlightEnabled", dwFlags);
- db_set_b(0, CHAT_MODULE, "HighlightMe", ::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTME) ? 1 : 0);
- g_Settings.Highlight->init();
+ {
+ wchar_t* szBuf = 0;
+ int iLen = ::GetWindowTextLength(::GetDlgItem(hwndDlg, IDC_HIGHLIGHTNICKPATTERN));
+ if (iLen) {
+ szBuf = reinterpret_cast<wchar_t *>(mir_alloc((iLen + 2) * sizeof(wchar_t)));
+ ::GetDlgItemText(hwndDlg, IDC_HIGHLIGHTNICKPATTERN, szBuf, iLen + 1);
+ db_set_ts(0, CHAT_MODULE, "HighlightNames", szBuf);
}
- return TRUE;
+
+ iLen = ::GetWindowTextLength(::GetDlgItem(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN));
+ if (iLen) {
+ szBuf = reinterpret_cast<TCHAR *>(mir_realloc(szBuf, sizeof(wchar_t) * (iLen + 2)));
+ ::GetDlgItemText(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN, szBuf, iLen + 1);
+ db_set_ts(0, CHAT_MODULE, "HighlightWords", szBuf);
+ }
+ else db_set_ts(0, CHAT_MODULE, "HighlightWords", L"");
+
+ mir_free(szBuf);
+ BYTE dwFlags = (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKENABLE) ? MATCH_NICKNAME : 0) |
+ (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTTEXTENABLE) ? MATCH_TEXT : 0);
+
+ if (dwFlags & MATCH_NICKNAME)
+ dwFlags |= (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKUID) ? MATCH_UIN : 0);
+
+ db_set_b(0, CHAT_MODULE, "HighlightEnabled", dwFlags);
+ db_set_b(0, CHAT_MODULE, "HighlightMe", ::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTME) ? 1 : 0);
+ g_Settings.Highlight->init();
+ }
+ return TRUE;
}
}
break;
@@ -282,46 +282,46 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
*/
INT_PTR CALLBACK CMUCHighlight::dlgProcAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
- {
- HFONT hFont = (HFONT)::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTTITLE, WM_GETFONT, 0, 0);
-
- THighLightEdit *the = reinterpret_cast<THighLightEdit *>(lParam);
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, the->uCmd);
-
- LOGFONT lf = {0};
- ::GetObject(hFont, sizeof(lf), &lf);
- lf.lfWeight = FW_BOLD;
- lf.lfHeight = (int)(lf.lfHeight * 1.2);
- hFont = ::CreateFontIndirect(&lf);
-
- ::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTTITLE, WM_SETFONT, (WPARAM)hFont, FALSE);
- if (the->uCmd == THighLightEdit::CMD_ADD) {
- Utils::showDlgControl(hwndDlg, IDC_ADDHIGHLIGHTEDITLIST, SW_HIDE);
- ::SetDlgItemText(hwndDlg, IDC_ADDHIGHLIGHTTITLE, TranslateT("Add user to highlight list"));
- ::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTNAME, CB_INSERTSTRING, -1, (LPARAM)the->ui->pszNick);
- if ( mir_tstrcmp(the->ui->pszNick, the->ui->pszUID))
- ::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTNAME, CB_INSERTSTRING, -1, (LPARAM)the->ui->pszUID);
- ::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTNAME, CB_SETCURSEL, 0, 0);
- }
- else {
- Utils::showDlgControl(hwndDlg, IDC_ADDHIGHLIGHTNAME, SW_HIDE);
- Utils::showDlgControl(hwndDlg, IDC_ADDHIGHLIGHTEXPLAIN, SW_HIDE);
- ::SetDlgItemText(hwndDlg, IDC_ADDHIGHLIGHTTITLE, TranslateT("Edit user highlight list"));
- }
+ {
+ HFONT hFont = (HFONT)::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTTITLE, WM_GETFONT, 0, 0);
+
+ THighLightEdit *the = reinterpret_cast<THighLightEdit *>(lParam);
+ ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, the->uCmd);
+
+ LOGFONT lf = { 0 };
+ ::GetObject(hFont, sizeof(lf), &lf);
+ lf.lfWeight = FW_BOLD;
+ lf.lfHeight = (int)(lf.lfHeight * 1.2);
+ hFont = ::CreateFontIndirect(&lf);
+
+ ::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTTITLE, WM_SETFONT, (WPARAM)hFont, FALSE);
+ if (the->uCmd == THighLightEdit::CMD_ADD) {
+ Utils::showDlgControl(hwndDlg, IDC_ADDHIGHLIGHTEDITLIST, SW_HIDE);
+ ::SetDlgItemText(hwndDlg, IDC_ADDHIGHLIGHTTITLE, TranslateT("Add user to highlight list"));
+ ::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTNAME, CB_INSERTSTRING, -1, (LPARAM)the->ui->pszNick);
+ if (mir_tstrcmp(the->ui->pszNick, the->ui->pszUID))
+ ::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTNAME, CB_INSERTSTRING, -1, (LPARAM)the->ui->pszUID);
+ ::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTNAME, CB_SETCURSEL, 0, 0);
}
- break;
+ else {
+ Utils::showDlgControl(hwndDlg, IDC_ADDHIGHLIGHTNAME, SW_HIDE);
+ Utils::showDlgControl(hwndDlg, IDC_ADDHIGHLIGHTEXPLAIN, SW_HIDE);
+ ::SetDlgItemText(hwndDlg, IDC_ADDHIGHLIGHTTITLE, TranslateT("Edit user highlight list"));
+ }
+ }
+ break;
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC:
- {
- HWND hwndChild = (HWND)lParam;
- if (hwndChild == ::GetDlgItem(hwndDlg, IDC_ADDHIGHLIGHTTITLE))
- ::SetTextColor((HDC)wParam, RGB(60, 60, 150));
- ::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
- return (INT_PTR)::GetSysColorBrush(COLOR_WINDOW);
- }
+ {
+ HWND hwndChild = (HWND)lParam;
+ if (hwndChild == ::GetDlgItem(hwndDlg, IDC_ADDHIGHLIGHTTITLE))
+ ::SetTextColor((HDC)wParam, RGB(60, 60, 150));
+ ::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
+ return (INT_PTR)::GetSysColorBrush(COLOR_WINDOW);
+ }
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp
index f419927345..b895e70991 100644
--- a/plugins/TabSRMM/src/chat/options.cpp
+++ b/plugins/TabSRMM/src/chat/options.cpp
@@ -181,8 +181,8 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM
FontOptionsList *fol = fontOptionsList;
switch (section) {
- case FONTSECTION_IM: fol = IM_fontOptionsList; break;
- case FONTSECTION_IP: fol = IP_fontOptionsList; break;
+ case FONTSECTION_IM: fol = IM_fontOptionsList; break;
+ case FONTSECTION_IP: fol = IP_fontOptionsList; break;
}
if (colour) {
@@ -354,13 +354,13 @@ HICON LoadIconEx(char *pszIcoLibName)
static void InitSetting(TCHAR* &ppPointer, const char *pszSetting, const TCHAR *pszDefault)
{
- ptrT val( db_get_tsa(NULL, CHAT_MODULE, pszSetting));
+ ptrT val(db_get_tsa(NULL, CHAT_MODULE, pszSetting));
replaceStrT(ppPointer, (val != NULL) ? val : pszDefault);
}
#define OPT_FIXHEADINGS (WM_USER+1)
-static UINT _o1controls[] = {IDC_CHECKBOXES, IDC_GROUP, IDC_STATIC_ADD};
+static UINT _o1controls[] = { IDC_CHECKBOXES, IDC_GROUP, IDC_STATIC_ADD };
HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle)
{
@@ -400,7 +400,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
{
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE) | (TVS_NOHSCROLL));
/* Replace image list, destroy old. */
- ImageList_Destroy(TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_CHECKBOXES), CreateStateImageList(), TVSIL_NORMAL));
+ ImageList_Destroy(TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_CHECKBOXES), CreateStateImageList(), TVSIL_NORMAL));
hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), TranslateT("Appearance and functionality of chat room windows"), TRUE);
hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), TranslateT("Appearance of the message log"), TRUE);
@@ -486,8 +486,8 @@ static TCHAR* chatcolorsnames[] =
void RegisterFontServiceFonts() {
char szTemp[100];
LOGFONT lf;
- FontIDT fid = {0};
- ColourIDT cid = {0};
+ FontIDT fid = { 0 };
+ ColourIDT cid = { 0 };
fid.cbSize = sizeof(FontIDT);
cid.cbSize = sizeof(ColourIDT);
@@ -643,7 +643,7 @@ void RegisterFontServiceFonts() {
}
}
-int FontServiceFontsChanged(WPARAM,LPARAM)
+int FontServiceFontsChanged(WPARAM, LPARAM)
{
PluginConfig.reloadSettings();
CSkin::initAeroEffect();
@@ -663,7 +663,7 @@ static UINT _o2chatcontrols[] =
IDC_STATIC110, IDC_STATIC112, 0
};
-static UINT _o3chatcontrols[] = {0};
+static UINT _o3chatcontrols[] = { 0 };
INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@@ -695,32 +695,32 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
_T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n")
_T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
// contact vars
- _T("%nick%"), TranslateT("nick of current contact (if defined)"),
- _T("%proto%"), TranslateT("protocol name of current contact (if defined). Account name is used when protocol supports multiple accounts"),
- _T("%accountname%"), TranslateT("user-defined account name of current contact (if defined)."),
- _T("%userid%"), TranslateT("user ID of current contact (if defined). It is like UIN for ICQ, JID for Jabber, etc."),
+ _T("%nick%"), TranslateT("nick of current contact (if defined)"),
+ _T("%proto%"), TranslateT("protocol name of current contact (if defined). Account name is used when protocol supports multiple accounts"),
+ _T("%accountname%"), TranslateT("user-defined account name of current contact (if defined)."),
+ _T("%userid%"), TranslateT("user ID of current contact (if defined). It is like UIN for ICQ, JID for Jabber, etc."),
// global vars
- _T("%miranda_path%"), TranslateT("path to Miranda root folder"),
- _T("%miranda_profilesdir%"), TranslateT("path to folder containing Miranda profiles"),
- _T("%miranda_profilename%"), TranslateT("name of current Miranda profile (filename, without extension)"),
- _T("%miranda_userdata%"), TranslateT("will return parsed string %miranda_profilesdir%\\%miranda_profilename%"),
- _T("%miranda_logpath%"), TranslateT("will return parsed string %miranda_userdata%\\Logs"),
- _T("%appdata%"), TranslateT("same as environment variable %APPDATA% for currently logged-on Windows user"),
- _T("%username%"), TranslateT("username for currently logged-on Windows user"),
- _T("%mydocuments%"), TranslateT("\"My Documents\" folder for currently logged-on Windows user"),
- _T("%desktop%"), TranslateT("\"Desktop\" folder for currently logged-on Windows user"),
- _T("%xxxxxxx%"), TranslateT("any environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)"),
+ _T("%miranda_path%"), TranslateT("path to Miranda root folder"),
+ _T("%miranda_profilesdir%"), TranslateT("path to folder containing Miranda profiles"),
+ _T("%miranda_profilename%"), TranslateT("name of current Miranda profile (filename, without extension)"),
+ _T("%miranda_userdata%"), TranslateT("will return parsed string %miranda_profilesdir%\\%miranda_profilename%"),
+ _T("%miranda_logpath%"), TranslateT("will return parsed string %miranda_userdata%\\Logs"),
+ _T("%appdata%"), TranslateT("same as environment variable %APPDATA% for currently logged-on Windows user"),
+ _T("%username%"), TranslateT("username for currently logged-on Windows user"),
+ _T("%mydocuments%"), TranslateT("\"My Documents\" folder for currently logged-on Windows user"),
+ _T("%desktop%"), TranslateT("\"Desktop\" folder for currently logged-on Windows user"),
+ _T("%xxxxxxx%"), TranslateT("any environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)"),
// date/time vars
- _T("%d%"), TranslateT("day of month, 1-31"),
- _T("%dd%"), TranslateT("day of month, 01-31"),
- _T("%m%"), TranslateT("month number, 1-12"),
- _T("%mm%"), TranslateT("month number, 01-12"),
- _T("%mon%"), TranslateT("abbreviated month name"),
- _T("%month%"), TranslateT("full month name"),
- _T("%yy%"), TranslateT("year without century, 01-99"),
- _T("%yyyy%"), TranslateT("year with century, 1901-9999"),
- _T("%wday%"), TranslateT("abbreviated weekday name"),
- _T("%weekday%"), TranslateT("full weekday name"));
+ _T("%d%"), TranslateT("day of month, 1-31"),
+ _T("%dd%"), TranslateT("day of month, 01-31"),
+ _T("%m%"), TranslateT("month number, 1-12"),
+ _T("%mm%"), TranslateT("month number, 01-12"),
+ _T("%mon%"), TranslateT("abbreviated month name"),
+ _T("%month%"), TranslateT("full month name"),
+ _T("%yy%"), TranslateT("year without century, 01-99"),
+ _T("%yyyy%"), TranslateT("year with century, 1901-9999"),
+ _T("%wday%"), TranslateT("abbreviated weekday name"),
+ _T("%weekday%"), TranslateT("full weekday name"));
hPathTip = CreateToolTip(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), tszTooltipText, TranslateT("Variables"));
}
}
@@ -729,7 +729,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
break;
case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_INSTAMP
+ if ((LOWORD(wParam) == IDC_INSTAMP
|| LOWORD(wParam) == IDC_OUTSTAMP
|| LOWORD(wParam) == IDC_TIMESTAMP
|| LOWORD(wParam) == IDC_LOGLIMIT
@@ -744,68 +744,68 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
// and possibly delete archived logs.
switch (LOWORD(wParam)) {
case IDC_MUC_OPENLOGBASEDIR:
- {
- TCHAR tszTemp[MAX_PATH + 20];
- _tcsncpy_s(tszTemp, g_Settings.pszLogDir, _TRUNCATE);
-
- TCHAR *p = tszTemp;
- while(*p && (*p == '\\' || *p == '.'))
- p++;
-
- if (*p)
- if (TCHAR *p1 = _tcschr(p, '\\'))
- *p1 = 0;
-
- TCHAR tszInitialDir[_MAX_DRIVE + _MAX_PATH + 10];
- mir_sntprintf(tszInitialDir, SIZEOF(tszInitialDir), _T("%s%s"), M.getChatLogPath(), p);
- if (!PathFileExists(tszInitialDir))
- _tcsncpy_s(tszInitialDir, M.getChatLogPath(), _TRUNCATE);
-
- TCHAR tszReturnName[MAX_PATH]; tszReturnName[0] = 0;
- mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%s%c*.*%c%c"), TranslateT("All files"), 0, 0, 0);
-
- OPENFILENAME ofn = { 0 };
- ofn.lpstrInitialDir = tszInitialDir;
- ofn.lpstrFilter = tszTemp;
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- ofn.lpstrFile = tszReturnName;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
- ofn.lpstrDefExt = _T("log");
- GetOpenFileName(&ofn);
- }
- break;
+ {
+ TCHAR tszTemp[MAX_PATH + 20];
+ _tcsncpy_s(tszTemp, g_Settings.pszLogDir, _TRUNCATE);
+
+ TCHAR *p = tszTemp;
+ while (*p && (*p == '\\' || *p == '.'))
+ p++;
+
+ if (*p)
+ if (TCHAR *p1 = _tcschr(p, '\\'))
+ *p1 = 0;
+
+ TCHAR tszInitialDir[_MAX_DRIVE + _MAX_PATH + 10];
+ mir_sntprintf(tszInitialDir, SIZEOF(tszInitialDir), _T("%s%s"), M.getChatLogPath(), p);
+ if (!PathFileExists(tszInitialDir))
+ _tcsncpy_s(tszInitialDir, M.getChatLogPath(), _TRUNCATE);
+
+ TCHAR tszReturnName[MAX_PATH]; tszReturnName[0] = 0;
+ mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%s%c*.*%c%c"), TranslateT("All files"), 0, 0, 0);
+
+ OPENFILENAME ofn = { 0 };
+ ofn.lpstrInitialDir = tszInitialDir;
+ ofn.lpstrFilter = tszTemp;
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ ofn.lpstrFile = tszReturnName;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.Flags = OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
+ ofn.lpstrDefExt = _T("log");
+ GetOpenFileName(&ofn);
+ }
+ break;
case IDC_FONTCHOOSE:
- {
- TCHAR tszDirectory[MAX_PATH];
- LPMALLOC psMalloc;
-
- if (SUCCEEDED(CoGetMalloc(1, &psMalloc))) {
- BROWSEINFO bi = { 0 };
- bi.hwndOwner = hwndDlg;
- bi.pszDisplayName = tszDirectory;
- bi.lpszTitle = TranslateT("Select folder");
- bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
- bi.lpfn = BrowseCallbackProc;
- bi.lParam = (LPARAM)tszDirectory;
-
- LPITEMIDLIST idList = SHBrowseForFolder(&bi);
- if (idList) {
- const TCHAR *szUserDir = M.getUserDir();
- SHGetPathFromIDList(idList, tszDirectory);
- mir_tstrcat(tszDirectory, _T("\\"));
-
- TCHAR tszTemp[MAX_PATH];
- PathToRelativeT(tszDirectory, tszTemp, szUserDir);
- SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_tstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
- }
- psMalloc->Free(idList);
- psMalloc->Release();
+ {
+ TCHAR tszDirectory[MAX_PATH];
+ LPMALLOC psMalloc;
+
+ if (SUCCEEDED(CoGetMalloc(1, &psMalloc))) {
+ BROWSEINFO bi = { 0 };
+ bi.hwndOwner = hwndDlg;
+ bi.pszDisplayName = tszDirectory;
+ bi.lpszTitle = TranslateT("Select folder");
+ bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
+ bi.lpfn = BrowseCallbackProc;
+ bi.lParam = (LPARAM)tszDirectory;
+
+ LPITEMIDLIST idList = SHBrowseForFolder(&bi);
+ if (idList) {
+ const TCHAR *szUserDir = M.getUserDir();
+ SHGetPathFromIDList(idList, tszDirectory);
+ mir_tstrcat(tszDirectory, _T("\\"));
+
+ TCHAR tszTemp[MAX_PATH];
+ PathToRelativeT(tszDirectory, tszTemp, szUserDir);
+ SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_tstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
}
+ psMalloc->Free(idList);
+ psMalloc->Release();
}
- break;
+ }
+ break;
case IDC_LOGGING:
Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
@@ -953,7 +953,7 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lParam)
DWORD dwPopupFlags = M.GetDword(CHAT_MODULE, "PopupFlags", GC_EVENT_HIGHLIGHT);
DWORD dwLogFlags = M.GetDword(CHAT_MODULE, "DiskLogFlags", GC_EVENT_ALL);
- for (int i=0; i < SIZEOF(_eventorder); i++) {
+ for (int i = 0; i < SIZEOF(_eventorder); i++) {
if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
CheckDlgButton(hwndDlg, IDC_1 + i, dwFilterFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_L1 + i, dwLogFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
@@ -985,7 +985,7 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lParam)
DWORD dwFilterFlags = 0, dwTrayFlags = 0,
dwPopupFlags = 0, dwLogFlags = 0;
- for (int i=0; i < SIZEOF(_eventorder); i++) {
+ for (int i = 0; i < SIZEOF(_eventorder); i++) {
if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
dwFilterFlags |= (IsDlgButtonChecked(hwndDlg, IDC_1 + i) ? _eventorder[i] : 0);
dwLogFlags |= (IsDlgButtonChecked(hwndDlg, IDC_L1 + i) ? _eventorder[i] : 0);
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp
index 35d55d78c2..19b489d1db 100644
--- a/plugins/TabSRMM/src/chat/tools.cpp
+++ b/plugins/TabSRMM/src/chat/tools.cpp
@@ -114,8 +114,8 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa
PROTOACCOUNT *pa = ProtoGetAccount(pszProtoName);
mir_sntprintf(pd.lptzContactName, SIZEOF(pd.lptzContactName), _T("%s - %s"),
- (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName,
- pcli->pfnGetContactDisplayName(hContact, 0));
+ (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName,
+ pcli->pfnGetContactDisplayName(hContact, 0));
_tcsncpy_s(pd.lptzText, TranslateTS(szBuf), _TRUNCATE);
pd.iSeconds = g_Settings.iPopupTimeout;
@@ -205,7 +205,7 @@ passed:
if (iNewEvent == GC_EVENT_MESSAGE) {
ShowPopup(si->hContact, si, pci->hIcons[ICON_MESSAGE], si->pszModule, si->ptszName, clr ? clr : pci->aFonts[9].color,
- TranslateT("%s%s says:%s %s"), bbStart, gce->ptszNick, bbEnd, pci->RemoveFormatting(gce->ptszText));
+ TranslateT("%s%s says:%s %s"), bbStart, gce->ptszNick, bbEnd, pci->RemoveFormatting(gce->ptszText));
}
else saveCI.DoPopup(si, gce);
@@ -470,7 +470,7 @@ int Chat_GetColorIndex(const char* pszModule, COLORREF cr)
if (!pMod || pMod->nColorCount == 0)
return -1;
- for (int i=0; i < pMod->nColorCount; i++)
+ for (int i = 0; i < pMod->nColorCount; i++)
if (pMod->crColors[i] == cr)
return i;
@@ -484,7 +484,7 @@ TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2)
_tsetlocale(LC_ALL, _T(""));
for (i = 0; s1[i]; i++)
for (j = i, k = 0; _totlower(s1[j]) == _totlower(s2[k]); j++, k++)
- if (!s2[k+1])
+ if (!s2[k + 1])
return (TCHAR*)(s1 + i);
return NULL;
@@ -560,7 +560,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO
if (gcmi.nItems > 0)
AppendMenu(*hMenu, MF_SEPARATOR, 0, 0);
- for (int i=0; i < gcmi.nItems; i++) {
+ for (int i = 0; i < gcmi.nItems; i++) {
TCHAR *ptszText = TranslateTS(gcmi.Item[i].pszDesc);
DWORD dwState = gcmi.Item[i].bDisabled ? MF_GRAYED : 0;
@@ -622,7 +622,7 @@ void Chat_SetFilters(SESSION_INFO *si)
DWORD dwMask = db_get_dw(si->hContact, CHAT_MODULE, "FilterMask", 0);
si->iLogFilterFlags = dwFlags_default;
- for (int i=0; i < 32; i++)
+ for (int i = 0; i < 32; i++)
if (dwMask & (1 << i))
si->iLogFilterFlags = (dwFlags_local & (1 << i) ? si->iLogFilterFlags | (1 << i) : si->iLogFilterFlags & ~(1 << i));
@@ -631,7 +631,7 @@ void Chat_SetFilters(SESSION_INFO *si)
dwMask = db_get_dw(si->hContact, CHAT_MODULE, "PopupMask", 0);
si->iLogPopupFlags = dwFlags_default;
- for (int i=0; i < 32; i++)
+ for (int i = 0; i < 32; i++)
if (dwMask & (1 << i))
si->iLogPopupFlags = (dwFlags_local & (1 << i) ? si->iLogPopupFlags | (1 << i) : si->iLogPopupFlags & ~(1 << i));
@@ -642,7 +642,7 @@ void Chat_SetFilters(SESSION_INFO *si)
si->iDiskLogFlags = M.GetDword(CHAT_MODULE, "DiskLogFlags", 0xFFFF);
si->iLogTrayFlags = dwFlags_default;
- for (int i=0; i < 32; i++)
+ for (int i = 0; i < 32; i++)
if (dwMask & (1 << i))
si->iLogTrayFlags = (dwFlags_local & (1 << i) ? si->iLogTrayFlags | (1 << i) : si->iLogTrayFlags & ~(1 << i));
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 310e5ecfc6..db496d27a3 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -32,8 +32,8 @@
extern LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
extern HRESULT(WINAPI *MyCloseThemeData)(HANDLE);
-int g_cLinesPerPage=0;
-int g_iWheelCarryover=0;
+int g_cLinesPerPage = 0;
+int g_iWheelCarryover = 0;
extern HMENU g_hMenu;
@@ -60,7 +60,7 @@ static BOOL CheckCustomLink(HWND hwndDlg, POINT *ptClient, UINT uMsg, WPARAM wPa
{
long res = 0, cnt = 0;
long cpMin = 0, cpMax = 0;
- POINT ptEnd = {0};
+ POINT ptEnd = { 0 };
IRichEditOle* RichEditOle = NULL;
ITextDocument* TextDocument = NULL;
ITextRange* TextRange = NULL;
@@ -134,7 +134,7 @@ bool IsStringValidLink(TCHAR *pszText)
{
if (pszText == NULL)
return false;
-
+
if (mir_tstrlen(pszText) < 5 || _tcschr(pszText, '"'))
return false;
@@ -432,7 +432,7 @@ static bool TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si)
int start = LOWORD(lResult), end = HIWORD(lResult);
SendMessage(hwnd, EM_SETSEL, end, end);
- GETTEXTEX gt = {0};
+ GETTEXTEX gt = { 0 };
gt.codepage = 1200;
gt.flags = GTL_DEFAULT | GTL_PRECISE;
int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gt, 0);
@@ -447,31 +447,31 @@ static bool TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si)
gt.cb = (iLen + 9) * sizeof(TCHAR);
SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)&gt, (LPARAM)pszText);
- if (start > 1 && pszText[start-1] == ' ' && pszText[start-2] == ':')
+ if (start > 1 && pszText[start - 1] == ' ' && pszText[start - 2] == ':')
start -= 2;
if (dat->szSearchResult != NULL) {
int cbResult = (int)_tcslen(dat->szSearchResult);
- if (start >= cbResult && !_tcsncicmp(dat->szSearchResult, pszText+start-cbResult, cbResult)) {
+ if (start >= cbResult && !_tcsncicmp(dat->szSearchResult, pszText + start - cbResult, cbResult)) {
start -= cbResult;
goto LBL_SkipEnd;
}
}
- while(start > 0 && pszText[start-1] != ' ' && pszText[start-1] != 13 && pszText[start-1] != VK_TAB)
+ while (start > 0 && pszText[start - 1] != ' ' && pszText[start - 1] != 13 && pszText[start - 1] != VK_TAB)
start--;
LBL_SkipEnd:
- while (end < iLen && pszText[end] != ' ' && pszText[end] != 13 && pszText[end-1] != VK_TAB)
+ while (end < iLen && pszText[end] != ' ' && pszText[end] != 13 && pszText[end - 1] != VK_TAB)
end++;
if (pszText[start] == '#')
isRoom = TRUE;
else {
int topicStart = start;
- while (topicStart > 0 && (pszText[topicStart-1] == ' ' || pszText[topicStart-1] == 13 || pszText[topicStart-1] == VK_TAB))
+ while (topicStart > 0 && (pszText[topicStart - 1] == ' ' || pszText[topicStart - 1] == 13 || pszText[topicStart - 1] == VK_TAB))
topicStart--;
- if (topicStart > 5 && _tcsstr(&pszText[topicStart-6], _T("/topic")) == &pszText[topicStart-6])
+ if (topicStart > 5 && _tcsstr(&pszText[topicStart - 6], _T("/topic")) == &pszText[topicStart - 6])
isTopic = TRUE;
}
if (dat->szSearchQuery == NULL) {
@@ -542,70 +542,70 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
return 0;
case WM_CONTEXTMENU:
- {
- MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
- CHARRANGE sel, all = { 0, -1};
- int idFrom = IDC_CHAT_MESSAGE;
-
- POINT pt;
- GetCursorPos(&pt);
- HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- HMENU hSubMenu = GetSubMenu(hMenu, 2);
- RemoveMenu(hSubMenu, 9, MF_BYPOSITION);
- RemoveMenu(hSubMenu, 8, MF_BYPOSITION);
- RemoveMenu(hSubMenu, 4, MF_BYPOSITION);
- EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, MF_BYCOMMAND | ((mi && mi->bBold) ? MF_ENABLED : MF_GRAYED));
- TranslateMenu(hSubMenu);
-
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin == sel.cpMax) {
- EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
- if (idFrom == IDC_CHAT_MESSAGE)
- EnableMenuItem(hSubMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED);
- }
-
- MessageWindowPopupData mwpd = { sizeof(mwpd) };
- mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
- mwpd.uFlags = (idFrom == IDC_LOG ? MSG_WINDOWPOPUP_LOG : MSG_WINDOWPOPUP_INPUT);
- mwpd.hContact = mwdat->hContact;
- mwpd.hwnd = hwnd;
- mwpd.hMenu = hSubMenu;
- mwpd.pt = pt;
- NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
-
- int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, GetParent(hwnd), NULL);
-
- mwpd.selection = iSelection;
- mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
- NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
+ {
+ MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
+ CHARRANGE sel, all = { 0, -1 };
+ int idFrom = IDC_CHAT_MESSAGE;
- switch (iSelection) {
- case IDM_COPY:
- SendMessage(hwnd, WM_COPY, 0, 0);
- break;
- case IDM_CUT:
- SendMessage(hwnd, WM_CUT, 0, 0);
- break;
- case IDM_PASTE:
- case IDM_PASTEFORMATTED:
- if (idFrom == IDC_CHAT_MESSAGE)
- SendMessage(hwnd, EM_PASTESPECIAL, (iSelection == IDM_PASTE) ? CF_UNICODETEXT : 0, 0);
- break;
- case IDM_COPYALL:
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all);
- SendMessage(hwnd, WM_COPY, 0, 0);
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel);
- break;
- case IDM_SELECTALL:
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all);
- break;
- }
- DestroyMenu(hMenu);
+ POINT pt;
+ GetCursorPos(&pt);
+ HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hSubMenu = GetSubMenu(hMenu, 2);
+ RemoveMenu(hSubMenu, 9, MF_BYPOSITION);
+ RemoveMenu(hSubMenu, 8, MF_BYPOSITION);
+ RemoveMenu(hSubMenu, 4, MF_BYPOSITION);
+ EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, MF_BYCOMMAND | ((mi && mi->bBold) ? MF_ENABLED : MF_GRAYED));
+ TranslateMenu(hSubMenu);
+
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin == sel.cpMax) {
+ EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
+ if (idFrom == IDC_CHAT_MESSAGE)
+ EnableMenuItem(hSubMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED);
+ }
+
+ MessageWindowPopupData mwpd = { sizeof(mwpd) };
+ mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
+ mwpd.uFlags = (idFrom == IDC_LOG ? MSG_WINDOWPOPUP_LOG : MSG_WINDOWPOPUP_INPUT);
+ mwpd.hContact = mwdat->hContact;
+ mwpd.hwnd = hwnd;
+ mwpd.hMenu = hSubMenu;
+ mwpd.pt = pt;
+ NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
+
+ int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, GetParent(hwnd), NULL);
+
+ mwpd.selection = iSelection;
+ mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
+ NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
+
+ switch (iSelection) {
+ case IDM_COPY:
+ SendMessage(hwnd, WM_COPY, 0, 0);
+ break;
+ case IDM_CUT:
+ SendMessage(hwnd, WM_CUT, 0, 0);
+ break;
+ case IDM_PASTE:
+ case IDM_PASTEFORMATTED:
+ if (idFrom == IDC_CHAT_MESSAGE)
+ SendMessage(hwnd, EM_PASTESPECIAL, (iSelection == IDM_PASTE) ? CF_UNICODETEXT : 0, 0);
+ break;
+ case IDM_COPYALL:
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all);
+ SendMessage(hwnd, WM_COPY, 0, 0);
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel);
+ break;
+ case IDM_SELECTALL:
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all);
+ break;
}
- return TRUE;
+ DestroyMenu(hMenu);
+ }
+ return TRUE;
case WM_MOUSEWHEEL:
- if ( DM_MouseWheelHandler(hwnd, hwndParent, mwdat, wParam, lParam) == 0)
+ if (DM_MouseWheelHandler(hwnd, hwndParent, mwdat, wParam, lParam) == 0)
return 0;
dat->lastEnterTime = 0;
@@ -641,260 +641,260 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_CHAR:
- {
- BOOL isShift, isAlt, isCtrl;
- KbdState(mwdat, isShift, isCtrl, isAlt);
+ {
+ BOOL isShift, isAlt, isCtrl;
+ KbdState(mwdat, isShift, isCtrl, isAlt);
- if (PluginConfig.m_bSoundOnTyping && !isAlt &&!isCtrl&&!(mwdat->pContainer->dwFlags&CNT_NOSOUND) && wParam != VK_ESCAPE&&!(wParam == VK_TAB&&PluginConfig.m_bAllowTab))
- SkinPlaySound("SoundOnTyping");
+ if (PluginConfig.m_bSoundOnTyping && !isAlt &&!isCtrl&&!(mwdat->pContainer->dwFlags&CNT_NOSOUND) && wParam != VK_ESCAPE&&!(wParam == VK_TAB&&PluginConfig.m_bAllowTab))
+ SkinPlaySound("SoundOnTyping");
- if (isCtrl && !isAlt && !isShift) {
- MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
+ if (isCtrl && !isAlt && !isShift) {
+ MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
- switch(wParam) {
- case 0x09: // ctrl-i (italics)
- if (mi && mi->bItalics) {
- CheckDlgButton(hwndParent, IDC_ITALICS, IsDlgButtonChecked(hwndParent, IDC_ITALICS) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_ITALICS, 0), 0);
- }
- return 0;
- case 0x02: // ctrl-b (bold)
- if (mi && mi->bBold) {
- CheckDlgButton(hwndParent, IDC_CHAT_BOLD, IsDlgButtonChecked(hwndParent, IDC_CHAT_BOLD) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_BOLD, 0), 0);
- }
- return 0;
- case 0x20: // ctrl-space clear formatting
- if (mi && mi->bBold && mi->bItalics && mi->bUnderline) {
- CheckDlgButton(hwndParent, IDC_BKGCOLOR, BST_UNCHECKED);
- CheckDlgButton(hwndParent, IDC_COLOR, BST_UNCHECKED);
- CheckDlgButton(hwndParent, IDC_CHAT_BOLD, BST_UNCHECKED);
- CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, BST_UNCHECKED);
- CheckDlgButton(hwndParent, IDC_ITALICS, BST_UNCHECKED);
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_BKGCOLOR, 0), 0);
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_COLOR, 0), 0);
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_BOLD, 0), 0);
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_UNDERLINE, 0), 0);
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_ITALICS, 0), 0);
- }
- return 0;
- case 0x0c: // ctrl-l background color
- if (mi && mi->bBkgColor) {
- CheckDlgButton(hwndParent, IDC_BKGCOLOR, IsDlgButtonChecked(hwndParent, IDC_BKGCOLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_BKGCOLOR, 0), 0);
- }
- return 0;
- case 0x15: // ctrl-u underlined
- if (mi && mi->bUnderline) {
- CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, IsDlgButtonChecked(hwndParent, IDC_CHAT_UNDERLINE) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_UNDERLINE, 0), 0);
- }
- return 0; // ctrl-k color
- case 0x0b:
- if (mi && mi->bColor) {
- CheckDlgButton(hwndParent, IDC_COLOR, IsDlgButtonChecked(hwndParent, IDC_COLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_COLOR, 0), 0);
- }
- return 0;
- case 0x17:
- PostMessage(hwndParent, WM_CLOSE, 0, 1);
- return 0;
+ switch (wParam) {
+ case 0x09: // ctrl-i (italics)
+ if (mi && mi->bItalics) {
+ CheckDlgButton(hwndParent, IDC_ITALICS, IsDlgButtonChecked(hwndParent, IDC_ITALICS) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_ITALICS, 0), 0);
}
+ return 0;
+ case 0x02: // ctrl-b (bold)
+ if (mi && mi->bBold) {
+ CheckDlgButton(hwndParent, IDC_CHAT_BOLD, IsDlgButtonChecked(hwndParent, IDC_CHAT_BOLD) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_BOLD, 0), 0);
+ }
+ return 0;
+ case 0x20: // ctrl-space clear formatting
+ if (mi && mi->bBold && mi->bItalics && mi->bUnderline) {
+ CheckDlgButton(hwndParent, IDC_BKGCOLOR, BST_UNCHECKED);
+ CheckDlgButton(hwndParent, IDC_COLOR, BST_UNCHECKED);
+ CheckDlgButton(hwndParent, IDC_CHAT_BOLD, BST_UNCHECKED);
+ CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, BST_UNCHECKED);
+ CheckDlgButton(hwndParent, IDC_ITALICS, BST_UNCHECKED);
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_BKGCOLOR, 0), 0);
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_COLOR, 0), 0);
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_BOLD, 0), 0);
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_UNDERLINE, 0), 0);
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_ITALICS, 0), 0);
+ }
+ return 0;
+ case 0x0c: // ctrl-l background color
+ if (mi && mi->bBkgColor) {
+ CheckDlgButton(hwndParent, IDC_BKGCOLOR, IsDlgButtonChecked(hwndParent, IDC_BKGCOLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_BKGCOLOR, 0), 0);
+ }
+ return 0;
+ case 0x15: // ctrl-u underlined
+ if (mi && mi->bUnderline) {
+ CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, IsDlgButtonChecked(hwndParent, IDC_CHAT_UNDERLINE) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_UNDERLINE, 0), 0);
+ }
+ return 0; // ctrl-k color
+ case 0x0b:
+ if (mi && mi->bColor) {
+ CheckDlgButton(hwndParent, IDC_COLOR, IsDlgButtonChecked(hwndParent, IDC_COLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_COLOR, 0), 0);
+ }
+ return 0;
+ case 0x17:
+ PostMessage(hwndParent, WM_CLOSE, 0, 1);
+ return 0;
}
}
- break;
+ }
+ break;
case WM_KEYDOWN:
- {
- static size_t start, end;
- BOOL isShift, isCtrl, isAlt;
- KbdState(mwdat, isShift, isCtrl, isAlt);
-
- // sound on typing..
- if (PluginConfig.m_bSoundOnTyping&&!isAlt&&wParam == VK_DELETE)
- SkinPlaySound("SoundOnTyping");
-
- if (wParam == VK_INSERT && !isShift && !isCtrl && !isAlt) {
- mwdat->fInsertMode = !mwdat->fInsertMode;
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
- }
- if (wParam == VK_CAPITAL || wParam == VK_NUMLOCK)
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
-
- if (isCtrl && isAlt && !isShift) {
- switch (wParam) {
- case VK_UP:
- case VK_DOWN:
- case VK_PRIOR:
- case VK_NEXT:
- case VK_HOME:
- case VK_END:
- WPARAM wp = 0;
-
- if (wParam == VK_UP)
- wp = MAKEWPARAM(SB_LINEUP, 0);
- else if (wParam == VK_PRIOR)
- wp = MAKEWPARAM(SB_PAGEUP, 0);
- else if (wParam == VK_NEXT)
- wp = MAKEWPARAM(SB_PAGEDOWN, 0);
- else if (wParam == VK_HOME)
- wp = MAKEWPARAM(SB_TOP, 0);
- else if (wParam == VK_END) {
- DM_ScrollToBottom(mwdat, 0, 0);
- return 0;
- }
- else if (wParam == VK_DOWN)
- wp = MAKEWPARAM(SB_LINEDOWN, 0);
-
- SendDlgItemMessage(hwndParent, IDC_CHAT_LOG, WM_VSCROLL, wp, 0);
- return 0;
- }
- }
+ {
+ static size_t start, end;
+ BOOL isShift, isCtrl, isAlt;
+ KbdState(mwdat, isShift, isCtrl, isAlt);
- if (wParam == VK_RETURN) {
- if (isShift) {
- if (PluginConfig.m_bSendOnShiftEnter) {
- PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
- return 0;
- }
- break;
- }
- if ((isCtrl && !isShift) ^(0 != PluginConfig.m_bSendOnEnter)) {
- PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
+ // sound on typing..
+ if (PluginConfig.m_bSoundOnTyping&&!isAlt&&wParam == VK_DELETE)
+ SkinPlaySound("SoundOnTyping");
+
+ if (wParam == VK_INSERT && !isShift && !isCtrl && !isAlt) {
+ mwdat->fInsertMode = !mwdat->fInsertMode;
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
+ }
+ if (wParam == VK_CAPITAL || wParam == VK_NUMLOCK)
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
+
+ if (isCtrl && isAlt && !isShift) {
+ switch (wParam) {
+ case VK_UP:
+ case VK_DOWN:
+ case VK_PRIOR:
+ case VK_NEXT:
+ case VK_HOME:
+ case VK_END:
+ WPARAM wp = 0;
+
+ if (wParam == VK_UP)
+ wp = MAKEWPARAM(SB_LINEUP, 0);
+ else if (wParam == VK_PRIOR)
+ wp = MAKEWPARAM(SB_PAGEUP, 0);
+ else if (wParam == VK_NEXT)
+ wp = MAKEWPARAM(SB_PAGEDOWN, 0);
+ else if (wParam == VK_HOME)
+ wp = MAKEWPARAM(SB_TOP, 0);
+ else if (wParam == VK_END) {
+ DM_ScrollToBottom(mwdat, 0, 0);
return 0;
}
- if (!PluginConfig.m_bSendOnEnter && !PluginConfig.m_bSendOnDblEnter)
- break;
- if (isCtrl)
- break;
+ else if (wParam == VK_DOWN)
+ wp = MAKEWPARAM(SB_LINEDOWN, 0);
- if (PluginConfig.m_bSendOnDblEnter) {
- if (dat->lastEnterTime + 2 < time(NULL)) {
- dat->lastEnterTime = time(NULL);
- break;
- }
+ SendDlgItemMessage(hwndParent, IDC_CHAT_LOG, WM_VSCROLL, wp, 0);
+ return 0;
+ }
+ }
- SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
- SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
+ if (wParam == VK_RETURN) {
+ if (isShift) {
+ if (PluginConfig.m_bSendOnShiftEnter) {
PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
return 0;
}
+ break;
+ }
+ if ((isCtrl && !isShift) ^ (0 != PluginConfig.m_bSendOnEnter)) {
PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
return 0;
}
- else dat->lastEnterTime = 0;
-
- if ((wParam == VK_NEXT && isCtrl && !isShift) || (wParam == VK_TAB && isCtrl && !isShift)) { // CTRL-TAB (switch tab/window)
- SendMessage(mwdat->pContainer->hwnd, DM_SELECTTAB, DM_SELECT_NEXT, 0);
- return TRUE;
- }
+ if (!PluginConfig.m_bSendOnEnter && !PluginConfig.m_bSendOnDblEnter)
+ break;
+ if (isCtrl)
+ break;
- if ((wParam == VK_PRIOR && isCtrl && !isShift) || (wParam == VK_TAB && isCtrl && isShift)) { // CTRL_SHIFT-TAB (switch tab/window)
- SendMessage(mwdat->pContainer->hwnd, DM_SELECTTAB, DM_SELECT_PREV, 0);
- return TRUE;
- }
- if (wParam == VK_TAB && !isCtrl && !isShift) { //tab-autocomplete
- SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
- bool fCompleted = TabAutoComplete(hwnd, dat, si);
- SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
- if (!fCompleted && !PluginConfig.m_bAllowTab) {
- if ((GetSendButtonState(mwdat->hwnd) != PBS_DISABLED))
- SetFocus(GetDlgItem(mwdat->hwnd, IDOK));
- else
- SetFocus(GetDlgItem(mwdat->hwnd, IDC_CHAT_LOG));
+ if (PluginConfig.m_bSendOnDblEnter) {
+ if (dat->lastEnterTime + 2 < time(NULL)) {
+ dat->lastEnterTime = time(NULL);
+ break;
}
- return 0;
- }
- if (wParam != VK_RIGHT && wParam != VK_LEFT) {
- mir_free(dat->szSearchQuery);
- dat->szSearchQuery = NULL;
- mir_free(dat->szSearchResult);
- dat->szSearchResult = NULL;
- }
- if (wParam == VK_F4 && isCtrl && !isAlt) { // ctrl-F4 (close tab)
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_CLOSE, BN_CLICKED), 0);
+ SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
+ SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
+ PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
return 0;
}
+ PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ else dat->lastEnterTime = 0;
- if (wParam == VK_NEXT || wParam == VK_PRIOR) {
- HWND htemp = hwndParent;
- SendDlgItemMessage(htemp, IDC_CHAT_LOG, msg, wParam, lParam);
- dat->lastEnterTime = 0;
- return 0;
- }
+ if ((wParam == VK_NEXT && isCtrl && !isShift) || (wParam == VK_TAB && isCtrl && !isShift)) { // CTRL-TAB (switch tab/window)
+ SendMessage(mwdat->pContainer->hwnd, DM_SELECTTAB, DM_SELECT_NEXT, 0);
+ return TRUE;
+ }
- if (wParam == VK_UP && isCtrl && !isAlt) {
- char *lpPrevCmd = pci->SM_GetPrevCommand(si->ptszID, si->pszModule);
+ if ((wParam == VK_PRIOR && isCtrl && !isShift) || (wParam == VK_TAB && isCtrl && isShift)) { // CTRL_SHIFT-TAB (switch tab/window)
+ SendMessage(mwdat->pContainer->hwnd, DM_SELECTTAB, DM_SELECT_PREV, 0);
+ return TRUE;
+ }
+ if (wParam == VK_TAB && !isCtrl && !isShift) { //tab-autocomplete
+ SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+ bool fCompleted = TabAutoComplete(hwnd, dat, si);
+ SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
+ RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
+ if (!fCompleted && !PluginConfig.m_bAllowTab) {
+ if ((GetSendButtonState(mwdat->hwnd) != PBS_DISABLED))
+ SetFocus(GetDlgItem(mwdat->hwnd, IDOK));
+ else
+ SetFocus(GetDlgItem(mwdat->hwnd, IDC_CHAT_LOG));
+ }
+ return 0;
+ }
+ if (wParam != VK_RIGHT && wParam != VK_LEFT) {
+ mir_free(dat->szSearchQuery);
+ dat->szSearchQuery = NULL;
+ mir_free(dat->szSearchResult);
+ dat->szSearchResult = NULL;
+ }
- if (!si->lpCurrentCommand || !si->lpCurrentCommand->last) {
- // Next command is not defined. It means currently entered text is not saved in the history and it
- // need to be saved in the window context.
- char *enteredText = Message_GetFromStream(hwndParent);
- if (mwdat->enteredText)
- mir_free(mwdat->enteredText);
+ if (wParam == VK_F4 && isCtrl && !isAlt) { // ctrl-F4 (close tab)
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_CLOSE, BN_CLICKED), 0);
+ return 0;
+ }
- mwdat->enteredText = enteredText;
- }
+ if (wParam == VK_NEXT || wParam == VK_PRIOR) {
+ HWND htemp = hwndParent;
+ SendDlgItemMessage(htemp, IDC_CHAT_LOG, msg, wParam, lParam);
+ dat->lastEnterTime = 0;
+ return 0;
+ }
- SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+ if (wParam == VK_UP && isCtrl && !isAlt) {
+ char *lpPrevCmd = pci->SM_GetPrevCommand(si->ptszID, si->pszModule);
- LOGFONTA lf;
- LoadLogfont(MSGFONTID_MESSAGEAREA, &lf, NULL, FONTMODULE);
+ if (!si->lpCurrentCommand || !si->lpCurrentCommand->last) {
+ // Next command is not defined. It means currently entered text is not saved in the history and it
+ // need to be saved in the window context.
+ char *enteredText = Message_GetFromStream(hwndParent);
+ if (mwdat->enteredText)
+ mir_free(mwdat->enteredText);
- SETTEXTEX ste;
- ste.flags = ST_DEFAULT;
- ste.codepage = CP_ACP;
- if (lpPrevCmd)
- SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd);
- else
- SetWindowText(hwnd, _T(""));
-
- GETTEXTLENGTHEX gtl = { 0 };
- gtl.flags = GTL_PRECISE;
- gtl.codepage = CP_ACP;
- int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
- SendMessage(hwnd, EM_SCROLLCARET, 0, 0);
- SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
- SendMessage(hwnd, EM_SETSEL, iLen, iLen);
- dat->lastEnterTime = 0;
- return 0;
+ mwdat->enteredText = enteredText;
}
- if (wParam == VK_DOWN && isCtrl && !isAlt) {
- GETTEXTLENGTHEX gtl = {0};
- SETTEXTEX ste;
+ SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
- char *lpPrevCmd = pci->SM_GetNextCommand(si->ptszID, si->pszModule);
- SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+ LOGFONTA lf;
+ LoadLogfont(MSGFONTID_MESSAGEAREA, &lf, NULL, FONTMODULE);
- ste.flags = ST_DEFAULT;
- ste.codepage = CP_ACP;
- if (lpPrevCmd)
- SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd);
- else if (mwdat->enteredText) {
- // If we cannot load the message from history, load the last edited text.
- SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)mwdat->enteredText);
- mir_free(mwdat->enteredText);
- mwdat->enteredText = NULL;
- }
+ SETTEXTEX ste;
+ ste.flags = ST_DEFAULT;
+ ste.codepage = CP_ACP;
+ if (lpPrevCmd)
+ SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd);
+ else
+ SetWindowText(hwnd, _T(""));
+
+ GETTEXTLENGTHEX gtl = { 0 };
+ gtl.flags = GTL_PRECISE;
+ gtl.codepage = CP_ACP;
+ int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
+ SendMessage(hwnd, EM_SCROLLCARET, 0, 0);
+ SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
+ RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
+ SendMessage(hwnd, EM_SETSEL, iLen, iLen);
+ dat->lastEnterTime = 0;
+ return 0;
+ }
- gtl.flags = GTL_PRECISE;
- gtl.codepage = CP_ACP;
- int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
- SendMessage(hwnd, EM_SCROLLCARET, 0, 0);
- SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
- SendMessage(hwnd, EM_SETSEL, iLen, iLen);
- dat->lastEnterTime = 0;
- return 0;
- }
- if (wParam == VK_RETURN)
- break;
- //fall through
+ if (wParam == VK_DOWN && isCtrl && !isAlt) {
+ GETTEXTLENGTHEX gtl = { 0 };
+ SETTEXTEX ste;
+
+ char *lpPrevCmd = pci->SM_GetNextCommand(si->ptszID, si->pszModule);
+ SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+
+ ste.flags = ST_DEFAULT;
+ ste.codepage = CP_ACP;
+ if (lpPrevCmd)
+ SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd);
+ else if (mwdat->enteredText) {
+ // If we cannot load the message from history, load the last edited text.
+ SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)mwdat->enteredText);
+ mir_free(mwdat->enteredText);
+ mwdat->enteredText = NULL;
+ }
+
+ gtl.flags = GTL_PRECISE;
+ gtl.codepage = CP_ACP;
+ int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
+ SendMessage(hwnd, EM_SCROLLCARET, 0, 0);
+ SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
+ RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
+ SendMessage(hwnd, EM_SETSEL, iLen, iLen);
+ dat->lastEnterTime = 0;
+ return 0;
}
+ if (wParam == VK_RETURN)
+ break;
+ //fall through
+ }
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
@@ -906,84 +906,84 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_LBUTTONUP:
case WM_RBUTTONUP:
case WM_MBUTTONUP:
- {
- UINT u = 0;
- UINT u2 = 0;
- MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
+ {
+ UINT u = 0;
+ UINT u2 = 0;
+ MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
- COLORREF cr;
- LoadLogfont(MSGFONTID_MESSAGEAREA, NULL, &cr, FONTMODULE);
-
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_BACKCOLOR | CFM_COLOR | CFM_UNDERLINETYPE;
- cf.dwEffects = 0;
- SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ COLORREF cr;
+ LoadLogfont(MSGFONTID_MESSAGEAREA, NULL, &cr, FONTMODULE);
- if (mi && mi->bColor) {
- int index = Chat_GetColorIndex(si->pszModule, cf.crTextColor);
- u = IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR);
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_BACKCOLOR | CFM_COLOR | CFM_UNDERLINETYPE;
+ cf.dwEffects = 0;
+ SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- if (index >= 0) {
- si->bFGSet = TRUE;
- si->iFG = index;
- }
+ if (mi && mi->bColor) {
+ int index = Chat_GetColorIndex(si->pszModule, cf.crTextColor);
+ u = IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR);
- if (u == BST_UNCHECKED && cf.crTextColor != cr)
- CheckDlgButton(hwndParent, IDC_COLOR, BST_CHECKED);
- else if (u == BST_CHECKED && cf.crTextColor == cr)
- CheckDlgButton(hwndParent, IDC_COLOR, BST_UNCHECKED);
+ if (index >= 0) {
+ si->bFGSet = TRUE;
+ si->iFG = index;
}
- if (mi && mi->bBkgColor) {
- int index = Chat_GetColorIndex(si->pszModule, cf.crBackColor);
- COLORREF crB = (COLORREF)M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR);
- u = IsDlgButtonChecked(hwndParent, IDC_BKGCOLOR);
+ if (u == BST_UNCHECKED && cf.crTextColor != cr)
+ CheckDlgButton(hwndParent, IDC_COLOR, BST_CHECKED);
+ else if (u == BST_CHECKED && cf.crTextColor == cr)
+ CheckDlgButton(hwndParent, IDC_COLOR, BST_UNCHECKED);
+ }
- if (index >= 0) {
- si->bBGSet = TRUE;
- si->iBG = index;
- }
+ if (mi && mi->bBkgColor) {
+ int index = Chat_GetColorIndex(si->pszModule, cf.crBackColor);
+ COLORREF crB = (COLORREF)M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR);
+ u = IsDlgButtonChecked(hwndParent, IDC_BKGCOLOR);
- if (u == BST_UNCHECKED && cf.crBackColor != crB)
- CheckDlgButton(hwndParent, IDC_BKGCOLOR, BST_CHECKED);
- else if (u == BST_CHECKED && cf.crBackColor == crB)
- CheckDlgButton(hwndParent, IDC_BKGCOLOR, BST_UNCHECKED);
+ if (index >= 0) {
+ si->bBGSet = TRUE;
+ si->iBG = index;
}
- if (mi && mi->bBold) {
- u = IsDlgButtonChecked(hwndParent, IDC_CHAT_BOLD);
- u2 = cf.dwEffects;
- u2 &= CFE_BOLD;
- if (u == BST_UNCHECKED && u2)
- CheckDlgButton(hwndParent, IDC_CHAT_BOLD, BST_CHECKED);
- else if (u == BST_CHECKED && u2 == 0)
- CheckDlgButton(hwndParent, IDC_CHAT_BOLD, BST_UNCHECKED);
- }
+ if (u == BST_UNCHECKED && cf.crBackColor != crB)
+ CheckDlgButton(hwndParent, IDC_BKGCOLOR, BST_CHECKED);
+ else if (u == BST_CHECKED && cf.crBackColor == crB)
+ CheckDlgButton(hwndParent, IDC_BKGCOLOR, BST_UNCHECKED);
+ }
- if (mi && mi->bItalics) {
- u = IsDlgButtonChecked(hwndParent, IDC_ITALICS);
- u2 = cf.dwEffects;
- u2 &= CFE_ITALIC;
- if (u == BST_UNCHECKED && u2)
- CheckDlgButton(hwndParent, IDC_ITALICS, BST_CHECKED);
- else if (u == BST_CHECKED && u2 == 0)
- CheckDlgButton(hwndParent, IDC_ITALICS, BST_UNCHECKED);
- }
+ if (mi && mi->bBold) {
+ u = IsDlgButtonChecked(hwndParent, IDC_CHAT_BOLD);
+ u2 = cf.dwEffects;
+ u2 &= CFE_BOLD;
+ if (u == BST_UNCHECKED && u2)
+ CheckDlgButton(hwndParent, IDC_CHAT_BOLD, BST_CHECKED);
+ else if (u == BST_CHECKED && u2 == 0)
+ CheckDlgButton(hwndParent, IDC_CHAT_BOLD, BST_UNCHECKED);
+ }
- if (mi && mi->bUnderline) {
- u = IsDlgButtonChecked(hwndParent, IDC_CHAT_UNDERLINE);
- if (cf.dwEffects & CFE_UNDERLINE && (cf.bUnderlineType & CFU_UNDERLINE || cf.bUnderlineType & CFU_UNDERLINEWORD)) {
- if (u == BST_UNCHECKED )
- CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, BST_CHECKED);
- }
- else {
- if (u == BST_CHECKED)
- CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, BST_UNCHECKED);
- }
+ if (mi && mi->bItalics) {
+ u = IsDlgButtonChecked(hwndParent, IDC_ITALICS);
+ u2 = cf.dwEffects;
+ u2 &= CFE_ITALIC;
+ if (u == BST_UNCHECKED && u2)
+ CheckDlgButton(hwndParent, IDC_ITALICS, BST_CHECKED);
+ else if (u == BST_CHECKED && u2 == 0)
+ CheckDlgButton(hwndParent, IDC_ITALICS, BST_UNCHECKED);
+ }
+
+ if (mi && mi->bUnderline) {
+ u = IsDlgButtonChecked(hwndParent, IDC_CHAT_UNDERLINE);
+ if (cf.dwEffects & CFE_UNDERLINE && (cf.bUnderlineType & CFU_UNDERLINE || cf.bUnderlineType & CFU_UNDERLINEWORD)) {
+ if (u == BST_UNCHECKED)
+ CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, BST_CHECKED);
+ }
+ else {
+ if (u == BST_CHECKED)
+ CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, BST_UNCHECKED);
}
}
- break;
+ }
+ break;
case WM_INPUTLANGCHANGE:
if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == hwnd && mwdat->pContainer->hwndActive == hwndParent && GetForegroundWindow() == mwdat->pContainer->hwnd && GetActiveWindow() == mwdat->pContainer->hwnd) {
@@ -1027,26 +1027,26 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) {
case WM_INITDIALOG:
- {
- si = (SESSION_INFO*)lParam;
- DWORD dwMask = db_get_dw(si->hContact, CHAT_MODULE, "FilterMask", 0);
- DWORD dwFlags = db_get_dw(si->hContact, CHAT_MODULE, "FilterFlags", 0);
+ {
+ si = (SESSION_INFO*)lParam;
+ DWORD dwMask = db_get_dw(si->hContact, CHAT_MODULE, "FilterMask", 0);
+ DWORD dwFlags = db_get_dw(si->hContact, CHAT_MODULE, "FilterFlags", 0);
- DWORD dwPopupMask = db_get_dw(si->hContact, CHAT_MODULE, "PopupMask", 0);
- DWORD dwPopupFlags = db_get_dw(si->hContact, CHAT_MODULE, "PopupFlags", 0);
+ DWORD dwPopupMask = db_get_dw(si->hContact, CHAT_MODULE, "PopupMask", 0);
+ DWORD dwPopupFlags = db_get_dw(si->hContact, CHAT_MODULE, "PopupFlags", 0);
- DWORD dwTrayMask = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconMask", 0);
- DWORD dwTrayFlags = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconFlags", 0);
+ DWORD dwTrayMask = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconMask", 0);
+ DWORD dwTrayFlags = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconFlags", 0);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)si);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)si);
- for (int i=0; i < SIZEOF(_eventorder); i++) {
- CheckDlgButton(hwndDlg, IDC_1 + i, dwMask & _eventorder[i] ? (dwFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
- CheckDlgButton(hwndDlg, IDC_P1 + i, dwPopupMask & _eventorder[i] ? (dwPopupFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
- CheckDlgButton(hwndDlg, IDC_T1 + i, dwTrayMask & _eventorder[i] ? (dwTrayFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
- }
+ for (int i = 0; i < SIZEOF(_eventorder); i++) {
+ CheckDlgButton(hwndDlg, IDC_1 + i, dwMask & _eventorder[i] ? (dwFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
+ CheckDlgButton(hwndDlg, IDC_P1 + i, dwPopupMask & _eventorder[i] ? (dwPopupFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
+ CheckDlgButton(hwndDlg, IDC_T1 + i, dwTrayMask & _eventorder[i] ? (dwTrayFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
}
- return FALSE;
+ }
+ return FALSE;
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC:
@@ -1059,7 +1059,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
int iFlags = 0, i;
DWORD dwMask = 0;
- for (i=0; i < SIZEOF(_eventorder); i++) {
+ for (i = 0; i < SIZEOF(_eventorder); i++) {
int result = IsDlgButtonChecked(hwndDlg, IDC_1 + i);
dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
@@ -1081,7 +1081,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
dwMask = iFlags = 0;
- for (i=0; i < SIZEOF(_eventorder); i++) {
+ for (i = 0; i < SIZEOF(_eventorder); i++) {
int result = IsDlgButtonChecked(hwndDlg, IDC_P1 + i);
dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
@@ -1103,7 +1103,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
dwMask = iFlags = 0;
- for (i=0; i < SIZEOF(_eventorder); i++) {
+ for (i = 0; i < SIZEOF(_eventorder); i++) {
int result = IsDlgButtonChecked(hwndDlg, IDC_T1 + i);
dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
@@ -1185,7 +1185,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
if (g_Settings.bClickableNicks && (LOWORD(lParam) == HTCLIENT)) {
POINT pt;
GetCursorPos(&pt);
- ScreenToClient(hwnd,&pt);
+ ScreenToClient(hwnd, &pt);
if (CheckCustomLink(hwnd, &pt, msg, wParam, lParam, FALSE)) return TRUE;
}
break;
@@ -1211,7 +1211,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
SendMessage(hwnd, WM_COPY, 0, 0);
- sel.cpMin = sel.cpMax ;
+ sel.cpMin = sel.cpMax;
SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel);
SetFocus(GetDlgItem(hwndParent, IDC_CHAT_MESSAGE));
}
@@ -1254,7 +1254,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
CHARRANGE sel;
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
- sel.cpMin = sel.cpMax ;
+ sel.cpMin = sel.cpMax;
SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel);
}
}
@@ -1303,10 +1303,10 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa
bool bNewTip = false;
if (!hwndToolTip) {
bNewTip = true;
- hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
- WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- hwnd, NULL, g_hInst, NULL);
+ hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
+ WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ hwnd, NULL, g_hInst, NULL);
}
RECT clientRect;
@@ -1323,7 +1323,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa
USERINFO *ui1 = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
if (ui1) {
- if ( ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
+ if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
TCHAR *p = (TCHAR*)ProtoCallService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
if (p != NULL) {
_tcsncpy_s(tszBuf, p, _TRUNCATE);
@@ -1333,15 +1333,15 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa
if (tszBuf[0] == 0)
mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
- TranslateT("Nickname"), ui1->pszNick,
- TranslateT("Unique ID"), ui1->pszUID,
- TranslateT("Status"), pci->TM_WordToString( parentdat->pStatuses, ui1->Status));
+ TranslateT("Nickname"), ui1->pszNick,
+ TranslateT("Unique ID"), ui1->pszUID,
+ TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui1->Status));
ti.lpszText = tszBuf;
}
SendMessage(hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
- SendMessage(hwndToolTip, TTM_ACTIVATE, (ti.lpszText != NULL) , 0);
- SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0 , 400);
+ SendMessage(hwndToolTip, TTM_ACTIVATE, (ti.lpszText != NULL), 0);
+ SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0, 400);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1361,7 +1361,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
RECT lpRect;
GetClientRect(hwnd, &lpRect);
LONG itemHeight = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
- g_cLinesPerPage = (lpRect.bottom - lpRect.top) /itemHeight ;
+ g_cLinesPerPage = (lpRect.bottom - lpRect.top) / itemHeight;
}
return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKUSERLIST, msg, wParam, lParam, NicklistSubclassProc);
@@ -1369,35 +1369,35 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKUSERLIST, msg, wParam, lParam, NicklistSubclassProc);
case WM_ERASEBKGND:
- {
- HDC dc = (HDC)wParam;
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- SESSION_INFO *parentdat = dat->si;
- if (dc) {
- int index = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
- if (index == LB_ERR || parentdat->nUsersInNicklist <= 0)
- return 0;
+ {
+ HDC dc = (HDC)wParam;
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ SESSION_INFO *parentdat = dat->si;
+ if (dc) {
+ int index = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
+ if (index == LB_ERR || parentdat->nUsersInNicklist <= 0)
+ return 0;
- int items = parentdat->nUsersInNicklist - index;
- int height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
+ int items = parentdat->nUsersInNicklist - index;
+ int height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
- if (height != LB_ERR) {
- RECT rc = {0};
- GetClientRect(hwnd, &rc);
+ if (height != LB_ERR) {
+ RECT rc = { 0 };
+ GetClientRect(hwnd, &rc);
- if (rc.bottom - rc.top > items * height) {
- rc.top = items * height;
- FillRect(dc, &rc, pci->hListBkgBrush);
- }
+ if (rc.bottom - rc.top > items * height) {
+ rc.top = items * height;
+ FillRect(dc, &rc, pci->hListBkgBrush);
}
}
}
- return 1;
+ }
+ return 1;
case WM_MOUSEWHEEL:
if (CSkin::m_DisableScrollbars) {
UINT uScroll;
- short zDelta=(short)HIWORD(wParam);
+ short zDelta = (short)HIWORD(wParam);
if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &uScroll, 0))
uScroll = 3; /* default value */
@@ -1434,7 +1434,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
return TRUE;
}
if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT ||
- wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) {
+ wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) {
if (mwdat && mwdat->si) {
SESSION_INFO *si = (SESSION_INFO*)mwdat->si;
si->szSearch[0] = 0;
@@ -1503,205 +1503,205 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_RBUTTONDOWN:
- {
- int iCounts = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
- if (iCounts != LB_ERR && iCounts > 1)
- return 0;
- SendMessage(hwnd, WM_LBUTTONDOWN, wParam, lParam);
- }
- break;
+ {
+ int iCounts = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
+ if (iCounts != LB_ERR && iCounts > 1)
+ return 0;
+ SendMessage(hwnd, WM_LBUTTONDOWN, wParam, lParam);
+ }
+ break;
case WM_RBUTTONUP:
SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam);
break;
case WM_MEASUREITEM:
- {
- MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
- if (mis->CtlType == ODT_MENU)
- return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
- }
- return FALSE;
+ {
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam;
+ if (mis->CtlType == ODT_MENU)
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+ }
+ return FALSE;
case WM_DRAWITEM:
- {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
- if (dis->CtlType == ODT_MENU)
- return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- }
- return FALSE;
+ {
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
+ if (dis->CtlType == ODT_MENU)
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+ }
+ return FALSE;
case WM_CONTEXTMENU:
- {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- SESSION_INFO *parentdat = dat->si;
-
- int height = 0;
- TVHITTESTINFO hti;
- hti.pt.x = (short) LOWORD(lParam);
- hti.pt.y = (short) HIWORD(lParam);
- if (hti.pt.x == -1 && hti.pt.y == -1) {
- int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
- int top = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
- height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
- hti.pt.x = 4;
- hti.pt.y = (index - top) * height + 1;
- }
- else ScreenToClient(hwnd, &hti.pt);
-
- int item = (DWORD)(SendMessage(hwnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
- if ( HIWORD( item ) == 1 )
- item = (DWORD)(-1);
- else
- item &= 0xFFFF;
-
- USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
- if (ui) {
- HMENU hMenu = 0;
- USERINFO uinew;
- memcpy(&uinew, ui, sizeof(USERINFO));
- if (hti.pt.x == -1 && hti.pt.y == -1)
- hti.pt.y += height - 4;
- ClientToScreen(hwnd, &hti.pt);
-
- UINT uID = CreateGCMenu(hwnd, &hMenu, 0, hti.pt, parentdat, uinew.pszUID, uinew.pszNick);
- switch (uID) {
- case 0:
- break;
+ {
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ SESSION_INFO *parentdat = dat->si;
+
+ int height = 0;
+ TVHITTESTINFO hti;
+ hti.pt.x = (short)LOWORD(lParam);
+ hti.pt.y = (short)HIWORD(lParam);
+ if (hti.pt.x == -1 && hti.pt.y == -1) {
+ int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
+ int top = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
+ height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
+ hti.pt.x = 4;
+ hti.pt.y = (index - top) * height + 1;
+ }
+ else ScreenToClient(hwnd, &hti.pt);
+
+ int item = (DWORD)(SendMessage(hwnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
+ if (HIWORD(item) == 1)
+ item = (DWORD)(-1);
+ else
+ item &= 0xFFFF;
+
+ USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
+ if (ui) {
+ HMENU hMenu = 0;
+ USERINFO uinew;
+ memcpy(&uinew, ui, sizeof(USERINFO));
+ if (hti.pt.x == -1 && hti.pt.y == -1)
+ hti.pt.y += height - 4;
+ ClientToScreen(hwnd, &hti.pt);
+
+ UINT uID = CreateGCMenu(hwnd, &hMenu, 0, hti.pt, parentdat, uinew.pszUID, uinew.pszNick);
+ switch (uID) {
+ case 0:
+ break;
- case 20020: // add to highlight...
- {
- THighLightEdit the = {THighLightEdit::CMD_ADD, parentdat, ui};
+ case 20020: // add to highlight...
+ {
+ THighLightEdit the = { THighLightEdit::CMD_ADD, parentdat, ui };
- if (parentdat && ui) {
- HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), parentdat->dat->pContainer->hwnd, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
- TranslateDialogDefault(hwnd);
+ if (parentdat && ui) {
+ HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), parentdat->dat->pContainer->hwnd, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
+ TranslateDialogDefault(hwnd);
- RECT rc, rcWnd;
- GetClientRect(parentdat->pContainer->hwnd, &rcWnd);
- GetWindowRect(hwnd, &rc);
- SetWindowPos(hwnd, HWND_TOP, (rcWnd.right - (rc.right - rc.left)) / 2, (rcWnd.bottom - (rc.bottom - rc.top)) / 2 , 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
- }
- }
- break;
+ RECT rc, rcWnd;
+ GetClientRect(parentdat->pContainer->hwnd, &rcWnd);
+ GetWindowRect(hwnd, &rc);
+ SetWindowPos(hwnd, HWND_TOP, (rcWnd.right - (rc.right - rc.left)) / 2, (rcWnd.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
+ }
+ }
+ break;
- case ID_MESS:
- pci->DoEventHookAsync(GetParent(hwnd), parentdat->ptszID, parentdat->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
- break;
+ case ID_MESS:
+ pci->DoEventHookAsync(GetParent(hwnd), parentdat->ptszID, parentdat->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
+ break;
- default:
- int iCount = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
- if (iCount != LB_ERR) {
- int iSelectedItems = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
- if (iSelectedItems != LB_ERR) {
- int *pItems = (int *)mir_alloc(sizeof(int) * (iSelectedItems + 1));
- if (pItems) {
- if (SendMessage(hwnd, LB_GETSELITEMS, iSelectedItems, (LPARAM)pItems) != LB_ERR) {
- for (int i=0; i < iSelectedItems; i++) {
- USERINFO *ui1 = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, pItems[i]);
- if (ui1)
- pci->DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui1->pszUID, NULL, (LPARAM)uID);
- }
+ default:
+ int iCount = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
+ if (iCount != LB_ERR) {
+ int iSelectedItems = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
+ if (iSelectedItems != LB_ERR) {
+ int *pItems = (int *)mir_alloc(sizeof(int) * (iSelectedItems + 1));
+ if (pItems) {
+ if (SendMessage(hwnd, LB_GETSELITEMS, iSelectedItems, (LPARAM)pItems) != LB_ERR) {
+ for (int i = 0; i < iSelectedItems; i++) {
+ USERINFO *ui1 = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, pItems[i]);
+ if (ui1)
+ pci->DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui1->pszUID, NULL, (LPARAM)uID);
}
- mir_free(pItems);
}
+ mir_free(pItems);
}
}
- break;
}
- DestroyGCMenu(&hMenu, 1);
- return TRUE;
+ break;
}
+ DestroyGCMenu(&hMenu, 1);
+ return TRUE;
}
- break;
+ }
+ break;
case WM_MOUSEMOVE:
- {
- POINT pt = { LOWORD(lParam), HIWORD(lParam) };
- RECT clientRect;
- GetClientRect(hwnd, &clientRect);
- if (PtInRect(&clientRect, pt)) {
- //hit test item under mouse
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- SESSION_INFO *parentdat = dat->si;
-
- DWORD nItemUnderMouse = (DWORD)SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
- if (HIWORD(nItemUnderMouse) == 1)
- nItemUnderMouse = (DWORD)(-1);
- else
- nItemUnderMouse &= 0xFFFF;
+ {
+ POINT pt = { LOWORD(lParam), HIWORD(lParam) };
+ RECT clientRect;
+ GetClientRect(hwnd, &clientRect);
+ if (PtInRect(&clientRect, pt)) {
+ //hit test item under mouse
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ SESSION_INFO *parentdat = dat->si;
- if (M.GetByte("adv_TipperTooltip", 1) && ServiceExists("mToolTip/HideTip")) {
- if ((int)nItemUnderMouse == currentHovered) break;
- currentHovered = (int)nItemUnderMouse;
+ DWORD nItemUnderMouse = (DWORD)SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
+ if (HIWORD(nItemUnderMouse) == 1)
+ nItemUnderMouse = (DWORD)(-1);
+ else
+ nItemUnderMouse &= 0xFFFF;
- KillTimer(hwnd, 1);
+ if (M.GetByte("adv_TipperTooltip", 1) && ServiceExists("mToolTip/HideTip")) {
+ if ((int)nItemUnderMouse == currentHovered) break;
+ currentHovered = (int)nItemUnderMouse;
- if (isToolTip) {
- CallService("mToolTip/HideTip", 0, 0);
- isToolTip = FALSE;
- }
+ KillTimer(hwnd, 1);
- if (nItemUnderMouse != -1)
- SetTimer(hwnd, 1, 450, 0);
+ if (isToolTip) {
+ CallService("mToolTip/HideTip", 0, 0);
+ isToolTip = FALSE;
}
- else ProcessNickListHovering(hwnd, (int)nItemUnderMouse, parentdat);
+
+ if (nItemUnderMouse != -1)
+ SetTimer(hwnd, 1, 450, 0);
}
- else {
- if (M.GetByte("adv_TipperTooltip", 1) && ServiceExists("mToolTip/HideTip")) {
- KillTimer(hwnd, 1);
- if (isToolTip) {
- CallService("mToolTip/HideTip", 0, 0);
- isToolTip = FALSE;
- }
+ else ProcessNickListHovering(hwnd, (int)nItemUnderMouse, parentdat);
+ }
+ else {
+ if (M.GetByte("adv_TipperTooltip", 1) && ServiceExists("mToolTip/HideTip")) {
+ KillTimer(hwnd, 1);
+ if (isToolTip) {
+ CallService("mToolTip/HideTip", 0, 0);
+ isToolTip = FALSE;
}
- else ProcessNickListHovering(hwnd, -1, NULL);
}
+ else ProcessNickListHovering(hwnd, -1, NULL);
}
- break;
+ }
+ break;
case WM_TIMER:
- {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- SESSION_INFO *parentdat = dat->si;
+ {
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ SESSION_INFO *parentdat = dat->si;
- POINT pt;
- GetCursorPos(&pt);
- ScreenToClient(hwnd, &pt);
+ POINT pt;
+ GetCursorPos(&pt);
+ ScreenToClient(hwnd, &pt);
- DWORD nItemUnderMouse = (DWORD)SendDlgItemMessage(dat->hwnd, IDC_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y));
- if (HIWORD(nItemUnderMouse) == 1)
- nItemUnderMouse = (DWORD)(-1);
- else
- nItemUnderMouse &= 0xFFFF;
- if (((int)nItemUnderMouse != currentHovered) || (nItemUnderMouse == -1)) {
- KillTimer(hwnd, 1);
- break;
- }
+ DWORD nItemUnderMouse = (DWORD)SendDlgItemMessage(dat->hwnd, IDC_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y));
+ if (HIWORD(nItemUnderMouse) == 1)
+ nItemUnderMouse = (DWORD)(-1);
+ else
+ nItemUnderMouse &= 0xFFFF;
+ if (((int)nItemUnderMouse != currentHovered) || (nItemUnderMouse == -1)) {
+ KillTimer(hwnd, 1);
+ break;
+ }
- USERINFO *ui1 = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
- if (ui1) {
- TCHAR tszBuf[1024]; tszBuf[0] = 0;
- if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
- TCHAR *p = (TCHAR*)ProtoCallService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
- if (p) {
- _tcsncpy_s(tszBuf, p, _TRUNCATE);
- mir_free(p);
- }
+ USERINFO *ui1 = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
+ if (ui1) {
+ TCHAR tszBuf[1024]; tszBuf[0] = 0;
+ if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
+ TCHAR *p = (TCHAR*)ProtoCallService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
+ if (p) {
+ _tcsncpy_s(tszBuf, p, _TRUNCATE);
+ mir_free(p);
}
- if (tszBuf[0] == 0)
- mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s"),
- TranslateT("Nick"), ui1->pszNick,
- TranslateT("Unique ID"), ui1->pszUID,
- TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui1->Status));
-
- CLCINFOTIP ti = { sizeof(ti) };
- if (CallService("mToolTip/ShowTipW", (WPARAM)tszBuf, (LPARAM)&ti))
- isToolTip = TRUE;
}
- KillTimer(hwnd, 1);
+ if (tszBuf[0] == 0)
+ mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s"),
+ TranslateT("Nick"), ui1->pszNick,
+ TranslateT("Unique ID"), ui1->pszUID,
+ TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui1->Status));
+
+ CLCINFOTIP ti = { sizeof(ti) };
+ if (CallService("mToolTip/ShowTipW", (WPARAM)tszBuf, (LPARAM)&ti))
+ isToolTip = TRUE;
}
- break;
+ KillTimer(hwnd, 1);
+ }
+ break;
}
return mir_callNextSubclass(hwnd, NicklistSubclassProc, msg, wParam, lParam);
}
@@ -1718,8 +1718,8 @@ int GetTextPixelSize(TCHAR* pszText, HFONT hFont, bool bWidth)
HDC hdc = GetDC(NULL);
HFONT hOldFont = (HFONT)SelectObject(hdc, hFont);
- RECT rc = {0};
- DrawText(hdc, pszText , -1, &rc, DT_CALCRECT);
+ RECT rc = { 0 };
+ DrawText(hdc, pszText, -1, &rc, DT_CALCRECT);
SelectObject(hdc, hOldFont);
ReleaseDC(NULL, hdc);
@@ -1728,7 +1728,7 @@ int GetTextPixelSize(TCHAR* pszText, HFONT hFont, bool bWidth)
static void __cdecl phase2(void * lParam)
{
- SESSION_INFO *si = (SESSION_INFO*) lParam;
+ SESSION_INFO *si = (SESSION_INFO*)lParam;
Sleep(30);
if (si && si->hWnd)
PostMessage(si->hWnd, GC_REDRAWLOG3, 0, 0);
@@ -1755,123 +1755,123 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
switch (uMsg) {
case WM_INITDIALOG:
- {
- TNewWindowData *newData = (TNewWindowData*)lParam;
-
- TWindowData *dat = (TWindowData*)mir_calloc( sizeof(TWindowData));
- dat->si = si = newData->si;
- dat->hContact = si->hContact;
- dat->szProto = GetContactProto(si->hContact);
- dat->bType = SESSIONTYPE_CHAT;
- dat->Panel = new CInfoPanel(dat);
-
- dat->cache = CContactCache::getContactCache(dat->hContact);
- dat->cache->updateState();
- dat->cache->updateUIN();
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
- newData->item.lParam = (LPARAM)hwndDlg;
- TabCtrl_SetItem(hwndTab, newData->iTabID, &newData->item);
- dat->iTabID = newData->iTabID;
- dat->pContainer = newData->pContainer;
- si->pContainer = newData->pContainer;
- dat->hwnd = hwndDlg;
- si->hWnd = hwndDlg;
- si->dat = dat;
- dat->bIsAutosizingInput = IsAutoSplitEnabled(dat);
- dat->fLimitedUpdate = false;
- dat->iInputAreaHeight = -1;
- if (!dat->pContainer->settings->fPrivate)
+ {
+ TNewWindowData *newData = (TNewWindowData*)lParam;
+
+ TWindowData *dat = (TWindowData*)mir_calloc(sizeof(TWindowData));
+ dat->si = si = newData->si;
+ dat->hContact = si->hContact;
+ dat->szProto = GetContactProto(si->hContact);
+ dat->bType = SESSIONTYPE_CHAT;
+ dat->Panel = new CInfoPanel(dat);
+
+ dat->cache = CContactCache::getContactCache(dat->hContact);
+ dat->cache->updateState();
+ dat->cache->updateUIN();
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
+ newData->item.lParam = (LPARAM)hwndDlg;
+ TabCtrl_SetItem(hwndTab, newData->iTabID, &newData->item);
+ dat->iTabID = newData->iTabID;
+ dat->pContainer = newData->pContainer;
+ si->pContainer = newData->pContainer;
+ dat->hwnd = hwndDlg;
+ si->hWnd = hwndDlg;
+ si->dat = dat;
+ dat->bIsAutosizingInput = IsAutoSplitEnabled(dat);
+ dat->fLimitedUpdate = false;
+ dat->iInputAreaHeight = -1;
+ if (!dat->pContainer->settings->fPrivate)
+ si->iSplitterY = g_Settings.iSplitterY;
+ else {
+ if (M.GetByte(CHAT_MODULE, "SyncSplitter", 0))
+ si->iSplitterY = dat->pContainer->settings->splitterPos - DPISCALEY_S(23);
+ else
si->iSplitterY = g_Settings.iSplitterY;
- else {
- if (M.GetByte(CHAT_MODULE, "SyncSplitter", 0))
- si->iSplitterY = dat->pContainer->settings->splitterPos - DPISCALEY_S(23);
- else
- si->iSplitterY = g_Settings.iSplitterY;
- }
-
- if (dat->bIsAutosizingInput)
- si->iSplitterY = GetDefaultMinimumInputHeight(dat);
-
- dat->pWnd = 0;
- dat->sbCustom = 0;
- CProxyWindow::add(dat);
-
- dat->fInsertMode = FALSE;
+ }
- // Typing support for GCW_PRIVMESS sessions
- if (si->iType == GCW_PRIVMESS) {
- dat->nTypeMode = PROTOTYPE_SELFTYPING_OFF;
- SetTimer(hwndDlg, TIMERID_TYPE, 1000, NULL);
- }
+ if (dat->bIsAutosizingInput)
+ si->iSplitterY = GetDefaultMinimumInputHeight(dat);
- dat->codePage = M.GetDword(dat->hContact, "ANSIcodepage", CP_ACP);
- dat->Panel->getVisibility();
- dat->Panel->Configure();
- M.AddWindow(hwndDlg, dat->hContact);
- BroadCastContainer(dat->pContainer, DM_REFRESHTABINDEX, 0, 0);
+ dat->pWnd = 0;
+ dat->sbCustom = 0;
+ CProxyWindow::add(dat);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
+ dat->fInsertMode = FALSE;
- BB_InitDlgButtons(dat);
- DM_InitTip(dat);
-
- SendDlgItemMessage(hwndDlg,IDC_COLOR, BUTTONSETASPUSHBTN, TRUE, 0);
-
- mir_subclassWindow( GetDlgItem(hwndDlg, IDC_SPLITTERX), SplitterSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg, IDC_SPLITTERY), SplitterSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg, IDC_LIST), NicklistSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg, IDC_CHAT_LOG), LogSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg, IDC_FILTER), ButtonSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg, IDC_COLOR), ButtonSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg, IDC_BKGCOLOR), ButtonSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), MessageSubclassProc);
-
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SUBCLASSED, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_AUTOURLDETECT, 1, 0);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
- TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING, 0);
-
- int mask = (int)SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETEVENTMASK, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS | ENM_KEYEVENTS);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, 0x7FFFFFFF, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
- dat->Panel->loadHeight();
- Utils::enableDlgControl(hwndDlg, IDC_SMILEYBTN, true);
-
- if (PluginConfig.g_hMenuTrayUnread != 0 && dat->hContact != 0 && dat->szProto != NULL)
- UpdateTrayMenu(0, dat->wStatus, dat->szProto, dat->szStatus, dat->hContact, FALSE);
-
- DM_ThemeChanged(dat);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_HIDESELECTION, TRUE, 0);
-
- CustomizeButton( CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
- hwndDlg, (HMENU)IDC_CHAT_TOGGLESIDEBAR, g_hInst, NULL));
-
- GetMYUIN(dat);
- GetMyNick(dat);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASTHEMEDBTN, 1, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASFLATBTN, FALSE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Expand or collapse the side bar"), BATF_TCHAR);
-
- dat->hwndIEView = dat->hwndHPP = 0;
-
- SendMessage(hwndDlg, GC_SETWNDPROPS, 0, 0);
- SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
- SendMessage(hwndDlg, GC_UPDATETITLE, 0, 1);
+ // Typing support for GCW_PRIVMESS sessions
+ if (si->iType == GCW_PRIVMESS) {
+ dat->nTypeMode = PROTOTYPE_SELFTYPING_OFF;
+ SetTimer(hwndDlg, TIMERID_TYPE, 1000, NULL);
+ }
+
+ dat->codePage = M.GetDword(dat->hContact, "ANSIcodepage", CP_ACP);
+ dat->Panel->getVisibility();
+ dat->Panel->Configure();
+ M.AddWindow(hwndDlg, dat->hContact);
+ BroadCastContainer(dat->pContainer, DM_REFRESHTABINDEX, 0, 0);
+
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
+
+ BB_InitDlgButtons(dat);
+ DM_InitTip(dat);
+
+ SendDlgItemMessage(hwndDlg, IDC_COLOR, BUTTONSETASPUSHBTN, TRUE, 0);
+
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERX), SplitterSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERY), SplitterSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_LIST), NicklistSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_LOG), LogSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_FILTER), ButtonSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_COLOR), ButtonSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOR), ButtonSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), MessageSubclassProc);
+
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SUBCLASSED, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_AUTOURLDETECT, 1, 0);
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR)SplitterSubclassProc);
+ TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING, 0);
+
+ int mask = (int)SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETEVENTMASK, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS | ENM_KEYEVENTS);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, 0x7FFFFFFF, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
+ dat->Panel->loadHeight();
+ Utils::enableDlgControl(hwndDlg, IDC_SMILEYBTN, true);
+
+ if (PluginConfig.g_hMenuTrayUnread != 0 && dat->hContact != 0 && dat->szProto != NULL)
+ UpdateTrayMenu(0, dat->wStatus, dat->szProto, dat->szStatus, dat->hContact, FALSE);
+
+ DM_ThemeChanged(dat);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_HIDESELECTION, TRUE, 0);
+
+ CustomizeButton(CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
+ hwndDlg, (HMENU)IDC_CHAT_TOGGLESIDEBAR, g_hInst, NULL));
+
+ GetMYUIN(dat);
+ GetMyNick(dat);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASTHEMEDBTN, 1, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASFLATBTN, FALSE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Expand or collapse the side bar"), BATF_TCHAR);
+
+ dat->hwndIEView = dat->hwndHPP = 0;
+
+ SendMessage(hwndDlg, GC_SETWNDPROPS, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATETITLE, 0, 1);
- SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
- SetWindowPos(hwndDlg, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), 0);
- ShowWindow(hwndDlg, SW_SHOW);
- PostMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
- dat->pContainer->hwndActive = hwndDlg;
- BB_SetButtonsPos(dat);
- TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPEN, 0);
- }
- break;
+ SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
+ SetWindowPos(hwndDlg, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), 0);
+ ShowWindow(hwndDlg, SW_SHOW);
+ PostMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
+ dat->pContainer->hwndActive = hwndDlg;
+ BB_SetButtonsPos(dat);
+ TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPEN, 0);
+ }
+ break;
case WM_SETFOCUS:
if (CMimAPI::m_shutDown)
@@ -1890,24 +1890,24 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
return 0;
case GC_SETWNDPROPS:
- {
- COLORREF colour = M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
- InitButtons(hwndDlg, si);
- ConfigureSmileyButton(dat);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETBKGNDCOLOR, 0, colour);
+ {
+ COLORREF colour = M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
+ InitButtons(hwndDlg, si);
+ ConfigureSmileyButton(dat);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETBKGNDCOLOR, 0, colour);
- DM_InitRichEdit(dat);
- SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETASNORMAL, TRUE, 0);
+ DM_InitRichEdit(dat);
+ SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETASNORMAL, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETITEMHEIGHT, 0, (LPARAM)g_Settings.iNickListFontHeight);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_LIST), NULL, TRUE);
+ SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETITEMHEIGHT, 0, (LPARAM)g_Settings.iNickListFontHeight);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_LIST), NULL, TRUE);
- SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETOVERLAYICON,
- (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
- }
- break;
+ SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETOVERLAYICON,
+ (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
+ }
+ break;
case DM_UPDATETITLE:
return SendMessage(hwndDlg, GC_UPDATETITLE, wParam, lParam);
@@ -1936,7 +1936,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
break;
case GCW_PRIVMESS:
hIcon = LoadSkinnedProtoIcon(si->pszModule, (dat->wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : dat->wStatus);
- if(si->nUsersInNicklist == 1)
+ if (si->nUsersInNicklist == 1)
mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("%s: message session"), szNick);
else
mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("%s: message session (%u users)"), szNick, si->nUsersInNicklist);
@@ -2107,26 +2107,26 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
break;
case GC_ADDLOG:
- {
- bool bInactive = (GetForegroundWindow() != dat->pContainer->hwnd || GetActiveWindow() != dat->pContainer->hwnd);
+ {
+ bool bInactive = (GetForegroundWindow() != dat->pContainer->hwnd || GetActiveWindow() != dat->pContainer->hwnd);
- if (g_Settings.bUseDividers && g_Settings.bDividersUsePopupConfig) {
- if (!MessageWindowOpened(0, (LPARAM)hwndDlg))
- SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
- }
- else if (g_Settings.bUseDividers) {
- if (bInactive)
- SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
- else if (dat->pContainer->hwndActive != hwndDlg)
- SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
- }
-
- if (si->pLogEnd)
- Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE);
- else
- SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
+ if (g_Settings.bUseDividers && g_Settings.bDividersUsePopupConfig) {
+ if (!MessageWindowOpened(0, (LPARAM)hwndDlg))
+ SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
+ }
+ else if (g_Settings.bUseDividers) {
+ if (bInactive)
+ SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
+ else if (dat->pContainer->hwndActive != hwndDlg)
+ SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
}
- break;
+
+ 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_ACKMESSAGE:
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, FALSE, 0);
@@ -2137,9 +2137,9 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
// Typing support for GCW_PRIVMESS sessions
if (si->iType == GCW_PRIVMESS) {
int preTyping = dat->nTypeSecs != 0;
- dat->nTypeSecs = (int) lParam > 0 ? (int) lParam : 0;
+ dat->nTypeSecs = (int)lParam > 0 ? (int)lParam : 0;
- if(dat->nTypeSecs)
+ if (dat->nTypeSecs)
dat->bShowTyping = 0;
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, preTyping);
@@ -2148,141 +2148,141 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
case WM_CTLCOLORLISTBOX:
- SetBkColor((HDC) wParam, g_Settings.crUserListBGColor);
+ SetBkColor((HDC)wParam, g_Settings.crUserListBGColor);
return (INT_PTR)pci->hListBkgBrush;
case WM_MEASUREITEM:
- {
- MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
- if (mis->CtlType == ODT_MENU) {
- if (dat->Panel->isHovered()) {
- mis->itemHeight = 0;
- mis->itemWidth = 6;
- return TRUE;
- }
- return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+ {
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam;
+ if (mis->CtlType == ODT_MENU) {
+ if (dat->Panel->isHovered()) {
+ mis->itemHeight = 0;
+ mis->itemWidth = 6;
+ return TRUE;
}
- mis->itemHeight = g_Settings.iNickListFontHeight;
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
}
- return TRUE;
+ mis->itemHeight = g_Settings.iNickListFontHeight;
+ }
+ return TRUE;
case WM_DRAWITEM:
- {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
- if (dis->CtlType == ODT_MENU) {
- if (dat->Panel->isHovered()) {
- DrawMenuItem(dis, (HICON)dis->itemData, 0);
- return TRUE;
- }
- return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+ {
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
+ if (dis->CtlType == ODT_MENU) {
+ if (dat->Panel->isHovered()) {
+ DrawMenuItem(dis, (HICON)dis->itemData, 0);
+ return TRUE;
}
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+ }
- if (dis->CtlID == IDC_LIST) {
- int x_offset = 0;
- int index = dis->itemID;
-
- USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, index);
- if (ui == NULL)
- return TRUE;
-
- int height = dis->rcItem.bottom - dis->rcItem.top;
- if (height & 1)
- height++;
- int offset = (height == 10) ? 0 : height/2;
+ if (dis->CtlID == IDC_LIST) {
+ int x_offset = 0;
+ int index = dis->itemID;
- HICON hIcon = pci->SM_GetStatusIcon(si, ui);
- HFONT hFont = g_Settings.UserListFonts[ui->iStatusEx];
- HFONT hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
- SetBkMode(dis->hDC, TRANSPARENT);
+ USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, index);
+ if (ui == NULL)
+ return TRUE;
- int nickIndex = 0;
- for (int i = 0; i < STATUSICONCOUNT; i++) {
- if (hIcon == pci->hIcons[ICON_STATUS0 + i]) {
- nickIndex = i;
- break;
- }
- }
+ int height = dis->rcItem.bottom - dis->rcItem.top;
+ if (height & 1)
+ height++;
+ int offset = (height == 10) ? 0 : height / 2;
- if (dis->itemState & ODS_SELECTED) {
- FillRect(dis->hDC, &dis->rcItem, g_Settings.SelectionBGBrush);
- SetTextColor(dis->hDC, g_Settings.nickColors[6]);
- }
- else {
- FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush);
- if (g_Settings.bColorizeNicks && nickIndex != 0)
- SetTextColor(dis->hDC, g_Settings.nickColors[nickIndex-1]);
- else
- SetTextColor(dis->hDC, g_Settings.UserListColors[ui->iStatusEx]);
- }
- x_offset = 2;
+ HICON hIcon = pci->SM_GetStatusIcon(si, ui);
+ HFONT hFont = g_Settings.UserListFonts[ui->iStatusEx];
+ HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont);
+ SetBkMode(dis->hDC, TRANSPARENT);
- if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, hIcon, 16, 16, 0, NULL, DI_NORMAL);
- Skin_ReleaseIcon(hIcon);
- x_offset += 18;
+ int nickIndex = 0;
+ for (int i = 0; i < STATUSICONCOUNT; i++) {
+ if (hIcon == pci->hIcons[ICON_STATUS0 + i]) {
+ nickIndex = i;
+ break;
}
+ }
- if (g_Settings.bClassicIndicators) {
- char szTemp[3];
- szTemp[1] = 0;
- szTemp[0] = szIndicators[nickIndex];
- if (szTemp[0]) {
- SIZE szUmode;
- GetTextExtentPoint32A(dis->hDC, szTemp, 1, &szUmode);
- TextOutA(dis->hDC, x_offset, dis->rcItem.top, szTemp, 1);
- x_offset += szUmode.cx + 2;
- }
- else x_offset += 8;
- }
- else {
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 5, hIcon, 10, 10, 0, NULL, DI_NORMAL);
- x_offset += 12;
+ if (dis->itemState & ODS_SELECTED) {
+ FillRect(dis->hDC, &dis->rcItem, g_Settings.SelectionBGBrush);
+ SetTextColor(dis->hDC, g_Settings.nickColors[6]);
+ }
+ else {
+ FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush);
+ if (g_Settings.bColorizeNicks && nickIndex != 0)
+ SetTextColor(dis->hDC, g_Settings.nickColors[nickIndex - 1]);
+ else
+ SetTextColor(dis->hDC, g_Settings.UserListColors[ui->iStatusEx]);
+ }
+ x_offset = 2;
+
+ if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
+ HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ Skin_ReleaseIcon(hIcon);
+ x_offset += 18;
+ }
+
+ if (g_Settings.bClassicIndicators) {
+ char szTemp[3];
+ szTemp[1] = 0;
+ szTemp[0] = szIndicators[nickIndex];
+ if (szTemp[0]) {
+ SIZE szUmode;
+ GetTextExtentPoint32A(dis->hDC, szTemp, 1, &szUmode);
+ TextOutA(dis->hDC, x_offset, dis->rcItem.top, szTemp, 1);
+ x_offset += szUmode.cx + 2;
}
+ else x_offset += 8;
+ }
+ else {
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 5, hIcon, 10, 10, 0, NULL, DI_NORMAL);
+ x_offset += 12;
+ }
- if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, hIcon, 16, 16, 0, NULL, DI_NORMAL);
- Skin_ReleaseIcon(hIcon);
- x_offset += 18;
- }
+ if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
+ HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ Skin_ReleaseIcon(hIcon);
+ x_offset += 18;
+ }
- SIZE sz;
- if (si->iSearchItem != -1 && si->iSearchItem == index && si->szSearch[0]) {
- COLORREF clr_orig = GetTextColor(dis->hDC);
- GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_tstrlen(si->szSearch), &sz);
- SetTextColor(dis->hDC, RGB(250, 250, 0));
- TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_tstrlen(si->szSearch));
- SetTextColor(dis->hDC, clr_orig);
- x_offset += sz.cx;
- TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + mir_tstrlen(si->szSearch), int(mir_tstrlen(ui->pszNick) - mir_tstrlen(si->szSearch)));
- }
- else {
- GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_tstrlen(ui->pszNick), &sz);
- TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_tstrlen(ui->pszNick));
- SelectObject(dis->hDC, hOldFont);
- }
- return TRUE;
+ SIZE sz;
+ if (si->iSearchItem != -1 && si->iSearchItem == index && si->szSearch[0]) {
+ COLORREF clr_orig = GetTextColor(dis->hDC);
+ GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_tstrlen(si->szSearch), &sz);
+ SetTextColor(dis->hDC, RGB(250, 250, 0));
+ TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_tstrlen(si->szSearch));
+ SetTextColor(dis->hDC, clr_orig);
+ x_offset += sz.cx;
+ TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + mir_tstrlen(si->szSearch), int(mir_tstrlen(ui->pszNick) - mir_tstrlen(si->szSearch)));
+ }
+ else {
+ GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_tstrlen(ui->pszNick), &sz);
+ TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_tstrlen(ui->pszNick));
+ SelectObject(dis->hDC, hOldFont);
}
+ return TRUE;
}
- break;
+ }
+ break;
case WM_CONTEXTMENU:
- {
- DWORD idFrom = GetDlgCtrlID((HWND)wParam);
- if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID)
- BB_CustomButtonClick(dat, idFrom, (HWND)wParam, 1);
- }
- break;
+ {
+ DWORD idFrom = GetDlgCtrlID((HWND)wParam);
+ if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID)
+ BB_CustomButtonClick(dat, idFrom, (HWND)wParam, 1);
+ }
+ break;
case GC_UPDATENICKLIST:
- {
- int i = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETTOPINDEX, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCOUNT, si->nUsersInNicklist, 0);
- SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETTOPINDEX, i, 0);
- SendMessage(hwndDlg, GC_UPDATETITLE, 0, 0);
- }
- break;
+ {
+ int i = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETTOPINDEX, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCOUNT, si->nUsersInNicklist, 0);
+ SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETTOPINDEX, i, 0);
+ SendMessage(hwndDlg, GC_UPDATETITLE, 0, 0);
+ }
+ break;
case GC_EVENT_CONTROL + WM_USER + 500:
switch (wParam) {
@@ -2309,7 +2309,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
si->wState &= ~STATE_TALK;
dat->bWasDeleted = 1;
- db_set_w(si->hContact, si->pszModule , "ApparentMode", 0);
+ db_set_w(si->hContact, si->pszModule, "ApparentMode", 0);
SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, lParam == 2 ? lParam : 1);
return TRUE;
@@ -2328,7 +2328,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case WINDOW_VISIBLE:
if (IsIconic(hwndDlg))
ShowWindow(hwndDlg, SW_NORMAL);
-LABEL_SHOWWINDOW:
+ LABEL_SHOWWINDOW:
SendMessage(hwndDlg, WM_SIZE, 0, 0);
SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
@@ -2461,176 +2461,176 @@ LABEL_SHOWWINDOW:
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case EN_MSGFILTER:
- {
- UINT msg = ((MSGFILTER *) lParam)->msg;
- WPARAM wp = ((MSGFILTER *) lParam)->wParam;
- LPARAM lp = ((MSGFILTER *) lParam)->lParam;
+ {
+ UINT msg = ((MSGFILTER *)lParam)->msg;
+ WPARAM wp = ((MSGFILTER *)lParam)->wParam;
+ LPARAM lp = ((MSGFILTER *)lParam)->lParam;
- BOOL isShift, isCtrl, isMenu;
- KbdState(dat, isShift, isCtrl, isMenu);
+ BOOL isShift, isCtrl, isMenu;
+ KbdState(dat, isShift, isCtrl, isMenu);
- MSG message;
- message.hwnd = hwndDlg;
- message.message = msg;
- message.lParam = lp;
- message.wParam = wp;
+ MSG message;
+ message.hwnd = hwndDlg;
+ message.message = msg;
+ message.lParam = lp;
+ message.wParam = wp;
- if (msg == WM_SYSKEYUP) {
- if (wp == VK_MENU)
- if (!dat->fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
- dat->pContainer->MenuBar->autoShow();
+ if (msg == WM_SYSKEYUP) {
+ if (wp == VK_MENU)
+ if (!dat->fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
+ dat->pContainer->MenuBar->autoShow();
- return _dlgReturn(hwndDlg, 0);
- }
+ return _dlgReturn(hwndDlg, 0);
+ }
- if (msg == WM_MOUSEMOVE) {
- POINT pt;
- GetCursorPos(&pt);
- DM_DismissTip(dat, pt);
- dat->Panel->trackMouse(pt);
- break;
- }
- if (msg == WM_KEYDOWN) {
- if ((wp == VK_INSERT && isShift && !isCtrl && !isMenu) || (wp == 'V' && !isShift && !isMenu && isCtrl)) {
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_PASTESPECIAL, CF_UNICODETEXT, 0);
- ((MSGFILTER*)lParam)->msg = WM_NULL;
- ((MSGFILTER*)lParam)->wParam = 0;
- ((MSGFILTER*)lParam)->lParam = 0;
- return _dlgReturn(hwndDlg, 1);
- }
+ if (msg == WM_MOUSEMOVE) {
+ POINT pt;
+ GetCursorPos(&pt);
+ DM_DismissTip(dat, pt);
+ dat->Panel->trackMouse(pt);
+ break;
+ }
+ if (msg == WM_KEYDOWN) {
+ if ((wp == VK_INSERT && isShift && !isCtrl && !isMenu) || (wp == 'V' && !isShift && !isMenu && isCtrl)) {
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_PASTESPECIAL, CF_UNICODETEXT, 0);
+ ((MSGFILTER*)lParam)->msg = WM_NULL;
+ ((MSGFILTER*)lParam)->wParam = 0;
+ ((MSGFILTER*)lParam)->lParam = 0;
+ return _dlgReturn(hwndDlg, 1);
}
+ }
- if (msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN)
- dat->pContainer->MenuBar->Cancel();
+ if (msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN)
+ dat->pContainer->MenuBar->Cancel();
- if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
- if (DM_GenericHotkeysCheck(&message, dat)) {
- dat->fkeyProcessed = true;
- return _dlgReturn(hwndDlg, 1);
- }
+ if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
+ if (DM_GenericHotkeysCheck(&message, dat)) {
+ dat->fkeyProcessed = true;
+ return _dlgReturn(hwndDlg, 1);
+ }
- LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC));
- if (mim_hotkey_check)
- dat->fkeyProcessed = true;
- switch(mim_hotkey_check) { // nothing (yet) FIXME
- case TABSRMM_HK_CHANNELMGR:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, BN_CLICKED), 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_FILTERTOGGLE:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FILTER, BN_CLICKED), 0);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FILTER), NULL, TRUE);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_LISTTOGGLE:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_MUC_SHOWSERVER:
- if (si->iType != GCW_SERVER)
- pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", 0);
- return _dlgReturn(hwndDlg, 1);
- }
+ LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC));
+ if (mim_hotkey_check)
+ dat->fkeyProcessed = true;
+ switch (mim_hotkey_check) { // nothing (yet) FIXME
+ case TABSRMM_HK_CHANNELMGR:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHANMGR, BN_CLICKED), 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_FILTERTOGGLE:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FILTER, BN_CLICKED), 0);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_FILTER), NULL, TRUE);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_LISTTOGGLE:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_MUC_SHOWSERVER:
+ if (si->iType != GCW_SERVER)
+ pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", 0);
+ return _dlgReturn(hwndDlg, 1);
}
+ }
- if (msg == WM_KEYDOWN && wp == VK_TAB) {
- if (((NMHDR*)lParam)->idFrom == IDC_CHAT_LOG) {
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- return _dlgReturn(hwndDlg, 1);
- }
+ if (msg == WM_KEYDOWN && wp == VK_TAB) {
+ if (((NMHDR*)lParam)->idFrom == IDC_CHAT_LOG) {
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ return _dlgReturn(hwndDlg, 1);
}
+ }
- if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_LOG && ((MSGFILTER *) lParam)->msg == WM_RBUTTONUP) {
- CHARRANGE sel, all = { 0, -1 };
+ if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
+ CHARRANGE sel, all = { 0, -1 };
- POINT pt = { (short)LOWORD(((ENLINK*) lParam)->lParam), (short)HIWORD(((ENLINK*) lParam)->lParam) };
- ClientToScreen(((LPNMHDR)lParam)->hwndFrom, &pt);
+ POINT pt = { (short)LOWORD(((ENLINK*)lParam)->lParam), (short)HIWORD(((ENLINK*)lParam)->lParam) };
+ ClientToScreen(((LPNMHDR)lParam)->hwndFrom, &pt);
- // fixing stuff for searches
- TCHAR *pszWord = (TCHAR*)_alloca(8192);
- pszWord[0] = '\0';
- POINTL ptl = { pt.x, pt.y };
- ScreenToClient(GetDlgItem(hwndDlg, IDC_CHAT_LOG), (LPPOINT)&ptl);
- int iCharIndex = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_CHARFROMPOS, 0, (LPARAM)&ptl);
- if (iCharIndex < 0)
- break;
+ // fixing stuff for searches
+ TCHAR *pszWord = (TCHAR*)_alloca(8192);
+ pszWord[0] = '\0';
+ POINTL ptl = { pt.x, pt.y };
+ ScreenToClient(GetDlgItem(hwndDlg, IDC_CHAT_LOG), (LPPOINT)&ptl);
+ int iCharIndex = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_CHARFROMPOS, 0, (LPARAM)&ptl);
+ if (iCharIndex < 0)
+ break;
- int start = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_FINDWORDBREAK, WB_LEFT, iCharIndex);
- int end = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);
+ int start = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_FINDWORDBREAK, WB_LEFT, iCharIndex);
+ int end = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);
- if (end - start > 0) {
- static char szTrimString[] = ":;,.!?\'\"><()[]- \r\n";
+ if (end - start > 0) {
+ static char szTrimString[] = ":;,.!?\'\"><()[]- \r\n";
- CHARRANGE cr;
- cr.cpMin = start;
- cr.cpMax = end;
+ CHARRANGE cr;
+ cr.cpMin = start;
+ cr.cpMax = end;
- TEXTRANGE tr = { 0 };
- tr.chrg = cr;
- tr.lpstrText = (TCHAR*)pszWord;
- int iRes = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
+ TEXTRANGE tr = { 0 };
+ tr.chrg = cr;
+ tr.lpstrText = (TCHAR*)pszWord;
+ int iRes = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
- if (iRes > 0) {
- size_t iLen = mir_tstrlen(pszWord) - 1;
- while (iLen >= 0 && strchr(szTrimString, pszWord[iLen])) {
- pszWord[iLen] = '\0';
- iLen--;
- }
+ if (iRes > 0) {
+ size_t iLen = mir_tstrlen(pszWord) - 1;
+ while (iLen >= 0 && strchr(szTrimString, pszWord[iLen])) {
+ pszWord[iLen] = '\0';
+ iLen--;
}
}
+ }
- HMENU hMenu = 0;
- UINT uID = CreateGCMenu(hwndDlg, &hMenu, 1, pt, si, NULL, pszWord);
- if ((uID > 800 && uID < 1400) || uID == CP_UTF8 || uID == 20866) {
- dat->codePage = uID;
- db_set_dw(dat->hContact, SRMSGMOD_T, "ANSIcodepage", dat->codePage);
- }
- else if (uID == 500) {
- dat->codePage = CP_ACP;
- db_unset(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
- }
- else switch (uID) {
- case 0:
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
-
- case ID_COPYALL:
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, WM_COPY, 0, 0);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&sel);
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
+ HMENU hMenu = 0;
+ UINT uID = CreateGCMenu(hwndDlg, &hMenu, 1, pt, si, NULL, pszWord);
+ if ((uID > 800 && uID < 1400) || uID == CP_UTF8 || uID == 20866) {
+ dat->codePage = uID;
+ db_set_dw(dat->hContact, SRMSGMOD_T, "ANSIcodepage", dat->codePage);
+ }
+ else if (uID == 500) {
+ dat->codePage = CP_ACP;
+ db_unset(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
+ }
+ else switch (uID) {
+ case 0:
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- case ID_CLEARLOG:
- ClearLog(dat);
- break;
+ case ID_COPYALL:
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, WM_COPY, 0, 0);
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&sel);
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- case ID_SEARCH_GOOGLE:
- if (pszWord[0]) {
- TCHAR szURL[4096];
- mir_sntprintf(szURL, SIZEOF(szURL), _T("http://www.google.com/search?q=%s"), pszWord);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)szURL);
- }
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
+ case ID_CLEARLOG:
+ ClearLog(dat);
+ break;
- case ID_SEARCH_WIKIPEDIA:
- if (pszWord[0]) {
- TCHAR szURL[4096];
- mir_sntprintf(szURL, SIZEOF(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)szURL);
- }
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- break;
+ case ID_SEARCH_GOOGLE:
+ if (pszWord[0]) {
+ TCHAR szURL[4096];
+ mir_sntprintf(szURL, SIZEOF(szURL), _T("http://www.google.com/search?q=%s"), pszWord);
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)szURL);
+ }
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- default:
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
- break;
+ case ID_SEARCH_WIKIPEDIA:
+ if (pszWord[0]) {
+ TCHAR szURL[4096];
+ mir_sntprintf(szURL, SIZEOF(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord);
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)szURL);
}
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ break;
- DestroyGCMenu(&hMenu, 5);
+ default:
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
+ pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
+ break;
}
+
+ DestroyGCMenu(&hMenu, 5);
}
- break;
+ }
+ break;
case EN_REQUESTRESIZE:
if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_MESSAGE)
@@ -2639,7 +2639,7 @@ LABEL_SHOWWINDOW:
case EN_LINK:
if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_LOG) {
- switch (((ENLINK*) lParam)->msg) {
+ switch (((ENLINK*)lParam)->msg) {
case WM_SETCURSOR:
if (g_Settings.bClickableNicks) {
if (!hCurHyperlinkHand)
@@ -2653,136 +2653,136 @@ LABEL_SHOWWINDOW:
case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
- {
- CHARRANGE sel;
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin != sel.cpMax)
- break;
-
- UINT msg = ((ENLINK*) lParam)->msg;
- dat->pContainer->MenuBar->Cancel();
-
- TEXTRANGE tr;
- tr.lpstrText = NULL;
- tr.chrg = ((ENLINK*) lParam)->chrg;
- tr.lpstrText = (TCHAR*)mir_alloc(sizeof(TCHAR) * (tr.chrg.cpMax - tr.chrg.cpMin + 2));
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
-
- BOOL isLink = IsStringValidLink(tr.lpstrText);
- if (isLink) {
- if (((ENLINK*) lParam)->msg == WM_RBUTTONDOWN) {
- HMENU hSubMenu = GetSubMenu(g_hMenu, 2);
- TranslateMenu(hSubMenu);
- pt.x = (short) LOWORD(((ENLINK*) lParam)->lParam);
- pt.y = (short) HIWORD(((ENLINK*) lParam)->lParam);
- ClientToScreen(((NMHDR*) lParam)->hwndFrom, &pt);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
- case ID_NEW:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)tr.lpstrText);
- break;
- case ID_CURR:
- CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)tr.lpstrText);
- break;
- case ID_COPY:
- if (!OpenClipboard(hwndDlg))
- break;
- EmptyClipboard();
- {
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR) * (mir_tstrlen(tr.lpstrText) + 1));
- mir_tstrcpy((TCHAR*)GlobalLock(hData), tr.lpstrText);
- GlobalUnlock(hData);
- SetClipboardData(CF_UNICODETEXT, hData);
- }
- CloseClipboard();
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ {
+ CHARRANGE sel;
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin != sel.cpMax)
+ break;
+
+ UINT msg = ((ENLINK*)lParam)->msg;
+ dat->pContainer->MenuBar->Cancel();
+
+ TEXTRANGE tr;
+ tr.lpstrText = NULL;
+ tr.chrg = ((ENLINK*)lParam)->chrg;
+ tr.lpstrText = (TCHAR*)mir_alloc(sizeof(TCHAR) * (tr.chrg.cpMax - tr.chrg.cpMin + 2));
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
+
+ BOOL isLink = IsStringValidLink(tr.lpstrText);
+ if (isLink) {
+ if (((ENLINK*)lParam)->msg == WM_RBUTTONDOWN) {
+ HMENU hSubMenu = GetSubMenu(g_hMenu, 2);
+ TranslateMenu(hSubMenu);
+ pt.x = (short)LOWORD(((ENLINK*)lParam)->lParam);
+ pt.y = (short)HIWORD(((ENLINK*)lParam)->lParam);
+ ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt);
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
+ case ID_NEW:
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)tr.lpstrText);
+ break;
+ case ID_CURR:
+ CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)tr.lpstrText);
+ break;
+ case ID_COPY:
+ if (!OpenClipboard(hwndDlg))
break;
+ EmptyClipboard();
+ {
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR) * (mir_tstrlen(tr.lpstrText) + 1));
+ mir_tstrcpy((TCHAR*)GlobalLock(hData), tr.lpstrText);
+ GlobalUnlock(hData);
+ SetClipboardData(CF_UNICODETEXT, hData);
}
- mir_free(tr.lpstrText);
- return TRUE;
- }
- if (((ENLINK*) lParam)->msg == WM_LBUTTONUP) {
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)tr.lpstrText);
+ CloseClipboard();
SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- mir_free(tr.lpstrText);
- return TRUE;
+ break;
}
+ mir_free(tr.lpstrText);
+ return TRUE;
+ }
+ if (((ENLINK*)lParam)->msg == WM_LBUTTONUP) {
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)tr.lpstrText);
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ mir_free(tr.lpstrText);
+ return TRUE;
}
- else if (g_Settings.bClickableNicks) { // clicked a nick name
- CHARRANGE chr;
- TEXTRANGE tr2;
- TCHAR tszAplTmpl[] = _T("%s:"), *tszAppeal, *tszTmp;
- size_t st;
-
- if (msg == WM_RBUTTONDOWN) {
- HMENU hMenu = 0;
- USERINFO uiNew;
- for (USERINFO *ui = si->pUsers; ui; ui = ui->next) {
- if ( mir_tstrcmp(ui->pszNick, tr.lpstrText))
- continue;
-
- pt.x = (short) LOWORD(((ENLINK*) lParam)->lParam);
- pt.y = (short) HIWORD(((ENLINK*) lParam)->lParam);
- ClientToScreen(((NMHDR*) lParam)->hwndFrom, &pt);
- memcpy(&uiNew, ui, sizeof(USERINFO));
- UINT uID = CreateGCMenu(hwndDlg, &hMenu, 0, pt, si, uiNew.pszUID, uiNew.pszNick);
- switch (uID) {
- case 0:
- break;
-
- case ID_MESS:
- pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
- break;
-
- default:
- pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
- break;
- }
- DestroyGCMenu(&hMenu, 1);
- return TRUE;
+ }
+ else if (g_Settings.bClickableNicks) { // clicked a nick name
+ CHARRANGE chr;
+ TEXTRANGE tr2;
+ TCHAR tszAplTmpl[] = _T("%s:"), *tszAppeal, *tszTmp;
+ size_t st;
+
+ if (msg == WM_RBUTTONDOWN) {
+ HMENU hMenu = 0;
+ USERINFO uiNew;
+ for (USERINFO *ui = si->pUsers; ui; ui = ui->next) {
+ if (mir_tstrcmp(ui->pszNick, tr.lpstrText))
+ continue;
+
+ pt.x = (short)LOWORD(((ENLINK*)lParam)->lParam);
+ pt.y = (short)HIWORD(((ENLINK*)lParam)->lParam);
+ ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt);
+ memcpy(&uiNew, ui, sizeof(USERINFO));
+ UINT uID = CreateGCMenu(hwndDlg, &hMenu, 0, pt, si, uiNew.pszUID, uiNew.pszNick);
+ switch (uID) {
+ case 0:
+ break;
+
+ case ID_MESS:
+ pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
+ break;
+
+ default:
+ pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
+ break;
}
+ DestroyGCMenu(&hMenu, 1);
return TRUE;
}
- else if (msg == WM_LBUTTONUP) {
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr);
- size_t bufSize = mir_tstrlen(tr.lpstrText) + mir_tstrlen(tszAplTmpl) + 3;
- tszTmp = tszAppeal = (TCHAR*)mir_alloc(bufSize * sizeof(TCHAR));
- tr2.lpstrText = (LPTSTR) mir_alloc(sizeof(TCHAR) * 2);
- if (chr.cpMin) {
- // prepend nick with space if needed
- tr2.chrg.cpMin = chr.cpMin - 1;
- tr2.chrg.cpMax = chr.cpMin;
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2);
- if (! _istspace(*tr2.lpstrText))
- *tszTmp++ = _T(' ');
- _tcscpy(tszTmp, tr.lpstrText);
- }
- else // in the beginning of the message window
- mir_sntprintf(tszAppeal, bufSize, tszAplTmpl, tr.lpstrText);
-
- st = mir_tstrlen(tszAppeal);
- if (chr.cpMax != -1) {
- tr2.chrg.cpMin = chr.cpMax;
- tr2.chrg.cpMax = chr.cpMax + 1;
- // if there is no space after selection,
- // or there is nothing after selection at all...
- if (!SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2) || !_istspace(*tr2.lpstrText)) {
- tszAppeal[st++] = _T(' ');
- tszAppeal[st++] = _T('\0');
- }
- }
- else {
+ return TRUE;
+ }
+ else if (msg == WM_LBUTTONUP) {
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr);
+ size_t bufSize = mir_tstrlen(tr.lpstrText) + mir_tstrlen(tszAplTmpl) + 3;
+ tszTmp = tszAppeal = (TCHAR*)mir_alloc(bufSize * sizeof(TCHAR));
+ tr2.lpstrText = (LPTSTR)mir_alloc(sizeof(TCHAR) * 2);
+ if (chr.cpMin) {
+ // prepend nick with space if needed
+ tr2.chrg.cpMin = chr.cpMin - 1;
+ tr2.chrg.cpMax = chr.cpMin;
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2);
+ if (!_istspace(*tr2.lpstrText))
+ *tszTmp++ = _T(' ');
+ _tcscpy(tszTmp, tr.lpstrText);
+ }
+ else // in the beginning of the message window
+ mir_sntprintf(tszAppeal, bufSize, tszAplTmpl, tr.lpstrText);
+
+ st = mir_tstrlen(tszAppeal);
+ if (chr.cpMax != -1) {
+ tr2.chrg.cpMin = chr.cpMax;
+ tr2.chrg.cpMax = chr.cpMax + 1;
+ // if there is no space after selection,
+ // or there is nothing after selection at all...
+ if (!SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2) || !_istspace(*tr2.lpstrText)) {
tszAppeal[st++] = _T(' ');
tszAppeal[st++] = _T('\0');
}
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)tszAppeal);
- mir_free((void*) tr2.lpstrText);
- mir_free((void*) tszAppeal);
}
+ else {
+ tszAppeal[st++] = _T(' ');
+ tszAppeal[st++] = _T('\0');
+ }
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)tszAppeal);
+ mir_free((void*)tr2.lpstrText);
+ mir_free((void*)tszAppeal);
}
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- mir_free(tr.lpstrText);
- return TRUE;
}
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ mir_free(tr.lpstrText);
+ return TRUE;
+ }
}
return TRUE;
}
@@ -2817,14 +2817,14 @@ LABEL_SHOWWINDOW:
break;
case WM_APPCOMMAND:
- {
- DWORD cmd = GET_APPCOMMAND_LPARAM(lParam);
- if (cmd == APPCOMMAND_BROWSER_BACKWARD || cmd == APPCOMMAND_BROWSER_FORWARD) {
- SendMessage(dat->pContainer->hwnd, DM_SELECTTAB, cmd == APPCOMMAND_BROWSER_BACKWARD ? DM_SELECT_PREV : DM_SELECT_NEXT, 0);
- return 1;
- }
+ {
+ DWORD cmd = GET_APPCOMMAND_LPARAM(lParam);
+ if (cmd == APPCOMMAND_BROWSER_BACKWARD || cmd == APPCOMMAND_BROWSER_FORWARD) {
+ SendMessage(dat->pContainer->hwnd, DM_SELECTTAB, cmd == APPCOMMAND_BROWSER_BACKWARD ? DM_SELECT_PREV : DM_SELECT_NEXT, 0);
+ return 1;
}
- break;
+ }
+ break;
case WM_COMMAND:
if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID){
@@ -2956,26 +2956,26 @@ LABEL_SHOWWINDOW:
case IDC_SMILEY:
case IDC_SMILEYBTN:
- {
- if (lParam == 0)
- GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYBTN), &rc);
- else
- GetWindowRect((HWND)lParam, &rc);
-
- SMADD_SHOWSEL3 smaddInfo = { sizeof(smaddInfo) };
- smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
- smaddInfo.targetMessage = EM_REPLACESEL;
- smaddInfo.targetWParam = TRUE;
- smaddInfo.Protocolname = si->pszModule;
- smaddInfo.Direction = 0;
- smaddInfo.xPosition = rc.left;
- smaddInfo.yPosition = rc.top + 24;
- smaddInfo.hContact = si->hContact;
- smaddInfo.hwndParent = dat->pContainer->hwnd;
- if (PluginConfig.g_SmileyAddAvail)
- CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
- }
- break;
+ {
+ if (lParam == 0)
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYBTN), &rc);
+ else
+ GetWindowRect((HWND)lParam, &rc);
+
+ SMADD_SHOWSEL3 smaddInfo = { sizeof(smaddInfo) };
+ smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
+ smaddInfo.targetMessage = EM_REPLACESEL;
+ smaddInfo.targetWParam = TRUE;
+ smaddInfo.Protocolname = si->pszModule;
+ smaddInfo.Direction = 0;
+ smaddInfo.xPosition = rc.left;
+ smaddInfo.yPosition = rc.top + 24;
+ smaddInfo.hContact = si->hContact;
+ smaddInfo.hwndParent = dat->pContainer->hwnd;
+ if (PluginConfig.g_SmileyAddAvail)
+ CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
+ }
+ break;
case IDC_CHAT_HISTORY:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_HISTORY))) {
@@ -3119,77 +3119,77 @@ LABEL_SHOWWINDOW:
break;
case WM_ERASEBKGND:
- {
- HDC hdc = (HDC)wParam;
- RECT rcClient, rcWindow, rc;
- UINT item_ids[3] = {ID_EXTBKUSERLIST, ID_EXTBKHISTORY, ID_EXTBKINPUTAREA};
- UINT ctl_ids[3] = {IDC_LIST, IDC_CHAT_LOG, IDC_CHAT_MESSAGE};
- bool bAero = M.isAero();
- HANDLE hbp = 0;
- HDC hdcMem = 0;
- HBITMAP hbm, hbmOld;
-
- GetClientRect(hwndDlg, &rcClient);
- LONG cx = rcClient.right - rcClient.left;
- LONG cy = rcClient.bottom - rcClient.top;
-
- if (CMimAPI::m_haveBufferedPaint) {
- hbp = CSkin::InitiateBufferedPaint(hdc, rcClient, hdcMem);
- hbm = hbmOld = 0;
- }
- else {
- hdcMem = CreateCompatibleDC(hdc);
- hbm = CSkin::CreateAeroCompatibleBitmap(rcClient, hdc);
- hbmOld = (HBITMAP)SelectObject(hdcMem, hbm);
- }
-
- if (CSkin::m_skinEnabled && !bAero) {
- CSkin::SkinDrawBG(hwndDlg, dat->pContainer->hwnd, dat->pContainer, &rcClient, hdcMem);
- for (int i=0; i < 3; i++) {
- CSkinItem *item = &SkinItems[item_ids[i]];
- if (!item->IGNORED) {
- GetWindowRect(GetDlgItem(hwndDlg, ctl_ids[i]), &rcWindow);
- pt.x = rcWindow.left;
- pt.y = rcWindow.top;
- ScreenToClient(hwndDlg, &pt);
- rc.left = pt.x - item->MARGIN_LEFT;
- rc.top = pt.y - item->MARGIN_TOP;
- rc.right = rc.left + item->MARGIN_RIGHT + (rcWindow.right - rcWindow.left) + item->MARGIN_LEFT;
- rc.bottom = rc.top + item->MARGIN_BOTTOM + (rcWindow.bottom - rcWindow.top) + item->MARGIN_TOP;
- CSkin::DrawItem(hdcMem, &rc, item);
- }
+ {
+ HDC hdc = (HDC)wParam;
+ RECT rcClient, rcWindow, rc;
+ UINT item_ids[3] = { ID_EXTBKUSERLIST, ID_EXTBKHISTORY, ID_EXTBKINPUTAREA };
+ UINT ctl_ids[3] = { IDC_LIST, IDC_CHAT_LOG, IDC_CHAT_MESSAGE };
+ bool bAero = M.isAero();
+ HANDLE hbp = 0;
+ HDC hdcMem = 0;
+ HBITMAP hbm, hbmOld;
+
+ GetClientRect(hwndDlg, &rcClient);
+ LONG cx = rcClient.right - rcClient.left;
+ LONG cy = rcClient.bottom - rcClient.top;
+
+ if (CMimAPI::m_haveBufferedPaint) {
+ hbp = CSkin::InitiateBufferedPaint(hdc, rcClient, hdcMem);
+ hbm = hbmOld = 0;
+ }
+ else {
+ hdcMem = CreateCompatibleDC(hdc);
+ hbm = CSkin::CreateAeroCompatibleBitmap(rcClient, hdc);
+ hbmOld = (HBITMAP)SelectObject(hdcMem, hbm);
+ }
+
+ if (CSkin::m_skinEnabled && !bAero) {
+ CSkin::SkinDrawBG(hwndDlg, dat->pContainer->hwnd, dat->pContainer, &rcClient, hdcMem);
+ for (int i = 0; i < 3; i++) {
+ CSkinItem *item = &SkinItems[item_ids[i]];
+ if (!item->IGNORED) {
+ GetWindowRect(GetDlgItem(hwndDlg, ctl_ids[i]), &rcWindow);
+ pt.x = rcWindow.left;
+ pt.y = rcWindow.top;
+ ScreenToClient(hwndDlg, &pt);
+ rc.left = pt.x - item->MARGIN_LEFT;
+ rc.top = pt.y - item->MARGIN_TOP;
+ rc.right = rc.left + item->MARGIN_RIGHT + (rcWindow.right - rcWindow.left) + item->MARGIN_LEFT;
+ rc.bottom = rc.top + item->MARGIN_BOTTOM + (rcWindow.bottom - rcWindow.top) + item->MARGIN_TOP;
+ CSkin::DrawItem(hdcMem, &rc, item);
}
}
- else {
- CSkin::FillBack(hdcMem, &rcClient);
+ }
+ else {
+ CSkin::FillBack(hdcMem, &rcClient);
- if (M.isAero()) {
- LONG temp = rcClient.bottom;
- rcClient.bottom = dat->Panel->isActive() ? dat->Panel->getHeight() + 5 : 5;
- FillRect(hdcMem, &rcClient, (HBRUSH)GetStockObject(BLACK_BRUSH));
- rcClient.bottom = temp;
- }
+ if (M.isAero()) {
+ LONG temp = rcClient.bottom;
+ rcClient.bottom = dat->Panel->isActive() ? dat->Panel->getHeight() + 5 : 5;
+ FillRect(hdcMem, &rcClient, (HBRUSH)GetStockObject(BLACK_BRUSH));
+ rcClient.bottom = temp;
}
+ }
- GetClientRect(hwndDlg, &rc);
- dat->Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], bAero);
- dat->Panel->renderContent(hdcMem);
+ GetClientRect(hwndDlg, &rc);
+ dat->Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], bAero);
+ dat->Panel->renderContent(hdcMem);
- if (!CSkin::m_skinEnabled)
- CSkin::RenderToolbarBG(dat, hdcMem, rcClient);
+ if (!CSkin::m_skinEnabled)
+ CSkin::RenderToolbarBG(dat, hdcMem, rcClient);
- if (hbp)
- CSkin::FinalizeBufferedPaint(hbp, &rcClient);
- else {
- BitBlt(hdc, 0, 0, cx, cy, hdcMem, 0, 0, SRCCOPY);
- SelectObject(hdcMem, hbmOld);
- DeleteObject(hbm);
- DeleteDC(hdcMem);
- }
- if (!dat->fLimitedUpdate)
- SetAeroMargins(dat->pContainer);
+ if (hbp)
+ CSkin::FinalizeBufferedPaint(hbp, &rcClient);
+ else {
+ BitBlt(hdc, 0, 0, cx, cy, hdcMem, 0, 0, SRCCOPY);
+ SelectObject(hdcMem, hbmOld);
+ DeleteObject(hbm);
+ DeleteDC(hdcMem);
}
- return 1;
+ if (!dat->fLimitedUpdate)
+ SetAeroMargins(dat->pContainer);
+ }
+ return 1;
case WM_NCPAINT:
if (CSkin::m_skinEnabled)
@@ -3197,12 +3197,12 @@ LABEL_SHOWWINDOW:
break;
case WM_PAINT:
- {
- PAINTSTRUCT ps;
- BeginPaint(hwndDlg, &ps);
- EndPaint(hwndDlg, &ps);
- }
- return 0;
+ {
+ PAINTSTRUCT ps;
+ BeginPaint(hwndDlg, &ps);
+ EndPaint(hwndDlg, &ps);
+ }
+ return 0;
case DM_SETINFOPANEL:
CInfoPanel::setPanelHandler(dat, wParam, lParam);
@@ -3215,14 +3215,14 @@ LABEL_SHOWWINDOW:
case WM_RBUTTONUP:
GetCursorPos(&pt);
- if ( !dat->Panel->invokeConfigDialog(pt)) {
+ if (!dat->Panel->invokeConfigDialog(pt)) {
HMENU subMenu = GetSubMenu(dat->pContainer->hMenuContext, 0);
MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
if (iSelection >= IDM_CONTAINERMENU) {
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
char szIndex[10];
char *szKey = "TAB_ContainersW";
mir_snprintf(szIndex, SIZEOF(szIndex), "%d", iSelection - IDM_CONTAINERMENU);
@@ -3259,26 +3259,26 @@ LABEL_SHOWWINDOW:
break;
case DM_CONTAINERSELECTED:
- {
- TContainerData *pNewContainer = 0;
- TCHAR *szNewName = (TCHAR*)lParam;
- if (!_tcscmp(szNewName, TranslateT("Default container")))
- szNewName = CGlobals::m_default_container_name;
- int iOldItems = TabCtrl_GetItemCount(hwndTab);
- if (!_tcsncmp(dat->pContainer->szName, szNewName, CONTAINER_NAMELEN))
+ {
+ TContainerData *pNewContainer = 0;
+ TCHAR *szNewName = (TCHAR*)lParam;
+ if (!_tcscmp(szNewName, TranslateT("Default container")))
+ szNewName = CGlobals::m_default_container_name;
+ int iOldItems = TabCtrl_GetItemCount(hwndTab);
+ if (!_tcsncmp(dat->pContainer->szName, szNewName, CONTAINER_NAMELEN))
+ break;
+ pNewContainer = FindContainerByName(szNewName);
+ if (pNewContainer == NULL)
+ if ((pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact)) == NULL)
break;
- pNewContainer = FindContainerByName(szNewName);
- if (pNewContainer == NULL)
- if ((pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact)) == NULL)
- break;
- db_set_ts(dat->hContact, SRMSGMOD_T, "containerW", szNewName);
- PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB_CHAT, (WPARAM)pNewContainer, (LPARAM)hwndDlg);
- if (iOldItems > 1) // there were more than 1 tab, container is still valid
- SendMessage(dat->pContainer->hwndActive, WM_SIZE, 0, 0);
- SetForegroundWindow(pNewContainer->hwnd);
- SetActiveWindow(pNewContainer->hwnd);
- }
- break;
+ db_set_ts(dat->hContact, SRMSGMOD_T, "containerW", szNewName);
+ PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB_CHAT, (WPARAM)pNewContainer, (LPARAM)hwndDlg);
+ if (iOldItems > 1) // there were more than 1 tab, container is still valid
+ SendMessage(dat->pContainer->hwndActive, WM_SIZE, 0, 0);
+ SetForegroundWindow(pNewContainer->hwnd);
+ SetActiveWindow(pNewContainer->hwnd);
+ }
+ break;
// container API support functions
case DM_QUERYCONTAINER:
@@ -3292,51 +3292,51 @@ LABEL_SHOWWINDOW:
return 0;
case GC_CLOSEWINDOW:
- {
- TContainerData *pContainer = dat->pContainer;
- bool bForced = (lParam == 2);
+ {
+ TContainerData *pContainer = dat->pContainer;
+ bool bForced = (lParam == 2);
- int iTabs = TabCtrl_GetItemCount(hwndTab);
- if (iTabs == 1 && CMimAPI::m_shutDown == 0) {
- SendMessage(GetParent(GetParent(hwndDlg)), WM_CLOSE, 0, 1);
- return 1;
- }
+ int iTabs = TabCtrl_GetItemCount(hwndTab);
+ if (iTabs == 1 && CMimAPI::m_shutDown == 0) {
+ SendMessage(GetParent(GetParent(hwndDlg)), WM_CLOSE, 0, 1);
+ return 1;
+ }
- dat->pContainer->iChilds--;
- int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
+ dat->pContainer->iChilds--;
+ int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
- // after closing a tab, we need to activate the tab to the left side of
- // the previously open tab.
- // normally, this tab has the same index after the deletion of the formerly active tab
- // unless, of course, we closed the last (rightmost) tab.
- if (!dat->pContainer->bDontSmartClose && iTabs > 1 && !bForced) {
- if (i == iTabs - 1)
- i--;
- else
- i++;
- TabCtrl_SetCurSel(hwndTab, i);
+ // after closing a tab, we need to activate the tab to the left side of
+ // the previously open tab.
+ // normally, this tab has the same index after the deletion of the formerly active tab
+ // unless, of course, we closed the last (rightmost) tab.
+ if (!dat->pContainer->bDontSmartClose && iTabs > 1 && !bForced) {
+ if (i == iTabs - 1)
+ i--;
+ else
+ i++;
+ TabCtrl_SetCurSel(hwndTab, i);
- TCITEM item = { 0 };
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, i, &item); // retrieve dialog hwnd for the now active tab...
- dat->pContainer->hwndActive = (HWND)item.lParam;
+ TCITEM item = { 0 };
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, i, &item); // retrieve dialog hwnd for the now active tab...
+ dat->pContainer->hwndActive = (HWND)item.lParam;
- SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
- SetWindowPos(dat->pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW);
- ShowWindow((HWND)item.lParam, SW_SHOW);
- SetForegroundWindow(dat->pContainer->hwndActive);
- SetFocus(dat->pContainer->hwndActive);
- SendMessage(dat->pContainer->hwnd, WM_SIZE, 0, 0);
- }
+ SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
+ SetWindowPos(dat->pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW);
+ ShowWindow((HWND)item.lParam, SW_SHOW);
+ SetForegroundWindow(dat->pContainer->hwndActive);
+ SetFocus(dat->pContainer->hwndActive);
+ SendMessage(dat->pContainer->hwnd, WM_SIZE, 0, 0);
+ }
- if (iTabs == 1)
- SendMessage(GetParent(GetParent(hwndDlg)), WM_CLOSE, 0, 1);
- else {
- PostMessage(pContainer->hwnd, WM_SIZE, 0, 0);
- DestroyWindow(hwndDlg);
- }
+ if (iTabs == 1)
+ SendMessage(GetParent(GetParent(hwndDlg)), WM_CLOSE, 0, 1);
+ else {
+ PostMessage(pContainer->hwnd, WM_SIZE, 0, 0);
+ DestroyWindow(hwndDlg);
}
- return 0;
+ }
+ return 0;
case DM_SETLOCALE:
if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
@@ -3366,7 +3366,7 @@ LABEL_SHOWWINDOW:
dat->dwFlags &= ~MWF_WASBACKGROUNDCREATE;
SendMessage(hwndDlg, WM_SIZE, 0, 0);
- POINT pt = {0};
+ POINT pt = { 0 };
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETSCROLLPOS, 0, (LPARAM)&pt);
if (PluginConfig.m_bAutoLocaleSupport) {
if (dat->hkl == 0)
@@ -3383,17 +3383,17 @@ LABEL_SHOWWINDOW:
return 0;
case DM_GETWINDOWSTATE:
- {
- UINT state = MSG_WINDOW_STATE_EXISTS;
- if (IsWindowVisible(hwndDlg))
- state |= MSG_WINDOW_STATE_VISIBLE;
- if (GetForegroundWindow() == dat->pContainer->hwnd)
- state |= MSG_WINDOW_STATE_FOCUS;
- if (IsIconic(dat->pContainer->hwnd))
- state |= MSG_WINDOW_STATE_ICONIC;
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, state);
- }
- return TRUE;
+ {
+ UINT state = MSG_WINDOW_STATE_EXISTS;
+ if (IsWindowVisible(hwndDlg))
+ state |= MSG_WINDOW_STATE_VISIBLE;
+ if (GetForegroundWindow() == dat->pContainer->hwnd)
+ state |= MSG_WINDOW_STATE_FOCUS;
+ if (IsIconic(dat->pContainer->hwnd))
+ state |= MSG_WINDOW_STATE_ICONIC;
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, state);
+ }
+ return TRUE;
case DM_ADDDIVIDER:
if (!(dat->dwFlags & MWF_DIVIDERSET) && g_Settings.bUseDividers) {
diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h
index 069a38f10b..6270ea6e5e 100644
--- a/plugins/TabSRMM/src/commonheaders.h
+++ b/plugins/TabSRMM/src/commonheaders.h
@@ -153,19 +153,19 @@ typedef struct _DWM_THUMBNAIL_PROPERTIES
enum DWMWINDOWATTRIBUTE
{
- DWMWA_NCRENDERING_ENABLED = 1, // [get] Is non-client rendering enabled/disabled
- DWMWA_NCRENDERING_POLICY, // [set] Non-client rendering policy
- DWMWA_TRANSITIONS_FORCEDISABLED, // [set] Potentially enable/forcibly disable transitions
- DWMWA_ALLOW_NCPAINT, // [set] Allow contents rendered in the non-client area to be visible on the DWM-drawn frame.
- DWMWA_CAPTION_BUTTON_BOUNDS, // [get] Bounds of the caption button area in window-relative space.
- DWMWA_NONCLIENT_RTL_LAYOUT, // [set] Is non-client content RTL mirrored
- DWMWA_FORCE_ICONIC_REPRESENTATION, // [set] Force this window to display iconic thumbnails.
- DWMWA_FLIP3D_POLICY, // [set] Designates how Flip3D will treat the window.
- DWMWA_EXTENDED_FRAME_BOUNDS, // [get] Gets the extended frame bounds rectangle in screen space
- DWMWA_HAS_ICONIC_BITMAP, // [set] Indicates an available bitmap when there is no better thumbnail representation.
- DWMWA_DISALLOW_PEEK, // [set] Don't invoke Peek on the window.
- DWMWA_EXCLUDED_FROM_PEEK, // [set] LivePreview exclusion information
- DWMWA_LAST
+ DWMWA_NCRENDERING_ENABLED = 1, // [get] Is non-client rendering enabled/disabled
+ DWMWA_NCRENDERING_POLICY, // [set] Non-client rendering policy
+ DWMWA_TRANSITIONS_FORCEDISABLED, // [set] Potentially enable/forcibly disable transitions
+ DWMWA_ALLOW_NCPAINT, // [set] Allow contents rendered in the non-client area to be visible on the DWM-drawn frame.
+ DWMWA_CAPTION_BUTTON_BOUNDS, // [get] Bounds of the caption button area in window-relative space.
+ DWMWA_NONCLIENT_RTL_LAYOUT, // [set] Is non-client content RTL mirrored
+ DWMWA_FORCE_ICONIC_REPRESENTATION, // [set] Force this window to display iconic thumbnails.
+ DWMWA_FLIP3D_POLICY, // [set] Designates how Flip3D will treat the window.
+ DWMWA_EXTENDED_FRAME_BOUNDS, // [get] Gets the extended frame bounds rectangle in screen space
+ DWMWA_HAS_ICONIC_BITMAP, // [set] Indicates an available bitmap when there is no better thumbnail representation.
+ DWMWA_DISALLOW_PEEK, // [set] Don't invoke Peek on the window.
+ DWMWA_EXCLUDED_FROM_PEEK, // [set] LivePreview exclusion information
+ DWMWA_LAST
};
#define DWM_TNP_RECTDESTINATION 0x00000001
@@ -178,50 +178,50 @@ enum DWMWINDOWATTRIBUTE
#ifndef BPPF_ERASE
- typedef enum _BP_BUFFERFORMAT
- {
- BPBF_COMPATIBLEBITMAP, // Compatible bitmap
- BPBF_DIB, // Device-independent bitmap
- BPBF_TOPDOWNDIB, // Top-down device-independent bitmap
- BPBF_TOPDOWNMONODIB // Top-down monochrome device-independent bitmap
- } BP_BUFFERFORMAT;
-
-
- typedef struct _BP_PAINTPARAMS
- {
- DWORD cbSize;
- DWORD dwFlags; // BPPF_ flags
- const RECT * prcExclude;
- const BLENDFUNCTION * pBlendFunction;
- } BP_PAINTPARAMS, *PBP_PAINTPARAMS;
-
- #define BPPF_ERASE 1
- #define BPPF_NOCLIP 2
- #define BPPF_NONCLIENT 4
+typedef enum _BP_BUFFERFORMAT
+{
+ BPBF_COMPATIBLEBITMAP, // Compatible bitmap
+ BPBF_DIB, // Device-independent bitmap
+ BPBF_TOPDOWNDIB, // Top-down device-independent bitmap
+ BPBF_TOPDOWNMONODIB // Top-down monochrome device-independent bitmap
+} BP_BUFFERFORMAT;
+
+
+typedef struct _BP_PAINTPARAMS
+{
+ DWORD cbSize;
+ DWORD dwFlags; // BPPF_ flags
+ const RECT * prcExclude;
+ const BLENDFUNCTION * pBlendFunction;
+} BP_PAINTPARAMS, *PBP_PAINTPARAMS;
+
+#define BPPF_ERASE 1
+#define BPPF_NOCLIP 2
+#define BPPF_NONCLIENT 4
#endif
#define DWM_BB_ENABLE 1
#ifndef LOCALE_SISO3166CTRYNAME2
- #define LOCALE_SISO3166CTRYNAME2 0x00000068 // 3 character ISO country name, eg "USA Vista+
- #define LOCALE_SISO639LANGNAME2 0x00000067 // 3 character ISO abbreviated language name, eg "eng"
+#define LOCALE_SISO3166CTRYNAME2 0x00000068 // 3 character ISO country name, eg "USA Vista+
+#define LOCALE_SISO639LANGNAME2 0x00000067 // 3 character ISO abbreviated language name, eg "eng"
#endif
#ifndef WM_DWMCOMPOSITIONCHANGED
- #define WM_DWMCOMPOSITIONCHANGED 0x031E
- #define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320
+#define WM_DWMCOMPOSITIONCHANGED 0x031E
+#define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320
#endif
#ifndef WM_DWMSENDICONICTHUMBNAIL
- #define WM_DWMSENDICONICTHUMBNAIL 0x0323
- #define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326
+#define WM_DWMSENDICONICTHUMBNAIL 0x0323
+#define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326
#endif
#if !defined(_WIN64) && !defined(_USE_32BIT_TIME_T)
- #define _USE_32BIT_TIME_T
+#define _USE_32BIT_TIME_T
#else
- #undef _USE_32BIT_TIME_T
+#undef _USE_32BIT_TIME_T
#endif
extern NEN_OPTIONS nen_options;
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp
index 1d81ddf80b..99f52c3f17 100644
--- a/plugins/TabSRMM/src/contactcache.cpp
+++ b/plugins/TabSRMM/src/contactcache.cpp
@@ -204,7 +204,7 @@ void CContactCache::updateStats(int iType, size_t value)
if (m_stats == 0)
allocStats();
- switch(iType) {
+ switch (iType) {
case TSessionStats::UPDATE_WITH_LAST_RCV:
if (!m_stats->lastReceivedChars)
break;
@@ -304,7 +304,8 @@ void CContactCache::saveHistory(WPARAM wParam, LPARAM)
iLength = HISTORY_INITIAL_ALLOCSIZE;
m_history[m_iHistoryTop].szText = (TCHAR*)mir_alloc(iLength);
m_history[m_iHistoryTop].lLen = iLength;
- } else {
+ }
+ else {
if (iLength > m_history[m_iHistoryTop].lLen) {
m_history[m_iHistoryTop].szText = (TCHAR*)mir_realloc(m_history[m_iHistoryTop].szText, iLength);
m_history[m_iHistoryTop].lLen = iLength;
@@ -336,7 +337,7 @@ void CContactCache::inputHistoryEvent(WPARAM wParam)
if (m_history != NULL && m_history[0].szText != NULL) { // at least one entry needs to be alloced, otherwise we get a nice infinite loop ;)
HWND hwndEdit = ::GetDlgItem(m_hwnd, IDC_MESSAGE);
- SETTEXTEX stx = {ST_DEFAULT, CP_UTF8};
+ SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 };
if (m_dat->dwFlags & MWF_NEEDHISTORYSAVE) {
m_iHistoryCurrent = m_iHistoryTop;
@@ -511,7 +512,7 @@ CContactCache* CContactCache::getContactCache(MCONTACT hContact)
*/
int CContactCache::cacheUpdateMetaChanged(WPARAM bMetaEnabled, LPARAM)
{
- for (int i=0; i < arContacts.getCount(); i++) {
+ for (int i = 0; i < arContacts.getCount(); i++) {
CContactCache &c = arContacts[i];
if (c.isMeta() && !bMetaEnabled) {
c.closeWindow();
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 481f1a9950..de77b7330f 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -47,7 +47,7 @@ static bool fForceOverlayIcons = false;
void TSAPI SetAeroMargins(TContainerData *pContainer)
{
- if(!pContainer)
+ if (!pContainer)
return;
if (!M.isAero() || CSkin::m_skinEnabled) {
@@ -133,7 +133,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
if (CSkin::m_frameSkins) {
- HDC dcFrame = GetDCEx(hwndDlg, 0, DCX_WINDOW|/*DCX_INTERSECTRGN|*/0x10000); // GetWindowDC(hwndDlg);
+ HDC dcFrame = GetDCEx(hwndDlg, 0, DCX_WINDOW |/*DCX_INTERSECTRGN|*/0x10000); // GetWindowDC(hwndDlg);
LONG clip_top, clip_left;
RECT rcText;
HDC dcMem = CreateCompatibleDC(pContainer->cachedDC ? pContainer->cachedDC : dcFrame);
@@ -164,7 +164,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
CSkinItem *item = pContainer->ncActive ? &SkinItems[ID_EXTBKFRAME] : &SkinItems[ID_EXTBKFRAMEINACTIVE];
CSkin::DrawItem(dcMem, &rcWindow, item);
-
+
TCHAR szWindowText[512];
GetWindowText(hwndDlg, szWindowText, SIZEOF(szWindowText));
szWindowText[511] = 0;
@@ -172,7 +172,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
GetTextMetrics(dcMem, &tm);
SetTextColor(dcMem, CInfoPanel::m_ipConfig.clrs[IPFONTCOUNT - 1]);
SetBkMode(dcMem, TRANSPARENT);
- rcText.left =20 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff;//26;
+ rcText.left = 20 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff;//26;
rcText.right = rcWindow.right - 3 * CSkin::m_titleBarButtonSize.cx - 11 - CSkin::m_titleBarRightOff;
rcText.top = CSkin::m_captionOffset + CSkin::m_bClipBorder;
rcText.bottom = rcText.top + tm.tmHeight;
@@ -201,7 +201,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
item_hot = &SkinItems[ID_EXTBKTITLEBUTTONMOUSEOVER];
item_pressed = &SkinItems[ID_EXTBKTITLEBUTTONPRESSED];
- for (i=0; i < 3; i++) {
+ for (i = 0; i < 3; i++) {
RECT *rc = 0;
HICON hIcon = 0;
@@ -269,7 +269,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
BitBlt(hdcReal, 0, 0, width, height, pContainer->cachedDC, 0, 0, SRCCOPY);
EndPaint(hwndDlg, &ps);
return 0;
- }
+ }
case WM_NCLBUTTONDOWN:
case WM_NCLBUTTONUP:
case WM_NCMOUSEHOVER:
@@ -325,7 +325,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
else if (isClose)
PostMessage(hwndDlg, WM_SYSCOMMAND, SC_CLOSE, 0);
}
- for (i=0; i < 3; i++) {
+ for (i = 0; i < 3; i++) {
if (pContainer->buttons[i].isHot != pContainer->oldbuttons[i].isHot) {
RECT *rc = 0;
HICON hIcon = 0;
@@ -409,42 +409,42 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case WM_NCHITTEST:
- {
- RECT r;
- POINT pt;
- int clip = CSkin::m_bClipBorder;
+ {
+ RECT r;
+ POINT pt;
+ int clip = CSkin::m_bClipBorder;
- if (!pContainer)
- break;
+ if (!pContainer)
+ break;
- if (!(pContainer->dwFlags & CNT_NOTITLE))
- break;
+ if (!(pContainer->dwFlags & CNT_NOTITLE))
+ break;
- GetWindowRect(hwndDlg, &r);
- GetCursorPos(&pt);
- if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6) {
- if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
- return HTBOTTOM;
- if (pt.x < r.left + clip + 10)
- return HTBOTTOMLEFT;
- if (pt.x > r.right - clip - 10)
- return HTBOTTOMRIGHT;
-
- }
- else if (pt.y >= r.top && pt.y <= r.top + 6) {
- if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
- return HTTOP;
- if (pt.x < r.left + clip + 10)
- return HTTOPLEFT;
- if (pt.x > r.right - clip - 10)
- return HTTOPRIGHT;
- }
- else if (pt.x >= r.left && pt.x <= r.left + clip + 6)
- return HTLEFT;
- else if (pt.x >= r.right - clip - 6 && pt.x <= r.right)
- return HTRIGHT;
- }
- return(DefWindowProc(hwndDlg, WM_NCHITTEST, wParam, lParam));
+ GetWindowRect(hwndDlg, &r);
+ GetCursorPos(&pt);
+ if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6) {
+ if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
+ return HTBOTTOM;
+ if (pt.x < r.left + clip + 10)
+ return HTBOTTOMLEFT;
+ if (pt.x > r.right - clip - 10)
+ return HTBOTTOMRIGHT;
+
+ }
+ else if (pt.y >= r.top && pt.y <= r.top + 6) {
+ if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
+ return HTTOP;
+ if (pt.x < r.left + clip + 10)
+ return HTTOPLEFT;
+ if (pt.x > r.right - clip - 10)
+ return HTTOPRIGHT;
+ }
+ else if (pt.x >= r.left && pt.x <= r.left + clip + 6)
+ return HTLEFT;
+ else if (pt.x >= r.right - clip - 6 && pt.x <= r.right)
+ return HTRIGHT;
+ }
+ return(DefWindowProc(hwndDlg, WM_NCHITTEST, wParam, lParam));
case 0xae: // must be some undocumented message - seems it messes with the title bar...
if (CSkin::m_frameSkins)
@@ -472,7 +472,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
fForceOverlayIcons = M.GetByte("forceTaskBarStatusOverlays", 0) ? true : false;
pContainer = (TContainerData*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pContainer);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pContainer);
mir_subclassWindow(hwndDlg, ContainerWndProc);
pContainer->hwnd = hwndDlg;
@@ -553,7 +553,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
// 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);
@@ -563,7 +563,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
else pContainer->hwndTip = 0;
if (pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
- WINDOWPLACEMENT wp = {0};
+ WINDOWPLACEMENT wp = { 0 };
wp.length = sizeof(wp);
SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) & ~WS_VISIBLE);
@@ -584,7 +584,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
// prevent ugly back background being visible while tabbed clients are created
if (M.isAero()) {
- MARGINS m = {-1};
+ MARGINS m = { -1 };
CMimAPI::m_pfnDwmExtendFrameIntoClientArea(hwndDlg, &m);
}
return TRUE;
@@ -623,7 +623,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
pContainer->dwFlags |= CNT_DEFERREDSIZEREQUEST;
else {
RECT rcClient, rcUnadjusted;
- TCITEM item = {0};
+ TCITEM item = { 0 };
GetClientRect(hwndDlg, &rcClient);
pContainer->MenuBar->getClientRect();
@@ -650,15 +650,15 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
LONG sbarWidth_left = pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT ? sbarWidth : 0;
if (lParam) {
- DWORD dwSWPFlags = SWP_NOACTIVATE|SWP_NOZORDER |SWP_DEFERERASE | SWP_NOCOPYBITS; // | SWP_NOSENDCHANGING | SWP_ASYNCWINDOWPOS;
+ 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),
@@ -678,12 +678,12 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
// just queues a resize request)
int nCount = TabCtrl_GetItemCount(hwndTab);
- for (int i=0; i < nCount; i++) {
+ for (int i = 0; i < nCount; i++) {
item.mask = TCIF_PARAM;
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);
@@ -696,7 +696,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!M.isAero()) { // aero mode uses buffered paint, no forced redraw needed
RedrawWindow(hwndTab, NULL, NULL, RDW_INVALIDATE | (pContainer->bSizingLoop ? RDW_ERASE : 0));
- RedrawWindow(hwndDlg, NULL, NULL, (bSkinned ? RDW_FRAME : 0) | RDW_INVALIDATE | ((pContainer->bSizingLoop || wParam == SIZE_RESTORED ) ? RDW_ERASE : 0));
+ RedrawWindow(hwndDlg, NULL, NULL, (bSkinned ? RDW_FRAME : 0) | RDW_INVALIDATE | ((pContainer->bSizingLoop || wParam == SIZE_RESTORED) ? RDW_ERASE : 0));
}
if (pContainer->hwndStatus)
@@ -711,7 +711,7 @@ 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);
@@ -748,7 +748,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
return FALSE;
}
else nPanel = nm->dwItemSpec;
-panel_found:
+ panel_found:
if (nPanel == 2) {
TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
@@ -762,7 +762,7 @@ panel_found:
SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
if (hContact) {
int iSel = 0;
- HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, 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), hContact);
@@ -793,186 +793,186 @@ panel_found:
SendMessage(hwndTab, EM_VALIDATEBOTTOM, 0, 0);
return 0;
- // tooltips
+ // tooltips
case NM_RCLICK:
- {
- int iItem;
- bool fFromSidebar = false;
- TCITEM item = { 0 };
- TWindowData *dat = 0;
+ {
+ int iItem;
+ bool fFromSidebar = false;
+ TCITEM item = { 0 };
+ TWindowData *dat = 0;
- POINT pt, pt1;
- GetCursorPos(&pt);
- pt1 = pt;
- HMENU subMenu = GetSubMenu(pContainer->hMenuContext, 0);
+ POINT pt, pt1;
+ GetCursorPos(&pt);
+ pt1 = pt;
+ HMENU subMenu = GetSubMenu(pContainer->hMenuContext, 0);
- if (((LPNMHDR)lParam)->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 = (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;
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, iItem, &item);
+ if (item.lParam && IsWindow((HWND)item.lParam))
+ dat = (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);
+
+ int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt1.x, pt1.y, 0, hwndDlg, NULL);
+ if (iSelection >= IDM_CONTAINERMENU) {
+ char szIndex[10];
+ itoa(iSelection - IDM_CONTAINERMENU, szIndex, 10);
+ if (iSelection - IDM_CONTAINERMENU >= 0) {
+ ptrT tszName(db_get_tsa(NULL, CONTAINER_KEY, szIndex));
+ if (tszName != NULL)
+ SendMessage((HWND)item.lParam, DM_CONTAINERSELECTED, 0, tszName);
}
-
- if (dat)
- MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
-
- int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt1.x, pt1.y, 0, hwndDlg, NULL);
- if (iSelection >= IDM_CONTAINERMENU) {
- char szIndex[10];
- itoa(iSelection - IDM_CONTAINERMENU, szIndex, 10);
- if (iSelection - IDM_CONTAINERMENU >= 0) {
- ptrT tszName(db_get_tsa(NULL, CONTAINER_KEY, szIndex));
- if (tszName != NULL)
- SendMessage((HWND)item.lParam, DM_CONTAINERSELECTED, 0, tszName);
+ 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:
+ db_set_dw(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 = dat->si;
+ if (si && dat->hContact) {
+ char *szProto = GetContactProto(dat->hContact);
+ if (szProto)
+ CallProtoService(szProto, PS_LEAVECHAT, dat->hContact, 0);
}
- 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:
- db_set_dw(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 = dat->si;
- if (si && dat->hContact) {
- char *szProto = GetContactProto(dat->hContact);
- if (szProto)
- CallProtoService( szProto, PS_LEAVECHAT, dat->hContact, 0 );
- }
- }
- break;
- case ID_TABMENU_ATTACHTOCONTAINER:
- if ((iItem = GetTabItemFromMouse(hwndTab, &pt1)) == -1)
- break;
- memset(&item, 0, 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;
+ case ID_TABMENU_ATTACHTOCONTAINER:
+ if ((iItem = GetTabItemFromMouse(hwndTab, &pt1)) == -1)
break;
- }
- InvalidateRect(hwndTab, NULL, FALSE);
- return 1;
+ memset(&item, 0, 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 WM_COMMAND:
- {
- bool fProcessContactMenu = pContainer->MenuBar->isContactMenu();
- bool fProcessMainMenu = pContainer->MenuBar->isMainMenu();
- pContainer->MenuBar->Cancel();
-
- MCONTACT hContact;
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- DWORD dwOldFlags = pContainer->dwFlags;
-
- if (dat) {
- if (fProcessContactMenu)
- return(CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact));
- else if (fProcessMainMenu) {
- return(CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_MAINMENU), 0));
- }
- else if (MsgWindowMenuHandler(dat, LOWORD(wParam), MENU_PICMENU) == 1)
- break;
- }
- SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- if (LOWORD(wParam) == IDC_TBFIRSTUID - 1)
+ {
+ bool fProcessContactMenu = pContainer->MenuBar->isContactMenu();
+ bool fProcessMainMenu = pContainer->MenuBar->isMainMenu();
+ pContainer->MenuBar->Cancel();
+
+ MCONTACT hContact;
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ DWORD dwOldFlags = pContainer->dwFlags;
+
+ if (dat) {
+ if (fProcessContactMenu)
+ return(CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact));
+ else if (fProcessMainMenu) {
+ return(CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_MAINMENU), 0));
+ }
+ else if (MsgWindowMenuHandler(dat, LOWORD(wParam), MENU_PICMENU) == 1)
break;
+ }
+ SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ if (LOWORD(wParam) == IDC_TBFIRSTUID - 1)
+ break;
- switch (LOWORD(wParam)) {
- case IDC_TOGGLESIDEBAR:
- {
- RECT rc;
- GetWindowRect(hwndDlg, &rc);
-
- LONG dwNewLeft;
- bool fVisible = pContainer->SideBar->isVisible();
- if (fVisible) {
- dwNewLeft = pContainer->SideBar->getWidth();
- pContainer->SideBar->setVisible(false);
- }
- else {
- pContainer->SideBar->setVisible(true);
- dwNewLeft = -(pContainer->SideBar->getWidth());
- }
-
- pContainer->preSIZE.cx = pContainer->preSIZE.cy = 0;
- pContainer->oldDCSize.cx = pContainer->oldDCSize.cy = 0;
+ switch (LOWORD(wParam)) {
+ case IDC_TOGGLESIDEBAR:
+ {
+ RECT rc;
+ GetWindowRect(hwndDlg, &rc);
- PostMessage(hwndDlg, WM_SIZE, 0, 1);
- }
- break;
+ LONG dwNewLeft;
+ bool fVisible = pContainer->SideBar->isVisible();
+ if (fVisible) {
+ dwNewLeft = pContainer->SideBar->getWidth();
+ pContainer->SideBar->setVisible(false);
+ }
+ else {
+ pContainer->SideBar->setVisible(true);
+ dwNewLeft = -(pContainer->SideBar->getWidth());
+ }
- case IDC_SIDEBARDOWN:
- case IDC_SIDEBARUP:
- {
- HWND hwnd = GetFocus();
- pContainer->SideBar->processScrollerButtons(LOWORD(wParam));
- SetFocus(hwnd);
- }
- break;
+ pContainer->preSIZE.cx = pContainer->preSIZE.cy = 0;
+ pContainer->oldDCSize.cx = pContainer->oldDCSize.cy = 0;
- default:
- Utils::CmdDispatcher(Utils::CMD_CONTAINER, hwndDlg, LOWORD(wParam), wParam, lParam, 0, pContainer);
- }
- if (pContainer->dwFlags != dwOldFlags)
- SendMessage(hwndDlg, DM_CONFIGURECONTAINER, 0, 0);
+ PostMessage(hwndDlg, WM_SIZE, 0, 1);
}
break;
- case WM_ENTERSIZEMOVE:
+ case IDC_SIDEBARDOWN:
+ case IDC_SIDEBARUP:
{
- RECT rc;
- 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;
+ HWND hwnd = GetFocus();
+ pContainer->SideBar->processScrollerButtons(LOWORD(wParam));
+ SetFocus(hwnd);
}
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:
+ {
+ RECT rc;
+ 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;
- 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);
- DM_ScrollToBottom(dat, 0, 0);
- SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);
- }
- pContainer->bSizingLoop = FALSE;
+ {
+ 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);
+ DM_ScrollToBottom(dat, 0, 0);
+ SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);
}
- break;
+ pContainer->bSizingLoop = FALSE;
+ }
+ break;
// determine minimum and maximum size limits
// 1) for maximizing the window when the "vertical maximize" option is set
@@ -980,107 +980,107 @@ panel_found:
// (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;
- mmi->ptMinTrackSize.x = 275;
- mmi->ptMinTrackSize.y = 130;
- GetClientRect(GetDlgItem(hwndDlg, IDC_MSGTABS), &rc);
- if (pContainer->hwndActive) // at container creation time, there is no hwndActive yet..
- GetClientRect(pContainer->hwndActive, &rcClient);
- GetWindowRect(hwndDlg, &rcWindow);
- 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
- if (pContainer->hwndActive)
- mmi->ptMinTrackSize.y = pContainer->uChildMinHeight + (pContainer->hwndActive ? ((rcWindow.bottom - rcWindow.top) - rcClient.bottom) : 0);
-
- if (pContainer->dwFlags & CNT_VERTICALMAX || (GetKeyState(VK_CONTROL) & 0x8000)) {
- RECT rcDesktop = {0};
- BOOL fDesktopValid = FALSE;
- int monitorXOffset = 0;
- WINDOWPLACEMENT wp = {0};
-
- HMONITOR hMonitor = MonitorFromWindow(hwndDlg, 2);
- if (hMonitor) {
- MONITORINFO mi = { 0 };
- mi.cbSize = sizeof(mi);
- GetMonitorInfoA(hMonitor, &mi);
- rcDesktop = mi.rcWork;
- OffsetRect(&rcDesktop, -mi.rcMonitor.left, -mi.rcMonitor.top);
- monitorXOffset = mi.rcMonitor.left;
- fDesktopValid = TRUE;
- }
- if (!fDesktopValid)
- SystemParametersInfo(SPI_GETWORKAREA, 0, &rcDesktop, 0);
-
- wp.length = sizeof(wp);
- GetWindowPlacement(hwndDlg, &wp);
- mmi->ptMaxSize.y = rcDesktop.bottom - rcDesktop.top;
- mmi->ptMaxSize.x = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
- mmi->ptMaxPosition.x = wp.rcNormalPosition.left - monitorXOffset;
- mmi->ptMaxPosition.y = 0;
- if (IsIconic(hwndDlg)) {
- mmi->ptMaxPosition.x += rcDesktop.left;
- mmi->ptMaxPosition.y += rcDesktop.top;
- }
-
- // protect against invalid values...
- if (mmi->ptMinTrackSize.y < 50 || mmi->ptMinTrackSize.y > rcDesktop.bottom)
- mmi->ptMinTrackSize.y = 130;
- }
+ {
+ RECT rc, rcWindow, rcClient = { 0 };
+ POINT pt;
+
+ MINMAXINFO *mmi = (MINMAXINFO *)lParam;
+ mmi->ptMinTrackSize.x = 275;
+ mmi->ptMinTrackSize.y = 130;
+ GetClientRect(GetDlgItem(hwndDlg, IDC_MSGTABS), &rc);
+ if (pContainer->hwndActive) // at container creation time, there is no hwndActive yet..
+ GetClientRect(pContainer->hwndActive, &rcClient);
+ GetWindowRect(hwndDlg, &rcWindow);
+ 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
+ if (pContainer->hwndActive)
+ mmi->ptMinTrackSize.y = pContainer->uChildMinHeight + (pContainer->hwndActive ? ((rcWindow.bottom - rcWindow.top) - rcClient.bottom) : 0);
+
+ if (pContainer->dwFlags & CNT_VERTICALMAX || (GetKeyState(VK_CONTROL) & 0x8000)) {
+ RECT rcDesktop = { 0 };
+ BOOL fDesktopValid = FALSE;
+ int monitorXOffset = 0;
+ WINDOWPLACEMENT wp = { 0 };
+
+ HMONITOR hMonitor = MonitorFromWindow(hwndDlg, 2);
+ if (hMonitor) {
+ MONITORINFO mi = { 0 };
+ mi.cbSize = sizeof(mi);
+ GetMonitorInfoA(hMonitor, &mi);
+ rcDesktop = mi.rcWork;
+ OffsetRect(&rcDesktop, -mi.rcMonitor.left, -mi.rcMonitor.top);
+ monitorXOffset = mi.rcMonitor.left;
+ fDesktopValid = TRUE;
+ }
+ if (!fDesktopValid)
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &rcDesktop, 0);
+
+ wp.length = sizeof(wp);
+ GetWindowPlacement(hwndDlg, &wp);
+ mmi->ptMaxSize.y = rcDesktop.bottom - rcDesktop.top;
+ mmi->ptMaxSize.x = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
+ mmi->ptMaxPosition.x = wp.rcNormalPosition.left - monitorXOffset;
+ mmi->ptMaxPosition.y = 0;
+ if (IsIconic(hwndDlg)) {
+ mmi->ptMaxPosition.x += rcDesktop.left;
+ mmi->ptMaxPosition.y += rcDesktop.top;
+ }
+
+ // protect against invalid values...
+ if (mmi->ptMinTrackSize.y < 50 || mmi->ptMinTrackSize.y > rcDesktop.bottom)
+ mmi->ptMinTrackSize.y = 130;
}
- return 0;
+ }
+ return 0;
case DM_UPDATETITLE:
- {
- MCONTACT hContact = 0;
- TWindowData *dat = NULL;
-
- if (lParam) { // lParam != 0 means sent by a chat window
- TCHAR szText[512];
- dat = (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;
- }
- if (wParam == 0) { // no hContact given - obtain the hContact for the active tab
- if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
- SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- else
- break;
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- }
- else {
- HWND hwnd = M.FindWindow(wParam);
- if (hwnd == 0) {
- SESSION_INFO *si = SM_FindSessionByHCONTACT(wParam);
- if (si) {
- SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0);
- return 0;
- }
+ {
+ MCONTACT hContact = 0;
+ TWindowData *dat = NULL;
+
+ if (lParam) { // lParam != 0 means sent by a chat window
+ TCHAR szText[512];
+ dat = (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;
+ }
+ if (wParam == 0) { // no hContact given - obtain the hContact for the active tab
+ if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
+ SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ else
+ break;
+ dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ }
+ else {
+ HWND hwnd = M.FindWindow(wParam);
+ if (hwnd == 0) {
+ SESSION_INFO *si = SM_FindSessionByHCONTACT(wParam);
+ if (si) {
+ SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0);
+ return 0;
}
- hContact = wParam;
- if (hwnd && hContact)
- dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
}
- if (dat) {
- SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabStatusIcon));
- TCHAR *szNewTitle = Utils::FormatTitleBar(dat, pContainer->settings->szTitleFormat);
- if (szNewTitle) {
- SetWindowText(hwndDlg, szNewTitle);
- mir_free(szNewTitle);
- }
+ hContact = wParam;
+ if (hwnd && hContact)
+ dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ }
+ if (dat) {
+ SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabStatusIcon));
+ TCHAR *szNewTitle = Utils::FormatTitleBar(dat, pContainer->settings->szTitleFormat);
+ if (szNewTitle) {
+ SetWindowText(hwndDlg, szNewTitle);
+ mir_free(szNewTitle);
}
}
- return 0;
+ }
+ return 0;
case WM_TIMER:
if (wParam == TIMERID_HEARTBEAT) {
@@ -1197,7 +1197,7 @@ panel_found:
}
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;
@@ -1279,26 +1279,26 @@ panel_found:
break;
case DM_CLOSETABATMOUSE:
- {
- HWND hwndCurrent = pContainer->hwndActive;
- POINT *pt = (POINT *)lParam;
- if ((iItem = GetTabItemFromMouse(hwndTab, pt)) == -1)
- break;
+ {
+ HWND hwndCurrent = pContainer->hwndActive;
+ POINT *pt = (POINT *)lParam;
+ if ((iItem = GetTabItemFromMouse(hwndTab, pt)) == -1)
+ break;
- TCITEM item = {0};
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, iItem, &item);
- if (item.lParam) {
- if ((HWND)item.lParam != hwndCurrent) {
- pContainer->bDontSmartClose = TRUE;
- SendMessage((HWND)item.lParam, WM_CLOSE, 0, 1);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
- pContainer->bDontSmartClose = FALSE;
- }
- else SendMessage((HWND)item.lParam, WM_CLOSE, 0, 1);
- }
+ TCITEM item = { 0 };
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, iItem, &item);
+ if (item.lParam) {
+ if ((HWND)item.lParam != hwndCurrent) {
+ pContainer->bDontSmartClose = TRUE;
+ SendMessage((HWND)item.lParam, WM_CLOSE, 0, 1);
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ pContainer->bDontSmartClose = FALSE;
+ }
+ else SendMessage((HWND)item.lParam, WM_CLOSE, 0, 1);
}
- break;
+ }
+ break;
case WM_PAINT:
if (bSkinned || M.isAero()) {
@@ -1346,50 +1346,50 @@ panel_found:
break;
case DM_OPTIONSAPPLIED:
- {
- char szCname[40];
- TCHAR szTitleFormat[200];
- TCHAR* szThemeName = NULL;
- DBVARIANT dbv = {0};
+ {
+ char szCname[40];
+ TCHAR szTitleFormat[200];
+ TCHAR* szThemeName = NULL;
+ DBVARIANT dbv = { 0 };
- szTitleFormat[0] = 0;
+ szTitleFormat[0] = 0;
- if (pContainer->isCloned && pContainer->hContactFrom != 0) {
- pContainer->settings = &PluginConfig.globalContainerSettings;
+ if (pContainer->isCloned && pContainer->hContactFrom != 0) {
+ pContainer->settings = &PluginConfig.globalContainerSettings;
- pContainer->szRelThemeFile[0] = pContainer->szAbsThemeFile[0] = 0;
- mir_snprintf(szCname, SIZEOF(szCname), "%s_theme", CONTAINER_PREFIX);
- if (!db_get_ts(pContainer->hContactFrom, SRMSGMOD_T, szCname, &dbv))
+ pContainer->szRelThemeFile[0] = pContainer->szAbsThemeFile[0] = 0;
+ mir_snprintf(szCname, SIZEOF(szCname), "%s_theme", CONTAINER_PREFIX);
+ if (!db_get_ts(pContainer->hContactFrom, SRMSGMOD_T, szCname, &dbv))
+ szThemeName = dbv.ptszVal;
+ }
+ else {
+ Utils::ReadPrivateContainerSettings(pContainer);
+ if (szThemeName == NULL) {
+ mir_snprintf(szCname, SIZEOF(szCname), "%s%d_theme", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ if (!db_get_ts(NULL, SRMSGMOD_T, szCname, &dbv))
szThemeName = dbv.ptszVal;
}
- else {
- Utils::ReadPrivateContainerSettings(pContainer);
- if (szThemeName == NULL) {
- mir_snprintf(szCname, SIZEOF(szCname), "%s%d_theme", CONTAINER_PREFIX, pContainer->iContainerIndex);
- if (!db_get_ts(NULL, SRMSGMOD_T, szCname, &dbv))
- szThemeName = dbv.ptszVal;
- }
- }
- Utils::SettingsToContainer(pContainer);
-
- if (szThemeName != NULL) {
- PathToAbsoluteT(szThemeName, pContainer->szAbsThemeFile, M.getDataPath());
- _tcsncpy_s(pContainer->szRelThemeFile, szThemeName, _TRUNCATE);
- db_free(&dbv);
- }
- else pContainer->szAbsThemeFile[0] = pContainer->szRelThemeFile[0] = 0;
+ }
+ Utils::SettingsToContainer(pContainer);
- pContainer->ltr_templates = pContainer->rtl_templates = 0;
+ if (szThemeName != NULL) {
+ PathToAbsoluteT(szThemeName, pContainer->szAbsThemeFile, M.getDataPath());
+ _tcsncpy_s(pContainer->szRelThemeFile, szThemeName, _TRUNCATE);
+ db_free(&dbv);
}
- break;
+ else pContainer->szAbsThemeFile[0] = pContainer->szRelThemeFile[0] = 0;
+
+ pContainer->ltr_templates = pContainer->rtl_templates = 0;
+ }
+ break;
case DM_STATUSBARCHANGED:
SendMessage(hwndDlg, WM_SIZE, 0, 0);
{
RECT rc;
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);
+ 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)
@@ -1397,247 +1397,247 @@ panel_found:
return 0;
case DM_CONFIGURECONTAINER:
- {
- DWORD ws, wsold, ex = 0, exold = 0;
- HMENU hSysmenu = GetSystemMenu(hwndDlg, FALSE);
- MCONTACT hContact = 0;
- UINT sBarHeight;
-
- 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;
- }
+ {
+ DWORD ws, wsold, ex = 0, exold = 0;
+ HMENU hSysmenu = GetSystemMenu(hwndDlg, FALSE);
+ MCONTACT hContact = 0;
+ UINT sBarHeight;
+
+ 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;
+ }
- SetWindowLongPtr(hwndDlg, GWL_STYLE, ws);
+ SetWindowLongPtr(hwndDlg, GWL_STYLE, ws);
- pContainer->tBorder = M.GetByte((bSkinned ? "S_tborder" : "tborder"), 2);
- pContainer->tBorder_outer_left = g_ButtonSet.left + M.GetByte((bSkinned ? "S_tborder_outer_left" : "tborder_outer_left"), 2);
- pContainer->tBorder_outer_right = g_ButtonSet.right + M.GetByte((bSkinned ? "S_tborder_outer_right" : "tborder_outer_right"), 2);
- pContainer->tBorder_outer_top = g_ButtonSet.top + M.GetByte((bSkinned ? "S_tborder_outer_top" : "tborder_outer_top"), 2);
- pContainer->tBorder_outer_bottom = g_ButtonSet.bottom + M.GetByte((bSkinned ? "S_tborder_outer_bottom" : "tborder_outer_bottom"), 2);
- sBarHeight = (UINT)M.GetByte((bSkinned ? "S_sbarheight" : "sbarheight"), 0);
+ pContainer->tBorder = M.GetByte((bSkinned ? "S_tborder" : "tborder"), 2);
+ pContainer->tBorder_outer_left = g_ButtonSet.left + M.GetByte((bSkinned ? "S_tborder_outer_left" : "tborder_outer_left"), 2);
+ pContainer->tBorder_outer_right = g_ButtonSet.right + M.GetByte((bSkinned ? "S_tborder_outer_right" : "tborder_outer_right"), 2);
+ pContainer->tBorder_outer_top = g_ButtonSet.top + M.GetByte((bSkinned ? "S_tborder_outer_top" : "tborder_outer_top"), 2);
+ pContainer->tBorder_outer_bottom = g_ButtonSet.bottom + M.GetByte((bSkinned ? "S_tborder_outer_bottom" : "tborder_outer_bottom"), 2);
+ sBarHeight = (UINT)M.GetByte((bSkinned ? "S_sbarheight" : "sbarheight"), 0);
- if (LOBYTE(LOWORD(GetVersion())) >= 5) {
- BOOL fTransAllowed = !bSkinned || PluginConfig.m_WinVerMajor >= 6;
+ if (LOBYTE(LOWORD(GetVersion())) >= 5) {
+ BOOL fTransAllowed = !bSkinned || PluginConfig.m_WinVerMajor >= 6;
- ex = exold = GetWindowLongPtr(hwndDlg, GWL_EXSTYLE);
- ex = (pContainer->dwFlags & CNT_TRANSPARENCY && (!CSkin::m_skinEnabled || fTransAllowed)) ? ex | WS_EX_LAYERED : ex & ~(WS_EX_LAYERED);
+ ex = exold = GetWindowLongPtr(hwndDlg, GWL_EXSTYLE);
+ ex = (pContainer->dwFlags & CNT_TRANSPARENCY && (!CSkin::m_skinEnabled || fTransAllowed)) ? ex | WS_EX_LAYERED : ex & ~(WS_EX_LAYERED);
- SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, ex);
- if (pContainer->dwFlags & CNT_TRANSPARENCY && fTransAllowed) {
- DWORD trans = LOWORD(pContainer->settings->dwTransparency);
- SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)trans, (/* pContainer->bSkinned ? LWA_COLORKEY : */ 0) | (pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
- }
+ SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, ex);
+ if (pContainer->dwFlags & CNT_TRANSPARENCY && fTransAllowed) {
+ DWORD trans = LOWORD(pContainer->settings->dwTransparency);
+ SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)trans, (/* pContainer->bSkinned ? LWA_COLORKEY : */ 0) | (pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
}
+ }
- if (!CSkin::m_frameSkins)
- CheckMenuItem(hSysmenu, IDM_NOTITLE, (pContainer->dwFlags & CNT_NOTITLE) ? MF_BYCOMMAND | MF_CHECKED : MF_BYCOMMAND | MF_UNCHECKED);
+ if (!CSkin::m_frameSkins)
+ CheckMenuItem(hSysmenu, IDM_NOTITLE, (pContainer->dwFlags & CNT_NOTITLE) ? MF_BYCOMMAND | MF_CHECKED : MF_BYCOMMAND | MF_UNCHECKED);
- CheckMenuItem(hSysmenu, IDM_STAYONTOP, pContainer->dwFlags & CNT_STICKY ? MF_BYCOMMAND | MF_CHECKED : MF_BYCOMMAND | MF_UNCHECKED);
- SetWindowPos(hwndDlg, (pContainer->dwFlags & CNT_STICKY) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
- if (ws != wsold) {
- RECT rc;
- GetWindowRect(hwndDlg, &rc);
- if ((ws & WS_CAPTION) != (wsold & WS_CAPTION)) {
- SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
- if (pContainer->hwndActive != 0) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- DM_ScrollToBottom(dat, 0, 0);
- }
+ CheckMenuItem(hSysmenu, IDM_STAYONTOP, pContainer->dwFlags & CNT_STICKY ? MF_BYCOMMAND | MF_CHECKED : MF_BYCOMMAND | MF_UNCHECKED);
+ SetWindowPos(hwndDlg, (pContainer->dwFlags & CNT_STICKY) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
+ if (ws != wsold) {
+ RECT rc;
+ GetWindowRect(hwndDlg, &rc);
+ if ((ws & WS_CAPTION) != (wsold & WS_CAPTION)) {
+ SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS);
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
+ if (pContainer->hwndActive != 0) {
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ DM_ScrollToBottom(dat, 0, 0);
}
}
+ }
- pContainer->dwFlags = ((pContainer->dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT)) ?
- pContainer->dwFlags | CNT_SIDEBAR : pContainer->dwFlags & ~CNT_SIDEBAR);
+ pContainer->dwFlags = ((pContainer->dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT)) ?
+ pContainer->dwFlags | CNT_SIDEBAR : pContainer->dwFlags & ~CNT_SIDEBAR);
- pContainer->SideBar->Init();
+ pContainer->SideBar->Init();
- ws = wsold = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_STYLE);
- if (pContainer->dwFlags & CNT_TABSBOTTOM)
- ws |= (TCS_BOTTOM);
- else
- ws &= ~(TCS_BOTTOM);
- if ((ws & (TCS_BOTTOM | TCS_MULTILINE)) != (wsold & (TCS_BOTTOM | TCS_MULTILINE))) {
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_STYLE, ws);
- RedrawWindow(GetDlgItem(hwndDlg, IDC_MSGTABS), NULL, NULL, RDW_INVALIDATE);
- }
-
- if (pContainer->dwFlags & CNT_NOSTATUSBAR) {
- if (pContainer->hwndStatus) {
- DestroyWindow(pContainer->hwndStatus);
- pContainer->hwndStatus = 0;
- pContainer->statusBarHeight = 0;
- SendMessage(hwndDlg, DM_STATUSBARCHANGED, 0, 0);
- }
- }
- else if (pContainer->hwndStatus == 0) {
- pContainer->hwndStatus = CreateWindowEx(0, _T("TSStatusBarClass"), NULL, SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL);
+ ws = wsold = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_STYLE);
+ if (pContainer->dwFlags & CNT_TABSBOTTOM)
+ ws |= (TCS_BOTTOM);
+ else
+ ws &= ~(TCS_BOTTOM);
+ if ((ws & (TCS_BOTTOM | TCS_MULTILINE)) != (wsold & (TCS_BOTTOM | TCS_MULTILINE))) {
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_STYLE, ws);
+ RedrawWindow(GetDlgItem(hwndDlg, IDC_MSGTABS), NULL, NULL, RDW_INVALIDATE);
+ }
- if (sBarHeight && bSkinned)
- SendMessage(pContainer->hwndStatus, SB_SETMINHEIGHT, sBarHeight, 0);
- }
- if (pContainer->hwndActive != 0) {
- hContact = 0;
- SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- if (hContact)
- SendMessage(hwndDlg, DM_UPDATETITLE, hContact, 0);
+ if (pContainer->dwFlags & CNT_NOSTATUSBAR) {
+ if (pContainer->hwndStatus) {
+ DestroyWindow(pContainer->hwndStatus);
+ pContainer->hwndStatus = 0;
+ pContainer->statusBarHeight = 0;
+ SendMessage(hwndDlg, DM_STATUSBARCHANGED, 0, 0);
}
- SendMessage(hwndDlg, WM_SIZE, 0, 1);
- BroadCastContainer(pContainer, DM_CONFIGURETOOLBAR, 0, 1);
}
- return 0;
+ else if (pContainer->hwndStatus == 0) {
+ pContainer->hwndStatus = CreateWindowEx(0, _T("TSStatusBarClass"), NULL, SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL);
- // 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 iItems = TabCtrl_GetItemCount(hwndTab);
- TCITEM item = {0};
+ if (sBarHeight && bSkinned)
+ SendMessage(pContainer->hwndStatus, SB_SETMINHEIGHT, sBarHeight, 0);
+ }
+ if (pContainer->hwndActive != 0) {
+ hContact = 0;
+ SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ if (hContact)
+ SendMessage(hwndDlg, DM_UPDATETITLE, hContact, 0);
+ }
+ SendMessage(hwndDlg, WM_SIZE, 0, 1);
+ BroadCastContainer(pContainer, DM_CONFIGURETOOLBAR, 0, 1);
+ }
+ return 0;
- DWORD dwTimestamp;
+ // 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 iItems = TabCtrl_GetItemCount(hwndTab);
+ TCITEM item = { 0 };
- RECENTINFO *ri = (RECENTINFO *)lParam;
- ri->iFirstIndex = ri->iMostRecent = -1;
- ri->dwFirst = ri->dwMostRecent = 0;
- ri->hwndFirst = ri->hwndMostRecent = 0;
+ DWORD dwTimestamp;
- for (int i=0; i < iItems; i++) {
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, i, &item);
- SendMessage((HWND)item.lParam, DM_QUERYLASTUNREAD, 0, (LPARAM)&dwTimestamp);
- if (dwTimestamp > ri->dwMostRecent) {
- ri->dwMostRecent = dwTimestamp;
- ri->iMostRecent = i;
- ri->hwndMostRecent = (HWND)item.lParam;
- if (ri->iFirstIndex == -1) {
- ri->iFirstIndex = i;
- ri->dwFirst = dwTimestamp;
- ri->hwndFirst = (HWND)item.lParam;
- }
+ RECENTINFO *ri = (RECENTINFO *)lParam;
+ ri->iFirstIndex = ri->iMostRecent = -1;
+ ri->dwFirst = ri->dwMostRecent = 0;
+ ri->hwndFirst = ri->hwndMostRecent = 0;
+
+ for (int i = 0; i < iItems; i++) {
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, i, &item);
+ SendMessage((HWND)item.lParam, DM_QUERYLASTUNREAD, 0, (LPARAM)&dwTimestamp);
+ if (dwTimestamp > ri->dwMostRecent) {
+ ri->dwMostRecent = dwTimestamp;
+ ri->iMostRecent = i;
+ ri->hwndMostRecent = (HWND)item.lParam;
+ if (ri->iFirstIndex == -1) {
+ ri->iFirstIndex = i;
+ ri->dwFirst = dwTimestamp;
+ ri->hwndFirst = (HWND)item.lParam;
}
}
}
- return 0;
+ }
+ return 0;
- // 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);
+ // 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;
+ NMHDR nmhdr;
+ nmhdr.code = TCN_SELCHANGE;
- if (wParam == DM_QUERY_NEXT && ri.iFirstIndex != -1) {
- TabCtrl_SetCurSel(hwndTab, ri.iFirstIndex);
- SendMessage(hwndDlg, WM_NOTIFY, 0, (LPARAM)&nmhdr);
- }
- if (wParam == DM_QUERY_MOSTRECENT && ri.iMostRecent != -1) {
- TabCtrl_SetCurSel(hwndTab, ri.iMostRecent);
- SendMessage(hwndDlg, WM_NOTIFY, 0, (LPARAM)&nmhdr);
- }
+ if (wParam == DM_QUERY_NEXT && ri.iFirstIndex != -1) {
+ TabCtrl_SetCurSel(hwndTab, ri.iFirstIndex);
+ SendMessage(hwndDlg, WM_NOTIFY, 0, (LPARAM)&nmhdr);
}
- return 0;
+ if (wParam == DM_QUERY_MOSTRECENT && ri.iMostRecent != -1) {
+ TabCtrl_SetCurSel(hwndTab, ri.iMostRecent);
+ SendMessage(hwndDlg, WM_NOTIFY, 0, (LPARAM)&nmhdr);
+ }
+ }
+ return 0;
case DM_SETICON:
- {
- TWindowData *dat = (TWindowData*)wParam;
- HICON hIconMsg = PluginConfig.g_IconMsgEvent;
- HICON hIconBig = (dat && dat->cache) ? LoadSkinnedProtoIconBig(dat->cache->getProto(), dat->cache->getStatus()) : 0;
-
- if (Win7Taskbar->haveLargeIcons()) {
- if ((HICON)lParam == PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING] || (HICON)lParam == hIconMsg) {
- Win7Taskbar->setOverlayIcon(hwndDlg, lParam);
- if (GetForegroundWindow() != hwndDlg)
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, lParam);
- if ((HICON)lParam == hIconMsg)
- pContainer->hIconTaskbarOverlay = hIconMsg;
- break;
- }
-
- if (dat) {
- if (dat->hTaskbarIcon == 0)
- dat->hTaskbarIcon = ((dat->pContainer->dwFlags & CNT_AVATARSONTASKBAR) ? Utils::iconFromAvatar(dat) : 0);
- else {
- if (!(dat->pContainer->dwFlags & CNT_AVATARSONTASKBAR)) {
- DestroyIcon(dat->hTaskbarIcon);
- dat->hTaskbarIcon = 0;
- }
- }
+ {
+ TWindowData *dat = (TWindowData*)wParam;
+ HICON hIconMsg = PluginConfig.g_IconMsgEvent;
+ HICON hIconBig = (dat && dat->cache) ? LoadSkinnedProtoIconBig(dat->cache->getProto(), dat->cache->getStatus()) : 0;
+
+ if (Win7Taskbar->haveLargeIcons()) {
+ if ((HICON)lParam == PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING] || (HICON)lParam == hIconMsg) {
+ Win7Taskbar->setOverlayIcon(hwndDlg, lParam);
+ if (GetForegroundWindow() != hwndDlg)
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, lParam);
+ if ((HICON)lParam == hIconMsg)
+ pContainer->hIconTaskbarOverlay = hIconMsg;
+ break;
+ }
- if (dat->hTaskbarIcon) {
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)dat->hTaskbarIcon);
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, lParam);
- Win7Taskbar->setOverlayIcon(hwndDlg, (LPARAM)(dat->hTabIcon ? (LPARAM)dat->hTabIcon : lParam));
- }
- else {
- if (0 == hIconBig || (HICON)CALLSERVICE_NOTFOUND == hIconBig)
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)lParam);
- else
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIconBig);
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, lParam);
- if (dat->pContainer->hIconTaskbarOverlay)
- Win7Taskbar->setOverlayIcon(hwndDlg, (LPARAM)dat->pContainer->hIconTaskbarOverlay);
- else if (Win7Taskbar->haveAlwaysGroupingMode() && fForceOverlayIcons)
- Win7Taskbar->setOverlayIcon(hwndDlg, lParam);
- else
- Win7Taskbar->clearOverlayIcon(hwndDlg);
+ if (dat) {
+ if (dat->hTaskbarIcon == 0)
+ dat->hTaskbarIcon = ((dat->pContainer->dwFlags & CNT_AVATARSONTASKBAR) ? Utils::iconFromAvatar(dat) : 0);
+ else {
+ if (!(dat->pContainer->dwFlags & CNT_AVATARSONTASKBAR)) {
+ DestroyIcon(dat->hTaskbarIcon);
+ dat->hTaskbarIcon = 0;
}
- return 0;
}
- }
- // 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);
- break;
+ if (dat->hTaskbarIcon) {
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)dat->hTaskbarIcon);
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, lParam);
+ Win7Taskbar->setOverlayIcon(hwndDlg, (LPARAM)(dat->hTabIcon ? (LPARAM)dat->hTabIcon : lParam));
+ }
+ else {
+ if (0 == hIconBig || (HICON)CALLSERVICE_NOTFOUND == hIconBig)
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)lParam);
+ else
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIconBig);
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, lParam);
+ if (dat->pContainer->hIconTaskbarOverlay)
+ Win7Taskbar->setOverlayIcon(hwndDlg, (LPARAM)dat->pContainer->hIconTaskbarOverlay);
+ else if (Win7Taskbar->haveAlwaysGroupingMode() && fForceOverlayIcons)
+ Win7Taskbar->setOverlayIcon(hwndDlg, lParam);
+ else
+ Win7Taskbar->clearOverlayIcon(hwndDlg);
+ }
+ return 0;
}
- if (reinterpret_cast<HICON>(lParam) == hIconMsg)
- hIconBig = LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE);
+ }
- if (pContainer->hIcon == STICK_ICON_MSG && (HICON)lParam != hIconMsg && pContainer->dwFlags & CNT_NEED_UPDATETITLE) {
- lParam = (LPARAM)hIconMsg;
- hIconBig = LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE);
- }
+ // 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);
- if (0 != hIconBig && reinterpret_cast<HICON>(CALLSERVICE_NOTFOUND) != hIconBig)
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, LPARAM(hIconBig));
- pContainer->hIcon = (lParam == (LPARAM)hIconMsg) ? STICK_ICON_MSG : 0;
+ break;
}
- return 0;
+ if (reinterpret_cast<HICON>(lParam) == hIconMsg)
+ hIconBig = LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE);
+
+ if (pContainer->hIcon == STICK_ICON_MSG && (HICON)lParam != hIconMsg && pContainer->dwFlags & CNT_NEED_UPDATETITLE) {
+ lParam = (LPARAM)hIconMsg;
+ hIconBig = LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE);
+ }
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, lParam);
+ if (0 != hIconBig && reinterpret_cast<HICON>(CALLSERVICE_NOTFOUND) != hIconBig)
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, LPARAM(hIconBig));
+ pContainer->hIcon = (lParam == (LPARAM)hIconMsg) ? STICK_ICON_MSG : 0;
+ }
+ return 0;
case WM_DRAWITEM:
- {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
- if (dis->hwndItem == pContainer->hwndStatus && !(pContainer->dwFlags & CNT_NOSTATUSBAR)) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- if (dat)
- DrawStatusIcons(dat, dis->hDC, dis->rcItem, 2);
- return TRUE;
- }
+ {
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
+ if (dis->hwndItem == pContainer->hwndStatus && !(pContainer->dwFlags & CNT_NOSTATUSBAR)) {
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ if (dat)
+ DrawStatusIcons(dat, dis->hDC, dis->rcItem, 2);
+ return TRUE;
}
- return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+ }
+ 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))
- GetClientRect(hwndDlg, rc);
- else
- CopyRect(rc, &pContainer->rcSaved);
- AdjustTabClientRect(pContainer, rc);
- }
+ {
+ RECT *rc = (RECT *)lParam;
+ if (rc) {
+ if (!IsIconic(hwndDlg))
+ GetClientRect(hwndDlg, rc);
+ else
+ CopyRect(rc, &pContainer->rcSaved);
+ AdjustTabClientRect(pContainer, rc);
}
- return 0;
+ }
+ return 0;
case WM_DESTROY:
pContainer->hwnd = 0;
@@ -1759,10 +1759,10 @@ panel_found:
// clear temp flags which should NEVER be saved...
if (pContainer->isCloned && pContainer->hContactFrom != 0) {
- TCITEM item = {0};
+ TCITEM item = { 0 };
item.mask = TCIF_PARAM;
pContainer->dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED);
- for (int i=0; i < TabCtrl_GetItemCount(hwndTab); i++) {
+ for (int i = 0; i < TabCtrl_GetItemCount(hwndTab); i++) {
if (TabCtrl_GetItem(hwndTab, i, &item)) {
MCONTACT hContact;
SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
@@ -1871,7 +1871,7 @@ int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd)
TCITEM item = { 0 };
item.mask = TCIF_PARAM;
- for (int i=0; i < iItems; i++) {
+ for (int i = 0; i < iItems; i++) {
TabCtrl_GetItem(hwndTab, i, &item);
if ((HWND)item.lParam == hwnd)
return i;
@@ -1896,7 +1896,7 @@ HWND TSAPI GetHWNDFromTabIndex(HWND hwndTab, int idx)
TCITEM item = { 0 };
item.mask = TCIF_PARAM;
- for (int i=0; i < iItems; i++) {
+ for (int i = 0; i < iItems; i++) {
TabCtrl_GetItem(hwndTab, i, &item);
if (i == idx)
return (HWND)item.lParam;
@@ -1938,7 +1938,7 @@ 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; ) {
+ 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);
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp
index b8dd0df52e..7e1d1ba039 100644
--- a/plugins/TabSRMM/src/containeroptions.cpp
+++ b/plugins/TabSRMM/src/containeroptions.cpp
@@ -103,22 +103,22 @@ static struct _tagPages {
const TCHAR *szTitle, *szDesc;
UINT uIds[10];
} o_pages[] = {
- { LPGENT("General options"), NULL, IDC_O_NOTABS, IDC_O_STICKY, IDC_VERTICALMAX, IDC_AUTOSPLITTER, IDC_O_AUTOHIDE, IDC_AUTOCLOSETABTIME, IDC_AUTOCLOSETABSPIN, IDC_O_AUTOHIDESECONDS, 0, 0},
- { LPGENT("Window layout"), NULL, IDC_CNTNOSTATUSBAR, IDC_HIDEMENUBAR, IDC_UIDSTATUSBAR, IDC_HIDETOOLBAR, IDC_INFOPANEL, IDC_BOTTOMTOOLBAR, 0, 0, 0, 0},
- { LPGENT("Tabs and switch bar"), LPGENT("Choose your options for the tabbed user interface. Not all options can be applied to open windows. You may need to close and re-open them."), IDC_TABMODE, IDC_O_TABMODE, IDC_O_SBARLAYOUT, IDC_SBARLAYOUT, IDC_FLASHICON, IDC_FLASHLABEL, IDC_SINGLEROWTAB, IDC_BUTTONTABS, IDC_CLOSEBUTTONONTABS, 0},
- { LPGENT("Notifications"), LPGENT("Select, when you want to see event notifications (popups) for this window. The settings apply to all tabs within this window."), IDC_O_DONTREPORT, IDC_DONTREPORTUNFOCUSED2, IDC_DONTREPORTFOCUSED2, IDC_ALWAYSPOPUPSINACTIVE, IDC_O_EXPLAINGLOBALNOTIFY, 0, 0, 0, 0, 0},
- { LPGENT("Flashing"), NULL, IDC_O_FLASHDEFAULT, IDC_O_FLASHALWAYS, IDC_O_FLASHNEVER, 0, 0, 0, 0, 0, 0, 0},
- { LPGENT("Title bar"), NULL, IDC_O_HIDETITLE, IDC_TITLEFORMAT, IDC_O_TITLEBARFORMAT, IDC_O_HELP_TITLEFORMAT, 0, 0, 0, 0, 0, 0},
- { LPGENT("Window size and theme"), LPGENT("You can select a private theme (.tabsrmm file) for this container which will then override the default message log theme. You will have to close and re-open all message windows after changing this option."), IDC_THEME, IDC_SELECTTHEME, IDC_USEGLOBALSIZE, IDC_SAVESIZEASGLOBAL, IDC_LABEL_PRIVATETHEME, IDC_TSLABEL_EXPLAINTHEME, 0, 0, 0, 0},
- { LPGENT("Transparency"), LPGENT("This feature requires Windows 2000 or later and may be unavailable when using a container skin."), IDC_TRANSPARENCY, IDC_TRANSPARENCY_ACTIVE, IDC_TRANSPARENCY_INACTIVE, IDC_TSLABEL_ACTIVE, IDC_TSLABEL_INACTIVE, 0, 0, 0, 0, 0},
- { LPGENT("Contact avatars"), NULL, IDC_O_STATIC_AVATAR, IDC_O_STATIC_OWNAVATAR, IDC_AVATARMODE, IDC_OWNAVATARMODE, IDC_AVATARSONTASKBAR, 0, 0, 0, 0, 0},
- { LPGENT("Sound notifications"), NULL, IDC_O_ENABLESOUNDS, IDC_O_SOUNDSMINIMIZED, IDC_O_SOUNDSUNFOCUSED, IDC_O_SOUNDSINACTIVE, IDC_O_SOUNDSFOCUSED, 0, 0, 0, 0, 0},
+ { LPGENT("General options"), NULL, IDC_O_NOTABS, IDC_O_STICKY, IDC_VERTICALMAX, IDC_AUTOSPLITTER, IDC_O_AUTOHIDE, IDC_AUTOCLOSETABTIME, IDC_AUTOCLOSETABSPIN, IDC_O_AUTOHIDESECONDS, 0, 0 },
+ { LPGENT("Window layout"), NULL, IDC_CNTNOSTATUSBAR, IDC_HIDEMENUBAR, IDC_UIDSTATUSBAR, IDC_HIDETOOLBAR, IDC_INFOPANEL, IDC_BOTTOMTOOLBAR, 0, 0, 0, 0 },
+ { LPGENT("Tabs and switch bar"), LPGENT("Choose your options for the tabbed user interface. Not all options can be applied to open windows. You may need to close and re-open them."), IDC_TABMODE, IDC_O_TABMODE, IDC_O_SBARLAYOUT, IDC_SBARLAYOUT, IDC_FLASHICON, IDC_FLASHLABEL, IDC_SINGLEROWTAB, IDC_BUTTONTABS, IDC_CLOSEBUTTONONTABS, 0 },
+ { LPGENT("Notifications"), LPGENT("Select, when you want to see event notifications (popups) for this window. The settings apply to all tabs within this window."), IDC_O_DONTREPORT, IDC_DONTREPORTUNFOCUSED2, IDC_DONTREPORTFOCUSED2, IDC_ALWAYSPOPUPSINACTIVE, IDC_O_EXPLAINGLOBALNOTIFY, 0, 0, 0, 0, 0 },
+ { LPGENT("Flashing"), NULL, IDC_O_FLASHDEFAULT, IDC_O_FLASHALWAYS, IDC_O_FLASHNEVER, 0, 0, 0, 0, 0, 0, 0 },
+ { LPGENT("Title bar"), NULL, IDC_O_HIDETITLE, IDC_TITLEFORMAT, IDC_O_TITLEBARFORMAT, IDC_O_HELP_TITLEFORMAT, 0, 0, 0, 0, 0, 0 },
+ { LPGENT("Window size and theme"), LPGENT("You can select a private theme (.tabsrmm file) for this container which will then override the default message log theme. You will have to close and re-open all message windows after changing this option."), IDC_THEME, IDC_SELECTTHEME, IDC_USEGLOBALSIZE, IDC_SAVESIZEASGLOBAL, IDC_LABEL_PRIVATETHEME, IDC_TSLABEL_EXPLAINTHEME, 0, 0, 0, 0 },
+ { LPGENT("Transparency"), LPGENT("This feature requires Windows 2000 or later and may be unavailable when using a container skin."), IDC_TRANSPARENCY, IDC_TRANSPARENCY_ACTIVE, IDC_TRANSPARENCY_INACTIVE, IDC_TSLABEL_ACTIVE, IDC_TSLABEL_INACTIVE, 0, 0, 0, 0, 0 },
+ { LPGENT("Contact avatars"), NULL, IDC_O_STATIC_AVATAR, IDC_O_STATIC_OWNAVATAR, IDC_AVATARMODE, IDC_OWNAVATARMODE, IDC_AVATARSONTASKBAR, 0, 0, 0, 0, 0 },
+ { LPGENT("Sound notifications"), NULL, IDC_O_ENABLESOUNDS, IDC_O_SOUNDSMINIMIZED, IDC_O_SOUNDSUNFOCUSED, IDC_O_SOUNDSINACTIVE, IDC_O_SOUNDSFOCUSED, 0, 0, 0, 0, 0 },
};
static void ShowPage(HWND hwndDlg, int iPage, BOOL fShow)
{
if (iPage >= 0 && iPage < NR_O_PAGES) {
- for (int i=0; i < NR_O_OPTIONSPERPAGE && o_pages[iPage].uIds[i] != 0; i++)
+ for (int i = 0; i < NR_O_OPTIONSPERPAGE && o_pages[iPage].uIds[i] != 0; i++)
Utils::showDlgControl(hwndDlg, o_pages[iPage].uIds[i], fShow ? SW_SHOW : SW_HIDE);
}
if (fShow) {
@@ -140,416 +140,417 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
- case WM_INITDIALOG: {
- TVINSERTSTRUCT tvis = {0};
- int nr_layouts = 0;
- const TSideBarLayout *sblayouts = CSideBar::getLayouts(nr_layouts);
-
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) lParam);
- pContainer = (TContainerData*)lParam;
- pContainer->hWndOptions = hwndDlg;
- TranslateDialogDefault(hwndDlg);
- SetWindowText(hwndDlg, TranslateT("Container options"));
- TCHAR szNewTitle[128];
- mir_sntprintf(szNewTitle, SIZEOF(szNewTitle), TranslateT("Configure container options for\n%s"), !_tcscmp(pContainer->szName, _T("default")) ?
- TranslateT("Default container") : pContainer->szName);
- SetDlgItemText(hwndDlg, IDC_HEADERBAR, szNewTitle);
- Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, !CSkin::m_frameSkins);
- CheckDlgButton(hwndDlg, IDC_CNTPRIVATE, pContainer->settings->fPrivate ? BST_CHECKED : BST_UNCHECKED);
-
- SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the top"));
- SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the bottom"));
- SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the left side"));
- SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the right side"));
-
- SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally on"));
- SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present"));
- SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally OFF"));
- SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present, always in bottom display"));
-
- SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present"));
- SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Don't show them"));
-
- for (int i=0; i < nr_layouts; i++)
- SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(sblayouts[i].szName));
-
- /* bits 24 - 31 of dwFlagsEx hold the side bar layout id */
- SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_SETCURSEL, (WPARAM)((pContainer->settings->dwFlagsEx & 0xff000000) >> 24), 0);
+ case WM_INITDIALOG: {
+ TVINSERTSTRUCT tvis = { 0 };
+ int nr_layouts = 0;
+ const TSideBarLayout *sblayouts = CSideBar::getLayouts(nr_layouts);
+
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
+ pContainer = (TContainerData*)lParam;
+ pContainer->hWndOptions = hwndDlg;
+ TranslateDialogDefault(hwndDlg);
+ SetWindowText(hwndDlg, TranslateT("Container options"));
+ TCHAR szNewTitle[128];
+ mir_sntprintf(szNewTitle, SIZEOF(szNewTitle), TranslateT("Configure container options for\n%s"), !_tcscmp(pContainer->szName, _T("default")) ?
+ TranslateT("Default container") : pContainer->szName);
+ SetDlgItemText(hwndDlg, IDC_HEADERBAR, szNewTitle);
+ Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, !CSkin::m_frameSkins);
+ CheckDlgButton(hwndDlg, IDC_CNTPRIVATE, pContainer->settings->fPrivate ? BST_CHECKED : BST_UNCHECKED);
+
+ SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the top"));
+ SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the bottom"));
+ SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the left side"));
+ SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the right side"));
+
+ SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally on"));
+ SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present"));
+ SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally OFF"));
+ SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present, always in bottom display"));
+
+ SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present"));
+ SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Don't show them"));
+
+ for (int i = 0; i < nr_layouts; i++)
+ SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(sblayouts[i].szName));
+
+ /* bits 24 - 31 of dwFlagsEx hold the side bar layout id */
+ SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_SETCURSEL, (WPARAM)((pContainer->settings->dwFlagsEx & 0xff000000) >> 24), 0);
+
+
+ SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings);
+ SendDlgItemMessage(hwndDlg, IDC_TITLEFORMAT, EM_LIMITTEXT, TITLE_FORMATLEN - 1, 0);
+ SetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat);
+ SetDlgItemText(hwndDlg, IDC_THEME, pContainer->szRelThemeFile);
+ for (int i = 0; i < NR_O_PAGES; i++) {
+ tvis.hParent = NULL;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
+ tvis.item.pszText = TranslateTS(o_pages[i].szTitle);
+ tvis.item.lParam = i;
+ HTREEITEM hItem = TreeView_InsertItem(hwndTree, &tvis);
+ if (i == 0)
+ SendMessage(hwndTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem);
+ for (int j = 0; j < NR_O_OPTIONSPERPAGE && o_pages[i].uIds[j] != 0; j++)
+ Utils::showDlgControl(hwndDlg, o_pages[i].uIds[j], SW_HIDE);
+ ShowPage(hwndDlg, i, FALSE);
+ }
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE));
+ ShowPage(hwndDlg, 0, TRUE);
+ SetFocus(hwndTree);
+ Utils::enableDlgControl(hwndDlg, IDC_APPLY, false);
+ HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_DESC, WM_GETFONT, 0, 0);
+ LOGFONT lf = { 0 };
- SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings);
- SendDlgItemMessage(hwndDlg, IDC_TITLEFORMAT, EM_LIMITTEXT, TITLE_FORMATLEN - 1, 0);
- SetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat);
- SetDlgItemText(hwndDlg, IDC_THEME, pContainer->szRelThemeFile);
- for (int i=0; i < NR_O_PAGES; i++) {
- tvis.hParent = NULL;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
- tvis.item.pszText = TranslateTS(o_pages[i].szTitle);
- tvis.item.lParam = i;
- HTREEITEM hItem = TreeView_InsertItem(hwndTree, &tvis);
- if (i == 0)
- SendMessage(hwndTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem);
- for (int j = 0; j < NR_O_OPTIONSPERPAGE && o_pages[i].uIds[j] != 0; j++)
- Utils::showDlgControl(hwndDlg, o_pages[i].uIds[j], SW_HIDE);
- ShowPage(hwndDlg, i, FALSE);
- }
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE));
- ShowPage(hwndDlg, 0, TRUE);
- SetFocus(hwndTree);
- Utils::enableDlgControl(hwndDlg, IDC_APPLY, false);
+ GetObject(hFont, sizeof(lf), &lf);
+ lf.lfHeight = (int)(lf.lfHeight * 1.2);
+ hFont = CreateFontIndirect(&lf);
- HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_DESC, WM_GETFONT, 0, 0);
- LOGFONT lf = {0};
+ SendDlgItemMessage(hwndDlg, IDC_TITLEBOX, WM_SETFONT, (WPARAM)hFont, TRUE);
- GetObject(hFont, sizeof(lf), &lf);
- lf.lfHeight = (int)(lf.lfHeight * 1.2);
- hFont = CreateFontIndirect(&lf);
+ if (pContainer->isCloned && pContainer->hContactFrom != 0) {
+ Utils::showDlgControl(hwndDlg, IDC_CNTPRIVATE, SW_HIDE);
+ Utils::showDlgControl(hwndDlg, IDC_O_CNTPRIVATE, SW_HIDE);
+ }
+ return FALSE;
+ }
- SendDlgItemMessage(hwndDlg, IDC_TITLEBOX, WM_SETFONT, (WPARAM)hFont, TRUE);
+ case WM_CTLCOLOREDIT:
+ case WM_CTLCOLORSTATIC:
+ {
+ HWND hwndChild = (HWND)lParam;
+ UINT id = GetDlgCtrlID(hwndChild);
- if (pContainer->isCloned && pContainer->hContactFrom != 0) {
- Utils::showDlgControl(hwndDlg, IDC_CNTPRIVATE, SW_HIDE);
- Utils::showDlgControl(hwndDlg, IDC_O_CNTPRIVATE, SW_HIDE);
- }
- return FALSE;
+ if (hwndChild == GetDlgItem(hwndDlg, IDC_TITLEBOX)) {
+ ::SetTextColor((HDC)wParam, RGB(60, 60, 150));
}
+ else if (hwndChild == GetDlgItem(hwndDlg, IDC_DESC))
+ ::SetTextColor((HDC)wParam, RGB(160, 50, 50));
+ if (id == IDC_TSLABEL_REOPENWARN)
+ break;
+ SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+ return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
+ }
+
+ case WM_NOTIFY:
+ if (wParam == IDC_SECTIONTREE && ((LPNMHDR)lParam)->code == TVN_SELCHANGED) {
+ NMTREEVIEW *pmtv = (NMTREEVIEW *)lParam;
- case WM_CTLCOLOREDIT:
- case WM_CTLCOLORSTATIC:
- {
- HWND hwndChild = (HWND)lParam;
- UINT id = GetDlgCtrlID(hwndChild);
-
- if (hwndChild == GetDlgItem(hwndDlg, IDC_TITLEBOX)) {
- ::SetTextColor((HDC)wParam, RGB(60, 60, 150));
- } else if (hwndChild == GetDlgItem(hwndDlg, IDC_DESC))
- ::SetTextColor((HDC)wParam, RGB(160, 50, 50));
- if (id == IDC_TSLABEL_REOPENWARN)
- break;
- SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
- return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
+ ShowPage(hwndDlg, pmtv->itemOld.lParam, 0);
+ ShowPage(hwndDlg, pmtv->itemNew.lParam, 1);
}
+ break;
- case WM_NOTIFY:
- if (wParam == IDC_SECTIONTREE && ((LPNMHDR)lParam)->code == TVN_SELCHANGED) {
- NMTREEVIEW *pmtv = (NMTREEVIEW *)lParam;
+ case WM_HSCROLL:
+ if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_TRANSPARENCY_ACTIVE) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_TRANSPARENCY_INACTIVE))
+ Utils::enableDlgControl(hwndDlg, IDC_APPLY, true);
+ break;
- ShowPage(hwndDlg, pmtv->itemOld.lParam, 0);
- ShowPage(hwndDlg, pmtv->itemNew.lParam, 1);
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_CNTPRIVATE: {
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) {
+ Utils::ReadPrivateContainerSettings(pContainer, true);
+ pContainer->settings->fPrivate = true;
+ }
+ else {
+ if (pContainer->settings != &PluginConfig.globalContainerSettings) {
+ char szCname[40];
+ mir_snprintf(szCname, SIZEOF(szCname), "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
+ pContainer->settings->fPrivate = false;
+ db_set_blob(0, SRMSGMOD_T, szCname, pContainer->settings, sizeof(TContainerSettings));
+ mir_free(pContainer->settings);
+ }
+ pContainer->settings = &PluginConfig.globalContainerSettings;
+ pContainer->settings->fPrivate = false;
+ }
+ SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings);
+ goto do_apply;
+ }
+ case IDC_TRANSPARENCY: {
+ bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0;
+ Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans);
+ Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans);
+ goto do_apply;
+ }
+ case IDC_SECTIONTREE:
+ case IDC_DESC:
+ return 0;
+ case IDC_SAVESIZEASGLOBAL: {
+ WINDOWPLACEMENT wp = { 0 };
+
+ wp.length = sizeof(wp);
+ if (GetWindowPlacement(pContainer->hwnd, &wp)) {
+ db_set_dw(0, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left);
+ db_set_dw(0, SRMSGMOD_T, "splity", wp.rcNormalPosition.top);
+ db_set_dw(0, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left);
+ db_set_dw(0, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
}
break;
-
- case WM_HSCROLL:
- if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_TRANSPARENCY_ACTIVE) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_TRANSPARENCY_INACTIVE))
- Utils::enableDlgControl(hwndDlg, IDC_APPLY, true);
+ }
+ case IDC_O_ENABLESOUNDS:
+ SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0);
break;
+ case IDC_TITLEFORMAT:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
+ return TRUE;
+ goto do_apply;
+ case IDC_SELECTTHEME: {
+ const wchar_t *szFileName = GetThemeFileName(0);
+
+ if (PathFileExists(szFileName)) {
+ SetDlgItemText(hwndDlg, IDC_THEME, szFileName);
+ goto do_apply;
+ }
+ break;
+ }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_CNTPRIVATE: {
-
- if (IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) {
- Utils::ReadPrivateContainerSettings(pContainer, true);
- pContainer->settings->fPrivate = true;
- }
- else {
- if (pContainer->settings != &PluginConfig.globalContainerSettings) {
- char szCname[40];
- mir_snprintf(szCname, SIZEOF(szCname), "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
- pContainer->settings->fPrivate = false;
- db_set_blob(0, SRMSGMOD_T, szCname, pContainer->settings, sizeof(TContainerSettings));
- mir_free(pContainer->settings);
- }
- pContainer->settings = &PluginConfig.globalContainerSettings;
- pContainer->settings->fPrivate = false;
- }
- SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings);
- goto do_apply;
- }
- case IDC_TRANSPARENCY: {
- bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0;
- Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans);
- Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans);
- goto do_apply;
- }
- case IDC_SECTIONTREE:
- case IDC_DESC:
- return 0;
- case IDC_SAVESIZEASGLOBAL: {
- WINDOWPLACEMENT wp = {0};
-
- wp.length = sizeof(wp);
- if (GetWindowPlacement(pContainer->hwnd, &wp)) {
- db_set_dw(0, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left);
- db_set_dw(0, SRMSGMOD_T, "splity", wp.rcNormalPosition.top);
- db_set_dw(0, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left);
- db_set_dw(0, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
- }
- break;
- }
- case IDC_O_ENABLESOUNDS:
- SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0);
- break;
- case IDC_TITLEFORMAT:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return TRUE;
- goto do_apply;
- case IDC_SELECTTHEME: {
- const wchar_t *szFileName = GetThemeFileName(0);
-
- if (PathFileExists(szFileName)) {
- SetDlgItemText(hwndDlg, IDC_THEME, szFileName);
- goto do_apply;
- }
- break;
- }
-
- case IDC_O_HELP_TITLEFORMAT:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)_T("http://miranda.or.at/TabSRMM/TitleBarFormatting"));
- break;
+ case IDC_O_HELP_TITLEFORMAT:
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)_T("http://miranda.or.at/TabSRMM/TitleBarFormatting"));
+ break;
- case IDOK:
- case IDC_APPLY: {
+ case IDOK:
+ case IDC_APPLY: {
- SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, (LPARAM)pContainer->settings);
+ SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, (LPARAM)pContainer->settings);
- pContainer->settings->dwTransparency = MAKELONG((WORD)SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_GETPOS, 0, 0),
- (WORD)SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_GETPOS, 0, 0));
+ pContainer->settings->dwTransparency = MAKELONG((WORD)SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_GETPOS, 0, 0),
+ (WORD)SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_GETPOS, 0, 0));
- pContainer->settings->avatarMode = (WORD)SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_GETCURSEL, 0, 0);
- pContainer->settings->ownAvatarMode = (WORD)SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_GETCURSEL, 0, 0);
+ pContainer->settings->avatarMode = (WORD)SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_GETCURSEL, 0, 0);
+ pContainer->settings->ownAvatarMode = (WORD)SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_GETCURSEL, 0, 0);
- GetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat, TITLE_FORMATLEN);
- pContainer->settings->szTitleFormat[TITLE_FORMATLEN - 1] = 0;
+ GetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat, TITLE_FORMATLEN);
+ pContainer->settings->szTitleFormat[TITLE_FORMATLEN - 1] = 0;
- pContainer->szRelThemeFile[0] = pContainer->szAbsThemeFile[0] = 0;
+ pContainer->szRelThemeFile[0] = pContainer->szAbsThemeFile[0] = 0;
- if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_THEME)) > 0) {
- wchar_t szFinalThemeFile[MAX_PATH], szFilename[MAX_PATH];
+ if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_THEME)) > 0) {
+ wchar_t szFinalThemeFile[MAX_PATH], szFilename[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_THEME, szFilename, SIZEOF(szFilename));
- szFilename[MAX_PATH - 1] = 0;
- PathToAbsoluteT(szFilename, szFinalThemeFile, M.getDataPath());
+ GetDlgItemText(hwndDlg, IDC_THEME, szFilename, SIZEOF(szFilename));
+ szFilename[MAX_PATH - 1] = 0;
+ PathToAbsoluteT(szFilename, szFinalThemeFile, M.getDataPath());
- if (_tcscmp(szFilename, pContainer->szRelThemeFile))
- pContainer->fPrivateThemeChanged = TRUE;
+ if (_tcscmp(szFilename, pContainer->szRelThemeFile))
+ pContainer->fPrivateThemeChanged = TRUE;
- if (PathFileExists(szFinalThemeFile))
- _tcsncpy_s(pContainer->szRelThemeFile, szFilename, _TRUNCATE);
- else
- pContainer->szRelThemeFile[0] = 0;
- }
- else {
- pContainer->szRelThemeFile[0] = 0;
- pContainer->fPrivateThemeChanged = TRUE;
- }
+ if (PathFileExists(szFinalThemeFile))
+ _tcsncpy_s(pContainer->szRelThemeFile, szFilename, _TRUNCATE);
+ else
+ pContainer->szRelThemeFile[0] = 0;
+ }
+ else {
+ pContainer->szRelThemeFile[0] = 0;
+ pContainer->fPrivateThemeChanged = TRUE;
+ }
- Utils::SettingsToContainer(pContainer);
+ Utils::SettingsToContainer(pContainer);
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) {
- ReloadGlobalContainerSettings(true);
- ::db_set_blob(0, SRMSGMOD_T, CNT_KEYNAME, &PluginConfig.globalContainerSettings, sizeof(TContainerSettings));
- }
- else {
- char *szSetting = "CNTW_";
- Utils::SaveContainerSettings(pContainer, szSetting);
- }
+ if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) {
+ ReloadGlobalContainerSettings(true);
+ ::db_set_blob(0, SRMSGMOD_T, CNT_KEYNAME, &PluginConfig.globalContainerSettings, sizeof(TContainerSettings));
+ }
+ else {
+ char *szSetting = "CNTW_";
+ Utils::SaveContainerSettings(pContainer, szSetting);
+ }
- SendMessage(pContainer->hwnd, DM_CONFIGURECONTAINER, 0, 0);
- BroadCastContainer(pContainer, DM_SETINFOPANEL, 0, 0);
+ SendMessage(pContainer->hwnd, DM_CONFIGURECONTAINER, 0, 0);
+ BroadCastContainer(pContainer, DM_SETINFOPANEL, 0, 0);
- ShowWindow(pContainer->hwnd, SW_HIDE);
- {
- RECT rc;
+ ShowWindow(pContainer->hwnd, SW_HIDE);
+ {
+ RECT rc;
- GetWindowRect(pContainer->hwnd, &rc);
- SetWindowPos(pContainer->hwnd, 0, rc.left, rc.top, (rc.right - rc.left) - 1, (rc.bottom - rc.top) - 1, SWP_NOZORDER | SWP_DRAWFRAME | SWP_FRAMECHANGED);
- SetWindowPos(pContainer->hwnd, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_NOZORDER | SWP_DRAWFRAME | SWP_SHOWWINDOW);
- }
+ GetWindowRect(pContainer->hwnd, &rc);
+ SetWindowPos(pContainer->hwnd, 0, rc.left, rc.top, (rc.right - rc.left) - 1, (rc.bottom - rc.top) - 1, SWP_NOZORDER | SWP_DRAWFRAME | SWP_FRAMECHANGED);
+ SetWindowPos(pContainer->hwnd, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_NOZORDER | SWP_DRAWFRAME | SWP_SHOWWINDOW);
+ }
- if (LOWORD(wParam) == IDOK)
- DestroyWindow(hwndDlg);
- else
- Utils::enableDlgControl(hwndDlg, IDC_APPLY, false);
+ if (LOWORD(wParam) == IDOK)
+ DestroyWindow(hwndDlg);
+ else
+ Utils::enableDlgControl(hwndDlg, IDC_APPLY, false);
- break;
- }
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- return TRUE;
-
- default:
-do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true);
- break;
- }
break;
- case DM_SC_INITDIALOG: {
- TContainerSettings* cs = (TContainerSettings *)lParam;
+ }
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
+ return TRUE;
- DWORD dwFlags = cs->dwFlags;
- DWORD dwTransparency = cs->dwTransparency;
- DWORD dwFlagsEx = cs->dwFlagsEx;
- BOOL fAllowTrans = FALSE;
+ default:
+ do_apply : Utils::enableDlgControl(hwndDlg, IDC_APPLY, true);
+ break;
+ }
+ break;
+ case DM_SC_INITDIALOG: {
+ TContainerSettings* cs = (TContainerSettings *)lParam;
- if (PluginConfig.m_WinVerMajor >= 6)
- fAllowTrans = TRUE;
- else
- fAllowTrans = (!CSkin::m_skinEnabled);
-
- MY_CheckDlgButton(hwndDlg, IDC_O_HIDETITLE, dwFlags & CNT_NOTITLE);
- MY_CheckDlgButton(hwndDlg, IDC_O_DONTREPORT, dwFlags & CNT_DONTREPORT);
- MY_CheckDlgButton(hwndDlg, IDC_O_NOTABS, dwFlags & CNT_HIDETABS);
- MY_CheckDlgButton(hwndDlg, IDC_O_STICKY, dwFlags & CNT_STICKY);
- MY_CheckDlgButton(hwndDlg, IDC_O_FLASHNEVER, dwFlags & CNT_NOFLASH);
- MY_CheckDlgButton(hwndDlg, IDC_O_FLASHALWAYS, dwFlags & CNT_FLASHALWAYS);
- MY_CheckDlgButton(hwndDlg, IDC_O_FLASHDEFAULT, !((dwFlags & CNT_NOFLASH) || (dwFlags & CNT_FLASHALWAYS)));
- MY_CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY);
- MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTUNFOCUSED2, dwFlags & CNT_DONTREPORTUNFOCUSED);
- MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTFOCUSED2, dwFlags & CNT_DONTREPORTFOCUSED);
- MY_CheckDlgButton(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, dwFlags & CNT_ALWAYSREPORTINACTIVE);
- MY_CheckDlgButton(hwndDlg, IDC_CNTNOSTATUSBAR, dwFlags & CNT_NOSTATUSBAR);
- MY_CheckDlgButton(hwndDlg, IDC_HIDEMENUBAR, dwFlags & CNT_NOMENUBAR);
- MY_CheckDlgButton(hwndDlg, IDC_HIDETOOLBAR, dwFlags & CNT_HIDETOOLBAR);
- MY_CheckDlgButton(hwndDlg, IDC_BOTTOMTOOLBAR, dwFlags & CNT_BOTTOMTOOLBAR);
- MY_CheckDlgButton(hwndDlg, IDC_UIDSTATUSBAR, dwFlags & CNT_UINSTATUSBAR);
- MY_CheckDlgButton(hwndDlg, IDC_VERTICALMAX, dwFlags & CNT_VERTICALMAX);
- MY_CheckDlgButton(hwndDlg, IDC_AUTOSPLITTER, dwFlags & CNT_AUTOSPLITTER);
- MY_CheckDlgButton(hwndDlg, IDC_AVATARSONTASKBAR, dwFlags & CNT_AVATARSONTASKBAR);
- MY_CheckDlgButton(hwndDlg, IDC_INFOPANEL, dwFlags & CNT_INFOPANEL);
- MY_CheckDlgButton(hwndDlg, IDC_USEGLOBALSIZE, dwFlags & CNT_GLOBALSIZE);
-
- MY_CheckDlgButton(hwndDlg, IDC_FLASHICON, dwFlagsEx & TCF_FLASHICON);
- MY_CheckDlgButton(hwndDlg, IDC_FLASHLABEL, dwFlagsEx & TCF_FLASHLABEL);
- MY_CheckDlgButton(hwndDlg, IDC_CLOSEBUTTONONTABS, dwFlagsEx & TCF_CLOSEBUTTON);
-
- MY_CheckDlgButton(hwndDlg, IDC_SINGLEROWTAB, dwFlagsEx & TCF_SINGLEROWTABCONTROL);
- MY_CheckDlgButton(hwndDlg, IDC_BUTTONTABS, dwFlagsEx & TCF_FLAT);
-
- MY_CheckDlgButton(hwndDlg, IDC_O_ENABLESOUNDS, !(dwFlags & CNT_NOSOUND));
- MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSMINIMIZED, dwFlagsEx & CNT_EX_SOUNDS_MINIMIZED);
- MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSUNFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_UNFOCUSED);
- MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSINACTIVE, dwFlagsEx & CNT_EX_SOUNDS_INACTIVETABS);
- MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_FOCUSED);
+ DWORD dwFlags = cs->dwFlags;
+ DWORD dwTransparency = cs->dwTransparency;
+ DWORD dwFlagsEx = cs->dwFlagsEx;
+ BOOL fAllowTrans = FALSE;
- SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0);
+ if (PluginConfig.m_WinVerMajor >= 6)
+ fAllowTrans = TRUE;
+ else
+ fAllowTrans = (!CSkin::m_skinEnabled);
+
+ MY_CheckDlgButton(hwndDlg, IDC_O_HIDETITLE, dwFlags & CNT_NOTITLE);
+ MY_CheckDlgButton(hwndDlg, IDC_O_DONTREPORT, dwFlags & CNT_DONTREPORT);
+ MY_CheckDlgButton(hwndDlg, IDC_O_NOTABS, dwFlags & CNT_HIDETABS);
+ MY_CheckDlgButton(hwndDlg, IDC_O_STICKY, dwFlags & CNT_STICKY);
+ MY_CheckDlgButton(hwndDlg, IDC_O_FLASHNEVER, dwFlags & CNT_NOFLASH);
+ MY_CheckDlgButton(hwndDlg, IDC_O_FLASHALWAYS, dwFlags & CNT_FLASHALWAYS);
+ MY_CheckDlgButton(hwndDlg, IDC_O_FLASHDEFAULT, !((dwFlags & CNT_NOFLASH) || (dwFlags & CNT_FLASHALWAYS)));
+ MY_CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY);
+ MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTUNFOCUSED2, dwFlags & CNT_DONTREPORTUNFOCUSED);
+ MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTFOCUSED2, dwFlags & CNT_DONTREPORTFOCUSED);
+ MY_CheckDlgButton(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, dwFlags & CNT_ALWAYSREPORTINACTIVE);
+ MY_CheckDlgButton(hwndDlg, IDC_CNTNOSTATUSBAR, dwFlags & CNT_NOSTATUSBAR);
+ MY_CheckDlgButton(hwndDlg, IDC_HIDEMENUBAR, dwFlags & CNT_NOMENUBAR);
+ MY_CheckDlgButton(hwndDlg, IDC_HIDETOOLBAR, dwFlags & CNT_HIDETOOLBAR);
+ MY_CheckDlgButton(hwndDlg, IDC_BOTTOMTOOLBAR, dwFlags & CNT_BOTTOMTOOLBAR);
+ MY_CheckDlgButton(hwndDlg, IDC_UIDSTATUSBAR, dwFlags & CNT_UINSTATUSBAR);
+ MY_CheckDlgButton(hwndDlg, IDC_VERTICALMAX, dwFlags & CNT_VERTICALMAX);
+ MY_CheckDlgButton(hwndDlg, IDC_AUTOSPLITTER, dwFlags & CNT_AUTOSPLITTER);
+ MY_CheckDlgButton(hwndDlg, IDC_AVATARSONTASKBAR, dwFlags & CNT_AVATARSONTASKBAR);
+ MY_CheckDlgButton(hwndDlg, IDC_INFOPANEL, dwFlags & CNT_INFOPANEL);
+ MY_CheckDlgButton(hwndDlg, IDC_USEGLOBALSIZE, dwFlags & CNT_GLOBALSIZE);
+
+ MY_CheckDlgButton(hwndDlg, IDC_FLASHICON, dwFlagsEx & TCF_FLASHICON);
+ MY_CheckDlgButton(hwndDlg, IDC_FLASHLABEL, dwFlagsEx & TCF_FLASHLABEL);
+ MY_CheckDlgButton(hwndDlg, IDC_CLOSEBUTTONONTABS, dwFlagsEx & TCF_CLOSEBUTTON);
+
+ MY_CheckDlgButton(hwndDlg, IDC_SINGLEROWTAB, dwFlagsEx & TCF_SINGLEROWTABCONTROL);
+ MY_CheckDlgButton(hwndDlg, IDC_BUTTONTABS, dwFlagsEx & TCF_FLAT);
+
+ MY_CheckDlgButton(hwndDlg, IDC_O_ENABLESOUNDS, !(dwFlags & CNT_NOSOUND));
+ MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSMINIMIZED, dwFlagsEx & CNT_EX_SOUNDS_MINIMIZED);
+ MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSUNFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_UNFOCUSED);
+ MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSINACTIVE, dwFlagsEx & CNT_EX_SOUNDS_INACTIVETABS);
+ MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_FOCUSED);
+
+ SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0);
+
+ if (!(dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT)))
+ SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlags & CNT_TABSBOTTOM ? 1 : 0, 0);
+ else
+ SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlagsEx & TCF_SBARLEFT ? 2 : 3, 0);
- if (!(dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT)))
- SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlags & CNT_TABSBOTTOM ? 1 : 0, 0);
- else
- SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlagsEx & TCF_SBARLEFT ? 2 : 3, 0);
+ if (LOBYTE(LOWORD(GetVersion())) >= 5 && fAllowTrans)
+ CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY ? BST_CHECKED : BST_UNCHECKED);
+ else
+ CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, BST_UNCHECKED);
- if (LOBYTE(LOWORD(GetVersion())) >= 5 && fAllowTrans)
- CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY ? BST_CHECKED : BST_UNCHECKED);
- else
- CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, BST_UNCHECKED);
+ Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY, PluginConfig.m_WinVerMajor >= 5 && fAllowTrans);
- Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY, PluginConfig.m_WinVerMajor >= 5 && fAllowTrans);
+ bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0;
+ Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans);
+ Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans);
- bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0;
- Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans);
- Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans);
+ SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255));
+ SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255));
- SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255));
- SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255));
+ SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETPOS, TRUE, (LPARAM)LOWORD(dwTransparency));
+ SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETPOS, TRUE, (LPARAM)HIWORD(dwTransparency));
- SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETPOS, TRUE, (LPARAM)LOWORD(dwTransparency));
- SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETPOS, TRUE, (LPARAM)HIWORD(dwTransparency));
+ Utils::enableDlgControl(hwndDlg, IDC_O_DONTREPORT, !nen_options.bWindowCheck);
+ Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTUNFOCUSED2, !nen_options.bWindowCheck);
+ Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTFOCUSED2, !nen_options.bWindowCheck);
+ Utils::enableDlgControl(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, !nen_options.bWindowCheck);
- Utils::enableDlgControl(hwndDlg, IDC_O_DONTREPORT, !nen_options.bWindowCheck);
- Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTUNFOCUSED2, !nen_options.bWindowCheck);
- Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTFOCUSED2, !nen_options.bWindowCheck);
- Utils::enableDlgControl(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, !nen_options.bWindowCheck);
+ SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_SETCURSEL, (WPARAM)cs->avatarMode, 0);
+ SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_SETCURSEL, (WPARAM)cs->ownAvatarMode, 0);
- SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_SETCURSEL, (WPARAM)cs->avatarMode, 0);
- SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_SETCURSEL, (WPARAM)cs->ownAvatarMode, 0);
+ Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, nen_options.bWindowCheck ? SW_SHOW : SW_HIDE);
- Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, nen_options.bWindowCheck ? SW_SHOW : SW_HIDE);
+ SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0));
+ SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETPOS, 0, (LPARAM)cs->autoCloseSeconds);
+ break;
+ }
- SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0));
- SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETPOS, 0, (LPARAM)cs->autoCloseSeconds);
- break;
- }
+ case DM_SC_CONFIG: {
+ bool bEnable = IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) != 0;
+ Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSINACTIVE, bEnable);
+ Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSUNFOCUSED, bEnable);
+ Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSMINIMIZED, bEnable);
+ Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSFOCUSED, bEnable);
+ return 0;
+ }
- case DM_SC_CONFIG: {
- bool bEnable = IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) != 0;
- Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSINACTIVE, bEnable);
- Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSUNFOCUSED, bEnable);
- Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSMINIMIZED, bEnable);
- Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSFOCUSED, bEnable);
- return 0;
+ case DM_SC_BUILDLIST: {
+ DWORD dwNewFlags = 0, dwNewFlagsEx = 0;
+ TContainerSettings* cs = (TContainerSettings *)lParam;
+
+ dwNewFlags = (IsDlgButtonChecked(hwndDlg, IDC_O_HIDETITLE) ? CNT_NOTITLE : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_O_DONTREPORT) ? CNT_DONTREPORT : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_O_NOTABS) ? CNT_HIDETABS : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_O_STICKY) ? CNT_STICKY : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHALWAYS) ? CNT_FLASHALWAYS : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHNEVER) ? CNT_NOFLASH : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) ? CNT_TRANSPARENCY : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTUNFOCUSED2) ? CNT_DONTREPORTUNFOCUSED : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTFOCUSED2) ? CNT_DONTREPORTFOCUSED : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE) ? CNT_ALWAYSREPORTINACTIVE : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_CNTNOSTATUSBAR) ? CNT_NOSTATUSBAR : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_HIDEMENUBAR) ? CNT_NOMENUBAR : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_HIDETOOLBAR) ? CNT_HIDETOOLBAR : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_BOTTOMTOOLBAR) ? CNT_BOTTOMTOOLBAR : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_UIDSTATUSBAR) ? CNT_UINSTATUSBAR : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_USEGLOBALSIZE) ? CNT_GLOBALSIZE : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_INFOPANEL) ? CNT_INFOPANEL : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) ? 0 : CNT_NOSOUND) |
+ (IsDlgButtonChecked(hwndDlg, IDC_AVATARSONTASKBAR) ? CNT_AVATARSONTASKBAR : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_VERTICALMAX) ? CNT_VERTICALMAX : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_AUTOSPLITTER) ? CNT_AUTOSPLITTER : 0) |
+ (CNT_NEWCONTAINERFLAGS);
+
+ LRESULT iTabMode = SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_GETCURSEL, 0, 0);
+ LRESULT iTabLayout = SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_GETCURSEL, 0, 0);
+
+ dwNewFlagsEx = 0;
+
+ if (iTabMode < 2)
+ dwNewFlags = ((iTabMode == 1) ? (dwNewFlags | CNT_TABSBOTTOM) : (dwNewFlags & ~CNT_TABSBOTTOM));
+ else {
+ dwNewFlags &= ~CNT_TABSBOTTOM;
+ dwNewFlagsEx = iTabMode == 2 ? TCF_SBARLEFT : TCF_SBARRIGHT;
}
- case DM_SC_BUILDLIST: {
- DWORD dwNewFlags = 0, dwNewFlagsEx = 0;
- TContainerSettings* cs = (TContainerSettings *)lParam;
-
- dwNewFlags = (IsDlgButtonChecked(hwndDlg, IDC_O_HIDETITLE) ? CNT_NOTITLE : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_DONTREPORT) ? CNT_DONTREPORT : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_NOTABS) ? CNT_HIDETABS : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_STICKY) ? CNT_STICKY : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHALWAYS) ? CNT_FLASHALWAYS : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHNEVER) ? CNT_NOFLASH : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) ? CNT_TRANSPARENCY : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTUNFOCUSED2) ? CNT_DONTREPORTUNFOCUSED : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTFOCUSED2) ? CNT_DONTREPORTFOCUSED : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE) ? CNT_ALWAYSREPORTINACTIVE : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_CNTNOSTATUSBAR) ? CNT_NOSTATUSBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_HIDEMENUBAR) ? CNT_NOMENUBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_HIDETOOLBAR) ? CNT_HIDETOOLBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_BOTTOMTOOLBAR) ? CNT_BOTTOMTOOLBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_UIDSTATUSBAR) ? CNT_UINSTATUSBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_USEGLOBALSIZE) ? CNT_GLOBALSIZE : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_INFOPANEL) ? CNT_INFOPANEL : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) ? 0 : CNT_NOSOUND) |
- (IsDlgButtonChecked(hwndDlg, IDC_AVATARSONTASKBAR) ? CNT_AVATARSONTASKBAR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_VERTICALMAX) ? CNT_VERTICALMAX : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_AUTOSPLITTER) ? CNT_AUTOSPLITTER : 0) |
- (CNT_NEWCONTAINERFLAGS);
-
- LRESULT iTabMode = SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_GETCURSEL, 0, 0);
- LRESULT iTabLayout = SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_GETCURSEL, 0, 0);
-
- dwNewFlagsEx = 0;
-
- if (iTabMode < 2)
- dwNewFlags = ((iTabMode == 1) ? (dwNewFlags | CNT_TABSBOTTOM) : (dwNewFlags & ~CNT_TABSBOTTOM));
- else {
- dwNewFlags &= ~CNT_TABSBOTTOM;
- dwNewFlagsEx = iTabMode == 2 ? TCF_SBARLEFT : TCF_SBARRIGHT;
- }
-
- dwNewFlagsEx |= ((IsDlgButtonChecked(hwndDlg, IDC_FLASHICON) ? TCF_FLASHICON : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_FLASHLABEL) ? TCF_FLASHLABEL : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_BUTTONTABS) ? TCF_FLAT : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_CLOSEBUTTONONTABS) ? TCF_CLOSEBUTTON : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_SINGLEROWTAB) ? TCF_SINGLEROWTABCONTROL : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSMINIMIZED) ? CNT_EX_SOUNDS_MINIMIZED : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSUNFOCUSED) ? CNT_EX_SOUNDS_UNFOCUSED : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSFOCUSED) ? CNT_EX_SOUNDS_FOCUSED : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSINACTIVE) ? CNT_EX_SOUNDS_INACTIVETABS : 0)
- );
-
- /* bits 24 - 31 of dwFlagsEx hold the sidebar layout id */
- dwNewFlagsEx |= ((int)((iTabLayout << 24) & 0xff000000));
-
- if (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHDEFAULT))
- dwNewFlags &= ~(CNT_FLASHALWAYS | CNT_NOFLASH);
-
- cs->dwFlags = dwNewFlags;
- cs->dwFlagsEx = dwNewFlagsEx;
- cs->autoCloseSeconds = (WORD)SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_GETPOS, 0, 0);
- break;
- }
- case WM_DESTROY: {
- pContainer->hWndOptions = 0;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ dwNewFlagsEx |= ((IsDlgButtonChecked(hwndDlg, IDC_FLASHICON) ? TCF_FLASHICON : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_FLASHLABEL) ? TCF_FLASHLABEL : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_BUTTONTABS) ? TCF_FLAT : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_CLOSEBUTTONONTABS) ? TCF_CLOSEBUTTON : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_SINGLEROWTAB) ? TCF_SINGLEROWTABCONTROL : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSMINIMIZED) ? CNT_EX_SOUNDS_MINIMIZED : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSUNFOCUSED) ? CNT_EX_SOUNDS_UNFOCUSED : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSFOCUSED) ? CNT_EX_SOUNDS_FOCUSED : 0) |
+ (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSINACTIVE) ? CNT_EX_SOUNDS_INACTIVETABS : 0)
+ );
+
+ /* bits 24 - 31 of dwFlagsEx hold the sidebar layout id */
+ dwNewFlagsEx |= ((int)((iTabLayout << 24) & 0xff000000));
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHDEFAULT))
+ dwNewFlags &= ~(CNT_FLASHALWAYS | CNT_NOFLASH);
+
+ cs->dwFlags = dwNewFlags;
+ cs->dwFlagsEx = dwNewFlagsEx;
+ cs->autoCloseSeconds = (WORD)SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_GETPOS, 0, 0);
+ break;
+ }
+ case WM_DESTROY: {
+ pContainer->hWndOptions = 0;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TITLEBOX, WM_GETFONT, 0, 0);
- DeleteObject(hFont);
- break;
- }
+ HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TITLEBOX, WM_GETFONT, 0, 0);
+ DeleteObject(hFont);
+ break;
+ }
}
return FALSE;
}
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp
index cf50bf2eac..980010ba5f 100644
--- a/plugins/TabSRMM/src/controls.cpp
+++ b/plugins/TabSRMM/src/controls.cpp
@@ -32,7 +32,7 @@ static WNDPROC OldStatusBarproc = 0;
bool CMenuBar::m_buttonsInit = false;
HHOOK CMenuBar::m_hHook = 0;
-TBBUTTON CMenuBar::m_TbButtons[8] = {0};
+TBBUTTON CMenuBar::m_TbButtons[8] = { 0 };
CMenuBar *CMenuBar::m_Owner = 0;
HBITMAP CMenuBar::m_MimIcon = 0;
int CMenuBar::m_MimIconRefCount = 0;
@@ -58,7 +58,7 @@ CMenuBar::CMenuBar(HWND hwndParent, const TContainerData *pContainer)
HDC hdcTemp = ::CreateCompatibleDC(hdc);
- RECT rc = {0,0,16,16};
+ RECT rc = { 0, 0, 16, 16 };
m_MimIcon = CSkin::CreateAeroCompatibleBitmap(rc, hdcTemp);
HBITMAP hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(hdcTemp, m_MimIcon));
::DrawIconEx(hdcTemp, 0, 0, (HICON)hIcon, 16, 16, 0, 0, DI_NORMAL);
@@ -70,8 +70,8 @@ CMenuBar::CMenuBar(HWND hwndParent, const TContainerData *pContainer)
m_MimIconRefCount++;
- m_hwndToolbar = ::CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAME, NULL, WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_VISIBLE|TBSTYLE_FLAT|TBSTYLE_TRANSPARENT|TBSTYLE_LIST|/*CCS_NOPARENTALIGN|*/CCS_NODIVIDER|CCS_TOP,
- 0, 0, 0, 0, hwndParent, NULL, g_hInst, NULL);
+ m_hwndToolbar = ::CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_LIST |/*CCS_NOPARENTALIGN|*/CCS_NODIVIDER | CCS_TOP,
+ 0, 0, 0, 0, hwndParent, NULL, g_hInst, NULL);
::SendMessage(m_hwndToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
@@ -155,31 +155,31 @@ LONG_PTR CMenuBar::processMsg(const UINT msg, const WPARAM, const LPARAM lParam)
{
if (msg == WM_NOTIFY) {
NMHDR *pNMHDR = (NMHDR*)lParam;
- switch(pNMHDR->code) {
+ switch (pNMHDR->code) {
case NM_CUSTOMDRAW:
- {
- NMCUSTOMDRAW *nm = (NMCUSTOMDRAW*)lParam;
- return customDrawWorker(nm);
- }
+ {
+ NMCUSTOMDRAW *nm = (NMCUSTOMDRAW*)lParam;
+ return customDrawWorker(nm);
+ }
case TBN_DROPDOWN:
- {
- NMTOOLBAR *mtb = (NMTOOLBAR *)lParam;
- return Handle(mtb);
- }
+ {
+ NMTOOLBAR *mtb = (NMTOOLBAR *)lParam;
+ return Handle(mtb);
+ }
case TBN_HOTITEMCHANGE:
- {
- NMTBHOTITEM *nmtb = (NMTBHOTITEM *)lParam;
- if (nmtb->idNew != 0 && m_fTracking && nmtb->idNew != m_activeID && m_activeID != 0) {
- cancel();
- return 0;
- }
- else if (m_fTracking == true && m_activeID == 0 && nmtb->idNew != 0) {
- invoke(nmtb->idNew);
- return 0;
- }
- break;
+ {
+ NMTBHOTITEM *nmtb = (NMTBHOTITEM *)lParam;
+ if (nmtb->idNew != 0 && m_fTracking && nmtb->idNew != m_activeID && m_activeID != 0) {
+ cancel();
+ return 0;
+ }
+ else if (m_fTracking == true && m_activeID == 0 && nmtb->idNew != 0) {
+ invoke(nmtb->idNew);
+ return 0;
}
+ break;
+ }
default:
return -1;
@@ -203,7 +203,7 @@ LRESULT CALLBACK CMenuBar::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
{
CMenuBar *menuBar = reinterpret_cast<CMenuBar *>(::GetWindowLongPtr(hWnd, GWLP_USERDATA));
- switch(msg) {
+ switch (msg) {
case WM_SYSKEYUP:
if (wParam == VK_MENU) {
menuBar->Cancel();
@@ -232,7 +232,7 @@ LONG_PTR CMenuBar::customDrawWorker(NMCUSTOMDRAW *nm)
if (nm->hdr.hwndFrom == m_hwndToolbar) {
NMTBCUSTOMDRAW *nmtb = (NMTBCUSTOMDRAW *)(nm);
- switch(nmtb->nmcd.dwDrawStage) {
+ switch (nmtb->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
if (fMustDraw) {
if (nmtb->nmcd.dwItemSpec == 0) {
@@ -402,10 +402,12 @@ void CMenuBar::invoke(const int id)
if (index == 3 && hContact != 0) {
hMenu = reinterpret_cast<HMENU>(::CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0));
m_isContactMenu = true;
- } else if (index == 0) {
+ }
+ else if (index == 0) {
hMenu = reinterpret_cast<HMENU>(::CallService(MS_CLIST_MENUBUILDMAIN, 0, 0));
m_isMainMenu = true;
- } else
+ }
+ else
hMenu = reinterpret_cast<HMENU>(m_TbButtons[index].dwData);
RECT rcButton;
@@ -539,56 +541,56 @@ void CMenuBar::checkButtons()
m_TbButtons[0].iBitmap = 0;
m_TbButtons[0].iString = 0;
m_TbButtons[0].fsState = TBSTATE_ENABLED;
- m_TbButtons[0].fsStyle = BTNS_DROPDOWN|BTNS_AUTOSIZE;
+ m_TbButtons[0].fsStyle = BTNS_DROPDOWN | BTNS_AUTOSIZE;
m_TbButtons[0].idCommand = 100;
m_TbButtons[0].dwData = 0;
m_TbButtons[1].iBitmap = I_IMAGENONE;
m_TbButtons[1].iString = (INT_PTR)TranslateT("&File");
m_TbButtons[1].fsState = TBSTATE_ENABLED;
- m_TbButtons[1].fsStyle = BTNS_DROPDOWN|BTNS_AUTOSIZE;
+ m_TbButtons[1].fsStyle = BTNS_DROPDOWN | BTNS_AUTOSIZE;
m_TbButtons[1].idCommand = 101;
m_TbButtons[1].dwData = reinterpret_cast<DWORD_PTR>(::GetSubMenu(PluginConfig.getMenuBar(), 0));
m_TbButtons[2].iBitmap = I_IMAGENONE;
m_TbButtons[2].iString = (INT_PTR)TranslateT("&View");
m_TbButtons[2].fsState = TBSTATE_ENABLED;
- m_TbButtons[2].fsStyle = BTNS_DROPDOWN|BTNS_AUTOSIZE;
+ m_TbButtons[2].fsStyle = BTNS_DROPDOWN | BTNS_AUTOSIZE;
m_TbButtons[2].idCommand = 102;
m_TbButtons[2].dwData = reinterpret_cast<DWORD_PTR>(::GetSubMenu(PluginConfig.getMenuBar(), 1));
m_TbButtons[3].iBitmap = I_IMAGENONE;
m_TbButtons[3].iString = (INT_PTR)TranslateT("&User");
m_TbButtons[3].fsState = TBSTATE_ENABLED;
- m_TbButtons[3].fsStyle = BTNS_DROPDOWN|BTNS_AUTOSIZE;
+ m_TbButtons[3].fsStyle = BTNS_DROPDOWN | BTNS_AUTOSIZE;
m_TbButtons[3].idCommand = 103;
m_TbButtons[3].dwData = 0; // dynamically built by Clist service
m_TbButtons[4].iBitmap = I_IMAGENONE;
m_TbButtons[4].iString = (INT_PTR)TranslateT("&Room");
m_TbButtons[4].fsState = TBSTATE_ENABLED;
- m_TbButtons[4].fsStyle = BTNS_DROPDOWN|BTNS_AUTOSIZE;
+ m_TbButtons[4].fsStyle = BTNS_DROPDOWN | BTNS_AUTOSIZE;
m_TbButtons[4].idCommand = 104;
m_TbButtons[4].dwData = 0;
m_TbButtons[5].iBitmap = I_IMAGENONE;
m_TbButtons[5].iString = (INT_PTR)TranslateT("Message &log");
m_TbButtons[5].fsState = TBSTATE_ENABLED;
- m_TbButtons[5].fsStyle = BTNS_DROPDOWN|BTNS_AUTOSIZE;
+ m_TbButtons[5].fsStyle = BTNS_DROPDOWN | BTNS_AUTOSIZE;
m_TbButtons[5].idCommand = 105;
m_TbButtons[5].dwData = reinterpret_cast<DWORD_PTR>(::GetSubMenu(PluginConfig.getMenuBar(), 2));
m_TbButtons[6].iBitmap = I_IMAGENONE;
m_TbButtons[6].iString = (INT_PTR)TranslateT("&Container");
m_TbButtons[6].fsState = TBSTATE_ENABLED;
- m_TbButtons[6].fsStyle = BTNS_DROPDOWN|BTNS_AUTOSIZE;
+ m_TbButtons[6].fsStyle = BTNS_DROPDOWN | BTNS_AUTOSIZE;
m_TbButtons[6].idCommand = 106;
m_TbButtons[6].dwData = reinterpret_cast<DWORD_PTR>(::GetSubMenu(PluginConfig.getMenuBar(), 3));
m_TbButtons[7].iBitmap = I_IMAGENONE;
m_TbButtons[7].iString = (INT_PTR)TranslateT("Help");
m_TbButtons[7].fsState = TBSTATE_ENABLED;
- m_TbButtons[7].fsStyle = BTNS_DROPDOWN|BTNS_AUTOSIZE;
+ m_TbButtons[7].fsStyle = BTNS_DROPDOWN | BTNS_AUTOSIZE;
m_TbButtons[7].idCommand = 107;
m_TbButtons[7].dwData = reinterpret_cast<DWORD_PTR>(::GetSubMenu(PluginConfig.getMenuBar(), 4));
@@ -608,7 +610,7 @@ void CMenuBar::checkButtons()
void CMenuBar::resetLP()
{
- while ( SendMessage(m_hwndToolbar, TB_DELETEBUTTON, 0, 0));
+ while (SendMessage(m_hwndToolbar, TB_DELETEBUTTON, 0, 0));
m_buttonsInit = false;
checkButtons();
@@ -630,7 +632,7 @@ LRESULT CALLBACK CMenuBar::MessageHook(int nCode, WPARAM wParam, LPARAM lParam)
POINT pt;
if (nCode == MSGF_MENU) {
- switch(pMsg->message) {
+ switch (pMsg->message) {
case WM_KEYDOWN:
if (pMsg->wParam == VK_ESCAPE)
fCancel = true;
@@ -653,7 +655,7 @@ LRESULT CALLBACK CMenuBar::MessageHook(int nCode, WPARAM wParam, LPARAM lParam)
return 0;
}
- // allow hottracking by the toolbar control
+ // allow hottracking by the toolbar control
case WM_MOUSEMOVE:
::GetCursorPos(&pt);
::ScreenToClient(m_Owner->m_hwndToolbar, &pt);
@@ -679,7 +681,7 @@ LRESULT CALLBACK CMenuBar::MessageHook(int nCode, WPARAM wParam, LPARAM lParam)
// window procedure for the status bar class.
static int tooltip_active = FALSE;
-static POINT ptMouse = {0};
+static POINT ptMouse = { 0 };
RECT rcLastStatusBarClick; // remembers click (down event) point for status bar clicks
LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -689,7 +691,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
POINT pt;
if (OldStatusBarproc == 0) {
- WNDCLASSEX wc = {0};
+ WNDCLASSEX wc = { 0 };
wc.cbSize = sizeof(wc);
GetClassInfoEx(g_hInst, STATUSCLASSNAME, &wc);
OldStatusBarproc = wc.lpfnWndProc;
@@ -892,28 +894,28 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
}
return 0;
- // tell status bar to update the part layout (re-calculate part widths)
- // needed when an icon is added to or removed from the icon area
+ // tell status bar to update the part layout (re-calculate part widths)
+ // needed when an icon is added to or removed from the icon area
case WM_USER + 101:
- {
- int list_icons = 0;
- dat = (TWindowData*)lParam;
- if (dat)
- while ( Srmm_GetNthIcon(dat->hContact, list_icons))
- list_icons++;
-
- SendMessage(hWnd, WM_SIZE, 0, 0);
-
- RECT rcs;
- GetWindowRect(hWnd, &rcs);
-
- int statwidths[5];
- statwidths[0] = (rcs.right - rcs.left) - (2 * SB_CHAR_WIDTH + 20) - (list_icons * (PluginConfig.m_smcxicon + 2));
- statwidths[1] = (rcs.right - rcs.left) - (10 + (list_icons * (PluginConfig.m_smcxicon + 2)));
- statwidths[2] = -1;
- SendMessage(hWnd, SB_SETPARTS, 3, (LPARAM)statwidths);
- }
- return 0;
+ {
+ int list_icons = 0;
+ dat = (TWindowData*)lParam;
+ if (dat)
+ while (Srmm_GetNthIcon(dat->hContact, list_icons))
+ list_icons++;
+
+ SendMessage(hWnd, WM_SIZE, 0, 0);
+
+ RECT rcs;
+ GetWindowRect(hWnd, &rcs);
+
+ int statwidths[5];
+ statwidths[0] = (rcs.right - rcs.left) - (2 * SB_CHAR_WIDTH + 20) - (list_icons * (PluginConfig.m_smcxicon + 2));
+ statwidths[1] = (rcs.right - rcs.left) - (10 + (list_icons * (PluginConfig.m_smcxicon + 2)));
+ statwidths[2] = -1;
+ SendMessage(hWnd, SB_SETPARTS, 3, (LPARAM)statwidths);
+ }
+ return 0;
case WM_SETCURSOR:
GetCursorPos(&pt);
@@ -965,21 +967,21 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
RECT rc;
SIZE size;
TCHAR wBuf[512]; wBuf[0] = 0;
- CLCINFOTIP ti = {0};
+ CLCINFOTIP ti = { 0 };
ti.cbSize = sizeof(ti);
ti.ptCursor = pt;
ScreenToClient(hWnd, &pt);
SendMessage(hWnd, SB_GETRECT, 2, (LPARAM)&rc);
- if ( PtInRect(&rc, pt)) {
+ if (PtInRect(&rc, pt)) {
unsigned int iconNum = (pt.x - rc.left) / (PluginConfig.m_smcxicon + 2);
StatusIconData *sid = Srmm_GetNthIcon(dat->hContact, iconNum);
if (sid == NULL)
break;
- if ( !strcmp(sid->szModule, MSG_ICON_MODULE)) {
+ if (!strcmp(sid->szModule, MSG_ICON_MODULE)) {
if (sid->dwId == MSG_ICON_SOUND && pContainer)
mir_sntprintf(wBuf, SIZEOF(wBuf), TranslateT("Sounds are %s. Click to toggle status, hold SHIFT and click to set for all open containers"),
- pContainer->dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
+ pContainer->dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
else if (sid->dwId == MSG_ICON_UTN && dat && (dat->bType == SESSIONTYPE_IM || dat->si->iType == GCW_PRIVMESS)) {
int mtnStatus = db_get_b(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
@@ -1000,7 +1002,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
SendMessage(hWnd, SB_GETRECT, 1, (LPARAM)&rc);
if (PtInRect(&rc, pt)) {
int iLength = 0;
- GETTEXTLENGTHEX gtxl = {0};
+ GETTEXTLENGTHEX gtxl = { 0 };
int iQueued = db_get_dw(dat->hContact, "SendLater", "count", 0);
gtxl.codepage = CP_UTF8;
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
@@ -1015,16 +1017,16 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
if (SendMessage(dat->pContainer->hwndStatus, SB_GETTEXT, 0, (LPARAM)wBuf)) {
HDC hdc;
- int iLen=SendMessage(dat->pContainer->hwndStatus,SB_GETTEXTLENGTH,0,0);
+ int iLen = SendMessage(dat->pContainer->hwndStatus, SB_GETTEXTLENGTH, 0, 0);
SendMessage(hWnd, SB_GETRECT, 0, (LPARAM)&rc);
- GetTextExtentPoint32( hdc=GetDC( dat->pContainer->hwndStatus), wBuf, iLen, &size );
- ReleaseDC (dat->pContainer->hwndStatus,hdc);
+ GetTextExtentPoint32(hdc = GetDC(dat->pContainer->hwndStatus), wBuf, iLen, &size);
+ ReleaseDC(dat->pContainer->hwndStatus, hdc);
- if (PtInRect(&rc,pt)&&((rc.right-rc.left)<size.cx)) {
- DBVARIANT dbv={0};
+ if (PtInRect(&rc, pt) && ((rc.right - rc.left) < size.cx)) {
+ DBVARIANT dbv = { 0 };
if (dat->bType == SESSIONTYPE_CHAT)
- db_get_ts(dat->hContact,dat->szProto,"Topic",&dbv);
+ db_get_ts(dat->hContact, dat->szProto, "Topic", &dbv);
tooltip_active = TRUE;
CallService("mToolTip/ShowTipW", (WPARAM)dbv.ptszVal, (LPARAM)&ti);
diff --git a/plugins/TabSRMM/src/controls.h b/plugins/TabSRMM/src/controls.h
index 4f6b69eaff..25f6568c04 100644
--- a/plugins/TabSRMM/src/controls.h
+++ b/plugins/TabSRMM/src/controls.h
@@ -79,42 +79,42 @@ public:
const int idToIndex(const int id) const
{
- for (int i=0; i < NR_BUTTONS; i++) {
- if (m_TbButtons[i].idCommand == id )
+ for (int i = 0; i < NR_BUTTONS; i++) {
+ if (m_TbButtons[i].idCommand == id)
return(i);
}
return -1;
}
public:
static HHOOK m_hHook;
- static HBITMAP m_MimIcon;
+ static HBITMAP m_MimIcon;
private:
- HWND m_hwndToolbar;
- RECT m_rcClient;
- TContainerData *m_pContainer;
- HMENU m_activeMenu, m_activeSubMenu;
- int m_activeID;
- bool m_fTracking;
- bool m_isContactMenu;
- bool m_isMainMenu;
- bool m_isAero;
- bool m_mustAutoHide;
- LONG m_size_y;
+ HWND m_hwndToolbar;
+ RECT m_rcClient;
+ TContainerData *m_pContainer;
+ HMENU m_activeMenu, m_activeSubMenu;
+ int m_activeID;
+ bool m_fTracking;
+ bool m_isContactMenu;
+ bool m_isMainMenu;
+ bool m_isAero;
+ bool m_mustAutoHide;
+ LONG m_size_y;
- /*
- * for custom drawing
- */
- RECT m_rcItem;
- HDC m_hdcDraw;
- HBITMAP m_hbmDraw, m_hbmOld;
- HANDLE m_hTheme;
- HFONT m_hOldFont;
+ /*
+ * for custom drawing
+ */
+ RECT m_rcItem;
+ HDC m_hdcDraw;
+ HBITMAP m_hbmDraw, m_hbmOld;
+ HANDLE m_hTheme;
+ HFONT m_hOldFont;
- static TBBUTTON m_TbButtons[8];
- static bool m_buttonsInit;
- static CMenuBar *m_Owner;
- static int m_MimIconRefCount;
+ static TBBUTTON m_TbButtons[8];
+ static bool m_buttonsInit;
+ static CMenuBar *m_Owner;
+ static int m_MimIconRefCount;
private:
LONG_PTR customDrawWorker(NMCUSTOMDRAW *nm);
void updateState(const HMENU hMenu) const;
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp
index 48b014b8d2..0765a23fc8 100644
--- a/plugins/TabSRMM/src/eventpopups.cpp
+++ b/plugins/TabSRMM/src/eventpopups.cpp
@@ -54,7 +54,7 @@ static PLUGIN_DATAT* PU_GetByContact(const MCONTACT hContact)
*/
static void PU_CleanUp()
{
- for (int i=arPopupList.getCount()-1; i >= 0; i--) {
+ for (int i = arPopupList.getCount() - 1; i >= 0; i--) {
PLUGIN_DATAT *p = arPopupList[i];
if (p->hContact != NULL)
continue;
@@ -98,7 +98,7 @@ int TSAPI NEN_ReadOptions(NEN_OPTIONS *options)
options->bNoRSS = (BOOL)M.GetByte(MODULE, OPT_NORSS, FALSE);
options->iDisable = (BYTE)M.GetByte(MODULE, OPT_DISABLE, 0);
options->iMUCDisable = (BYTE)M.GetByte(MODULE, OPT_MUCDISABLE, 0);
- options->dwStatusMask = (DWORD)M.GetDword(MODULE, "statusmask", (DWORD) - 1);
+ options->dwStatusMask = (DWORD)M.GetDword(MODULE, "statusmask", (DWORD)-1);
options->bTraySupport = (BOOL)M.GetByte(MODULE, "traysupport", 0);
options->bWindowCheck = (BOOL)M.GetByte(MODULE, OPT_WINDOWCHECK, 0);
options->bNoRSS = (BOOL)M.GetByte(MODULE, OPT_NORSS, 0);
@@ -154,7 +154,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
if (!PluginConfig.g_bPopupAvail) {
HWND hwndChild = FindWindowEx(hWnd, 0, 0, 0);
- while(hwndChild) {
+ while (hwndChild) {
ShowWindow(hwndChild, SW_HIDE);
hwndChild = FindWindowEx(hWnd, hwndChild, 0, 0);
}
@@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
bWmNotify = TRUE;
break;
- // configure the option page - hide most of the settings here when either IEView
+ // configure the option page - hide most of the settings here when either IEView
case DM_STATUSMASKSET:
db_set_dw(0, MODULE, "statusmask", (DWORD)lParam);
options->dwStatusMask = (int)lParam;
@@ -229,7 +229,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
break;
case IDC_POPUPSTATUSMODES:
- hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), hWnd, DlgProcSetupStatusModes, M.GetDword(MODULE, "statusmask", (DWORD) - 1));
+ hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), hWnd, DlgProcSetupStatusModes, M.GetDword(MODULE, "statusmask", (DWORD)-1));
SendMessage(hwndNew, DM_SETPARENTDIALOG, 0, (LPARAM)hWnd);
break;
@@ -331,7 +331,7 @@ static int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATAT* pdata)
{
pdata->iActionTaken = TRUE;
if (mask & MASK_OPEN) {
- for (int i=0; i < pdata->nrMerged; i++) {
+ for (int i = 0; i < pdata->nrMerged; i++) {
if (pdata->eventData[i].hEvent != 0) {
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_HANDLECLISTEVENT, (WPARAM)pdata->hContact, (LPARAM)pdata->eventData[i].hEvent);
pdata->eventData[i].hEvent = 0;
@@ -339,7 +339,7 @@ static int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATAT* pdata)
}
}
if (mask & MASK_REMOVE) {
- for (int i=0; i < pdata->nrMerged; i++) {
+ for (int i = 0; i < pdata->nrMerged; i++) {
if (pdata->eventData[i].hEvent != 0) {
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_REMOVECLISTEVENT, (WPARAM)pdata->hContact, (LPARAM)pdata->eventData[i].hEvent);
pdata->eventData[i].hEvent = 0;
@@ -426,7 +426,7 @@ static TCHAR* ShortenPreview(DBEVENTINFO* dbe)
fAddEllipsis = true;
size_t iIndex = iPreviewLimit;
size_t iWordThreshold = 20;
- while(iIndex && buf[iIndex] != ' ' && iWordThreshold--)
+ while (iIndex && buf[iIndex] != ' ' && iWordThreshold--)
buf[iIndex--] = 0;
buf[iIndex] = 0;
@@ -447,7 +447,7 @@ static TCHAR* GetPreviewT(WORD eventType, DBEVENTINFO* dbe)
if (pBlob && nen_options.bPreview)
return ShortenPreview(dbe);
- return mir_tstrdup( TranslateT("Message"));
+ return mir_tstrdup(TranslateT("Message"));
case EVENTTYPE_FILE:
if (pBlob) {
@@ -462,11 +462,11 @@ static TCHAR* GetPreviewT(WORD eventType, DBEVENTINFO* dbe)
if (dbe->cbBlob > (sizeof(DWORD) + namelength + 1))
szDescr = szFileName + namelength + 1;
- ptrT tszFileName( DbGetEventStringT(dbe, szFileName));
+ ptrT tszFileName(DbGetEventStringT(dbe, szFileName));
TCHAR buf[1024];
if (szDescr && Utils::safe_strlen(szDescr, dbe->cbBlob - sizeof(DWORD) - namelength - 1) > 0) {
- ptrT tszDescr( DbGetEventStringT(dbe, szDescr));
+ ptrT tszDescr(DbGetEventStringT(dbe, szDescr));
if (tszFileName && tszDescr) {
mir_sntprintf(buf, SIZEOF(buf), _T("%s: %s (%s)"), TranslateT("Incoming file"), tszFileName, tszDescr);
return mir_tstrdup(buf);
@@ -580,7 +580,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, MEVENT hEve
if (hEvent == 0 && hContact == 0)
dbe.szModule = Translate("Unknown module or contact");
- POPUPDATAT pud = {0};
+ POPUPDATAT pud = { 0 };
long iSeconds;
switch (eventType) {
case EVENTTYPE_MESSAGE:
@@ -633,7 +633,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, MEVENT hEve
pdata->nrMerged = 1;
// fix for broken popups -- process failures
- if ( PUAddPopupT(&pud) < 0) {
+ if (PUAddPopupT(&pud) < 0) {
mir_free(pdata->eventData);
mir_free(pdata);
}
@@ -660,7 +660,7 @@ void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced)
if (PluginConfig.g_hMenuTrayUnread == 0 || dat->hContact == NULL)
return;
- MENUITEMINFO mii = {0};
+ MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA | MIIM_BITMAP;
@@ -797,10 +797,10 @@ int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, WORD eventType, int wi
return 0;
}
passed:
- if ( !PluginConfig.g_bPopupAvail)
+ if (!PluginConfig.g_bPopupAvail)
return 0;
- if ( PU_GetByContact(hContact) && nen_options.bMergePopup && eventType == EVENTTYPE_MESSAGE) {
+ if (PU_GetByContact(hContact) && nen_options.bMergePopup && eventType == EVENTTYPE_MESSAGE) {
if (PopupUpdateT(hContact, hDbEvent) != 0)
PopupShowT(&nen_options, hContact, hDbEvent, eventType, pContainer ? pContainer->hwnd : 0);
}
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h
index bfffb4fbd6..062db0a300 100644
--- a/plugins/TabSRMM/src/functions.h
+++ b/plugins/TabSRMM/src/functions.h
@@ -60,7 +60,7 @@ void TSAPI FlashTrayIcon(HICON hIcon);
void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced);
void TSAPI LoadFavoritesAndRecent();
void TSAPI AddContactToFavorites(MCONTACT hContact, const TCHAR *szNickname, const char *szProto, TCHAR *szStatus,
- WORD wStatus, HICON hIcon, BOOL mode, HMENU hMenu);
+ WORD wStatus, HICON hIcon, BOOL mode, HMENU hMenu);
void TSAPI CreateTrayMenus(int mode);
void TSAPI HandleMenuEntryFromhContact(MCONTACT iSelection);
@@ -70,7 +70,7 @@ void TSAPI HandleMenuEntryFromhContact(MCONTACT iSelection);
BOOL TSAPI IsUtfSendAvailable(MCONTACT hContact);
HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, int isSend,
- const char *pszInitialText, BOOL bActivateTAb, BOOL bPopupContainer, BOOL bWantPopup, MEVENT hdbEvent);
+ const char *pszInitialText, BOOL bActivateTAb, BOOL bPopupContainer, BOOL bWantPopup, MEVENT hdbEvent);
int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd);
void TSAPI FlashContainer(TContainerData *pContainer, int iMode, int iNum);
void TSAPI CreateImageList(BOOL bInitial);
@@ -109,7 +109,7 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
* skinning engine
*/
void TSAPI DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor2,
- BYTE transparent, BYTE FLG_GRADIENT, BYTE FLG_CORNER, DWORD BORDERSTYLE, CImageItem *imageItem);
+ BYTE transparent, BYTE FLG_GRADIENT, BYTE FLG_CORNER, DWORD BORDERSTYLE, CImageItem *imageItem);
// the cached message log icons
void TSAPI CacheMsgLogIcons();
diff --git a/plugins/TabSRMM/src/generic_msghandlers.h b/plugins/TabSRMM/src/generic_msghandlers.h
index 57f971425b..40fc324e76 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.h
+++ b/plugins/TabSRMM/src/generic_msghandlers.h
@@ -46,7 +46,7 @@ void TSAPI BB_InitDlgButtons(TWindowData *dat);
BOOL TSAPI BB_SetButtonsPos(TWindowData *dat);
void TSAPI BB_RedrawButtons(TWindowData *dat);
-void TSAPI BB_CustomButtonClick(TWindowData *dat,DWORD idFrom ,HWND hwndFrom, BOOL code) ;
+void TSAPI BB_CustomButtonClick(TWindowData *dat, DWORD idFrom, HWND hwndFrom, BOOL code);
void TSAPI DM_EventAdded(TWindowData *dat, WPARAM wParam, LPARAM lParam);
void TSAPI DM_InitRichEdit(TWindowData *dat);
LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index c69c2e941f..387ae9b138 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -51,17 +51,17 @@ int CGlobals::m_exLine = 0;
bool CGlobals::m_exAllowContinue = false;
#if defined(_WIN64)
- static char szCurrentVersion[30];
- static char *szVersionUrl = "http://download.miranda.or.at/tabsrmm/3/version.txt";
- static char *szUpdateUrl = "http://miranda-ng.org/distr/x64/Plugins/tabsrmm.zip";
- static char *szFLVersionUrl = "http://miranda-ng.org/";
- static char *szFLUpdateurl = "http://miranda-ng.org/";
+static char szCurrentVersion[30];
+static char *szVersionUrl = "http://download.miranda.or.at/tabsrmm/3/version.txt";
+static char *szUpdateUrl = "http://miranda-ng.org/distr/x64/Plugins/tabsrmm.zip";
+static char *szFLVersionUrl = "http://miranda-ng.org/";
+static char *szFLUpdateurl = "http://miranda-ng.org/";
#else
- static char szCurrentVersion[30];
- static char *szVersionUrl = "http://download.miranda.or.at/tabsrmm/3/version.txt";
- static char *szUpdateUrl = "http://miranda-ng.org/distr/x32/Plugins/tabsrmm.zip";
- static char *szFLVersionUrl = "http://miranda-ng.org/";
- static char *szFLUpdateurl = "http://miranda-ng.org/";
+static char szCurrentVersion[30];
+static char *szVersionUrl = "http://download.miranda.or.at/tabsrmm/3/version.txt";
+static char *szUpdateUrl = "http://miranda-ng.org/distr/x32/Plugins/tabsrmm.zip";
+static char *szFLVersionUrl = "http://miranda-ng.org/";
+static char *szFLUpdateurl = "http://miranda-ng.org/";
#endif
/////////////////////////////////////////////////////////////////////////////////////////
@@ -83,11 +83,11 @@ void CGlobals::reloadSystemStartup()
PluginConfig.g_hMenuContext = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_TABCONTEXT));
TranslateMenu(g_hMenuContext);
- SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (focused window)"));
+ SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (focused window)"));
SkinAddNewSoundEx("RecvMsgInactive", LPGEN("Instant messages"), LPGEN("Incoming (unfocused window)"));
- SkinAddNewSoundEx("AlertMsg", LPGEN("Instant messages"), LPGEN("Incoming (new session)"));
- SkinAddNewSoundEx("SendMsg", LPGEN("Instant messages"), LPGEN("Outgoing"));
- SkinAddNewSoundEx("SendError", LPGEN("Instant messages"), LPGEN("Message send error"));
+ SkinAddNewSoundEx("AlertMsg", LPGEN("Instant messages"), LPGEN("Incoming (new session)"));
+ SkinAddNewSoundEx("SendMsg", LPGEN("Instant messages"), LPGEN("Outgoing"));
+ SkinAddNewSoundEx("SendError", LPGEN("Instant messages"), LPGEN("Message send error"));
hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);
@@ -263,7 +263,7 @@ void CGlobals::hookSystemEvents()
HookEvent(ME_AV_MYAVATARCHANGED, ::MyAvatarChanged);
}
-int CGlobals::TopToolbarLoaded(WPARAM,LPARAM)
+int CGlobals::TopToolbarLoaded(WPARAM, LPARAM)
{
TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h
index 73a2aeafb3..3444094437 100644
--- a/plugins/TabSRMM/src/globals.h
+++ b/plugins/TabSRMM/src/globals.h
@@ -39,7 +39,7 @@ struct TSplitterBroadCast {
BYTE bSync;
};
-typedef BOOL (WINAPI *pfnSetMenuInfo )( HMENU hmenu, LPCMENUINFO lpcmi );
+typedef BOOL(WINAPI *pfnSetMenuInfo)(HMENU hmenu, LPCMENUINFO lpcmi);
class CGlobals
{
@@ -56,36 +56,36 @@ public:
::DestroyMenu(m_MenuBar);
}
void reloadAdv();
- void reloadSystemStartup();
- void reloadSystemModulesChanged();
- void reloadSettings(bool fReloadSkins = true);
-
- void hookSystemEvents();
- bool haveAutoSwitch();
-
- const HMENU getMenuBar();
-
- HWND g_hwndHotkeyHandler;
- HICON g_iconIn, g_iconOut, g_iconErr, g_iconContainer, g_iconStatus;
- HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock;
- HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
- HBITMAP g_hbmUnknown;
- bool g_SmileyAddAvail, g_WantIEView, g_bPopupAvail, g_WantHPP;
- HIMAGELIST g_hImageList;
- HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend;
- HICON g_IconMsgEventBig, g_IconTypingEventBig;
- HICON g_IconGroupOpen, g_IconGroupClose, g_IconChecked, g_IconUnchecked;
- HMENU g_hMenuContext, g_hMenuContainer, g_hMenuEncoding, g_hMenuTrayUnread;
- HMENU g_hMenuFavorites, g_hMenuRecent, g_hMenuTrayContext;
- HICON g_buttonBarIcons[NR_BUTTONBARICONS];
- HICON g_sideBarIcons[NR_SIDEBARICONS];
- HANDLE g_buttonBarIconHandles[23];
+ void reloadSystemStartup();
+ void reloadSystemModulesChanged();
+ void reloadSettings(bool fReloadSkins = true);
+
+ void hookSystemEvents();
+ bool haveAutoSwitch();
+
+ const HMENU getMenuBar();
+
+ HWND g_hwndHotkeyHandler;
+ HICON g_iconIn, g_iconOut, g_iconErr, g_iconContainer, g_iconStatus;
+ HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock;
+ HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
+ HBITMAP g_hbmUnknown;
+ bool g_SmileyAddAvail, g_WantIEView, g_bPopupAvail, g_WantHPP;
+ HIMAGELIST g_hImageList;
+ HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend;
+ HICON g_IconMsgEventBig, g_IconTypingEventBig;
+ HICON g_IconGroupOpen, g_IconGroupClose, g_IconChecked, g_IconUnchecked;
+ HMENU g_hMenuContext, g_hMenuContainer, g_hMenuEncoding, g_hMenuTrayUnread;
+ HMENU g_hMenuFavorites, g_hMenuRecent, g_hMenuTrayContext;
+ HICON g_buttonBarIcons[NR_BUTTONBARICONS];
+ HICON g_sideBarIcons[NR_SIDEBARICONS];
+ HANDLE g_buttonBarIconHandles[23];
// dynamic options, need reload when options change
int m_iTabNameLimit;
bool m_bAllowTab;
bool m_bSendOnShiftEnter;
- bool m_bSendOnEnter;
+ bool m_bSendOnEnter;
bool m_bSendOnDblEnter;
bool m_bAutoLocaleSupport;
bool m_bAutoSwitchTabs;
@@ -96,54 +96,54 @@ public:
bool m_bUseDividers;
bool m_bSoundOnTyping;
bool m_bAllowOfflineMultisend;
- bool m_bDividersUsePopupConfig;
+ bool m_bDividersUsePopupConfig;
bool m_bFlashOnClist;
bool m_bAlwaysFullToolbarWidth;
bool m_bIdleDetect;
bool m_bDontUseDefaultKbd;
- int m_MsgTimeout;
- int m_EscapeCloses;
- int m_LimitStaticAvatarHeight;
- int m_SendFormat;
- int m_UnreadInTray;
- int m_TrayFlashes;
- int m_TrayFlashState;
- HANDLE m_UserMenuItem;
- double m_DPIscaleX;
- double m_DPIscaleY;
- HBITMAP m_hbmMsgArea;
- BYTE m_iButtonsBarGap;
- BYTE m_WinVerMajor;
- BYTE m_WinVerMinor;
- bool m_bIsVista, m_bIsWin7;
- HWND m_hwndClist;
- int m_TabAppearance;
- myTabCtrl tabConfig;
- int m_panelHeight, m_MUCpanelHeight;
- int m_smcxicon, m_smcyicon;
- int m_PasteAndSend;
- COLORREF crIncoming, crOutgoing, crOldIncoming, crOldOutgoing, crStatus;
- BOOL bUnicodeBuild;
- HFONT hFontCaption;
- DWORD m_LangPackCP;
- BYTE m_SmileyButtonOverride;
- HICON m_AnimTrayIcons[4];
- BOOL m_visualMessageSizeIndicator;
- BOOL m_autoSplit;
- BOOL m_FlashOnMTN;
- DWORD dwThreadID;
- HANDLE m_hMessageWindowList, hUserPrefsWindowList;
- HMENU m_MenuBar;
- COLORREF m_ipBackgroundGradient;
- COLORREF m_ipBackgroundGradientHigh;
- COLORREF m_tbBackgroundHigh, m_tbBackgroundLow, m_fillColor, m_cRichBorders, m_genericTxtColor;
- HANDLE m_event_MsgWin, m_event_MsgPopup, m_event_WriteEvent;
- HGENMENU m_hMenuItem;
- BYTE m_useAeroPeek;
-
- WINDOWPLACEMENT m_GlobalContainerWpos;
- NONCLIENTMETRICS m_ncm;
+ int m_MsgTimeout;
+ int m_EscapeCloses;
+ int m_LimitStaticAvatarHeight;
+ int m_SendFormat;
+ int m_UnreadInTray;
+ int m_TrayFlashes;
+ int m_TrayFlashState;
+ HANDLE m_UserMenuItem;
+ double m_DPIscaleX;
+ double m_DPIscaleY;
+ HBITMAP m_hbmMsgArea;
+ BYTE m_iButtonsBarGap;
+ BYTE m_WinVerMajor;
+ BYTE m_WinVerMinor;
+ bool m_bIsVista, m_bIsWin7;
+ HWND m_hwndClist;
+ int m_TabAppearance;
+ myTabCtrl tabConfig;
+ int m_panelHeight, m_MUCpanelHeight;
+ int m_smcxicon, m_smcyicon;
+ int m_PasteAndSend;
+ COLORREF crIncoming, crOutgoing, crOldIncoming, crOldOutgoing, crStatus;
+ BOOL bUnicodeBuild;
+ HFONT hFontCaption;
+ DWORD m_LangPackCP;
+ BYTE m_SmileyButtonOverride;
+ HICON m_AnimTrayIcons[4];
+ BOOL m_visualMessageSizeIndicator;
+ BOOL m_autoSplit;
+ BOOL m_FlashOnMTN;
+ DWORD dwThreadID;
+ HANDLE m_hMessageWindowList, hUserPrefsWindowList;
+ HMENU m_MenuBar;
+ COLORREF m_ipBackgroundGradient;
+ COLORREF m_ipBackgroundGradientHigh;
+ COLORREF m_tbBackgroundHigh, m_tbBackgroundLow, m_fillColor, m_cRichBorders, m_genericTxtColor;
+ HANDLE m_event_MsgWin, m_event_MsgPopup, m_event_WriteEvent;
+ HGENMENU m_hMenuItem;
+ BYTE m_useAeroPeek;
+
+ WINDOWPLACEMENT m_GlobalContainerWpos;
+ NONCLIENTMETRICS m_ncm;
TSplitterBroadCast lastSPlitterPos;
TContainerSettings globalContainerSettings;
@@ -163,7 +163,7 @@ private:
static int m_exLine;
static bool m_exAllowContinue;
private:
- static int TopToolbarLoaded(WPARAM,LPARAM);
+ static int TopToolbarLoaded(WPARAM, LPARAM);
static int ModulesLoaded(WPARAM wParam, LPARAM lParam);
static int DBSettingChanged(WPARAM wParam, LPARAM lParam);
static int DBContactDeleted(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index d87c22c912..91426f00e3 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -40,24 +40,24 @@ static UINT WM_TASKBARCREATED;
static HANDLE hSvcHotkeyProcessor = 0;
static HOTKEYDESC _hotkeydescs[] = {
- { 0, "tabsrmm_mostrecent", LPGEN("Most recent unread session"), TABSRMM_HK_SECTION_IM, MS_TABMSG_HOTKEYPROCESS, HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'R'), TABSRMM_HK_LASTUNREAD },
- { 0, "tabsrmm_paste_and_send", LPGEN("Paste and send"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'D'), TABSRMM_HK_PASTEANDSEND },
- { 0, "tabsrmm_uprefs", LPGEN("Contact's messaging preferences"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'C'), TABSRMM_HK_SETUSERPREFS },
+ { 0, "tabsrmm_mostrecent", LPGEN("Most recent unread session"), TABSRMM_HK_SECTION_IM, MS_TABMSG_HOTKEYPROCESS, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'R'), TABSRMM_HK_LASTUNREAD },
+ { 0, "tabsrmm_paste_and_send", LPGEN("Paste and send"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'D'), TABSRMM_HK_PASTEANDSEND },
+ { 0, "tabsrmm_uprefs", LPGEN("Contact's messaging preferences"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C'), TABSRMM_HK_SETUSERPREFS },
{ 0, "tabsrmm_copts", LPGEN("Container options"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'O'), TABSRMM_HK_CONTAINEROPTIONS },
{ 0, "tabsrmm_nudge", LPGEN("Send nudge"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'N'), TABSRMM_HK_NUDGE },
{ 0, "tabsrmm_sendfile", LPGEN("Send a file"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'F'), TABSRMM_HK_SENDFILE },
{ 0, "tabsrmm_quote", LPGEN("Quote message"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'Q'), TABSRMM_HK_QUOTEMSG },
- { 0, "tabsrmm_sendlater", LPGEN("Toggle send later"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'S'), TABSRMM_HK_TOGGLESENDLATER },
+ { 0, "tabsrmm_sendlater", LPGEN("Toggle send later"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'S'), TABSRMM_HK_TOGGLESENDLATER },
{ 0, "tabsrmm_send", LPGEN("Send message"), TABSRMM_HK_SECTION_GENERIC, 0, 0, TABSRMM_HK_SEND },
{ 0, "tabsrmm_emot", LPGEN("Smiley selector"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT, 'E'), TABSRMM_HK_EMOTICONS },
{ 0, "tabsrmm_hist", LPGEN("Show message history"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT, 'H'), TABSRMM_HK_HISTORY },
{ 0, "tabsrmm_umenu", LPGEN("Show user menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'D'), TABSRMM_HK_USERMENU },
{ 0, "tabsrmm_udet", LPGEN("Show user details"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'U'), TABSRMM_HK_USERDETAILS },
- { 0, "tabsrmm_tbar", LPGEN("Toggle toolbar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT|HOTKEYF_SHIFT, 'T'), TABSRMM_HK_TOGGLETOOLBAR },
- { 0, "tabsrmm_ipanel", LPGEN("Toggle info panel"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT|HOTKEYF_CONTROL, 'I'), TABSRMM_HK_TOGGLEINFOPANEL },
- { 0, "tabsrmm_rtl", LPGEN("Toggle text direction"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT|HOTKEYF_CONTROL, 'B'), TABSRMM_HK_TOGGLERTL },
- { 0, "tabsrmm_msend", LPGEN("Toggle multi send"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT|HOTKEYF_CONTROL, 'M'), TABSRMM_HK_TOGGLEMULTISEND },
+ { 0, "tabsrmm_tbar", LPGEN("Toggle toolbar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_SHIFT, 'T'), TABSRMM_HK_TOGGLETOOLBAR },
+ { 0, "tabsrmm_ipanel", LPGEN("Toggle info panel"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'I'), TABSRMM_HK_TOGGLEINFOPANEL },
+ { 0, "tabsrmm_rtl", LPGEN("Toggle text direction"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'B'), TABSRMM_HK_TOGGLERTL },
+ { 0, "tabsrmm_msend", LPGEN("Toggle multi send"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'M'), TABSRMM_HK_TOGGLEMULTISEND },
{ 0, "tabsrmm_clearlog", LPGEN("Clear message log"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'L'), TABSRMM_HK_CLEARLOG },
{ 0, "tabsrmm_notes", LPGEN("Edit user notes"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_EDITNOTES },
{ 0, "tabsrmm_sbar", LPGEN("Collapse side bar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(0, VK_F9), TABSRMM_HK_TOGGLESIDEBAR },
@@ -65,7 +65,7 @@ static HOTKEYDESC _hotkeydescs[] = {
{ 0, "tabsrmm_muc_filter", LPGEN("Toggle filter"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'F'), TABSRMM_HK_FILTERTOGGLE },
{ 0, "tabsrmm_muc_nick", LPGEN("Toggle nick list"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_LISTTOGGLE },
{ 0, "tabsrmm_muc_server_show", LPGEN("Show server window"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, '1'), TABSRMM_HK_MUC_SHOWSERVER },
- { 0, "tabsrmm_close_other", LPGEN("Close other tabs"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT|HOTKEYF_CONTROL, 'W'), TABSRMM_HK_CLOSE_OTHER },
+ { 0, "tabsrmm_close_other", LPGEN("Close other tabs"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'W'), TABSRMM_HK_CLOSE_OTHER },
};
LRESULT ProcessHotkeysByMsgFilter(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR ctrlId)
@@ -150,7 +150,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
switch (msg) {
case WM_CREATE:
- for (int i=0; i < SIZEOF(_hotkeydescs); i++) {
+ for (int i = 0; i < SIZEOF(_hotkeydescs); i++) {
_hotkeydescs[i].cbSize = sizeof(HOTKEYDESC);
Hotkey_Register(&_hotkeydescs[i]);
}
@@ -162,202 +162,201 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
break;
case WM_HOTKEY:
- {
- CLISTEVENT *cli = (CLISTEVENT *)CallService(MS_CLIST_GETEVENT, (WPARAM)INVALID_HANDLE_VALUE, 0);
- if (cli != NULL) {
- if (strncmp(cli->pszService, "SRMsg/TypingMessage", strlen(cli->pszService))) {
- CallService(cli->pszService, 0, (LPARAM)cli);
- break;
- }
+ {
+ CLISTEVENT *cli = (CLISTEVENT *)CallService(MS_CLIST_GETEVENT, (WPARAM)INVALID_HANDLE_VALUE, 0);
+ if (cli != NULL) {
+ if (strncmp(cli->pszService, "SRMsg/TypingMessage", strlen(cli->pszService))) {
+ CallService(cli->pszService, 0, (LPARAM)cli);
+ break;
}
- if (wParam == 0xc001)
- SendMessage(hwndDlg, DM_TRAYICONNOTIFY, 101, WM_MBUTTONDOWN);
}
- break;
+ if (wParam == 0xc001)
+ SendMessage(hwndDlg, DM_TRAYICONNOTIFY, 101, WM_MBUTTONDOWN);
+ }
+ break;
// handle the popup menus (session list, favorites, recents...
// just draw some icons, nothing more :)
case WM_MEASUREITEM:
- {
- LPMEASUREITEMSTRUCT lpmi = (LPMEASUREITEMSTRUCT) lParam;
- lpmi->itemHeight = 0;
- lpmi->itemWidth = 6;
- }
- return TRUE;
+ {
+ LPMEASUREITEMSTRUCT lpmi = (LPMEASUREITEMSTRUCT)lParam;
+ lpmi->itemHeight = 0;
+ lpmi->itemWidth = 6;
+ }
+ return TRUE;
case WM_DRAWITEM:
- {
- LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT) lParam;
- TWindowData *dat = 0;
- if (dis->CtlType == ODT_MENU && (dis->hwndItem == (HWND)PluginConfig.g_hMenuFavorites || dis->hwndItem == (HWND)PluginConfig.g_hMenuRecent)) {
- HICON hIcon = (HICON)dis->itemData;
+ {
+ LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
+ TWindowData *dat = 0;
+ if (dis->CtlType == ODT_MENU && (dis->hwndItem == (HWND)PluginConfig.g_hMenuFavorites || dis->hwndItem == (HWND)PluginConfig.g_hMenuRecent)) {
+ HICON hIcon = (HICON)dis->itemData;
+
+ DrawMenuItem(dis, hIcon, 0);
+ return TRUE;
+ }
+ else if (dis->CtlType == ODT_MENU) {
+ HWND hWnd = M.FindWindow((MCONTACT)dis->itemID);
+ DWORD idle = 0;
- DrawMenuItem(dis, hIcon, 0);
- return TRUE;
+ if (hWnd == NULL) {
+ SESSION_INFO *si = SM_FindSessionByHCONTACT((MCONTACT)dis->itemID);
+ hWnd = si ? si->hWnd : 0;
}
- else if (dis->CtlType == ODT_MENU) {
- HWND hWnd = M.FindWindow((MCONTACT)dis->itemID);
- DWORD idle = 0;
-
- if (hWnd == NULL) {
- SESSION_INFO *si = SM_FindSessionByHCONTACT((MCONTACT)dis->itemID);
- hWnd = si ? si->hWnd : 0;
- }
- if (hWnd)
- dat = (TWindowData*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+ if (hWnd)
+ dat = (TWindowData*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
- if (dis->itemData >= 0) {
- HICON hIcon;
+ if (dis->itemData >= 0) {
+ HICON hIcon;
- if (dis->itemData > 0)
- hIcon = dis->itemData & 0x10000000 ? pci->hIcons[ICON_HIGHLIGHT] : PluginConfig.g_IconMsgEvent;
- else if (dat != NULL) {
- hIcon = MY_GetContactIcon(dat, 0);
- idle = dat->idle;
- }
- else hIcon = PluginConfig.g_iconContainer;
-
- DrawMenuItem(dis, hIcon, idle);
- return TRUE;
+ if (dis->itemData > 0)
+ hIcon = dis->itemData & 0x10000000 ? pci->hIcons[ICON_HIGHLIGHT] : PluginConfig.g_IconMsgEvent;
+ else if (dat != NULL) {
+ hIcon = MY_GetContactIcon(dat, 0);
+ idle = dat->idle;
}
+ else hIcon = PluginConfig.g_iconContainer;
+
+ DrawMenuItem(dis, hIcon, idle);
+ return TRUE;
}
}
- break;
+ }
+ break;
case DM_TRAYICONNOTIFY:
if (wParam == 100 || wParam == 101) {
switch (lParam) {
case WM_LBUTTONUP:
- {
- POINT pt;
- GetCursorPos(&pt);
- if (wParam == 100)
- SetForegroundWindow(hwndDlg);
- if (GetMenuItemCount(PluginConfig.g_hMenuTrayUnread) > 0) {
- BOOL iSelection = TrackPopupMenu(PluginConfig.g_hMenuTrayUnread, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- HandleMenuEntryFromhContact((MCONTACT)iSelection);
- }
- else TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 8), TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
-
- if (wParam == 100)
- PostMessage(hwndDlg, WM_NULL, 0, 0);
+ {
+ POINT pt;
+ GetCursorPos(&pt);
+ if (wParam == 100)
+ SetForegroundWindow(hwndDlg);
+ if (GetMenuItemCount(PluginConfig.g_hMenuTrayUnread) > 0) {
+ BOOL iSelection = TrackPopupMenu(PluginConfig.g_hMenuTrayUnread, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ HandleMenuEntryFromhContact((MCONTACT)iSelection);
}
- break;
+ else TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 8), TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+
+ if (wParam == 100)
+ PostMessage(hwndDlg, WM_NULL, 0, 0);
+ }
+ break;
case WM_MBUTTONDOWN:
- {
- if (wParam == 100)
- SetForegroundWindow(hwndDlg);
-
- int iCount = GetMenuItemCount(PluginConfig.g_hMenuTrayUnread);
- if (iCount > 0) {
- UINT uid = 0;
- MENUITEMINFOA mii = {0};
- mii.fMask = MIIM_DATA;
- mii.cbSize = sizeof(mii);
- int i = iCount - 1;
- do {
- GetMenuItemInfoA(PluginConfig.g_hMenuTrayUnread, i, TRUE, &mii);
- if (mii.dwItemData > 0) {
- uid = GetMenuItemID(PluginConfig.g_hMenuTrayUnread, i);
- HandleMenuEntryFromhContact((MCONTACT)uid);
- break;
- }
+ {
+ if (wParam == 100)
+ SetForegroundWindow(hwndDlg);
+
+ int iCount = GetMenuItemCount(PluginConfig.g_hMenuTrayUnread);
+ if (iCount > 0) {
+ UINT uid = 0;
+ MENUITEMINFOA mii = { 0 };
+ mii.fMask = MIIM_DATA;
+ mii.cbSize = sizeof(mii);
+ int i = iCount - 1;
+ do {
+ GetMenuItemInfoA(PluginConfig.g_hMenuTrayUnread, i, TRUE, &mii);
+ if (mii.dwItemData > 0) {
+ uid = GetMenuItemID(PluginConfig.g_hMenuTrayUnread, i);
+ HandleMenuEntryFromhContact((MCONTACT)uid);
+ break;
}
- while (--i >= 0);
-
- if (uid == 0 && pLastActiveContainer != NULL) { // no session found, restore last active container
- if (IsIconic(pLastActiveContainer->hwnd) || !IsWindowVisible(pLastActiveContainer->hwnd)) {
- SendMessage(pLastActiveContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
- SetForegroundWindow(pLastActiveContainer->hwnd);
- SetFocus(GetDlgItem(pLastActiveContainer->hwndActive, IDC_MESSAGE));
- }
- else if (GetForegroundWindow() != pLastActiveContainer->hwnd) {
- SetForegroundWindow(pLastActiveContainer->hwnd);
- SetFocus(GetDlgItem(pLastActiveContainer->hwndActive, IDC_MESSAGE));
- }
- else {
- if (PluginConfig.m_bHideOnClose)
- ShowWindow(pLastActiveContainer->hwnd, SW_HIDE);
- else
- SendMessage(pLastActiveContainer->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- }
+ } while (--i >= 0);
+
+ if (uid == 0 && pLastActiveContainer != NULL) { // no session found, restore last active container
+ if (IsIconic(pLastActiveContainer->hwnd) || !IsWindowVisible(pLastActiveContainer->hwnd)) {
+ SendMessage(pLastActiveContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
+ SetForegroundWindow(pLastActiveContainer->hwnd);
+ SetFocus(GetDlgItem(pLastActiveContainer->hwndActive, IDC_MESSAGE));
+ }
+ else if (GetForegroundWindow() != pLastActiveContainer->hwnd) {
+ SetForegroundWindow(pLastActiveContainer->hwnd);
+ SetFocus(GetDlgItem(pLastActiveContainer->hwndActive, IDC_MESSAGE));
+ }
+ else {
+ if (PluginConfig.m_bHideOnClose)
+ ShowWindow(pLastActiveContainer->hwnd, SW_HIDE);
+ else
+ SendMessage(pLastActiveContainer->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
}
}
- if (wParam == 100)
- PostMessage(hwndDlg, WM_NULL, 0, 0);
}
- break;
+ if (wParam == 100)
+ PostMessage(hwndDlg, WM_NULL, 0, 0);
+ }
+ break;
case WM_RBUTTONUP:
- {
- HMENU submenu = PluginConfig.g_hMenuTrayContext;
- POINT pt;
-
- if (wParam == 100)
- SetForegroundWindow(hwndDlg);
- GetCursorPos(&pt);
- CheckMenuItem(submenu, ID_TRAYCONTEXT_DISABLEALLPOPUPS, MF_BYCOMMAND | (nen_options.iDisable ? MF_CHECKED : MF_UNCHECKED));
- CheckMenuItem(submenu, ID_TRAYCONTEXT_DON40223, MF_BYCOMMAND | (nen_options.iNoSounds ? MF_CHECKED : MF_UNCHECKED));
- CheckMenuItem(submenu, ID_TRAYCONTEXT_DON, MF_BYCOMMAND | (nen_options.iNoAutoPopup ? MF_CHECKED : MF_UNCHECKED));
- EnableMenuItem(submenu, ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS, MF_BYCOMMAND | (nen_options.bTraySupport) ? MF_ENABLED : MF_GRAYED);
- CheckMenuItem(submenu, ID_TRAYCONTEXT_SHOWTHETRAYICON, MF_BYCOMMAND | (nen_options.bTraySupport ? MF_CHECKED : MF_UNCHECKED));
- BOOL iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- if (iSelection) {
- MENUITEMINFO mii = {0};
-
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_DATA | MIIM_ID;
- GetMenuItemInfo(submenu, (UINT_PTR)iSelection, FALSE, &mii);
- if (mii.dwItemData != 0) // this must be an itm of the fav or recent menu
- HandleMenuEntryFromhContact((MCONTACT)iSelection);
- else {
- switch (iSelection) {
- case ID_TRAYCONTEXT_SHOWTHETRAYICON:
- nen_options.bTraySupport = !nen_options.bTraySupport;
- CreateSystrayIcon(nen_options.bTraySupport ? TRUE : FALSE);
- break;
- case ID_TRAYCONTEXT_DISABLEALLPOPUPS:
- nen_options.iDisable ^= 1;
- break;
- case ID_TRAYCONTEXT_DON40223:
- nen_options.iNoSounds ^= 1;
- break;
- case ID_TRAYCONTEXT_DON:
- nen_options.iNoAutoPopup ^= 1;
- break;
- case ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS:
- for (p = pFirstContainer; p; p = p->pNext)
- ShowWindow(p->hwnd, SW_HIDE);
- break;
- case ID_TRAYCONTEXT_RESTOREALLMESSAGECONTAINERS:
- for (p = pFirstContainer; p; p = p->pNext)
- ShowWindow(p->hwnd, SW_SHOW);
- break;
- case ID_TRAYCONTEXT_BE:
- nen_options.iDisable = 1;
- nen_options.iNoSounds = 1;
- nen_options.iNoAutoPopup = 1;
-
- for (p = pFirstContainer; p; p = p->pNext)
- SendMessage(p->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 1);
- break;
- }
+ {
+ HMENU submenu = PluginConfig.g_hMenuTrayContext;
+ POINT pt;
+
+ if (wParam == 100)
+ SetForegroundWindow(hwndDlg);
+ GetCursorPos(&pt);
+ CheckMenuItem(submenu, ID_TRAYCONTEXT_DISABLEALLPOPUPS, MF_BYCOMMAND | (nen_options.iDisable ? MF_CHECKED : MF_UNCHECKED));
+ CheckMenuItem(submenu, ID_TRAYCONTEXT_DON40223, MF_BYCOMMAND | (nen_options.iNoSounds ? MF_CHECKED : MF_UNCHECKED));
+ CheckMenuItem(submenu, ID_TRAYCONTEXT_DON, MF_BYCOMMAND | (nen_options.iNoAutoPopup ? MF_CHECKED : MF_UNCHECKED));
+ EnableMenuItem(submenu, ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS, MF_BYCOMMAND | (nen_options.bTraySupport) ? MF_ENABLED : MF_GRAYED);
+ CheckMenuItem(submenu, ID_TRAYCONTEXT_SHOWTHETRAYICON, MF_BYCOMMAND | (nen_options.bTraySupport ? MF_CHECKED : MF_UNCHECKED));
+ BOOL iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ if (iSelection) {
+ MENUITEMINFO mii = { 0 };
+
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_DATA | MIIM_ID;
+ GetMenuItemInfo(submenu, (UINT_PTR)iSelection, FALSE, &mii);
+ if (mii.dwItemData != 0) // this must be an itm of the fav or recent menu
+ HandleMenuEntryFromhContact((MCONTACT)iSelection);
+ else {
+ switch (iSelection) {
+ case ID_TRAYCONTEXT_SHOWTHETRAYICON:
+ nen_options.bTraySupport = !nen_options.bTraySupport;
+ CreateSystrayIcon(nen_options.bTraySupport ? TRUE : FALSE);
+ break;
+ case ID_TRAYCONTEXT_DISABLEALLPOPUPS:
+ nen_options.iDisable ^= 1;
+ break;
+ case ID_TRAYCONTEXT_DON40223:
+ nen_options.iNoSounds ^= 1;
+ break;
+ case ID_TRAYCONTEXT_DON:
+ nen_options.iNoAutoPopup ^= 1;
+ break;
+ case ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS:
+ for (p = pFirstContainer; p; p = p->pNext)
+ ShowWindow(p->hwnd, SW_HIDE);
+ break;
+ case ID_TRAYCONTEXT_RESTOREALLMESSAGECONTAINERS:
+ for (p = pFirstContainer; p; p = p->pNext)
+ ShowWindow(p->hwnd, SW_SHOW);
+ break;
+ case ID_TRAYCONTEXT_BE:
+ nen_options.iDisable = 1;
+ nen_options.iNoSounds = 1;
+ nen_options.iNoAutoPopup = 1;
+
+ for (p = pFirstContainer; p; p = p->pNext)
+ SendMessage(p->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 1);
+ break;
}
}
- if (wParam == 100)
- PostMessage(hwndDlg, WM_NULL, 0, 0);
- break;
}
+ if (wParam == 100)
+ PostMessage(hwndDlg, WM_NULL, 0, 0);
+ break;
+ }
}
}
break;
- // handle an event from the popup module (mostly window activation). Since popups may run in different threads, the message
- // is posted to our invisible hotkey handler which does always run within the main thread.
- // wParam is the hContact
- // lParam the event handle
+ // handle an event from the popup module (mostly window activation). Since popups may run in different threads, the message
+ // is posted to our invisible hotkey handler which does always run within the main thread.
+ // wParam is the hContact
+ // lParam the event handle
case DM_HANDLECLISTEVENT:
// if lParam == NULL, don't consider clist events, just open the message tab
if (lParam == 0)
@@ -376,42 +375,42 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
break;
case DM_DOCREATETAB:
- {
- HWND hWnd = M.FindWindow(lParam);
- if (hWnd && IsWindow(hWnd)) {
- TContainerData *pContainer = 0;
- SendMessage(hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
- if (pContainer) {
- int iTabs = TabCtrl_GetItemCount(GetDlgItem(pContainer->hwnd, IDC_MSGTABS));
- if (iTabs == 1)
- SendMessage(pContainer->hwnd, WM_CLOSE, 0, 1);
- else
- SendMessage(hWnd, WM_CLOSE, 0, 1);
-
- CreateNewTabForContact((TContainerData*)wParam, lParam, 0, NULL, TRUE, TRUE, FALSE, 0);
- }
+ {
+ HWND hWnd = M.FindWindow(lParam);
+ if (hWnd && IsWindow(hWnd)) {
+ TContainerData *pContainer = 0;
+ SendMessage(hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
+ if (pContainer) {
+ int iTabs = TabCtrl_GetItemCount(GetDlgItem(pContainer->hwnd, IDC_MSGTABS));
+ if (iTabs == 1)
+ SendMessage(pContainer->hwnd, WM_CLOSE, 0, 1);
+ else
+ SendMessage(hWnd, WM_CLOSE, 0, 1);
+
+ CreateNewTabForContact((TContainerData*)wParam, lParam, 0, NULL, TRUE, TRUE, FALSE, 0);
}
}
- break;
+ }
+ break;
case DM_DOCREATETAB_CHAT:
- {
- SESSION_INFO *si = SM_FindSessionByHWND((HWND)lParam);
- if (si && IsWindow(si->hWnd)) {
- TContainerData *pContainer = 0;
- SendMessage(si->hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
- if (pContainer) {
- int iTabs = TabCtrl_GetItemCount(GetDlgItem(pContainer->hwnd, 1159));
- if (iTabs == 1)
- SendMessage(pContainer->hwnd, WM_CLOSE, 0, 1);
- else
- SendMessage(si->hWnd, WM_CLOSE, 0, 1);
-
- si->hWnd = CreateNewRoom((TContainerData*)wParam, si, TRUE, 0, 0);
- }
+ {
+ SESSION_INFO *si = SM_FindSessionByHWND((HWND)lParam);
+ if (si && IsWindow(si->hWnd)) {
+ TContainerData *pContainer = 0;
+ SendMessage(si->hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
+ if (pContainer) {
+ int iTabs = TabCtrl_GetItemCount(GetDlgItem(pContainer->hwnd, 1159));
+ if (iTabs == 1)
+ SendMessage(pContainer->hwnd, WM_CLOSE, 0, 1);
+ else
+ SendMessage(si->hWnd, WM_CLOSE, 0, 1);
+
+ si->hWnd = CreateNewRoom((TContainerData*)wParam, si, TRUE, 0, 0);
}
}
- break;
+ }
+ break;
case DM_SENDMESSAGECOMMANDW:
SendMessageCommand_W(wParam, lParam);
@@ -425,60 +424,60 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
mir_free((void*)lParam);
return 0;
- // sent from the popup to "dismiss" the event. we should do this in the main thread
+ // sent from the popup to "dismiss" the event. we should do this in the main thread
case DM_REMOVECLISTEVENT:
CallService(MS_CLIST_REMOVEEVENT, wParam, lParam);
db_event_markRead(wParam, lParam);
return 0;
case DM_SETLOCALE:
- {
- HKL hkl = (HKL)lParam;
- MCONTACT hContact = wParam;
-
- HWND hWnd = M.FindWindow(hContact);
- if (hWnd) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
- if (dat) {
- if (hkl) {
- dat->hkl = hkl;
- PostMessage(dat->hwnd, DM_SETLOCALE, 0, 0);
- }
+ {
+ HKL hkl = (HKL)lParam;
+ MCONTACT hContact = wParam;
+
+ HWND hWnd = M.FindWindow(hContact);
+ if (hWnd) {
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+ if (dat) {
+ if (hkl) {
+ dat->hkl = hkl;
+ PostMessage(dat->hwnd, DM_SETLOCALE, 0, 0);
+ }
- DBVARIANT dbv;
- if (0 == db_get_ts(hContact, SRMSGMOD_T, "locale", &dbv)) {
- GetLocaleID(dat, dbv.ptszVal);
- db_free(&dbv);
- UpdateReadChars(dat);
- }
+ DBVARIANT dbv;
+ if (0 == db_get_ts(hContact, SRMSGMOD_T, "locale", &dbv)) {
+ GetLocaleID(dat, dbv.ptszVal);
+ db_free(&dbv);
+ UpdateReadChars(dat);
}
}
}
- return 0;
+ }
+ return 0;
// react to changes in the desktop composition state
// (enable/disable DWM, change to a non-aero visual style
// or classic Windows theme
case WM_DWMCOMPOSITIONCHANGED:
- {
- bool fNewAero = M.getAeroState(); // refresh dwm state
- SendMessage(hwndDlg, WM_THEMECHANGED, 0, 0);
-
- for (p = pFirstContainer; p; p = p->pNext) {
- if (fNewAero)
- SetAeroMargins(p);
- else {
- MARGINS m = {0};
- if (M.m_pfnDwmExtendFrameIntoClientArea)
- M.m_pfnDwmExtendFrameIntoClientArea(p->hwnd, &m);
- }
- if (p->SideBar->isActive())
- RedrawWindow(GetDlgItem(p->hwnd, 5000), NULL, NULL, RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); // the container for the sidebar buttons
- RedrawWindow(p->hwnd, NULL, NULL, RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW|RDW_ALLCHILDREN);
+ {
+ bool fNewAero = M.getAeroState(); // refresh dwm state
+ SendMessage(hwndDlg, WM_THEMECHANGED, 0, 0);
+
+ for (p = pFirstContainer; p; p = p->pNext) {
+ if (fNewAero)
+ SetAeroMargins(p);
+ else {
+ MARGINS m = { 0 };
+ if (M.m_pfnDwmExtendFrameIntoClientArea)
+ M.m_pfnDwmExtendFrameIntoClientArea(p->hwnd, &m);
}
+ if (p->SideBar->isActive())
+ RedrawWindow(GetDlgItem(p->hwnd, 5000), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); // the container for the sidebar buttons
+ RedrawWindow(p->hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
}
- M.BroadcastMessage(WM_DWMCOMPOSITIONCHANGED, 0, 0);
- break;
+ }
+ M.BroadcastMessage(WM_DWMCOMPOSITIONCHANGED, 0, 0);
+ break;
// this message is fired when the user changes desktop color
// settings (Desktop->personalize)
@@ -490,8 +489,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
CSkin::initAeroEffect();
break;
- // user has changed the visual style or switched to/from
- // classic Windows theme
+ // user has changed the visual style or switched to/from
+ // classic Windows theme
case WM_THEMECHANGED:
M.getAeroState();
Skin->setupTabCloseBitmap();
@@ -508,47 +507,47 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
break;
case DM_SPLITSENDACK:
- {
- SendJob *job = sendQueue->getJobByIndex((int)wParam);
-
- ACKDATA ack = {0};
- ack.hContact = job->hContact;
- ack.hProcess = job->hSendId;
- ack.type = ACKTYPE_MESSAGE;
- ack.result = ACKRESULT_SUCCESS;
-
- if (job->hContact && job->iAcksNeeded && job->iStatus == SendQueue::SQ_INPROGRESS) {
- if (IsWindow(job->hOwnerWnd))
- ::SendMessage(job->hOwnerWnd, HM_EVENTSENT, (WPARAM)MAKELONG(wParam, 0), (LPARAM)&ack);
- else
- sendQueue->ackMessage(0, (WPARAM)MAKELONG(wParam, 0), (LPARAM)&ack);
- }
+ {
+ SendJob *job = sendQueue->getJobByIndex((int)wParam);
+
+ ACKDATA ack = { 0 };
+ ack.hContact = job->hContact;
+ ack.hProcess = job->hSendId;
+ ack.type = ACKTYPE_MESSAGE;
+ ack.result = ACKRESULT_SUCCESS;
+
+ if (job->hContact && job->iAcksNeeded && job->iStatus == SendQueue::SQ_INPROGRESS) {
+ if (IsWindow(job->hOwnerWnd))
+ ::SendMessage(job->hOwnerWnd, HM_EVENTSENT, (WPARAM)MAKELONG(wParam, 0), (LPARAM)&ack);
+ else
+ sendQueue->ackMessage(0, (WPARAM)MAKELONG(wParam, 0), (LPARAM)&ack);
}
- return 0;
+ }
+ return 0;
case DM_LOGSTATUSCHANGE:
CGlobals::logStatusChange(wParam, reinterpret_cast<CContactCache *>(lParam));
return 0;
case DM_MUCFLASHWORKER:
- {
- FLASH_PARAMS *p = reinterpret_cast<FLASH_PARAMS*>(lParam);
- if (1 == wParam) {
- CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)p->hContact, 1);
- p->bActiveTab = TRUE;
- p->bInactive = FALSE;
- p->bMustAutoswitch = p->bMustFlash = FALSE;
- }
+ {
+ FLASH_PARAMS *p = reinterpret_cast<FLASH_PARAMS*>(lParam);
+ if (1 == wParam) {
+ CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)p->hContact, 1);
+ p->bActiveTab = TRUE;
+ p->bInactive = FALSE;
+ p->bMustAutoswitch = p->bMustFlash = FALSE;
+ }
- if (2 == wParam) {
- p->bActiveTab = TRUE;
- p->bInactive = FALSE;
- p->bMustAutoswitch = p->bMustFlash = FALSE;
- SendMessage(p->hWnd, DM_ACTIVATEME, 0, 0);
- }
- DoFlashAndSoundWorker(p);
+ if (2 == wParam) {
+ p->bActiveTab = TRUE;
+ p->bInactive = FALSE;
+ p->bMustAutoswitch = p->bMustFlash = FALSE;
+ SendMessage(p->hWnd, DM_ACTIVATEME, 0, 0);
}
- return 0;
+ DoFlashAndSoundWorker(p);
+ }
+ return 0;
case WM_POWERBROADCAST:
case WM_DISPLAYCHANGE:
@@ -561,7 +560,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
p->cachedDC = 0;
RedrawWindow(p->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME);
}
- break;
+ break;
case WM_ACTIVATE:
if (LOWORD(wParam) != WA_ACTIVE)
@@ -599,7 +598,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
// TODO better timings, possibly slow down when many jobs are in the
// queue.
else if (wParam == TIMERID_SENDLATER_TICK) {
- if ( !sendLater->haveJobs()) {
+ if (!sendLater->haveJobs()) {
KillTimer(hwndDlg, wParam);
SetTimer(hwndDlg, TIMERID_SENDLATER, TIMEOUT_SENDLATER, 0);
sendLater->qMgrUpdate(true);
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index 56f06d9617..85889fd2ec 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -38,7 +38,7 @@ TCHAR *xStatusDescr[] =
_T("<undef>"), _T("<undef>")
};
-TInfoPanelConfig CInfoPanel::m_ipConfig = {0};
+TInfoPanelConfig CInfoPanel::m_ipConfig = { 0 };
int CInfoPanel::setPanelHandler(TWindowData *dat, WPARAM wParam, LPARAM lParam)
{
@@ -303,7 +303,7 @@ void CInfoPanel::renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool bAero,
rc.bottom -= 2;
CSkin::SkinDrawBG(m_dat->hwnd, m_dat->pContainer->hwnd, m_dat->pContainer, &rc, hdc);
item = &SkinItems[ID_EXTBKINFOPANELBG];
-
+
// if new (= tabsrmm 3.x) skin item is not defined, use the old info panel
// field background items. That should break less skins
if (!item->IGNORED)
@@ -332,7 +332,7 @@ void CInfoPanel::renderContent(const HDC hdc)
return;
if (!m_isChat) { // panel picture
- DRAWITEMSTRUCT dis = {0};
+ DRAWITEMSTRUCT dis = { 0 };
dis.rcItem = m_dat->rcPic;
dis.hDC = hdc;
dis.hwndItem = m_dat->hwnd;
@@ -555,7 +555,7 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem)
SetBkMode(hdc, TRANSPARENT);
RECT rc = rcItem;
rc.left += 2;
- rc.right -=3;
+ rc.right -= 3;
if (szResult[0]) {
::DrawIconEx(hdc, rcItem.left, (rcItem.bottom - rcItem.top) / 2 - 8 + rcItem.top, PluginConfig.g_iconClock, 16, 16, 0, 0, DI_NORMAL);
@@ -611,12 +611,12 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem)
if (m_height < DEGRADE_THRESHOLD) {
TCHAR tszText[2048];
- mir_sntprintf(tszText, SIZEOF(tszText), TranslateT("Topic is: %s"),
+ mir_sntprintf(tszText, SIZEOF(tszText), TranslateT("Topic is: %s"),
si->ptszTopic ? si->ptszTopic : TranslateT("no topic set."));
hOldFont = reinterpret_cast<HFONT>(::SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_UIN]));
CSkin::RenderText(hdc, m_dat->hThemeIP, tszText, &rcItem, DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOPREFIX | DT_VCENTER,
- CSkin::m_glowSize, m_ipConfig.clrs[IPFONTID_UIN]);
+ CSkin::m_glowSize, m_ipConfig.clrs[IPFONTID_UIN]);
}
else {
const TCHAR *tszNick = m_dat->cache->getNick();
@@ -629,7 +629,7 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem)
setUnderlinedFont(hdc, m_ipConfig.hFonts[IPFONTID_NICK]);
CSkin::RenderText(hdc, m_dat->hThemeIP, tszNick, &rcItem, DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER,
- CSkin::m_glowSize, m_ipConfig.clrs[IPFONTID_NICK]);
+ CSkin::m_glowSize, m_ipConfig.clrs[IPFONTID_NICK]);
if (m_hoverFlags & HOVER_NICK)
::DeleteObject(::SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_NICK]));
@@ -640,11 +640,11 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem)
if (si->ptszStatusbarText) {
TCHAR *pTmp = _tcschr(si->ptszStatusbarText, ']');
pTmp += 2;
-
+
if (si->ptszStatusbarText[0] == '[' && pTmp > si->ptszStatusbarText) {
CMString tszTemp(si->ptszStatusbarText, pTmp - si->ptszStatusbarText);
CSkin::RenderText(hdc, m_dat->hThemeIP, tszTemp, &rcItem, DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOPREFIX | DT_VCENTER,
- CSkin::m_glowSize, m_ipConfig.clrs[IPFONTID_STATUS]);
+ CSkin::m_glowSize, m_ipConfig.clrs[IPFONTID_STATUS]);
}
}
}
@@ -681,7 +681,7 @@ void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem)
if (si->ptszTopic && mir_tstrlen(si->ptszTopic) > 1)
CSkin::RenderText(hdc, m_dat->hThemeIP, si->ptszTopic, &rcItem, DT_WORDBREAK | DT_END_ELLIPSIS | DT_NOPREFIX | DT_TOP, CSkin::m_glowSize, clr);
else
- CSkin::RenderText(hdc, m_dat->hThemeIP, TranslateT("no topic set."), &rcItem, DT_TOP| DT_SINGLELINE | DT_NOPREFIX, CSkin::m_glowSize, clr);
+ CSkin::RenderText(hdc, m_dat->hThemeIP, TranslateT("no topic set."), &rcItem, DT_TOP | DT_SINGLELINE | DT_NOPREFIX, CSkin::m_glowSize, clr);
if (hOldFont)
::SelectObject(hdc, hOldFont);
@@ -898,7 +898,7 @@ void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam)
if (tszXStatusName) {
str.Append(TranslateT("\\par\\par\\ul\\b Extended status information:\\ul0\\b0 \\par "));
str.AppendFormat(_T("%s%s%s"), tszXStatusName, m_dat->cache->getXStatusMsg() ? _T(" / ") : _T(""),
- m_dat->cache->getXStatusMsg() ? m_dat->cache->getXStatusMsg() : _T(""));
+ m_dat->cache->getXStatusMsg() ? m_dat->cache->getXStatusMsg() : _T(""));
if (dbv.ptszVal)
mir_free(dbv.ptszVal);
@@ -918,7 +918,7 @@ void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam)
str.Replace(_T("\n"), _T("\\line "));
POINT pt;
- RECT rc = {0, 0, 400, 600};
+ RECT rc = { 0, 0, 400, 600 };
GetCursorPos(&pt);
m_tip = new CTip(m_dat->hwnd, m_dat->hContact, str, this);
m_tip->show(rc, pt, m_dat->hTabIcon, m_dat->szStatus);
@@ -1057,168 +1057,168 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
{
switch (msg) {
case WM_INITDIALOG:
- {
- TCHAR tszTitle[100];
- mir_sntprintf(tszTitle, SIZEOF(tszTitle), TranslateT("Set panel visibility for this %s"),
- m_isChat ? TranslateT("chat room") : TranslateT("contact"));
- ::SetDlgItemText(hwnd, IDC_STATIC_VISIBILTY, tszTitle);
+ {
+ TCHAR tszTitle[100];
+ mir_sntprintf(tszTitle, SIZEOF(tszTitle), TranslateT("Set panel visibility for this %s"),
+ m_isChat ? TranslateT("chat room") : TranslateT("contact"));
+ ::SetDlgItemText(hwnd, IDC_STATIC_VISIBILTY, tszTitle);
- mir_sntprintf(tszTitle, SIZEOF(tszTitle), m_isChat ? TranslateT("Do not synchronize the panel height with IM windows") :
- TranslateT("Do not synchronize the panel height with group chat windows"));
+ mir_sntprintf(tszTitle, SIZEOF(tszTitle), m_isChat ? TranslateT("Do not synchronize the panel height with IM windows") :
+ TranslateT("Do not synchronize the panel height with group chat windows"));
- ::SetDlgItemText(hwnd, IDC_NOSYNC, tszTitle);
+ ::SetDlgItemText(hwnd, IDC_NOSYNC, tszTitle);
- ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Inherit from container setting"));
- ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always off"));
- ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always on"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Inherit from container setting"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always off"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always on"));
- BYTE v = M.GetByte(m_dat->hContact, "infopanel", 0);
- ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_SETCURSEL, (WPARAM)(v == 0 ? 0 : (v == (BYTE)-1 ? 1 : 2)), 0);
+ BYTE v = M.GetByte(m_dat->hContact, "infopanel", 0);
+ ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_SETCURSEL, (WPARAM)(v == 0 ? 0 : (v == (BYTE)-1 ? 1 : 2)), 0);
- ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use default size"));
- ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use private size"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use default size"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use private size"));
- ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_SETCURSEL, (WPARAM)(m_fPrivateHeight ? 1 : 0), 0);
+ ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_SETCURSEL, (WPARAM)(m_fPrivateHeight ? 1 : 0), 0);
- ::CheckDlgButton(hwnd, IDC_NOSYNC, M.GetByte("syncAllPanels", 0) ? BST_UNCHECKED : BST_CHECKED);
+ ::CheckDlgButton(hwnd, IDC_NOSYNC, M.GetByte("syncAllPanels", 0) ? BST_UNCHECKED : BST_CHECKED);
- Utils::showDlgControl(hwnd, IDC_IPCONFIG_PRIVATECONTAINER, m_dat->pContainer->settings->fPrivate ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(hwnd, IDC_IPCONFIG_PRIVATECONTAINER, m_dat->pContainer->settings->fPrivate ? SW_SHOW : SW_HIDE);
- if (!m_isChat) {
- v = db_get_b(m_dat->hContact, SRMSGMOD_T, "hideavatar", -1);
- ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use global setting"));
- ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Show always (if present)"));
- ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Never show it at all"));
- ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_SETCURSEL, (v == (BYTE)-1 ? 0 : (v == 1 ? 1 : 2)), 0);
- }
- else Utils::enableDlgControl(hwnd, IDC_PANELPICTUREVIS, false);
+ if (!m_isChat) {
+ v = db_get_b(m_dat->hContact, SRMSGMOD_T, "hideavatar", -1);
+ ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Use global setting"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Show always (if present)"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Never show it at all"));
+ ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_SETCURSEL, (v == (BYTE)-1 ? 0 : (v == 1 ? 1 : 2)), 0);
}
- return FALSE;
+ else Utils::enableDlgControl(hwnd, IDC_PANELPICTUREVIS, false);
+ }
+ return FALSE;
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC:
- {
- HWND hwndChild = (HWND)lParam;
- UINT id = ::GetDlgCtrlID(hwndChild);
+ {
+ HWND hwndChild = (HWND)lParam;
+ UINT id = ::GetDlgCtrlID(hwndChild);
- if (m_configDlgFont == 0) {
- HFONT hFont = (HFONT)::SendDlgItemMessage(hwnd, IDC_IPCONFIG_TITLE, WM_GETFONT, 0, 0);
- LOGFONT lf = { 0 };
+ if (m_configDlgFont == 0) {
+ HFONT hFont = (HFONT)::SendDlgItemMessage(hwnd, IDC_IPCONFIG_TITLE, WM_GETFONT, 0, 0);
+ LOGFONT lf = { 0 };
- ::GetObject(hFont, sizeof(lf), &lf);
- lf.lfWeight = FW_BOLD;
- m_configDlgBoldFont = ::CreateFontIndirect(&lf);
+ ::GetObject(hFont, sizeof(lf), &lf);
+ lf.lfWeight = FW_BOLD;
+ m_configDlgBoldFont = ::CreateFontIndirect(&lf);
- lf.lfHeight = (int)(lf.lfHeight * 1.2);
- m_configDlgFont = ::CreateFontIndirect(&lf);
- ::SendDlgItemMessage(hwnd, IDC_IPCONFIG_TITLE, WM_SETFONT, (WPARAM)m_configDlgFont, FALSE);
- }
-
- if (hwndChild == ::GetDlgItem(hwnd, IDC_IPCONFIG_TITLE)) {
- ::SetTextColor((HDC)wParam, RGB(60, 60, 150));
- ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_configDlgFont, FALSE);
- }
- else if (id == IDC_IPCONFIG_FOOTER || id == IDC_SIZE_TIP || id == IDC_IPCONFIG_PRIVATECONTAINER)
- ::SetTextColor((HDC)wParam, RGB(160, 50, 50));
- else if (id == IDC_GROUP_SIZE || id == IDC_GROUP_SCOPE || id == IDC_GROUP_OTHER)
- ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_configDlgBoldFont, FALSE);
+ lf.lfHeight = (int)(lf.lfHeight * 1.2);
+ m_configDlgFont = ::CreateFontIndirect(&lf);
+ ::SendDlgItemMessage(hwnd, IDC_IPCONFIG_TITLE, WM_SETFONT, (WPARAM)m_configDlgFont, FALSE);
+ }
- ::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
- return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
+ if (hwndChild == ::GetDlgItem(hwnd, IDC_IPCONFIG_TITLE)) {
+ ::SetTextColor((HDC)wParam, RGB(60, 60, 150));
+ ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_configDlgFont, FALSE);
}
+ else if (id == IDC_IPCONFIG_FOOTER || id == IDC_SIZE_TIP || id == IDC_IPCONFIG_PRIVATECONTAINER)
+ ::SetTextColor((HDC)wParam, RGB(160, 50, 50));
+ else if (id == IDC_GROUP_SIZE || id == IDC_GROUP_SCOPE || id == IDC_GROUP_OTHER)
+ ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_configDlgBoldFont, FALSE);
+
+ ::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
+ return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
+ }
case WM_COMMAND:
+ {
+ LONG lOldHeight = m_height;
+ switch (LOWORD(wParam)) {
+ case IDC_PANELSIZE:
{
- LONG lOldHeight = m_height;
- switch (LOWORD(wParam)) {
- case IDC_PANELSIZE:
- {
- LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_GETCURSEL, 0, 0);
- if (iResult == 0) {
- if (m_fPrivateHeight) {
- db_set_dw(m_dat->hContact, SRMSGMOD_T, "panelheight", m_height);
- loadHeight();
- }
- }
- else if (iResult == 1) {
- db_set_dw(m_dat->hContact, SRMSGMOD_T, "panelheight",
- MAKELONG(M.GetDword(m_dat->hContact, "panelheight", m_height), 0xffff));
- loadHeight();
- }
+ LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_GETCURSEL, 0, 0);
+ if (iResult == 0) {
+ if (m_fPrivateHeight) {
+ db_set_dw(m_dat->hContact, SRMSGMOD_T, "panelheight", m_height);
+ loadHeight();
}
- break;
+ }
+ else if (iResult == 1) {
+ db_set_dw(m_dat->hContact, SRMSGMOD_T, "panelheight",
+ MAKELONG(M.GetDword(m_dat->hContact, "panelheight", m_height), 0xffff));
+ loadHeight();
+ }
+ }
+ break;
- case IDC_PANELPICTUREVIS:
- {
- BYTE vOld = db_get_b(m_dat->hContact, SRMSGMOD_T, "hideavatar", -1);
- LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_GETCURSEL, 0, 0);
-
- BYTE vNew = (iResult == 0 ? (BYTE)-1 : (iResult == 1 ? 1 : 0));
- if (vNew != vOld) {
- if (vNew == (BYTE)-1)
- db_unset(m_dat->hContact, SRMSGMOD_T, "hideavatar");
- else
- db_set_b(m_dat->hContact, SRMSGMOD_T, "hideavatar", vNew);
-
- ::ShowPicture(m_dat, FALSE);
- ::SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
- ::DM_ScrollToBottom(m_dat, 0, 1);
- }
- }
- break;
+ case IDC_PANELPICTUREVIS:
+ {
+ BYTE vOld = db_get_b(m_dat->hContact, SRMSGMOD_T, "hideavatar", -1);
+ LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_GETCURSEL, 0, 0);
- case IDC_PANELVISIBILITY:
- {
- BYTE vOld = db_get_b(m_dat->hContact, SRMSGMOD_T, "infopanel", 0);
- LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_GETCURSEL, 0, 0);
-
- BYTE vNew = (iResult == 0 ? 0 : (iResult == 1 ? (BYTE)-1 : 1));
- if (vNew != vOld) {
- db_set_b(m_dat->hContact, SRMSGMOD_T, "infopanel", vNew);
- getVisibility();
- showHide();
- }
- }
- break;
+ BYTE vNew = (iResult == 0 ? (BYTE)-1 : (iResult == 1 ? 1 : 0));
+ if (vNew != vOld) {
+ if (vNew == (BYTE)-1)
+ db_unset(m_dat->hContact, SRMSGMOD_T, "hideavatar");
+ else
+ db_set_b(m_dat->hContact, SRMSGMOD_T, "hideavatar", vNew);
- case IDC_SIZECOMPACT:
- setHeight(MIN_PANELHEIGHT + 2, true);
- break;
+ ::ShowPicture(m_dat, FALSE);
+ ::SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
+ ::DM_ScrollToBottom(m_dat, 0, 1);
+ }
+ }
+ break;
- case IDC_SIZENORMAL:
- setHeight(DEGRADE_THRESHOLD, true);
- break;
+ case IDC_PANELVISIBILITY:
+ {
+ BYTE vOld = db_get_b(m_dat->hContact, SRMSGMOD_T, "infopanel", 0);
+ LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_GETCURSEL, 0, 0);
+
+ BYTE vNew = (iResult == 0 ? 0 : (iResult == 1 ? (BYTE)-1 : 1));
+ if (vNew != vOld) {
+ db_set_b(m_dat->hContact, SRMSGMOD_T, "infopanel", vNew);
+ getVisibility();
+ showHide();
+ }
+ }
+ break;
- case IDC_SIZELARGE:
- setHeight(51, true);
- break;
+ case IDC_SIZECOMPACT:
+ setHeight(MIN_PANELHEIGHT + 2, true);
+ break;
- case IDC_NOSYNC:
- db_set_b(0, SRMSGMOD_T, "syncAllPanels", ::IsDlgButtonChecked(hwnd, IDC_NOSYNC) ? 0 : 1);
- if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_NOSYNC)) {
- loadHeight();
- if (!m_dat->pContainer->settings->fPrivate)
- M.BroadcastMessage(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight);
- else
- ::BroadCastContainer(m_dat->pContainer, DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight);
- }
- else {
- if (!m_dat->pContainer->settings->fPrivate)
- M.BroadcastMessage(DM_SETINFOPANEL, (WPARAM)m_dat, 0);
- else
- ::BroadCastContainer(m_dat->pContainer, DM_SETINFOPANEL, (WPARAM)m_dat, 0);
- }
- break;
- }
+ case IDC_SIZENORMAL:
+ setHeight(DEGRADE_THRESHOLD, true);
+ break;
- if (m_height != lOldHeight) {
- ::SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
- ::SetAeroMargins(m_dat->pContainer);
- ::RedrawWindow(m_dat->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
- ::RedrawWindow(GetParent(m_dat->hwnd), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ case IDC_SIZELARGE:
+ setHeight(51, true);
+ break;
+
+ case IDC_NOSYNC:
+ db_set_b(0, SRMSGMOD_T, "syncAllPanels", ::IsDlgButtonChecked(hwnd, IDC_NOSYNC) ? 0 : 1);
+ if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_NOSYNC)) {
+ loadHeight();
+ if (!m_dat->pContainer->settings->fPrivate)
+ M.BroadcastMessage(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight);
+ else
+ ::BroadCastContainer(m_dat->pContainer, DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight);
}
+ else {
+ if (!m_dat->pContainer->settings->fPrivate)
+ M.BroadcastMessage(DM_SETINFOPANEL, (WPARAM)m_dat, 0);
+ else
+ ::BroadCastContainer(m_dat->pContainer, DM_SETINFOPANEL, (WPARAM)m_dat, 0);
+ }
+ break;
}
- break;
+
+ if (m_height != lOldHeight) {
+ ::SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
+ ::SetAeroMargins(m_dat->pContainer);
+ ::RedrawWindow(m_dat->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ ::RedrawWindow(GetParent(m_dat->hwnd), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ }
+ }
+ break;
case WM_CLOSE:
if (wParam == 1 && lParam == 1)
diff --git a/plugins/TabSRMM/src/infopanel.h b/plugins/TabSRMM/src/infopanel.h
index 5f74ba6d99..ddb9c2f8f8 100644
--- a/plugins/TabSRMM/src/infopanel.h
+++ b/plugins/TabSRMM/src/infopanel.h
@@ -64,25 +64,25 @@ class CTip
{
public:
enum {
- TOP_BORDER = 25,
- LEFT_BORDER = 2,
- RIGHT_BORDER = 2,
- BOTTOM_BORDER = 1,
- LEFT_BAR_WIDTH = 20
+ TOP_BORDER = 25,
+ LEFT_BORDER = 2,
+ RIGHT_BORDER = 2,
+ BOTTOM_BORDER = 1,
+ LEFT_BAR_WIDTH = 20
};
- CTip (const HWND hwndParent, const MCONTACT hContact, const TCHAR *pszText = 0, const CInfoPanel *panel = 0);
+ CTip(const HWND hwndParent, const MCONTACT hContact, const TCHAR *pszText = 0, const CInfoPanel *panel = 0);
~CTip()
{
mir_free(m_pszText);
}
- void show (const RECT& rc, POINT& pt, const HICON hIcon = 0, const TCHAR *szTitle = 0);
- const HWND getHwnd () const { return(m_hwnd); }
+ void show(const RECT& rc, POINT& pt, const HICON hIcon = 0, const TCHAR *szTitle = 0);
+ const HWND getHwnd() const { return(m_hwnd); }
- static void registerClass ();
+ static void registerClass();
private:
- INT_PTR CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ INT_PTR CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK WndProcStub(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -114,14 +114,14 @@ public:
LEFT_OFFSET_LOGO = 3
};
enum {
- HOVER_NICK = 1,
+ HOVER_NICK = 1,
HOVER_STATUS = 2,
- HOVER_UIN = 4
+ HOVER_UIN = 4
};
enum {
- HTNICK = 1,
- HTUIN = 2,
- HTSTATUS = 3,
+ HTNICK = 1,
+ HTUIN = 2,
+ HTSTATUS = 3,
HTNIRVANA = 0
};
@@ -197,10 +197,10 @@ private:
TWindowData *m_dat; // this one OWNS us...
LONG m_height; // height (determined by position of IDC_PANELSPLITTER)
LONG m_defaultHeight,
- m_defaultMUCHeight; // global values for the info bar height
+ m_defaultMUCHeight; // global values for the info bar height
HWND m_hwndConfig; // window handle of the config dialog window
HFONT m_configDlgFont,
- m_configDlgBoldFont;
+ m_configDlgBoldFont;
SIZE m_szNick; // rectangle where the nick has been rendered,
/*
* these are used to store rectangles important to mouse tracking.
diff --git a/plugins/TabSRMM/src/mim.h b/plugins/TabSRMM/src/mim.h
index 5dcae4648a..ee3e78145f 100644
--- a/plugins/TabSRMM/src/mim.h
+++ b/plugins/TabSRMM/src/mim.h
@@ -39,24 +39,24 @@ extern FI_INTERFACE *FIF;
* - some GDI functions (AlphaBlend()..)
*/
//dwmapi
-typedef HRESULT (WINAPI *DEFICA)(HWND hwnd, const MARGINS *margins);
-typedef HRESULT (WINAPI *DICE)(BOOL *);
-typedef HRESULT (WINAPI *DRT)(HWND, HWND, PHTHUMBNAIL);
-typedef HRESULT (WINAPI *BBW)(HWND, DWM_BLURBEHIND *);
-typedef HRESULT (WINAPI *DGC)(DWORD *, BOOL *);
-typedef HRESULT (WINAPI *DWMIIB)(HWND);
-typedef HRESULT (WINAPI *DWMSWA)(HWND, DWORD, LPCVOID, DWORD);
-typedef HRESULT (WINAPI *DWMUT)(HTHUMBNAIL, DWM_THUMBNAIL_PROPERTIES *);
-typedef HRESULT (WINAPI *DURT)(HTHUMBNAIL);
-typedef HRESULT (WINAPI *DSIT)(HWND, HBITMAP, DWORD);
-typedef HRESULT (WINAPI *DSILP)(HWND, HBITMAP, POINT *, DWORD);
+typedef HRESULT(WINAPI *DEFICA)(HWND hwnd, const MARGINS *margins);
+typedef HRESULT(WINAPI *DICE)(BOOL *);
+typedef HRESULT(WINAPI *DRT)(HWND, HWND, PHTHUMBNAIL);
+typedef HRESULT(WINAPI *BBW)(HWND, DWM_BLURBEHIND *);
+typedef HRESULT(WINAPI *DGC)(DWORD *, BOOL *);
+typedef HRESULT(WINAPI *DWMIIB)(HWND);
+typedef HRESULT(WINAPI *DWMSWA)(HWND, DWORD, LPCVOID, DWORD);
+typedef HRESULT(WINAPI *DWMUT)(HTHUMBNAIL, DWM_THUMBNAIL_PROPERTIES *);
+typedef HRESULT(WINAPI *DURT)(HTHUMBNAIL);
+typedef HRESULT(WINAPI *DSIT)(HWND, HBITMAP, DWORD);
+typedef HRESULT(WINAPI *DSILP)(HWND, HBITMAP, POINT *, DWORD);
//uxtheme
-typedef UINT (WINAPI *PDTTE)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, RECT *, const DTTOPTS *);
-typedef HANDLE (WINAPI *BBP)(HDC, RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *);
-typedef HRESULT (WINAPI *EBP)(HANDLE, BOOL);
-typedef HRESULT (WINAPI *BPI)(void);
-typedef HRESULT (WINAPI *BPU)(void);
-typedef HRESULT (WINAPI *BPSA)(HANDLE, const RECT *, BYTE);
+typedef UINT(WINAPI *PDTTE)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, RECT *, const DTTOPTS *);
+typedef HANDLE(WINAPI *BBP)(HDC, RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *);
+typedef HRESULT(WINAPI *EBP)(HANDLE, BOOL);
+typedef HRESULT(WINAPI *BPI)(void);
+typedef HRESULT(WINAPI *BPU)(void);
+typedef HRESULT(WINAPI *BPSA)(HANDLE, const RECT *, BYTE);
//kernel32
typedef int (WINAPI *GLIX)(LPCWSTR, LCTYPE, LPCWSTR, int);
@@ -87,7 +87,7 @@ public:
}
~CMimAPI() {
- if (m_haveBufferedPaint)
+ if (m_haveBufferedPaint)
m_pfnBufferedPaintUninit();
if (m_hUxTheme != 0)
FreeLibrary(m_hUxTheme);
@@ -103,25 +103,43 @@ public:
*/
static DWORD __forceinline GetDword(const char *szModule, const char *szSetting, DWORD uDefault)
- { return db_get_dw(0, szModule, szSetting, uDefault); }
+ {
+ return db_get_dw(0, szModule, szSetting, uDefault);
+ }
static DWORD __forceinline GetDword(const char *szSetting, DWORD uDefault)
- { return db_get_dw(0, SRMSGMOD_T, szSetting, uDefault); }
+ {
+ return db_get_dw(0, SRMSGMOD_T, szSetting, uDefault);
+ }
static DWORD __forceinline GetDword(const MCONTACT hContact, const char *szSetting, DWORD uDefault)
- { return db_get_dw(hContact, SRMSGMOD_T, szSetting, uDefault); }
+ {
+ return db_get_dw(hContact, SRMSGMOD_T, szSetting, uDefault);
+ }
static int __forceinline GetByte(const char *szSetting, int uDefault)
- { return db_get_b(0, SRMSGMOD_T, szSetting, uDefault); }
+ {
+ return db_get_b(0, SRMSGMOD_T, szSetting, uDefault);
+ }
static int __forceinline GetByte(const char *szModule, const char *szSetting, int uDefault)
- { return db_get_b(0, szModule, szSetting, uDefault); }
+ {
+ return db_get_b(0, szModule, szSetting, uDefault);
+ }
static int __forceinline GetByte(const MCONTACT hContact, const char *szSetting, int uDefault)
- { return db_get_b(hContact, SRMSGMOD_T, szSetting, uDefault); }
+ {
+ return db_get_b(hContact, SRMSGMOD_T, szSetting, uDefault);
+ }
static bool __forceinline GetBool(const char *szSetting, bool bDefault)
- { return db_get_b(0, SRMSGMOD_T, szSetting, bDefault) != 0; }
+ {
+ return db_get_b(0, SRMSGMOD_T, szSetting, bDefault) != 0;
+ }
static bool __forceinline GetBool(const char *szModule, const char *szSetting, bool bDefault)
- { return db_get_b(0, szModule, szSetting, bDefault) != 0; }
+ {
+ return db_get_b(0, szModule, szSetting, bDefault) != 0;
+ }
static bool __forceinline GetBool(const MCONTACT hContact, const char *szSetting, bool bDefault)
- { return db_get_b(hContact, SRMSGMOD_T, szSetting, bDefault) != 0; }
+ {
+ return db_get_b(hContact, SRMSGMOD_T, szSetting, bDefault) != 0;
+ }
/*
* path utilities
@@ -150,7 +168,7 @@ public:
// returns status of Windows Aero
const bool isAero() const { return m_isAero; }
-
+
const bool isDwmActive() const { return m_DwmActive; }
const DWORD getWinVer() const { return m_winVer; }
diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp
index 42dca25d9d..b106517789 100644
--- a/plugins/TabSRMM/src/modplus.cpp
+++ b/plugins/TabSRMM/src/modplus.cpp
@@ -101,27 +101,27 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam)
switch (state) {
case 1:
- {
- int menulimit = M.GetByte("tabmodplus", "MenuCount", 0);
- if (menulimit == 0)
- break;
+ {
+ int menulimit = M.GetByte("tabmodplus", "MenuCount", 0);
+ if (menulimit == 0)
+ break;
- HMENU hMenu = CreatePopupMenu();
+ HMENU hMenu = CreatePopupMenu();
- for (int menunum = 0; menunum < menulimit; menunum++) {
- pszMenu[menunum] = getMenuEntry(menunum);
- AppendMenu(hMenu, MF_STRING, menunum + 1, pszMenu[menunum]);
- }
+ for (int menunum = 0; menunum < menulimit; menunum++) {
+ pszMenu[menunum] = getMenuEntry(menunum);
+ AppendMenu(hMenu, MF_STRING, menunum + 1, pszMenu[menunum]);
+ }
- int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, NULL);
- if (res == 0)
- break;
+ int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, NULL);
+ if (res == 0)
+ break;
- bufSize = textlenght + mir_tstrlen(pszMenu[res - 1]) + 2;
- pszFormatedText = (TCHAR*)_alloca(bufSize*sizeof(TCHAR));
- mir_sntprintf(pszFormatedText, bufSize, pszMenu[res-1], pszText);
- }
- break;
+ bufSize = textlenght + mir_tstrlen(pszMenu[res - 1]) + 2;
+ pszFormatedText = (TCHAR*)_alloca(bufSize*sizeof(TCHAR));
+ mir_sntprintf(pszFormatedText, bufSize, pszMenu[res - 1], pszText);
+ }
+ break;
case 2:
SendDlgItemMessage(cbcd->hwndFrom, IDC_MESSAGE, EM_GETSELTEXT, 0, (LPARAM)pszText);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 717cfc28a8..8945853bd9 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -1,3396 +1,3397 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Miranda NG: the free IM client for Microsoft* Windows*
-//
-// Copyright (ñ) 2012-15 Miranda NG project,
-// Copyright (c) 2000-09 Miranda ICQ/IM project,
-// all portions of this codebase are copyrighted to the people
-// listed in contributors.txt.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// you should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-// part of tabSRMM messaging plugin for Miranda.
-//
-// (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
-//
-// implements the message dialog window.
-
-#include "commonheaders.h"
-
-#define MS_HTTPSERVER_ADDFILENAME "HTTPServer/AddFileName"
-
-bool IsStringValidLink(TCHAR* pszText);
-
-const TCHAR *pszIDCSAVE_close = 0, *pszIDCSAVE_save = 0;
-
-static const UINT sendControls[] = { IDC_MESSAGE, IDC_LOG };
-static const UINT formatControls[] = { IDC_SMILEYBTN, IDC_FONTBOLD, IDC_FONTITALIC, IDC_FONTUNDERLINE, IDC_FONTFACE,IDC_FONTSTRIKEOUT };
-static const UINT addControls[] = { IDC_ADD, IDC_CANCELADD };
-static const UINT btnControls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER, IDC_ADD, IDC_CANCELADD };
-static const UINT errorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER};
-
+/////////////////////////////////////////////////////////////////////////////////////////
+// Miranda NG: the free IM client for Microsoft* Windows*
+//
+// Copyright (ñ) 2012-15 Miranda NG project,
+// Copyright (c) 2000-09 Miranda ICQ/IM project,
+// all portions of this codebase are copyrighted to the people
+// listed in contributors.txt.
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// you should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// part of tabSRMM messaging plugin for Miranda.
+//
+// (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
+//
+// implements the message dialog window.
+
+#include "commonheaders.h"
+
+#define MS_HTTPSERVER_ADDFILENAME "HTTPServer/AddFileName"
+
+bool IsStringValidLink(TCHAR* pszText);
+
+const TCHAR *pszIDCSAVE_close = 0, *pszIDCSAVE_save = 0;
+
+static const UINT sendControls[] = { IDC_MESSAGE, IDC_LOG };
+static const UINT formatControls[] = { IDC_SMILEYBTN, IDC_FONTBOLD, IDC_FONTITALIC, IDC_FONTUNDERLINE, IDC_FONTFACE, IDC_FONTSTRIKEOUT };
+static const UINT addControls[] = { IDC_ADD, IDC_CANCELADD };
+static const UINT btnControls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER, IDC_ADD, IDC_CANCELADD };
+static const UINT errorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER };
+
static COLORREF rtfDefColors[] = { RGB(255, 0, 0), RGB(0, 0, 255), RGB(0, 255, 0), RGB(255, 0, 255), RGB(255, 255, 0), RGB(0, 255, 255), 0, RGB(255, 255, 255) };
-
-static struct {
- int id;
- const TCHAR* text;
-}
-tooltips[] =
-{
- { IDC_ADD, LPGENT("Add this contact permanently to your contact list") },
- { IDC_CANCELADD, LPGENT("Do not add this contact permanently") },
- { IDC_TOGGLESIDEBAR, LPGENT("Expand or collapse the side bar") }
-};
-
-static struct
-{
- int id;
- HICON *pIcon;
-}
-buttonicons[] =
-{
- { IDC_ADD, &PluginConfig.g_buttonBarIcons[ICON_BUTTON_ADD] },
- { IDC_CANCELADD, &PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL] }
-};
-
-static void _clrMsgFilter(LPARAM lParam)
-{
- MSGFILTER *m = reinterpret_cast<MSGFILTER *>(lParam);
- m->msg = 0;
- m->lParam = 0;
- m->wParam = 0;
-}
-
-BOOL TSAPI IsUtfSendAvailable(MCONTACT hContact)
-{
- char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return FALSE;
-
- return (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDUTF) ? TRUE : FALSE;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// show a modified context menu for the richedit control(s)
-// @param dat message window data
-// @param idFrom dlg ctrl id
-// @param hwndFrom src window handle
-// @param pt mouse pointer position
-
-static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt)
-{
- CHARRANGE sel, all = { 0, -1};
- int oldCodepage = dat->codePage;
- HWND hwndDlg = dat->hwnd;
-
- HMENU hSubMenu, hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- if (idFrom == IDC_LOG)
- hSubMenu = GetSubMenu(hMenu, 0);
- else {
- hSubMenu = GetSubMenu(hMenu, 2);
- EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, MF_BYCOMMAND | (dat->SendFormat != 0 ? MF_ENABLED : MF_GRAYED));
- EnableMenuItem(hSubMenu, ID_EDITOR_PASTEANDSENDIMMEDIATELY, MF_BYCOMMAND | (PluginConfig.m_PasteAndSend ? MF_ENABLED : MF_GRAYED));
- CheckMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, MF_BYCOMMAND | (PluginConfig.m_visualMessageSizeIndicator ? MF_CHECKED : MF_UNCHECKED));
- EnableMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, MF_BYCOMMAND | (dat->pContainer->hwndStatus ? MF_ENABLED : MF_GRAYED));
- }
- TranslateMenu(hSubMenu);
- SendMessage(hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin == sel.cpMax) {
- EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
- EnableMenuItem(hSubMenu, IDM_QUOTE, MF_BYCOMMAND | MF_GRAYED);
- if (idFrom == IDC_MESSAGE)
- EnableMenuItem(hSubMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED);
- }
-
- if (idFrom == IDC_LOG) {
- InsertMenuA(hSubMenu, 6/*5*/, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
- InsertMenu(hSubMenu, 7/*6*/, MF_BYPOSITION | MF_POPUP, (UINT_PTR) PluginConfig.g_hMenuEncoding, TranslateT("Character encoding"));
- for (int i=0; i < GetMenuItemCount(PluginConfig.g_hMenuEncoding); i++)
- CheckMenuItem(PluginConfig.g_hMenuEncoding, i, MF_BYPOSITION | MF_UNCHECKED);
-
- if (dat->codePage == CP_ACP)
- CheckMenuItem(PluginConfig.g_hMenuEncoding, 0, MF_BYPOSITION | MF_CHECKED);
- else
- CheckMenuItem(PluginConfig.g_hMenuEncoding, dat->codePage, MF_BYCOMMAND | MF_CHECKED);
-
- CheckMenuItem(hSubMenu, ID_LOG_FREEZELOG, MF_BYCOMMAND | (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED ? MF_CHECKED : MF_UNCHECKED));
- }
-
- MessageWindowPopupData mwpd;
- if (idFrom == IDC_LOG || idFrom == IDC_MESSAGE) {
- // First notification
- mwpd.cbSize = sizeof(mwpd);
- mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
- mwpd.uFlags = (idFrom == IDC_LOG ? MSG_WINDOWPOPUP_LOG : MSG_WINDOWPOPUP_INPUT);
- mwpd.hContact = dat->hContact;
- mwpd.hwnd = hwndFrom;
- mwpd.hMenu = hSubMenu;
- mwpd.selection = 0;
- mwpd.pt = pt;
- NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
- }
-
- int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
-
- if (idFrom == IDC_LOG || idFrom == IDC_MESSAGE) {
- // Second notification
- mwpd.selection = iSelection;
- mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
- NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
- }
-
- if (((iSelection > 800 && iSelection < 1400) || iSelection == 20866) && idFrom == IDC_LOG) {
- dat->codePage = iSelection;
- db_set_dw(dat->hContact, SRMSGMOD_T, "ANSIcodepage", dat->codePage);
- }
- else if (iSelection == 500 && idFrom == IDC_LOG) {
- dat->codePage = CP_ACP;
- db_unset(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
- }
- else {
- switch (iSelection) {
- case IDM_COPY:
- SendMessage(hwndFrom, WM_COPY, 0, 0);
- break;
- case IDM_CUT:
- SendMessage(hwndFrom, WM_CUT, 0, 0);
- break;
- case IDM_PASTE:
- case IDM_PASTEFORMATTED:
- if (idFrom == IDC_MESSAGE)
- SendMessage(hwndFrom, EM_PASTESPECIAL, (iSelection == IDM_PASTE) ? CF_UNICODETEXT : 0, 0);
- break;
- case IDM_COPYALL:
- SendMessage(hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
- SendMessage(hwndFrom, WM_COPY, 0, 0);
- SendMessage(hwndFrom, EM_EXSETSEL, 0, (LPARAM)&sel);
- break;
- case IDM_QUOTE:
- SendMessage(hwndDlg, WM_COMMAND, IDC_QUOTE, 0);
- break;
- case IDM_SELECTALL:
- SendMessage(hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
- break;
- case IDM_CLEAR:
- ClearLog(dat);
- break;
- case ID_LOG_FREEZELOG:
- SendDlgItemMessage(hwndDlg, IDC_LOG, WM_KEYDOWN, VK_F12, 0);
- break;
- case ID_EDITOR_SHOWMESSAGELENGTHINDICATOR:
- PluginConfig.m_visualMessageSizeIndicator = !PluginConfig.m_visualMessageSizeIndicator;
- db_set_b(0, SRMSGMOD_T, "msgsizebar", (BYTE)PluginConfig.m_visualMessageSizeIndicator);
- M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 0);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- if (dat->pContainer->hwndStatus)
- RedrawWindow(dat->pContainer->hwndStatus, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW);
- break;
- case ID_EDITOR_PASTEANDSENDIMMEDIATELY:
- HandlePasteAndSend(dat);
- break;
- }
- }
- if (idFrom == IDC_LOG)
- RemoveMenu(hSubMenu, 7, MF_BYPOSITION);
- DestroyMenu(hMenu);
- if (dat->codePage != (UINT)oldCodepage) {
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETITLE, 0, 1);
- }
-}
-
-static void ResizeIeView(const TWindowData *dat)
-{
- RECT rcRichEdit;
- GetWindowRect(GetDlgItem(dat->hwnd, IDC_LOG), &rcRichEdit);
-
- POINT pt = { rcRichEdit.left, rcRichEdit.top };
- ScreenToClient(dat->hwnd, &pt);
-
- IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
- ieWindow.iType = IEW_SETPOS;
- ieWindow.parent = dat->hwnd;
- ieWindow.hwnd = dat->hwndIEView ? dat->hwndIEView : dat->hwndHPP;
- ieWindow.x = pt.x;
- ieWindow.y = pt.y;
- ieWindow.cx = rcRichEdit.right - rcRichEdit.left;
- ieWindow.cy = rcRichEdit.bottom - rcRichEdit.top;
- if (ieWindow.cx != 0 && ieWindow.cy != 0)
- CallService(dat->hwndIEView ? MS_IEVIEW_WINDOW : MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
-}
-
-LRESULT CALLBACK IEViewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
-
- switch (msg) {
- case WM_NCCALCSIZE:
- return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, IEViewSubclassProc);
- case WM_NCPAINT:
- return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, IEViewSubclassProc);
- }
- return mir_callNextSubclass(hwnd, IEViewSubclassProc, msg, wParam, lParam);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// sublassing procedure for the h++ based message log viewer
-
-LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- if (mwdat) {
- BOOL isCtrl, isShift, isAlt;
- KbdState(mwdat, isShift, isCtrl, isAlt);
-
- switch (msg) {
- case WM_NCCALCSIZE:
- return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, HPPKFSubclassProc);
- case WM_NCPAINT:
- return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, HPPKFSubclassProc);
-
- case WM_KEYDOWN:
- if (!isCtrl && !isAlt && !isShift) {
- if (wParam != VK_PRIOR && wParam != VK_NEXT && wParam != VK_DELETE &&
- wParam != VK_MENU && wParam != VK_END && wParam != VK_HOME &&
- wParam != VK_UP && wParam != VK_DOWN && wParam != VK_LEFT &&
- wParam != VK_RIGHT && wParam != VK_TAB && wParam != VK_SPACE)
- {
- SetFocus(GetDlgItem(mwdat->hwnd, IDC_MESSAGE));
- keybd_event((BYTE)wParam, (BYTE)MapVirtualKey(wParam, 0), KEYEVENTF_EXTENDEDKEY | 0, 0);
- return 0;
- }
- break;
- }
- }
- }
- return mir_callNextSubclass(hwnd, HPPKFSubclassProc, msg, wParam, lParam);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// update state of the container - this is called whenever a tab becomes active, no matter how and
-// deals with various things like updating the title bar, removing flashing icons, updating the
-// session list, switching the keyboard layout (autolocale active) and the general container status.
-//
-// it protects itself from being called more than once per session activation and is valid for
-// normal IM sessions *only*. Group chat sessions have their own activation handler (see chat/window.c)
-
-static void MsgWindowUpdateState(TWindowData *dat, UINT msg)
-{
- if (dat == NULL || dat->iTabID < 0)
- return;
-
- HWND hwndDlg = dat->hwnd;
- HWND hwndTab = GetParent(hwndDlg);
-
- if (msg == WM_ACTIVATE) {
- if (dat->pContainer->dwFlags & CNT_TRANSPARENCY) {
- DWORD trans = LOWORD(dat->pContainer->settings->dwTransparency);
- SetLayeredWindowAttributes(dat->pContainer->hwnd, 0, (BYTE)trans, (dat->pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
- }
- }
-
- if (dat->bIsAutosizingInput && dat->iInputAreaHeight == -1) {
- dat->iInputAreaHeight = 0;
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
- }
-
- if (dat->pWnd)
- dat->pWnd->activateTab();
- dat->Panel->dismissConfig();
- dat->dwUnread = 0;
- if (dat->pContainer->hwndSaved == hwndDlg)
- return;
-
- dat->pContainer->hwndSaved = hwndDlg;
-
- dat->dwTickLastEvent = 0;
- dat->dwFlags &= ~MWF_DIVIDERSET;
- if (KillTimer(hwndDlg, TIMERID_FLASHWND)) {
- FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, FALSE, dat->hTabIcon);
- dat->mayFlashTab = FALSE;
- }
- if (dat->pContainer->dwFlashingStarted != 0) {
- FlashContainer(dat->pContainer, 0, 0);
- dat->pContainer->dwFlashingStarted = 0;
- }
- if (dat->dwFlagsEx & MWF_SHOW_FLASHCLIST) {
- dat->dwFlagsEx &= ~MWF_SHOW_FLASHCLIST;
- if (dat->hFlashingEvent != 0)
- CallService(MS_CLIST_REMOVEEVENT, dat->hContact, (LPARAM)dat->hFlashingEvent);
- dat->hFlashingEvent = 0;
- }
- dat->pContainer->dwFlags &= ~CNT_NEED_UPDATETITLE;
-
- if ((dat->dwFlags & MWF_DEFERREDREMAKELOG) && !IsIconic(dat->pContainer->hwnd)) {
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
- dat->dwFlags &= ~MWF_DEFERREDREMAKELOG;
- }
-
- if (dat->dwFlags & MWF_NEEDCHECKSIZE)
- PostMessage(hwndDlg, DM_SAVESIZE, 0, 0);
-
- if (PluginConfig.m_bAutoLocaleSupport) {
- if (dat->hkl == 0)
- DM_LoadLocale(dat);
- else
- SendMessage(hwndDlg, DM_SETLOCALE, 0, 0);
- }
-
- dat->pContainer->hIconTaskbarOverlay = 0;
- SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0);
-
- UpdateStatusBar(dat);
- dat->dwLastActivity = GetTickCount();
- dat->pContainer->dwLastActivity = dat->dwLastActivity;
-
- dat->pContainer->MenuBar->configureMenu();
- UpdateTrayMenuState(dat, FALSE);
-
- if (dat->pContainer->hwndActive == hwndDlg)
- PostMessage(hwndDlg, DM_REMOVEPOPUPS, PU_REMOVE_ON_FOCUS, 0);
-
- dat->Panel->Invalidate();
-
+
+static struct {
+ int id;
+ const TCHAR* text;
+}
+tooltips[] =
+{
+ { IDC_ADD, LPGENT("Add this contact permanently to your contact list") },
+ { IDC_CANCELADD, LPGENT("Do not add this contact permanently") },
+ { IDC_TOGGLESIDEBAR, LPGENT("Expand or collapse the side bar") }
+};
+
+static struct
+{
+ int id;
+ HICON *pIcon;
+}
+buttonicons[] =
+{
+ { IDC_ADD, &PluginConfig.g_buttonBarIcons[ICON_BUTTON_ADD] },
+ { IDC_CANCELADD, &PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL] }
+};
+
+static void _clrMsgFilter(LPARAM lParam)
+{
+ MSGFILTER *m = reinterpret_cast<MSGFILTER *>(lParam);
+ m->msg = 0;
+ m->lParam = 0;
+ m->wParam = 0;
+}
+
+BOOL TSAPI IsUtfSendAvailable(MCONTACT hContact)
+{
+ char *szProto = GetContactProto(hContact);
+ if (szProto == NULL)
+ return FALSE;
+
+ return (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDUTF) ? TRUE : FALSE;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// show a modified context menu for the richedit control(s)
+// @param dat message window data
+// @param idFrom dlg ctrl id
+// @param hwndFrom src window handle
+// @param pt mouse pointer position
+
+static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt)
+{
+ CHARRANGE sel, all = { 0, -1 };
+ int oldCodepage = dat->codePage;
+ HWND hwndDlg = dat->hwnd;
+
+ HMENU hSubMenu, hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ if (idFrom == IDC_LOG)
+ hSubMenu = GetSubMenu(hMenu, 0);
+ else {
+ hSubMenu = GetSubMenu(hMenu, 2);
+ EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, MF_BYCOMMAND | (dat->SendFormat != 0 ? MF_ENABLED : MF_GRAYED));
+ EnableMenuItem(hSubMenu, ID_EDITOR_PASTEANDSENDIMMEDIATELY, MF_BYCOMMAND | (PluginConfig.m_PasteAndSend ? MF_ENABLED : MF_GRAYED));
+ CheckMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, MF_BYCOMMAND | (PluginConfig.m_visualMessageSizeIndicator ? MF_CHECKED : MF_UNCHECKED));
+ EnableMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, MF_BYCOMMAND | (dat->pContainer->hwndStatus ? MF_ENABLED : MF_GRAYED));
+ }
+ TranslateMenu(hSubMenu);
+ SendMessage(hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin == sel.cpMax) {
+ EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
+ EnableMenuItem(hSubMenu, IDM_QUOTE, MF_BYCOMMAND | MF_GRAYED);
+ if (idFrom == IDC_MESSAGE)
+ EnableMenuItem(hSubMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED);
+ }
+
+ if (idFrom == IDC_LOG) {
+ InsertMenuA(hSubMenu, 6/*5*/, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
+ InsertMenu(hSubMenu, 7/*6*/, MF_BYPOSITION | MF_POPUP, (UINT_PTR)PluginConfig.g_hMenuEncoding, TranslateT("Character encoding"));
+ for (int i = 0; i < GetMenuItemCount(PluginConfig.g_hMenuEncoding); i++)
+ CheckMenuItem(PluginConfig.g_hMenuEncoding, i, MF_BYPOSITION | MF_UNCHECKED);
+
+ if (dat->codePage == CP_ACP)
+ CheckMenuItem(PluginConfig.g_hMenuEncoding, 0, MF_BYPOSITION | MF_CHECKED);
+ else
+ CheckMenuItem(PluginConfig.g_hMenuEncoding, dat->codePage, MF_BYCOMMAND | MF_CHECKED);
+
+ CheckMenuItem(hSubMenu, ID_LOG_FREEZELOG, MF_BYCOMMAND | (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED ? MF_CHECKED : MF_UNCHECKED));
+ }
+
+ MessageWindowPopupData mwpd;
+ if (idFrom == IDC_LOG || idFrom == IDC_MESSAGE) {
+ // First notification
+ mwpd.cbSize = sizeof(mwpd);
+ mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
+ mwpd.uFlags = (idFrom == IDC_LOG ? MSG_WINDOWPOPUP_LOG : MSG_WINDOWPOPUP_INPUT);
+ mwpd.hContact = dat->hContact;
+ mwpd.hwnd = hwndFrom;
+ mwpd.hMenu = hSubMenu;
+ mwpd.selection = 0;
+ mwpd.pt = pt;
+ NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
+ }
+
+ int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+
+ if (idFrom == IDC_LOG || idFrom == IDC_MESSAGE) {
+ // Second notification
+ mwpd.selection = iSelection;
+ mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
+ NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd);
+ }
+
+ if (((iSelection > 800 && iSelection < 1400) || iSelection == 20866) && idFrom == IDC_LOG) {
+ dat->codePage = iSelection;
+ db_set_dw(dat->hContact, SRMSGMOD_T, "ANSIcodepage", dat->codePage);
+ }
+ else if (iSelection == 500 && idFrom == IDC_LOG) {
+ dat->codePage = CP_ACP;
+ db_unset(dat->hContact, SRMSGMOD_T, "ANSIcodepage");
+ }
+ else {
+ switch (iSelection) {
+ case IDM_COPY:
+ SendMessage(hwndFrom, WM_COPY, 0, 0);
+ break;
+ case IDM_CUT:
+ SendMessage(hwndFrom, WM_CUT, 0, 0);
+ break;
+ case IDM_PASTE:
+ case IDM_PASTEFORMATTED:
+ if (idFrom == IDC_MESSAGE)
+ SendMessage(hwndFrom, EM_PASTESPECIAL, (iSelection == IDM_PASTE) ? CF_UNICODETEXT : 0, 0);
+ break;
+ case IDM_COPYALL:
+ SendMessage(hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
+ SendMessage(hwndFrom, WM_COPY, 0, 0);
+ SendMessage(hwndFrom, EM_EXSETSEL, 0, (LPARAM)&sel);
+ break;
+ case IDM_QUOTE:
+ SendMessage(hwndDlg, WM_COMMAND, IDC_QUOTE, 0);
+ break;
+ case IDM_SELECTALL:
+ SendMessage(hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
+ break;
+ case IDM_CLEAR:
+ ClearLog(dat);
+ break;
+ case ID_LOG_FREEZELOG:
+ SendDlgItemMessage(hwndDlg, IDC_LOG, WM_KEYDOWN, VK_F12, 0);
+ break;
+ case ID_EDITOR_SHOWMESSAGELENGTHINDICATOR:
+ PluginConfig.m_visualMessageSizeIndicator = !PluginConfig.m_visualMessageSizeIndicator;
+ db_set_b(0, SRMSGMOD_T, "msgsizebar", (BYTE)PluginConfig.m_visualMessageSizeIndicator);
+ M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 0);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ if (dat->pContainer->hwndStatus)
+ RedrawWindow(dat->pContainer->hwndStatus, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW);
+ break;
+ case ID_EDITOR_PASTEANDSENDIMMEDIATELY:
+ HandlePasteAndSend(dat);
+ break;
+ }
+ }
+ if (idFrom == IDC_LOG)
+ RemoveMenu(hSubMenu, 7, MF_BYPOSITION);
+ DestroyMenu(hMenu);
+ if (dat->codePage != (UINT)oldCodepage) {
+ SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETITLE, 0, 1);
+ }
+}
+
+static void ResizeIeView(const TWindowData *dat)
+{
+ RECT rcRichEdit;
+ GetWindowRect(GetDlgItem(dat->hwnd, IDC_LOG), &rcRichEdit);
+
+ POINT pt = { rcRichEdit.left, rcRichEdit.top };
+ ScreenToClient(dat->hwnd, &pt);
+
+ IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
+ ieWindow.iType = IEW_SETPOS;
+ ieWindow.parent = dat->hwnd;
+ ieWindow.hwnd = dat->hwndIEView ? dat->hwndIEView : dat->hwndHPP;
+ ieWindow.x = pt.x;
+ ieWindow.y = pt.y;
+ ieWindow.cx = rcRichEdit.right - rcRichEdit.left;
+ ieWindow.cy = rcRichEdit.bottom - rcRichEdit.top;
+ if (ieWindow.cx != 0 && ieWindow.cy != 0)
+ CallService(dat->hwndIEView ? MS_IEVIEW_WINDOW : MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
+}
+
+LRESULT CALLBACK IEViewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+
+ switch (msg) {
+ case WM_NCCALCSIZE:
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, IEViewSubclassProc);
+ case WM_NCPAINT:
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, IEViewSubclassProc);
+ }
+ return mir_callNextSubclass(hwnd, IEViewSubclassProc, msg, wParam, lParam);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// sublassing procedure for the h++ based message log viewer
+
+LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+ if (mwdat) {
+ BOOL isCtrl, isShift, isAlt;
+ KbdState(mwdat, isShift, isCtrl, isAlt);
+
+ switch (msg) {
+ case WM_NCCALCSIZE:
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, HPPKFSubclassProc);
+ case WM_NCPAINT:
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, HPPKFSubclassProc);
+
+ case WM_KEYDOWN:
+ if (!isCtrl && !isAlt && !isShift) {
+ if (wParam != VK_PRIOR && wParam != VK_NEXT && wParam != VK_DELETE &&
+ wParam != VK_MENU && wParam != VK_END && wParam != VK_HOME &&
+ wParam != VK_UP && wParam != VK_DOWN && wParam != VK_LEFT &&
+ wParam != VK_RIGHT && wParam != VK_TAB && wParam != VK_SPACE)
+ {
+ SetFocus(GetDlgItem(mwdat->hwnd, IDC_MESSAGE));
+ keybd_event((BYTE)wParam, (BYTE)MapVirtualKey(wParam, 0), KEYEVENTF_EXTENDEDKEY | 0, 0);
+ return 0;
+ }
+ break;
+ }
+ }
+ }
+ return mir_callNextSubclass(hwnd, HPPKFSubclassProc, msg, wParam, lParam);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// update state of the container - this is called whenever a tab becomes active, no matter how and
+// deals with various things like updating the title bar, removing flashing icons, updating the
+// session list, switching the keyboard layout (autolocale active) and the general container status.
+//
+// it protects itself from being called more than once per session activation and is valid for
+// normal IM sessions *only*. Group chat sessions have their own activation handler (see chat/window.c)
+
+static void MsgWindowUpdateState(TWindowData *dat, UINT msg)
+{
+ if (dat == NULL || dat->iTabID < 0)
+ return;
+
+ HWND hwndDlg = dat->hwnd;
+ HWND hwndTab = GetParent(hwndDlg);
+
+ if (msg == WM_ACTIVATE) {
+ if (dat->pContainer->dwFlags & CNT_TRANSPARENCY) {
+ DWORD trans = LOWORD(dat->pContainer->settings->dwTransparency);
+ SetLayeredWindowAttributes(dat->pContainer->hwnd, 0, (BYTE)trans, (dat->pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0));
+ }
+ }
+
+ if (dat->bIsAutosizingInput && dat->iInputAreaHeight == -1) {
+ dat->iInputAreaHeight = 0;
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
+ }
+
+ if (dat->pWnd)
+ dat->pWnd->activateTab();
+ dat->Panel->dismissConfig();
+ dat->dwUnread = 0;
+ if (dat->pContainer->hwndSaved == hwndDlg)
+ return;
+
+ dat->pContainer->hwndSaved = hwndDlg;
+
+ dat->dwTickLastEvent = 0;
+ dat->dwFlags &= ~MWF_DIVIDERSET;
+ if (KillTimer(hwndDlg, TIMERID_FLASHWND)) {
+ FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, FALSE, dat->hTabIcon);
+ dat->mayFlashTab = FALSE;
+ }
+ if (dat->pContainer->dwFlashingStarted != 0) {
+ FlashContainer(dat->pContainer, 0, 0);
+ dat->pContainer->dwFlashingStarted = 0;
+ }
+ if (dat->dwFlagsEx & MWF_SHOW_FLASHCLIST) {
+ dat->dwFlagsEx &= ~MWF_SHOW_FLASHCLIST;
+ if (dat->hFlashingEvent != 0)
+ CallService(MS_CLIST_REMOVEEVENT, dat->hContact, (LPARAM)dat->hFlashingEvent);
+ dat->hFlashingEvent = 0;
+ }
+ dat->pContainer->dwFlags &= ~CNT_NEED_UPDATETITLE;
+
+ if ((dat->dwFlags & MWF_DEFERREDREMAKELOG) && !IsIconic(dat->pContainer->hwnd)) {
+ SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
+ dat->dwFlags &= ~MWF_DEFERREDREMAKELOG;
+ }
+
+ if (dat->dwFlags & MWF_NEEDCHECKSIZE)
+ PostMessage(hwndDlg, DM_SAVESIZE, 0, 0);
+
+ if (PluginConfig.m_bAutoLocaleSupport) {
+ if (dat->hkl == 0)
+ DM_LoadLocale(dat);
+ else
+ SendMessage(hwndDlg, DM_SETLOCALE, 0, 0);
+ }
+
+ dat->pContainer->hIconTaskbarOverlay = 0;
+ SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0);
+
+ UpdateStatusBar(dat);
+ dat->dwLastActivity = GetTickCount();
+ dat->pContainer->dwLastActivity = dat->dwLastActivity;
+
+ dat->pContainer->MenuBar->configureMenu();
+ UpdateTrayMenuState(dat, FALSE);
+
+ if (dat->pContainer->hwndActive == hwndDlg)
+ PostMessage(hwndDlg, DM_REMOVEPOPUPS, PU_REMOVE_ON_FOCUS, 0);
+
+ dat->Panel->Invalidate();
+
if (dat->dwFlags & MWF_DEFERREDSCROLL && dat->hwndIEView == 0 && dat->hwndHPP == 0) {
dat->dwFlags &= ~MWF_DEFERREDSCROLL;
DM_ScrollToBottom(dat, 0, 1);
}
-
- DM_SetDBButtonStates(hwndDlg, dat);
-
- if (dat->hwndIEView) {
- RECT rcRTF;
- POINT pt;
-
- GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rcRTF);
- rcRTF.left += 20;
- rcRTF.top += 20;
- pt.x = rcRTF.left;
- pt.y = rcRTF.top;
- if (dat->hwndIEView) {
- if (M.GetByte("subclassIEView", 0)) {
- mir_subclassWindow(dat->hwndIEView, IEViewSubclassProc);
- SetWindowPos(dat->hwndIEView, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME);
- RedrawWindow(dat->hwndIEView, 0, 0, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
- }
- }
- dat->hwndIWebBrowserControl = WindowFromPoint(pt);
- }
-
- if (dat->dwFlagsEx & MWF_EX_DELAYEDSPLITTER) {
- dat->dwFlagsEx &= ~MWF_EX_DELAYEDSPLITTER;
- ShowWindow(dat->pContainer->hwnd, SW_RESTORE);
- PostMessage(hwndDlg, DM_SPLITTERGLOBALEVENT, dat->wParam, dat->lParam);
- dat->wParam = dat->lParam = 0;
- }
- if (dat->dwFlagsEx & MWF_EX_AVATARCHANGED) {
- dat->dwFlagsEx &= ~MWF_EX_AVATARCHANGED;
- PostMessage(hwndDlg, DM_UPDATEPICLAYOUT, 0, 0);
- }
- BB_SetButtonsPos(dat);
- if (M.isAero())
- InvalidateRect(hwndTab, NULL, FALSE);
- if (dat->pContainer->dwFlags & CNT_SIDEBAR)
- dat->pContainer->SideBar->setActiveItem(dat);
-
- if (dat->pWnd)
- dat->pWnd->Invalidate();
-}
-
-void TSAPI ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControls, int state)
-{
- for (int i = 0; i < cControls; i++)
- Utils::showDlgControl(hwndDlg, controls[i], state);
-}
-
-void TSAPI SetDialogToType(HWND hwndDlg)
-{
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (dat->hContact) {
- if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
- dat->bNotOnList = TRUE;
- ShowMultipleControls(hwndDlg, addControls, 2, SW_SHOW);
- Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_SHOW);
- SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, TranslateT("Contact not on list. You may add it..."));
- }
- else {
- ShowMultipleControls(hwndDlg, addControls, 2, SW_HIDE);
- dat->bNotOnList = FALSE;
- Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_HIDE);
- }
- }
-
- Utils::enableDlgControl(hwndDlg, IDC_TIME, true);
-
- if (dat->hwndIEView || dat->hwndHPP) {
- Utils::showDlgControl(hwndDlg, IDC_LOG, SW_HIDE);
- Utils::enableDlgControl(hwndDlg, IDC_LOG, false);
- Utils::showDlgControl(hwndDlg, IDC_MESSAGE, SW_SHOW);
- }
- else ShowMultipleControls(hwndDlg, sendControls, sizeof(sendControls) / sizeof(sendControls[0]), SW_SHOW);
-
- ShowMultipleControls(hwndDlg, errorControls, sizeof(errorControls) / sizeof(errorControls[0]), dat->dwFlags & MWF_ERRORSTATE ? SW_SHOW : SW_HIDE);
-
- if (!dat->SendFormat)
- ShowMultipleControls(hwndDlg, &formatControls[1], 5, SW_HIDE);
-
- ConfigureSmileyButton(dat);
-
- if (dat->pContainer->hwndActive == hwndDlg)
- UpdateReadChars(dat);
-
- SetDlgItemText(hwndDlg, IDC_STATICTEXT, TranslateT("A message failed to send successfully."));
-
- DM_RecalcPictureSize(dat);
- GetAvatarVisibility(hwndDlg, dat);
-
- Utils::showDlgControl(hwndDlg, IDC_CONTACTPIC, dat->bShowAvatar ? SW_SHOW : SW_HIDE);
- Utils::showDlgControl(hwndDlg, IDC_SPLITTER, dat->bIsAutosizingInput ? SW_HIDE : SW_SHOW);
- Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
-
- EnableSendButton(dat, GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
- SendMessage(hwndDlg, DM_UPDATETITLE, 0, 1);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
-
- Utils::enableDlgControl(hwndDlg, IDC_CONTACTPIC, false);
-
- dat->Panel->Configure();
-}
-
-static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- HWND hwndParent = GetParent(hwnd);
- TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- BOOL isCtrl, isShift, isAlt;
- KbdState(mwdat, isShift, isCtrl, isAlt);
-
- switch (msg) {
- case WM_KILLFOCUS:
- if (wParam != (WPARAM)hwnd && 0 != wParam) {
- CHARRANGE cr;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&cr);
- if (cr.cpMax != cr.cpMin) {
- cr.cpMin = cr.cpMax;
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr);
- }
- }
- break;
-
- case WM_CHAR:
- if (wParam == 0x03 && isCtrl) // Ctrl+C
- return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
- if (wParam == 0x11 && isCtrl)
- SendMessage(mwdat->hwnd, WM_COMMAND, IDC_QUOTE, 0);
- break;
-
- case WM_SYSKEYUP:
- if (wParam == VK_MENU) {
- ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_LOG);
- return 0;
- }
- break;
-
- case WM_SYSKEYDOWN:
- mwdat->fkeyProcessed = false;
- if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_LOG)) {
- mwdat->fkeyProcessed = true;
- return 0;
- }
- break;
-
- case WM_SYSCHAR:
- if (mwdat->fkeyProcessed) {
- mwdat->fkeyProcessed = false;
- return 0;
- }
- break;
-
- case WM_KEYDOWN:
- if (wParam == VK_INSERT && isCtrl)
- return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
- break;
-
- case WM_COPY:
- return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
-
- case WM_NCCALCSIZE:
- return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, MessageLogSubclassProc);
-
- case WM_NCPAINT:
- return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, MessageLogSubclassProc);
-
- case WM_CONTEXTMENU:
- POINT pt;
-
- if (lParam == 0xFFFFFFFF) {
- CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
- ClientToScreen(hwnd, &pt);
- }
- else {
- pt.x = (short)LOWORD(lParam);
- pt.y = (short)HIWORD(lParam);
- }
-
- ShowPopupMenu(mwdat, IDC_LOG, hwnd, pt);
- return TRUE;
- }
-
- return mir_callNextSubclass(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
-}
-
-static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- BOOL isCtrl, isShift, isAlt;
- HWND hwndParent = GetParent(hwnd);
- TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- if (mwdat == NULL)
- return 0;
-
- // prevent the rich edit from switching text direction or keyboard layout when
- // using hotkeys with ctrl-shift or alt-shift modifiers
- if (mwdat->fkeyProcessed && (msg == WM_KEYUP)) {
- GetKeyboardState(mwdat->kstate);
- if (mwdat->kstate[VK_CONTROL] & 0x80 || mwdat->kstate[VK_SHIFT] & 0x80)
- return 0;
-
- mwdat->fkeyProcessed = false;
- return 0;
- }
-
- switch (msg) {
- case WM_NCCALCSIZE:
- return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageEditSubclassProc);
-
- case WM_NCPAINT:
- return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageEditSubclassProc);
-
- case WM_DROPFILES:
- SendMessage(hwndParent, WM_DROPFILES, (WPARAM)wParam, (LPARAM)lParam);
- return 0;
-
- case WM_CHAR:
- KbdState(mwdat, isShift, isCtrl, isAlt);
-
- if (PluginConfig.m_bSoundOnTyping && !isAlt && !isCtrl && !(mwdat->pContainer->dwFlags & CNT_NOSOUND) && wParam != VK_ESCAPE && !(wParam == VK_TAB && PluginConfig.m_bAllowTab))
- SkinPlaySound("SoundOnTyping");
-
- if (isCtrl && !isAlt) {
- switch (wParam) {
- case 0x02: // bold
- if (mwdat->SendFormat)
- SendMessage(hwndParent, WM_COMMAND, MAKELONG(IDC_FONTBOLD, IDC_MESSAGE), 0);
- return 0;
- case 0x09:
- if (mwdat->SendFormat)
- SendMessage(hwndParent, WM_COMMAND, MAKELONG(IDC_FONTITALIC, IDC_MESSAGE), 0);
- return 0;
- case 21:
- if (mwdat->SendFormat)
- SendMessage(hwndParent, WM_COMMAND, MAKELONG(IDC_FONTUNDERLINE, IDC_MESSAGE), 0);
- return 0;
- case 0x0b:
- SetWindowText(hwnd, _T(""));
- return 0;
- }
- }
- break;
-
- case WM_MOUSEWHEEL:
- if (DM_MouseWheelHandler(hwnd, hwndParent, mwdat, wParam, lParam) == 0)
- return 0;
- break;
-
- case EM_PASTESPECIAL:
- case WM_PASTE:
- if (OpenClipboard(hwnd)) {
- HANDLE hClip = GetClipboardData(CF_TEXT);
- if (hClip) {
- if (mir_strlen((char*)hClip) > mwdat->nMax) {
- TCHAR szBuffer[512];
- if (M.GetByte("autosplit", 0))
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("WARNING: The message you are trying to paste exceeds the message size limit for the active protocol. It will be sent in chunks of max %d characters"), mwdat->nMax - 10);
- else
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("The message you are trying to paste exceeds the message size limit for the active protocol. Only the first %d characters will be sent."), mwdat->nMax);
- SendMessage(hwndParent, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)szBuffer);
- }
- }
- else if (hClip = GetClipboardData(CF_BITMAP))
- SendHBitmapAsFile(mwdat, (HBITMAP)hClip);
-
- CloseClipboard();
- }
- break;
-
- case WM_KEYDOWN:
- KbdState(mwdat, isShift, isCtrl, isAlt);
-
- if (PluginConfig.m_bSoundOnTyping && !isAlt && !(mwdat->pContainer->dwFlags & CNT_NOSOUND) && wParam == VK_DELETE)
- SkinPlaySound("SoundOnTyping");
-
- if (wParam == VK_INSERT && !isShift && !isCtrl && !isAlt) {
- mwdat->fInsertMode = !mwdat->fInsertMode;
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
- }
- if (wParam == VK_CAPITAL || wParam == VK_NUMLOCK)
- SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
-
- if (wParam == VK_RETURN) {
- if (mwdat->fEditNotesActive)
- break;
-
- if (isShift) {
- if (PluginConfig.m_bSendOnShiftEnter) {
- PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
- return 0;
- }
- else break;
- }
- if ((isCtrl && !isShift) ^ (0 != PluginConfig.m_bSendOnEnter)) {
- PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
- return 0;
- }
- if (PluginConfig.m_bSendOnEnter || PluginConfig.m_bSendOnDblEnter) {
- if (isCtrl)
- break;
-
- if (PluginConfig.m_bSendOnDblEnter) {
- LONG_PTR lastEnterTime = GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (lastEnterTime + 2 < time(NULL)) {
- lastEnterTime = time(NULL);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, lastEnterTime);
- break;
- }
- else {
- SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
- SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
- PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
- return 0;
- }
- }
- PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
- return 0;
- }
- else break;
- }
- else SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
-
- if (isCtrl && !isAlt && !isShift) {
- if (!isShift && (wParam == VK_UP || wParam == VK_DOWN)) { // input history scrolling (ctrl-up / down)
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- if (mwdat)
- mwdat->cache->inputHistoryEvent(wParam);
- return 0;
- }
- }
- if (isCtrl && isAlt && !isShift) {
- switch (wParam) {
- case VK_UP:
- case VK_DOWN:
- case VK_PRIOR:
- case VK_NEXT:
- case VK_HOME:
- case VK_END:
- WPARAM wp = 0;
-
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- if (wParam == VK_UP)
- wp = MAKEWPARAM(SB_LINEUP, 0);
- else if (wParam == VK_PRIOR)
- wp = MAKEWPARAM(SB_PAGEUP, 0);
- else if (wParam == VK_NEXT)
- wp = MAKEWPARAM(SB_PAGEDOWN, 0);
- else if (wParam == VK_HOME)
- wp = MAKEWPARAM(SB_TOP, 0);
- else if (wParam == VK_END) {
- DM_ScrollToBottom(mwdat, 0, 0);
- return 0;
- }
- else if (wParam == VK_DOWN)
- wp = MAKEWPARAM(SB_LINEDOWN, 0);
-
- if (mwdat->hwndIEView == 0 && mwdat->hwndHPP == 0)
- SendDlgItemMessage(hwndParent, IDC_LOG, WM_VSCROLL, wp, 0);
- else
- SendMessage(mwdat->hwndIWebBrowserControl, WM_VSCROLL, wp, 0);
- return 0;
- }
- }
- if (wParam == VK_RETURN)
- break;
-
- case WM_SYSKEYDOWN:
- mwdat->fkeyProcessed = false;
- if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_MESSAGE)) {
- mwdat->fkeyProcessed = true;
- return 0;
- }
- break;
-
- case WM_SYSKEYUP:
- if (wParam == VK_MENU) {
- ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_MESSAGE);
- return 0;
- }
- break;
-
- case WM_SYSCHAR:
- if (mwdat->fkeyProcessed) {
- mwdat->fkeyProcessed = false;
- return 0;
- }
-
- KbdState(mwdat, isShift, isCtrl, isAlt);
- if ((wParam >= '0' && wParam <= '9') && isAlt) { // ALT-1 -> ALT-0 direct tab selection
- BYTE bChar = (BYTE)wParam;
- int iIndex;
-
- if (bChar == '0')
- iIndex = 10;
- else
- iIndex = bChar - (BYTE)'0';
- SendMessage(mwdat->pContainer->hwnd, DM_SELECTTAB, DM_SELECT_BY_INDEX, (LPARAM)iIndex);
- return 0;
- }
- break;
-
- case WM_INPUTLANGCHANGE:
- if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == hwnd && mwdat->pContainer->hwndActive == hwndParent && GetForegroundWindow() == mwdat->pContainer->hwnd && GetActiveWindow() == mwdat->pContainer->hwnd) {
- DM_SaveLocale(mwdat, wParam, lParam);
- SendMessage(hwnd, EM_SETLANGOPTIONS, 0, (LPARAM)SendMessage(hwnd, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
- return 1;
- }
- break;
-
- case WM_ERASEBKGND:
- return(CSkin::m_skinEnabled ? 0 : 1);
-
- // sent by smileyadd when the smiley selection window dies
- // just grab the focus :)
- case WM_USER + 100:
- SetFocus(hwnd);
- break;
-
- case WM_CONTEXTMENU:
- POINT pt;
- if (lParam == 0xFFFFFFFF) {
- CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
- ClientToScreen(hwnd, &pt);
- }
- else {
- pt.x = (short)LOWORD(lParam);
- pt.y = (short)HIWORD(lParam);
- }
-
- ShowPopupMenu(mwdat, IDC_MESSAGE, hwnd, pt);
- return TRUE;
- }
- return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// subclasses the avatar display controls, needed for skinning and to prevent
-// it from flickering during resize/move operations.
-
-static LRESULT CALLBACK AvatarSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_ERASEBKGND:
- return TRUE;
-
- case WM_UPDATEUISTATE:
- return TRUE;
-
- case WM_NOTIFY:
- ProcessAvatarChange(hwnd, lParam);
- break;
- }
- return mir_callNextSubclass(hwnd, AvatarSubclassProc, msg, wParam, lParam);
-}
-
-LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- RECT rc;
- HWND hwndParent = GetParent(hwnd);
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
-
- switch (msg) {
- case WM_NCHITTEST:
- return HTCLIENT;
-
- case WM_SETCURSOR:
- GetClientRect(hwnd, &rc);
- SetCursor(rc.right > rc.bottom ? PluginConfig.hCurSplitNS : PluginConfig.hCurSplitWE);
- return TRUE;
-
- case WM_LBUTTONDOWN:
- if (hwnd == GetDlgItem(hwndParent, IDC_SPLITTER) || hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY)) {
- if (dat) {
- GetClientRect(hwnd, &rc);
- dat->savedSplitter = rc.right > rc.bottom ? (short)HIWORD(GetMessagePos()) + rc.bottom / 2 : (short)LOWORD(GetMessagePos()) + rc.right / 2;
- if (dat->bType == SESSIONTYPE_IM)
- dat->savedSplitY = dat->splitterY;
- else
- dat->savedSplitY = dat->si->iSplitterY;
-
- dat->savedDynaSplit = dat->dynaSplitter;
- }
- }
- SetCapture(hwnd);
- return 0;
-
- case WM_MOUSEMOVE:
- if (GetCapture() == hwnd) {
- GetClientRect(hwnd, &rc);
- SendMessage(hwndParent, DM_SPLITTERMOVED, rc.right > rc.bottom ? (short)HIWORD(GetMessagePos()) + rc.bottom / 2 : (short)LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM)hwnd);
- }
- return 0;
-
- case WM_ERASEBKGND:
- return 1;
-
- case WM_PAINT:
- GetClientRect(hwnd, &rc);
- {
- PAINTSTRUCT ps;
- HDC dc = BeginPaint(hwnd, &ps);
-
- if (dat && CSkin::m_skinEnabled)
- CSkin::SkinDrawBG(hwnd, dat->pContainer->hwnd, dat->pContainer, &rc, dc);
- else if (M.isAero() || M.isVSThemed()) {
- if (GetDlgCtrlID(hwnd) == IDC_PANELSPLITTER) {
- EndPaint(hwnd, &ps);
- return 0;
- }
- CSkin::FillBack(dc, &rc);
- }
- else CSkin::FillBack(dc, &rc);
-
- EndPaint(hwnd, &ps);
- }
- return 0;
-
- case WM_LBUTTONUP:
- HWND hwndCapture = GetCapture();
-
- ReleaseCapture();
- DM_ScrollToBottom(dat, 0, 1);
- if (dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_PANELSPLITTER)) {
- SendMessage(hwndParent, WM_SIZE, 0, 0);
- RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
- }
- else if ((dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_SPLITTER)) ||
- (dat && dat->bType == SESSIONTYPE_CHAT && hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY))) {
- POINT pt;
- int selection;
- HMENU hMenu = GetSubMenu(dat->pContainer->hMenuContext, 12);
- LONG messagePos = GetMessagePos();
-
- GetClientRect(hwnd, &rc);
- if (hwndCapture != hwnd || dat->savedSplitter == (rc.right > rc.bottom ? (short) HIWORD(messagePos) + rc.bottom / 2 : (short) LOWORD(messagePos) + rc.right / 2))
- break;
- GetCursorPos(&pt);
-
- if (dat->bIsAutosizingInput)
- selection = ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION;
- else
- selection = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, NULL);
-
- switch (selection) {
- case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY:
- dat->dwFlagsEx |= MWF_SHOW_SPLITTEROVERRIDE;
- db_set_b(dat->hContact, SRMSGMOD_T, "splitoverride", 1);
- if (dat->bType == SESSIONTYPE_IM)
- SaveSplitter(dat);
- break;
-
- case ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION:
- if (dat->bIsAutosizingInput) {
- GetWindowRect(GetDlgItem(dat->hwnd, IDC_MESSAGE), &rc);
- dat->iInputAreaHeight = 0;
- }
- break;
-
- case ID_SPLITTERCONTEXT_SAVEGLOBALFORALLSESSIONS:
- {
- BYTE bSync = M.GetByte(CHAT_MODULE, "SyncSplitter", 0);
- DWORD dwOff_IM = 0, dwOff_CHAT = 0;
-
- dwOff_CHAT = -(2 + (PluginConfig.m_DPIscaleY > 1.0 ? 1 : 0));
- dwOff_IM = 2 + (PluginConfig.m_DPIscaleY > 1.0 ? 1 : 0);
-
- RECT rcWin;
- GetWindowRect(hwndParent, &rcWin);
-
- PluginConfig.lastSPlitterPos.pSrcDat = dat;
- PluginConfig.lastSPlitterPos.pSrcContainer = dat->pContainer;
- PluginConfig.lastSPlitterPos.lParam = rc.bottom;
- PluginConfig.lastSPlitterPos.pos = rcWin.bottom - HIWORD(messagePos);
- PluginConfig.lastSPlitterPos.pos_chat = rcWin.bottom - (short)HIWORD(messagePos) + rc.bottom / 2;
- PluginConfig.lastSPlitterPos.off_chat = dwOff_CHAT;
- PluginConfig.lastSPlitterPos.off_im = dwOff_IM;
- PluginConfig.lastSPlitterPos.bSync = bSync;
- SendMessage(dat->hwnd, DM_SPLITTERGLOBALEVENT, 0, 0);
- M.BroadcastMessage(DM_SPLITTERGLOBALEVENT, 0, 0);
- }
- break;
-
- default:
- dat->splitterY = dat->savedSplitY;
- dat->dynaSplitter = dat->savedDynaSplit;
- DM_RecalcPictureSize(dat);
- if (dat->bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = dat->si;
- si->iSplitterY = dat->savedSplitY;
- dat->splitterY = si->iSplitterY + DPISCALEY_S(22);
- }
- CSkin::UpdateToolbarBG(dat);
- SendMessage(hwndParent, WM_SIZE, 0, 0);
- DM_ScrollToBottom(dat, 0, 1);
- break;
- }
- }
- return 0;
- }
- return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// resizer proc for the "new" layout.
-
-static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc)
-{
- TWindowData *dat = (TWindowData*)lParam;
- RECT rc, rcButton;
- static int uinWidth, msgTop = 0, msgBottom = 0;
-
- int showToolbar = dat->pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
- BOOL bBottomToolbar = dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR ? 1 : 0;
- static LONG rcLogBottom;
-
- int panelHeight = dat->Panel->getHeight() + 1;
- int s_offset = 0;
- bool bInfoPanel = dat->Panel->isActive();
- bool fErrorState = (dat->dwFlags & MWF_ERRORSTATE) ? true : false;
-
- GetClientRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
- GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rcButton);
-
- if (dat->panelStatusCX == 0)
- dat->panelStatusCX = 80;
-
- s_offset = 1;
-
- switch (urc->wId) {
- case IDC_PANELSPLITTER:
- urc->rcItem.bottom = panelHeight;
- urc->rcItem.top = panelHeight - 2;
- return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP;
-
- case IDC_LOG:
- if (dat->dwFlags & MWF_ERRORSTATE)
- urc->rcItem.bottom -= ERRORPANEL_HEIGHT;
- if (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED || dat->bNotOnList)
- urc->rcItem.bottom -= 20;
- if (dat->sendMode & SMODE_MULTIPLE)
- urc->rcItem.right -= (dat->multiSplitterX + 3);
- urc->rcItem.bottom -= dat->splitterY - dat->originalSplitterY;
- if (!showToolbar||bBottomToolbar)
- urc->rcItem.bottom += 21;
- if (bInfoPanel)
- urc->rcItem.top += panelHeight;
- urc->rcItem.bottom += 3;
- if (CSkin::m_skinEnabled) {
- CSkinItem *item = &SkinItems[ID_EXTBKHISTORY];
- if (!item->IGNORED) {
- urc->rcItem.left += item->MARGIN_LEFT;
- urc->rcItem.right -= item->MARGIN_RIGHT;
- urc->rcItem.top += item->MARGIN_TOP;
- urc->rcItem.bottom -= item->MARGIN_BOTTOM;
- }
- }
- rcLogBottom = urc->rcItem.bottom;
- return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
-
- case IDC_CONTACTPIC:
- GetClientRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &rc);
- urc->rcItem.top -= dat->splitterY - dat->originalSplitterY;
- urc->rcItem.left = urc->rcItem.right - (dat->pic.cx + 2);
- if ((urc->rcItem.bottom - urc->rcItem.top) < (dat->pic.cy/* + 2*/) && dat->bShowAvatar) {
- urc->rcItem.top = urc->rcItem.bottom - dat->pic.cy;
- dat->bUseOffset = true;
- }
- else dat->bUseOffset = false;
-
- if (showToolbar && bBottomToolbar && (PluginConfig.m_bAlwaysFullToolbarWidth || ((dat->pic.cy - DPISCALEY_S(6)) < rc.bottom))) {
- urc->rcItem.bottom -= DPISCALEY_S(22);
- if (dat->bIsAutosizingInput) {
- urc->rcItem.left--;
- urc->rcItem.top--;
- }
- }
-
- if (dat->hwndContactPic) //if Panel control was created?
- SetWindowPos(dat->hwndContactPic, HWND_TOP, 1, ((urc->rcItem.bottom - urc->rcItem.top) - (dat->pic.cy)) / 2 + 1, //resizes it
- dat->pic.cx - 2, dat->pic.cy - 2, SWP_SHOWWINDOW);
-
- return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
-
- case IDC_SPLITTER:
- urc->rcItem.right = urc->dlgNewSize.cx;
- urc->rcItem.top -= dat->splitterY - dat->originalSplitterY;
- urc->rcItem.bottom = urc->rcItem.top + 2;
- OffsetRect(&urc->rcItem, 0, 1);
- urc->rcItem.left = 0;
-
- if (dat->bUseOffset)
- urc->rcItem.right -= (dat->pic.cx); // + DPISCALEX(2));
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
-
- case IDC_MESSAGE:
- urc->rcItem.right = urc->dlgNewSize.cx;
- if (dat->bShowAvatar)
- urc->rcItem.right -= dat->pic.cx + 2;
- urc->rcItem.top -= dat->splitterY - dat->originalSplitterY;
- if (bBottomToolbar&&showToolbar)
- urc->rcItem.bottom -= DPISCALEY_S(22);
-
- if (dat->bIsAutosizingInput)
- urc->rcItem.top -= DPISCALEY_S(1);
-
- msgTop = urc->rcItem.top;
- msgBottom = urc->rcItem.bottom;
- if (CSkin::m_skinEnabled) {
- CSkinItem *item = &SkinItems[ID_EXTBKINPUTAREA];
- if (!item->IGNORED) {
- urc->rcItem.left += item->MARGIN_LEFT;
- urc->rcItem.right -= item->MARGIN_RIGHT;
- urc->rcItem.top += item->MARGIN_TOP;
- urc->rcItem.bottom -= item->MARGIN_BOTTOM;
- }
- }
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
-
- case IDC_MULTISPLITTER:
- if (bInfoPanel)
- urc->rcItem.top += panelHeight;
- urc->rcItem.left -= dat->multiSplitterX;
- urc->rcItem.right -= dat->multiSplitterX;
- urc->rcItem.bottom = rcLogBottom;
- return RD_ANCHORX_RIGHT | RD_ANCHORY_HEIGHT;
-
- case IDC_LOGFROZENTEXT:
- urc->rcItem.right = urc->dlgNewSize.cx - 50;
- urc->rcItem.bottom = msgTop - (bBottomToolbar ? 0 : 28);
- urc->rcItem.top = msgTop - 16 - (bBottomToolbar ? 0 : 28);
- if (!showToolbar && !bBottomToolbar) {
- urc->rcItem.bottom += 21;
- urc->rcItem.top += 21;
- }
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
-
- case IDC_ADD:
- urc->rcItem.bottom = msgTop - (bBottomToolbar ? 0 : 28);
- urc->rcItem.top = msgTop - 18 - (bBottomToolbar ? 0 : 28);
- urc->rcItem.right = urc->dlgNewSize.cx - 28;
- urc->rcItem.left = urc->rcItem.right - 20;
- if (!showToolbar && !bBottomToolbar) {
- urc->rcItem.bottom += 21;
- urc->rcItem.top += 21;
- }
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
-
- case IDC_CANCELADD:
- urc->rcItem.bottom = msgTop - (bBottomToolbar ? 0 : 28);
- urc->rcItem.top = msgTop - 18 - (bBottomToolbar ? 0 : 28);
- urc->rcItem.right = urc->dlgNewSize.cx - 4;
- urc->rcItem.left = urc->rcItem.right - 20;
- if (!showToolbar && !bBottomToolbar) {
- urc->rcItem.bottom += 21;
- urc->rcItem.top += 21;
- }
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
-
- case IDC_TOGGLESIDEBAR:
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
-
- case IDC_RETRY:
- case IDC_CANCELSEND:
- case IDC_MSGSENDLATER:
- if (fErrorState) {
- urc->rcItem.bottom = msgTop - 5 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
- urc->rcItem.top = msgTop - 25 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
- }
- if (!showToolbar && !bBottomToolbar) {
- urc->rcItem.bottom += 21;
- urc->rcItem.top += 21;
- }
- return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
-
- case IDC_STATICTEXT:
- case IDC_STATICERRORICON:
- if (fErrorState) {
- urc->rcItem.bottom = msgTop - 28 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
- urc->rcItem.top = msgTop - 45 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
- }
- if (!showToolbar && !bBottomToolbar) {
- urc->rcItem.bottom += 21;
- urc->rcItem.top += 21;
- }
- return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
- }
- return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
-}
-
-INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- TContainerData *m_pContainer = 0;
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- HWND hwndTab = GetParent(hwndDlg), hwndContainer;
- POINT pt, tmp, cur;
- RECT rc;
-
- if (dat == 0) {
- if (msg == WM_ACTIVATE || msg == WM_SETFOCUS)
- return 0;
- hwndContainer = NULL;
- }
- else {
- m_pContainer = dat->pContainer;
- hwndContainer = m_pContainer->hwnd;
- }
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- TNewWindowData *newData = (TNewWindowData*)lParam;
-
- dat = (TWindowData*)mir_calloc(sizeof(TWindowData));
- if (newData->iTabID >= 0) {
- dat->pContainer = newData->pContainer;
- m_pContainer = dat->pContainer;
- hwndContainer = m_pContainer->hwnd;
- }
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
-
- if (Utils::rtf_ctable == 0)
- Utils::RTF_CTableInit();
-
- dat->dwFlags |= MWF_INITMODE;
- dat->bType = SESSIONTYPE_IM;
- dat->fInsertMode = FALSE;
- dat->fLimitedUpdate = false;
- dat->Panel = new CInfoPanel(dat);
-
- newData->item.lParam = (LPARAM)hwndDlg;
- TabCtrl_SetItem(hwndTab, newData->iTabID, &newData->item);
- dat->iTabID = newData->iTabID;
- dat->hwnd = hwndDlg;
-
- DM_ThemeChanged(dat);
-
- pszIDCSAVE_close = TranslateT("Close session");
- pszIDCSAVE_save = TranslateT("Save and close session");
-
- dat->hContact = newData->hContact;
- dat->cache = CContactCache::getContactCache(dat->hContact);
- dat->cache->updateState();
- dat->cache->setWindowData(hwndDlg, dat);
- M.AddWindow(hwndDlg, dat->hContact);
- BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0);
- dat->pWnd = 0;
- dat->sbCustom = 0;
- CProxyWindow::add(dat);
- dat->szProto = const_cast<char *>(dat->cache->getProto());
- dat->bIsMeta = dat->cache->isMeta();
- if (dat->bIsMeta)
- dat->cache->updateMeta();
-
- dat->cache->updateUIN();
-
- if (dat->hContact && dat->szProto != NULL) {
- dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
- _tcsncpy_s(dat->szStatus, pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, 0), _TRUNCATE);
- }
- else dat->wStatus = ID_STATUS_OFFLINE;
-
- for (int i = 0; i < SIZEOF(btnControls); i++)
- CustomizeButton(GetDlgItem(hwndDlg, btnControls[i]));
-
- GetMYUIN(dat);
- GetClientIcon(dat);
-
- CustomizeButton(CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
- hwndDlg, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL));
- dat->hwndPanelPicParent = CreateWindowEx(WS_EX_TOPMOST, _T("Static"), _T(""), SS_OWNERDRAW | WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, hwndDlg, (HMENU)6000, NULL, NULL);
- mir_subclassWindow(dat->hwndPanelPicParent, CInfoPanel::avatarParentSubclass);
-
- dat->bShowUIElements = (m_pContainer->dwFlags & CNT_HIDETOOLBAR) == 0;
- dat->sendMode |= M.GetByte(dat->hContact, "forceansi", 0) ? SMODE_FORCEANSI : 0;
- dat->sendMode |= dat->hContact == 0 ? SMODE_MULTIPLE : 0;
- dat->sendMode |= M.GetByte(dat->hContact, "no_ack", 0) ? SMODE_NOACK : 0;
-
- dat->hQueuedEvents = (MEVENT*)mir_calloc(sizeof(MEVENT)* EVENT_QUEUE_SIZE);
- dat->iEventQueueSize = EVENT_QUEUE_SIZE;
- dat->iCurrentQueueError = -1;
-
- // message history limit
- // hHistoryEvents holds up to n event handles
- dat->maxHistory = M.GetDword(dat->hContact, "maxhist", M.GetDword("maxhist", 0));
- dat->curHistory = 0;
- if (dat->maxHistory)
- dat->hHistoryEvents = (MEVENT*)mir_alloc(dat->maxHistory * sizeof(MEVENT));
- else
- dat->hHistoryEvents = NULL;
-
- if (dat->bIsMeta)
- SendMessage(hwndDlg, DM_UPDATEMETACONTACTINFO, 0, 0);
- else
- SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
- dat->bTabFlash = FALSE;
- dat->mayFlashTab = FALSE;
- GetMyNick(dat);
-
- dat->multiSplitterX = (int)M.GetDword(SRMSGMOD, "multisplit", 150);
- dat->nTypeMode = PROTOTYPE_SELFTYPING_OFF;
- SetTimer(hwndDlg, TIMERID_TYPE, 1000, NULL);
- dat->iLastEventType = 0xffffffff;
-
- // load log option flags...
- dat->dwFlags = dat->pContainer->theme.dwFlags;
-
- // consider per-contact message setting overrides
- if (dat->hContact && M.GetDword(dat->hContact, "mwmask", 0))
- LoadLocalFlags(dat);
-
- DM_InitTip(dat);
- dat->Panel->getVisibility();
-
- dat->dwFlagsEx |= M.GetByte(dat->hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0;
- dat->bIsAutosizingInput = IsAutoSplitEnabled(dat);
- dat->iInputAreaHeight = -1;
- SetMessageLog(dat);
- if (dat->hContact) {
- dat->codePage = M.GetDword(dat->hContact, "ANSIcodepage", CP_ACP);
- dat->Panel->loadHeight();
- }
-
- dat->bShowAvatar = GetAvatarVisibility(hwndDlg, dat);
-
- Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, SW_HIDE);
-
- GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTER), &rc);
- pt.y = (rc.top + rc.bottom) / 2;
- pt.x = 0;
- ScreenToClient(hwndDlg, &pt);
- dat->originalSplitterY = pt.y;
- if (dat->splitterY == -1)
- dat->splitterY = dat->originalSplitterY + 60;
-
- GetWindowRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &rc);
- dat->minEditBoxSize.cx = rc.right - rc.left;
- dat->minEditBoxSize.cy = rc.bottom - rc.top;
-
- BB_InitDlgButtons(dat);
- SendMessage(hwndDlg, DM_LOADBUTTONBARICONS, 0, 0);
-
- BOOL isThemed = TRUE;
- if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKBUTTONSNPRESSED].IGNORED &&
- !SkinItems[ID_EXTBKBUTTONSPRESSED].IGNORED && !SkinItems[ID_EXTBKBUTTONSMOUSEOVER].IGNORED)
- isThemed = FALSE;
-
- SendDlgItemMessage(hwndDlg, IDC_ADD, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CANCELADD, BUTTONSETASFLATBTN, TRUE, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASTHEMEDBTN, isThemed, 0);
- SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
- SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0);
-
- TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING, 0);
-
- for (int i = 0; i < SIZEOF(tooltips); i++)
- SendDlgItemMessage(hwndDlg, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(tooltips[i].text), BATF_TCHAR);
-
- SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, dat->bNotOnList ? TranslateT("Contact not on list. You may add it...") :
- TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
-
- SendDlgItemMessage(hwndDlg, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, BATF_TCHAR);
- SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Click for contact menu\nClick dropdown for window settings"), BATF_TCHAR);
-
- SetDlgItemText(hwndDlg, IDC_RETRY, TranslateT("Retry"));
-
- UINT _ctrls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER };
- for (int i = 0; i < SIZEOF(_ctrls); i++) {
- SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASFLATBTN, FALSE, 0);
- SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASTHEMEDBTN, TRUE, 0);
- }
-
- SetDlgItemText(hwndDlg, IDC_CANCELSEND, TranslateT("Cancel"));
- SetDlgItemText(hwndDlg, IDC_MSGSENDLATER, TranslateT("Send later"));
-
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETUNDOLIMIT, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_LINK);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
-
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE);
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback2);
-
- dat->bActualHistory = M.GetByte(dat->hContact, "ActualHistory", 0);
-
- /* OnO: higligh lines to their end */
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
-
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETLANGOPTIONS, 0, SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOFONTSIZEADJUST);
-
- // add us to the tray list (if it exists)
- if (PluginConfig.g_hMenuTrayUnread != 0 && dat->hContact != 0 && dat->szProto != NULL)
- UpdateTrayMenu(0, dat->wStatus, dat->szProto, dat->szStatus, dat->hContact, FALSE);
-
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXLIMITTEXT, 0, 0x80000000);
-
- // subclassing stuff
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), MessageEditSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CONTACTPIC), AvatarSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SplitterSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MULTISPLITTER), SplitterSubclassProc);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), SplitterSubclassProc);
-
- // load old messages from history (if wanted...)
- dat->cache->updateStats(TSessionStats::INIT_TIMER);
- if (dat->hContact) {
- FindFirstEvent(dat);
- dat->nMax = dat->cache->getMaxMessageLength();
- }
- LoadContactAvatar(dat);
- SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
- LoadOwnAvatar(dat);
-
- // restore saved msg if any...
- if (dat->hContact) {
- ptrT tszSavedMsg(db_get_tsa(dat->hContact, SRMSGMOD, "SavedMsg"));
- if (tszSavedMsg != 0) {
- SETTEXTEX stx = { ST_DEFAULT, 1200 };
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, tszSavedMsg);
- SendQueue::UpdateSaveAndSendButton(dat);
- if (m_pContainer->hwndActive == hwndDlg)
- UpdateReadChars(dat);
- }
- }
- if (newData->szInitialText) {
- if (newData->isWchar)
- SetDlgItemTextW(hwndDlg, IDC_MESSAGE, (TCHAR*)newData->szInitialText);
- else
- SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
- int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE));
- PostMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETSEL, len, len);
- if (len)
- EnableSendButton(dat, TRUE);
- }
-
- for (MEVENT hdbEvent = db_event_last(dat->hContact); hdbEvent; hdbEvent = db_event_prev(dat->hContact, hdbEvent)) {
- DBEVENTINFO dbei = { sizeof(dbei) };
- db_event_get(hdbEvent, &dbei);
- if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) {
- dat->lastMessage = dbei.timestamp;
- DM_UpdateLastMessage(dat);
- break;
- }
- }
-
- SendMessage(hwndContainer, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
-
- WNDCLASS wndClass = { 0 };
- GetClassInfo(g_hInst, _T("RICHEDIT50W"), &wndClass);
- mir_subclassWindowFull(GetDlgItem(hwndDlg, IDC_LOG), MessageLogSubclassProc, wndClass.lpfnWndProc);
-
- SetWindowPos(hwndDlg, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), newData->iActivate ? 0 : SWP_NOZORDER | SWP_NOACTIVATE);
- LoadSplitter(dat);
- ShowPicture(dat, TRUE);
-
- if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED || !newData->iActivate || m_pContainer->dwFlags & CNT_DEFERREDTABSELECT) {
- dat->iFlashIcon = PluginConfig.g_IconMsgEvent;
- SetTimer(hwndDlg, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL);
- dat->mayFlashTab = true;
-
- DBEVENTINFO dbei = { 0 };
- dbei.eventType = EVENTTYPE_MESSAGE;
- FlashOnClist(hwndDlg, dat, dat->hDbEventFirst, &dbei);
-
- SendMessage(hwndContainer, DM_SETICON, (WPARAM)dat, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
- m_pContainer->dwFlags |= CNT_NEED_UPDATETITLE;
- dat->dwFlags |= MWF_NEEDCHECKSIZE | MWF_WASBACKGROUNDCREATE | MWF_DEFERREDSCROLL;
- }
-
- if (newData->iActivate) {
- m_pContainer->hwndActive = hwndDlg;
- ShowWindow(hwndDlg, SW_SHOW);
- SetActiveWindow(hwndDlg);
- SetForegroundWindow(hwndDlg);
- }
- else if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
- dat->dwFlags |= MWF_DEFERREDSCROLL;
- ShowWindow(hwndDlg, SW_SHOWNOACTIVATE);
- m_pContainer->hwndActive = hwndDlg;
- m_pContainer->dwFlags |= CNT_DEFERREDCONFIGURE;
- }
- PostMessage(hwndContainer, DM_UPDATETITLE, dat->hContact, 0);
-
- DM_RecalcPictureSize(dat);
- dat->dwLastActivity = GetTickCount() - 1000;
- m_pContainer->dwLastActivity = dat->dwLastActivity;
-
- if (dat->hwndHPP)
- mir_subclassWindow(dat->hwndHPP, HPPKFSubclassProc);
-
- dat->dwFlags &= ~MWF_INITMODE;
- TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPEN, 0);
-
- // show a popup if wanted...
- if (newData->bWantPopup) {
- DBEVENTINFO dbei = { sizeof(dbei) };
- newData->bWantPopup = FALSE;
- db_event_get(newData->hdbEvent, &dbei);
- tabSRMM_ShowPopup(dat->hContact, newData->hdbEvent, dbei.eventType, 0, 0, hwndDlg, dat->cache->getActiveProto());
- }
- if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
- m_pContainer->dwFlags &= ~CNT_CREATE_MINIMIZED;
- m_pContainer->hwndActive = hwndDlg;
- return FALSE;
- }
- return newData->iActivate != 0;
- }
-
- case WM_ERASEBKGND:
- RECT rcClient, rcWindow;
- {
- HDC hdc = (HDC)wParam;
- HDC hdcMem = 0;
- HBITMAP hbm, hbmOld;
- HANDLE hpb = 0;
-
- GetClientRect(hwndDlg, &rcClient);
- DWORD cx = rcClient.right - rcClient.left;
- DWORD cy = rcClient.bottom - rcClient.top;
-
- if (CMimAPI::m_haveBufferedPaint) {
- hpb = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rcClient, BPBF_TOPDOWNDIB, 0, &hdcMem);
- hbm = hbmOld = 0;
- }
- else {
- hdcMem = CreateCompatibleDC(hdc);
- hbm = CSkin::CreateAeroCompatibleBitmap(rcClient, hdc);
- hbmOld = (HBITMAP)SelectObject(hdcMem, hbm);
- }
-
- bool bAero = M.isAero();
-
- if (CSkin::m_skinEnabled) {
- UINT item_ids[2] = {ID_EXTBKHISTORY, ID_EXTBKINPUTAREA};
- UINT ctl_ids[2] = {IDC_LOG, IDC_MESSAGE};
- BOOL isEditNotesReason = dat->fEditNotesActive;
- BOOL isSendLaterReason = (dat->sendMode & SMODE_SENDLATER);
- BOOL isMultipleReason = (dat->sendMode & SMODE_MULTIPLE || dat->sendMode & SMODE_CONTAINER);
-
- CSkin::SkinDrawBG(hwndDlg, hwndContainer, m_pContainer, &rcClient, hdcMem);
-
- for (int i=0; i < 2; i++) {
- CSkinItem *item = &SkinItems[item_ids[i]];
- if (!item->IGNORED) {
- GetWindowRect(GetDlgItem(hwndDlg, ctl_ids[i]), &rcWindow);
- pt.x = rcWindow.left;
- pt.y = rcWindow.top;
- ScreenToClient(hwndDlg, &pt);
- rc.left = pt.x - item->MARGIN_LEFT;
- rc.top = pt.y - item->MARGIN_TOP;
- rc.right = rc.left + item->MARGIN_RIGHT + (rcWindow.right - rcWindow.left) + item->MARGIN_LEFT;
- rc.bottom = rc.top + item->MARGIN_BOTTOM + (rcWindow.bottom - rcWindow.top) + item->MARGIN_TOP;
- if (item_ids[i] == ID_EXTBKINPUTAREA && (isMultipleReason || isEditNotesReason || isSendLaterReason)) {
- HBRUSH br = CreateSolidBrush(isMultipleReason ? RGB(255, 130, 130) : (isEditNotesReason ? RGB(80, 255, 80) : RGB(80, 80, 255)));
- FillRect(hdcMem, &rc, br);
- DeleteObject(br);
- }
- else CSkin::DrawItem(hdcMem, &rc, item);
- }
- }
- }
- else {
- CSkin::FillBack(hdcMem, &rcClient);
-
- if (M.isAero()) {
- LONG temp = rcClient.bottom;
- rcClient.bottom = dat->Panel->isActive() ? dat->Panel->getHeight() + 5 : 5;
- FillRect(hdcMem, &rcClient, (HBRUSH)GetStockObject(BLACK_BRUSH));
- rcClient.bottom = temp;
- }
- }
-
- // draw the (new) infopanel background. Use the gradient from the statusitem.
- GetClientRect(hwndDlg, &rc);
- dat->Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], bAero);
-
- // draw aero related stuff
- if (!CSkin::m_skinEnabled)
- CSkin::RenderToolbarBG(dat, hdcMem, rcClient);
-
- // render info panel fields
- dat->Panel->renderContent(hdcMem);
-
- if (hpb)
- CSkin::FinalizeBufferedPaint(hpb, &rcClient);
- else {
- BitBlt(hdc, 0, 0, cx, cy, hdcMem, 0, 0, SRCCOPY);
- SelectObject(hdcMem, hbmOld);
- DeleteObject(hbm);
- DeleteDC(hdcMem);
- }
- if (!dat->fLimitedUpdate)
- SetAeroMargins(dat->pContainer);
- }
- return 1;
-
- case WM_NCPAINT:
- return 0;
-
- case WM_PAINT:
- // in skinned mode only, draw the background elements for the 2 richedit controls
- // this allows border-less textboxes to appear "skinned" and blended with the background
- {
- PAINTSTRUCT ps;
- BeginPaint(hwndDlg, &ps);
- EndPaint(hwndDlg, &ps);
- }
- return 0;
-
- case WM_SIZE:
- if (!IsIconic(hwndDlg)) {
- if (dat->ipFieldHeight == 0)
- dat->ipFieldHeight = CInfoPanel::m_ipConfig.height2;
-
- if (dat->pContainer->uChildMinHeight > 0 && HIWORD(lParam) >= dat->pContainer->uChildMinHeight) {
- if (dat->splitterY > HIWORD(lParam) - DPISCALEY_S(MINLOGHEIGHT)) {
- dat->splitterY = HIWORD(lParam) - DPISCALEY_S(MINLOGHEIGHT);
- dat->dynaSplitter = dat->splitterY - DPISCALEY_S(34);
- DM_RecalcPictureSize(dat);
- }
- if (dat->splitterY < DPISCALEY_S(MINSPLITTERY))
- LoadSplitter(dat);
- }
-
- HBITMAP hbm = ((dat->Panel->isActive()) && m_pContainer->avatarMode != 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown);
- if (hbm != 0) {
- BITMAP bminfo;
- GetObject(hbm, sizeof(bminfo), &bminfo);
- CalcDynamicAvatarSize(dat, &bminfo);
- }
-
- GetClientRect(hwndDlg, &rc);
-
- UTILRESIZEDIALOG urd = { sizeof(urd) };
- urd.hInstance = g_hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = (LPARAM)dat;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_MSGSPLITNEW);
- urd.pfnResizer = MessageDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
-
- BB_SetButtonsPos(dat);
-
- // size info panel fields
- if (dat->Panel->isActive()) {
- LONG cx = rc.right;
- LONG panelHeight = dat->Panel->getHeight();
-
- hbm = (m_pContainer->avatarMode == 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown);
- double dHeight = 0, dWidth = 0;
- Utils::scaleAvatarHeightLimited(hbm, dWidth, dHeight, panelHeight-2);
- dat->iPanelAvatarX = (int)dWidth;
- dat->iPanelAvatarY = (int)dHeight;
-
- rc.top = 1;
- rc.left = cx - dat->iPanelAvatarX;
- rc.bottom = panelHeight - (CSkin::m_bAvatarBorderType ? 2 : 0);
- rc.right = cx;
- dat->rcPic = rc;
-
- if (dat->bShowInfoAvatar) {
- SetWindowPos(dat->hwndPanelPicParent, HWND_TOP, rc.left - 2, rc.top, rc.right - rc.left, rc.bottom - rc.top + 1, 0);
- ShowWindow(dat->hwndPanelPicParent, (dat->iPanelAvatarX == 0) || !dat->Panel->isActive() ? SW_HIDE : SW_SHOW);
- }
- else {
- ShowWindow(dat->hwndPanelPicParent, SW_HIDE);
- dat->iPanelAvatarX = dat->iPanelAvatarY = 0;
- }
-
- rc.right = cx - dat->iPanelAvatarX;
- rc.left = rc.right - dat->panelStatusCX;
- rc.bottom = panelHeight - 3;
- rc.top = rc.bottom - dat->ipFieldHeight;
- dat->rcStatus = rc;
-
- rc.left = CInfoPanel::LEFT_OFFSET_LOGO;
- rc.right = cx - dat->iPanelAvatarX - (panelHeight < CInfoPanel::DEGRADE_THRESHOLD ? (dat->rcStatus.right - dat->rcStatus.left) + 3 : 0);
- rc.bottom = panelHeight - (panelHeight >= CInfoPanel::DEGRADE_THRESHOLD ? dat->ipFieldHeight : 0) - 1;
- rc.top = 1;
- dat->rcNick = rc;
-
- rc.left = CInfoPanel::LEFT_OFFSET_LOGO;
- rc.right = cx - (dat->iPanelAvatarX + 2) - dat->panelStatusCX;
- rc.bottom = panelHeight - 3;
- rc.top = rc.bottom - dat->ipFieldHeight;
- dat->rcUIN = rc;
-
- dat->Panel->Invalidate();
- }
-
- if (GetDlgItem(hwndDlg, IDC_CLIST) != 0) {
- RECT rcLog;
- GetClientRect(hwndDlg, &rcClient);
- GetClientRect(GetDlgItem(hwndDlg, IDC_LOG), &rcLog);
- rc.top = 0;
- rc.right = rcClient.right;
- rc.left = rcClient.right - dat->multiSplitterX;
- rc.bottom = rcLog.bottom;
- if (dat->Panel->isActive())
- rc.top += (dat->Panel->getHeight() + 1);
- MoveWindow(GetDlgItem(hwndDlg, IDC_CLIST), rc.left, rc.top, rc.right - rc.left, rcLog.bottom - rcLog.top, FALSE);
- }
-
- if (dat->hwndIEView || dat->hwndHPP)
- ResizeIeView(dat);
-
- DetermineMinHeight(dat);
- }
- break;
-
- case WM_TIMECHANGE:
- PostMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
- break;
-
- case WM_NOTIFY:
- if (dat != 0 && ((NMHDR*)lParam)->hwndFrom == dat->hwndTip) {
- if (((NMHDR*)lParam)->code == NM_CLICK)
- SendMessage(dat->hwndTip, TTM_TRACKACTIVATE, FALSE, 0);
- break;
- }
-
- switch (((NMHDR*)lParam)->idFrom) {
- case IDC_LOG:
- case IDC_MESSAGE:
- switch (((NMHDR*)lParam)->code) {
- case EN_MSGFILTER:
- {
- DWORD msg = ((MSGFILTER *) lParam)->msg;
- WPARAM wp = ((MSGFILTER *) lParam)->wParam;
- LPARAM lp = ((MSGFILTER *) lParam)->lParam;
- CHARFORMAT2 cf2;
- BOOL isCtrl, isShift, isAlt;
- KbdState(dat, isShift, isCtrl, isAlt);
-
- MSG message;
- message.hwnd = hwndDlg;
- message.message = msg;
- message.lParam = lp;
- message.wParam = wp;
-
- if (msg == WM_SYSKEYUP) {
- if (wp == VK_MENU)
- if (!dat->fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
- m_pContainer->MenuBar->autoShow();
-
- return _dlgReturn(hwndDlg, 0);
- }
-
- if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
- LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_IM));
- if (mim_hotkey_check)
- dat->fkeyProcessed = true;
-
- switch (mim_hotkey_check) {
- case TABSRMM_HK_SETUSERPREFS:
- CallService(MS_TABMSG_SETUSERPREFS, dat->hContact, 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_NUDGE:
- SendNudge(dat);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_SENDFILE:
- CallService(MS_FILE_SENDFILE, dat->hContact, 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_QUOTEMSG:
- SendMessage(hwndDlg, WM_COMMAND, IDC_QUOTE, 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_USERMENU:
- SendMessage(hwndDlg, WM_COMMAND, IDC_PROTOCOL, 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_USERDETAILS:
- SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_NAME, BN_CLICKED), 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_EDITNOTES:
- PostMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_PIC, BN_CLICKED), 0);
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_TOGGLESENDLATER:
- if (sendLater->isAvail()) {
- dat->sendMode ^= SMODE_SENDLATER;
- SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME|SWP_FRAMECHANGED|SWP_NOZORDER|
- SWP_NOMOVE|SWP_NOSIZE|SWP_NOCOPYBITS);
- RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW|RDW_ALLCHILDREN);
- }
- else
- CWarning::show(CWarning::WARN_NO_SENDLATER, MB_OK|MB_ICONINFORMATION, TranslateT("Configuration issue|The unattended send feature is disabled. The \\b1 send later\\b0 and \\b1 send to multiple contacts\\b0 features depend on it.\n\nYou must enable it under \\b1Options->Message sessions->Advanced tweaks\\b0. Changing this option requires a restart."));
- return _dlgReturn(hwndDlg, 1);
- case TABSRMM_HK_TOGGLERTL:
- {
- DWORD dwGlobal = M.GetDword("mwflags", MWF_LOG_DEFAULT);
- DWORD dwMask = M.GetDword(dat->hContact, "mwmask", 0);
- DWORD dwFlags = M.GetDword(dat->hContact, "mwflags", 0);
-
- dat->dwFlags ^= MWF_LOG_RTL;
- if ((dwGlobal & MWF_LOG_RTL) != (dat->dwFlags & MWF_LOG_RTL)) {
- dwMask |= MWF_LOG_RTL;
- dwFlags |= (dat->dwFlags & MWF_LOG_RTL);
- }
- else {
- dwMask &= ~MWF_LOG_RTL;
- dwFlags &= ~MWF_LOG_RTL;
- }
- if (dwMask) {
- db_set_dw(dat->hContact, SRMSGMOD_T, "mwmask", dwMask);
- db_set_dw(dat->hContact, SRMSGMOD_T, "mwflags", dwFlags);
- }
- else {
- db_unset(dat->hContact, SRMSGMOD_T, "mwmask");
- db_unset(dat->hContact, SRMSGMOD_T, "mwflags");
- }
- SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
- SendMessage(hwndDlg, DM_DEFERREDREMAKELOG, (WPARAM)hwndDlg, 0);
- }
- return _dlgReturn(hwndDlg, 1);
-
- case TABSRMM_HK_TOGGLEMULTISEND:
- dat->sendMode ^= SMODE_MULTIPLE;
- if (dat->sendMode & SMODE_MULTIPLE)
- DM_CreateClist(dat);
- else if (IsWindow(GetDlgItem(hwndDlg, IDC_CLIST)))
- DestroyWindow(GetDlgItem(hwndDlg, IDC_CLIST));
-
- HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
- SetWindowPos(hwndEdit, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- RedrawWindow(hwndEdit, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
- DM_ScrollToBottom(dat, 0, 0);
- Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
- Utils::showDlgControl(hwndDlg, IDC_CLIST, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
- if (dat->sendMode & SMODE_MULTIPLE)
- SetFocus(GetDlgItem(hwndDlg, IDC_CLIST));
- else
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW|RDW_ALLCHILDREN);
- return _dlgReturn(hwndDlg, 1);
- }
- if (DM_GenericHotkeysCheck(&message, dat)) {
- dat->fkeyProcessed = true;
- return _dlgReturn(hwndDlg, 1);
- }
- }
- if (wp == VK_BROWSER_BACK || wp == VK_BROWSER_FORWARD)
- return 1;
-
- if (msg == WM_CHAR) {
- if (isCtrl && !isShift && !isAlt) {
- switch (wp) {
- case 23: // ctrl - w
- PostMessage(hwndDlg, WM_CLOSE, 1, 0);
- break;
- case 19:
- PostMessage(hwndDlg, WM_COMMAND, IDC_SENDMENU, IDC_SENDMENU);
- break;
- case 16:
- PostMessage(hwndDlg, WM_COMMAND, IDC_PROTOMENU, IDC_PROTOMENU);
- break;
- case 20:
- PostMessage(hwndDlg, WM_COMMAND, IDC_TOGGLETOOLBAR, 1);
- break;
- }
- return 1;
- }
- }
- if (msg == WM_KEYDOWN) {
- if ((wp == VK_INSERT && isShift && !isCtrl) || (wp == 'V' && isCtrl && !isShift && !isAlt)) {
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_PASTESPECIAL, CF_UNICODETEXT, 0);
- _clrMsgFilter(lParam);
- return _dlgReturn(hwndDlg, 1);
- }
- if (isCtrl && isShift) {
- if (wp == 0x9) { // ctrl-shift tab
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_PREV, 0);
- _clrMsgFilter(lParam);
- return _dlgReturn(hwndDlg, 1);
- }
- }
- if (isCtrl && !isShift && !isAlt) {
- if (wp == VK_TAB) {
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
- _clrMsgFilter(lParam);
- return _dlgReturn(hwndDlg, 1);
- }
- if (wp == VK_F4) {
- PostMessage(hwndDlg, WM_CLOSE, 1, 0);
- return _dlgReturn(hwndDlg, 1);
- }
- if (wp == VK_PRIOR) {
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_PREV, 0);
- return _dlgReturn(hwndDlg, 1);
- }
- if (wp == VK_NEXT) {
- SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
- return _dlgReturn(hwndDlg, 1);
- }
- }
- }
- if (msg == WM_SYSKEYDOWN && isAlt) {
- if (wp == 0x52) {
- SendMessage(hwndDlg, DM_QUERYPENDING, DM_QUERY_MOSTRECENT, 0);
- return _dlgReturn(hwndDlg, 1);
- }
- if (wp == VK_MULTIPLY) {
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return _dlgReturn(hwndDlg, 1);
- }
- if (wp == VK_DIVIDE) {
- SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
- return _dlgReturn(hwndDlg, 1);
- }
- if (wp == VK_ADD) {
- SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_NEXT, 0);
- return _dlgReturn(hwndDlg, 1);
- }
- if (wp == VK_SUBTRACT) {
- SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_PREV, 0);
- return _dlgReturn(hwndDlg, 1);
- }
- }
-
- if (msg == WM_KEYDOWN && wp == VK_F12) {
- if (isShift || isCtrl || isAlt)
- return _dlgReturn(hwndDlg, 1);
- if (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)
- SendMessage(hwndDlg, DM_REPLAYQUEUE, 0, 0);
- dat->dwFlagsEx ^= MWF_SHOW_SCROLLINGDISABLED;
- Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, (dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? SW_SHOW : SW_HIDE);
- if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
- SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, TranslateT("Contact not on list. You may add it..."));
- else
- SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- DM_ScrollToBottom(dat, 1, 1);
- return _dlgReturn(hwndDlg, 1);
- }
-
- // tabulation mod
- if (msg == WM_KEYDOWN && wp == VK_TAB) {
- if (PluginConfig.m_bAllowTab) {
- if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE)
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)"\t");
- _clrMsgFilter(lParam);
- if (((NMHDR*)lParam)->idFrom != IDC_MESSAGE)
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return _dlgReturn(hwndDlg, 1);
- }
- else {
- if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE) {
- if (GetSendButtonState(hwndDlg) != PBS_DISABLED && !(dat->pContainer->dwFlags & CNT_HIDETOOLBAR))
- SetFocus(GetDlgItem(hwndDlg, IDOK));
- else
- SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
- return _dlgReturn(hwndDlg, 1);
- }
- if (((NMHDR*)lParam)->idFrom == IDC_LOG) {
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return _dlgReturn(hwndDlg, 1);
- }
- }
- return _dlgReturn(hwndDlg, 0);
- }
-
- if (msg == WM_MOUSEWHEEL && (((NMHDR*)lParam)->idFrom == IDC_LOG || ((NMHDR*)lParam)->idFrom == IDC_MESSAGE)) {
- GetCursorPos(&pt);
- GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
- if (PtInRect(&rc, pt)) {
- short wDirection = (short)HIWORD(wp);
- if (LOWORD(wp) & MK_SHIFT) {
- if (wDirection < 0)
- SendDlgItemMessage(hwndDlg, IDC_LOG, WM_VSCROLL, MAKEWPARAM(SB_PAGEDOWN, 0), 0);
- else if (wDirection > 0)
- SendDlgItemMessage(hwndDlg, IDC_LOG, WM_VSCROLL, MAKEWPARAM(SB_PAGEUP, 0), 0);
- return 0;
- }
- return 0;
- }
- return 1;
- }
-
- if (msg == WM_CHAR && wp == 'c') {
- if (isCtrl) {
- SendDlgItemMessage(hwndDlg, ((NMHDR*)lParam)->code, WM_COPY, 0, 0);
- break;
- }
- }
- if ((msg == WM_LBUTTONDOWN || msg == WM_KEYUP || msg == WM_LBUTTONUP) && ((NMHDR*)lParam)->idFrom == IDC_MESSAGE) {
- int bBold = IsDlgButtonChecked(hwndDlg, IDC_FONTBOLD);
- int bItalic = IsDlgButtonChecked(hwndDlg, IDC_FONTITALIC);
- int bUnder = IsDlgButtonChecked(hwndDlg, IDC_FONTUNDERLINE);
- int bStrikeout = IsDlgButtonChecked(hwndDlg, IDC_FONTSTRIKEOUT);
-
- cf2.cbSize = sizeof(CHARFORMAT2);
- cf2.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_UNDERLINETYPE | CFM_STRIKEOUT;
- cf2.dwEffects = 0;
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
- if (cf2.dwEffects & CFE_BOLD) {
- if (bBold == BST_UNCHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_CHECKED);
- }
- else if (bBold == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_UNCHECKED);
-
- if (cf2.dwEffects & CFE_ITALIC) {
- if (bItalic == BST_UNCHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_CHECKED);
- }
- else if (bItalic == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_UNCHECKED);
-
- if (cf2.dwEffects & CFE_UNDERLINE && (cf2.bUnderlineType & CFU_UNDERLINE || cf2.bUnderlineType & CFU_UNDERLINEWORD)) {
- if (bUnder == BST_UNCHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_CHECKED);
- }
- else if (bUnder == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_UNCHECKED);
-
- if (cf2.dwEffects & CFE_STRIKEOUT) {
- if (bStrikeout == BST_UNCHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_CHECKED);
- }
- else if (bStrikeout == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_UNCHECKED);
- }
- switch (msg) {
- case WM_LBUTTONDOWN:
- {
- HCURSOR hCur = GetCursor();
- m_pContainer->MenuBar->Cancel();
- if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
- || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) {
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- break;
- }
-
- // auto-select-and-copy handling...
- // if enabled, releasing the lmb with an active selection automatically copies the selection
- // to the clipboard.
- // holding ctrl while releasing the button pastes the selection to the input area, using plain text
- // holding ctrl-alt does the same, but pastes formatted text
- case WM_LBUTTONUP:
- if (((NMHDR*) lParam)->idFrom == IDC_LOG) {
- CHARRANGE cr;
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&cr);
- if (cr.cpMax != cr.cpMin) {
- cr.cpMin = cr.cpMax;
- if (isCtrl && M.GetByte("autocopy", 1)) {
- SETTEXTEX stx = {ST_KEEPUNDO | ST_SELECTION, CP_UTF8};
- char *streamOut = NULL;
- if (isAlt)
- streamOut = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_RTFNOOBJS | SFF_PLAINRTF | SFF_SELECTION);
- else
- streamOut = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_TEXT | SFF_SELECTION);
- if (streamOut) {
- Utils::FilterEventMarkers(streamOut);
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)streamOut);
- mir_free(streamOut);
- }
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- }
- else if (M.GetByte("autocopy", 1) && !isShift) {
- SendDlgItemMessage(hwndDlg, IDC_LOG, WM_COPY, 0, 0);
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- if (m_pContainer->hwndStatus)
- SendMessage(m_pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)TranslateT("Selection copied to clipboard"));
- }
- }
- }
- break;
-
- case WM_RBUTTONUP:
+
+ DM_SetDBButtonStates(hwndDlg, dat);
+
+ if (dat->hwndIEView) {
+ RECT rcRTF;
+ POINT pt;
+
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rcRTF);
+ rcRTF.left += 20;
+ rcRTF.top += 20;
+ pt.x = rcRTF.left;
+ pt.y = rcRTF.top;
+ if (dat->hwndIEView) {
+ if (M.GetByte("subclassIEView", 0)) {
+ mir_subclassWindow(dat->hwndIEView, IEViewSubclassProc);
+ SetWindowPos(dat->hwndIEView, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME);
+ RedrawWindow(dat->hwndIEView, 0, 0, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
+ }
+ }
+ dat->hwndIWebBrowserControl = WindowFromPoint(pt);
+ }
+
+ if (dat->dwFlagsEx & MWF_EX_DELAYEDSPLITTER) {
+ dat->dwFlagsEx &= ~MWF_EX_DELAYEDSPLITTER;
+ ShowWindow(dat->pContainer->hwnd, SW_RESTORE);
+ PostMessage(hwndDlg, DM_SPLITTERGLOBALEVENT, dat->wParam, dat->lParam);
+ dat->wParam = dat->lParam = 0;
+ }
+ if (dat->dwFlagsEx & MWF_EX_AVATARCHANGED) {
+ dat->dwFlagsEx &= ~MWF_EX_AVATARCHANGED;
+ PostMessage(hwndDlg, DM_UPDATEPICLAYOUT, 0, 0);
+ }
+ BB_SetButtonsPos(dat);
+ if (M.isAero())
+ InvalidateRect(hwndTab, NULL, FALSE);
+ if (dat->pContainer->dwFlags & CNT_SIDEBAR)
+ dat->pContainer->SideBar->setActiveItem(dat);
+
+ if (dat->pWnd)
+ dat->pWnd->Invalidate();
+}
+
+void TSAPI ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControls, int state)
+{
+ for (int i = 0; i < cControls; i++)
+ Utils::showDlgControl(hwndDlg, controls[i], state);
+}
+
+void TSAPI SetDialogToType(HWND hwndDlg)
+{
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ if (dat->hContact) {
+ if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
+ dat->bNotOnList = TRUE;
+ ShowMultipleControls(hwndDlg, addControls, 2, SW_SHOW);
+ Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_SHOW);
+ SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, TranslateT("Contact not on list. You may add it..."));
+ }
+ else {
+ ShowMultipleControls(hwndDlg, addControls, 2, SW_HIDE);
+ dat->bNotOnList = FALSE;
+ Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_HIDE);
+ }
+ }
+
+ Utils::enableDlgControl(hwndDlg, IDC_TIME, true);
+
+ if (dat->hwndIEView || dat->hwndHPP) {
+ Utils::showDlgControl(hwndDlg, IDC_LOG, SW_HIDE);
+ Utils::enableDlgControl(hwndDlg, IDC_LOG, false);
+ Utils::showDlgControl(hwndDlg, IDC_MESSAGE, SW_SHOW);
+ }
+ else ShowMultipleControls(hwndDlg, sendControls, sizeof(sendControls) / sizeof(sendControls[0]), SW_SHOW);
+
+ ShowMultipleControls(hwndDlg, errorControls, sizeof(errorControls) / sizeof(errorControls[0]), dat->dwFlags & MWF_ERRORSTATE ? SW_SHOW : SW_HIDE);
+
+ if (!dat->SendFormat)
+ ShowMultipleControls(hwndDlg, &formatControls[1], 5, SW_HIDE);
+
+ ConfigureSmileyButton(dat);
+
+ if (dat->pContainer->hwndActive == hwndDlg)
+ UpdateReadChars(dat);
+
+ SetDlgItemText(hwndDlg, IDC_STATICTEXT, TranslateT("A message failed to send successfully."));
+
+ DM_RecalcPictureSize(dat);
+ GetAvatarVisibility(hwndDlg, dat);
+
+ Utils::showDlgControl(hwndDlg, IDC_CONTACTPIC, dat->bShowAvatar ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(hwndDlg, IDC_SPLITTER, dat->bIsAutosizingInput ? SW_HIDE : SW_SHOW);
+ Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
+
+ EnableSendButton(dat, GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
+ SendMessage(hwndDlg, DM_UPDATETITLE, 0, 1);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+
+ Utils::enableDlgControl(hwndDlg, IDC_CONTACTPIC, false);
+
+ dat->Panel->Configure();
+}
+
+static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ HWND hwndParent = GetParent(hwnd);
+ TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ BOOL isCtrl, isShift, isAlt;
+ KbdState(mwdat, isShift, isCtrl, isAlt);
+
+ switch (msg) {
+ case WM_KILLFOCUS:
+ if (wParam != (WPARAM)hwnd && 0 != wParam) {
+ CHARRANGE cr;
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&cr);
+ if (cr.cpMax != cr.cpMin) {
+ cr.cpMin = cr.cpMax;
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr);
+ }
+ }
+ break;
+
+ case WM_CHAR:
+ if (wParam == 0x03 && isCtrl) // Ctrl+C
+ return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
+ if (wParam == 0x11 && isCtrl)
+ SendMessage(mwdat->hwnd, WM_COMMAND, IDC_QUOTE, 0);
+ break;
+
+ case WM_SYSKEYUP:
+ if (wParam == VK_MENU) {
+ ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_LOG);
+ return 0;
+ }
+ break;
+
+ case WM_SYSKEYDOWN:
+ mwdat->fkeyProcessed = false;
+ if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_LOG)) {
+ mwdat->fkeyProcessed = true;
+ return 0;
+ }
+ break;
+
+ case WM_SYSCHAR:
+ if (mwdat->fkeyProcessed) {
+ mwdat->fkeyProcessed = false;
+ return 0;
+ }
+ break;
+
+ case WM_KEYDOWN:
+ if (wParam == VK_INSERT && isCtrl)
+ return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
+ break;
+
+ case WM_COPY:
+ return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
+
+ case WM_NCCALCSIZE:
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, MessageLogSubclassProc);
+
+ case WM_NCPAINT:
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, MessageLogSubclassProc);
+
+ case WM_CONTEXTMENU:
+ POINT pt;
+
+ if (lParam == 0xFFFFFFFF) {
+ CHARRANGE sel;
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
+ SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
+ ClientToScreen(hwnd, &pt);
+ }
+ else {
+ pt.x = (short)LOWORD(lParam);
+ pt.y = (short)HIWORD(lParam);
+ }
+
+ ShowPopupMenu(mwdat, IDC_LOG, hwnd, pt);
+ return TRUE;
+ }
+
+ return mir_callNextSubclass(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
+}
+
+static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ BOOL isCtrl, isShift, isAlt;
+ HWND hwndParent = GetParent(hwnd);
+ TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ if (mwdat == NULL)
+ return 0;
+
+ // prevent the rich edit from switching text direction or keyboard layout when
+ // using hotkeys with ctrl-shift or alt-shift modifiers
+ if (mwdat->fkeyProcessed && (msg == WM_KEYUP)) {
+ GetKeyboardState(mwdat->kstate);
+ if (mwdat->kstate[VK_CONTROL] & 0x80 || mwdat->kstate[VK_SHIFT] & 0x80)
+ return 0;
+
+ mwdat->fkeyProcessed = false;
+ return 0;
+ }
+
+ switch (msg) {
+ case WM_NCCALCSIZE:
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageEditSubclassProc);
+
+ case WM_NCPAINT:
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageEditSubclassProc);
+
+ case WM_DROPFILES:
+ SendMessage(hwndParent, WM_DROPFILES, (WPARAM)wParam, (LPARAM)lParam);
+ return 0;
+
+ case WM_CHAR:
+ KbdState(mwdat, isShift, isCtrl, isAlt);
+
+ if (PluginConfig.m_bSoundOnTyping && !isAlt && !isCtrl && !(mwdat->pContainer->dwFlags & CNT_NOSOUND) && wParam != VK_ESCAPE && !(wParam == VK_TAB && PluginConfig.m_bAllowTab))
+ SkinPlaySound("SoundOnTyping");
+
+ if (isCtrl && !isAlt) {
+ switch (wParam) {
+ case 0x02: // bold
+ if (mwdat->SendFormat)
+ SendMessage(hwndParent, WM_COMMAND, MAKELONG(IDC_FONTBOLD, IDC_MESSAGE), 0);
+ return 0;
+ case 0x09:
+ if (mwdat->SendFormat)
+ SendMessage(hwndParent, WM_COMMAND, MAKELONG(IDC_FONTITALIC, IDC_MESSAGE), 0);
+ return 0;
+ case 21:
+ if (mwdat->SendFormat)
+ SendMessage(hwndParent, WM_COMMAND, MAKELONG(IDC_FONTUNDERLINE, IDC_MESSAGE), 0);
+ return 0;
+ case 0x0b:
+ SetWindowText(hwnd, _T(""));
+ return 0;
+ }
+ }
+ break;
+
+ case WM_MOUSEWHEEL:
+ if (DM_MouseWheelHandler(hwnd, hwndParent, mwdat, wParam, lParam) == 0)
+ return 0;
+ break;
+
+ case EM_PASTESPECIAL:
+ case WM_PASTE:
+ if (OpenClipboard(hwnd)) {
+ HANDLE hClip = GetClipboardData(CF_TEXT);
+ if (hClip) {
+ if (mir_strlen((char*)hClip) > mwdat->nMax) {
+ TCHAR szBuffer[512];
+ if (M.GetByte("autosplit", 0))
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("WARNING: The message you are trying to paste exceeds the message size limit for the active protocol. It will be sent in chunks of max %d characters"), mwdat->nMax - 10);
+ else
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("The message you are trying to paste exceeds the message size limit for the active protocol. Only the first %d characters will be sent."), mwdat->nMax);
+ SendMessage(hwndParent, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)szBuffer);
+ }
+ }
+ else if (hClip = GetClipboardData(CF_BITMAP))
+ SendHBitmapAsFile(mwdat, (HBITMAP)hClip);
+
+ CloseClipboard();
+ }
+ break;
+
+ case WM_KEYDOWN:
+ KbdState(mwdat, isShift, isCtrl, isAlt);
+
+ if (PluginConfig.m_bSoundOnTyping && !isAlt && !(mwdat->pContainer->dwFlags & CNT_NOSOUND) && wParam == VK_DELETE)
+ SkinPlaySound("SoundOnTyping");
+
+ if (wParam == VK_INSERT && !isShift && !isCtrl && !isAlt) {
+ mwdat->fInsertMode = !mwdat->fInsertMode;
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
+ }
+ if (wParam == VK_CAPITAL || wParam == VK_NUMLOCK)
+ SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
+
+ if (wParam == VK_RETURN) {
+ if (mwdat->fEditNotesActive)
+ break;
+
+ if (isShift) {
+ if (PluginConfig.m_bSendOnShiftEnter) {
+ PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ else break;
+ }
+ if ((isCtrl && !isShift) ^ (0 != PluginConfig.m_bSendOnEnter)) {
+ PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ if (PluginConfig.m_bSendOnEnter || PluginConfig.m_bSendOnDblEnter) {
+ if (isCtrl)
+ break;
+
+ if (PluginConfig.m_bSendOnDblEnter) {
+ LONG_PTR lastEnterTime = GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (lastEnterTime + 2 < time(NULL)) {
+ lastEnterTime = time(NULL);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, lastEnterTime);
+ break;
+ }
+ else {
+ SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
+ SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
+ PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ }
+ PostMessage(hwndParent, WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ else break;
+ }
+ else SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+
+ if (isCtrl && !isAlt && !isShift) {
+ if (!isShift && (wParam == VK_UP || wParam == VK_DOWN)) { // input history scrolling (ctrl-up / down)
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ if (mwdat)
+ mwdat->cache->inputHistoryEvent(wParam);
+ return 0;
+ }
+ }
+ if (isCtrl && isAlt && !isShift) {
+ switch (wParam) {
+ case VK_UP:
+ case VK_DOWN:
+ case VK_PRIOR:
+ case VK_NEXT:
+ case VK_HOME:
+ case VK_END:
+ WPARAM wp = 0;
+
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ if (wParam == VK_UP)
+ wp = MAKEWPARAM(SB_LINEUP, 0);
+ else if (wParam == VK_PRIOR)
+ wp = MAKEWPARAM(SB_PAGEUP, 0);
+ else if (wParam == VK_NEXT)
+ wp = MAKEWPARAM(SB_PAGEDOWN, 0);
+ else if (wParam == VK_HOME)
+ wp = MAKEWPARAM(SB_TOP, 0);
+ else if (wParam == VK_END) {
+ DM_ScrollToBottom(mwdat, 0, 0);
+ return 0;
+ }
+ else if (wParam == VK_DOWN)
+ wp = MAKEWPARAM(SB_LINEDOWN, 0);
+
+ if (mwdat->hwndIEView == 0 && mwdat->hwndHPP == 0)
+ SendDlgItemMessage(hwndParent, IDC_LOG, WM_VSCROLL, wp, 0);
+ else
+ SendMessage(mwdat->hwndIWebBrowserControl, WM_VSCROLL, wp, 0);
+ return 0;
+ }
+ }
+ if (wParam == VK_RETURN)
+ break;
+
+ case WM_SYSKEYDOWN:
+ mwdat->fkeyProcessed = false;
+ if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_MESSAGE)) {
+ mwdat->fkeyProcessed = true;
+ return 0;
+ }
+ break;
+
+ case WM_SYSKEYUP:
+ if (wParam == VK_MENU) {
+ ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_MESSAGE);
+ return 0;
+ }
+ break;
+
+ case WM_SYSCHAR:
+ if (mwdat->fkeyProcessed) {
+ mwdat->fkeyProcessed = false;
+ return 0;
+ }
+
+ KbdState(mwdat, isShift, isCtrl, isAlt);
+ if ((wParam >= '0' && wParam <= '9') && isAlt) { // ALT-1 -> ALT-0 direct tab selection
+ BYTE bChar = (BYTE)wParam;
+ int iIndex;
+
+ if (bChar == '0')
+ iIndex = 10;
+ else
+ iIndex = bChar - (BYTE)'0';
+ SendMessage(mwdat->pContainer->hwnd, DM_SELECTTAB, DM_SELECT_BY_INDEX, (LPARAM)iIndex);
+ return 0;
+ }
+ break;
+
+ case WM_INPUTLANGCHANGE:
+ if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == hwnd && mwdat->pContainer->hwndActive == hwndParent && GetForegroundWindow() == mwdat->pContainer->hwnd && GetActiveWindow() == mwdat->pContainer->hwnd) {
+ DM_SaveLocale(mwdat, wParam, lParam);
+ SendMessage(hwnd, EM_SETLANGOPTIONS, 0, (LPARAM)SendMessage(hwnd, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
+ return 1;
+ }
+ break;
+
+ case WM_ERASEBKGND:
+ return(CSkin::m_skinEnabled ? 0 : 1);
+
+ // sent by smileyadd when the smiley selection window dies
+ // just grab the focus :)
+ case WM_USER + 100:
+ SetFocus(hwnd);
+ break;
+
+ case WM_CONTEXTMENU:
+ POINT pt;
+ if (lParam == 0xFFFFFFFF) {
+ CHARRANGE sel;
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
+ SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
+ ClientToScreen(hwnd, &pt);
+ }
+ else {
+ pt.x = (short)LOWORD(lParam);
+ pt.y = (short)HIWORD(lParam);
+ }
+
+ ShowPopupMenu(mwdat, IDC_MESSAGE, hwnd, pt);
+ return TRUE;
+ }
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// subclasses the avatar display controls, needed for skinning and to prevent
+// it from flickering during resize/move operations.
+
+static LRESULT CALLBACK AvatarSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg) {
+ case WM_ERASEBKGND:
+ return TRUE;
+
+ case WM_UPDATEUISTATE:
+ return TRUE;
+
+ case WM_NOTIFY:
+ ProcessAvatarChange(hwnd, lParam);
+ break;
+ }
+ return mir_callNextSubclass(hwnd, AvatarSubclassProc, msg, wParam, lParam);
+}
+
+LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ RECT rc;
+ HWND hwndParent = GetParent(hwnd);
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+
+ switch (msg) {
+ case WM_NCHITTEST:
+ return HTCLIENT;
+
+ case WM_SETCURSOR:
+ GetClientRect(hwnd, &rc);
+ SetCursor(rc.right > rc.bottom ? PluginConfig.hCurSplitNS : PluginConfig.hCurSplitWE);
+ return TRUE;
+
+ case WM_LBUTTONDOWN:
+ if (hwnd == GetDlgItem(hwndParent, IDC_SPLITTER) || hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY)) {
+ if (dat) {
+ GetClientRect(hwnd, &rc);
+ dat->savedSplitter = rc.right > rc.bottom ? (short)HIWORD(GetMessagePos()) + rc.bottom / 2 : (short)LOWORD(GetMessagePos()) + rc.right / 2;
+ if (dat->bType == SESSIONTYPE_IM)
+ dat->savedSplitY = dat->splitterY;
+ else
+ dat->savedSplitY = dat->si->iSplitterY;
+
+ dat->savedDynaSplit = dat->dynaSplitter;
+ }
+ }
+ SetCapture(hwnd);
+ return 0;
+
+ case WM_MOUSEMOVE:
+ if (GetCapture() == hwnd) {
+ GetClientRect(hwnd, &rc);
+ SendMessage(hwndParent, DM_SPLITTERMOVED, rc.right > rc.bottom ? (short)HIWORD(GetMessagePos()) + rc.bottom / 2 : (short)LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM)hwnd);
+ }
+ return 0;
+
+ case WM_ERASEBKGND:
+ return 1;
+
+ case WM_PAINT:
+ GetClientRect(hwnd, &rc);
+ {
+ PAINTSTRUCT ps;
+ HDC dc = BeginPaint(hwnd, &ps);
+
+ if (dat && CSkin::m_skinEnabled)
+ CSkin::SkinDrawBG(hwnd, dat->pContainer->hwnd, dat->pContainer, &rc, dc);
+ else if (M.isAero() || M.isVSThemed()) {
+ if (GetDlgCtrlID(hwnd) == IDC_PANELSPLITTER) {
+ EndPaint(hwnd, &ps);
+ return 0;
+ }
+ CSkin::FillBack(dc, &rc);
+ }
+ else CSkin::FillBack(dc, &rc);
+
+ EndPaint(hwnd, &ps);
+ }
+ return 0;
+
+ case WM_LBUTTONUP:
+ HWND hwndCapture = GetCapture();
+
+ ReleaseCapture();
+ DM_ScrollToBottom(dat, 0, 1);
+ if (dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_PANELSPLITTER)) {
+ SendMessage(hwndParent, WM_SIZE, 0, 0);
+ RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
+ }
+ else if ((dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_SPLITTER)) ||
+ (dat && dat->bType == SESSIONTYPE_CHAT && hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY))) {
+ POINT pt;
+ int selection;
+ HMENU hMenu = GetSubMenu(dat->pContainer->hMenuContext, 12);
+ LONG messagePos = GetMessagePos();
+
+ GetClientRect(hwnd, &rc);
+ if (hwndCapture != hwnd || dat->savedSplitter == (rc.right > rc.bottom ? (short)HIWORD(messagePos) + rc.bottom / 2 : (short)LOWORD(messagePos) + rc.right / 2))
+ break;
+ GetCursorPos(&pt);
+
+ if (dat->bIsAutosizingInput)
+ selection = ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION;
+ else
+ selection = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, NULL);
+
+ switch (selection) {
+ case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY:
+ dat->dwFlagsEx |= MWF_SHOW_SPLITTEROVERRIDE;
+ db_set_b(dat->hContact, SRMSGMOD_T, "splitoverride", 1);
+ if (dat->bType == SESSIONTYPE_IM)
+ SaveSplitter(dat);
+ break;
+
+ case ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION:
+ if (dat->bIsAutosizingInput) {
+ GetWindowRect(GetDlgItem(dat->hwnd, IDC_MESSAGE), &rc);
+ dat->iInputAreaHeight = 0;
+ }
+ break;
+
+ case ID_SPLITTERCONTEXT_SAVEGLOBALFORALLSESSIONS:
+ {
+ BYTE bSync = M.GetByte(CHAT_MODULE, "SyncSplitter", 0);
+ DWORD dwOff_IM = 0, dwOff_CHAT = 0;
+
+ dwOff_CHAT = -(2 + (PluginConfig.m_DPIscaleY > 1.0 ? 1 : 0));
+ dwOff_IM = 2 + (PluginConfig.m_DPIscaleY > 1.0 ? 1 : 0);
+
+ RECT rcWin;
+ GetWindowRect(hwndParent, &rcWin);
+
+ PluginConfig.lastSPlitterPos.pSrcDat = dat;
+ PluginConfig.lastSPlitterPos.pSrcContainer = dat->pContainer;
+ PluginConfig.lastSPlitterPos.lParam = rc.bottom;
+ PluginConfig.lastSPlitterPos.pos = rcWin.bottom - HIWORD(messagePos);
+ PluginConfig.lastSPlitterPos.pos_chat = rcWin.bottom - (short)HIWORD(messagePos) + rc.bottom / 2;
+ PluginConfig.lastSPlitterPos.off_chat = dwOff_CHAT;
+ PluginConfig.lastSPlitterPos.off_im = dwOff_IM;
+ PluginConfig.lastSPlitterPos.bSync = bSync;
+ SendMessage(dat->hwnd, DM_SPLITTERGLOBALEVENT, 0, 0);
+ M.BroadcastMessage(DM_SPLITTERGLOBALEVENT, 0, 0);
+ }
+ break;
+
+ default:
+ dat->splitterY = dat->savedSplitY;
+ dat->dynaSplitter = dat->savedDynaSplit;
+ DM_RecalcPictureSize(dat);
+ if (dat->bType == SESSIONTYPE_CHAT) {
+ SESSION_INFO *si = dat->si;
+ si->iSplitterY = dat->savedSplitY;
+ dat->splitterY = si->iSplitterY + DPISCALEY_S(22);
+ }
+ CSkin::UpdateToolbarBG(dat);
+ SendMessage(hwndParent, WM_SIZE, 0, 0);
+ DM_ScrollToBottom(dat, 0, 1);
+ break;
+ }
+ }
+ return 0;
+ }
+ return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// resizer proc for the "new" layout.
+
+static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc)
+{
+ TWindowData *dat = (TWindowData*)lParam;
+ RECT rc, rcButton;
+ static int uinWidth, msgTop = 0, msgBottom = 0;
+
+ int showToolbar = dat->pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
+ BOOL bBottomToolbar = dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR ? 1 : 0;
+ static LONG rcLogBottom;
+
+ int panelHeight = dat->Panel->getHeight() + 1;
+ int s_offset = 0;
+ bool bInfoPanel = dat->Panel->isActive();
+ bool fErrorState = (dat->dwFlags & MWF_ERRORSTATE) ? true : false;
+
+ GetClientRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rcButton);
+
+ if (dat->panelStatusCX == 0)
+ dat->panelStatusCX = 80;
+
+ s_offset = 1;
+
+ switch (urc->wId) {
+ case IDC_PANELSPLITTER:
+ urc->rcItem.bottom = panelHeight;
+ urc->rcItem.top = panelHeight - 2;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP;
+
+ case IDC_LOG:
+ if (dat->dwFlags & MWF_ERRORSTATE)
+ urc->rcItem.bottom -= ERRORPANEL_HEIGHT;
+ if (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED || dat->bNotOnList)
+ urc->rcItem.bottom -= 20;
+ if (dat->sendMode & SMODE_MULTIPLE)
+ urc->rcItem.right -= (dat->multiSplitterX + 3);
+ urc->rcItem.bottom -= dat->splitterY - dat->originalSplitterY;
+ if (!showToolbar || bBottomToolbar)
+ urc->rcItem.bottom += 21;
+ if (bInfoPanel)
+ urc->rcItem.top += panelHeight;
+ urc->rcItem.bottom += 3;
+ if (CSkin::m_skinEnabled) {
+ CSkinItem *item = &SkinItems[ID_EXTBKHISTORY];
+ if (!item->IGNORED) {
+ urc->rcItem.left += item->MARGIN_LEFT;
+ urc->rcItem.right -= item->MARGIN_RIGHT;
+ urc->rcItem.top += item->MARGIN_TOP;
+ urc->rcItem.bottom -= item->MARGIN_BOTTOM;
+ }
+ }
+ rcLogBottom = urc->rcItem.bottom;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
+
+ case IDC_CONTACTPIC:
+ GetClientRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &rc);
+ urc->rcItem.top -= dat->splitterY - dat->originalSplitterY;
+ urc->rcItem.left = urc->rcItem.right - (dat->pic.cx + 2);
+ if ((urc->rcItem.bottom - urc->rcItem.top) < (dat->pic.cy/* + 2*/) && dat->bShowAvatar) {
+ urc->rcItem.top = urc->rcItem.bottom - dat->pic.cy;
+ dat->bUseOffset = true;
+ }
+ else dat->bUseOffset = false;
+
+ if (showToolbar && bBottomToolbar && (PluginConfig.m_bAlwaysFullToolbarWidth || ((dat->pic.cy - DPISCALEY_S(6)) < rc.bottom))) {
+ urc->rcItem.bottom -= DPISCALEY_S(22);
+ if (dat->bIsAutosizingInput) {
+ urc->rcItem.left--;
+ urc->rcItem.top--;
+ }
+ }
+
+ if (dat->hwndContactPic) //if Panel control was created?
+ SetWindowPos(dat->hwndContactPic, HWND_TOP, 1, ((urc->rcItem.bottom - urc->rcItem.top) - (dat->pic.cy)) / 2 + 1, //resizes it
+ dat->pic.cx - 2, dat->pic.cy - 2, SWP_SHOWWINDOW);
+
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
+
+ case IDC_SPLITTER:
+ urc->rcItem.right = urc->dlgNewSize.cx;
+ urc->rcItem.top -= dat->splitterY - dat->originalSplitterY;
+ urc->rcItem.bottom = urc->rcItem.top + 2;
+ OffsetRect(&urc->rcItem, 0, 1);
+ urc->rcItem.left = 0;
+
+ if (dat->bUseOffset)
+ urc->rcItem.right -= (dat->pic.cx); // + DPISCALEX(2));
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
+
+ case IDC_MESSAGE:
+ urc->rcItem.right = urc->dlgNewSize.cx;
+ if (dat->bShowAvatar)
+ urc->rcItem.right -= dat->pic.cx + 2;
+ urc->rcItem.top -= dat->splitterY - dat->originalSplitterY;
+ if (bBottomToolbar&&showToolbar)
+ urc->rcItem.bottom -= DPISCALEY_S(22);
+
+ if (dat->bIsAutosizingInput)
+ urc->rcItem.top -= DPISCALEY_S(1);
+
+ msgTop = urc->rcItem.top;
+ msgBottom = urc->rcItem.bottom;
+ if (CSkin::m_skinEnabled) {
+ CSkinItem *item = &SkinItems[ID_EXTBKINPUTAREA];
+ if (!item->IGNORED) {
+ urc->rcItem.left += item->MARGIN_LEFT;
+ urc->rcItem.right -= item->MARGIN_RIGHT;
+ urc->rcItem.top += item->MARGIN_TOP;
+ urc->rcItem.bottom -= item->MARGIN_BOTTOM;
+ }
+ }
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
+
+ case IDC_MULTISPLITTER:
+ if (bInfoPanel)
+ urc->rcItem.top += panelHeight;
+ urc->rcItem.left -= dat->multiSplitterX;
+ urc->rcItem.right -= dat->multiSplitterX;
+ urc->rcItem.bottom = rcLogBottom;
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_HEIGHT;
+
+ case IDC_LOGFROZENTEXT:
+ urc->rcItem.right = urc->dlgNewSize.cx - 50;
+ urc->rcItem.bottom = msgTop - (bBottomToolbar ? 0 : 28);
+ urc->rcItem.top = msgTop - 16 - (bBottomToolbar ? 0 : 28);
+ if (!showToolbar && !bBottomToolbar) {
+ urc->rcItem.bottom += 21;
+ urc->rcItem.top += 21;
+ }
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
+
+ case IDC_ADD:
+ urc->rcItem.bottom = msgTop - (bBottomToolbar ? 0 : 28);
+ urc->rcItem.top = msgTop - 18 - (bBottomToolbar ? 0 : 28);
+ urc->rcItem.right = urc->dlgNewSize.cx - 28;
+ urc->rcItem.left = urc->rcItem.right - 20;
+ if (!showToolbar && !bBottomToolbar) {
+ urc->rcItem.bottom += 21;
+ urc->rcItem.top += 21;
+ }
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
+
+ case IDC_CANCELADD:
+ urc->rcItem.bottom = msgTop - (bBottomToolbar ? 0 : 28);
+ urc->rcItem.top = msgTop - 18 - (bBottomToolbar ? 0 : 28);
+ urc->rcItem.right = urc->dlgNewSize.cx - 4;
+ urc->rcItem.left = urc->rcItem.right - 20;
+ if (!showToolbar && !bBottomToolbar) {
+ urc->rcItem.bottom += 21;
+ urc->rcItem.top += 21;
+ }
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
+
+ case IDC_TOGGLESIDEBAR:
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
+
+ case IDC_RETRY:
+ case IDC_CANCELSEND:
+ case IDC_MSGSENDLATER:
+ if (fErrorState) {
+ urc->rcItem.bottom = msgTop - 5 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
+ urc->rcItem.top = msgTop - 25 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
+ }
+ if (!showToolbar && !bBottomToolbar) {
+ urc->rcItem.bottom += 21;
+ urc->rcItem.top += 21;
+ }
+ return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
+
+ case IDC_STATICTEXT:
+ case IDC_STATICERRORICON:
+ if (fErrorState) {
+ urc->rcItem.bottom = msgTop - 28 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
+ urc->rcItem.top = msgTop - 45 - (bBottomToolbar ? 0 : 28) - ((dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? 20 : 0);
+ }
+ if (!showToolbar && !bBottomToolbar) {
+ urc->rcItem.bottom += 21;
+ urc->rcItem.top += 21;
+ }
+ return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
+ }
+ return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
+}
+
+INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ TContainerData *m_pContainer = 0;
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ HWND hwndTab = GetParent(hwndDlg), hwndContainer;
+ POINT pt, tmp, cur;
+ RECT rc;
+
+ if (dat == 0) {
+ if (msg == WM_ACTIVATE || msg == WM_SETFOCUS)
+ return 0;
+ hwndContainer = NULL;
+ }
+ else {
+ m_pContainer = dat->pContainer;
+ hwndContainer = m_pContainer->hwnd;
+ }
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ {
+ TNewWindowData *newData = (TNewWindowData*)lParam;
+
+ dat = (TWindowData*)mir_calloc(sizeof(TWindowData));
+ if (newData->iTabID >= 0) {
+ dat->pContainer = newData->pContainer;
+ m_pContainer = dat->pContainer;
+ hwndContainer = m_pContainer->hwnd;
+ }
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
+
+ if (Utils::rtf_ctable == 0)
+ Utils::RTF_CTableInit();
+
+ dat->dwFlags |= MWF_INITMODE;
+ dat->bType = SESSIONTYPE_IM;
+ dat->fInsertMode = FALSE;
+ dat->fLimitedUpdate = false;
+ dat->Panel = new CInfoPanel(dat);
+
+ newData->item.lParam = (LPARAM)hwndDlg;
+ TabCtrl_SetItem(hwndTab, newData->iTabID, &newData->item);
+ dat->iTabID = newData->iTabID;
+ dat->hwnd = hwndDlg;
+
+ DM_ThemeChanged(dat);
+
+ pszIDCSAVE_close = TranslateT("Close session");
+ pszIDCSAVE_save = TranslateT("Save and close session");
+
+ dat->hContact = newData->hContact;
+ dat->cache = CContactCache::getContactCache(dat->hContact);
+ dat->cache->updateState();
+ dat->cache->setWindowData(hwndDlg, dat);
+ M.AddWindow(hwndDlg, dat->hContact);
+ BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0);
+ dat->pWnd = 0;
+ dat->sbCustom = 0;
+ CProxyWindow::add(dat);
+ dat->szProto = const_cast<char *>(dat->cache->getProto());
+ dat->bIsMeta = dat->cache->isMeta();
+ if (dat->bIsMeta)
+ dat->cache->updateMeta();
+
+ dat->cache->updateUIN();
+
+ if (dat->hContact && dat->szProto != NULL) {
+ dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
+ _tcsncpy_s(dat->szStatus, pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, 0), _TRUNCATE);
+ }
+ else dat->wStatus = ID_STATUS_OFFLINE;
+
+ for (int i = 0; i < SIZEOF(btnControls); i++)
+ CustomizeButton(GetDlgItem(hwndDlg, btnControls[i]));
+
+ GetMYUIN(dat);
+ GetClientIcon(dat);
+
+ CustomizeButton(CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
+ hwndDlg, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL));
+ dat->hwndPanelPicParent = CreateWindowEx(WS_EX_TOPMOST, _T("Static"), _T(""), SS_OWNERDRAW | WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, hwndDlg, (HMENU)6000, NULL, NULL);
+ mir_subclassWindow(dat->hwndPanelPicParent, CInfoPanel::avatarParentSubclass);
+
+ dat->bShowUIElements = (m_pContainer->dwFlags & CNT_HIDETOOLBAR) == 0;
+ dat->sendMode |= M.GetByte(dat->hContact, "forceansi", 0) ? SMODE_FORCEANSI : 0;
+ dat->sendMode |= dat->hContact == 0 ? SMODE_MULTIPLE : 0;
+ dat->sendMode |= M.GetByte(dat->hContact, "no_ack", 0) ? SMODE_NOACK : 0;
+
+ dat->hQueuedEvents = (MEVENT*)mir_calloc(sizeof(MEVENT)* EVENT_QUEUE_SIZE);
+ dat->iEventQueueSize = EVENT_QUEUE_SIZE;
+ dat->iCurrentQueueError = -1;
+
+ // message history limit
+ // hHistoryEvents holds up to n event handles
+ dat->maxHistory = M.GetDword(dat->hContact, "maxhist", M.GetDword("maxhist", 0));
+ dat->curHistory = 0;
+ if (dat->maxHistory)
+ dat->hHistoryEvents = (MEVENT*)mir_alloc(dat->maxHistory * sizeof(MEVENT));
+ else
+ dat->hHistoryEvents = NULL;
+
+ if (dat->bIsMeta)
+ SendMessage(hwndDlg, DM_UPDATEMETACONTACTINFO, 0, 0);
+ else
+ SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
+ dat->bTabFlash = FALSE;
+ dat->mayFlashTab = FALSE;
+ GetMyNick(dat);
+
+ dat->multiSplitterX = (int)M.GetDword(SRMSGMOD, "multisplit", 150);
+ dat->nTypeMode = PROTOTYPE_SELFTYPING_OFF;
+ SetTimer(hwndDlg, TIMERID_TYPE, 1000, NULL);
+ dat->iLastEventType = 0xffffffff;
+
+ // load log option flags...
+ dat->dwFlags = dat->pContainer->theme.dwFlags;
+
+ // consider per-contact message setting overrides
+ if (dat->hContact && M.GetDword(dat->hContact, "mwmask", 0))
+ LoadLocalFlags(dat);
+
+ DM_InitTip(dat);
+ dat->Panel->getVisibility();
+
+ dat->dwFlagsEx |= M.GetByte(dat->hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0;
+ dat->bIsAutosizingInput = IsAutoSplitEnabled(dat);
+ dat->iInputAreaHeight = -1;
+ SetMessageLog(dat);
+ if (dat->hContact) {
+ dat->codePage = M.GetDword(dat->hContact, "ANSIcodepage", CP_ACP);
+ dat->Panel->loadHeight();
+ }
+
+ dat->bShowAvatar = GetAvatarVisibility(hwndDlg, dat);
+
+ Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, SW_HIDE);
+
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTER), &rc);
+ pt.y = (rc.top + rc.bottom) / 2;
+ pt.x = 0;
+ ScreenToClient(hwndDlg, &pt);
+ dat->originalSplitterY = pt.y;
+ if (dat->splitterY == -1)
+ dat->splitterY = dat->originalSplitterY + 60;
+
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &rc);
+ dat->minEditBoxSize.cx = rc.right - rc.left;
+ dat->minEditBoxSize.cy = rc.bottom - rc.top;
+
+ BB_InitDlgButtons(dat);
+ SendMessage(hwndDlg, DM_LOADBUTTONBARICONS, 0, 0);
+
+ BOOL isThemed = TRUE;
+ if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKBUTTONSNPRESSED].IGNORED &&
+ !SkinItems[ID_EXTBKBUTTONSPRESSED].IGNORED && !SkinItems[ID_EXTBKBUTTONSMOUSEOVER].IGNORED)
+ isThemed = FALSE;
+
+ SendDlgItemMessage(hwndDlg, IDC_ADD, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CANCELADD, BUTTONSETASFLATBTN, TRUE, 0);
+
+ SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASTHEMEDBTN, isThemed, 0);
+ SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
+ SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0);
+
+ TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING, 0);
+
+ for (int i = 0; i < SIZEOF(tooltips); i++)
+ SendDlgItemMessage(hwndDlg, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(tooltips[i].text), BATF_TCHAR);
+
+ SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, dat->bNotOnList ? TranslateT("Contact not on list. You may add it...") :
+ TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
+
+ SendDlgItemMessage(hwndDlg, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Click for contact menu\nClick dropdown for window settings"), BATF_TCHAR);
+
+ SetDlgItemText(hwndDlg, IDC_RETRY, TranslateT("Retry"));
+
+ UINT _ctrls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER };
+ for (int i = 0; i < SIZEOF(_ctrls); i++) {
+ SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASPUSHBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASFLATBTN, FALSE, 0);
+ SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASTHEMEDBTN, TRUE, 0);
+ }
+
+ SetDlgItemText(hwndDlg, IDC_CANCELSEND, TranslateT("Cancel"));
+ SetDlgItemText(hwndDlg, IDC_MSGSENDLATER, TranslateT("Send later"));
+
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETUNDOLIMIT, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_LINK);
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
+
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE);
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback2);
+
+ dat->bActualHistory = M.GetByte(dat->hContact, "ActualHistory", 0);
+
+ /* OnO: higligh lines to their end */
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
+
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETLANGOPTIONS, 0, SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOFONTSIZEADJUST);
+
+ // add us to the tray list (if it exists)
+ if (PluginConfig.g_hMenuTrayUnread != 0 && dat->hContact != 0 && dat->szProto != NULL)
+ UpdateTrayMenu(0, dat->wStatus, dat->szProto, dat->szStatus, dat->hContact, FALSE);
+
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXLIMITTEXT, 0, 0x80000000);
+
+ // subclassing stuff
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), MessageEditSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CONTACTPIC), AvatarSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SplitterSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MULTISPLITTER), SplitterSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), SplitterSubclassProc);
+
+ // load old messages from history (if wanted...)
+ dat->cache->updateStats(TSessionStats::INIT_TIMER);
+ if (dat->hContact) {
+ FindFirstEvent(dat);
+ dat->nMax = dat->cache->getMaxMessageLength();
+ }
+ LoadContactAvatar(dat);
+ SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
+ LoadOwnAvatar(dat);
+
+ // restore saved msg if any...
+ if (dat->hContact) {
+ ptrT tszSavedMsg(db_get_tsa(dat->hContact, SRMSGMOD, "SavedMsg"));
+ if (tszSavedMsg != 0) {
+ SETTEXTEX stx = { ST_DEFAULT, 1200 };
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, tszSavedMsg);
+ SendQueue::UpdateSaveAndSendButton(dat);
+ if (m_pContainer->hwndActive == hwndDlg)
+ UpdateReadChars(dat);
+ }
+ }
+ if (newData->szInitialText) {
+ if (newData->isWchar)
+ SetDlgItemTextW(hwndDlg, IDC_MESSAGE, (TCHAR*)newData->szInitialText);
+ else
+ SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
+ int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ PostMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETSEL, len, len);
+ if (len)
+ EnableSendButton(dat, TRUE);
+ }
+
+ for (MEVENT hdbEvent = db_event_last(dat->hContact); hdbEvent; hdbEvent = db_event_prev(dat->hContact, hdbEvent)) {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get(hdbEvent, &dbei);
+ if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) {
+ dat->lastMessage = dbei.timestamp;
+ DM_UpdateLastMessage(dat);
+ break;
+ }
+ }
+
+ SendMessage(hwndContainer, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
+
+ WNDCLASS wndClass = { 0 };
+ GetClassInfo(g_hInst, _T("RICHEDIT50W"), &wndClass);
+ mir_subclassWindowFull(GetDlgItem(hwndDlg, IDC_LOG), MessageLogSubclassProc, wndClass.lpfnWndProc);
+
+ SetWindowPos(hwndDlg, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), newData->iActivate ? 0 : SWP_NOZORDER | SWP_NOACTIVATE);
+ LoadSplitter(dat);
+ ShowPicture(dat, TRUE);
+
+ if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED || !newData->iActivate || m_pContainer->dwFlags & CNT_DEFERREDTABSELECT) {
+ dat->iFlashIcon = PluginConfig.g_IconMsgEvent;
+ SetTimer(hwndDlg, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL);
+ dat->mayFlashTab = true;
+
+ DBEVENTINFO dbei = { 0 };
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ FlashOnClist(hwndDlg, dat, dat->hDbEventFirst, &dbei);
+
+ SendMessage(hwndContainer, DM_SETICON, (WPARAM)dat, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
+ m_pContainer->dwFlags |= CNT_NEED_UPDATETITLE;
+ dat->dwFlags |= MWF_NEEDCHECKSIZE | MWF_WASBACKGROUNDCREATE | MWF_DEFERREDSCROLL;
+ }
+
+ if (newData->iActivate) {
+ m_pContainer->hwndActive = hwndDlg;
+ ShowWindow(hwndDlg, SW_SHOW);
+ SetActiveWindow(hwndDlg);
+ SetForegroundWindow(hwndDlg);
+ }
+ else if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
+ dat->dwFlags |= MWF_DEFERREDSCROLL;
+ ShowWindow(hwndDlg, SW_SHOWNOACTIVATE);
+ m_pContainer->hwndActive = hwndDlg;
+ m_pContainer->dwFlags |= CNT_DEFERREDCONFIGURE;
+ }
+ PostMessage(hwndContainer, DM_UPDATETITLE, dat->hContact, 0);
+
+ DM_RecalcPictureSize(dat);
+ dat->dwLastActivity = GetTickCount() - 1000;
+ m_pContainer->dwLastActivity = dat->dwLastActivity;
+
+ if (dat->hwndHPP)
+ mir_subclassWindow(dat->hwndHPP, HPPKFSubclassProc);
+
+ dat->dwFlags &= ~MWF_INITMODE;
+ TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPEN, 0);
+
+ // show a popup if wanted...
+ if (newData->bWantPopup) {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ newData->bWantPopup = FALSE;
+ db_event_get(newData->hdbEvent, &dbei);
+ tabSRMM_ShowPopup(dat->hContact, newData->hdbEvent, dbei.eventType, 0, 0, hwndDlg, dat->cache->getActiveProto());
+ }
+ if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
+ m_pContainer->dwFlags &= ~CNT_CREATE_MINIMIZED;
+ m_pContainer->hwndActive = hwndDlg;
+ return FALSE;
+ }
+ return newData->iActivate != 0;
+ }
+
+ case WM_ERASEBKGND:
+ RECT rcClient, rcWindow;
+ {
+ HDC hdc = (HDC)wParam;
+ HDC hdcMem = 0;
+ HBITMAP hbm, hbmOld;
+ HANDLE hpb = 0;
+
+ GetClientRect(hwndDlg, &rcClient);
+ DWORD cx = rcClient.right - rcClient.left;
+ DWORD cy = rcClient.bottom - rcClient.top;
+
+ if (CMimAPI::m_haveBufferedPaint) {
+ hpb = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rcClient, BPBF_TOPDOWNDIB, 0, &hdcMem);
+ hbm = hbmOld = 0;
+ }
+ else {
+ hdcMem = CreateCompatibleDC(hdc);
+ hbm = CSkin::CreateAeroCompatibleBitmap(rcClient, hdc);
+ hbmOld = (HBITMAP)SelectObject(hdcMem, hbm);
+ }
+
+ bool bAero = M.isAero();
+
+ if (CSkin::m_skinEnabled) {
+ UINT item_ids[2] = { ID_EXTBKHISTORY, ID_EXTBKINPUTAREA };
+ UINT ctl_ids[2] = { IDC_LOG, IDC_MESSAGE };
+ BOOL isEditNotesReason = dat->fEditNotesActive;
+ BOOL isSendLaterReason = (dat->sendMode & SMODE_SENDLATER);
+ BOOL isMultipleReason = (dat->sendMode & SMODE_MULTIPLE || dat->sendMode & SMODE_CONTAINER);
+
+ CSkin::SkinDrawBG(hwndDlg, hwndContainer, m_pContainer, &rcClient, hdcMem);
+
+ for (int i = 0; i < 2; i++) {
+ CSkinItem *item = &SkinItems[item_ids[i]];
+ if (!item->IGNORED) {
+ GetWindowRect(GetDlgItem(hwndDlg, ctl_ids[i]), &rcWindow);
+ pt.x = rcWindow.left;
+ pt.y = rcWindow.top;
+ ScreenToClient(hwndDlg, &pt);
+ rc.left = pt.x - item->MARGIN_LEFT;
+ rc.top = pt.y - item->MARGIN_TOP;
+ rc.right = rc.left + item->MARGIN_RIGHT + (rcWindow.right - rcWindow.left) + item->MARGIN_LEFT;
+ rc.bottom = rc.top + item->MARGIN_BOTTOM + (rcWindow.bottom - rcWindow.top) + item->MARGIN_TOP;
+ if (item_ids[i] == ID_EXTBKINPUTAREA && (isMultipleReason || isEditNotesReason || isSendLaterReason)) {
+ HBRUSH br = CreateSolidBrush(isMultipleReason ? RGB(255, 130, 130) : (isEditNotesReason ? RGB(80, 255, 80) : RGB(80, 80, 255)));
+ FillRect(hdcMem, &rc, br);
+ DeleteObject(br);
+ }
+ else CSkin::DrawItem(hdcMem, &rc, item);
+ }
+ }
+ }
+ else {
+ CSkin::FillBack(hdcMem, &rcClient);
+
+ if (M.isAero()) {
+ LONG temp = rcClient.bottom;
+ rcClient.bottom = dat->Panel->isActive() ? dat->Panel->getHeight() + 5 : 5;
+ FillRect(hdcMem, &rcClient, (HBRUSH)GetStockObject(BLACK_BRUSH));
+ rcClient.bottom = temp;
+ }
+ }
+
+ // draw the (new) infopanel background. Use the gradient from the statusitem.
+ GetClientRect(hwndDlg, &rc);
+ dat->Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], bAero);
+
+ // draw aero related stuff
+ if (!CSkin::m_skinEnabled)
+ CSkin::RenderToolbarBG(dat, hdcMem, rcClient);
+
+ // render info panel fields
+ dat->Panel->renderContent(hdcMem);
+
+ if (hpb)
+ CSkin::FinalizeBufferedPaint(hpb, &rcClient);
+ else {
+ BitBlt(hdc, 0, 0, cx, cy, hdcMem, 0, 0, SRCCOPY);
+ SelectObject(hdcMem, hbmOld);
+ DeleteObject(hbm);
+ DeleteDC(hdcMem);
+ }
+ if (!dat->fLimitedUpdate)
+ SetAeroMargins(dat->pContainer);
+ }
+ return 1;
+
+ case WM_NCPAINT:
+ return 0;
+
+ case WM_PAINT:
+ // in skinned mode only, draw the background elements for the 2 richedit controls
+ // this allows border-less textboxes to appear "skinned" and blended with the background
+ {
+ PAINTSTRUCT ps;
+ BeginPaint(hwndDlg, &ps);
+ EndPaint(hwndDlg, &ps);
+ }
+ return 0;
+
+ case WM_SIZE:
+ if (!IsIconic(hwndDlg)) {
+ if (dat->ipFieldHeight == 0)
+ dat->ipFieldHeight = CInfoPanel::m_ipConfig.height2;
+
+ if (dat->pContainer->uChildMinHeight > 0 && HIWORD(lParam) >= dat->pContainer->uChildMinHeight) {
+ if (dat->splitterY > HIWORD(lParam) - DPISCALEY_S(MINLOGHEIGHT)) {
+ dat->splitterY = HIWORD(lParam) - DPISCALEY_S(MINLOGHEIGHT);
+ dat->dynaSplitter = dat->splitterY - DPISCALEY_S(34);
+ DM_RecalcPictureSize(dat);
+ }
+ if (dat->splitterY < DPISCALEY_S(MINSPLITTERY))
+ LoadSplitter(dat);
+ }
+
+ HBITMAP hbm = ((dat->Panel->isActive()) && m_pContainer->avatarMode != 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown);
+ if (hbm != 0) {
+ BITMAP bminfo;
+ GetObject(hbm, sizeof(bminfo), &bminfo);
+ CalcDynamicAvatarSize(dat, &bminfo);
+ }
+
+ GetClientRect(hwndDlg, &rc);
+
+ UTILRESIZEDIALOG urd = { sizeof(urd) };
+ urd.hInstance = g_hInst;
+ urd.hwndDlg = hwndDlg;
+ urd.lParam = (LPARAM)dat;
+ urd.lpTemplate = MAKEINTRESOURCEA(IDD_MSGSPLITNEW);
+ urd.pfnResizer = MessageDialogResize;
+ CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+
+ BB_SetButtonsPos(dat);
+
+ // size info panel fields
+ if (dat->Panel->isActive()) {
+ LONG cx = rc.right;
+ LONG panelHeight = dat->Panel->getHeight();
+
+ hbm = (m_pContainer->avatarMode == 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown);
+ double dHeight = 0, dWidth = 0;
+ Utils::scaleAvatarHeightLimited(hbm, dWidth, dHeight, panelHeight - 2);
+ dat->iPanelAvatarX = (int)dWidth;
+ dat->iPanelAvatarY = (int)dHeight;
+
+ rc.top = 1;
+ rc.left = cx - dat->iPanelAvatarX;
+ rc.bottom = panelHeight - (CSkin::m_bAvatarBorderType ? 2 : 0);
+ rc.right = cx;
+ dat->rcPic = rc;
+
+ if (dat->bShowInfoAvatar) {
+ SetWindowPos(dat->hwndPanelPicParent, HWND_TOP, rc.left - 2, rc.top, rc.right - rc.left, rc.bottom - rc.top + 1, 0);
+ ShowWindow(dat->hwndPanelPicParent, (dat->iPanelAvatarX == 0) || !dat->Panel->isActive() ? SW_HIDE : SW_SHOW);
+ }
+ else {
+ ShowWindow(dat->hwndPanelPicParent, SW_HIDE);
+ dat->iPanelAvatarX = dat->iPanelAvatarY = 0;
+ }
+
+ rc.right = cx - dat->iPanelAvatarX;
+ rc.left = rc.right - dat->panelStatusCX;
+ rc.bottom = panelHeight - 3;
+ rc.top = rc.bottom - dat->ipFieldHeight;
+ dat->rcStatus = rc;
+
+ rc.left = CInfoPanel::LEFT_OFFSET_LOGO;
+ rc.right = cx - dat->iPanelAvatarX - (panelHeight < CInfoPanel::DEGRADE_THRESHOLD ? (dat->rcStatus.right - dat->rcStatus.left) + 3 : 0);
+ rc.bottom = panelHeight - (panelHeight >= CInfoPanel::DEGRADE_THRESHOLD ? dat->ipFieldHeight : 0) - 1;
+ rc.top = 1;
+ dat->rcNick = rc;
+
+ rc.left = CInfoPanel::LEFT_OFFSET_LOGO;
+ rc.right = cx - (dat->iPanelAvatarX + 2) - dat->panelStatusCX;
+ rc.bottom = panelHeight - 3;
+ rc.top = rc.bottom - dat->ipFieldHeight;
+ dat->rcUIN = rc;
+
+ dat->Panel->Invalidate();
+ }
+
+ if (GetDlgItem(hwndDlg, IDC_CLIST) != 0) {
+ RECT rcLog;
+ GetClientRect(hwndDlg, &rcClient);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_LOG), &rcLog);
+ rc.top = 0;
+ rc.right = rcClient.right;
+ rc.left = rcClient.right - dat->multiSplitterX;
+ rc.bottom = rcLog.bottom;
+ if (dat->Panel->isActive())
+ rc.top += (dat->Panel->getHeight() + 1);
+ MoveWindow(GetDlgItem(hwndDlg, IDC_CLIST), rc.left, rc.top, rc.right - rc.left, rcLog.bottom - rcLog.top, FALSE);
+ }
+
+ if (dat->hwndIEView || dat->hwndHPP)
+ ResizeIeView(dat);
+
+ DetermineMinHeight(dat);
+ }
+ break;
+
+ case WM_TIMECHANGE:
+ PostMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
+ break;
+
+ case WM_NOTIFY:
+ if (dat != 0 && ((NMHDR*)lParam)->hwndFrom == dat->hwndTip) {
+ if (((NMHDR*)lParam)->code == NM_CLICK)
+ SendMessage(dat->hwndTip, TTM_TRACKACTIVATE, FALSE, 0);
+ break;
+ }
+
+ switch (((NMHDR*)lParam)->idFrom) {
+ case IDC_LOG:
+ case IDC_MESSAGE:
+ switch (((NMHDR*)lParam)->code) {
+ case EN_MSGFILTER:
+ {
+ DWORD msg = ((MSGFILTER *)lParam)->msg;
+ WPARAM wp = ((MSGFILTER *)lParam)->wParam;
+ LPARAM lp = ((MSGFILTER *)lParam)->lParam;
+ CHARFORMAT2 cf2;
+ BOOL isCtrl, isShift, isAlt;
+ KbdState(dat, isShift, isCtrl, isAlt);
+
+ MSG message;
+ message.hwnd = hwndDlg;
+ message.message = msg;
+ message.lParam = lp;
+ message.wParam = wp;
+
+ if (msg == WM_SYSKEYUP) {
+ if (wp == VK_MENU)
+ if (!dat->fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
+ m_pContainer->MenuBar->autoShow();
+
+ return _dlgReturn(hwndDlg, 0);
+ }
+
+ if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
+ LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_IM));
+ if (mim_hotkey_check)
+ dat->fkeyProcessed = true;
+
+ switch (mim_hotkey_check) {
+ case TABSRMM_HK_SETUSERPREFS:
+ CallService(MS_TABMSG_SETUSERPREFS, dat->hContact, 0);
return _dlgReturn(hwndDlg, 1);
-
- case WM_MOUSEMOVE:
- GetCursorPos(&pt);
- DM_DismissTip(dat, pt);
- dat->Panel->trackMouse(pt);
-
- HCURSOR hCur = GetCursor();
- if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE))
- SetCursor(LoadCursor(NULL, IDC_ARROW));
- break;
- }
- }
- break;
-
- case EN_REQUESTRESIZE:
- DM_HandleAutoSizeRequest(dat, (REQRESIZE *)lParam);
- break;
-
- case EN_LINK:
- ENLINK *pLink = (ENLINK*)lParam;
- switch (pLink->msg) {
- case WM_SETCURSOR:
- SetCursor(PluginConfig.hCurHyperlinkHand);
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
-
- case WM_RBUTTONDOWN:
- case WM_LBUTTONUP:
- ptrT tszUrl(Utils::extractURLFromRichEdit((ENLINK*)lParam, GetDlgItem(hwndDlg, IDC_LOG)));
- if (!IsStringValidLink(tszUrl))
- break;
-
- if (pLink->msg != WM_RBUTTONDOWN) {
- CallService(MS_UTILS_OPENURL, OUF_TCHAR, tszUrl);
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- break;
- }
- HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- HMENU hSubMenu = GetSubMenu(hMenu, 1);
- TranslateMenu(hSubMenu);
- pt.x = (short)LOWORD(pLink->lParam);
- pt.y = (short)HIWORD(pLink->lParam);
- ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
- case IDM_OPENNEW:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, tszUrl);
- break;
-
- case IDM_OPENEXISTING:
- CallService(MS_UTILS_OPENURL, OUF_TCHAR, tszUrl);
- break;
-
- case IDM_COPYLINK:
- if (!OpenClipboard(hwndDlg))
- break;
-
- EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(tszUrl) + 1));
- TCHAR *buf = (TCHAR*)GlobalLock(hData);
- mir_tstrcpy(buf, tszUrl);
- GlobalUnlock(hData);
- SetClipboardData(CF_UNICODETEXT, hData);
- CloseClipboard();
- break;
- }
- DestroyMenu(hMenu);
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- }
- }
- break;
-
- case DM_TYPING:
- {
- int preTyping = dat->nTypeSecs != 0;
- dat->nTypeSecs = (int)lParam > 0 ? (int)lParam : 0;
-
- if (dat->nTypeSecs)
- dat->bShowTyping = 0;
-
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, preTyping);
- }
- return TRUE;
-
- case DM_UPDATEWINICON:
- if (dat->hXStatusIcon) {
- DestroyIcon(dat->hXStatusIcon);
- dat->hXStatusIcon = 0;
- }
-
- if (LPCSTR szProto = dat->cache->getProto()) {
- dat->hTabIcon = dat->hTabStatusIcon = MY_GetContactIcon(dat, "MetaiconTab");
- if (M.GetByte("use_xicons", 1))
- dat->hXStatusIcon = GetXStatusIcon(dat);
-
- SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BUTTONSETASDIMMED, (dat->dwFlagsEx & MWF_SHOW_ISIDLE) != 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : MY_GetContactIcon(dat, "MetaiconBar")));
-
- if (m_pContainer->hwndActive == hwndDlg)
- SendMessage(m_pContainer->hwnd, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon));
-
- if (dat->pWnd)
- dat->pWnd->updateIcon(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon);
- }
- return 0;
-
- // configures the toolbar only... if lParam != 0, then it also calls
- // SetDialogToType() to reconfigure the message window
- case DM_CONFIGURETOOLBAR:
- dat->bShowUIElements = m_pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
-
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
-
- if (lParam == 1) {
- GetSendFormat(dat);
- SetDialogToType(hwndDlg);
- }
-
- if (lParam == 1) {
- DM_RecalcPictureSize(dat);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- DM_ScrollToBottom(dat, 0, 1);
- }
- return 0;
-
- case DM_LOADBUTTONBARICONS:
- for (int i=0; i < SIZEOF(buttonicons); i++) {
- SendDlgItemMessage(hwndDlg, buttonicons[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)*buttonicons[i].pIcon);
- SendDlgItemMessage(hwndDlg, buttonicons[i].id, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
- }
-
- BB_UpdateIcons(hwndDlg);
- SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
- return 0;
-
- case DM_OPTIONSAPPLIED:
- DM_OptionsApplied(dat, wParam, lParam);
- return 0;
-
- case DM_UPDATETITLE:
- DM_UpdateTitle(dat, wParam, lParam);
- return 0;
-
- case DM_UPDATESTATUSMSG:
- dat->Panel->Invalidate();
- return 0;
-
- case DM_OWNNICKCHANGED:
- GetMyNick(dat);
- return 0;
-
- case DM_ADDDIVIDER:
- if (!(dat->dwFlags & MWF_DIVIDERSET) && PluginConfig.m_bUseDividers) {
- if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOG)) > 0) {
- dat->dwFlags |= MWF_DIVIDERWANTED;
- dat->dwFlags |= MWF_DIVIDERSET;
- }
- }
- return 0;
-
- case WM_SETFOCUS:
- MsgWindowUpdateState(dat, WM_SETFOCUS);
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- return 1;
-
- case WM_ACTIVATE:
- if (LOWORD(wParam) != WA_ACTIVE)
- break;
-
- //fall through
- case WM_MOUSEACTIVATE:
- MsgWindowUpdateState(dat, WM_ACTIVATE);
- return 1;
-
- case DM_UPDATEPICLAYOUT:
- LoadContactAvatar(dat);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- return 0;
-
- case DM_SPLITTERGLOBALEVENT:
- DM_SplitterGlobalEvent(dat, wParam, lParam);
- return 0;
-
- case DM_SPLITTERMOVED:
- if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_MULTISPLITTER)) {
- GetClientRect(hwndDlg, &rc);
- pt.x = wParam;
- pt.y = 0;
- ScreenToClient(hwndDlg, &pt);
- int oldSplitterX = dat->multiSplitterX;
- dat->multiSplitterX = rc.right - pt.x;
- if (dat->multiSplitterX < 25)
- dat->multiSplitterX = 25;
-
- if (dat->multiSplitterX > ((rc.right - rc.left) - 80))
- dat->multiSplitterX = oldSplitterX;
- SendMessage(dat->hwnd, WM_SIZE, 0, 0);
- }
- else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTER)) {
- GetClientRect(hwndDlg, &rc);
- rc.top += (dat->Panel->isActive() ? dat->Panel->getHeight() + 40 : 30);
- pt.x = 0;
- pt.y = wParam;
- ScreenToClient(hwndDlg, &pt);
-
- int oldSplitterY = dat->splitterY;
- int oldDynaSplitter = dat->dynaSplitter;
-
- dat->splitterY = rc.bottom - pt.y + DPISCALEY_S(23);
-
- // attempt to fix splitter troubles..
- // hardcoded limits... better solution is possible, but this works for now
- int bottomtoolbarH = 0;
- if (dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR)
- bottomtoolbarH = 22;
-
- if (dat->splitterY < (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH)) { // min splitter size
- dat->splitterY = (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH);
- dat->dynaSplitter = dat->splitterY - DPISCALEY_S(34);
- DM_RecalcPictureSize(dat);
- }
- else if (dat->splitterY > (rc.bottom - rc.top)) {
- dat->splitterY = oldSplitterY;
- dat->dynaSplitter = oldDynaSplitter;
- DM_RecalcPictureSize(dat);
- }
- else {
- dat->dynaSplitter = (rc.bottom - pt.y) - DPISCALEY_S(11);
- DM_RecalcPictureSize(dat);
- }
- CSkin::UpdateToolbarBG(dat);
- SendMessage(dat->hwnd, WM_SIZE, 0, 0);
- }
- else if ((HWND) lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) {
- GetClientRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
-
- POINT pt = { 0, wParam };
- ScreenToClient(hwndDlg, &pt);
- if ((pt.y + 2 >= MIN_PANELHEIGHT + 2) && (pt.y + 2 < 100) && (pt.y + 2 < rc.bottom - 30))
- dat->Panel->setHeight(pt.y + 2, true);
-
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
- if (M.isAero())
- InvalidateRect(GetParent(hwndDlg), NULL, FALSE);
- }
- break;
-
- // queue a dm_remakelog
- // wParam = hwnd of the sender, so we can directly do a DM_REMAKELOG if the msg came
- // from ourself. otherwise, the dm_remakelog will be deferred until next window
- // activation (focus)
- case DM_DEFERREDREMAKELOG:
- if ((HWND) wParam == hwndDlg)
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
- else {
- if (M.GetByte(dat->hContact, "mwoverride", 0) == 0) {
- dat->dwFlags &= ~(MWF_LOG_ALL);
- dat->dwFlags |= (lParam & MWF_LOG_ALL);
- dat->dwFlags |= MWF_DEFERREDREMAKELOG;
- }
- }
- return 0;
-
- case DM_FORCEDREMAKELOG:
- if ((HWND) wParam == hwndDlg)
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
- else {
- dat->dwFlags &= ~(MWF_LOG_ALL);
- dat->dwFlags |= (lParam & MWF_LOG_ALL);
- dat->dwFlags |= MWF_DEFERREDREMAKELOG;
- }
- return 0;
-
- case DM_REMAKELOG:
- dat->szMicroLf[0] = 0;
- dat->lastEventTime = 0;
- dat->iLastEventType = -1;
- StreamInEvents(hwndDlg, dat->hDbEventFirst, -1, 0, NULL);
- return 0;
-
- case DM_APPENDMCEVENT:
- if (dat->hContact == db_mc_getMeta(wParam) && dat->hDbEventFirst == NULL) {
- dat->hDbEventFirst = lParam;
- SendMessage(dat->hwnd, DM_REMAKELOG, 0, 0);
- }
- else if (dat->hContact == wParam && db_mc_isSub(wParam) && db_event_getContact(lParam) != wParam)
- StreamInEvents(hwndDlg, lParam, 1, 1, NULL);
- return 0;
-
- case DM_APPENDTOLOG:
- StreamInEvents(hwndDlg, wParam, 1, 1, NULL);
- return 0;
-
- // replays queued events after the message log has been frozen for a while
- case DM_REPLAYQUEUE:
- for (int i=0; i < dat->iNextQueuedEvent; i++)
- if (dat->hQueuedEvents[i] != 0)
- StreamInEvents(hwndDlg, dat->hQueuedEvents[i], 1, 1, NULL);
-
- dat->iNextQueuedEvent = 0;
- SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, dat->bNotOnList ? TranslateT("Contact not on list. You may add it...") :
- TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
- return 0;
-
- case DM_SCROLLIEVIEW:
- {
- IEVIEWWINDOW iew = { sizeof(iew) };
- iew.iType = IEW_SCROLLBOTTOM;
- if (dat->hwndIEView) {
- iew.hwnd = dat->hwndIEView;
- CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&iew);
- }
- else if (dat->hwndHPP) {
- iew.hwnd = dat->hwndHPP;
- CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&iew);
- }
- }
- return 0;
-
- case HM_DBEVENTADDED:
- // this is called whenever a new event has been added to the database.
- // this CAN be posted (some sanity checks required).
- if (dat && dat->hContact)
- DM_EventAdded(dat, dat->hContact, lParam);
- return 0;
-
- case WM_TIMER:
- // timer to control info panel hovering
- if (wParam == TIMERID_AWAYMSG) {
- KillTimer(hwndDlg, wParam);
- GetCursorPos(&pt);
-
- if (wParam == TIMERID_AWAYMSG && dat->Panel->hitTest(pt) != CInfoPanel::HTNIRVANA)
- SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, 0, 0);
- else
- dat->dwFlagsEx &= ~MWF_SHOW_AWAYMSGTIMER;
- break;
- }
-
- // timer id for message timeouts is composed like:
- // for single message sends: basevalue (TIMERID_MSGSEND) + send queue index
- if (wParam >= TIMERID_MSGSEND) {
- int iIndex = wParam - TIMERID_MSGSEND;
- if (iIndex < SendQueue::NR_SENDJOBS) { // single sendjob timer
- SendJob *job = sendQueue->getJobByIndex(iIndex);
- KillTimer(hwndDlg, wParam);
- mir_sntprintf(job->szErrorMsg, SIZEOF(job->szErrorMsg), TranslateT("Delivery failure: %s"),
- TranslateT("The message send timed out"));
- job->iStatus = SendQueue::SQ_ERROR;
- if (!nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND))
- SkinPlaySound("SendError");
- if (!(dat->dwFlags & MWF_ERRORSTATE))
- sendQueue->handleError(dat, iIndex);
- break;
- }
- }
- else if (wParam == TIMERID_FLASHWND) {
- if (dat->mayFlashTab)
- FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, TRUE, dat->hTabIcon);
- break;
- }
- else if (wParam == TIMERID_TYPE) {
- DM_Typing(dat);
- break;
- }
- break;
-
- case DM_ERRORDECIDED:
- switch (wParam) {
- case MSGERROR_CANCEL:
- case MSGERROR_SENDLATER:
- if (dat->dwFlags & MWF_ERRORSTATE) {
- dat->cache->saveHistory(0, 0);
- if (wParam == MSGERROR_SENDLATER)
- sendQueue->doSendLater(dat->iCurrentQueueError, dat); // to be implemented at a later time
- dat->iOpenJobs--;
- sendQueue->dec();
- if (dat->iCurrentQueueError >= 0 && dat->iCurrentQueueError < SendQueue::NR_SENDJOBS)
- sendQueue->clearJob(dat->iCurrentQueueError);
- dat->iCurrentQueueError = -1;
- sendQueue->showErrorControls(dat, FALSE);
- if (wParam != MSGERROR_CANCEL || (wParam == MSGERROR_CANCEL && lParam == 0))
- SetDlgItemText(hwndDlg, IDC_MESSAGE, _T(""));
- sendQueue->checkQueue(dat);
- int iNextFailed = sendQueue->findNextFailed(dat);
- if (iNextFailed >= 0)
- sendQueue->handleError(dat, iNextFailed);
- }
- break;
-
- case MSGERROR_RETRY:
- if (dat->dwFlags & MWF_ERRORSTATE) {
- int resent = 0;
-
- dat->cache->saveHistory(0, 0);
- if (dat->iCurrentQueueError >= 0 && dat->iCurrentQueueError < SendQueue::NR_SENDJOBS) {
- SendJob *job = sendQueue->getJobByIndex(dat->iCurrentQueueError);
- if (job->hSendId == 0 && job->hContact == 0)
- break;
-
- job->hSendId = (HANDLE)CallContactService(job->hContact, PSS_MESSAGE,
- (dat->sendMode & SMODE_FORCEANSI) ? (job->dwFlags & ~PREF_UNICODE) : job->dwFlags, (LPARAM)job->szSendBuffer);
- resent++;
- }
-
- if (resent) {
- SendJob *job = sendQueue->getJobByIndex(dat->iCurrentQueueError);
-
- SetTimer(hwndDlg, TIMERID_MSGSEND + dat->iCurrentQueueError, PluginConfig.m_MsgTimeout, NULL);
- job->iStatus = SendQueue::SQ_INPROGRESS;
- dat->iCurrentQueueError = -1;
- sendQueue->showErrorControls(dat, FALSE);
- SetDlgItemText(hwndDlg, IDC_MESSAGE, _T(""));
- sendQueue->checkQueue(dat);
-
- int iNextFailed = sendQueue->findNextFailed(dat);
- if (iNextFailed >= 0)
- sendQueue->handleError(dat, iNextFailed);
- }
- }
- }
- break;
-
- case DM_SELECTTAB:
- SendMessage(hwndContainer, DM_SELECTTAB, wParam, lParam); // pass the msg to our container
- return 0;
-
- case DM_SETLOCALE:
- if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
- break;
- if (m_pContainer->hwndActive == hwndDlg && PluginConfig.m_bAutoLocaleSupport && hwndContainer == GetForegroundWindow() && hwndContainer == GetActiveWindow()) {
- if (lParam)
- dat->hkl = (HKL)lParam;
-
- if (dat->hkl)
- ActivateKeyboardLayout(dat->hkl, 0);
- }
- return 0;
-
- // return timestamp (in ticks) of last recent message which has not been read yet.
- // 0 if there is none
- // lParam = pointer to a dword receiving the value.
- case DM_QUERYLASTUNREAD:
- {
- DWORD *pdw = (DWORD *)lParam;
- if (pdw)
- *pdw = dat->dwTickLastEvent;
- }
- return 0;
-
- case DM_QUERYCONTAINER:
- {
- TContainerData **pc = (TContainerData **)lParam;
- if (pc)
- *pc = m_pContainer;
- }
- return 0;
-
- case DM_QUERYHCONTACT:
- {
- MCONTACT *phContact = (MCONTACT*)lParam;
- if (phContact)
- *phContact = dat->hContact;
- }
- return 0;
-
- case DM_UPDATELASTMESSAGE:
- DM_UpdateLastMessage(dat);
- return 0;
-
- case DM_SAVESIZE:
- if (dat->dwFlags & MWF_NEEDCHECKSIZE)
- lParam = 0;
-
- dat->dwFlags &= ~MWF_NEEDCHECKSIZE;
- if (dat->dwFlags & MWF_WASBACKGROUNDCREATE) {
- dat->dwFlags &= ~MWF_INITMODE;
- if (dat->lastMessage)
- DM_UpdateLastMessage(dat);
- }
-
- SendMessage(hwndContainer, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient);
- MoveWindow(hwndDlg, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), TRUE);
- if (dat->dwFlags & MWF_WASBACKGROUNDCREATE) {
- dat->dwFlags &= ~MWF_WASBACKGROUNDCREATE;
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- PostMessage(hwndDlg, DM_UPDATEPICLAYOUT, 0, 0);
- if (PluginConfig.m_bAutoLocaleSupport) {
- if (dat->hkl == 0)
- DM_LoadLocale(dat);
- else
- PostMessage(hwndDlg, DM_SETLOCALE, 0, 0);
- }
- if (dat->hwndIEView != 0)
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- if (dat->pContainer->dwFlags & CNT_SIDEBAR)
- dat->pContainer->SideBar->Layout();
- }
- else {
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- if (lParam == 0)
- DM_ScrollToBottom(dat, 0, 1);
- }
- return 0;
-
- case DM_CHECKSIZE:
- dat->dwFlags |= MWF_NEEDCHECKSIZE;
- return 0;
-
- // sent by the message input area hotkeys. just pass it to our container
- case DM_QUERYPENDING:
- SendMessage(hwndContainer, DM_QUERYPENDING, wParam, lParam);
- return 0;
-
- case WM_LBUTTONDOWN:
- GetCursorPos(&tmp);
- cur.x = (SHORT)tmp.x;
- cur.y = (SHORT)tmp.y;
- if (!dat->Panel->isHovered())
- SendMessage(hwndContainer, WM_NCLBUTTONDOWN, HTCAPTION, *((LPARAM*)(&cur)));
- break;
-
- case WM_LBUTTONUP:
- GetCursorPos(&tmp);
- if (dat->Panel->isHovered())
- dat->Panel->handleClick(tmp);
- else {
- cur.x = (SHORT)tmp.x;
- cur.y = (SHORT)tmp.y;
- SendMessage(hwndContainer, WM_NCLBUTTONUP, HTCAPTION, *((LPARAM*)(&cur)));
- }
- break;
-
- case WM_RBUTTONUP:
- {
- RECT rcPicture, rcPanelNick = { 0 };
- int menuID = 0;
-
- GetWindowRect(GetDlgItem(hwndDlg, IDC_CONTACTPIC), &rcPicture);
- rcPanelNick.left = rcPanelNick.right - 30;
- GetCursorPos(&pt);
-
- if (dat->Panel->invokeConfigDialog(pt))
- break;
-
- if (PtInRect(&rcPicture, pt))
- menuID = MENU_PICMENU;
-
- if ((menuID == MENU_PICMENU && ((dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown) || dat->hOwnPic) && dat->bShowAvatar != 0)) {
- HMENU submenu = GetSubMenu(m_pContainer->hMenuContext, menuID == MENU_PICMENU ? 1 : 11);
- GetCursorPos(&pt);
- MsgWindowUpdateMenu(dat, submenu, menuID);
- int iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- MsgWindowMenuHandler(dat, iSelection, menuID);
- break;
- }
-
- HMENU subMenu = GetSubMenu(m_pContainer->hMenuContext, 0);
- MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
-
- int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- if (iSelection >= IDM_CONTAINERMENU) {
- char szIndex[10];
- char *szKey = "TAB_ContainersW";
-
- mir_snprintf(szIndex, SIZEOF(szIndex), "%d", iSelection - IDM_CONTAINERMENU);
- if (iSelection - IDM_CONTAINERMENU >= 0) {
- ptrT val(db_get_tsa(NULL, szKey, szIndex));
- if (val)
- SendMessage(hwndDlg, DM_CONTAINERSELECTED, 0, (LPARAM)val);
- }
- break;
- }
- MsgWindowMenuHandler(dat, iSelection, MENU_TABCONTEXT);
- }
- break;
-
- case WM_MOUSEMOVE:
- GetCursorPos(&pt);
- DM_DismissTip(dat, pt);
- dat->Panel->trackMouse(pt);
- break;
-
- case WM_MEASUREITEM:
- {
- LPMEASUREITEMSTRUCT lpmi = (LPMEASUREITEMSTRUCT) lParam;
- if (dat->Panel->isHovered()) {
- lpmi->itemHeight = 0;
- lpmi->itemWidth = 6;
- return TRUE;
- }
- }
- return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
-
- case WM_NCHITTEST:
- SendMessage(hwndContainer, WM_NCHITTEST, wParam, lParam);
- break;
-
- case WM_DRAWITEM:
- return MsgWindowDrawHandler(wParam, lParam, dat);
-
- case WM_APPCOMMAND:
- {
- DWORD cmd = GET_APPCOMMAND_LPARAM(lParam);
- if (cmd == APPCOMMAND_BROWSER_BACKWARD || cmd == APPCOMMAND_BROWSER_FORWARD) {
- SendMessage(hwndContainer, DM_SELECTTAB, cmd == APPCOMMAND_BROWSER_BACKWARD ? DM_SELECT_PREV : DM_SELECT_NEXT, 0);
- return 1;
- }
- }
- break;
-
- case WM_COMMAND:
- if (!dat)
- break;
-
- // custom button handling
- if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID) {
- BB_CustomButtonClick(dat, LOWORD(wParam), GetDlgItem(hwndDlg, LOWORD(wParam)), 0);
- break;
- }
-
- switch (LOWORD(wParam)) {
- case IDOK:
- if (dat->fEditNotesActive) {
- SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_PIC, (LPARAM)TranslateT("You are editing the user notes. Click the button again or use the hotkey (default: Alt-N) to save the notes and return to normal messaging mode"));
- return 0;
- }
- else {
- // don't parse text formatting when the message contains curly braces - these are used by the rtf syntax
- // and the parser currently cannot handle them properly in the text - XXX needs to be fixed later.
- FINDTEXTEXA fi = { 0 };
- fi.chrg.cpMin = 0;
- fi.chrg.cpMax = -1;
- fi.lpstrText = "{";
- int final_sendformat = SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? dat->SendFormat : 0;
- fi.lpstrText = "}";
- final_sendformat = SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? final_sendformat : 0;
-
- if (GetSendButtonState(hwndDlg) == PBS_DISABLED)
- break;
-
- ptrA streamOut(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), final_sendformat ? 0 : SF_TEXT));
- if (streamOut == NULL)
- break;
-
- CMString decoded(ptrT(mir_utf8decodeT(streamOut)));
- if (decoded.IsEmpty())
- break;
-
- char *utfResult = NULL;
- if (final_sendformat)
- DoRtfToTags(dat, decoded, SIZEOF(rtfDefColors), rtfDefColors);
- decoded.Trim();
- int bufSize = WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, 0, 0, 0);
-
- size_t memRequired = 0;
- int flags = 0;
- if (!IsUtfSendAvailable(dat->hContact)) {
- flags |= PREF_UNICODE;
- memRequired = bufSize + (mir_wstrlen(decoded) + 1) * sizeof(WCHAR);
- }
- else {
- flags |= PREF_UTF;
- utfResult = mir_utf8encodeT(decoded);
- memRequired = strlen(utfResult) + 1;
- }
-
- // try to detect RTL
- HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
- SendMessage(hwndEdit, WM_SETREDRAW, FALSE, 0);
-
- PARAFORMAT2 pf2;
- memset(&pf2, 0, sizeof(PARAFORMAT2));
- pf2.cbSize = sizeof(pf2);
- pf2.dwMask = PFM_RTLPARA;
- SendMessage(hwndEdit, EM_SETSEL, 0, -1);
- SendMessage(hwndEdit, EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
- if (pf2.wEffects & PFE_RTLPARA)
- if (SendQueue::RTL_Detect(decoded))
- flags |= PREF_RTL;
-
- SendMessage(hwndEdit, WM_SETREDRAW, TRUE, 0);
- SendMessage(hwndEdit, EM_SETSEL, -1, -1);
- InvalidateRect(hwndEdit, NULL, FALSE);
-
- if (memRequired > dat->iSendBufferSize) {
- dat->sendBuffer = (char *)mir_realloc(dat->sendBuffer, memRequired);
- dat->iSendBufferSize = memRequired;
- }
- if (utfResult) {
- memcpy(dat->sendBuffer, utfResult, memRequired);
- mir_free(utfResult);
- }
- else {
- WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, bufSize, 0, 0);
- if (flags & PREF_UNICODE)
- memcpy(&dat->sendBuffer[bufSize], decoded, (mir_wstrlen(decoded) + 1) * sizeof(WCHAR));
- }
-
- if (memRequired == 0 || dat->sendBuffer[0] == 0)
- break;
-
- if (dat->sendMode & SMODE_CONTAINER && m_pContainer->hwndActive == hwndDlg && GetForegroundWindow() == hwndContainer) {
- int tabCount = TabCtrl_GetItemCount(hwndTab);
- ptrA szFromStream(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->SendFormat ? 0 : SF_TEXT));
-
- TCITEM tci = { 0 };
- tci.mask = TCIF_PARAM;
- for (int i=0; i < tabCount; i++) {
- TabCtrl_GetItem(hwndTab, i, &tci);
- // get the contact from the tabs lparam which hopefully is the tabs hwnd so we can get its userdata.... hopefully
- HWND contacthwnd = (HWND)tci.lParam;
- if (IsWindow(contacthwnd)) {
- // if the contact hwnd is the current contact then ignore it and let the normal code deal with the msg
- if (contacthwnd != hwndDlg) {
- SETTEXTEX stx = {ST_DEFAULT, CP_UTF8};
- // send the buffer to the contacts msg typing area
- SendDlgItemMessage(contacthwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szFromStream);
- SendMessage(contacthwnd, WM_COMMAND, IDOK, 0);
- }
- }
- }
- }
- // END /all /MOD
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
- DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
-
- DeletePopupsForContact(dat->hContact, PU_REMOVE_ON_SEND);
- if (M.GetByte("allow_sendhook", 0)) {
- int result = TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CUSTOM, MAKELONG(flags, tabMSG_WINDOW_EVT_CUSTOM_BEFORESEND));
- if (result)
- return TRUE;
- }
- sendQueue->addTo(dat, memRequired, flags);
- }
- return TRUE;
-
- case IDC_QUOTE:
- {
- int iCharsPerLine = M.GetDword("quoteLineLength", 64);
- CHARRANGE sel;
- SETTEXTEX stx = {ST_SELECTION, 1200};
-
- MEVENT hDBEvent = 0;
- if (dat->hwndIEView || dat->hwndHPP) { // IEView quoting support..
- TCHAR *selected = 0, *szQuoted = 0;
-
- IEVIEWEVENT event = { sizeof(event) };
- event.hContact = dat->hContact;
- event.dwFlags = 0;
- event.iType = IEE_GET_SELECTION;
-
- if (dat->hwndIEView) {
- event.hwnd = dat->hwndIEView;
- selected = (TCHAR*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
- }
- else {
- event.hwnd = dat->hwndHPP;
- selected = (TCHAR*)CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event);
- }
-
- if (selected != NULL) {
- szQuoted = QuoteText(selected, iCharsPerLine, 0);
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
- if (szQuoted)
- mir_free(szQuoted);
- break;
- }
- else {
- hDBEvent = db_event_last(dat->hContact);
- goto quote_from_last;
- }
- }
- hDBEvent = dat->hDbEventLast;
-
-quote_from_last:
- if (hDBEvent == NULL)
- break;
-
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin == sel.cpMax) {
- DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.cbBlob = db_event_getBlobSize(hDBEvent);
- TCHAR *szText = (TCHAR*)mir_alloc((dbei.cbBlob + 1) * sizeof(TCHAR)); //URLs are made one char bigger for crlf
- dbei.pBlob = (BYTE*)szText;
- db_event_get(hDBEvent, &dbei);
- int iSize = int(strlen((char*)dbei.pBlob)) + 1;
-
- bool iAlloced = false;
- TCHAR *szConverted;
- if (dbei.flags & DBEF_UTF) {
- szConverted = mir_utf8decodeW((char*)szText);
- iAlloced = true;
- }
- else {
- if (iSize != (int)dbei.cbBlob)
- szConverted = (TCHAR*)&dbei.pBlob[iSize];
- else {
- szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR) * iSize);
- iAlloced = true;
- MultiByteToWideChar(CP_ACP, 0, (char*)dbei.pBlob, -1, szConverted, iSize);
- }
- }
- if (dbei.eventType == EVENTTYPE_FILE) {
- size_t iDescr = mir_strlen((char *)(szText + sizeof(DWORD)));
- memmove(szText, szText + sizeof(DWORD), iDescr);
- memmove(szText + iDescr + 2, szText + sizeof(DWORD)+iDescr, dbei.cbBlob - iDescr - sizeof(DWORD)-1);
- szText[iDescr] = '\r';
- szText[iDescr + 1] = '\n';
- szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR)* (1 + mir_strlen((char *)szText)));
- MultiByteToWideChar(CP_ACP, 0, (char *)szText, -1, szConverted, 1 + (int)mir_strlen((char *)szText));
- iAlloced = true;
- }
- ptrT szQuoted(QuoteText(szConverted, iCharsPerLine, 0));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
- mir_free(szText);
- if (iAlloced)
- mir_free(szConverted);
- }
- else {
- ptrA szFromStream(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_TEXT | SFF_SELECTION));
- ptrW converted(mir_utf8decodeW(szFromStream));
- Utils::FilterEventMarkers(converted);
- ptrT szQuoted(QuoteText(converted, iCharsPerLine, 0));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
- }
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- }
- break;
-
- case IDC_ADD:
- {
- ADDCONTACTSTRUCT acs = { 0 };
- acs.hContact = dat->hContact;
- acs.handleType = HANDLE_CONTACT;
- acs.szProto = 0;
- CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
- if (!db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
- dat->bNotOnList = FALSE;
- ShowMultipleControls(hwndDlg, addControls, 2, SW_HIDE);
- if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
- Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_HIDE);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- }
- }
- break;
-
- case IDC_CANCELADD:
- dat->bNotOnList = FALSE;
- ShowMultipleControls(hwndDlg, addControls, 2, SW_HIDE);
- if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
- Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_HIDE);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- break;
-
- case IDC_MESSAGE:
- if (HIWORD(wParam) == EN_CHANGE) {
- if (m_pContainer->hwndActive == hwndDlg)
- UpdateReadChars(dat);
- dat->dwFlags |= MWF_NEEDHISTORYSAVE;
- dat->dwLastActivity = GetTickCount();
- m_pContainer->dwLastActivity = dat->dwLastActivity;
- SendQueue::UpdateSaveAndSendButton(dat);
- if (!(GetKeyState(VK_CONTROL) & 0x8000)) {
- dat->nLastTyping = GetTickCount();
- if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE))) {
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_OFF) {
- if (!(dat->dwFlags & MWF_INITMODE))
- DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_ON);
- }
- }
- else if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
- DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
- }
- }
- break;
-
- default:
- Utils::CmdDispatcher(Utils::CMD_MSGDIALOG, hwndDlg, LOWORD(wParam), wParam, lParam, dat, m_pContainer);
- break;
- }
- break;
-
- case WM_CONTEXTMENU:
- {
- DWORD idFrom = GetDlgCtrlID((HWND)wParam);
- if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID) {
- BB_CustomButtonClick(dat, idFrom, (HWND)wParam, 1);
- break;
- }
- }
- break;
-
- // this is now *only* called from the global ME_PROTO_ACK handler (static int ProtoAck() in msgs.c)
- // it receives:
- // wParam = index of the sendjob in the queue in the low word, index of the found sendID in the high word
- // (normally 0, but if its a multisend job, then the sendjob may contain more than one hContact/hSendId pairs.)
- // lParam = the original ackdata
- //
- // the "per message window" ACK hook is gone, the global ack handler cares about all types of ack's (currently
- // *_MESSAGE and *_AVATAR and dispatches them to the owner windows).
- case HM_EVENTSENT:
- sendQueue->ackMessage(dat, wParam, lParam);
- return 0;
-
- case DM_ACTIVATEME:
- ActivateExistingTab(m_pContainer, hwndDlg);
- return 0;
-
- // sent by the select container dialog box when a container was selected...
- // lParam = (TCHAR*)selected name...
- case DM_CONTAINERSELECTED:
- {
- TCHAR *szNewName = (TCHAR*)lParam;
- if (!_tcscmp(szNewName, TranslateT("Default container")))
- szNewName = CGlobals::m_default_container_name;
-
- int iOldItems = TabCtrl_GetItemCount(hwndTab);
- if (!_tcsncmp(m_pContainer->szName, szNewName, CONTAINER_NAMELEN))
- break;
-
- TContainerData *pNewContainer = FindContainerByName(szNewName);
- if (pNewContainer == NULL)
- if ((pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact)) == NULL)
- break;
-
- db_set_ts(dat->hContact, SRMSGMOD_T, "containerW", szNewName);
- dat->fIsReattach = TRUE;
- PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB, (WPARAM)pNewContainer, dat->hContact);
- if (iOldItems > 1) // there were more than 1 tab, container is still valid
- SendMessage(m_pContainer->hwndActive, WM_SIZE, 0, 0);
- SetForegroundWindow(pNewContainer->hwnd);
- SetActiveWindow(pNewContainer->hwnd);
- }
- break;
-
- case DM_STATUSBARCHANGED:
- UpdateStatusBar(dat);
- return 0;
-
- case DM_UINTOCLIPBOARD:
- Utils::CopyToClipBoard(dat->cache->getUIN(), hwndDlg);
- return 0;
-
- // broadcasted when GLOBAL info panel setting changes
- case DM_SETINFOPANEL:
- CInfoPanel::setPanelHandler(dat, wParam, lParam);
- return 0;
-
- // show the balloon tooltip control.
- // wParam == id of the "anchor" element, defaults to the panel status field (for away msg retrieval)
- // lParam == new text to show
- case DM_ACTIVATETOOLTIP:
- if (IsIconic(hwndContainer) || m_pContainer->hwndActive != hwndDlg)
- break;
-
- dat->Panel->showTip(wParam, lParam);
- break;
-
- case WM_NEXTDLGCTL:
- if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
- return 1;
- break;
-
- // save the contents of the log as rtf file
- case DM_SAVEMESSAGELOG:
- DM_SaveLogAsRTF(dat);
- return 0;
-
- case DM_CHECKAUTOHIDE:
- DM_CheckAutoHide(dat, wParam, lParam);
- return 0;
-
- case DM_IEVIEWOPTIONSCHANGED:
- if (dat->hwndIEView)
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
- break;
-
- case DM_SMILEYOPTIONSCHANGED:
- ConfigureSmileyButton(dat);
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
- break;
-
- case DM_MYAVATARCHANGED:
- {
- const char *szProto = dat->cache->getActiveProto();
- if (!strcmp((char *)wParam, szProto) && mir_strlen(szProto) == mir_strlen((char *)wParam))
- LoadOwnAvatar(dat);
- }
- break;
-
- case DM_GETWINDOWSTATE:
- {
- UINT state = MSG_WINDOW_STATE_EXISTS;
- if (IsWindowVisible(hwndDlg))
- state |= MSG_WINDOW_STATE_VISIBLE;
- if (GetForegroundWindow() == hwndContainer)
- state |= MSG_WINDOW_STATE_FOCUS;
- if (IsIconic(hwndContainer))
- state |= MSG_WINDOW_STATE_ICONIC;
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, state);
- }
- return TRUE;
-
- case DM_CLIENTCHANGED:
- GetClientIcon(dat);
- if (dat->hClientIcon && dat->Panel->isActive())
- InvalidateRect(hwndDlg, NULL, TRUE);
- return 0;
-
- case DM_UPDATEUIN:
- if (dat->Panel->isActive())
- dat->Panel->Invalidate();
- if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR)
- UpdateStatusBar(dat);
- return 0;
-
- case DM_REMOVEPOPUPS:
- DeletePopupsForContact(dat->hContact, (DWORD)wParam);
- return 0;
-
- case EM_THEMECHANGED:
- DM_FreeTheme(dat);
- return DM_ThemeChanged(dat);
-
- case DM_PLAYINCOMINGSOUND:
- if (!dat)
- return 0;
- PlayIncomingSound(dat);
- return 0;
-
- case DM_REFRESHTABINDEX:
- dat->iTabID = GetTabIndexFromHWND(GetParent(hwndDlg), hwndDlg);
- return 0;
-
- case DM_STATUSICONCHANGE:
- if (m_pContainer->hwndStatus) {
- SendMessage(dat->pContainer->hwnd, WM_SIZE, 0, 0);
- SendMessage(m_pContainer->hwndStatus, SB_SETTEXT, (WPARAM)(SBT_OWNERDRAW) | 2, 0);
- InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE);
- }
- return 0;
-
- case DM_BBNEEDUPDATE:
- if (lParam)
- CB_ChangeButton(hwndDlg, dat, (CustomButtonData*)lParam);
- else
- BB_InitDlgButtons(dat);
-
- BB_SetButtonsPos(dat);
- return 0;
-
- case DM_CBDESTROY:
- if (lParam)
- CB_DestroyButton(hwndDlg, dat, (DWORD)wParam, (DWORD)lParam);
- else
- CB_DestroyAllButtons(hwndDlg);
- return 0;
-
- case WM_DROPFILES:
- {
- BOOL not_sending = GetKeyState(VK_CONTROL) & 0x8000;
- if (!not_sending) {
- const char *szProto = dat->cache->getActiveProto();
- if (szProto == NULL)
- break;
-
- int pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- if (!(pcaps & PF1_FILESEND))
- break;
- if (dat->wStatus == ID_STATUS_OFFLINE) {
- pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
- if (!(pcaps & PF4_OFFLINEFILES)) {
- SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("Contact is offline and this protocol does not support sending files to offline users."));
- break;
- }
- }
- }
-
- if (dat->hContact != NULL) {
- TCHAR szFilename[MAX_PATH];
- HDROP hDrop = (HDROP)wParam;
- int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i;
- TCHAR** ppFiles = NULL;
- for (i = 0; i < fileCount; i++) {
- DragQueryFile(hDrop, i, szFilename, SIZEOF(szFilename));
- Utils::AddToFileList(&ppFiles, &totalCount, szFilename);
- }
-
- if (!not_sending)
- CallService(MS_FILE_SENDSPECIFICFILEST, dat->hContact, (LPARAM)ppFiles);
- else {
- if (ServiceExists(MS_HTTPSERVER_ADDFILENAME)) {
- for (int i = 0; i < totalCount; i++) {
- char* szFileName = mir_t2a(ppFiles[i]);
- CallService(MS_HTTPSERVER_ADDFILENAME, (WPARAM)szFileName, 0);
- mir_free(szFileName);
- }
- char *szHTTPText = "DEBUG";
- SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)szHTTPText);
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- }
- }
- for (i = 0; ppFiles[i]; i++)
- mir_free(ppFiles[i]);
- mir_free(ppFiles);
- }
- }
- return 0;
-
- case DM_CHECKQUEUEFORCLOSE:
- {
- int *uOpen = (int*)lParam;
- if (uOpen)
- *uOpen += dat->iOpenJobs;
- }
- return 0;
-
- case WM_CLOSE:
- // esc handles error controls if we are in error state (error controls visible)
- if (wParam == 0 && lParam == 0 && dat->dwFlags & MWF_ERRORSTATE) {
- SendMessage(hwndDlg, DM_ERRORDECIDED, MSGERROR_CANCEL, 0);
- return TRUE;
- }
-
- if (wParam == 0 && lParam == 0) {
- if (PluginConfig.m_EscapeCloses == 1) {
- SendMessage(hwndContainer, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- return TRUE;
- }
- else if (PluginConfig.m_bHideOnClose && PluginConfig.m_EscapeCloses == 2) {
- ShowWindow(hwndContainer, SW_HIDE);
- return TRUE;
- }
- _dlgReturn(hwndDlg, TRUE);
- }
- if(dat) {
- TContainerData *pContainer = dat->pContainer;
- if (dat->iOpenJobs > 0 && lParam != 2) {
- if (dat->dwFlags & MWF_ERRORSTATE) {
- SendMessage(hwndDlg, DM_ERRORDECIDED, MSGERROR_CANCEL, 1);
- } else {
- if (dat->dwFlagsEx & MWF_EX_WARNCLOSE)
- return TRUE;
-
- dat->dwFlagsEx |= MWF_EX_WARNCLOSE;
- LRESULT result = SendQueue::WarnPendingJobs(0);
- dat->dwFlagsEx &= ~MWF_EX_WARNCLOSE;
- if (result == IDNO)
- return TRUE;
- }
- }
- int iTabs = TabCtrl_GetItemCount(hwndTab);
- if (iTabs == 1) {
- PostMessage(hwndContainer, WM_CLOSE, 0, 1);
- return 1;
- }
-
- m_pContainer->iChilds--;
- int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
-
- // after closing a tab, we need to activate the tab to the left side of
- // the previously open tab.
- // normally, this tab has the same index after the deletion of the formerly active tab
- // unless, of course, we closed the last (rightmost) tab.
- if (!m_pContainer->bDontSmartClose && iTabs > 1 && lParam != 3) {
- if (i == iTabs - 1)
- i--;
- else
- i++;
- TabCtrl_SetCurSel(hwndTab, i);
-
- TCITEM item = { 0 };
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, i, &item); // retrieve dialog hwnd for the now active tab...
-
- m_pContainer->hwndActive = (HWND)item.lParam;
-
- SendMessage(hwndContainer, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
- SetWindowPos(m_pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW);
- ShowWindow((HWND)item.lParam, SW_SHOW);
- SetForegroundWindow(m_pContainer->hwndActive);
- SetFocus(m_pContainer->hwndActive);
- SendMessage(hwndContainer, WM_SIZE, 0, 0);
- }
-
- DestroyWindow(hwndDlg);
- if (iTabs == 1)
- PostMessage(GetParent(GetParent(hwndDlg)), WM_CLOSE, 0, 1);
- else
- SendMessage(pContainer->hwnd, WM_SIZE, 0, 0);
- }
- break;
-
- case WM_DESTROY:
- if (!dat)
- break;
-
- if (dat->hwndContactPic)
- DestroyWindow(dat->hwndContactPic);
-
- if (dat->hwndPanelPic)
- DestroyWindow(dat->hwndPanelPic);
-
- if (dat->hClientIcon)
- DestroyIcon(dat->hClientIcon);
-
- if (dat->hwndPanelPicParent)
- DestroyWindow(dat->hwndPanelPicParent);
-
- if (dat->cache->isValid()) { // not valid means the contact was deleted
- TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0);
- AddContactToFavorites(dat->hContact, dat->cache->getNick(), dat->cache->getActiveProto(), dat->szStatus, dat->wStatus,
- LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 1, PluginConfig.g_hMenuRecent);
- if (dat->hContact) {
- if (!dat->fEditNotesActive) {
- char *msg = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), SF_TEXT);
- if (msg) {
- db_set_utf(dat->hContact, SRMSGMOD, "SavedMsg", msg);
- mir_free(msg);
- }
- else db_unset(dat->hContact, SRMSGMOD, "SavedMsg");
- }
- else SendMessage(hwndDlg, WM_COMMAND, IDC_PIC, 0);
- }
- }
-
- if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
- DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
-
- DM_FreeTheme(dat);
-
- mir_free(dat->sendBuffer);
- mir_free(dat->hHistoryEvents);
-
- // search the sendqueue for unfinished send jobs and mir_free them. Leave unsent
- // messages in the queue as they can be acked later
- {
- SendJob *jobs = sendQueue->getJobByIndex(0);
-
- for (int i = 0; i < SendQueue::NR_SENDJOBS; i++) {
- if (jobs[i].hContact == dat->hContact) {
- if (jobs[i].iStatus >(unsigned)SendQueue::SQ_INPROGRESS)
- sendQueue->clearJob(i);
-
- // unfinished jobs which did not yet return anything are kept in the queue.
- // the hwndOwner is set to 0 because the window handle is now no longer valid.
- // Response for such a job is still silently handled by AckMessage() (sendqueue.c)
- if (jobs[i].iStatus == (unsigned)SendQueue::SQ_INPROGRESS)
- jobs[i].hOwnerWnd = 0;
- }
- }
- }
-
- mir_free(dat->hQueuedEvents);
-
- if (dat->hSmileyIcon)
- DestroyIcon(dat->hSmileyIcon);
-
- if (dat->hXStatusIcon)
- DestroyIcon(dat->hXStatusIcon);
-
- if (dat->hwndTip)
- DestroyWindow(dat->hwndTip);
-
- if (dat->hTaskbarIcon)
- DestroyIcon(dat->hTaskbarIcon);
-
- UpdateTrayMenuState(dat, FALSE); // remove me from the tray menu (if still there)
- if (PluginConfig.g_hMenuTrayUnread)
- DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->hContact, MF_BYCOMMAND);
- M.RemoveWindow(hwndDlg);
-
- if (dat->cache->isValid())
- db_set_dw(0, SRMSGMOD, "multisplit", dat->multiSplitterX);
-
- {
- HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
- if (hFont != NULL && hFont != (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0))
- DeleteObject(hFont);
-
- TCITEM item = { 0 };
- item.mask = TCIF_PARAM;
-
- int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
- if (i >= 0) {
- SendMessage(hwndTab, WM_USER + 100, 0, 0); // remove tooltip
- TabCtrl_DeleteItem(hwndTab, i);
- BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0);
- dat->iTabID = -1;
- }
- }
-
- TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE, 0);
-
- // clean up IEView and H++ log windows
- if (dat->hwndIEView != 0) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = dat->hwndIEView;
- CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- }
- if (dat->hwndHPP) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = dat->hwndHPP;
- CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
- }
- if (dat->pWnd) {
- delete dat->pWnd;
- dat->pWnd = 0;
- }
- if (dat->sbCustom) {
- delete dat->sbCustom;
- dat->sbCustom = 0;
- }
- break;
-
- case WM_DWMCOMPOSITIONCHANGED:
- BB_RefreshTheme(dat);
- memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
- CProxyWindow::verify(dat);
- break;
-
- case DM_FORCEREDRAW:
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
- return 0;
-
- case DM_CHECKINFOTIP:
- dat->Panel->hideTip(reinterpret_cast<HWND>(lParam));
- return 0;
-
- case WM_NCDESTROY:
- if (dat) {
- memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
- PostMessage(dat->pContainer->hwnd, WM_SIZE, 0, 1);
- if (m_pContainer->dwFlags & CNT_SIDEBAR)
- m_pContainer->SideBar->removeSession(dat);
- dat->cache->setWindowData();
- if (dat->cache->isValid() && !dat->fIsReattach && dat->hContact && M.GetByte("deletetemp", 0))
- if (db_get_b(dat->hContact, "CList", "NotOnList", 0))
- CallService(MS_DB_CONTACT_DELETE, dat->hContact, 0);
-
- delete dat->Panel;
- mir_free(dat);
- }
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- break;
- }
- return FALSE;
-}
+ case TABSRMM_HK_NUDGE:
+ SendNudge(dat);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_SENDFILE:
+ CallService(MS_FILE_SENDFILE, dat->hContact, 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_QUOTEMSG:
+ SendMessage(hwndDlg, WM_COMMAND, IDC_QUOTE, 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_USERMENU:
+ SendMessage(hwndDlg, WM_COMMAND, IDC_PROTOCOL, 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_USERDETAILS:
+ SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_NAME, BN_CLICKED), 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_EDITNOTES:
+ PostMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_PIC, BN_CLICKED), 0);
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_TOGGLESENDLATER:
+ if (sendLater->isAvail()) {
+ dat->sendMode ^= SMODE_SENDLATER;
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER |
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS);
+ RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
+ }
+ else
+ CWarning::show(CWarning::WARN_NO_SENDLATER, MB_OK | MB_ICONINFORMATION, TranslateT("Configuration issue|The unattended send feature is disabled. The \\b1 send later\\b0 and \\b1 send to multiple contacts\\b0 features depend on it.\n\nYou must enable it under \\b1Options->Message sessions->Advanced tweaks\\b0. Changing this option requires a restart."));
+ return _dlgReturn(hwndDlg, 1);
+ case TABSRMM_HK_TOGGLERTL:
+ {
+ DWORD dwGlobal = M.GetDword("mwflags", MWF_LOG_DEFAULT);
+ DWORD dwMask = M.GetDword(dat->hContact, "mwmask", 0);
+ DWORD dwFlags = M.GetDword(dat->hContact, "mwflags", 0);
+
+ dat->dwFlags ^= MWF_LOG_RTL;
+ if ((dwGlobal & MWF_LOG_RTL) != (dat->dwFlags & MWF_LOG_RTL)) {
+ dwMask |= MWF_LOG_RTL;
+ dwFlags |= (dat->dwFlags & MWF_LOG_RTL);
+ }
+ else {
+ dwMask &= ~MWF_LOG_RTL;
+ dwFlags &= ~MWF_LOG_RTL;
+ }
+ if (dwMask) {
+ db_set_dw(dat->hContact, SRMSGMOD_T, "mwmask", dwMask);
+ db_set_dw(dat->hContact, SRMSGMOD_T, "mwflags", dwFlags);
+ }
+ else {
+ db_unset(dat->hContact, SRMSGMOD_T, "mwmask");
+ db_unset(dat->hContact, SRMSGMOD_T, "mwflags");
+ }
+ SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
+ SendMessage(hwndDlg, DM_DEFERREDREMAKELOG, (WPARAM)hwndDlg, 0);
+ }
+ return _dlgReturn(hwndDlg, 1);
+
+ case TABSRMM_HK_TOGGLEMULTISEND:
+ dat->sendMode ^= SMODE_MULTIPLE;
+ if (dat->sendMode & SMODE_MULTIPLE)
+ DM_CreateClist(dat);
+ else if (IsWindow(GetDlgItem(hwndDlg, IDC_CLIST)))
+ DestroyWindow(GetDlgItem(hwndDlg, IDC_CLIST));
+
+ HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
+ SetWindowPos(hwndEdit, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ RedrawWindow(hwndEdit, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
+ DM_ScrollToBottom(dat, 0, 0);
+ Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(hwndDlg, IDC_CLIST, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
+ if (dat->sendMode & SMODE_MULTIPLE)
+ SetFocus(GetDlgItem(hwndDlg, IDC_CLIST));
+ else
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (DM_GenericHotkeysCheck(&message, dat)) {
+ dat->fkeyProcessed = true;
+ return _dlgReturn(hwndDlg, 1);
+ }
+ }
+ if (wp == VK_BROWSER_BACK || wp == VK_BROWSER_FORWARD)
+ return 1;
+
+ if (msg == WM_CHAR) {
+ if (isCtrl && !isShift && !isAlt) {
+ switch (wp) {
+ case 23: // ctrl - w
+ PostMessage(hwndDlg, WM_CLOSE, 1, 0);
+ break;
+ case 19:
+ PostMessage(hwndDlg, WM_COMMAND, IDC_SENDMENU, IDC_SENDMENU);
+ break;
+ case 16:
+ PostMessage(hwndDlg, WM_COMMAND, IDC_PROTOMENU, IDC_PROTOMENU);
+ break;
+ case 20:
+ PostMessage(hwndDlg, WM_COMMAND, IDC_TOGGLETOOLBAR, 1);
+ break;
+ }
+ return 1;
+ }
+ }
+ if (msg == WM_KEYDOWN) {
+ if ((wp == VK_INSERT && isShift && !isCtrl) || (wp == 'V' && isCtrl && !isShift && !isAlt)) {
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_PASTESPECIAL, CF_UNICODETEXT, 0);
+ _clrMsgFilter(lParam);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (isCtrl && isShift) {
+ if (wp == 0x9) { // ctrl-shift tab
+ SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_PREV, 0);
+ _clrMsgFilter(lParam);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ }
+ if (isCtrl && !isShift && !isAlt) {
+ if (wp == VK_TAB) {
+ SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
+ _clrMsgFilter(lParam);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (wp == VK_F4) {
+ PostMessage(hwndDlg, WM_CLOSE, 1, 0);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (wp == VK_PRIOR) {
+ SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_PREV, 0);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (wp == VK_NEXT) {
+ SendMessage(hwndDlg, DM_SELECTTAB, DM_SELECT_NEXT, 0);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ }
+ }
+ if (msg == WM_SYSKEYDOWN && isAlt) {
+ if (wp == 0x52) {
+ SendMessage(hwndDlg, DM_QUERYPENDING, DM_QUERY_MOSTRECENT, 0);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (wp == VK_MULTIPLY) {
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (wp == VK_DIVIDE) {
+ SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (wp == VK_ADD) {
+ SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_NEXT, 0);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (wp == VK_SUBTRACT) {
+ SendMessage(hwndContainer, DM_SELECTTAB, DM_SELECT_PREV, 0);
+ return _dlgReturn(hwndDlg, 1);
+ }
+ }
+
+ if (msg == WM_KEYDOWN && wp == VK_F12) {
+ if (isShift || isCtrl || isAlt)
+ return _dlgReturn(hwndDlg, 1);
+ if (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)
+ SendMessage(hwndDlg, DM_REPLAYQUEUE, 0, 0);
+ dat->dwFlagsEx ^= MWF_SHOW_SCROLLINGDISABLED;
+ Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, (dat->bNotOnList || dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED) ? SW_SHOW : SW_HIDE);
+ if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
+ SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, TranslateT("Contact not on list. You may add it..."));
+ else
+ SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ DM_ScrollToBottom(dat, 1, 1);
+ return _dlgReturn(hwndDlg, 1);
+ }
+
+ // tabulation mod
+ if (msg == WM_KEYDOWN && wp == VK_TAB) {
+ if (PluginConfig.m_bAllowTab) {
+ if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE)
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)"\t");
+ _clrMsgFilter(lParam);
+ if (((NMHDR*)lParam)->idFrom != IDC_MESSAGE)
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ return _dlgReturn(hwndDlg, 1);
+ }
+ else {
+ if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE) {
+ if (GetSendButtonState(hwndDlg) != PBS_DISABLED && !(dat->pContainer->dwFlags & CNT_HIDETOOLBAR))
+ SetFocus(GetDlgItem(hwndDlg, IDOK));
+ else
+ SetFocus(GetDlgItem(hwndDlg, IDC_LOG));
+ return _dlgReturn(hwndDlg, 1);
+ }
+ if (((NMHDR*)lParam)->idFrom == IDC_LOG) {
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ return _dlgReturn(hwndDlg, 1);
+ }
+ }
+ return _dlgReturn(hwndDlg, 0);
+ }
+
+ if (msg == WM_MOUSEWHEEL && (((NMHDR*)lParam)->idFrom == IDC_LOG || ((NMHDR*)lParam)->idFrom == IDC_MESSAGE)) {
+ GetCursorPos(&pt);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
+ if (PtInRect(&rc, pt)) {
+ short wDirection = (short)HIWORD(wp);
+ if (LOWORD(wp) & MK_SHIFT) {
+ if (wDirection < 0)
+ SendDlgItemMessage(hwndDlg, IDC_LOG, WM_VSCROLL, MAKEWPARAM(SB_PAGEDOWN, 0), 0);
+ else if (wDirection > 0)
+ SendDlgItemMessage(hwndDlg, IDC_LOG, WM_VSCROLL, MAKEWPARAM(SB_PAGEUP, 0), 0);
+ return 0;
+ }
+ return 0;
+ }
+ return 1;
+ }
+
+ if (msg == WM_CHAR && wp == 'c') {
+ if (isCtrl) {
+ SendDlgItemMessage(hwndDlg, ((NMHDR*)lParam)->code, WM_COPY, 0, 0);
+ break;
+ }
+ }
+ if ((msg == WM_LBUTTONDOWN || msg == WM_KEYUP || msg == WM_LBUTTONUP) && ((NMHDR*)lParam)->idFrom == IDC_MESSAGE) {
+ int bBold = IsDlgButtonChecked(hwndDlg, IDC_FONTBOLD);
+ int bItalic = IsDlgButtonChecked(hwndDlg, IDC_FONTITALIC);
+ int bUnder = IsDlgButtonChecked(hwndDlg, IDC_FONTUNDERLINE);
+ int bStrikeout = IsDlgButtonChecked(hwndDlg, IDC_FONTSTRIKEOUT);
+
+ cf2.cbSize = sizeof(CHARFORMAT2);
+ cf2.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_UNDERLINETYPE | CFM_STRIKEOUT;
+ cf2.dwEffects = 0;
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
+ if (cf2.dwEffects & CFE_BOLD) {
+ if (bBold == BST_UNCHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_CHECKED);
+ }
+ else if (bBold == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_UNCHECKED);
+
+ if (cf2.dwEffects & CFE_ITALIC) {
+ if (bItalic == BST_UNCHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_CHECKED);
+ }
+ else if (bItalic == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_UNCHECKED);
+
+ if (cf2.dwEffects & CFE_UNDERLINE && (cf2.bUnderlineType & CFU_UNDERLINE || cf2.bUnderlineType & CFU_UNDERLINEWORD)) {
+ if (bUnder == BST_UNCHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_CHECKED);
+ }
+ else if (bUnder == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_UNCHECKED);
+
+ if (cf2.dwEffects & CFE_STRIKEOUT) {
+ if (bStrikeout == BST_UNCHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_CHECKED);
+ }
+ else if (bStrikeout == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_UNCHECKED);
+ }
+ switch (msg) {
+ case WM_LBUTTONDOWN:
+ {
+ HCURSOR hCur = GetCursor();
+ m_pContainer->MenuBar->Cancel();
+ if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
+ || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) {
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+ break;
+ }
+
+ // auto-select-and-copy handling...
+ // if enabled, releasing the lmb with an active selection automatically copies the selection
+ // to the clipboard.
+ // holding ctrl while releasing the button pastes the selection to the input area, using plain text
+ // holding ctrl-alt does the same, but pastes formatted text
+ case WM_LBUTTONUP:
+ if (((NMHDR*)lParam)->idFrom == IDC_LOG) {
+ CHARRANGE cr;
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&cr);
+ if (cr.cpMax != cr.cpMin) {
+ cr.cpMin = cr.cpMax;
+ if (isCtrl && M.GetByte("autocopy", 1)) {
+ SETTEXTEX stx = { ST_KEEPUNDO | ST_SELECTION, CP_UTF8 };
+ char *streamOut = NULL;
+ if (isAlt)
+ streamOut = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_RTFNOOBJS | SFF_PLAINRTF | SFF_SELECTION);
+ else
+ streamOut = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_TEXT | SFF_SELECTION);
+ if (streamOut) {
+ Utils::FilterEventMarkers(streamOut);
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)streamOut);
+ mir_free(streamOut);
+ }
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ }
+ else if (M.GetByte("autocopy", 1) && !isShift) {
+ SendDlgItemMessage(hwndDlg, IDC_LOG, WM_COPY, 0, 0);
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ if (m_pContainer->hwndStatus)
+ SendMessage(m_pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)TranslateT("Selection copied to clipboard"));
+ }
+ }
+ }
+ break;
+
+ case WM_RBUTTONUP:
+ return _dlgReturn(hwndDlg, 1);
+
+ case WM_MOUSEMOVE:
+ GetCursorPos(&pt);
+ DM_DismissTip(dat, pt);
+ dat->Panel->trackMouse(pt);
+
+ HCURSOR hCur = GetCursor();
+ if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE))
+ SetCursor(LoadCursor(NULL, IDC_ARROW));
+ break;
+ }
+ }
+ break;
+
+ case EN_REQUESTRESIZE:
+ DM_HandleAutoSizeRequest(dat, (REQRESIZE *)lParam);
+ break;
+
+ case EN_LINK:
+ ENLINK *pLink = (ENLINK*)lParam;
+ switch (pLink->msg) {
+ case WM_SETCURSOR:
+ SetCursor(PluginConfig.hCurHyperlinkHand);
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONUP:
+ ptrT tszUrl(Utils::extractURLFromRichEdit((ENLINK*)lParam, GetDlgItem(hwndDlg, IDC_LOG)));
+ if (!IsStringValidLink(tszUrl))
+ break;
+
+ if (pLink->msg != WM_RBUTTONDOWN) {
+ CallService(MS_UTILS_OPENURL, OUF_TCHAR, tszUrl);
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ break;
+ }
+ HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hSubMenu = GetSubMenu(hMenu, 1);
+ TranslateMenu(hSubMenu);
+ pt.x = (short)LOWORD(pLink->lParam);
+ pt.y = (short)HIWORD(pLink->lParam);
+ ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt);
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
+ case IDM_OPENNEW:
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, tszUrl);
+ break;
+
+ case IDM_OPENEXISTING:
+ CallService(MS_UTILS_OPENURL, OUF_TCHAR, tszUrl);
+ break;
+
+ case IDM_COPYLINK:
+ if (!OpenClipboard(hwndDlg))
+ break;
+
+ EmptyClipboard();
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(tszUrl) + 1));
+ TCHAR *buf = (TCHAR*)GlobalLock(hData);
+ mir_tstrcpy(buf, tszUrl);
+ GlobalUnlock(hData);
+ SetClipboardData(CF_UNICODETEXT, hData);
+ CloseClipboard();
+ break;
+ }
+ DestroyMenu(hMenu);
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+ }
+ }
+ break;
+
+ case DM_TYPING:
+ {
+ int preTyping = dat->nTypeSecs != 0;
+ dat->nTypeSecs = (int)lParam > 0 ? (int)lParam : 0;
+
+ if (dat->nTypeSecs)
+ dat->bShowTyping = 0;
+
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, preTyping);
+ }
+ return TRUE;
+
+ case DM_UPDATEWINICON:
+ if (dat->hXStatusIcon) {
+ DestroyIcon(dat->hXStatusIcon);
+ dat->hXStatusIcon = 0;
+ }
+
+ if (LPCSTR szProto = dat->cache->getProto()) {
+ dat->hTabIcon = dat->hTabStatusIcon = MY_GetContactIcon(dat, "MetaiconTab");
+ if (M.GetByte("use_xicons", 1))
+ dat->hXStatusIcon = GetXStatusIcon(dat);
+
+ SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BUTTONSETASDIMMED, (dat->dwFlagsEx & MWF_SHOW_ISIDLE) != 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : MY_GetContactIcon(dat, "MetaiconBar")));
+
+ if (m_pContainer->hwndActive == hwndDlg)
+ SendMessage(m_pContainer->hwnd, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon));
+
+ if (dat->pWnd)
+ dat->pWnd->updateIcon(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon);
+ }
+ return 0;
+
+ // configures the toolbar only... if lParam != 0, then it also calls
+ // SetDialogToType() to reconfigure the message window
+ case DM_CONFIGURETOOLBAR:
+ dat->bShowUIElements = m_pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
+
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
+
+ if (lParam == 1) {
+ GetSendFormat(dat);
+ SetDialogToType(hwndDlg);
+ }
+
+ if (lParam == 1) {
+ DM_RecalcPictureSize(dat);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ DM_ScrollToBottom(dat, 0, 1);
+ }
+ return 0;
+
+ case DM_LOADBUTTONBARICONS:
+ for (int i = 0; i < SIZEOF(buttonicons); i++) {
+ SendDlgItemMessage(hwndDlg, buttonicons[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)*buttonicons[i].pIcon);
+ SendDlgItemMessage(hwndDlg, buttonicons[i].id, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
+ }
+
+ BB_UpdateIcons(hwndDlg);
+ SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
+ return 0;
+
+ case DM_OPTIONSAPPLIED:
+ DM_OptionsApplied(dat, wParam, lParam);
+ return 0;
+
+ case DM_UPDATETITLE:
+ DM_UpdateTitle(dat, wParam, lParam);
+ return 0;
+
+ case DM_UPDATESTATUSMSG:
+ dat->Panel->Invalidate();
+ return 0;
+
+ case DM_OWNNICKCHANGED:
+ GetMyNick(dat);
+ return 0;
+
+ case DM_ADDDIVIDER:
+ if (!(dat->dwFlags & MWF_DIVIDERSET) && PluginConfig.m_bUseDividers) {
+ if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOG)) > 0) {
+ dat->dwFlags |= MWF_DIVIDERWANTED;
+ dat->dwFlags |= MWF_DIVIDERSET;
+ }
+ }
+ return 0;
+
+ case WM_SETFOCUS:
+ MsgWindowUpdateState(dat, WM_SETFOCUS);
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ return 1;
+
+ case WM_ACTIVATE:
+ if (LOWORD(wParam) != WA_ACTIVE)
+ break;
+
+ //fall through
+ case WM_MOUSEACTIVATE:
+ MsgWindowUpdateState(dat, WM_ACTIVATE);
+ return 1;
+
+ case DM_UPDATEPICLAYOUT:
+ LoadContactAvatar(dat);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ return 0;
+
+ case DM_SPLITTERGLOBALEVENT:
+ DM_SplitterGlobalEvent(dat, wParam, lParam);
+ return 0;
+
+ case DM_SPLITTERMOVED:
+ if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_MULTISPLITTER)) {
+ GetClientRect(hwndDlg, &rc);
+ pt.x = wParam;
+ pt.y = 0;
+ ScreenToClient(hwndDlg, &pt);
+ int oldSplitterX = dat->multiSplitterX;
+ dat->multiSplitterX = rc.right - pt.x;
+ if (dat->multiSplitterX < 25)
+ dat->multiSplitterX = 25;
+
+ if (dat->multiSplitterX > ((rc.right - rc.left) - 80))
+ dat->multiSplitterX = oldSplitterX;
+ SendMessage(dat->hwnd, WM_SIZE, 0, 0);
+ }
+ else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTER)) {
+ GetClientRect(hwndDlg, &rc);
+ rc.top += (dat->Panel->isActive() ? dat->Panel->getHeight() + 40 : 30);
+ pt.x = 0;
+ pt.y = wParam;
+ ScreenToClient(hwndDlg, &pt);
+
+ int oldSplitterY = dat->splitterY;
+ int oldDynaSplitter = dat->dynaSplitter;
+
+ dat->splitterY = rc.bottom - pt.y + DPISCALEY_S(23);
+
+ // attempt to fix splitter troubles..
+ // hardcoded limits... better solution is possible, but this works for now
+ int bottomtoolbarH = 0;
+ if (dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR)
+ bottomtoolbarH = 22;
+
+ if (dat->splitterY < (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH)) { // min splitter size
+ dat->splitterY = (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH);
+ dat->dynaSplitter = dat->splitterY - DPISCALEY_S(34);
+ DM_RecalcPictureSize(dat);
+ }
+ else if (dat->splitterY > (rc.bottom - rc.top)) {
+ dat->splitterY = oldSplitterY;
+ dat->dynaSplitter = oldDynaSplitter;
+ DM_RecalcPictureSize(dat);
+ }
+ else {
+ dat->dynaSplitter = (rc.bottom - pt.y) - DPISCALEY_S(11);
+ DM_RecalcPictureSize(dat);
+ }
+ CSkin::UpdateToolbarBG(dat);
+ SendMessage(dat->hwnd, WM_SIZE, 0, 0);
+ }
+ else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) {
+ GetClientRect(GetDlgItem(hwndDlg, IDC_LOG), &rc);
+
+ POINT pt = { 0, wParam };
+ ScreenToClient(hwndDlg, &pt);
+ if ((pt.y + 2 >= MIN_PANELHEIGHT + 2) && (pt.y + 2 < 100) && (pt.y + 2 < rc.bottom - 30))
+ dat->Panel->setHeight(pt.y + 2, true);
+
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
+ if (M.isAero())
+ InvalidateRect(GetParent(hwndDlg), NULL, FALSE);
+ }
+ break;
+
+ // queue a dm_remakelog
+ // wParam = hwnd of the sender, so we can directly do a DM_REMAKELOG if the msg came
+ // from ourself. otherwise, the dm_remakelog will be deferred until next window
+ // activation (focus)
+ case DM_DEFERREDREMAKELOG:
+ if ((HWND)wParam == hwndDlg)
+ SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
+ else {
+ if (M.GetByte(dat->hContact, "mwoverride", 0) == 0) {
+ dat->dwFlags &= ~(MWF_LOG_ALL);
+ dat->dwFlags |= (lParam & MWF_LOG_ALL);
+ dat->dwFlags |= MWF_DEFERREDREMAKELOG;
+ }
+ }
+ return 0;
+
+ case DM_FORCEDREMAKELOG:
+ if ((HWND)wParam == hwndDlg)
+ SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
+ else {
+ dat->dwFlags &= ~(MWF_LOG_ALL);
+ dat->dwFlags |= (lParam & MWF_LOG_ALL);
+ dat->dwFlags |= MWF_DEFERREDREMAKELOG;
+ }
+ return 0;
+
+ case DM_REMAKELOG:
+ dat->szMicroLf[0] = 0;
+ dat->lastEventTime = 0;
+ dat->iLastEventType = -1;
+ StreamInEvents(hwndDlg, dat->hDbEventFirst, -1, 0, NULL);
+ return 0;
+
+ case DM_APPENDMCEVENT:
+ if (dat->hContact == db_mc_getMeta(wParam) && dat->hDbEventFirst == NULL) {
+ dat->hDbEventFirst = lParam;
+ SendMessage(dat->hwnd, DM_REMAKELOG, 0, 0);
+ }
+ else if (dat->hContact == wParam && db_mc_isSub(wParam) && db_event_getContact(lParam) != wParam)
+ StreamInEvents(hwndDlg, lParam, 1, 1, NULL);
+ return 0;
+
+ case DM_APPENDTOLOG:
+ StreamInEvents(hwndDlg, wParam, 1, 1, NULL);
+ return 0;
+
+ // replays queued events after the message log has been frozen for a while
+ case DM_REPLAYQUEUE:
+ for (int i = 0; i < dat->iNextQueuedEvent; i++)
+ if (dat->hQueuedEvents[i] != 0)
+ StreamInEvents(hwndDlg, dat->hQueuedEvents[i], 1, 1, NULL);
+
+ dat->iNextQueuedEvent = 0;
+ SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, dat->bNotOnList ? TranslateT("Contact not on list. You may add it...") :
+ TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
+ return 0;
+
+ case DM_SCROLLIEVIEW:
+ {
+ IEVIEWWINDOW iew = { sizeof(iew) };
+ iew.iType = IEW_SCROLLBOTTOM;
+ if (dat->hwndIEView) {
+ iew.hwnd = dat->hwndIEView;
+ CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&iew);
+ }
+ else if (dat->hwndHPP) {
+ iew.hwnd = dat->hwndHPP;
+ CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&iew);
+ }
+ }
+ return 0;
+
+ case HM_DBEVENTADDED:
+ // this is called whenever a new event has been added to the database.
+ // this CAN be posted (some sanity checks required).
+ if (dat && dat->hContact)
+ DM_EventAdded(dat, dat->hContact, lParam);
+ return 0;
+
+ case WM_TIMER:
+ // timer to control info panel hovering
+ if (wParam == TIMERID_AWAYMSG) {
+ KillTimer(hwndDlg, wParam);
+ GetCursorPos(&pt);
+
+ if (wParam == TIMERID_AWAYMSG && dat->Panel->hitTest(pt) != CInfoPanel::HTNIRVANA)
+ SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, 0, 0);
+ else
+ dat->dwFlagsEx &= ~MWF_SHOW_AWAYMSGTIMER;
+ break;
+ }
+
+ // timer id for message timeouts is composed like:
+ // for single message sends: basevalue (TIMERID_MSGSEND) + send queue index
+ if (wParam >= TIMERID_MSGSEND) {
+ int iIndex = wParam - TIMERID_MSGSEND;
+ if (iIndex < SendQueue::NR_SENDJOBS) { // single sendjob timer
+ SendJob *job = sendQueue->getJobByIndex(iIndex);
+ KillTimer(hwndDlg, wParam);
+ mir_sntprintf(job->szErrorMsg, SIZEOF(job->szErrorMsg), TranslateT("Delivery failure: %s"),
+ TranslateT("The message send timed out"));
+ job->iStatus = SendQueue::SQ_ERROR;
+ if (!nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND))
+ SkinPlaySound("SendError");
+ if (!(dat->dwFlags & MWF_ERRORSTATE))
+ sendQueue->handleError(dat, iIndex);
+ break;
+ }
+ }
+ else if (wParam == TIMERID_FLASHWND) {
+ if (dat->mayFlashTab)
+ FlashTab(dat, hwndTab, dat->iTabID, &dat->bTabFlash, TRUE, dat->hTabIcon);
+ break;
+ }
+ else if (wParam == TIMERID_TYPE) {
+ DM_Typing(dat);
+ break;
+ }
+ break;
+
+ case DM_ERRORDECIDED:
+ switch (wParam) {
+ case MSGERROR_CANCEL:
+ case MSGERROR_SENDLATER:
+ if (dat->dwFlags & MWF_ERRORSTATE) {
+ dat->cache->saveHistory(0, 0);
+ if (wParam == MSGERROR_SENDLATER)
+ sendQueue->doSendLater(dat->iCurrentQueueError, dat); // to be implemented at a later time
+ dat->iOpenJobs--;
+ sendQueue->dec();
+ if (dat->iCurrentQueueError >= 0 && dat->iCurrentQueueError < SendQueue::NR_SENDJOBS)
+ sendQueue->clearJob(dat->iCurrentQueueError);
+ dat->iCurrentQueueError = -1;
+ sendQueue->showErrorControls(dat, FALSE);
+ if (wParam != MSGERROR_CANCEL || (wParam == MSGERROR_CANCEL && lParam == 0))
+ SetDlgItemText(hwndDlg, IDC_MESSAGE, _T(""));
+ sendQueue->checkQueue(dat);
+ int iNextFailed = sendQueue->findNextFailed(dat);
+ if (iNextFailed >= 0)
+ sendQueue->handleError(dat, iNextFailed);
+ }
+ break;
+
+ case MSGERROR_RETRY:
+ if (dat->dwFlags & MWF_ERRORSTATE) {
+ int resent = 0;
+
+ dat->cache->saveHistory(0, 0);
+ if (dat->iCurrentQueueError >= 0 && dat->iCurrentQueueError < SendQueue::NR_SENDJOBS) {
+ SendJob *job = sendQueue->getJobByIndex(dat->iCurrentQueueError);
+ if (job->hSendId == 0 && job->hContact == 0)
+ break;
+
+ job->hSendId = (HANDLE)CallContactService(job->hContact, PSS_MESSAGE,
+ (dat->sendMode & SMODE_FORCEANSI) ? (job->dwFlags & ~PREF_UNICODE) : job->dwFlags, (LPARAM)job->szSendBuffer);
+ resent++;
+ }
+
+ if (resent) {
+ SendJob *job = sendQueue->getJobByIndex(dat->iCurrentQueueError);
+
+ SetTimer(hwndDlg, TIMERID_MSGSEND + dat->iCurrentQueueError, PluginConfig.m_MsgTimeout, NULL);
+ job->iStatus = SendQueue::SQ_INPROGRESS;
+ dat->iCurrentQueueError = -1;
+ sendQueue->showErrorControls(dat, FALSE);
+ SetDlgItemText(hwndDlg, IDC_MESSAGE, _T(""));
+ sendQueue->checkQueue(dat);
+
+ int iNextFailed = sendQueue->findNextFailed(dat);
+ if (iNextFailed >= 0)
+ sendQueue->handleError(dat, iNextFailed);
+ }
+ }
+ }
+ break;
+
+ case DM_SELECTTAB:
+ SendMessage(hwndContainer, DM_SELECTTAB, wParam, lParam); // pass the msg to our container
+ return 0;
+
+ case DM_SETLOCALE:
+ if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
+ break;
+ if (m_pContainer->hwndActive == hwndDlg && PluginConfig.m_bAutoLocaleSupport && hwndContainer == GetForegroundWindow() && hwndContainer == GetActiveWindow()) {
+ if (lParam)
+ dat->hkl = (HKL)lParam;
+
+ if (dat->hkl)
+ ActivateKeyboardLayout(dat->hkl, 0);
+ }
+ return 0;
+
+ // return timestamp (in ticks) of last recent message which has not been read yet.
+ // 0 if there is none
+ // lParam = pointer to a dword receiving the value.
+ case DM_QUERYLASTUNREAD:
+ {
+ DWORD *pdw = (DWORD *)lParam;
+ if (pdw)
+ *pdw = dat->dwTickLastEvent;
+ }
+ return 0;
+
+ case DM_QUERYCONTAINER:
+ {
+ TContainerData **pc = (TContainerData **)lParam;
+ if (pc)
+ *pc = m_pContainer;
+ }
+ return 0;
+
+ case DM_QUERYHCONTACT:
+ {
+ MCONTACT *phContact = (MCONTACT*)lParam;
+ if (phContact)
+ *phContact = dat->hContact;
+ }
+ return 0;
+
+ case DM_UPDATELASTMESSAGE:
+ DM_UpdateLastMessage(dat);
+ return 0;
+
+ case DM_SAVESIZE:
+ if (dat->dwFlags & MWF_NEEDCHECKSIZE)
+ lParam = 0;
+
+ dat->dwFlags &= ~MWF_NEEDCHECKSIZE;
+ if (dat->dwFlags & MWF_WASBACKGROUNDCREATE) {
+ dat->dwFlags &= ~MWF_INITMODE;
+ if (dat->lastMessage)
+ DM_UpdateLastMessage(dat);
+ }
+
+ SendMessage(hwndContainer, DM_QUERYCLIENTAREA, 0, (LPARAM)&rcClient);
+ MoveWindow(hwndDlg, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), TRUE);
+ if (dat->dwFlags & MWF_WASBACKGROUNDCREATE) {
+ dat->dwFlags &= ~MWF_WASBACKGROUNDCREATE;
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ PostMessage(hwndDlg, DM_UPDATEPICLAYOUT, 0, 0);
+ if (PluginConfig.m_bAutoLocaleSupport) {
+ if (dat->hkl == 0)
+ DM_LoadLocale(dat);
+ else
+ PostMessage(hwndDlg, DM_SETLOCALE, 0, 0);
+ }
+ if (dat->hwndIEView != 0)
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ if (dat->pContainer->dwFlags & CNT_SIDEBAR)
+ dat->pContainer->SideBar->Layout();
+ }
+ else {
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ if (lParam == 0)
+ DM_ScrollToBottom(dat, 0, 1);
+ }
+ return 0;
+
+ case DM_CHECKSIZE:
+ dat->dwFlags |= MWF_NEEDCHECKSIZE;
+ return 0;
+
+ // sent by the message input area hotkeys. just pass it to our container
+ case DM_QUERYPENDING:
+ SendMessage(hwndContainer, DM_QUERYPENDING, wParam, lParam);
+ return 0;
+
+ case WM_LBUTTONDOWN:
+ GetCursorPos(&tmp);
+ cur.x = (SHORT)tmp.x;
+ cur.y = (SHORT)tmp.y;
+ if (!dat->Panel->isHovered())
+ SendMessage(hwndContainer, WM_NCLBUTTONDOWN, HTCAPTION, *((LPARAM*)(&cur)));
+ break;
+
+ case WM_LBUTTONUP:
+ GetCursorPos(&tmp);
+ if (dat->Panel->isHovered())
+ dat->Panel->handleClick(tmp);
+ else {
+ cur.x = (SHORT)tmp.x;
+ cur.y = (SHORT)tmp.y;
+ SendMessage(hwndContainer, WM_NCLBUTTONUP, HTCAPTION, *((LPARAM*)(&cur)));
+ }
+ break;
+
+ case WM_RBUTTONUP:
+ {
+ RECT rcPicture, rcPanelNick = { 0 };
+ int menuID = 0;
+
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_CONTACTPIC), &rcPicture);
+ rcPanelNick.left = rcPanelNick.right - 30;
+ GetCursorPos(&pt);
+
+ if (dat->Panel->invokeConfigDialog(pt))
+ break;
+
+ if (PtInRect(&rcPicture, pt))
+ menuID = MENU_PICMENU;
+
+ if ((menuID == MENU_PICMENU && ((dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown) || dat->hOwnPic) && dat->bShowAvatar != 0)) {
+ HMENU submenu = GetSubMenu(m_pContainer->hMenuContext, menuID == MENU_PICMENU ? 1 : 11);
+ GetCursorPos(&pt);
+ MsgWindowUpdateMenu(dat, submenu, menuID);
+ int iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ MsgWindowMenuHandler(dat, iSelection, menuID);
+ break;
+ }
+
+ HMENU subMenu = GetSubMenu(m_pContainer->hMenuContext, 0);
+ MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
+
+ int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ if (iSelection >= IDM_CONTAINERMENU) {
+ char szIndex[10];
+ char *szKey = "TAB_ContainersW";
+
+ mir_snprintf(szIndex, SIZEOF(szIndex), "%d", iSelection - IDM_CONTAINERMENU);
+ if (iSelection - IDM_CONTAINERMENU >= 0) {
+ ptrT val(db_get_tsa(NULL, szKey, szIndex));
+ if (val)
+ SendMessage(hwndDlg, DM_CONTAINERSELECTED, 0, (LPARAM)val);
+ }
+ break;
+ }
+ MsgWindowMenuHandler(dat, iSelection, MENU_TABCONTEXT);
+ }
+ break;
+
+ case WM_MOUSEMOVE:
+ GetCursorPos(&pt);
+ DM_DismissTip(dat, pt);
+ dat->Panel->trackMouse(pt);
+ break;
+
+ case WM_MEASUREITEM:
+ {
+ LPMEASUREITEMSTRUCT lpmi = (LPMEASUREITEMSTRUCT)lParam;
+ if (dat->Panel->isHovered()) {
+ lpmi->itemHeight = 0;
+ lpmi->itemWidth = 6;
+ return TRUE;
+ }
+ }
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+
+ case WM_NCHITTEST:
+ SendMessage(hwndContainer, WM_NCHITTEST, wParam, lParam);
+ break;
+
+ case WM_DRAWITEM:
+ return MsgWindowDrawHandler(wParam, lParam, dat);
+
+ case WM_APPCOMMAND:
+ {
+ DWORD cmd = GET_APPCOMMAND_LPARAM(lParam);
+ if (cmd == APPCOMMAND_BROWSER_BACKWARD || cmd == APPCOMMAND_BROWSER_FORWARD) {
+ SendMessage(hwndContainer, DM_SELECTTAB, cmd == APPCOMMAND_BROWSER_BACKWARD ? DM_SELECT_PREV : DM_SELECT_NEXT, 0);
+ return 1;
+ }
+ }
+ break;
+
+ case WM_COMMAND:
+ if (!dat)
+ break;
+
+ // custom button handling
+ if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID) {
+ BB_CustomButtonClick(dat, LOWORD(wParam), GetDlgItem(hwndDlg, LOWORD(wParam)), 0);
+ break;
+ }
+
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ if (dat->fEditNotesActive) {
+ SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_PIC, (LPARAM)TranslateT("You are editing the user notes. Click the button again or use the hotkey (default: Alt-N) to save the notes and return to normal messaging mode"));
+ return 0;
+ }
+ else {
+ // don't parse text formatting when the message contains curly braces - these are used by the rtf syntax
+ // and the parser currently cannot handle them properly in the text - XXX needs to be fixed later.
+ FINDTEXTEXA fi = { 0 };
+ fi.chrg.cpMin = 0;
+ fi.chrg.cpMax = -1;
+ fi.lpstrText = "{";
+ int final_sendformat = SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? dat->SendFormat : 0;
+ fi.lpstrText = "}";
+ final_sendformat = SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? final_sendformat : 0;
+
+ if (GetSendButtonState(hwndDlg) == PBS_DISABLED)
+ break;
+
+ ptrA streamOut(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), final_sendformat ? 0 : SF_TEXT));
+ if (streamOut == NULL)
+ break;
+
+ CMString decoded(ptrT(mir_utf8decodeT(streamOut)));
+ if (decoded.IsEmpty())
+ break;
+
+ char *utfResult = NULL;
+ if (final_sendformat)
+ DoRtfToTags(dat, decoded, SIZEOF(rtfDefColors), rtfDefColors);
+ decoded.Trim();
+ int bufSize = WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, 0, 0, 0);
+
+ size_t memRequired = 0;
+ int flags = 0;
+ if (!IsUtfSendAvailable(dat->hContact)) {
+ flags |= PREF_UNICODE;
+ memRequired = bufSize + (mir_wstrlen(decoded) + 1) * sizeof(WCHAR);
+ }
+ else {
+ flags |= PREF_UTF;
+ utfResult = mir_utf8encodeT(decoded);
+ memRequired = strlen(utfResult) + 1;
+ }
+
+ // try to detect RTL
+ HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
+ SendMessage(hwndEdit, WM_SETREDRAW, FALSE, 0);
+
+ PARAFORMAT2 pf2;
+ memset(&pf2, 0, sizeof(PARAFORMAT2));
+ pf2.cbSize = sizeof(pf2);
+ pf2.dwMask = PFM_RTLPARA;
+ SendMessage(hwndEdit, EM_SETSEL, 0, -1);
+ SendMessage(hwndEdit, EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
+ if (pf2.wEffects & PFE_RTLPARA)
+ if (SendQueue::RTL_Detect(decoded))
+ flags |= PREF_RTL;
+
+ SendMessage(hwndEdit, WM_SETREDRAW, TRUE, 0);
+ SendMessage(hwndEdit, EM_SETSEL, -1, -1);
+ InvalidateRect(hwndEdit, NULL, FALSE);
+
+ if (memRequired > dat->iSendBufferSize) {
+ dat->sendBuffer = (char *)mir_realloc(dat->sendBuffer, memRequired);
+ dat->iSendBufferSize = memRequired;
+ }
+ if (utfResult) {
+ memcpy(dat->sendBuffer, utfResult, memRequired);
+ mir_free(utfResult);
+ }
+ else {
+ WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, bufSize, 0, 0);
+ if (flags & PREF_UNICODE)
+ memcpy(&dat->sendBuffer[bufSize], decoded, (mir_wstrlen(decoded) + 1) * sizeof(WCHAR));
+ }
+
+ if (memRequired == 0 || dat->sendBuffer[0] == 0)
+ break;
+
+ if (dat->sendMode & SMODE_CONTAINER && m_pContainer->hwndActive == hwndDlg && GetForegroundWindow() == hwndContainer) {
+ int tabCount = TabCtrl_GetItemCount(hwndTab);
+ ptrA szFromStream(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->SendFormat ? 0 : SF_TEXT));
+
+ TCITEM tci = { 0 };
+ tci.mask = TCIF_PARAM;
+ for (int i = 0; i < tabCount; i++) {
+ TabCtrl_GetItem(hwndTab, i, &tci);
+ // get the contact from the tabs lparam which hopefully is the tabs hwnd so we can get its userdata.... hopefully
+ HWND contacthwnd = (HWND)tci.lParam;
+ if (IsWindow(contacthwnd)) {
+ // if the contact hwnd is the current contact then ignore it and let the normal code deal with the msg
+ if (contacthwnd != hwndDlg) {
+ SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 };
+ // send the buffer to the contacts msg typing area
+ SendDlgItemMessage(contacthwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szFromStream);
+ SendMessage(contacthwnd, WM_COMMAND, IDOK, 0);
+ }
+ }
+ }
+ }
+ // END /all /MOD
+ if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
+ DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
+
+ DeletePopupsForContact(dat->hContact, PU_REMOVE_ON_SEND);
+ if (M.GetByte("allow_sendhook", 0)) {
+ int result = TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CUSTOM, MAKELONG(flags, tabMSG_WINDOW_EVT_CUSTOM_BEFORESEND));
+ if (result)
+ return TRUE;
+ }
+ sendQueue->addTo(dat, memRequired, flags);
+ }
+ return TRUE;
+
+ case IDC_QUOTE:
+ {
+ int iCharsPerLine = M.GetDword("quoteLineLength", 64);
+ CHARRANGE sel;
+ SETTEXTEX stx = { ST_SELECTION, 1200 };
+
+ MEVENT hDBEvent = 0;
+ if (dat->hwndIEView || dat->hwndHPP) { // IEView quoting support..
+ TCHAR *selected = 0, *szQuoted = 0;
+
+ IEVIEWEVENT event = { sizeof(event) };
+ event.hContact = dat->hContact;
+ event.dwFlags = 0;
+ event.iType = IEE_GET_SELECTION;
+
+ if (dat->hwndIEView) {
+ event.hwnd = dat->hwndIEView;
+ selected = (TCHAR*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
+ }
+ else {
+ event.hwnd = dat->hwndHPP;
+ selected = (TCHAR*)CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event);
+ }
+
+ if (selected != NULL) {
+ szQuoted = QuoteText(selected, iCharsPerLine, 0);
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
+ if (szQuoted)
+ mir_free(szQuoted);
+ break;
+ }
+ else {
+ hDBEvent = db_event_last(dat->hContact);
+ goto quote_from_last;
+ }
+ }
+ hDBEvent = dat->hDbEventLast;
+
+ quote_from_last:
+ if (hDBEvent == NULL)
+ break;
+
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin == sel.cpMax) {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.cbBlob = db_event_getBlobSize(hDBEvent);
+ TCHAR *szText = (TCHAR*)mir_alloc((dbei.cbBlob + 1) * sizeof(TCHAR)); //URLs are made one char bigger for crlf
+ dbei.pBlob = (BYTE*)szText;
+ db_event_get(hDBEvent, &dbei);
+ int iSize = int(strlen((char*)dbei.pBlob)) + 1;
+
+ bool iAlloced = false;
+ TCHAR *szConverted;
+ if (dbei.flags & DBEF_UTF) {
+ szConverted = mir_utf8decodeW((char*)szText);
+ iAlloced = true;
+ }
+ else {
+ if (iSize != (int)dbei.cbBlob)
+ szConverted = (TCHAR*)&dbei.pBlob[iSize];
+ else {
+ szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR) * iSize);
+ iAlloced = true;
+ MultiByteToWideChar(CP_ACP, 0, (char*)dbei.pBlob, -1, szConverted, iSize);
+ }
+ }
+ if (dbei.eventType == EVENTTYPE_FILE) {
+ size_t iDescr = mir_strlen((char *)(szText + sizeof(DWORD)));
+ memmove(szText, szText + sizeof(DWORD), iDescr);
+ memmove(szText + iDescr + 2, szText + sizeof(DWORD) + iDescr, dbei.cbBlob - iDescr - sizeof(DWORD) - 1);
+ szText[iDescr] = '\r';
+ szText[iDescr + 1] = '\n';
+ szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR)* (1 + mir_strlen((char *)szText)));
+ MultiByteToWideChar(CP_ACP, 0, (char *)szText, -1, szConverted, 1 + (int)mir_strlen((char *)szText));
+ iAlloced = true;
+ }
+ ptrT szQuoted(QuoteText(szConverted, iCharsPerLine, 0));
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
+ mir_free(szText);
+ if (iAlloced)
+ mir_free(szConverted);
+ }
+ else {
+ ptrA szFromStream(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_TEXT | SFF_SELECTION));
+ ptrW converted(mir_utf8decodeW(szFromStream));
+ Utils::FilterEventMarkers(converted);
+ ptrT szQuoted(QuoteText(converted, iCharsPerLine, 0));
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
+ }
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ }
+ break;
+
+ case IDC_ADD:
+ {
+ ADDCONTACTSTRUCT acs = { 0 };
+ acs.hContact = dat->hContact;
+ acs.handleType = HANDLE_CONTACT;
+ acs.szProto = 0;
+ CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
+ if (!db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
+ dat->bNotOnList = FALSE;
+ ShowMultipleControls(hwndDlg, addControls, 2, SW_HIDE);
+ if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
+ Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_HIDE);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ }
+ }
+ break;
+
+ case IDC_CANCELADD:
+ dat->bNotOnList = FALSE;
+ ShowMultipleControls(hwndDlg, addControls, 2, SW_HIDE);
+ if (!(dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED))
+ Utils::showDlgControl(hwndDlg, IDC_LOGFROZENTEXT, SW_HIDE);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ break;
+
+ case IDC_MESSAGE:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ if (m_pContainer->hwndActive == hwndDlg)
+ UpdateReadChars(dat);
+ dat->dwFlags |= MWF_NEEDHISTORYSAVE;
+ dat->dwLastActivity = GetTickCount();
+ m_pContainer->dwLastActivity = dat->dwLastActivity;
+ SendQueue::UpdateSaveAndSendButton(dat);
+ if (!(GetKeyState(VK_CONTROL) & 0x8000)) {
+ dat->nLastTyping = GetTickCount();
+ if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE))) {
+ if (dat->nTypeMode == PROTOTYPE_SELFTYPING_OFF) {
+ if (!(dat->dwFlags & MWF_INITMODE))
+ DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_ON);
+ }
+ }
+ else if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
+ DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
+ }
+ }
+ break;
+
+ default:
+ Utils::CmdDispatcher(Utils::CMD_MSGDIALOG, hwndDlg, LOWORD(wParam), wParam, lParam, dat, m_pContainer);
+ break;
+ }
+ break;
+
+ case WM_CONTEXTMENU:
+ {
+ DWORD idFrom = GetDlgCtrlID((HWND)wParam);
+ if (idFrom >= MIN_CBUTTONID && idFrom <= MAX_CBUTTONID) {
+ BB_CustomButtonClick(dat, idFrom, (HWND)wParam, 1);
+ break;
+ }
+ }
+ break;
+
+ // this is now *only* called from the global ME_PROTO_ACK handler (static int ProtoAck() in msgs.c)
+ // it receives:
+ // wParam = index of the sendjob in the queue in the low word, index of the found sendID in the high word
+ // (normally 0, but if its a multisend job, then the sendjob may contain more than one hContact/hSendId pairs.)
+ // lParam = the original ackdata
+ //
+ // the "per message window" ACK hook is gone, the global ack handler cares about all types of ack's (currently
+ // *_MESSAGE and *_AVATAR and dispatches them to the owner windows).
+ case HM_EVENTSENT:
+ sendQueue->ackMessage(dat, wParam, lParam);
+ return 0;
+
+ case DM_ACTIVATEME:
+ ActivateExistingTab(m_pContainer, hwndDlg);
+ return 0;
+
+ // sent by the select container dialog box when a container was selected...
+ // lParam = (TCHAR*)selected name...
+ case DM_CONTAINERSELECTED:
+ {
+ TCHAR *szNewName = (TCHAR*)lParam;
+ if (!_tcscmp(szNewName, TranslateT("Default container")))
+ szNewName = CGlobals::m_default_container_name;
+
+ int iOldItems = TabCtrl_GetItemCount(hwndTab);
+ if (!_tcsncmp(m_pContainer->szName, szNewName, CONTAINER_NAMELEN))
+ break;
+
+ TContainerData *pNewContainer = FindContainerByName(szNewName);
+ if (pNewContainer == NULL)
+ if ((pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact)) == NULL)
+ break;
+
+ db_set_ts(dat->hContact, SRMSGMOD_T, "containerW", szNewName);
+ dat->fIsReattach = TRUE;
+ PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB, (WPARAM)pNewContainer, dat->hContact);
+ if (iOldItems > 1) // there were more than 1 tab, container is still valid
+ SendMessage(m_pContainer->hwndActive, WM_SIZE, 0, 0);
+ SetForegroundWindow(pNewContainer->hwnd);
+ SetActiveWindow(pNewContainer->hwnd);
+ }
+ break;
+
+ case DM_STATUSBARCHANGED:
+ UpdateStatusBar(dat);
+ return 0;
+
+ case DM_UINTOCLIPBOARD:
+ Utils::CopyToClipBoard(dat->cache->getUIN(), hwndDlg);
+ return 0;
+
+ // broadcasted when GLOBAL info panel setting changes
+ case DM_SETINFOPANEL:
+ CInfoPanel::setPanelHandler(dat, wParam, lParam);
+ return 0;
+
+ // show the balloon tooltip control.
+ // wParam == id of the "anchor" element, defaults to the panel status field (for away msg retrieval)
+ // lParam == new text to show
+ case DM_ACTIVATETOOLTIP:
+ if (IsIconic(hwndContainer) || m_pContainer->hwndActive != hwndDlg)
+ break;
+
+ dat->Panel->showTip(wParam, lParam);
+ break;
+
+ case WM_NEXTDLGCTL:
+ if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
+ return 1;
+ break;
+
+ // save the contents of the log as rtf file
+ case DM_SAVEMESSAGELOG:
+ DM_SaveLogAsRTF(dat);
+ return 0;
+
+ case DM_CHECKAUTOHIDE:
+ DM_CheckAutoHide(dat, wParam, lParam);
+ return 0;
+
+ case DM_IEVIEWOPTIONSCHANGED:
+ if (dat->hwndIEView)
+ SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
+ break;
+
+ case DM_SMILEYOPTIONSCHANGED:
+ ConfigureSmileyButton(dat);
+ SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
+ break;
+
+ case DM_MYAVATARCHANGED:
+ {
+ const char *szProto = dat->cache->getActiveProto();
+ if (!strcmp((char *)wParam, szProto) && mir_strlen(szProto) == mir_strlen((char *)wParam))
+ LoadOwnAvatar(dat);
+ }
+ break;
+
+ case DM_GETWINDOWSTATE:
+ {
+ UINT state = MSG_WINDOW_STATE_EXISTS;
+ if (IsWindowVisible(hwndDlg))
+ state |= MSG_WINDOW_STATE_VISIBLE;
+ if (GetForegroundWindow() == hwndContainer)
+ state |= MSG_WINDOW_STATE_FOCUS;
+ if (IsIconic(hwndContainer))
+ state |= MSG_WINDOW_STATE_ICONIC;
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, state);
+ }
+ return TRUE;
+
+ case DM_CLIENTCHANGED:
+ GetClientIcon(dat);
+ if (dat->hClientIcon && dat->Panel->isActive())
+ InvalidateRect(hwndDlg, NULL, TRUE);
+ return 0;
+
+ case DM_UPDATEUIN:
+ if (dat->Panel->isActive())
+ dat->Panel->Invalidate();
+ if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR)
+ UpdateStatusBar(dat);
+ return 0;
+
+ case DM_REMOVEPOPUPS:
+ DeletePopupsForContact(dat->hContact, (DWORD)wParam);
+ return 0;
+
+ case EM_THEMECHANGED:
+ DM_FreeTheme(dat);
+ return DM_ThemeChanged(dat);
+
+ case DM_PLAYINCOMINGSOUND:
+ if (!dat)
+ return 0;
+ PlayIncomingSound(dat);
+ return 0;
+
+ case DM_REFRESHTABINDEX:
+ dat->iTabID = GetTabIndexFromHWND(GetParent(hwndDlg), hwndDlg);
+ return 0;
+
+ case DM_STATUSICONCHANGE:
+ if (m_pContainer->hwndStatus) {
+ SendMessage(dat->pContainer->hwnd, WM_SIZE, 0, 0);
+ SendMessage(m_pContainer->hwndStatus, SB_SETTEXT, (WPARAM)(SBT_OWNERDRAW) | 2, 0);
+ InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE);
+ }
+ return 0;
+
+ case DM_BBNEEDUPDATE:
+ if (lParam)
+ CB_ChangeButton(hwndDlg, dat, (CustomButtonData*)lParam);
+ else
+ BB_InitDlgButtons(dat);
+
+ BB_SetButtonsPos(dat);
+ return 0;
+
+ case DM_CBDESTROY:
+ if (lParam)
+ CB_DestroyButton(hwndDlg, dat, (DWORD)wParam, (DWORD)lParam);
+ else
+ CB_DestroyAllButtons(hwndDlg);
+ return 0;
+
+ case WM_DROPFILES:
+ {
+ BOOL not_sending = GetKeyState(VK_CONTROL) & 0x8000;
+ if (!not_sending) {
+ const char *szProto = dat->cache->getActiveProto();
+ if (szProto == NULL)
+ break;
+
+ int pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ if (!(pcaps & PF1_FILESEND))
+ break;
+ if (dat->wStatus == ID_STATUS_OFFLINE) {
+ pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ if (!(pcaps & PF4_OFFLINEFILES)) {
+ SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("Contact is offline and this protocol does not support sending files to offline users."));
+ break;
+ }
+ }
+ }
+
+ if (dat->hContact != NULL) {
+ TCHAR szFilename[MAX_PATH];
+ HDROP hDrop = (HDROP)wParam;
+ int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i;
+ TCHAR** ppFiles = NULL;
+ for (i = 0; i < fileCount; i++) {
+ DragQueryFile(hDrop, i, szFilename, SIZEOF(szFilename));
+ Utils::AddToFileList(&ppFiles, &totalCount, szFilename);
+ }
+
+ if (!not_sending)
+ CallService(MS_FILE_SENDSPECIFICFILEST, dat->hContact, (LPARAM)ppFiles);
+ else {
+ if (ServiceExists(MS_HTTPSERVER_ADDFILENAME)) {
+ for (int i = 0; i < totalCount; i++) {
+ char* szFileName = mir_t2a(ppFiles[i]);
+ CallService(MS_HTTPSERVER_ADDFILENAME, (WPARAM)szFileName, 0);
+ mir_free(szFileName);
+ }
+ char *szHTTPText = "DEBUG";
+ SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)szHTTPText);
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ }
+ }
+ for (i = 0; ppFiles[i]; i++)
+ mir_free(ppFiles[i]);
+ mir_free(ppFiles);
+ }
+ }
+ return 0;
+
+ case DM_CHECKQUEUEFORCLOSE:
+ {
+ int *uOpen = (int*)lParam;
+ if (uOpen)
+ *uOpen += dat->iOpenJobs;
+ }
+ return 0;
+
+ case WM_CLOSE:
+ // esc handles error controls if we are in error state (error controls visible)
+ if (wParam == 0 && lParam == 0 && dat->dwFlags & MWF_ERRORSTATE) {
+ SendMessage(hwndDlg, DM_ERRORDECIDED, MSGERROR_CANCEL, 0);
+ return TRUE;
+ }
+
+ if (wParam == 0 && lParam == 0) {
+ if (PluginConfig.m_EscapeCloses == 1) {
+ SendMessage(hwndContainer, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ return TRUE;
+ }
+ else if (PluginConfig.m_bHideOnClose && PluginConfig.m_EscapeCloses == 2) {
+ ShowWindow(hwndContainer, SW_HIDE);
+ return TRUE;
+ }
+ _dlgReturn(hwndDlg, TRUE);
+ }
+ if (dat) {
+ TContainerData *pContainer = dat->pContainer;
+ if (dat->iOpenJobs > 0 && lParam != 2) {
+ if (dat->dwFlags & MWF_ERRORSTATE) {
+ SendMessage(hwndDlg, DM_ERRORDECIDED, MSGERROR_CANCEL, 1);
+ }
+ else {
+ if (dat->dwFlagsEx & MWF_EX_WARNCLOSE)
+ return TRUE;
+
+ dat->dwFlagsEx |= MWF_EX_WARNCLOSE;
+ LRESULT result = SendQueue::WarnPendingJobs(0);
+ dat->dwFlagsEx &= ~MWF_EX_WARNCLOSE;
+ if (result == IDNO)
+ return TRUE;
+ }
+ }
+ int iTabs = TabCtrl_GetItemCount(hwndTab);
+ if (iTabs == 1) {
+ PostMessage(hwndContainer, WM_CLOSE, 0, 1);
+ return 1;
+ }
+
+ m_pContainer->iChilds--;
+ int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
+
+ // after closing a tab, we need to activate the tab to the left side of
+ // the previously open tab.
+ // normally, this tab has the same index after the deletion of the formerly active tab
+ // unless, of course, we closed the last (rightmost) tab.
+ if (!m_pContainer->bDontSmartClose && iTabs > 1 && lParam != 3) {
+ if (i == iTabs - 1)
+ i--;
+ else
+ i++;
+ TabCtrl_SetCurSel(hwndTab, i);
+
+ TCITEM item = { 0 };
+ item.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwndTab, i, &item); // retrieve dialog hwnd for the now active tab...
+
+ m_pContainer->hwndActive = (HWND)item.lParam;
+
+ SendMessage(hwndContainer, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
+ SetWindowPos(m_pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW);
+ ShowWindow((HWND)item.lParam, SW_SHOW);
+ SetForegroundWindow(m_pContainer->hwndActive);
+ SetFocus(m_pContainer->hwndActive);
+ SendMessage(hwndContainer, WM_SIZE, 0, 0);
+ }
+
+ DestroyWindow(hwndDlg);
+ if (iTabs == 1)
+ PostMessage(GetParent(GetParent(hwndDlg)), WM_CLOSE, 0, 1);
+ else
+ SendMessage(pContainer->hwnd, WM_SIZE, 0, 0);
+ }
+ break;
+
+ case WM_DESTROY:
+ if (!dat)
+ break;
+
+ if (dat->hwndContactPic)
+ DestroyWindow(dat->hwndContactPic);
+
+ if (dat->hwndPanelPic)
+ DestroyWindow(dat->hwndPanelPic);
+
+ if (dat->hClientIcon)
+ DestroyIcon(dat->hClientIcon);
+
+ if (dat->hwndPanelPicParent)
+ DestroyWindow(dat->hwndPanelPicParent);
+
+ if (dat->cache->isValid()) { // not valid means the contact was deleted
+ TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0);
+ AddContactToFavorites(dat->hContact, dat->cache->getNick(), dat->cache->getActiveProto(), dat->szStatus, dat->wStatus,
+ LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 1, PluginConfig.g_hMenuRecent);
+ if (dat->hContact) {
+ if (!dat->fEditNotesActive) {
+ char *msg = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), SF_TEXT);
+ if (msg) {
+ db_set_utf(dat->hContact, SRMSGMOD, "SavedMsg", msg);
+ mir_free(msg);
+ }
+ else db_unset(dat->hContact, SRMSGMOD, "SavedMsg");
+ }
+ else SendMessage(hwndDlg, WM_COMMAND, IDC_PIC, 0);
+ }
+ }
+
+ if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
+ DM_NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
+
+ DM_FreeTheme(dat);
+
+ mir_free(dat->sendBuffer);
+ mir_free(dat->hHistoryEvents);
+
+ // search the sendqueue for unfinished send jobs and mir_free them. Leave unsent
+ // messages in the queue as they can be acked later
+ {
+ SendJob *jobs = sendQueue->getJobByIndex(0);
+
+ for (int i = 0; i < SendQueue::NR_SENDJOBS; i++) {
+ if (jobs[i].hContact == dat->hContact) {
+ if (jobs[i].iStatus > (unsigned)SendQueue::SQ_INPROGRESS)
+ sendQueue->clearJob(i);
+
+ // unfinished jobs which did not yet return anything are kept in the queue.
+ // the hwndOwner is set to 0 because the window handle is now no longer valid.
+ // Response for such a job is still silently handled by AckMessage() (sendqueue.c)
+ if (jobs[i].iStatus == (unsigned)SendQueue::SQ_INPROGRESS)
+ jobs[i].hOwnerWnd = 0;
+ }
+ }
+ }
+
+ mir_free(dat->hQueuedEvents);
+
+ if (dat->hSmileyIcon)
+ DestroyIcon(dat->hSmileyIcon);
+
+ if (dat->hXStatusIcon)
+ DestroyIcon(dat->hXStatusIcon);
+
+ if (dat->hwndTip)
+ DestroyWindow(dat->hwndTip);
+
+ if (dat->hTaskbarIcon)
+ DestroyIcon(dat->hTaskbarIcon);
+
+ UpdateTrayMenuState(dat, FALSE); // remove me from the tray menu (if still there)
+ if (PluginConfig.g_hMenuTrayUnread)
+ DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->hContact, MF_BYCOMMAND);
+ M.RemoveWindow(hwndDlg);
+
+ if (dat->cache->isValid())
+ db_set_dw(0, SRMSGMOD, "multisplit", dat->multiSplitterX);
+
+ {
+ HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
+ if (hFont != NULL && hFont != (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0))
+ DeleteObject(hFont);
+
+ TCITEM item = { 0 };
+ item.mask = TCIF_PARAM;
+
+ int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
+ if (i >= 0) {
+ SendMessage(hwndTab, WM_USER + 100, 0, 0); // remove tooltip
+ TabCtrl_DeleteItem(hwndTab, i);
+ BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0);
+ dat->iTabID = -1;
+ }
+ }
+
+ TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE, 0);
+
+ // clean up IEView and H++ log windows
+ if (dat->hwndIEView != 0) {
+ IEVIEWWINDOW ieWindow;
+ ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ ieWindow.iType = IEW_DESTROY;
+ ieWindow.hwnd = dat->hwndIEView;
+ CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
+ }
+ if (dat->hwndHPP) {
+ IEVIEWWINDOW ieWindow;
+ ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ ieWindow.iType = IEW_DESTROY;
+ ieWindow.hwnd = dat->hwndHPP;
+ CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
+ }
+ if (dat->pWnd) {
+ delete dat->pWnd;
+ dat->pWnd = 0;
+ }
+ if (dat->sbCustom) {
+ delete dat->sbCustom;
+ dat->sbCustom = 0;
+ }
+ break;
+
+ case WM_DWMCOMPOSITIONCHANGED:
+ BB_RefreshTheme(dat);
+ memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
+ CProxyWindow::verify(dat);
+ break;
+
+ case DM_FORCEREDRAW:
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
+ return 0;
+
+ case DM_CHECKINFOTIP:
+ dat->Panel->hideTip(reinterpret_cast<HWND>(lParam));
+ return 0;
+
+ case WM_NCDESTROY:
+ if (dat) {
+ memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
+ PostMessage(dat->pContainer->hwnd, WM_SIZE, 0, 1);
+ if (m_pContainer->dwFlags & CNT_SIDEBAR)
+ m_pContainer->SideBar->removeSession(dat);
+ dat->cache->setWindowData();
+ if (dat->cache->isValid() && !dat->fIsReattach && dat->hContact && M.GetByte("deletetemp", 0))
+ if (db_get_b(dat->hContact, "CList", "NotOnList", 0))
+ CallService(MS_DB_CONTACT_DELETE, dat->hContact, 0);
+
+ delete dat->Panel;
+ mir_free(dat);
+ }
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ break;
+ }
+ return FALSE;
+}
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 1a97906f1c..67c28e2fe4 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -343,21 +343,21 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId)
case ID_VISIBILITY_DEFAULT:
case ID_VISIBILITY_HIDDENFORTHISCONTACT:
case ID_VISIBILITY_VISIBLEFORTHISCONTACT:
- {
- BYTE avOverrideMode;
- if (selection == ID_VISIBILITY_DEFAULT)
- avOverrideMode = -1;
- else if (selection == ID_VISIBILITY_VISIBLEFORTHISCONTACT)
- avOverrideMode = 1;
- else
- avOverrideMode = 0;
- db_set_b(dat->hContact, SRMSGMOD_T, "hideavatar", avOverrideMode);
- }
+ {
+ BYTE avOverrideMode;
+ if (selection == ID_VISIBILITY_DEFAULT)
+ avOverrideMode = -1;
+ else if (selection == ID_VISIBILITY_VISIBLEFORTHISCONTACT)
+ avOverrideMode = 1;
+ else
+ avOverrideMode = 0;
+ db_set_b(dat->hContact, SRMSGMOD_T, "hideavatar", avOverrideMode);
+ }
- ShowPicture(dat, FALSE);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- DM_ScrollToBottom(dat, 0, 1);
- return 1;
+ ShowPicture(dat, FALSE);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ DM_ScrollToBottom(dat, 0, 1);
+ return 1;
case ID_PICMENU_ALWAYSKEEPTHEBUTTONBARATFULLWIDTH:
PluginConfig.m_bAlwaysFullToolbarWidth = !PluginConfig.m_bAlwaysFullToolbarWidth;
@@ -398,13 +398,13 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId)
else if (menuId == MENU_LOGMENU) {
switch (selection) {
case ID_MESSAGELOGSETTINGS_GLOBAL:
- {
- OPENOPTIONSDIALOG ood = { sizeof(ood) };
- ood.pszPage = "Message Sessions";
- db_set_b(0, SRMSGMOD_T, "opage", 3); // force 3th tab to appear
- Options_Open(&ood);
- }
- return 1;
+ {
+ OPENOPTIONSDIALOG ood = { sizeof(ood) };
+ ood.pszPage = "Message Sessions";
+ db_set_b(0, SRMSGMOD_T, "opage", 3); // force 3th tab to appear
+ Options_Open(&ood);
+ }
+ return 1;
case ID_MESSAGELOGSETTINGS_FORTHISCONTACT:
CallService(MS_TABMSG_SETUSERPREFS, dat->hContact, 0);
@@ -593,7 +593,7 @@ bool TSAPI GetAvatarVisibility(HWND hwndDlg, TWindowData *dat)
switch (bAvatarMode) {
case 0: // globally on
dat->bShowAvatar = true;
-LBL_Check:
+ LBL_Check:
if (!dat->hwndContactPic)
dat->hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, _T(""), WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(hwndDlg, IDC_CONTACTPIC), (HMENU)0, NULL, NULL);
break;
@@ -772,7 +772,7 @@ void TSAPI FlashOnClist(HWND hwndDlg, TWindowData *dat, MEVENT hEvent, DBEVENTIN
if (!PluginConfig.m_bFlashOnClist)
return;
-
+
if ((GetForegroundWindow() != dat->pContainer->hwnd || dat->pContainer->hwndActive != hwndDlg) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE && !(dat->dwFlagsEx & MWF_SHOW_FLASHCLIST)) {
CLISTEVENT cle = { 0 };
cle.cbSize = sizeof(cle);
@@ -997,7 +997,7 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText, int iNumColors
_tcsncpy(tmp, p + 2, 2);
tmp[2] = 0;
}
-
+
// convert string containing char in hex format to int.
TCHAR *stoppedHere;
res.AppendChar(_tcstol(tmp, &stoppedHere, 16));
@@ -1761,9 +1761,10 @@ void TSAPI GetMyNick(TWindowData *dat)
switch (ci.type) {
case CNFT_ASCIIZ:
if (mir_tstrlen((TCHAR*)ci.pszVal) == 0 ||
- !_tcscmp((TCHAR*)ci.pszVal, TranslateT("'(Unknown contact)'"))) {
+ !_tcscmp((TCHAR*)ci.pszVal, TranslateT("'(Unknown contact)'"))) {
_tcsncpy_s(dat->szMyNickname, (dat->myUin[0] ? dat->myUin : TranslateT("'(Unknown contact)'")), _TRUNCATE);
- } else {
+ }
+ else {
_tcsncpy_s(dat->szMyNickname, (TCHAR*)ci.pszVal, _TRUNCATE);
}
break;
@@ -1775,7 +1776,8 @@ void TSAPI GetMyNick(TWindowData *dat)
break;
}
mir_free(ci.pszVal);
- } else {
+ }
+ else {
_tcsncpy_s(dat->szMyNickname, _T("<undef>"), _TRUNCATE); // same here
}
}
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index 838e6eba23..458ec01406 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -29,26 +29,26 @@
#include "commonheaders.h"
struct TCpTable cpTable[] = {
- { 874, LPGENT("Thai") },
- { 932, LPGENT("Japanese") },
- { 936, LPGENT("Simplified Chinese") },
- { 949, LPGENT("Korean") },
- { 950, LPGENT("Traditional Chinese") },
- { 1250, LPGENT("Central European") },
- { 1251, LPGENT("Cyrillic") },
+ { 874, LPGENT("Thai") },
+ { 932, LPGENT("Japanese") },
+ { 936, LPGENT("Simplified Chinese") },
+ { 949, LPGENT("Korean") },
+ { 950, LPGENT("Traditional Chinese") },
+ { 1250, LPGENT("Central European") },
+ { 1251, LPGENT("Cyrillic") },
{ 20866, LPGENT("Cyrillic KOI8-R") },
- { 1252, LPGENT("Latin I") },
- { 1253, LPGENT("Greek") },
- { 1254, LPGENT("Turkish") },
- { 1255, LPGENT("Hebrew") },
- { 1256, LPGENT("Arabic") },
- { 1257, LPGENT("Baltic") },
- { 1258, LPGENT("Vietnamese") },
- { 1361, LPGENT("Korean (Johab)") },
- { -1, NULL}
+ { 1252, LPGENT("Latin I") },
+ { 1253, LPGENT("Greek") },
+ { 1254, LPGENT("Turkish") },
+ { 1255, LPGENT("Hebrew") },
+ { 1256, LPGENT("Arabic") },
+ { 1257, LPGENT("Baltic") },
+ { 1258, LPGENT("Vietnamese") },
+ { 1361, LPGENT("Korean (Johab)") },
+ { -1, NULL }
};
-wchar_t* weekDays[7] = {LPGENT("Sunday"), LPGENT("Monday"), LPGENT("Tuesday"), LPGENT("Wednesday"), LPGENT("Thursday"), LPGENT("Friday"), LPGENT("Saturday")};
+wchar_t* weekDays[7] = { LPGENT("Sunday"), LPGENT("Monday"), LPGENT("Tuesday"), LPGENT("Wednesday"), LPGENT("Thursday"), LPGENT("Friday"), LPGENT("Saturday") };
wchar_t* months[12] =
{
@@ -560,7 +560,7 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
else {
if (dwEffectiveFlags & MWF_LOG_GROUPMODE)
szTemplate = isSent ? (g_groupBreak ? this_templateset->szTemplates[TMPL_GRPSTARTOUT] : this_templateset->szTemplates[TMPL_GRPINNEROUT]) :
- (g_groupBreak ? this_templateset->szTemplates[TMPL_GRPSTARTIN] : this_templateset->szTemplates[TMPL_GRPINNERIN]);
+ (g_groupBreak ? this_templateset->szTemplates[TMPL_GRPSTARTIN] : this_templateset->szTemplates[TMPL_GRPINNERIN]);
else
szTemplate = isSent ? this_templateset->szTemplates[TMPL_MSGOUT] : this_templateset->szTemplates[TMPL_MSGIN];
}
@@ -984,7 +984,7 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "\\ltrmark\\ltrch ");
break;
}
-skip:
+ skip:
if (skipToNext) {
i++;
while (szTemplate[i] != '%' && i < iTemplateLen) i++;
@@ -1035,8 +1035,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
dat->hDbEvent = db_event_next(dat->hContact, dat->hDbEvent);
if (--dat->eventsToInsert == 0)
break;
- }
- while (dat->buffer == NULL && dat->hDbEvent);
+ } while (dat->buffer == NULL && dat->hDbEvent);
if (dat->buffer)
break;
@@ -1321,7 +1320,7 @@ void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAp
if (dat->isAutoRTL & 1)
SendMessage(hwndrtf, EM_SETBKGNDCOLOR, 0, (LOWORD(dat->iLastEventType) & DBEF_SENT) ? (fAppend ? dat->pContainer->theme.outbg : dat->pContainer->theme.oldoutbg) :
- (fAppend ? dat->pContainer->theme.inbg : dat->pContainer->theme.oldinbg));
+ (fAppend ? dat->pContainer->theme.inbg : dat->pContainer->theme.oldinbg));
if (!(dat->isAutoRTL & 1)) {
GETTEXTLENGTHEX gtxl = { 0 };
@@ -1347,10 +1346,10 @@ void TSAPI StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAp
ReplaceIcons(hwndDlg, dat, startAt, fAppend, isSent);
dat->clr_added = FALSE;
- if (dat->hwndIEView == NULL && dat->hwndHPP == NULL) {
- int len = GetWindowTextLength(hwndrtf);
- SendMessage(hwndrtf, EM_SETSEL, len - 1, len - 1);
- }
+ if (dat->hwndIEView == NULL && dat->hwndHPP == NULL) {
+ int len = GetWindowTextLength(hwndrtf);
+ SendMessage(hwndrtf, EM_SETSEL, len - 1, len - 1);
+ }
DM_ScrollToBottom(dat, 0, 0);
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 1d37379afd..34cc300a76 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -39,7 +39,7 @@ struct FontOptionsList
}
static fontOptionsList[] = {
- {RGB(0, 0, 0), "Tahoma", 0, -10}
+ { RGB(0, 0, 0), "Tahoma", 0, -10 }
};
@@ -47,13 +47,13 @@ static fontOptionsList[] = {
HIMAGELIST CreateStateImageList()
{
HIMAGELIST himlStates;
-
+
himlStates = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 4, 0);
ImageList_AddIcon(himlStates, PluginConfig.g_IconUnchecked); /* IMG_NOCHECK */
ImageList_AddIcon(himlStates, PluginConfig.g_IconChecked); /* IMG_CHECK */
ImageList_AddIcon(himlStates, PluginConfig.g_IconGroupOpen); /* IMG_GRPOPEN */
ImageList_AddIcon(himlStates, PluginConfig.g_IconGroupClose); /* IMG_GRPCLOSED */
-
+
return himlStates;
}
@@ -236,19 +236,19 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
break;
- // self - configure the dialog, don't let the user load or unload
- // a skin while a message window is open. Show the warning that all
- // windows must be closed.
+ // self - configure the dialog, don't let the user load or unload
+ // a skin while a message window is open. Show the warning that all
+ // windows must be closed.
case WM_USER + 100:
- {
- bool fWindowsOpen = (pFirstContainer != 0 ? true : false);
- for (int i = 0; _ctrls[i]; i++)
- Utils::enableDlgControl(hwndDlg, _ctrls[i], !fWindowsOpen);
+ {
+ bool fWindowsOpen = (pFirstContainer != 0 ? true : false);
+ for (int i = 0; _ctrls[i]; i++)
+ Utils::enableDlgControl(hwndDlg, _ctrls[i], !fWindowsOpen);
- Utils::showDlgControl(hwndDlg, IDC_SKIN_WARN, fWindowsOpen ? SW_SHOW : SW_HIDE);
- Utils::showDlgControl(hwndDlg, IDC_SKIN_CLOSENOW, fWindowsOpen ? SW_SHOW : SW_HIDE);
- }
- return 0;
+ Utils::showDlgControl(hwndDlg, IDC_SKIN_WARN, fWindowsOpen ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(hwndDlg, IDC_SKIN_CLOSENOW, fWindowsOpen ? SW_SHOW : SW_HIDE);
+ }
+ return 0;
case WM_TIMER:
if (wParam == 1000)
@@ -290,12 +290,12 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
break;
case IDC_THEMEEXPORT:
- {
- const TCHAR *szFilename = GetThemeFileName(1);
- if (szFilename != NULL)
- WriteThemeToINI(szFilename, 0);
- }
- break;
+ {
+ const TCHAR *szFilename = GetThemeFileName(1);
+ if (szFilename != NULL)
+ WriteThemeToINI(szFilename, 0);
+ }
+ break;
case IDC_THEMEIMPORT:
if (CSkin::m_skinEnabled) {
@@ -390,7 +390,7 @@ void TreeViewInit(HWND hwndTree, UINT id, DWORD dwFlags, BOOL bFromMem)
SetWindowLongPtr(hwndTree, GWL_STYLE, GetWindowLongPtr(hwndTree, GWL_STYLE) | (TVS_NOHSCROLL));
/* Replace image list, destroy old. */
- ImageList_Destroy(TreeView_SetImageList(hwndTree, CreateStateImageList(), TVSIL_NORMAL));
+ ImageList_Destroy(TreeView_SetImageList(hwndTree, CreateStateImageList(), TVSIL_NORMAL));
// fill the list box, create groups first, then add items
for (int i = 0; lvGroups[i].szName != NULL; i++) {
@@ -419,7 +419,8 @@ void TreeViewInit(HWND hwndTree, UINT id, DWORD dwFlags, BOOL bFromMem)
tvi.item.iImage = tvi.item.iSelectedImage = (M.GetByte((char *)lvItems[i].lParam, lvItems[i].id) ? IMG_CHECK : IMG_NOCHECK);
break;
}
- } else {
+ }
+ else {
switch (lvItems[i].uType) {
case LOI_TYPE_FLAG:
tvi.item.iImage = tvi.item.iSelectedImage = (((*((UINT*)lvItems[i].lParam)) & lvItems[i].id) ? IMG_CHECK : IMG_NOCHECK);
@@ -464,7 +465,7 @@ void TreeViewToDB(HWND hwndTree, UINT id, char *DBPath, DWORD *dwFlags)
item.mask = TVIF_HANDLE | TVIF_IMAGE;
item.hItem = (HTREEITEM)lvItems[i].handle;
TreeView_GetItem(hwndTree, &item);
-
+
switch (lvItems[i].uType) {
case LOI_TYPE_FLAG:
if (dwFlags != NULL)
@@ -477,7 +478,8 @@ void TreeViewToDB(HWND hwndTree, UINT id, char *DBPath, DWORD *dwFlags)
case LOI_TYPE_SETTING:
if (DBPath != NULL) {
db_set_b(0, DBPath, (char *)lvItems[i].lParam, (BYTE)((item.iImage == IMG_CHECK) ? 1 : 0));
- } else {
+ }
+ else {
(*((BOOL*)lvItems[i].lParam)) = ((item.iImage == IMG_CHECK) ? TRUE : FALSE);
}
break;
@@ -508,29 +510,29 @@ BOOL TreeViewHandleClick(HWND hwndDlg, HWND hwndTree, WPARAM, LPARAM lParam)
item.hItem = (HTREEITEM)hti.hItem;
break;
case TVN_ITEMEXPANDEDW:
- {
- LPNMTREEVIEWW lpnmtv = (LPNMTREEVIEWW)lParam;
+ {
+ LPNMTREEVIEWW lpnmtv = (LPNMTREEVIEWW)lParam;
- item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- item.hItem = lpnmtv->itemNew.hItem;
- item.iImage = item.iSelectedImage =
- (lpnmtv->itemNew.state & TVIS_EXPANDED) ? IMG_GRPOPEN : IMG_GRPCLOSED;
- SendMessageW(((LPNMHDR)lParam)->hwndFrom, TVM_SETITEMW, 0, (LPARAM)&item);
- }
- return TRUE;
- break;
+ item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ item.hItem = lpnmtv->itemNew.hItem;
+ item.iImage = item.iSelectedImage =
+ (lpnmtv->itemNew.state & TVIS_EXPANDED) ? IMG_GRPOPEN : IMG_GRPCLOSED;
+ SendMessageW(((LPNMHDR)lParam)->hwndFrom, TVM_SETITEMW, 0, (LPARAM)&item);
+ }
+ return TRUE;
+ break;
case TVN_ITEMEXPANDEDA:
- {
- LPNMTREEVIEWA lpnmtv = (LPNMTREEVIEWA)lParam;
+ {
+ LPNMTREEVIEWA lpnmtv = (LPNMTREEVIEWA)lParam;
- item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- item.hItem = lpnmtv->itemNew.hItem;
- item.iImage = item.iSelectedImage =
- (lpnmtv->itemNew.state & TVIS_EXPANDED) ? IMG_GRPOPEN : IMG_GRPCLOSED;
- SendMessageA(((LPNMHDR)lParam)->hwndFrom, TVM_SETITEMA, 0, (LPARAM)&item);
- }
- return TRUE;
- break;
+ item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ item.hItem = lpnmtv->itemNew.hItem;
+ item.iImage = item.iSelectedImage =
+ (lpnmtv->itemNew.state & TVIS_EXPANDED) ? IMG_GRPOPEN : IMG_GRPCLOSED;
+ SendMessageA(((LPNMHDR)lParam)->hwndFrom, TVM_SETITEMA, 0, (LPARAM)&item);
+ }
+ return TRUE;
+ break;
default:
return FALSE;
}
@@ -564,7 +566,8 @@ BOOL TreeViewHandleClick(HWND hwndDlg, HWND hwndTree, WPARAM, LPARAM lParam)
if (item.mask & TVIF_STATE) {
RedrawWindow(hwndTree, NULL, NULL, RDW_INVALIDATE | RDW_NOFRAME | RDW_ERASENOW | RDW_ALLCHILDREN);
InvalidateRect(hwndTree, NULL, TRUE);
- } else {
+ }
+ else {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
@@ -645,7 +648,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
static int have_ieview = 0, have_hpp = 0;
static UINT __ctrls[] = { IDC_INDENTSPIN, IDC_RINDENTSPIN, IDC_INDENTAMOUNT, IDC_RIGHTINDENT,
- IDC_MODIFY, IDC_RTLMODIFY };
+IDC_MODIFY, IDC_RTLMODIFY };
static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -727,20 +730,20 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
TreeViewDestroy(GetDlgItem(hwndDlg, IDC_LOGOPTIONS));
break;
- // configure the option page - hide most of the settings here when either IEView
- // or H++ is set as the global message log viewer. Showing these options may confuse
- // the user, because they are not working and the user needs to configure the 3rd
- // party plugin.
+ // configure the option page - hide most of the settings here when either IEView
+ // or H++ is set as the global message log viewer. Showing these options may confuse
+ // the user, because they are not working and the user needs to configure the 3rd
+ // party plugin.
case WM_USER + 100:
- {
- LRESULT r = SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_GETCURSEL, 0, 0);
- Utils::showDlgControl(hwndDlg, IDC_EXPLAINMSGLOGSETTINGS, r == 0 ? SW_HIDE : SW_SHOW);
- Utils::showDlgControl(hwndDlg, IDC_LOGOPTIONS, r == 0 ? SW_SHOW : SW_HIDE);
- Utils::enableDlgControl(GetDlgItem(hwndDlg, IDC_MSGLOGDIDSPLAY), r != 0);
- for (int i = 0; i < SIZEOF(__ctrls); i++)
- Utils::enableDlgControl(hwndDlg, __ctrls[i], r == 0 ? TRUE : FALSE);
- }
- return 0;
+ {
+ LRESULT r = SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_GETCURSEL, 0, 0);
+ Utils::showDlgControl(hwndDlg, IDC_EXPLAINMSGLOGSETTINGS, r == 0 ? SW_HIDE : SW_SHOW);
+ Utils::showDlgControl(hwndDlg, IDC_LOGOPTIONS, r == 0 ? SW_SHOW : SW_HIDE);
+ Utils::enableDlgControl(GetDlgItem(hwndDlg, IDC_MSGLOGDIDSPLAY), r != 0);
+ for (int i = 0; i < SIZEOF(__ctrls); i++)
+ Utils::enableDlgControl(hwndDlg, __ctrls[i], r == 0 ? TRUE : FALSE);
+ }
+ return 0;
case WM_COMMAND:
switch (LOWORD(wParam)) {
@@ -762,21 +765,21 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_LOADTIMEN:
case IDC_RIGHTINDENT:
case IDC_TRIM:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
return TRUE;
break;
case IDC_MODIFY:
- {
- TemplateEditorNew teNew = {0, 0, hwndDlg};
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TEMPLATEEDIT), hwndDlg, DlgProcTemplateEditor, (LPARAM)&teNew);
- }
- break;
+ {
+ TemplateEditorNew teNew = { 0, 0, hwndDlg };
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TEMPLATEEDIT), hwndDlg, DlgProcTemplateEditor, (LPARAM)&teNew);
+ }
+ break;
case IDC_RTLMODIFY:
- {
- TemplateEditorNew teNew = {0, TRUE, hwndDlg};
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TEMPLATEEDIT), hwndDlg, DlgProcTemplateEditor, (LPARAM)&teNew);
- }
- break;
+ {
+ TemplateEditorNew teNew = { 0, TRUE, hwndDlg };
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TEMPLATEEDIT), hwndDlg, DlgProcTemplateEditor, (LPARAM)&teNew);
+ }
+ break;
case IDC_MSGLOGDIDSPLAY:
SendMessage(hwndDlg, WM_USER + 100, 0, 0);
break;
@@ -791,7 +794,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
default:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
LRESULT msglogmode = SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_GETCURSEL, 0, 0);
DWORD dwFlags = M.GetDword("mwflags", MWF_LOG_DEFAULT);
@@ -805,15 +808,15 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
db_set_b(0, SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
else
db_set_b(0, SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
- db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
- db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
- db_set_dw(0, SRMSGMOD_T, "IndentAmount", (DWORD) GetDlgItemInt(hwndDlg, IDC_INDENTAMOUNT, &translated, FALSE));
- db_set_dw(0, SRMSGMOD_T, "RightIndent", (DWORD) GetDlgItemInt(hwndDlg, IDC_RIGHTINDENT, &translated, FALSE));
+ db_set_dw(0, SRMSGMOD_T, "IndentAmount", (DWORD)GetDlgItemInt(hwndDlg, IDC_INDENTAMOUNT, &translated, FALSE));
+ db_set_dw(0, SRMSGMOD_T, "RightIndent", (DWORD)GetDlgItemInt(hwndDlg, IDC_RIGHTINDENT, &translated, FALSE));
db_set_b(0, SRMSGMOD_T, "default_ieview", 0);
db_set_b(0, SRMSGMOD_T, "default_hpp", 0);
- switch(msglogmode) {
+ switch (msglogmode) {
case 0:
break;
case 1:
@@ -1168,9 +1171,9 @@ static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM
}
-INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
+INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -1188,13 +1191,13 @@ INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
break;
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case IDC_PLUS_CHECKTREE:
return TreeViewHandleClick(hwndDlg, ((LPNMHDR)lParam)->hwndFrom, wParam, lParam);
break;
default:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TreeViewToDB(GetDlgItem(hwndDlg, IDC_PLUS_CHECKTREE), CTranslator::TREE_MODPLUS, SRMSGMOD_T, NULL);
@@ -1217,20 +1220,20 @@ INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
else if (LOWORD(wParam) == IDC_PLUS_REVERT) { // revert to defaults...
TOptionListItem *lvItems = CTranslator::getTree(CTranslator::TREE_MODPLUS);
- for (int i=0; lvItems[i].szName != NULL; i++)
+ for (int i = 0; lvItems[i].szName != NULL; i++)
if (lvItems[i].uType == LOI_TYPE_SETTING)
db_set_b(0, SRMSGMOD_T, (char *)lvItems[i].lParam, (BYTE)lvItems[i].id);
TreeViewSetFromDB(GetDlgItem(hwndDlg, IDC_PLUS_CHECKTREE), CTranslator::TREE_MODPLUS, 0);
break;
}
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
return TRUE;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case WM_CLOSE:
- EndDialog(hwndDlg,0);
+ EndDialog(hwndDlg, 0);
return 0;
}
return 0;
@@ -1274,84 +1277,84 @@ static int OptInitialise(WPARAM wParam, LPARAM lParam)
odp.pszTitle = LPGEN("Message sessions");
odp.flags = ODPF_BOLDGROUPS;
- odp.pszTab = LPGEN("General");
+ odp.pszTab = LPGEN("General");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGDLG);
- odp.pfnDlgProc = DlgProcOptions;
+ odp.pfnDlgProc = DlgProcOptions;
Options_AddPage(wParam, &odp);
- odp.pszTab = LPGEN("Tabs and layout");
+ odp.pszTab = LPGEN("Tabs and layout");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABBEDMSG);
- odp.pfnDlgProc = DlgProcTabbedOptions;
+ odp.pfnDlgProc = DlgProcTabbedOptions;
Options_AddPage(wParam, &odp);
- odp.pszTab = LPGEN("Containers");
+ odp.pszTab = LPGEN("Containers");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTAINERS);
- odp.pfnDlgProc = DlgProcContainerSettings;
+ odp.pfnDlgProc = DlgProcContainerSettings;
Options_AddPage(wParam, &odp);
- odp.pszTab = LPGEN("Message log");
+ odp.pszTab = LPGEN("Message log");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGLOG);
- odp.pfnDlgProc = DlgProcLogOptions;
+ odp.pfnDlgProc = DlgProcLogOptions;
Options_AddPage(wParam, &odp);
- odp.pszTab = LPGEN("Toolbar");
+ odp.pszTab = LPGEN("Toolbar");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TOOLBAR);
- odp.pfnDlgProc = DlgProcToolBar;
+ odp.pfnDlgProc = DlgProcToolBar;
Options_AddPage(wParam, &odp);
- odp.pszTab = LPGEN("Advanced tweaks");
+ odp.pszTab = LPGEN("Advanced tweaks");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_PLUS);
- odp.pfnDlgProc = PlusOptionsProc;
+ odp.pfnDlgProc = PlusOptionsProc;
Options_AddPage(wParam, &odp);
- odp.pszGroup = LPGEN("Message sessions");
+ odp.pszGroup = LPGEN("Message sessions");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGTYPE);
- odp.pszTitle = LPGEN("Typing notify");
+ odp.pszTitle = LPGEN("Typing notify");
odp.pfnDlgProc = DlgProcTypeOptions;
Options_AddPage(wParam, &odp);
if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP_OPT);
- odp.pszTitle = LPGEN("Event notifications");
- odp.pszGroup = LPGEN("Popups");
- odp.pfnDlgProc = DlgProcPopupOpts;
+ odp.pszTitle = LPGEN("Event notifications");
+ odp.pszGroup = LPGEN("Popups");
+ odp.pfnDlgProc = DlgProcPopupOpts;
Options_AddPage(wParam, &odp);
}
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN);
- odp.pszTitle = LPGEN("Message window");
- odp.pszTab = LPGEN("Load and apply");
- odp.pfnDlgProc = DlgProcSkinOpts;
- odp.pszGroup = LPGEN("Skins");
+ odp.pszTitle = LPGEN("Message window");
+ odp.pszTab = LPGEN("Load and apply");
+ odp.pfnDlgProc = DlgProcSkinOpts;
+ odp.pszGroup = LPGEN("Skins");
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_TABCONFIG);
- odp.pszTab = LPGEN("Window layout tweaks");
- odp.pfnDlgProc = DlgProcTabConfig;
+ odp.pszTab = LPGEN("Window layout tweaks");
+ odp.pfnDlgProc = DlgProcTabConfig;
Options_AddPage(wParam, &odp);
/* group chats */
- odp.pszGroup = LPGEN("Message sessions");
+ odp.pszGroup = LPGEN("Message sessions");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS1);
- odp.pszTitle = LPGEN("Group chats");
- odp.pszTab = LPGEN("Settings");
+ odp.pszTitle = LPGEN("Group chats");
+ odp.pszTab = LPGEN("Settings");
odp.pfnDlgProc = DlgProcOptions1;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS2);
- odp.pszTab = LPGEN("Log formatting");
- odp.pfnDlgProc = DlgProcOptions2;
+ odp.pszTab = LPGEN("Log formatting");
+ odp.pfnDlgProc = DlgProcOptions2;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS3);
- odp.pszTab = LPGEN("Events and filters");
- odp.pfnDlgProc = DlgProcOptions3;
+ odp.pszTab = LPGEN("Events and filters");
+ odp.pfnDlgProc = DlgProcOptions3;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS4);
- odp.pszTab = LPGEN("Highlighting");
- odp.pfnDlgProc = CMUCHighlight::dlgProc;
+ odp.pszTab = LPGEN("Highlighting");
+ odp.pfnDlgProc = CMUCHighlight::dlgProc;
Options_AddPage(wParam, &odp);
return 0;
}
@@ -1471,19 +1474,19 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR
OptCheckBox opts[] =
{
//{IDC_, def, bit, dbtype, dbmodule, dbsetting, valtype, pval},
- {IDC_CLOSEONESC, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, "escmode"},
- {IDC_ALWAYSPOPUP, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, SRMSGSET_AUTOPOPUP},
- {IDC_CREATEMIN, TRUE, 0, DBVT_BYTE, SRMSGMOD_T, "autocontainer"},
+ { IDC_CLOSEONESC, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, "escmode" },
+ { IDC_ALWAYSPOPUP, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, SRMSGSET_AUTOPOPUP },
+ { IDC_CREATEMIN, TRUE, 0, DBVT_BYTE, SRMSGMOD_T, "autocontainer" },
//{IDC_USETABS, , 0, DBVT_BYTE, SRMSGMOD_T, },
- {IDC_CREATENOACTIVATE, TRUE, 0, DBVT_BYTE, SRMSGMOD_T, "autotabs"},
- {IDC_POPUPONCREATE, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, "cpopup"},
- {IDC_AUTOSWITCHTABS, TRUE, 0, DBVT_BYTE, SRMSGMOD_T, "autoswitchtabs"},
+ { IDC_CREATENOACTIVATE, TRUE, 0, DBVT_BYTE, SRMSGMOD_T, "autotabs" },
+ { IDC_POPUPONCREATE, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, "cpopup" },
+ { IDC_AUTOSWITCHTABS, TRUE, 0, DBVT_BYTE, SRMSGMOD_T, "autoswitchtabs" },
//{IDC_SENDCTRLENTER, , 0, DBVT_BYTE, SRMSGMOD_T, },
- {IDC_SENDSHIFTENTER, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, "sendonshiftenter"},
- {IDC_SENDENTER, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, SRMSGSET_SENDONENTER},
- {IDC_SENDDBLENTER, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, "SendOnDblEnter"},
- {IDC_MINSEND, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, SRMSGSET_AUTOMIN},
- {IDC_NOOPENNOTIFY, FALSE, 0, DBVT_BYTE, "tabSRMM_NEN", OPT_WINDOWCHECK, CBVT_BOOL, &nen_options.bWindowCheck},
+ { IDC_SENDSHIFTENTER, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, "sendonshiftenter" },
+ { IDC_SENDENTER, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, SRMSGSET_SENDONENTER },
+ { IDC_SENDDBLENTER, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, "SendOnDblEnter" },
+ { IDC_MINSEND, FALSE, 0, DBVT_BYTE, SRMSGMOD_T, SRMSGSET_AUTOMIN },
+ { IDC_NOOPENNOTIFY, FALSE, 0, DBVT_BYTE, "tabSRMM_NEN", OPT_WINDOWCHECK, CBVT_BOOL, &nen_options.bWindowCheck },
};
static BOOL bInit = TRUE;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 456e48681a..ddc593297d 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -51,7 +51,7 @@ int IEViewOptionsChanged(WPARAM, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// fired event when user changes smileyadd options. Notify all open tabs about the changes
-int SmileyAddOptionsChanged(WPARAM,LPARAM)
+int SmileyAddOptionsChanged(WPARAM, LPARAM)
{
M.BroadcastMessage(DM_SMILEYOPTIONSCHANGED, 0, 0);
pci->SM_BroadcastMessage(NULL, DM_SMILEYOPTIONSCHANGED, 0, 0, FALSE);
@@ -81,7 +81,7 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
return 1;
MessageWindowData *mwd = (MessageWindowData*)lParam;
- if(mwd == NULL || (mwd->cbSize != sizeof(MessageWindowData)))
+ if (mwd == NULL || (mwd->cbSize != sizeof(MessageWindowData)))
return 1;
HWND hwnd = M.FindWindow(mwid->hContact);
@@ -506,7 +506,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
int iTabIndex_wanted = M.GetDword(hContact, "tabindex", pContainer->iChilds * 100);
int iCount = TabCtrl_GetItemCount(hwndTab);
- TCITEM item = {0};
+ TCITEM item = { 0 };
pContainer->iTabIndex = iCount;
if (iCount > 0) {
@@ -530,7 +530,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
newData.iTabID = newItem;
newData.iTabImage = newData.item.iImage;
newData.pContainer = pContainer;
- newData.iActivate = (int) bActivateTab;
+ newData.iActivate = (int)bActivateTab;
pContainer->iChilds++;
newData.bWantPopup = bWantPopup;
newData.hdbEvent = hdbEvent;
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 116198c758..c5f3d52032 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -231,31 +231,31 @@ struct SESSION_INFO;
struct TWindowData
{
- UINT cbSize;
- BYTE bType;
- TContainerData *pContainer; // parent container description structure
- HWND hwnd;
- DWORD dwFlags;
- DWORD dwFlagsEx;
+ UINT cbSize;
+ BYTE bType;
+ TContainerData *pContainer; // parent container description structure
+ HWND hwnd;
+ DWORD dwFlags;
+ DWORD dwFlagsEx;
MCONTACT hContact;
- char *szProto;
- TCHAR szMyNickname[130];
- TCHAR szStatusBar[100];
- StatusTextData *sbCustom;
- TCHAR newtitle[130]; // tab title...
- TCHAR szStatus[50];
- WORD wStatus;
- char *sendBuffer;
- size_t iSendBufferSize;
- int iSendLength; // message length in utf-8 octets
- HICON hTabIcon, hTabStatusIcon, hXStatusIcon, hClientIcon, hTaskbarIcon;
- HICON iFlashIcon;
- BOOL mayFlashTab;
- BOOL bTabFlash;
- HWND hwndIEView, hwndIWebBrowserControl, hwndHPP;
- HWND hwndContactPic, hwndPanelPic, hwndPanelPicParent;
- UINT bbLSideWidth, bbRSideWidth;
- BYTE kstate[256];
+ char *szProto;
+ TCHAR szMyNickname[130];
+ TCHAR szStatusBar[100];
+ StatusTextData *sbCustom;
+ TCHAR newtitle[130]; // tab title...
+ TCHAR szStatus[50];
+ WORD wStatus;
+ char *sendBuffer;
+ size_t iSendBufferSize;
+ int iSendLength; // message length in utf-8 octets
+ HICON hTabIcon, hTabStatusIcon, hXStatusIcon, hClientIcon, hTaskbarIcon;
+ HICON iFlashIcon;
+ BOOL mayFlashTab;
+ BOOL bTabFlash;
+ HWND hwndIEView, hwndIWebBrowserControl, hwndHPP;
+ HWND hwndContactPic, hwndPanelPic, hwndPanelPicParent;
+ UINT bbLSideWidth, bbRSideWidth;
+ BYTE kstate[256];
SESSION_INFO *si;
@@ -324,7 +324,7 @@ struct TWindowData
CInfoPanel *Panel;
CContactCache *cache;
CProxyWindow *pWnd; // proxy window object (win7+, for taskbar support).
- // ALWAYS check this pointer before using it, it is not guaranteed to exist.
+ // ALWAYS check this pointer before using it, it is not guaranteed to exist.
DWORD iSplitterSaved;
BYTE bWasDeleted;
BOOL bActualHistory;
@@ -799,8 +799,8 @@ struct SIDEBARITEM {
DWORD dwFlags;
HICON *hIcon, *hIconPressed, *hIconHover;
TCHAR *szName;
- void (*pfnAction)(ButtonItem *item, HWND hwndDlg, TWindowData *dat, HWND hwndItem);
- void (*pfnCallback)(ButtonItem *item, HWND hwndDlg, TWindowData *dat, HWND hwndItem);
+ void(*pfnAction)(ButtonItem *item, HWND hwndDlg, TWindowData *dat, HWND hwndItem);
+ void(*pfnCallback)(ButtonItem *item, HWND hwndDlg, TWindowData *dat, HWND hwndItem);
TCHAR *tszTip;
};
diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp
index b43ba08f79..e90e10cc1d 100644
--- a/plugins/TabSRMM/src/selectcontainer.cpp
+++ b/plugins/TabSRMM/src/selectcontainer.cpp
@@ -32,181 +32,181 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
{
HWND hwndMsgDlg = 0;
- hwndMsgDlg = (HWND) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ hwndMsgDlg = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
- case WM_INITDIALOG: {
- TCHAR szNewTitle[128];
- RECT rc, rcParent;
+ case WM_INITDIALOG: {
+ TCHAR szNewTitle[128];
+ RECT rc, rcParent;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) lParam);
- hwndMsgDlg = (HWND) lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
+ hwndMsgDlg = (HWND)lParam;
- TranslateDialogDefault(hwndDlg);
+ TranslateDialogDefault(hwndDlg);
- if (lParam) {
- TWindowData *dat = (TWindowData*)GetWindowLongPtr((HWND)lParam, GWLP_USERDATA);
- if (dat) {
- mir_sntprintf(szNewTitle, SIZEOF(szNewTitle), TranslateT("Select container for %s"), dat->cache->getNick());
- SetWindowText(hwndDlg, szNewTitle);
- }
+ if (lParam) {
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr((HWND)lParam, GWLP_USERDATA);
+ if (dat) {
+ mir_sntprintf(szNewTitle, SIZEOF(szNewTitle), TranslateT("Select container for %s"), dat->cache->getNick());
+ SetWindowText(hwndDlg, szNewTitle);
}
+ }
- SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_NEWCONTAINERNAME, EM_LIMITTEXT, (WPARAM)CONTAINER_NAMELEN, 0);
- SendDlgItemMessage(hwndDlg, IDC_NEWCONTAINER, EM_LIMITTEXT, (WPARAM)CONTAINER_NAMELEN, 0);
+ SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_NEWCONTAINERNAME, EM_LIMITTEXT, (WPARAM)CONTAINER_NAMELEN, 0);
+ SendDlgItemMessage(hwndDlg, IDC_NEWCONTAINER, EM_LIMITTEXT, (WPARAM)CONTAINER_NAMELEN, 0);
- GetWindowRect(hwndDlg, &rc);
- GetWindowRect(GetParent(hwndDlg), &rcParent);
- SetWindowPos(hwndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
- return TRUE;
- }
+ GetWindowRect(hwndDlg, &rc);
+ GetWindowRect(GetParent(hwndDlg), &rcParent);
+ SetWindowPos(hwndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
+ return TRUE;
+ }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK: {
- TCHAR szName[CONTAINER_NAMELEN];
- LRESULT iItem;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDOK: {
+ TCHAR szName[CONTAINER_NAMELEN];
+ LRESULT iItem;
- if ((iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETCURSEL, 0, 0)) != LB_ERR) {
- SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
- if (IsWindow(hwndMsgDlg))
- SendMessage(hwndMsgDlg, DM_CONTAINERSELECTED, 0, (LPARAM)szName);
- }
- if (IsWindow(hwndDlg))
- DestroyWindow(hwndDlg);
- break;
+ if ((iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETCURSEL, 0, 0)) != LB_ERR) {
+ SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
+ if (IsWindow(hwndMsgDlg))
+ SendMessage(hwndMsgDlg, DM_CONTAINERSELECTED, 0, (LPARAM)szName);
+ }
+ if (IsWindow(hwndDlg))
+ DestroyWindow(hwndDlg);
+ break;
+ }
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
+ break;
+ case IDC_DELETECONTAINER: {
+ TCHAR szName[CONTAINER_NAMELEN + 1];
+ LRESULT iItem;
+
+ if ((iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETCURSEL, 0, 0)) != LB_ERR) {
+ SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
+ if (!_tcsncmp(szName, _T("default"), CONTAINER_NAMELEN) || !_tcsncmp(szName, TranslateT("Default container"), CONTAINER_NAMELEN))
+ MessageBox(hwndDlg, TranslateT("You cannot delete the default container"), TranslateT("Error"), MB_OK | MB_ICONERROR);
+ else {
+ int iIndex = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETITEMDATA, (WPARAM)iItem, 0);
+ DeleteContainer(iIndex);
+ SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_RESETCONTENT, 0, 0);
+ SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, 0);
+ BuildContainerMenu();
}
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
- case IDC_DELETECONTAINER: {
- TCHAR szName[CONTAINER_NAMELEN + 1];
- LRESULT iItem;
-
- if ((iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETCURSEL, 0, 0)) != LB_ERR) {
- SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
- if (!_tcsncmp(szName, _T("default"), CONTAINER_NAMELEN) || !_tcsncmp(szName, TranslateT("Default container"), CONTAINER_NAMELEN))
- MessageBox(hwndDlg, TranslateT("You cannot delete the default container"), TranslateT("Error"), MB_OK | MB_ICONERROR);
- else {
- int iIndex = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETITEMDATA, (WPARAM)iItem, 0);
- DeleteContainer(iIndex);
- SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_RESETCONTENT, 0, 0);
- SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, 0);
- BuildContainerMenu();
- }
- }
+ }
+ break;
+ }
+ case IDC_RENAMECONTAINER: {
+ TCHAR szNewName[CONTAINER_NAMELEN], szName[CONTAINER_NAMELEN + 1];
+ int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME));
+ if (iLen) {
+ GetDlgItemText(hwndDlg, IDC_NEWCONTAINERNAME, szNewName, SIZEOF(szNewName));
+ if (!_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN) || !_tcsncmp(szNewName, TranslateT("Default container"), CONTAINER_NAMELEN)) {
+ MessageBox(hwndDlg, TranslateT("You cannot rename the default container"), TranslateT("Error"), MB_OK | MB_ICONERROR);
break;
}
- case IDC_RENAMECONTAINER: {
- TCHAR szNewName[CONTAINER_NAMELEN], szName[CONTAINER_NAMELEN + 1];
- int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME));
- if (iLen) {
- GetDlgItemText(hwndDlg, IDC_NEWCONTAINERNAME, szNewName, SIZEOF(szNewName));
- if (!_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN) || !_tcsncmp(szNewName, TranslateT("Default container"), CONTAINER_NAMELEN)) {
- MessageBox(hwndDlg, TranslateT("You cannot rename the default container"), TranslateT("Error"), MB_OK | MB_ICONERROR);
- break;
- }
- int iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)- 1, (LPARAM)szNewName);
- if (iItem != LB_ERR) {
- TCHAR szOldName[CONTAINER_NAMELEN + 1];
- SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szOldName);
- if (mir_tstrlen(szOldName) == mir_tstrlen(szNewName)) {
- MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
- SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME));
- break;
- }
- }
- if ((iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETCURSEL, 0, 0)) != LB_ERR) {
- SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
- if (!_tcsncmp(szName, _T("default"), CONTAINER_NAMELEN) || !_tcsncmp(szName, TranslateT("Default container"), CONTAINER_NAMELEN))
- MessageBox(hwndDlg, TranslateT("You cannot rename the default container"), TranslateT("Error"), MB_OK | MB_ICONERROR);
- else {
- int iIndex = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETITEMDATA, (WPARAM)iItem, 0);
- RenameContainer(iIndex, szNewName);
- SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_RESETCONTENT, 0, 0);
- for (TContainerData *p = pFirstContainer; p; p = p->pNext) {
- if (!_tcsncmp(p->szName, szName, CONTAINER_NAMELEN) && mir_tstrlen(p->szName) == mir_tstrlen(szName)) {
- _tcsncpy(p->szName, szNewName, CONTAINER_NAMELEN);
- SendMessage(p->hwnd, DM_CONFIGURECONTAINER, 0, 0);
- }
- }
- SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, 0);
- BuildContainerMenu();
- }
- }
+ int iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)szNewName);
+ if (iItem != LB_ERR) {
+ TCHAR szOldName[CONTAINER_NAMELEN + 1];
+ SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szOldName);
+ if (mir_tstrlen(szOldName) == mir_tstrlen(szNewName)) {
+ MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
+ SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME));
+ break;
}
- break;
}
- case IDC_CREATENEW: {
- TCHAR szNewName[CONTAINER_NAMELEN], szName[CONTAINER_NAMELEN + 1];
-
- int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
- if (iLen) {
- GetDlgItemText(hwndDlg, IDC_NEWCONTAINER, szNewName, SIZEOF(szNewName));
- int iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)- 1, (LPARAM)szNewName);
- if (iItem != LB_ERR || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
- SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
- if (mir_tstrlen(szName) == mir_tstrlen(szNewName) || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
- MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
- SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
- break;
+ if ((iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETCURSEL, 0, 0)) != LB_ERR) {
+ SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
+ if (!_tcsncmp(szName, _T("default"), CONTAINER_NAMELEN) || !_tcsncmp(szName, TranslateT("Default container"), CONTAINER_NAMELEN))
+ MessageBox(hwndDlg, TranslateT("You cannot rename the default container"), TranslateT("Error"), MB_OK | MB_ICONERROR);
+ else {
+ int iIndex = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETITEMDATA, (WPARAM)iItem, 0);
+ RenameContainer(iIndex, szNewName);
+ SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_RESETCONTENT, 0, 0);
+ for (TContainerData *p = pFirstContainer; p; p = p->pNext) {
+ if (!_tcsncmp(p->szName, szName, CONTAINER_NAMELEN) && mir_tstrlen(p->szName) == mir_tstrlen(szName)) {
+ _tcsncpy(p->szName, szNewName, CONTAINER_NAMELEN);
+ SendMessage(p->hwnd, DM_CONFIGURECONTAINER, 0, 0);
}
}
- if (IsWindow(hwndMsgDlg)) {
- SendMessage(hwndMsgDlg, DM_CONTAINERSELECTED, 0, (LPARAM)szNewName);
- if (IsWindow(hwndDlg))
- DestroyWindow(hwndDlg);
- }
+ SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, 0);
+ BuildContainerMenu();
}
- break;
}
- case IDC_CNTLIST:
- if (HIWORD(wParam) == LBN_DBLCLK)
- SendMessage(hwndDlg, WM_COMMAND, IDOK, 0);
- break;
}
break;
- /*
- * fill the list box...
- */
- case DM_SC_BUILDLIST: {
- DBVARIANT dbv;
- int iCounter = 0, iItemNew;
- char *szKey = "TAB_ContainersW";
- char szValue[10];
- TContainerData *pContainer = 0;
- do {
- mir_snprintf(szValue, SIZEOF(szValue), "%d", iCounter);
- if (db_get_ts(NULL, szKey, szValue, &dbv))
- break; // end of list
- if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
- if (_tcsncmp(dbv.ptszVal, _T("**mir_free**"), CONTAINER_NAMELEN)) {
- iItemNew = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_ADDSTRING, 0, (LPARAM)(!_tcscmp(dbv.ptszVal, _T("default")) ?
- TranslateT("Default container") : dbv.ptszVal));
- if (iItemNew != LB_ERR)
- SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_SETITEMDATA, (WPARAM)iItemNew, (LPARAM)iCounter);
+ }
+ case IDC_CREATENEW: {
+ TCHAR szNewName[CONTAINER_NAMELEN], szName[CONTAINER_NAMELEN + 1];
+
+ int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
+ if (iLen) {
+ GetDlgItemText(hwndDlg, IDC_NEWCONTAINER, szNewName, SIZEOF(szNewName));
+ int iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)szNewName);
+ if (iItem != LB_ERR || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
+ SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
+ if (mir_tstrlen(szName) == mir_tstrlen(szNewName) || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
+ MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
+ SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
+ break;
}
- db_free(&dbv);
}
- } while (++iCounter);
+ if (IsWindow(hwndMsgDlg)) {
+ SendMessage(hwndMsgDlg, DM_CONTAINERSELECTED, 0, (LPARAM)szNewName);
+ if (IsWindow(hwndDlg))
+ DestroyWindow(hwndDlg);
+ }
+ }
+ break;
+ }
+ case IDC_CNTLIST:
+ if (HIWORD(wParam) == LBN_DBLCLK)
+ SendMessage(hwndDlg, WM_COMMAND, IDOK, 0);
+ break;
+ }
+ break;
+ /*
+ * fill the list box...
+ */
+ case DM_SC_BUILDLIST: {
+ DBVARIANT dbv;
+ int iCounter = 0, iItemNew;
+ char *szKey = "TAB_ContainersW";
+ char szValue[10];
+ TContainerData *pContainer = 0;
+ do {
+ mir_snprintf(szValue, SIZEOF(szValue), "%d", iCounter);
+ if (db_get_ts(NULL, szKey, szValue, &dbv))
+ break; // end of list
+ if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
+ if (_tcsncmp(dbv.ptszVal, _T("**mir_free**"), CONTAINER_NAMELEN)) {
+ iItemNew = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_ADDSTRING, 0, (LPARAM)(!_tcscmp(dbv.ptszVal, _T("default")) ?
+ TranslateT("Default container") : dbv.ptszVal));
+ if (iItemNew != LB_ERR)
+ SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_SETITEMDATA, (WPARAM)iItemNew, (LPARAM)iCounter);
+ }
+ db_free(&dbv);
+ }
+ } while (++iCounter);
- /*
- * highlight the name of the container to which the message window currently is assigned
- */
+ /*
+ * highlight the name of the container to which the message window currently is assigned
+ */
- SendMessage(hwndMsgDlg, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
- if (pContainer) {
- LRESULT iItem;
+ SendMessage(hwndMsgDlg, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
+ if (pContainer) {
+ LRESULT iItem;
- iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)- 1, (LPARAM)(!_tcscmp(pContainer->szName, _T("default")) ?
- TranslateT("Default container") : pContainer->szName));
- if (iItem != LB_ERR)
- SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_SETCURSEL, (WPARAM)iItem, 0);
- }
+ iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)(!_tcscmp(pContainer->szName, _T("default")) ?
+ TranslateT("Default container") : pContainer->szName));
+ if (iItem != LB_ERR)
+ SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_SETCURSEL, (WPARAM)iItem, 0);
}
- break;
+ }
+ break;
}
return FALSE;
}
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index d13df65bc4..ca88da7714 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -125,13 +125,13 @@ CSendLaterJob::~CSendLaterJob()
if (PluginConfig.g_bPopupAvail && fShowPopup) {
TCHAR *tszName = pcli->pfnGetContactDisplayName(hContact, 0);
- POPUPDATAT ppd = {0};
+ POPUPDATAT ppd = { 0 };
ppd.lchContact = hContact;
_tcsncpy_s(ppd.lptzContactName, (tszName ? tszName : TranslateT("'(Unknown contact)'")), _TRUNCATE);
TCHAR *msgPreview = Utils::GetPreviewWithEllipsis(reinterpret_cast<TCHAR *>(&pBuf[mir_strlen((char *)pBuf) + 1]), 100);
if (fSuccess) {
mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), TranslateT("A send later job completed successfully.\nThe original message: %s"),
- msgPreview);
+ msgPreview);
mir_free(msgPreview);
}
else if (fFailed) {
@@ -159,9 +159,9 @@ CSendLaterJob::~CSendLaterJob()
}
CSendLater::CSendLater() :
- m_sendLaterContactList(5, PtrKeySortT),
- m_sendLaterJobList(5),
- m_currJob(-1)
+m_sendLaterContactList(5, PtrKeySortT),
+m_sendLaterJobList(5),
+m_currJob(-1)
{
m_fAvail = M.GetByte("sendLaterAvail", 0) != 0;
m_last_sendlater_processed = time(0);
@@ -183,7 +183,7 @@ CSendLater::~CSendLater()
if (m_sendLaterJobList.getCount() == 0)
return;
- for (int i=0; i < m_sendLaterJobList.getCount(); i++) {
+ for (int i = 0; i < m_sendLaterJobList.getCount(); i++) {
CSendLaterJob *p = m_sendLaterJobList[i];
mir_free(p->sendBuffer);
mir_free(p->pBuf);
@@ -257,7 +257,7 @@ void CSendLater::processSingleContact(const MCONTACT hContact)
int iCount = db_get_dw(hContact, "SendLater", "count", 0);
if (iCount) {
- DBCONTACTENUMSETTINGS ces = {0};
+ DBCONTACTENUMSETTINGS ces = { 0 };
ces.pfnEnumProc = CSendLater::addStub;
ces.szModule = "SendLater";
ces.lParam = hContact;
@@ -272,7 +272,7 @@ void CSendLater::processSingleContact(const MCONTACT hContact)
void CSendLater::processContacts()
{
if (m_fAvail && m_sendLaterContactList.getCount() != 0) {
- for (int i=0; i < m_sendLaterContactList.getCount(); i++)
+ for (int i = 0; i < m_sendLaterContactList.getCount(); i++)
processSingleContact((MCONTACT)m_sendLaterContactList[i]);
m_sendLaterContactList.destroy();
@@ -292,7 +292,7 @@ void CSendLater::processContacts()
int CSendLater::addJob(const char *szSetting, LPARAM lParam)
{
MCONTACT hContact = lParam;
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
char *szOrig_Utf = 0;
if (!m_fAvail || !szSetting || !strcmp(szSetting, "count") || mir_strlen(szSetting) < 8)
@@ -302,7 +302,7 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam)
return 0;
// check for possible dupes
- for (int i=0; i < m_sendLaterJobList.getCount(); i++) {
+ for (int i = 0; i < m_sendLaterJobList.getCount(); i++) {
CSendLaterJob *p = m_sendLaterJobList[i];
if (p->hContact == hContact && !strcmp(p->szId, szSetting))
return 0;
@@ -462,7 +462,7 @@ HANDLE CSendLater::processAck(const ACKDATA *ack)
if (m_sendLaterJobList.getCount() == 0 || !m_fAvail)
return 0;
- for (int i=0; i < m_sendLaterJobList.getCount(); i++) {
+ for (int i = 0; i < m_sendLaterJobList.getCount(); i++) {
CSendLaterJob *p = m_sendLaterJobList[i];
if (p->hProcess == ack->hProcess && p->hTargetContact == ack->hContact && !(p->fSuccess || p->fFailed)) {
if (!p->fSuccess) {
@@ -524,7 +524,7 @@ void CSendLater::qMgrFillList(bool fClear)
m_sel = 0;
::SendMessage(m_hwndFilter, CB_INSERTSTRING, -1,
- LPARAM(TranslateT("<All contacts>")));
+ LPARAM(TranslateT("<All contacts>")));
::SendMessage(m_hwndFilter, CB_SETITEMDATA, 0, 0);
LVITEM lvItem = { 0 };
@@ -541,7 +541,7 @@ void CSendLater::qMgrFillList(bool fClear)
continue;
}
- lvItem.mask = LVIF_TEXT|LVIF_PARAM;
+ lvItem.mask = LVIF_TEXT | LVIF_PARAM;
TCHAR tszBuf[255];
mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s [%s]"), tszNick, c->getRealAccount());
lvItem.pszText = tszBuf;
@@ -576,7 +576,7 @@ void CSendLater::qMgrFillList(bool fClear)
else if (p->fSuccess)
tszStatusText = TranslateT("Sent OK");
else {
- switch(p->bCode) {
+ switch (p->bCode) {
case CSendLaterJob::JOB_DEFERRED:
tszStatusText = TranslateT("Deferred");
break;
@@ -628,9 +628,9 @@ static char* szColDefault = "100;120;80;120;120";
void CSendLater::qMgrSetupColumns()
{
- LVCOLUMN col = {0};
+ LVCOLUMN col = { 0 };
int nWidths[QMGR_LIST_NRCOLUMNS];
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
RECT rcList;
LONG cxList;
@@ -644,7 +644,7 @@ void CSendLater::qMgrSetupColumns()
else
sscanf(szColDefault, szColFormat, &nWidths[0], &nWidths[1], &nWidths[2], &nWidths[3], &nWidths[4]);
- col.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM;
+ col.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
col.cx = max(nWidths[0], 10);
col.pszText = TranslateT("Contact");
@@ -674,10 +674,10 @@ void CSendLater::qMgrSaveColumns()
{
char szColFormatNew[100];
int nWidths[QMGR_LIST_NRCOLUMNS], i;
- LVCOLUMN col = {0};
+ LVCOLUMN col = { 0 };
col.mask = LVCF_WIDTH;
- for (i=0; i < QMGR_LIST_NRCOLUMNS; i++) {
+ for (i = 0; i < QMGR_LIST_NRCOLUMNS; i++) {
::SendMessage(m_hwndList, LVM_GETCOLUMN, i, LPARAM(&col));
nWidths[i] = max(col.cx, 10);
}
@@ -701,7 +701,7 @@ INT_PTR CALLBACK CSendLater::DlgProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPA
INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
m_hwndDlg = hwnd;
TranslateDialogDefault(hwnd);
@@ -710,7 +710,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
m_hFilter = db_get_dw(0, SRMSGMOD_T, "qmgrFilterContact", 0);
::SetWindowLongPtr(m_hwndList, GWL_STYLE, ::GetWindowLongPtr(m_hwndList, GWL_STYLE) | LVS_SHOWSELALWAYS);
- ::SendMessage(m_hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_LABELTIP|LVS_EX_DOUBLEBUFFER);
+ ::SendMessage(m_hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_LABELTIP | LVS_EX_DOUBLEBUFFER);
qMgrSetupColumns();
qMgrFillList();
if (PluginConfig.g_bPopupAvail) {
@@ -726,7 +726,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case WM_NOTIFY:
if (((LPNMHDR)lParam)->hwndFrom == m_hwndList) {
- switch(((LPNMHDR)lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case NM_RCLICK:
HMENU hMenu = ::LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_TABCONTEXT));
HMENU hSubMenu = ::GetSubMenu(hMenu, 13);
@@ -742,7 +742,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
m_fIsInteractive = true;
int selection = ::TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwndDlg, NULL);
if (selection == ID_QUEUEMANAGER_CANCELALLMULTISENDJOBS) {
- for (int i=0; i < m_sendLaterJobList.getCount(); i++) {
+ for (int i = 0; i < m_sendLaterJobList.getCount(); i++) {
CSendLaterJob *p = m_sendLaterJobList[i];
if (p->szId[0] == 'M') {
p->fFailed = true;
@@ -770,7 +770,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
}
break;
}
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
qMgrSaveColumns();
@@ -791,14 +791,14 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
CallService(MS_UTILS_OPENURL, 0, LPARAM("http://wiki.miranda.or.at/TabSRMM/SendLater"));
break;
- // this handles all commands sent by the context menu
- // mark jobs for removal/reset/hold/unhold
- // exception: kill all open multisend jobs is directly handled from the context menu
+ // this handles all commands sent by the context menu
+ // mark jobs for removal/reset/hold/unhold
+ // exception: kill all open multisend jobs is directly handled from the context menu
case IDC_QMGR_REMOVE:
if (::SendMessage(m_hwndList, LVM_GETSELECTEDCOUNT, 0, 0) != 0) {
- LVITEM item = {0};
+ LVITEM item = { 0 };
LRESULT items = ::SendMessage(m_hwndList, LVM_GETITEMCOUNT, 0, 0);
- item.mask = LVIF_STATE|LVIF_PARAM;
+ item.mask = LVIF_STATE | LVIF_PARAM;
item.stateMask = LVIS_SELECTED;
if (HIWORD(wParam) != ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD) {
diff --git a/plugins/TabSRMM/src/sendlater.h b/plugins/TabSRMM/src/sendlater.h
index 7485979f1f..8d545bfcaa 100644
--- a/plugins/TabSRMM/src/sendlater.h
+++ b/plugins/TabSRMM/src/sendlater.h
@@ -90,56 +90,56 @@ public:
};
CSendLater();
- ~CSendLater();
- bool isAvail() const { return(m_fAvail); }
- bool isInteractive() const { return(m_fIsInteractive); }
- bool isJobListEmpty() const { return(m_sendLaterJobList.getCount() == 0); }
- bool haveErrorPopups() const { return(m_fErrorPopups); }
- bool haveSuccessPopups() const { return(m_fSuccessPopups); }
- void startJobListProcess();
- time_t lastProcessed() const { return(m_last_sendlater_processed); }
- void setLastProcessed(const time_t _t) { m_last_sendlater_processed = _t; }
- void flushQueue() { m_last_sendlater_processed = 0; }
- bool haveJobs() const { return (m_sendLaterJobList.getCount() != 0 && m_currJob != -1); }
-
- static int _cdecl addStub(const char *szSetting, LPARAM lParam);
+ ~CSendLater();
+ bool isAvail() const { return(m_fAvail); }
+ bool isInteractive() const { return(m_fIsInteractive); }
+ bool isJobListEmpty() const { return(m_sendLaterJobList.getCount() == 0); }
+ bool haveErrorPopups() const { return(m_fErrorPopups); }
+ bool haveSuccessPopups() const { return(m_fSuccessPopups); }
+ void startJobListProcess();
+ time_t lastProcessed() const { return(m_last_sendlater_processed); }
+ void setLastProcessed(const time_t _t) { m_last_sendlater_processed = _t; }
+ void flushQueue() { m_last_sendlater_processed = 0; }
+ bool haveJobs() const { return (m_sendLaterJobList.getCount() != 0 && m_currJob != -1); }
+
+ static int _cdecl addStub(const char *szSetting, LPARAM lParam);
bool processCurrentJob();
- void processContacts();
- int addJob(const char *szSetting, LPARAM lParam);
- void addContact(const MCONTACT hContact);
- HANDLE processAck(const ACKDATA *ack);
+ void processContacts();
+ int addJob(const char *szSetting, LPARAM lParam);
+ void addContact(const MCONTACT hContact);
+ HANDLE processAck(const ACKDATA *ack);
- void invokeQueueMgrDlg();
- void qMgrUpdate(bool fReEnable = false);
- static INT_PTR svcQMgr(WPARAM wParam, LPARAM lParam);
+ void invokeQueueMgrDlg();
+ void qMgrUpdate(bool fReEnable = false);
+ static INT_PTR svcQMgr(WPARAM wParam, LPARAM lParam);
private:
- void processSingleContact(const MCONTACT hContact);
- int sendIt(CSendLaterJob *job);
+ void processSingleContact(const MCONTACT hContact);
+ int sendIt(CSendLaterJob *job);
- INT_PTR CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK DlgProcStub(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ INT_PTR CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK DlgProcStub(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
void qMgrFillList(bool fClear = true);
- void qMgrSetupColumns();
- void qMgrSaveColumns();
- LRESULT qMgrAddFilter(const MCONTACT hContact, const TCHAR* tszNick);
+ void qMgrSetupColumns();
+ void qMgrSaveColumns();
+ LRESULT qMgrAddFilter(const MCONTACT hContact, const TCHAR* tszNick);
- LIST<void> m_sendLaterContactList;
- LIST<CSendLaterJob> m_sendLaterJobList;
+ LIST<void> m_sendLaterContactList;
+ LIST<CSendLaterJob> m_sendLaterJobList;
bool m_fAvail;
- bool m_fIsInteractive;
- bool m_fErrorPopups;
- bool m_fSuccessPopups;
- time_t m_last_sendlater_processed;
- int m_currJob;
-
- HWND m_hwndDlg;
- HWND m_hwndList, m_hwndFilter;
- MCONTACT m_hFilter; // contact handle to filter the qmgr list (0 = no filter, show all)
- LRESULT m_sel; // index of the combo box entry corresponding to the contact filter;
+ bool m_fIsInteractive;
+ bool m_fErrorPopups;
+ bool m_fSuccessPopups;
+ time_t m_last_sendlater_processed;
+ int m_currJob;
+
+ HWND m_hwndDlg;
+ HWND m_hwndList, m_hwndFilter;
+ MCONTACT m_hFilter; // contact handle to filter the qmgr list (0 = no filter, show all)
+ LRESULT m_sel; // index of the combo box entry corresponding to the contact filter;
};
extern CSendLater* sendLater;
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index c4a6da240b..a7169c8485 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -38,7 +38,7 @@ SendQueue *sendQueue = 0;
int SendQueue::findNextFailed(const TWindowData *dat) const
{
if (dat)
- for (int i=0; i < NR_SENDJOBS; i++)
+ for (int i = 0; i < NR_SENDJOBS; i++)
if (m_jobs[i].hContact == dat->hContact && m_jobs[i].iStatus == SQ_ERROR)
return i;
@@ -74,7 +74,7 @@ int SendQueue::addTo(TWindowData *dat, size_t iLen, int dwFlags)
}
// find a mir_free entry in the send queue...
- for (i=0; i < NR_SENDJOBS; i++) {
+ for (i = 0; i < NR_SENDJOBS; i++) {
if (m_jobs[i].hContact != 0 || m_jobs[i].iStatus != 0) {
// this entry is used, check if it's orphaned and can be removed...
if (m_jobs[i].hOwnerWnd && IsWindow(m_jobs[i].hOwnerWnd)) // window exists, do not reuse it
@@ -128,7 +128,7 @@ static int SendChunkW(WCHAR *chunk, MCONTACT hContact, DWORD dwFlags)
ptrA pBuf((char*)mir_alloc(memRequired));
WideCharToMultiByte(codePage, 0, chunk, -1, pBuf, mbcsSize, 0, 0);
- memcpy(&pBuf[mbcsSize], chunk, (wLen+1) * sizeof(WCHAR));
+ memcpy(&pBuf[mbcsSize], chunk, (wLen + 1) * sizeof(WCHAR));
return CallContactService(hContact, PSS_MESSAGE, dwFlags, (LPARAM)pBuf);
}
@@ -149,7 +149,7 @@ static void DoSplitSendW(LPVOID param)
size_t chunkSize = job->chunkSize / 2;
size_t iLen = mir_strlen(job->szSendBuffer);
- WCHAR *wszBegin = (WCHAR*) & job->szSendBuffer[iLen + 1];
+ WCHAR *wszBegin = (WCHAR*)& job->szSendBuffer[iLen + 1];
WCHAR *wszTemp = (WCHAR*)mir_alloc(sizeof(WCHAR) * (mir_wstrlen(wszBegin) + 1));
memcpy(wszTemp, wszBegin, sizeof(WCHAR) * (mir_wstrlen(wszBegin) + 1));
wszBegin = wszTemp;
@@ -202,8 +202,7 @@ static void DoSplitSendW(LPVOID param)
}
}
Sleep(500L);
- }
- while (fSplitting);
+ } while (fSplitting);
mir_free(wszBegin);
}
@@ -270,8 +269,7 @@ static void DoSplitSendA(LPVOID param)
}
}
Sleep(500L);
- }
- while (fSplitting);
+ } while (fSplitting);
mir_free(szBegin);
}
@@ -377,7 +375,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
m_jobs[iEntry].dwFlags = dwOldFlags;
}
else {
-send_unsplitted:
+ send_unsplitted:
m_jobs[iEntry].hContact = ccActive->getActiveContact();
m_jobs[iEntry].hOwnerWnd = hwndDlg;
m_jobs[iEntry].iStatus = SQ_INPROGRESS;
@@ -400,7 +398,7 @@ send_unsplitted:
(dat->sendMode & SMODE_FORCEANSI) ? (m_jobs[iEntry].dwFlags & ~PREF_UNICODE) : m_jobs[iEntry].dwFlags, (LPARAM)m_jobs[iEntry].szSendBuffer);
if (dat->sendMode & SMODE_NOACK) { // fake the ack if we are not interested in receiving real acks
- ACKDATA ack = {0};
+ ACKDATA ack = { 0 };
ack.hContact = dat->hContact;
ack.hProcess = m_jobs[iEntry].hSendId;
ack.type = ACKTYPE_MESSAGE;
@@ -508,12 +506,12 @@ void SendQueue::EnableSending(const TWindowData *dat, const int iMode)
void SendQueue::showErrorControls(TWindowData *dat, const int showCmd) const
{
- UINT myerrorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER};
+ UINT myerrorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER };
int i;
HWND hwndDlg = dat->hwnd;
if (showCmd) {
- TCITEM item = {0};
+ TCITEM item = { 0 };
dat->hTabIcon = PluginConfig.g_iconErr;
item.mask = TCIF_IMAGE;
item.iImage = 0;
@@ -525,7 +523,7 @@ void SendQueue::showErrorControls(TWindowData *dat, const int showCmd) const
dat->hTabIcon = dat->hTabStatusIcon;
}
- for (i=0; i < 5; i++) {
+ for (i = 0; i < 5; i++) {
if (IsWindow(GetDlgItem(hwndDlg, myerrorControls[i])))
Utils::showDlgControl(hwndDlg, myerrorControls[i], showCmd ? SW_SHOW : SW_HIDE);
}
@@ -540,14 +538,14 @@ void SendQueue::recallFailed(const TWindowData *dat, int iEntry) const
{
if (dat == NULL)
return;
-
+
int iLen = GetWindowTextLength(GetDlgItem(dat->hwnd, IDC_MESSAGE));
NotifyDeliveryFailure(dat);
if (iLen != 0)
return;
-
+
// message area is empty, so we can recall the failed message...
- SETTEXTEX stx = {ST_DEFAULT, 1200};
+ SETTEXTEX stx = { ST_DEFAULT, 1200 };
if (m_jobs[iEntry].dwFlags & PREF_UNICODE)
SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)&m_jobs[iEntry].szSendBuffer[mir_strlen(m_jobs[iEntry].szSendBuffer) + 1]);
else {
@@ -555,7 +553,7 @@ void SendQueue::recallFailed(const TWindowData *dat, int iEntry) const
SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_jobs[iEntry].szSendBuffer);
}
UpdateSaveAndSendButton(const_cast<TWindowData *>(dat));
- SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETSEL, (WPARAM)- 1, (LPARAM)- 1);
+ SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETSEL, (WPARAM)-1, (LPARAM)-1);
}
void SendQueue::UpdateSaveAndSendButton(TWindowData *dat)
@@ -563,7 +561,7 @@ void SendQueue::UpdateSaveAndSendButton(TWindowData *dat)
if (dat) {
HWND hwndDlg = dat->hwnd;
- GETTEXTLENGTHEX gtxl = {0};
+ GETTEXTLENGTHEX gtxl = { 0 };
gtxl.codepage = CP_UTF8;
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
@@ -594,7 +592,7 @@ void SendQueue::NotifyDeliveryFailure(const TWindowData *dat)
if (M.GetByte("adv_noErrorPopups", 0))
return;
- if ( CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) != 1)
+ if (CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) != 1)
return;
POPUPDATAT ppd = { 0 };
@@ -629,7 +627,7 @@ int SendQueue::RTL_Detect(const WCHAR *pszwText)
GetStringTypeW(CT_CTYPE2, pszwText, (int)iLen, infoTypeC2);
- for (i=0; i < iLen; i++)
+ for (i = 0; i < iLen; i++)
if (infoTypeC2[i] == C2_RIGHTTOLEFT)
n++;
@@ -639,7 +637,7 @@ int SendQueue::RTL_Detect(const WCHAR *pszwText)
int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam)
{
- ACKDATA *ack = (ACKDATA *) lParam;
+ ACKDATA *ack = (ACKDATA *)lParam;
TContainerData *m_pContainer = 0;
if (dat)
@@ -679,7 +677,7 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam)
return 0;
}
-inform_and_discard:
+ inform_and_discard:
_DebugPopup(job.hContact, TranslateT("A message delivery has failed after the contacts chat window was closed. You may want to resend the last message"));
clearJob(iFound);
return 0;
diff --git a/plugins/TabSRMM/src/sendqueue.h b/plugins/TabSRMM/src/sendqueue.h
index 2944c7c4cd..1cfab48128 100644
--- a/plugins/TabSRMM/src/sendqueue.h
+++ b/plugins/TabSRMM/src/sendqueue.h
@@ -61,11 +61,11 @@ struct SendJob
class SendQueue {
public:
enum {
- NR_SENDJOBS = 30,
- SQ_ERROR = 2,
- SQ_INPROGRESS = 1,
- SQ_UNDEFINED = 0
- };
+ NR_SENDJOBS = 30,
+ SQ_ERROR = 2,
+ SQ_INPROGRESS = 1,
+ SQ_UNDEFINED = 0
+ };
SendQueue()
{
@@ -78,7 +78,7 @@ public:
~SendQueue()
{
- for (int i=0; i < NR_SENDJOBS; i++)
+ for (int i = 0; i < NR_SENDJOBS; i++)
mir_free(m_jobs[i].szSendBuffer);
}
@@ -113,8 +113,8 @@ private:
extern SendQueue *sendQueue;
-int TSAPI ActivateExistingTab (TContainerData *pContainer, HWND hwndChild);
-void TSAPI ShowMultipleControls (const HWND hwndDlg, const UINT * controls, int cControls, int state);
-void TSAPI HandleIconFeedback (TWindowData *dat, HICON iIcon);
+int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild);
+void TSAPI ShowMultipleControls(const HWND hwndDlg, const UINT * controls, int cControls, int state);
+void TSAPI HandleIconFeedback(TWindowData *dat, HICON iIcon);
#endif /* __SENDQUEUE_H */
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp
index 1f0b809d51..6ac9628f17 100644
--- a/plugins/TabSRMM/src/sidebar.cpp
+++ b/plugins/TabSRMM/src/sidebar.cpp
@@ -97,12 +97,12 @@ void CSideBarButton::_create()
m_sz.cx = m_sz.cy = 0;
m_hwnd = ::CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
- 0, 0, 40, 40, m_sideBar->getScrollWnd(), reinterpret_cast<HMENU>(m_id), g_hInst, NULL);
+ 0, 0, 40, 40, m_sideBar->getScrollWnd(), reinterpret_cast<HMENU>(m_id), g_hInst, NULL);
if (m_hwnd) {
CustomizeButton(m_hwnd);
::SendMessage(m_hwnd, BUTTONSETASSIDEBARBUTTON, (WPARAM)this, 0);
- ::SendMessage(m_hwnd, BUTTONSETASFLATBTN, FALSE, 0);
- ::SendMessage(m_hwnd, BUTTONSETASTHEMEDBTN, TRUE, 0);
+ ::SendMessage(m_hwnd, BUTTONSETASFLATBTN, FALSE, 0);
+ ::SendMessage(m_hwnd, BUTTONSETASTHEMEDBTN, TRUE, 0);
::SendMessage(m_hwnd, BUTTONSETCONTAINER, (LPARAM)m_sideBar->getContainer(), 0);
m_buttonControl = (TSButtonCtrl *)::GetWindowLongPtr(m_hwnd, 0);
if (m_id == IDC_SIDEBARUP || m_id == IDC_SIDEBARDOWN)
@@ -132,7 +132,7 @@ void CSideBarButton::Show(const int showCmd) const
* m_elementWidth and m_elementHeight will be used.
*
* @return SIZE&: reference to the item's size member. The caller may use cx and cy values
- * to determine further layouting actions.
+ * to determine further layouting actions.
*/
const SIZE& CSideBarButton::measureItem()
{
@@ -193,7 +193,7 @@ void CSideBarButton::RenderThis(const HDC hdc) const
HDC hdcMem = ::CreateCompatibleDC(hdc);
if (fVertical) {
- RECT rcFlipped = {0,0,cx,cy};
+ RECT rcFlipped = { 0, 0, cx, cy };
hbmMem = CSkin::CreateAeroCompatibleBitmap(rcFlipped, hdcMem);
rc = rcFlipped;
}
@@ -222,7 +222,7 @@ void CSideBarButton::RenderThis(const HDC hdc) const
::DeleteObject(hbmMem);
hbmMem = FIF->FI_CreateHBITMAPFromDIB(fib_new);
FIF->FI_Unload(fib_new);
- hbmOld =reinterpret_cast<HBITMAP>(::SelectObject(hdcMem, hbmMem));
+ hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(hdcMem, hbmMem));
::BitBlt(hdc, 0, 0, cy, cx, hdcMem, 0, 0, SRCCOPY);
::SelectObject(hdcMem, hbmOld);
::DeleteObject(hbmMem);
@@ -347,7 +347,7 @@ void CSideBarButton::invokeContextMenu()
const TContainerData *pContainer = m_sideBar->getContainer();
if (pContainer) {
- TSideBarNotify tsn = {0};
+ TSideBarNotify tsn = { 0 };
tsn.nmHdr.code = NM_RCLICK;
tsn.nmHdr.idFrom = 5000;
tsn.nmHdr.hwndFrom = ::GetDlgItem(pContainer->hwnd, 5000);
@@ -357,7 +357,7 @@ void CSideBarButton::invokeContextMenu()
}
CSideBar::CSideBar(TContainerData *pContainer) :
- m_buttonlist(1, PtrKeySortT)
+m_buttonlist(1, PtrKeySortT)
{
m_pContainer = pContainer;
m_up = m_down = 0;
@@ -395,8 +395,8 @@ void CSideBar::Init()
if (m_pContainer->dwFlags & CNT_SIDEBAR) {
if (m_hwndScrollWnd == 0)
- m_hwndScrollWnd = ::CreateWindowEx(0, _T("TS_SideBarClass"), _T(""), WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | WS_CHILD,
- 0, 0, m_width, 40, m_pContainer->hwnd, reinterpret_cast<HMENU>(5000), g_hInst, this);
+ m_hwndScrollWnd = ::CreateWindowEx(0, _T("TS_SideBarClass"), _T(""), WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | WS_CHILD,
+ 0, 0, m_width, 40, m_pContainer->hwnd, reinterpret_cast<HMENU>(5000), g_hInst, this);
m_isActive = true;
m_isVisible = m_isActive ? m_isVisible : true;
@@ -501,12 +501,12 @@ void CSideBar::populateAll()
int iItems = (int)TabCtrl_GetItemCount(hwndTab);
- TCITEM item = {0};
+ TCITEM item = { 0 };
item.mask = TCIF_PARAM;
m_iTopButtons = 0;
- for (int i=0; i < iItems; i++) {
+ for (int i = 0; i < iItems; i++) {
TabCtrl_GetItem(hwndTab, i, &item);
if (item.lParam == 0 || !IsWindow((HWND)item.lParam))
continue;
@@ -533,8 +533,8 @@ void CSideBar::populateAll()
* Add a new session to the switchbar.
*
* @param dat _MessageWindowData *: session data for a client session. Must be fully initialized
- * (that is, it can only be used after WM_INITIALOG completed).
- *position: -1 = append, otherwise insert it at the given position
+ * (that is, it can only be used after WM_INITIALOG completed).
+ *position: -1 = append, otherwise insert it at the given position
*/
void CSideBar::addSession(const TWindowData *dat, int position)
{
@@ -559,7 +559,7 @@ void CSideBar::addSession(const TWindowData *dat, int position)
m_buttonlist.insert(item, position);
SendDlgItemMessage(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_TOGGLESIDEBAR : IDC_CHAT_TOGGLESIDEBAR, BM_SETIMAGE, IMAGE_ICON,
- (LPARAM)(m_dwFlags & SIDEBARORIENTATION_LEFT ? PluginConfig.g_buttonBarIcons[ICON_DEFAULT_LEFT] : PluginConfig.g_buttonBarIcons[ICON_DEFAULT_RIGHT]));
+ (LPARAM)(m_dwFlags & SIDEBARORIENTATION_LEFT ? PluginConfig.g_buttonBarIcons[ICON_DEFAULT_LEFT] : PluginConfig.g_buttonBarIcons[ICON_DEFAULT_RIGHT]));
Invalidate();
}
@@ -607,7 +607,7 @@ void CSideBar::scrollIntoView(const CSideBarButton *item)
item = m_activeItem;
int i;
- for (i=0; i < m_buttonlist.getCount(); i++) {
+ for (i = 0; i < m_buttonlist.getCount(); i++) {
CSideBarButton &p = m_buttonlist[i];
itemHeight = p.getHeight();
spaceUsed += (itemHeight + 1);
@@ -704,9 +704,9 @@ const CSideBarButton* CSideBar::setActiveItem(const TWindowData *dat)
* @param rc RECT*:the window rectangle
*
* @param fOnlyCalc bool: if false (default), window positions will be updated, otherwise,
- * the method will only calculate the layout parameters. A final call to
- * Layout() with the parameter set to false is required to perform the
- * position update.
+ * the method will only calculate the layout parameters. A final call to
+ * Layout() with the parameter set to false is required to perform the
+ * position update.
*/
void CSideBar::Layout(const RECT *rc, bool fOnlyCalc)
{
@@ -728,7 +728,7 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc)
BOOL topEnabled = FALSE, bottomEnabled = FALSE;
HWND hwnd;
LONG spaceUsed = 0;
- DWORD dwFlags = SWP_NOZORDER|SWP_NOACTIVATE;
+ DWORD dwFlags = SWP_NOZORDER | SWP_NOACTIVATE;
LONG iSpaceAvail = rc->bottom;
m_firstVisibleOffset = max(0, m_firstVisibleOffset);
@@ -737,7 +737,7 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc)
LONG height = m_elementHeight;
- for (int i=0; i < m_buttonlist.getCount(); i++) {
+ for (int i = 0; i < m_buttonlist.getCount(); i++) {
CSideBarButton &p = m_buttonlist[i];
hwnd = p.getHwnd();
@@ -754,7 +754,7 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc)
if (m_totalItemHeight <= m_firstVisibleOffset) { // partially visible
if (!fOnlyCalc)
hdwp = ::DeferWindowPos(hdwp, hwnd, 0, 2, -(m_firstVisibleOffset - m_totalItemHeight),
- m_elementWidth, height, SWP_SHOWWINDOW | dwFlags);
+ m_elementWidth, height, SWP_SHOWWINDOW | dwFlags);
spaceUsed += ((height + 1) - (m_firstVisibleOffset - m_totalItemHeight));
m_totalItemHeight += (height + 1);
}
@@ -775,12 +775,12 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc)
::GetClientRect(m_pContainer->hwnd, &rcContainer);
LONG dx = m_dwFlags & SIDEBARORIENTATION_LEFT ? m_pContainer->tBorder_outer_left :
- rcContainer.right - m_pContainer->tBorder_outer_right - (m_elementWidth + 4);
+ rcContainer.right - m_pContainer->tBorder_outer_right - (m_elementWidth + 4);
::SetWindowPos(m_up->getHwnd(), 0, dx, m_pContainer->tBorder_outer_top + m_pContainer->MenuBar->getHeight(),
- m_elementWidth + 4, 14, dwFlags | SWP_SHOWWINDOW);
+ m_elementWidth + 4, 14, dwFlags | SWP_SHOWWINDOW);
::SetWindowPos(m_down->getHwnd(), 0, dx, (rcContainer.bottom - 14 - m_pContainer->statusBarHeight - 1),
- m_elementWidth + 4, 14, dwFlags | SWP_SHOWWINDOW);
+ m_elementWidth + 4, 14, dwFlags | SWP_SHOWWINDOW);
::EnableWindow(m_up->getHwnd(), topEnabled);
::EnableWindow(m_down->getHwnd(), bottomEnabled);
::InvalidateRect(m_up->getHwnd(), NULL, FALSE);
@@ -798,7 +798,7 @@ void CSideBar::showAll(int showCmd)
::ShowWindow(m_up->getHwnd(), showCmd);
::ShowWindow(m_down->getHwnd(), showCmd);
- for (int i=0; i < m_buttonlist.getCount(); i++)
+ for (int i = 0; i < m_buttonlist.getCount(); i++)
::ShowWindow(m_buttonlist[i].getHwnd(), showCmd);
}
@@ -816,7 +816,7 @@ CSideBarButton* CSideBar::findSession(const TWindowData *dat)
if (dat == NULL)
return NULL;
- for (int i=0; i < m_buttonlist.getCount(); i++) {
+ for (int i = 0; i < m_buttonlist.getCount(); i++) {
CSideBarButton &p = m_buttonlist[i];
if (p.getDat() == dat)
return &p;
@@ -839,7 +839,7 @@ CSideBarButton* CSideBar::findSession(const MCONTACT hContact)
if (hContact == NULL)
return NULL;
- for (int i=0; i < m_buttonlist.getCount(); i++) {
+ for (int i = 0; i < m_buttonlist.getCount(); i++) {
CSideBarButton &p = m_buttonlist[i];
if (p.getContactHandle() == hContact)
return &p;
@@ -868,7 +868,7 @@ void CSideBar::resizeScrollWnd(LONG x, LONG y, LONG, LONG height) const
return;
}
::SetWindowPos(m_hwndScrollWnd, 0, x, y + 15, m_width, height - 30,
- SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOSENDCHANGING | SWP_DEFERERASE | SWP_ASYNCWINDOWPOS);
+ SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOSENDCHANGING | SWP_DEFERERASE | SWP_ASYNCWINDOWPOS);
}
void CSideBar::invalidateButton(const TWindowData *dat)
@@ -887,7 +887,7 @@ void CSideBar::invalidateButton(const TWindowData *dat)
*/
LRESULT CALLBACK CSideBar::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_SIZE:
return TRUE;
@@ -914,7 +914,7 @@ LRESULT CALLBACK CSideBar::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
}
else {
hdcMem = ::CreateCompatibleDC(hdc);
- hbm = CSkin::CreateAeroCompatibleBitmap(rc, hdcMem);
+ hbm = CSkin::CreateAeroCompatibleBitmap(rc, hdcMem);
hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(hdcMem, hbm));
}
@@ -945,7 +945,7 @@ LRESULT CALLBACK CSideBar::wndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARA
if (sideBar)
return(sideBar->wndProc(hwnd, msg, wParam, lParam));
- switch(msg) {
+ switch (msg) {
case WM_NCCREATE:
CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams);
@@ -992,26 +992,26 @@ void __fastcall CSideBar::m_DefaultBackgroundRenderer(const HDC hdc, const RECT
if (stateId == PBS_HOT || stateId == PBS_PRESSED)
DrawAlpha(hdc, const_cast<RECT *>(rc), 0xf0f0f0, 70, 0x000000, 0, 9,
- 31, 4, 0);
+ 31, 4, 0);
else
DrawAlpha(hdc, const_cast<RECT *>(rc), 0xf0f0f0, 30, 0x707070, 0, 9,
- 31, 4, 0);
+ 31, 4, 0);
}
else {
if (PluginConfig.m_fillColor)
FillTabBackground(hdc, stateId, item->getDat(), const_cast<RECT *>(rc));
CSkin::m_switchBarItem->setAlphaFormat(AC_SRC_ALPHA,
- (stateId == PBS_HOT && !fIsActiveItem) ? 250 : (fIsActiveItem || stateId == PBS_PRESSED ? 250 : 230));
+ (stateId == PBS_HOT && !fIsActiveItem) ? 250 : (fIsActiveItem || stateId == PBS_PRESSED ? 250 : 230));
CSkin::m_switchBarItem->Render(hdc, rc, true);
if (stateId == PBS_HOT || stateId == PBS_PRESSED || fIsActiveItem) {
- RECT rcGlow = *rc;
- rcGlow.top += 1;
+ RECT rcGlow = *rc;
+ rcGlow.top += 1;
rcGlow.bottom -= 2;
CSkin::m_tabGlowTop->setAlphaFormat(AC_SRC_ALPHA, (stateId == PBS_PRESSED || fIsActiveItem) ? 180 : 100);
- CSkin::m_tabGlowTop->Render(hdc, &rcGlow, true);
- }
+ CSkin::m_tabGlowTop->Render(hdc, &rcGlow, true);
+ }
}
}
else if (M.isVSThemed()) {
@@ -1019,7 +1019,7 @@ void __fastcall CSideBar::m_DefaultBackgroundRenderer(const HDC hdc, const RECT
if (id == IDC_SIDEBARUP || id == IDC_SIDEBARDOWN) {
::FillRect(hdc, rc, stateId == PBS_HOT ? ::GetSysColorBrush(COLOR_HOTLIGHT) : ::GetSysColorBrush(COLOR_3DFACE));
::InflateRect(rcDraw, -2, 0);
- ::DrawEdge(hdc, rcDraw, EDGE_ETCHED, BF_SOFT|BF_RECT|BF_FLAT);
+ ::DrawEdge(hdc, rcDraw, EDGE_ETCHED, BF_SOFT | BF_RECT | BF_FLAT);
}
else {
CSkin::FillBack(hdc, rcDraw);
@@ -1047,13 +1047,13 @@ void __fastcall CSideBar::m_DefaultBackgroundRenderer(const HDC hdc, const RECT
else {
::FillRect(hdc, rc, stateId == PBS_HOT ? ::GetSysColorBrush(COLOR_HOTLIGHT) : ::GetSysColorBrush(COLOR_3DFACE));
::InflateRect(rcDraw, -2, 0);
- ::DrawEdge(hdc, rcDraw, EDGE_ETCHED, BF_SOFT|BF_RECT|BF_FLAT);
+ ::DrawEdge(hdc, rcDraw, EDGE_ETCHED, BF_SOFT | BF_RECT | BF_FLAT);
}
}
}
void __fastcall CSideBar::m_DefaultContentRenderer(const HDC hdc, const RECT *rcBox,
- const CSideBarButton *item)
+ const CSideBarButton *item)
{
const TWindowData *dat = item->getDat();
UINT id = item->getID();
@@ -1061,7 +1061,7 @@ void __fastcall CSideBar::m_DefaultContentRenderer(const HDC hdc, const RECT *rc
if (id == IDC_SIDEBARUP || id == IDC_SIDEBARDOWN) {
::DrawIconEx(hdc, (rcBox->left + rcBox->right) / 2 - 8, (rcBox->top + rcBox->bottom) / 2 - 8, id == IDC_SIDEBARUP ? PluginConfig.g_buttonBarIcons[26] : PluginConfig.g_buttonBarIcons[16],
- 16, 16, 0, 0, DI_NORMAL);
+ 16, 16, 0, 0, DI_NORMAL);
if (!M.isAero() && stateID == PBS_HOT)
::DrawEdge(hdc, const_cast<RECT *>(rcBox), BDR_INNER, BF_RECT | BF_SOFT | BF_FLAT);
}
@@ -1131,7 +1131,7 @@ void __fastcall CSideBar::m_AdvancedContentRenderer(const HDC hdc, const RECT *r
rc.top++;
::SetBkMode(hdc, TRANSPARENT);
CSkin::RenderText(hdc, dat->hThemeIP, dat->cache->getNick(), &rc,
- dtFlags, CSkin::m_glowSize, CInfoPanel::m_ipConfig.clrs[IPFONTID_NICK]);
+ dtFlags, CSkin::m_glowSize, CInfoPanel::m_ipConfig.clrs[IPFONTID_NICK]);
if (fSecondLine) {
int iSize;
@@ -1147,7 +1147,7 @@ void __fastcall CSideBar::m_AdvancedContentRenderer(const HDC hdc, const RECT *r
rc.left += 18;
::SelectObject(hdc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_STATUS]);
CSkin::RenderText(hdc, dat->hThemeIP, dat->szStatus, &rc,
- dtFlags | DT_VCENTER, CSkin::m_glowSize, CInfoPanel::m_ipConfig.clrs[IPFONTID_STATUS]);
+ dtFlags | DT_VCENTER, CSkin::m_glowSize, CInfoPanel::m_ipConfig.clrs[IPFONTID_STATUS]);
}
::SelectObject(hdc, hOldFont);
}
@@ -1161,7 +1161,7 @@ const SIZE& __fastcall CSideBar::m_measureAdvancedVertical(CSideBarButton* item)
{
const TWindowData* dat = item->getDat();
- SIZE sz = {0};
+ SIZE sz = { 0 };
if (dat) {
SIZE szFirstLine, szSecondLine;
diff --git a/plugins/TabSRMM/src/sidebar.h b/plugins/TabSRMM/src/sidebar.h
index 71a6061b56..1a3d1896df 100644
--- a/plugins/TabSRMM/src/sidebar.h
+++ b/plugins/TabSRMM/src/sidebar.h
@@ -48,10 +48,10 @@ struct TSideBarLayout
* a default is always provided, however, it has been designed to be easily extendible without
* rewriting lots of code just in order to change how the switchbar items look like.
*/
- void (__fastcall *pfnContentRenderer)(const HDC hdc, const RECT *rc, const CSideBarButton *item);
- void (__fastcall *pfnBackgroundRenderer)(const HDC hdc, const RECT *rc, const CSideBarButton *item);
+ void(__fastcall *pfnContentRenderer)(const HDC hdc, const RECT *rc, const CSideBarButton *item);
+ void(__fastcall *pfnBackgroundRenderer)(const HDC hdc, const RECT *rc, const CSideBarButton *item);
const SIZE& (__fastcall *pfnMeasureItem)(CSideBarButton *item);
- void (__fastcall *pfnLayout)(const CSideBar *sideBar, RECT *rc);
+ void(__fastcall *pfnLayout)(const CSideBar *sideBar, RECT *rc);
UINT uId; // numeric id by which the layout is identified. basically, the index into the array.
};
@@ -64,37 +64,37 @@ public:
CSideBarButton(const TWindowData *dat, CSideBar *sideBar);
~CSideBarButton();
- LONG getHeight() const { return(m_sz.cy); }
- const SIZE& getSize() const { return(m_sz); }
- void setSize(const SIZE& newSize) { m_sz = newSize; }
- const bool isTopAligned() const { return(m_isTopAligned); }
- const HWND getHwnd() const { return(m_hwnd); }
- const UINT getID() const { return(m_id); }
- const MCONTACT getContactHandle() const { return(m_dat->hContact); }
- const TWindowData* getDat() const { return(m_dat); }
- const TSideBarLayout* getLayout() const { return(m_sideBarLayout); }
-
- void RenderThis(const HDC hdc) const;
- void renderIconAndNick(const HDC hdc, const RECT *rcItem) const;
- int testCloseButton() const;
- void Show(const int showCmd) const;
- void activateSession() const;
- const SIZE& measureItem();
- void setLayout(const TSideBarLayout *newLayout);
- void invokeContextMenu();
+ LONG getHeight() const { return(m_sz.cy); }
+ const SIZE& getSize() const { return(m_sz); }
+ void setSize(const SIZE& newSize) { m_sz = newSize; }
+ const bool isTopAligned() const { return(m_isTopAligned); }
+ const HWND getHwnd() const { return(m_hwnd); }
+ const UINT getID() const { return(m_id); }
+ const MCONTACT getContactHandle() const { return(m_dat->hContact); }
+ const TWindowData* getDat() const { return(m_dat); }
+ const TSideBarLayout* getLayout() const { return(m_sideBarLayout); }
+
+ void RenderThis(const HDC hdc) const;
+ void renderIconAndNick(const HDC hdc, const RECT *rcItem) const;
+ int testCloseButton() const;
+ void Show(const int showCmd) const;
+ void activateSession() const;
+ const SIZE& measureItem();
+ void setLayout(const TSideBarLayout *newLayout);
+ void invokeContextMenu();
public:
- CSideBar* m_sideBar;
- const TSButtonCtrl* m_buttonControl; // private data struct of the Win32 button object
+ CSideBar* m_sideBar;
+ const TSButtonCtrl* m_buttonControl; // private data struct of the Win32 button object
private:
- void _create();
+ void _create();
private:
- const TSideBarLayout* m_sideBarLayout;
- HWND m_hwnd; // window handle for the TSButton object
- const TWindowData* m_dat; // session data
- UINT m_id; // control id
- bool m_isTopAligned;
- SIZE m_sz;
+ const TSideBarLayout* m_sideBarLayout;
+ HWND m_hwnd; // window handle for the TSButton object
+ const TWindowData* m_dat; // session data
+ UINT m_id; // control id
+ bool m_isTopAligned;
+ SIZE m_sz;
};
class CSideBar
@@ -129,101 +129,101 @@ public:
CSideBar(TContainerData *pContainer);
~CSideBar();
- void Init();
- void addSession(const TWindowData *dat, int position);
- HRESULT removeSession(const TWindowData *dat);
- void updateSession(const TWindowData *dat);
-
- void processScrollerButtons(UINT cmd);
- void Layout(const RECT *rc = 0, bool fOnlyCalc = false);
- void setVisible(bool fNewVisibility);
- void showAll(int showCmd);
-
- const LONG getWidth() const { return(m_isVisible ? m_width + SIDEBAR_GAP : 0); }
- const DWORD getFlags() const { return(m_dwFlags); }
- const TContainerData* getContainer() const { return(m_pContainer); }
- const bool isActive() const { return(m_isActive); }
- const bool isVisible() const { return(m_isVisible); }
- const CSideBarButton* getActiveItem() const { return(m_activeItem); }
- const CSideBarButton* getScrollUp() const { return(m_up); }
- const CSideBarButton* getScrollDown() const { return(m_down); }
- bool isSkinnedContainer() const { return(CSkin::m_skinEnabled ? true : false); }
- const UINT getLayoutId() const { return(m_uLayout); }
- void invalidateButton(const TWindowData *dat);
-
- const CSideBarButton* setActiveItem(const CSideBarButton *newItem)
- {
- CSideBarButton *oldItem = m_activeItem;
- m_activeItem = const_cast<CSideBarButton *>(newItem);
- if (oldItem)
- ::InvalidateRect(oldItem->getHwnd(), NULL, FALSE);
- ::InvalidateRect(m_activeItem->getHwnd(), NULL, FALSE);
- scrollIntoView(m_activeItem);
- return(oldItem);
- }
- /**
- * this item has its close button currently hovered
- * @param item: the CSideBarButton* which is hovered
- */
- void setHoveredClose (CSideBarButton* item)
- {
- m_hoveredClose = item;
- }
- HWND getScrollWnd() const { return(m_hwndScrollWnd); }
- const CSideBarButton* getHoveredClose() const { return(m_hoveredClose); }
- const CSideBarButton* setActiveItem (const TWindowData *dat);
-
- static LRESULT CALLBACK wndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
- static const TSideBarLayout* getLayouts (int& uLayoutCount)
- {
- uLayoutCount = NR_LAYOUTS;
- return(m_layouts);
- }
- void scrollIntoView (const CSideBarButton *item = 0);
- void resizeScrollWnd (LONG x, LONG y, LONG width, LONG height) const;
+ void Init();
+ void addSession(const TWindowData *dat, int position);
+ HRESULT removeSession(const TWindowData *dat);
+ void updateSession(const TWindowData *dat);
+
+ void processScrollerButtons(UINT cmd);
+ void Layout(const RECT *rc = 0, bool fOnlyCalc = false);
+ void setVisible(bool fNewVisibility);
+ void showAll(int showCmd);
+
+ const LONG getWidth() const { return(m_isVisible ? m_width + SIDEBAR_GAP : 0); }
+ const DWORD getFlags() const { return(m_dwFlags); }
+ const TContainerData* getContainer() const { return(m_pContainer); }
+ const bool isActive() const { return(m_isActive); }
+ const bool isVisible() const { return(m_isVisible); }
+ const CSideBarButton* getActiveItem() const { return(m_activeItem); }
+ const CSideBarButton* getScrollUp() const { return(m_up); }
+ const CSideBarButton* getScrollDown() const { return(m_down); }
+ bool isSkinnedContainer() const { return(CSkin::m_skinEnabled ? true : false); }
+ const UINT getLayoutId() const { return(m_uLayout); }
+ void invalidateButton(const TWindowData *dat);
+
+ const CSideBarButton* setActiveItem(const CSideBarButton *newItem)
+ {
+ CSideBarButton *oldItem = m_activeItem;
+ m_activeItem = const_cast<CSideBarButton *>(newItem);
+ if (oldItem)
+ ::InvalidateRect(oldItem->getHwnd(), NULL, FALSE);
+ ::InvalidateRect(m_activeItem->getHwnd(), NULL, FALSE);
+ scrollIntoView(m_activeItem);
+ return(oldItem);
+ }
+ /**
+ * this item has its close button currently hovered
+ * @param item: the CSideBarButton* which is hovered
+ */
+ void setHoveredClose(CSideBarButton* item)
+ {
+ m_hoveredClose = item;
+ }
+ HWND getScrollWnd() const { return(m_hwndScrollWnd); }
+ const CSideBarButton* getHoveredClose() const { return(m_hoveredClose); }
+ const CSideBarButton* setActiveItem(const TWindowData *dat);
+
+ static LRESULT CALLBACK wndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
+ static const TSideBarLayout* getLayouts(int& uLayoutCount)
+ {
+ uLayoutCount = NR_LAYOUTS;
+ return(m_layouts);
+ }
+ void scrollIntoView(const CSideBarButton *item = 0);
+ void resizeScrollWnd(LONG x, LONG y, LONG width, LONG height) const;
private:
- void createScroller();
- void destroyScroller();
- void populateAll();
- void removeAll();
- void Invalidate();
- CSideBarButton* findSession(const TWindowData *dat);
- CSideBarButton* findSession(const MCONTACT hContact);
+ void createScroller();
+ void destroyScroller();
+ void populateAll();
+ void removeAll();
+ void Invalidate();
+ CSideBarButton* findSession(const TWindowData *dat);
+ CSideBarButton* findSession(const MCONTACT hContact);
- LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
private:
- HWND m_hwndScrollWnd;
- OBJLIST<CSideBarButton> m_buttonlist; // our list of buttons
- TContainerData* m_pContainer; // our master and commander...
- LONG m_width; // required width of the bar (m_elementWidth + padding)
- DWORD m_dwFlags;
- CSideBarButton* m_up, *m_down; // the scroller buttons (up down)
- CSideBarButton* m_activeItem; // active button item (for highlighting)
- const CSideBarButton* m_hoveredClose; // item which must display an active close button
- LONG m_topHeight, m_bottomHeight;
- LONG m_firstVisibleOffset, m_totalItemHeight;
- int m_iTopButtons, m_iBottomButtons;
- LONG m_elementHeight, m_elementWidth; // width / height for a single element.
- // can be dynamic (see measeureItem() in CSideBarButtonItem
- bool m_isActive; // the sidebar is active (false, if it does _nothing at all_
- bool m_isVisible; // visible aswell (not collapsed)
- TSideBarLayout* m_currentLayout; // the layout in use. will be passed to new button items
- UINT m_uLayout; // layout id number, currently in use
+ HWND m_hwndScrollWnd;
+ OBJLIST<CSideBarButton> m_buttonlist; // our list of buttons
+ TContainerData* m_pContainer; // our master and commander...
+ LONG m_width; // required width of the bar (m_elementWidth + padding)
+ DWORD m_dwFlags;
+ CSideBarButton* m_up, *m_down; // the scroller buttons (up down)
+ CSideBarButton* m_activeItem; // active button item (for highlighting)
+ const CSideBarButton* m_hoveredClose; // item which must display an active close button
+ LONG m_topHeight, m_bottomHeight;
+ LONG m_firstVisibleOffset, m_totalItemHeight;
+ int m_iTopButtons, m_iBottomButtons;
+ LONG m_elementHeight, m_elementWidth; // width / height for a single element.
+ // can be dynamic (see measeureItem() in CSideBarButtonItem
+ bool m_isActive; // the sidebar is active (false, if it does _nothing at all_
+ bool m_isVisible; // visible aswell (not collapsed)
+ TSideBarLayout* m_currentLayout; // the layout in use. will be passed to new button items
+ UINT m_uLayout; // layout id number, currently in use
private:
- /*
- * layouts. m_layouts[] is static and contains layout descriptions
- * renderer functions are static aswell
- */
- static TSideBarLayout m_layouts[NR_LAYOUTS];
- static void __fastcall m_DefaultBackgroundRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
- static void __fastcall m_DefaultContentRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
- static void __fastcall m_AdvancedContentRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
-
- static const SIZE& __fastcall m_measureAdvancedVertical(CSideBarButton *item);
+ /*
+ * layouts. m_layouts[] is static and contains layout descriptions
+ * renderer functions are static aswell
+ */
+ static TSideBarLayout m_layouts[NR_LAYOUTS];
+ static void __fastcall m_DefaultBackgroundRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
+ static void __fastcall m_DefaultContentRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
+ static void __fastcall m_AdvancedContentRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item);
+
+ static const SIZE& __fastcall m_measureAdvancedVertical(CSideBarButton *item);
};
inline void CSideBarButton::setLayout(const TSideBarLayout *newLayout)
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp
index 6b14befdcd..1e307ff698 100644
--- a/plugins/TabSRMM/src/srmm.cpp
+++ b/plugins/TabSRMM/src/srmm.cpp
@@ -29,14 +29,14 @@
#include "commonheaders.h"
HINSTANCE g_hInst;
-LOGFONT lfDefault = {0};
+LOGFONT lfDefault = { 0 };
/*
* miranda interfaces
*/
int hLangpack;
-TIME_API tmi = {0};
+TIME_API tmi = { 0 };
CLIST_INTERFACE *pcli;
PLUGININFOEX pluginInfo = {
@@ -50,7 +50,7 @@ PLUGININFOEX pluginInfo = {
__AUTHORWEB,
UNICODE_AWARE,
// {6CA5F042-7A7F-47CC-A715-FC8C46FBF434}
- {0x6ca5f042, 0x7a7f, 0x47cc, {0xa7, 0x15, 0xfc, 0x8c, 0x46, 0xfb, 0xf4, 0x34}}
+ { 0x6ca5f042, 0x7a7f, 0x47cc, { 0xa7, 0x15, 0xfc, 0x8c, 0x46, 0xfb, 0xf4, 0x34 } }
};
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
@@ -64,7 +64,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
return &pluginInfo;
}
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_SRMM, MIID_CHAT, MIID_LAST};
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRMM, MIID_CHAT, MIID_LAST };
extern "C" int __declspec(dllexport) Load(void)
{
@@ -114,9 +114,9 @@ int _DebugTraceW(const wchar_t *fmt, ...)
mir_vsntprintf(debug, ibsize - 10, fmt, va);
-//#ifdef _DEBUG
+ //#ifdef _DEBUG
OutputDebugStringW(debug);
-//#else
+ //#else
{
char szLogFileName[MAX_PATH], szDataPath[MAX_PATH];
FILE *f;
@@ -130,14 +130,15 @@ int _DebugTraceW(const wchar_t *fmt, ...)
if (szDebug != NULL) {
fputs(szDebug, f);
mir_free(szDebug);
- } else {
+ }
+ else {
fputs("mir_utf8encodeT() fail in _DebugTraceW()", f);
}
fputs("\n", f);
fclose(f);
}
}
-//#endif
+ //#endif
return 0;
}
@@ -151,7 +152,7 @@ int _DebugTraceA(const char *fmt, ...)
mir_strcpy(debug, "TABSRMM: ");
mir_vsnprintf(&debug[9], ibsize - 10, fmt, va);
#ifdef _DEBUG
- OutputDebugStringA(debug);
+ OutputDebugStringA(debug);
#else
{
char szLogFileName[MAX_PATH], szDataPath[MAX_PATH];
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index 045dd970cf..e200dd0bda 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -474,7 +474,7 @@ static void DrawThemesXpTabItem(HDC pDC, RECT *rcItem, UINT uiFlag, TabControlDa
BITMAPINFO biOut;
memset(&biOut, 0, sizeof(BITMAPINFO)); // Fill local pixel arrays
-
+
BITMAPINFOHEADER *bihOut = &biOut.bmiHeader;
bihOut->biSize = sizeof(BITMAPINFOHEADER);
bihOut->biCompression = BI_RGB;
@@ -925,22 +925,22 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
switch (msg) {
case WM_NCCREATE:
- {
- WNDCLASSEX wcl = { 0 };
- wcl.cbSize = sizeof(wcl);
- GetClassInfoEx(g_hInst, _T("SysTabControl32"), &wcl);
- OldTabControlClassProc = wcl.lpfnWndProc;
-
- tabdat = (TabControlData*)mir_calloc(sizeof(TabControlData));
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)tabdat);
- tabdat->hwnd = hwnd;
- tabdat->cx = GetSystemMetrics(SM_CXSMICON);
- tabdat->cy = GetSystemMetrics(SM_CYSMICON);
- tabdat->fTipActive = FALSE;
- tabdat->iHoveredCloseIcon = -1;
- SendMessage(hwnd, EM_THEMECHANGED, 0, 0);
- }
- return TRUE;
+ {
+ WNDCLASSEX wcl = { 0 };
+ wcl.cbSize = sizeof(wcl);
+ GetClassInfoEx(g_hInst, _T("SysTabControl32"), &wcl);
+ OldTabControlClassProc = wcl.lpfnWndProc;
+
+ tabdat = (TabControlData*)mir_calloc(sizeof(TabControlData));
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)tabdat);
+ tabdat->hwnd = hwnd;
+ tabdat->cx = GetSystemMetrics(SM_CXSMICON);
+ tabdat->cy = GetSystemMetrics(SM_CYSMICON);
+ tabdat->fTipActive = FALSE;
+ tabdat->iHoveredCloseIcon = -1;
+ SendMessage(hwnd, EM_THEMECHANGED, 0, 0);
+ }
+ return TRUE;
case EM_THEMECHANGED:
tabdat->m_xpad = M.GetByte("x-pad", 3);
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp
index c79e4e22ef..6ff4c4c4c2 100644
--- a/plugins/TabSRMM/src/taskbar.cpp
+++ b/plugins/TabSRMM/src/taskbar.cpp
@@ -72,7 +72,7 @@ CTaskbarInteract* Win7Taskbar = 0;
bool CTaskbarInteract::setOverlayIcon(HWND hwndDlg, LPARAM lParam) const
{
if (m_pTaskbarInterface && m_isEnabled && m_fHaveLargeicons) {
- m_pTaskbarInterface->SetOverlayIcon(hwndDlg,(HICON)lParam, NULL);
+ m_pTaskbarInterface->SetOverlayIcon(hwndDlg, (HICON)lParam, NULL);
return true;
}
return false;
@@ -241,7 +241,7 @@ CProxyWindow::CProxyWindow(TWindowData *dat)
BOOL fIconic = TRUE;
BOOL fHasIconicBitmap = TRUE;
- CMimAPI::m_pfnDwmSetWindowAttribute(m_hwndProxy, DWMWA_FORCE_ICONIC_REPRESENTATION, &fIconic, sizeof(fIconic));
+ CMimAPI::m_pfnDwmSetWindowAttribute(m_hwndProxy, DWMWA_FORCE_ICONIC_REPRESENTATION, &fIconic, sizeof(fIconic));
CMimAPI::m_pfnDwmSetWindowAttribute(m_hwndProxy, DWMWA_HAS_ICONIC_BITMAP, &fHasIconicBitmap, sizeof(fHasIconicBitmap));
}
}
@@ -324,15 +324,15 @@ void CProxyWindow::sendPreview()
if (!m_thumb || !dat_active)
return;
- FORMATRANGE fr = {0};
- POINT pt = {0};
+ FORMATRANGE fr = { 0 };
+ POINT pt = { 0 };
RECT rcContainer, rcTemp, rcRich, rcLog;
HDC hdc, dc;
int twips = (int)(15.0f / PluginConfig.m_DPIscaleY);
bool fIsChat = m_dat->bType != SESSIONTYPE_IM;
HWND hwndRich = ::GetDlgItem(m_dat->hwnd, fIsChat ? IDC_CHAT_LOG : IDC_LOG);
LONG cx, cy;
- POINT ptOrigin = {0}, ptBottom;
+ POINT ptOrigin = { 0 }, ptBottom;
if (m_dat->dwFlags & MWF_NEEDCHECKSIZE) {
RECT rcClient;
@@ -401,7 +401,7 @@ void CProxyWindow::sendPreview()
::SendMessage(m_dat->hwndIEView, WM_PRINT, reinterpret_cast<WPARAM>(hdcRich), PRF_CLIENT | PRF_NONCLIENT);
else if (m_dat->hwndHPP) {
CSkin::RenderText(hdcRich, m_dat->hTheme, TranslateT("Previews not available when using History++ plugin for message log display."),
- &rcRich, DT_VCENTER | DT_CENTER | DT_WORDBREAK, 10, m_dat->pContainer->theme.fontColors[MSGFONTID_MYMSG], false);
+ &rcRich, DT_VCENTER | DT_CENTER | DT_WORDBREAK, 10, m_dat->pContainer->theme.fontColors[MSGFONTID_MYMSG], false);
}
else {
rcRich.right *= twips;
@@ -534,7 +534,7 @@ LRESULT CALLBACK CProxyWindow::stubWndProc(HWND hWnd, UINT msg, WPARAM wParam, L
if (pWnd)
return(pWnd->wndProc(hWnd, msg, wParam, lParam));
- switch(msg) {
+ switch (msg) {
case WM_NCCREATE:
CREATESTRUCT *cs = reinterpret_cast<CREATESTRUCT *>(lParam);
CProxyWindow *pWnd = reinterpret_cast<CProxyWindow *>(cs->lpCreateParams);
@@ -549,7 +549,7 @@ LRESULT CALLBACK CProxyWindow::stubWndProc(HWND hWnd, UINT msg, WPARAM wParam, L
*/
LRESULT CALLBACK CProxyWindow::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
#if defined(__LOGDEBUG_)
case WM_NCCREATE:
@@ -557,22 +557,22 @@ LRESULT CALLBACK CProxyWindow::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA
break;
#endif
case WM_CLOSE:
- {
- TContainerData* pC = m_dat->pContainer;
-
- if (m_dat->hwnd != pC->hwndActive)
- SendMessage(m_dat->hwnd, WM_CLOSE, 1, 3);
- else
- SendMessage(m_dat->hwnd, WM_CLOSE, 1, 2);
- if (!IsIconic(pC->hwnd))
- SetForegroundWindow(pC->hwnd);
- }
- return 0;
+ {
+ TContainerData* pC = m_dat->pContainer;
- /*
- * proxy window was activated by clicking on the thumbnail. Send this
- * to the real message window.
- */
+ if (m_dat->hwnd != pC->hwndActive)
+ SendMessage(m_dat->hwnd, WM_CLOSE, 1, 3);
+ else
+ SendMessage(m_dat->hwnd, WM_CLOSE, 1, 2);
+ if (!IsIconic(pC->hwnd))
+ SetForegroundWindow(pC->hwnd);
+ }
+ return 0;
+
+ /*
+ * proxy window was activated by clicking on the thumbnail. Send this
+ * to the real message window.
+ */
case WM_ACTIVATE:
if (WA_ACTIVE == wParam) {
if (IsWindow(m_dat->hwnd))
@@ -699,7 +699,7 @@ void CThumbBase::renderBase()
mir_sntprintf(tszTemp, SIZEOF(tszTemp), TranslateT("%d unread"), m_dat->dwUnread);
CSkin::RenderText(m_hdc, m_dat->hTheme, tszTemp, &m_rcIcon, m_dtFlags | DT_CENTER | DT_WORD_ELLIPSIS, 10, 0, true);
}
- m_rcIcon= m_rcTop;
+ m_rcIcon = m_rcTop;
m_rcIcon.top += 2;
m_rcIcon.left = m_rc.right / 3;
m_cx = m_rcIcon.right - m_rcIcon.left;
@@ -714,7 +714,7 @@ void CThumbBase::setupRect()
if (SESSIONTYPE_IM == m_pWnd->getDat()->bType) {
m_rcTop = m_rc;
m_rcBottom = m_rc;
- m_rcBottom.top = m_rc.bottom - ( 2 * (m_rcBottom.bottom / 5)) - 2;
+ m_rcBottom.top = m_rc.bottom - (2 * (m_rcBottom.bottom / 5)) - 2;
m_rcTop.bottom = m_rcBottom.top - 2;
m_rcIcon = m_rcTop;
@@ -723,7 +723,7 @@ void CThumbBase::setupRect()
else {
m_rcTop = m_rc;
m_rcBottom = m_rc;
- m_rcBottom.top = m_rc.bottom - ( 2 * (m_rcBottom.bottom / 5)) - 2;
+ m_rcBottom.top = m_rc.bottom - (2 * (m_rcBottom.bottom / 5)) - 2;
m_rcTop.bottom = m_rcBottom.top - 2;
m_rcIcon = m_rcTop;
@@ -825,7 +825,7 @@ void CThumbIM::renderContent()
m_rcBottom.bottom = m_rc.bottom;
m_rcBottom.top = m_rcBottom.bottom - m_sz.cy - 2;
CSkin::RenderText(m_hdc, m_dat->hTheme, Win7Taskbar->haveAlwaysGroupingMode() ? m_dat->cache->getUIN() : m_dat->cache->getNick(),
- &m_rcBottom, m_dtFlags | DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS, 10, 0, true);
+ &m_rcBottom, m_dtFlags | DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS, 10, 0, true);
/*
* finalize it
@@ -881,9 +881,9 @@ void CThumbMUC::renderContent()
}
if (m_dat->si->iType != GCW_SERVER) {
wchar_t* _p = NULL;
- if ( m_dat->si->ptszStatusbarText )
+ if (m_dat->si->ptszStatusbarText)
_p = wcschr(m_dat->si->ptszStatusbarText, ']');
- if ( _p ) {
+ if (_p) {
_p++;
wchar_t _t = *_p;
*_p = 0;
diff --git a/plugins/TabSRMM/src/taskbar.h b/plugins/TabSRMM/src/taskbar.h
index 96a6f30ad9..d2eb0f3733 100644
--- a/plugins/TabSRMM/src/taskbar.h
+++ b/plugins/TabSRMM/src/taskbar.h
@@ -156,7 +156,7 @@ public:
wcex.lpfnWndProc = CProxyWindow::stubWndProc;
wcex.hInstance = g_hInst;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
- wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszClassName = PROXYCLASSNAME;
::RegisterClassEx(&wcex);
}
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp
index c621d1e951..ba1a5b025a 100644
--- a/plugins/TabSRMM/src/templates.cpp
+++ b/plugins/TabSRMM/src/templates.cpp
@@ -45,28 +45,28 @@ char *TemplateNames[] = {
};
TTemplateSet LTR_Default = { TRUE,
- _T("%I %S %N %?&D%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M"),
- _T("%I %S %N %?&D%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M"),
- _T("%I %S %N %?&D%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M"),
- _T("%I %S %N %?&D%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M"),
- _T("%S %T%|%M"),
- _T("%S %T%|%M"),
- _T("%I %S %&D, %&T, %N %M%! "),
- _T("%I%S %D, %T, %e%l%M"),
- "Default LTR"
- };
+_T("%I %S %N %?&D%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M"),
+_T("%I %S %N %?&D%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M"),
+_T("%I %S %N %?&D%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M"),
+_T("%I %S %N %?&D%\\&E%\\!, %\\T%\\!: %?n%?S %?T%?|%M"),
+_T("%S %T%|%M"),
+_T("%S %T%|%M"),
+_T("%I %S %&D, %&T, %N %M%! "),
+_T("%I%S %D, %T, %e%l%M"),
+"Default LTR"
+};
TTemplateSet RTL_Default = { TRUE,
- _T("%I %S %N %D%n%S %T%|%M"),
- _T("%I %S %N %D%n%S %T%|%M"),
- _T("%I %S %N %D%n%S %T%|%M"),
- _T("%I %S %N %D%n%S %T%|%M"),
- _T("%S %T%|%M"),
- _T("%S %T%|%M"),
- _T("%I%S %D, %T, %N %M%! "),
- _T("%I%S %D, %T, %e%l%M"),
- "Default RTL"
- };
+_T("%I %S %N %D%n%S %T%|%M"),
+_T("%I %S %N %D%n%S %T%|%M"),
+_T("%I %S %N %D%n%S %T%|%M"),
+_T("%I %S %N %D%n%S %T%|%M"),
+_T("%S %T%|%M"),
+_T("%S %T%|%M"),
+_T("%I%S %D, %T, %N %M%! "),
+_T("%I%S %D, %T, %e%l%M"),
+"Default RTL"
+};
TTemplateSet LTR_Active, RTL_Active;
static int helpActive = 0;
@@ -79,10 +79,10 @@ static int helpActive = 0;
static void LoadTemplatesFrom(TTemplateSet *tSet, MCONTACT hContact, int rtl)
{
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
int i;
- for (i=0; i <= TMPL_ERRMSG; i++) {
+ for (i = 0; i <= TMPL_ERRMSG; i++) {
if (db_get_ts(hContact, rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[i], &dbv))
continue;
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR)
@@ -99,12 +99,12 @@ void LoadDefaultTemplates()
RTL_Active = RTL_Default;
if (M.GetByte(RTLTEMPLATES_MODULE, "setup", 0) < 2) {
- for (i=0; i <= TMPL_ERRMSG; i++)
+ for (i = 0; i <= TMPL_ERRMSG; i++)
db_set_ts(NULL, RTLTEMPLATES_MODULE, TemplateNames[i], RTL_Default.szTemplates[i]);
db_set_b(0, RTLTEMPLATES_MODULE, "setup", 2);
}
if (M.GetByte(TEMPLATES_MODULE, "setup", 0) < 2) {
- for (i=0; i <= TMPL_ERRMSG; i++)
+ for (i = 0; i <= TMPL_ERRMSG; i++)
db_set_ts(NULL, TEMPLATES_MODULE, TemplateNames[i], LTR_Default.szTemplates[i]);
db_set_b(0, TEMPLATES_MODULE, "setup", 2);
}
@@ -133,7 +133,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP
TranslateDialogDefault(hwndDlg);
{
TemplateEditorNew *teNew = (TemplateEditorNew *)lParam;
- dat = (TWindowData*)mir_calloc( sizeof(TWindowData));
+ dat = (TWindowData*)mir_calloc(sizeof(TWindowData));
dat->pContainer = (TContainerData*)mir_alloc(sizeof(TContainerData));
memset(dat->pContainer, 0, sizeof(TContainerData));
teInfo = (TemplateEditorInfo *)dat->pContainer;
@@ -154,7 +154,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP
dat->hContact = db_find_first();
dat->szProto = GetContactProto(dat->hContact);
- while(dat->szProto == 0 && dat->hContact != 0) {
+ while (dat->szProto == 0 && dat->hContact != 0) {
dat->hContact = db_find_next(dat->hContact);
dat->szProto = GetContactProto(dat->hContact);
}
@@ -166,14 +166,14 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP
dat->cache->updateStats(TSessionStats::INIT_TIMER);
GetMYUIN(dat);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
ShowWindow(hwndDlg, SW_SHOW);
SendDlgItemMessage(hwndDlg, IDC_EDITTEMPLATE, EM_LIMITTEXT, (WPARAM)TEMPLATE_LENGTH - 1, 0);
SetWindowText(hwndDlg, TranslateT("Template set editor"));
Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
- for (i=0; i <= TMPL_ERRMSG; i++) {
+ for (i = 0; i <= TMPL_ERRMSG; i++) {
SendDlgItemMessageA(hwndDlg, IDC_TEMPLATELIST, LB_ADDSTRING, 0, (LPARAM)Translate(TemplateNames[i]));
SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_SETITEMDATA, i, (LPARAM)i);
}
@@ -198,17 +198,17 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_RESETALLTEMPLATES:
if (MessageBox(0, TranslateT("This will reset the template set to the default built-in templates. Are you sure you want to do this?"),
TranslateT("Template set editor"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- db_set_b(0, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, "setup", 0);
- LoadDefaultTemplates();
- MessageBox(0, TranslateT("Template set was successfully reset, please close and reopen all message windows. This template editor window will now close."),
- TranslateT("Template set editor"), MB_OK);
- DestroyWindow(hwndDlg);
+ db_set_b(0, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, "setup", 0);
+ LoadDefaultTemplates();
+ MessageBox(0, TranslateT("Template set was successfully reset, please close and reopen all message windows. This template editor window will now close."),
+ TranslateT("Template set editor"), MB_OK);
+ DestroyWindow(hwndDlg);
}
break;
case IDC_TEMPLATELIST:
switch (HIWORD(wParam)) {
- LRESULT iIndex;
+ LRESULT iIndex;
case LBN_DBLCLK:
iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
if (iIndex != LB_ERR) {
@@ -251,22 +251,22 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
break;
case IDC_SAVETEMPLATE:
- {
- TCHAR newTemplate[TEMPLATE_LENGTH + 2];
-
- GetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, newTemplate, SIZEOF(newTemplate));
- memcpy(tSet->szTemplates[teInfo->inEdit], newTemplate, sizeof(TCHAR) * TEMPLATE_LENGTH);
- teInfo->changed = FALSE;
- teInfo->updateInfo[teInfo->inEdit] = FALSE;
- Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
- db_set_ts(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit], newTemplate);
- SendDlgItemMessage(hwndDlg, IDC_EDITTEMPLATE, EM_SETREADONLY, TRUE, 0);
- }
- break;
+ {
+ TCHAR newTemplate[TEMPLATE_LENGTH + 2];
+
+ GetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, newTemplate, SIZEOF(newTemplate));
+ memcpy(tSet->szTemplates[teInfo->inEdit], newTemplate, sizeof(TCHAR) * TEMPLATE_LENGTH);
+ teInfo->changed = FALSE;
+ teInfo->updateInfo[teInfo->inEdit] = FALSE;
+ Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
+ db_set_ts(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit], newTemplate);
+ SendDlgItemMessage(hwndDlg, IDC_EDITTEMPLATE, EM_SETREADONLY, TRUE, 0);
+ }
+ break;
case IDC_FORGET:
teInfo->changed = FALSE;
@@ -307,36 +307,38 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP
break;
case WM_DRAWITEM:
- {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
- int iItem = dis->itemData;
- HBRUSH bkg, oldBkg;
- SetBkMode(dis->hDC, TRANSPARENT);
- FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW));
- if (dis->itemState & ODS_SELECTED) {
- if (teInfo->updateInfo[iItem] == TRUE) {
- bkg = CreateSolidBrush(RGB(255, 0, 0));
- oldBkg = (HBRUSH)SelectObject(dis->hDC, bkg);
- FillRect(dis->hDC, &dis->rcItem, bkg);
- SelectObject(dis->hDC, oldBkg);
- DeleteObject(bkg);
- } else
- FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
-
- SetTextColor(dis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
- } else {
- if (teInfo->updateInfo[iItem] == TRUE)
- SetTextColor(dis->hDC, RGB(255, 0, 0));
- else
- SetTextColor(dis->hDC, GetSysColor(COLOR_WINDOWTEXT));
+ {
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
+ int iItem = dis->itemData;
+ HBRUSH bkg, oldBkg;
+ SetBkMode(dis->hDC, TRANSPARENT);
+ FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW));
+ if (dis->itemState & ODS_SELECTED) {
+ if (teInfo->updateInfo[iItem] == TRUE) {
+ bkg = CreateSolidBrush(RGB(255, 0, 0));
+ oldBkg = (HBRUSH)SelectObject(dis->hDC, bkg);
+ FillRect(dis->hDC, &dis->rcItem, bkg);
+ SelectObject(dis->hDC, oldBkg);
+ DeleteObject(bkg);
}
- char *pszName = Translate(TemplateNames[iItem]);
- TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, pszName, (int)mir_strlen(pszName));
+ else
+ FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
+
+ SetTextColor(dis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
}
- return TRUE;
+ else {
+ if (teInfo->updateInfo[iItem] == TRUE)
+ SetTextColor(dis->hDC, RGB(255, 0, 0));
+ else
+ SetTextColor(dis->hDC, GetSysColor(COLOR_WINDOWTEXT));
+ }
+ char *pszName = Translate(TemplateNames[iItem]);
+ TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, pszName, (int)mir_strlen(pszName));
+ }
+ return TRUE;
case DM_UPDATETEMPLATEPREVIEW: {
- DBEVENTINFO dbei = {0};
+ DBEVENTINFO dbei = { 0 };
int iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
TCHAR szTemp[TEMPLATE_LENGTH + 2];
@@ -367,7 +369,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (teInfo->changed)
memcpy(tSet->szTemplates[teInfo->inEdit], szTemp, TEMPLATE_LENGTH * sizeof(TCHAR));
break;
- }
+ }
case WM_DESTROY:
Utils::enableDlgControl(teInfo->hwndParent, IDC_MODIFY, TRUE);
Utils::enableDlgControl(teInfo->hwndParent, IDC_RTLMODIFY, TRUE);
diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp
index 226c955746..6783205d63 100644
--- a/plugins/TabSRMM/src/themeio.cpp
+++ b/plugins/TabSRMM/src/themeio.cpp
@@ -94,7 +94,7 @@ static _extSettings_v5[18] =
* szKey = ini section (e.g. [Font10])
* *lf = pointer to a LOGFONT structure which will receive the font definition
* *colour = pointer to a COLORREF which will receive the color of the font definition
-*/
+ */
static void TSAPI LoadLogfontFromINI(int i, char *szKey, LOGFONTA *lf, COLORREF *colour, const char *szIniFilename)
{
int style;
@@ -136,7 +136,8 @@ static void TSAPI LoadLogfontFromINI(int i, char *szKey, LOGFONTA *lf, COLORREF
if (i == MSGFONTID_SYMBOLS_IN || i == MSGFONTID_SYMBOLS_OUT) {
strncpy_s(lf->lfFaceName, "Webdings", _TRUNCATE);
lf->lfCharSet = SYMBOL_CHARSET;
- } else
+ }
+ else
GetPrivateProfileStringA(szKey, "Face", "Tahoma", lf->lfFaceName, LF_FACESIZE - 1, szIniFilename);
/*
@@ -190,7 +191,7 @@ void TSAPI WriteThemeToINI(const TCHAR *szIniFilenameT, TWindowData *dat)
int firstIndex = fontBlocks[n].iFirst;
char *szModule = fontBlocks[n].szModule;
WritePrivateProfileStringA(fontBlocks[n].szBLockname, "Valid", "1", szIniFilename);
- for (i=0; i < fontBlocks[n].iCount; i++) {
+ for (i = 0; i < fontBlocks[n].iCount; i++) {
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", firstIndex + i);
mir_snprintf(szAppname, SIZEOF(szAppname), fontBlocks[n].szIniTemp, firstIndex + i);
if (!db_get_s(NULL, szModule, szTemp, &dbv)) {
@@ -210,12 +211,12 @@ void TSAPI WriteThemeToINI(const TCHAR *szIniFilenameT, TWindowData *dat)
}
def = SRMSGDEFSET_BKGCOLOUR;
- for (i=0; i < SIZEOF(_extSettings); i++) {
+ for (i = 0; i < SIZEOF(_extSettings); i++) {
WritePrivateProfileStringA(_extSettings[i].szIniSection, _extSettings[i].szIniName,
_itoa(M.GetDword(_extSettings[i].szDbModule, _extSettings[i].szDbSetting, _extSettings[i].dwDef), szBuf, 10), szIniFilename);
}
- for (i=0; i < SIZEOF(_extSettings_v5); i++) {
+ for (i = 0; i < SIZEOF(_extSettings_v5); i++) {
WritePrivateProfileStringA(_extSettings_v5[i].szIniSection, _extSettings_v5[i].szIniName,
_itoa(M.GetDword(_extSettings_v5[i].szDbModule, _extSettings_v5[i].szDbSetting, _extSettings_v5[i].dwDef), szBuf, 10), szIniFilename);
}
@@ -223,7 +224,7 @@ void TSAPI WriteThemeToINI(const TCHAR *szIniFilenameT, TWindowData *dat)
WritePrivateProfileStringA("Message Log", "VGrid", _itoa(M.GetByte("wantvgrid", 0), szBuf, 10), szIniFilename);
WritePrivateProfileStringA("Message Log", "ExtraMicroLF", _itoa(M.GetByte("extramicrolf", 0), szBuf, 10), szIniFilename);
- for (i=0; i <= TMPL_ERRMSG; i++) {
+ for (i = 0; i <= TMPL_ERRMSG; i++) {
char *encoded;
if (dat == 0)
encoded = mir_utf8encodeT(LTR_Active.szTemplates[i]);
@@ -238,14 +239,14 @@ void TSAPI WriteThemeToINI(const TCHAR *szIniFilenameT, TWindowData *dat)
WritePrivateProfileStringA("RTLTemplates", TemplateNames[i], encoded, szIniFilename);
mir_free(encoded);
}
- for (i=0; i < CUSTOM_COLORS; i++) {
+ for (i = 0; i < CUSTOM_COLORS; i++) {
mir_snprintf(szTemp, SIZEOF(szTemp), "cc%d", i + 1);
if (dat == 0)
WritePrivateProfileStringA("Custom Colors", szTemp, _itoa(M.GetDword(szTemp, 0), szBuf, 10), szIniFilename);
else
WritePrivateProfileStringA("Custom Colors", szTemp, _itoa(dat->pContainer->theme.custom_colors[i], szBuf, 10), szIniFilename);
}
- for (i=0; i <= 7; i++)
+ for (i = 0; i <= 7; i++)
WritePrivateProfileStringA("Nick Colors", _itoa(i, szBuf, 10), _itoa(g_Settings.nickColors[i], szTemp, 10), szIniFilename);
mir_free(szIniFilename);
@@ -281,7 +282,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
n++;
continue;
}
- for (i=0; i < fontBlocks[n].iCount; i++) {
+ for (i = 0; i < fontBlocks[n].iCount; i++) {
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", firstIndex + i);
mir_snprintf(szAppname, SIZEOF(szAppname), fontBlocks[n].szIniTemp, firstIndex + i);
if (GetPrivateProfileStringA(szAppname, "Face", "Verdana", szBuf, sizeof(szBuf), szIniFilename) != 0) {
@@ -316,13 +317,13 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
if (dwFlags & THEME_READ_FONTS) {
COLORREF defclr;
- for (i=0; i < SIZEOF(_extSettings); i++) {
+ for (i = 0; i < SIZEOF(_extSettings); i++) {
db_set_dw(0, _extSettings[i].szDbModule, _extSettings[i].szDbSetting,
GetPrivateProfileIntA(_extSettings[i].szIniSection, _extSettings[i].szIniName, _extSettings[i].dwDef, szIniFilename));
}
if (version >= 5) {
- for (i=0; i < SIZEOF(_extSettings_v5); i++) {
+ for (i = 0; i < SIZEOF(_extSettings_v5); i++) {
db_set_dw(0, _extSettings_v5[i].szDbModule, _extSettings_v5[i].szDbSetting,
GetPrivateProfileIntA(_extSettings_v5[i].szIniSection, _extSettings_v5[i].szIniName, _extSettings_v5[i].dwDef, szIniFilename));
}
@@ -331,14 +332,14 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
db_set_b(0, SRMSGMOD_T, "wantvgrid", (BYTE)(GetPrivateProfileIntA("Message Log", "VGrid", 0, szIniFilename)));
db_set_b(0, SRMSGMOD_T, "extramicrolf", (BYTE)(GetPrivateProfileIntA("Message Log", "ExtraMicroLF", 0, szIniFilename)));
- for (i=0; i < CUSTOM_COLORS; i++) {
+ for (i = 0; i < CUSTOM_COLORS; i++) {
mir_snprintf(szTemp, SIZEOF(szTemp), "cc%d", i + 1);
if (dat == 0)
db_set_dw(0, SRMSGMOD_T, szTemp, GetPrivateProfileIntA("Custom Colors", szTemp, RGB(224, 224, 224), szIniFilename));
else
dat->theme.custom_colors[i] = GetPrivateProfileIntA("Custom Colors", szTemp, RGB(224, 224, 224), szIniFilename);
}
- for (i=0; i <= 7; i++) {
+ for (i = 0; i <= 7; i++) {
if (i == 5)
defclr = GetSysColor(COLOR_HIGHLIGHT);
else if (i == 6)
@@ -350,12 +351,13 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
db_set_dw(0, CHAT_MODULE, szTemp, g_Settings.nickColors[i]);
}
}
- } else {
+ }
+ else {
HDC hdc = GetDC(NULL);
int SY = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(NULL, hdc);
if (!noAdvanced) {
- for (i=0; i < MSGDLGFONTCOUNT; i++) {
+ for (i = 0; i < MSGDLGFONTCOUNT; i++) {
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i);
LoadLogfontFromINI(i, szTemp, &dat->theme.logFonts[i], &dat->theme.fontColors[i], szIniFilename);
wsprintfA(dat->theme.rtfFonts + (i * RTFCACHELINESIZE), "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", i, i, dat->theme.logFonts[i].lfWeight >= FW_BOLD ? 1 : 0, dat->theme.logFonts[i].lfItalic, dat->theme.logFonts[i].lfUnderline, 2 * abs(dat->theme.logFonts[i].lfHeight) * 74 / SY); //!!!!!!!!
@@ -379,7 +381,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
dat->theme.left_indent = GetPrivateProfileIntA("Message Log", "LeftIndent", 0, szIniFilename);
dat->theme.right_indent = GetPrivateProfileIntA("Message Log", "RightIndent", 0, szIniFilename);
- for (i=0; i < CUSTOM_COLORS; i++) {
+ for (i = 0; i < CUSTOM_COLORS; i++) {
mir_snprintf(szTemp, SIZEOF(szTemp), "cc%d", i + 1);
if (dat == 0)
db_set_dw(0, SRMSGMOD_T, szTemp, GetPrivateProfileIntA("Custom Colors", szTemp, RGB(224, 224, 224), szIniFilename));
@@ -390,7 +392,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
if (version >= 3) {
if (!noAdvanced && dwFlags & THEME_READ_TEMPLATES) {
- for (i=0; i <= TMPL_ERRMSG; i++) {
+ for (i = 0; i <= TMPL_ERRMSG; i++) {
wchar_t *decoded = 0;
GetPrivateProfileStringA("Templates", TemplateNames[i], "[undef]", szTemplateBuffer, TEMPLATE_LENGTH * 3, szIniFilename);
@@ -432,7 +434,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
const TCHAR* TSAPI GetThemeFileName(int iMode)
{
static TCHAR szFilename[MAX_PATH];
- OPENFILENAME ofn = {0};
+ OPENFILENAME ofn = { 0 };
TCHAR szInitialDir[MAX_PATH];
_tcsncpy_s(szInitialDir, M.getSkinPath(), _TRUNCATE);
@@ -455,7 +457,8 @@ const TCHAR* TSAPI GetThemeFileName(int iMode)
return szFilename;
else
return NULL;
- } else {
+ }
+ else {
if (GetSaveFileName(&ofn))
return szFilename;
else
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index 5968f7a805..010b1cab5e 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -40,16 +40,16 @@ CSkin* Skin = 0;
static void __inline gradientVertical(UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ubBlueFinal,
- ULONG ulBitmapHeight, UCHAR ubRed, UCHAR ubGreen, UCHAR ubBlue, UCHAR ubRed2,
- UCHAR ubGreen2, UCHAR ubBlue2, DWORD FLG_GRADIENT, BOOL transparent, UINT32 y, UCHAR *ubAlpha);
+ ULONG ulBitmapHeight, UCHAR ubRed, UCHAR ubGreen, UCHAR ubBlue, UCHAR ubRed2,
+ UCHAR ubGreen2, UCHAR ubBlue2, DWORD FLG_GRADIENT, BOOL transparent, UINT32 y, UCHAR *ubAlpha);
static void __inline gradientHorizontal(UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ubBlueFinal,
- ULONG ulBitmapWidth, UCHAR ubRed, UCHAR ubGreen, UCHAR ubBlue, UCHAR ubRed2,
- UCHAR ubGreen2, UCHAR ubBlue2, DWORD FLG_GRADIENT, BOOL transparent, UINT32 x, UCHAR *ubAlpha);
+ ULONG ulBitmapWidth, UCHAR ubRed, UCHAR ubGreen, UCHAR ubBlue, UCHAR ubRed2,
+ UCHAR ubGreen2, UCHAR ubBlue2, DWORD FLG_GRADIENT, BOOL transparent, UINT32 x, UCHAR *ubAlpha);
UINT nextButtonID;
-ButtonSet g_ButtonSet = {0};
+ButtonSet g_ButtonSet = { 0 };
#define NR_MAXSKINICONS 100
@@ -68,10 +68,10 @@ COLORREF CSkin::m_sideBarContainerBG;
BLENDFUNCTION CSkin::m_default_bf = { 0 };
bool CSkin::m_bClipBorder = false, CSkin::m_DisableScrollbars = false,
- CSkin::m_skinEnabled = false, CSkin::m_frameSkins = false;
+CSkin::m_skinEnabled = false, CSkin::m_frameSkins = false;
char CSkin::m_SkinnedFrame_left = 0, CSkin::m_SkinnedFrame_right = 0,
- CSkin::m_SkinnedFrame_bottom = 0, CSkin::m_SkinnedFrame_caption = 0;
+CSkin::m_SkinnedFrame_bottom = 0, CSkin::m_SkinnedFrame_caption = 0;
char CSkin::m_realSkinnedFrame_left = 0;
char CSkin::m_realSkinnedFrame_right = 0;
@@ -79,13 +79,13 @@ char CSkin::m_realSkinnedFrame_bottom = 0;
char CSkin::m_realSkinnedFrame_caption = 0;
int CSkin::m_titleBarLeftOff = 0, CSkin::m_titleButtonTopOff = 0, CSkin::m_captionOffset = 0, CSkin::m_captionPadding = 0,
- CSkin::m_titleBarRightOff = 0, CSkin::m_sidebarTopOffset = 0, CSkin::m_sidebarBottomOffset = 0, CSkin::m_bRoundedCorner = 0;
+CSkin::m_titleBarRightOff = 0, CSkin::m_sidebarTopOffset = 0, CSkin::m_sidebarBottomOffset = 0, CSkin::m_bRoundedCorner = 0;
CImageItem *CSkin::m_switchBarItem = 0, *CSkin::m_tabTop = 0, *CSkin::m_tabBottom = 0, *CSkin::m_tabGlowTop = 0, *CSkin::m_tabGlowBottom = 0;
bool CSkin::m_fAeroSkinsValid = false;
-SIZE CSkin::m_titleBarButtonSize = {0};
+SIZE CSkin::m_titleBarButtonSize = { 0 };
COLORREF CSkin::m_ContainerColorKey = 0, CSkin::m_dwmColorRGB = 0, CSkin::m_DefaultFontColor = 0;
HBRUSH CSkin::m_ContainerColorKeyBrush = 0, CSkin::m_MenuBGBrush = 0;
@@ -190,106 +190,106 @@ AeroEffect CSkin::m_aeroEffects[AERO_EFFECT_LAST] = {
// definition of the availbale skin items
CSkinItem SkinItems[] = {
- {_T("Container"), "TSKIN_Container", ID_EXTBKCONTAINER,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Toolbar"), "TSKIN_Container", ID_EXTBKBUTTONBAR,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("{-}Buttonpressed"), "TSKIN_BUTTONSPRESSED", ID_EXTBKBUTTONSPRESSED,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Buttonnotpressed"), "TSKIN_BUTTONSNPRESSED", ID_EXTBKBUTTONSNPRESSED,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Buttonmouseover"), "TSKIN_BUTTONSMOUSEOVER", ID_EXTBKBUTTONSMOUSEOVER,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Infopanelfield"), "TSKIN_INFOPANELFIELD", ID_EXTBKINFOPANEL,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Titlebutton"), "TSKIN_TITLEBUTTON", ID_EXTBKTITLEBUTTON,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Titlebuttonmouseover"), "TSKIN_TITLEBUTTONHOVER", ID_EXTBKTITLEBUTTONMOUSEOVER,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Titlebuttonpressed"), "TSKIN_TITLEBUTTONPRESSED", ID_EXTBKTITLEBUTTONPRESSED,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Tabpage"), "TSKIN_TABPAGE", ID_EXTBKTABPAGE,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Tabitem"), "TSKIN_TABITEM", ID_EXTBKTABITEM,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Tabitem_active"), "TSKIN_TABITEMACTIVE", ID_EXTBKTABITEMACTIVE,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Tabitem_bottom"), "TSKIN_TABITEMBOTTOM", ID_EXTBKTABITEMBOTTOM,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Tabitem_active_bottom"), "TSKIN_TABITEMACTIVEBOTTOM", ID_EXTBKTABITEMACTIVEBOTTOM,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Frame"), "TSKIN_FRAME", ID_EXTBKFRAME,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("MessageLog"), "TSKIN_MLOG", ID_EXTBKHISTORY,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("InputArea"), "TSKIN_INPUT", ID_EXTBKINPUTAREA,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("FrameInactive"), "TSKIN_FRAMEINACTIVE", ID_EXTBKFRAMEINACTIVE,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Tabitem_hottrack"), "TSKIN_TABITEMHOTTRACK", ID_EXTBKTABITEMHOTTRACK,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Tabitem_hottrack_bottom"), "TSKIN_TABITEMHOTTRACKBOTTOM", ID_EXTBKTABITEMHOTTRACKBOTTOM,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Statusbarpanel"), "TSKIN_STATUSBARPANEL", ID_EXTBKSTATUSBARPANEL,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Statusbar"), "TSKIN_STATUSBAR", ID_EXTBKSTATUSBAR,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("Userlist"), "TSKIN_USERLIST", ID_EXTBKUSERLIST,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
- }, {_T("InfoPanelBackground"), "TSKIN_INFOPANELBG", ID_EXTBKINFOPANELBG,
- 8, CLCDEFAULT_CORNER,
- 0xf0f0f0, 0x42b1ff, 1, CLCDEFAULT_TEXTCOLOR, 40, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE, 0, 0
- }, {_T("Sidebar Background"), "TSKIN_SIDEBARBG", ID_EXTBKSIDEBARBG,
- CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
- 0xb2e1ff, 0xb2e1ff, 1, CLCDEFAULT_TEXTCOLOR, 40, CLCDEFAULT_MRGN_LEFT,
- CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE, 0, 0
+ { _T("Container"), "TSKIN_Container", ID_EXTBKCONTAINER,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Toolbar"), "TSKIN_Container", ID_EXTBKBUTTONBAR,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("{-}Buttonpressed"), "TSKIN_BUTTONSPRESSED", ID_EXTBKBUTTONSPRESSED,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Buttonnotpressed"), "TSKIN_BUTTONSNPRESSED", ID_EXTBKBUTTONSNPRESSED,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Buttonmouseover"), "TSKIN_BUTTONSMOUSEOVER", ID_EXTBKBUTTONSMOUSEOVER,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Infopanelfield"), "TSKIN_INFOPANELFIELD", ID_EXTBKINFOPANEL,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Titlebutton"), "TSKIN_TITLEBUTTON", ID_EXTBKTITLEBUTTON,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Titlebuttonmouseover"), "TSKIN_TITLEBUTTONHOVER", ID_EXTBKTITLEBUTTONMOUSEOVER,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Titlebuttonpressed"), "TSKIN_TITLEBUTTONPRESSED", ID_EXTBKTITLEBUTTONPRESSED,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Tabpage"), "TSKIN_TABPAGE", ID_EXTBKTABPAGE,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Tabitem"), "TSKIN_TABITEM", ID_EXTBKTABITEM,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Tabitem_active"), "TSKIN_TABITEMACTIVE", ID_EXTBKTABITEMACTIVE,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Tabitem_bottom"), "TSKIN_TABITEMBOTTOM", ID_EXTBKTABITEMBOTTOM,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Tabitem_active_bottom"), "TSKIN_TABITEMACTIVEBOTTOM", ID_EXTBKTABITEMACTIVEBOTTOM,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Frame"), "TSKIN_FRAME", ID_EXTBKFRAME,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("MessageLog"), "TSKIN_MLOG", ID_EXTBKHISTORY,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("InputArea"), "TSKIN_INPUT", ID_EXTBKINPUTAREA,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("FrameInactive"), "TSKIN_FRAMEINACTIVE", ID_EXTBKFRAMEINACTIVE,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Tabitem_hottrack"), "TSKIN_TABITEMHOTTRACK", ID_EXTBKTABITEMHOTTRACK,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Tabitem_hottrack_bottom"), "TSKIN_TABITEMHOTTRACKBOTTOM", ID_EXTBKTABITEMHOTTRACKBOTTOM,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Statusbarpanel"), "TSKIN_STATUSBARPANEL", ID_EXTBKSTATUSBARPANEL,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Statusbar"), "TSKIN_STATUSBAR", ID_EXTBKSTATUSBAR,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("Userlist"), "TSKIN_USERLIST", ID_EXTBKUSERLIST,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ CLCDEFAULT_COLOR, CLCDEFAULT_COLOR2, CLCDEFAULT_COLOR2_TRANSPARENT, CLCDEFAULT_TEXTCOLOR, CLCDEFAULT_ALPHA, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
+ }, { _T("InfoPanelBackground"), "TSKIN_INFOPANELBG", ID_EXTBKINFOPANELBG,
+ 8, CLCDEFAULT_CORNER,
+ 0xf0f0f0, 0x42b1ff, 1, CLCDEFAULT_TEXTCOLOR, 40, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE, 0, 0
+ }, { _T("Sidebar Background"), "TSKIN_SIDEBARBG", ID_EXTBKSIDEBARBG,
+ CLCDEFAULT_GRADIENT, CLCDEFAULT_CORNER,
+ 0xb2e1ff, 0xb2e1ff, 1, CLCDEFAULT_TEXTCOLOR, 40, CLCDEFAULT_MRGN_LEFT,
+ CLCDEFAULT_MRGN_TOP, CLCDEFAULT_MRGN_RIGHT, CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE, 0, 0
}
};
@@ -302,7 +302,7 @@ static CSkinItem _defInfoPanel = {
static BYTE __inline percent_to_byte(UINT32 percent)
{
- return(BYTE)((FLOAT)(((FLOAT) percent) / 100) * 255);
+ return(BYTE)((FLOAT)(((FLOAT)percent) / 100) * 255);
}
static COLORREF __inline revcolref(COLORREF colref)
@@ -312,7 +312,7 @@ static COLORREF __inline revcolref(COLORREF colref)
static DWORD __inline argb_from_cola(COLORREF col, UINT32 alpha)
{
- return((BYTE) percent_to_byte(alpha) << 24 | col);
+ return((BYTE)percent_to_byte(alpha) << 24 | col);
}
@@ -353,12 +353,12 @@ void TSAPI DrawAlpha(HDC hDC, PRECT rc, DWORD clr_base, int alpha, DWORD clr_de
tvtx[orig].Red = (COLOR16)GetRValue(clr_base) << 8;
tvtx[orig].Blue = (COLOR16)GetBValue(clr_base) << 8;
tvtx[orig].Green = (COLOR16)GetGValue(clr_base) << 8;
- tvtx[orig].Alpha = (COLOR16) alpha << 8;
+ tvtx[orig].Alpha = (COLOR16)alpha << 8;
tvtx[dest].Red = (COLOR16)GetRValue(clr_dest) << 8;
tvtx[dest].Blue = (COLOR16)GetBValue(clr_dest) << 8;
tvtx[dest].Green = (COLOR16)GetGValue(clr_dest) << 8;
- tvtx[dest].Alpha = (COLOR16) alpha << 8;
+ tvtx[dest].Alpha = (COLOR16)alpha << 8;
grect.UpperLeft = 0;
grect.LowerRight = 1;
@@ -431,19 +431,21 @@ void TSAPI DrawAlpha(HDC hDC, PRECT rc, DWORD clr_base, int alpha, DWORD clr_de
int realx = x + realHeightHalf;
realx = realx > ulBitmapWidth ? ulBitmapWidth : realx;
gradientHorizontal(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapWidth, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, bGradient, clr_dest_trans, realx, &ubAlpha);
- } else if (bGradient & GRADIENT_TB || bGradient & GRADIENT_BT)
+ }
+ else if (bGradient & GRADIENT_TB || bGradient & GRADIENT_BT)
gradientVertical(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapHeight, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, bGradient, clr_dest_trans, y, &ubAlpha);
- float fAlphaFactor = (float) ubAlpha / (float) 0xff;
- ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
- } else {
+ float fAlphaFactor = (float)ubAlpha / (float)0xff;
+ ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
+ }
+ else {
ubAlpha = percent_to_byte(alpha);
ubRedFinal = ubRed;
ubGreenFinal = ubGreen;
ubBlueFinal = ubBlue;
- float fAlphaFactor = (float) ubAlpha / (float) 0xff;
+ float fAlphaFactor = (float)ubAlpha / (float)0xff;
- ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
+ ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
}
}
}
@@ -485,7 +487,7 @@ void TSAPI DrawAlpha(HDC hDC, PRECT rc, DWORD clr_base, int alpha, DWORD clr_de
for (int y = 0; y < ulBitmapHeight; y++) {
for (int x = 0; x < ulBitmapWidth; x++) {
- if (((((UINT32 *) pvBits)[x + y * ulBitmapWidth]) << 8) == 0xFF00FF00 || (y < ulBitmapHeight >> 1 && !(bCorner & CORNER_BL && bCorner & CORNER_ACTIVE)) || (y > ulBitmapHeight >> 2 && !(bCorner & CORNER_TL && bCorner & CORNER_ACTIVE))) {
+ if (((((UINT32 *)pvBits)[x + y * ulBitmapWidth]) << 8) == 0xFF00FF00 || (y < ulBitmapHeight >> 1 && !(bCorner & CORNER_BL && bCorner & CORNER_ACTIVE)) || (y > ulBitmapHeight >> 2 && !(bCorner & CORNER_TL && bCorner & CORNER_ACTIVE))) {
if (bGradient & GRADIENT_ACTIVE) {
if (bGradient & GRADIENT_LR || bGradient & GRADIENT_RL)
gradientHorizontal(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, realWidth, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, bGradient, clr_dest_trans, x, &ubAlpha);
@@ -493,15 +495,16 @@ void TSAPI DrawAlpha(HDC hDC, PRECT rc, DWORD clr_base, int alpha, DWORD clr_de
gradientVertical(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapHeight, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, bGradient, clr_dest_trans, y, &ubAlpha);
float fAlphaFactor = (float)ubAlpha / (float)0xff;
- ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
- } else {
+ ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
+ }
+ else {
ubAlpha = percent_to_byte(alpha);
ubRedFinal = ubRed;
ubGreenFinal = ubGreen;
ubBlueFinal = ubBlue;
float fAlphaFactor = (float)ubAlpha / (float)0xff;
- ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
+ ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
}
}
}
@@ -517,25 +520,27 @@ void TSAPI DrawAlpha(HDC hDC, PRECT rc, DWORD clr_base, int alpha, DWORD clr_de
for (int y = 0; y < ulBitmapHeight; y++) {
for (int x = 0; x < ulBitmapWidth; x++) {
- if (((((UINT32 *) pvBits)[x + y * ulBitmapWidth]) << 8) == 0xFF00FF00 || (y < ulBitmapHeight >> 1 && !(bCorner & CORNER_BR && bCorner & CORNER_ACTIVE)) || (y > ulBitmapHeight >> 1 && !(bCorner & CORNER_TR && bCorner & CORNER_ACTIVE))) {
+ if (((((UINT32 *)pvBits)[x + y * ulBitmapWidth]) << 8) == 0xFF00FF00 || (y < ulBitmapHeight >> 1 && !(bCorner & CORNER_BR && bCorner & CORNER_ACTIVE)) || (y > ulBitmapHeight >> 1 && !(bCorner & CORNER_TR && bCorner & CORNER_ACTIVE))) {
if (bGradient & GRADIENT_ACTIVE) {
if (bGradient & GRADIENT_LR || bGradient & GRADIENT_RL) {
int realx = x + realWidth;
realx = realx > realWidth ? realWidth : realx;
gradientHorizontal(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, realWidth, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, bGradient, clr_dest_trans, realx, &ubAlpha);
- } else if (bGradient & GRADIENT_TB || bGradient & GRADIENT_BT)
+ }
+ else if (bGradient & GRADIENT_TB || bGradient & GRADIENT_BT)
gradientVertical(&ubRedFinal, &ubGreenFinal, &ubBlueFinal, ulBitmapHeight, ubRed, ubGreen, ubBlue, ubRed2, ubGreen2, ubBlue2, bGradient, clr_dest_trans, y, &ubAlpha);
float fAlphaFactor = (float)ubAlpha / (float)0xff;
- ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
- } else {
+ ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
+ }
+ else {
ubAlpha = percent_to_byte(alpha);
ubRedFinal = ubRed;
ubGreenFinal = ubGreen;
ubBlueFinal = ubBlue;
float fAlphaFactor = (float)ubAlpha / (float)0xff;
- ((UINT32 *) pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
+ ((UINT32 *)pvBits)[x + y * ulBitmapWidth] = (ubAlpha << 24) | ((UCHAR)(ubRedFinal * fAlphaFactor) << 16) | ((UCHAR)(ubGreenFinal * fAlphaFactor) << 8) | ((UCHAR)(ubBlueFinal * fAlphaFactor));
}
}
}
@@ -674,41 +679,39 @@ void __fastcall CImageItem::Render(const HDC hdc, const RECT *rc, bool fIgnoreGl
else switch (m_bStretch) {
case IMAGE_STRETCH_H:
// tile image vertically, stretch to width
- {
- LONG top = rc->top;
+ {
+ LONG top = rc->top;
- do {
- if (top + m_height <= rc->bottom) {
- GdiAlphaBlend(hdc, rc->left, top, width, m_height, hdcSrc, srcOrigX, srcOrigY, m_width, m_height, m_bf);
- top += m_height;
- }
- else {
- GdiAlphaBlend(hdc, rc->left, top, width, rc->bottom - top, hdcSrc, srcOrigX, srcOrigY, m_width, rc->bottom - top, m_bf);
- break;
- }
+ do {
+ if (top + m_height <= rc->bottom) {
+ GdiAlphaBlend(hdc, rc->left, top, width, m_height, hdcSrc, srcOrigX, srcOrigY, m_width, m_height, m_bf);
+ top += m_height;
}
- while (true);
- }
- break;
+ else {
+ GdiAlphaBlend(hdc, rc->left, top, width, rc->bottom - top, hdcSrc, srcOrigX, srcOrigY, m_width, rc->bottom - top, m_bf);
+ break;
+ }
+ } while (true);
+ }
+ break;
case IMAGE_STRETCH_V:
// tile horizontally, stretch to height
- {
- LONG left = rc->left;
+ {
+ LONG left = rc->left;
- do {
- if (left + m_width <= rc->right) {
- GdiAlphaBlend(hdc, left, rc->top, m_width, height, hdcSrc, srcOrigX, srcOrigY, m_width, m_height, m_bf);
- left += m_width;
- }
- else {
- GdiAlphaBlend(hdc, left, rc->top, rc->right - left, height, hdcSrc, srcOrigX, srcOrigY, rc->right - left, m_height, m_bf);
- break;
- }
+ do {
+ if (left + m_width <= rc->right) {
+ GdiAlphaBlend(hdc, left, rc->top, m_width, height, hdcSrc, srcOrigX, srcOrigY, m_width, m_height, m_bf);
+ left += m_width;
}
- while (true);
- }
- break;
+ else {
+ GdiAlphaBlend(hdc, left, rc->top, rc->right - left, height, hdcSrc, srcOrigX, srcOrigY, rc->right - left, m_height, m_bf);
+ break;
+ }
+ } while (true);
+ }
+ break;
case IMAGE_STRETCH_B:
// stretch the image in both directions...
diff --git a/plugins/TabSRMM/src/themes.h b/plugins/TabSRMM/src/themes.h
index 9c022aa3e0..18433a6a4e 100644
--- a/plugins/TabSRMM/src/themes.h
+++ b/plugins/TabSRMM/src/themes.h
@@ -99,11 +99,11 @@ public:
}
CImageItem(BYTE bottom, BYTE left, BYTE top, BYTE right, HDC hdc, HBITMAP hbm, DWORD dwFlags,
- HBRUSH brush, BYTE alpha, LONG inner_height, LONG inner_width, LONG height, LONG width)
+ HBRUSH brush, BYTE alpha, LONG inner_height, LONG inner_width, LONG height, LONG width)
{
m_bBottom = bottom;
m_bLeft = left,
- m_bTop = top;
+ m_bTop = top;
m_bRight = right;
m_hdc = hdc;
m_hbm = hbm;
@@ -309,7 +309,7 @@ public:
static char m_realSkinnedFrame_left, m_realSkinnedFrame_right, m_realSkinnedFrame_bottom, m_realSkinnedFrame_caption;
static HPEN m_SkinLightShadowPen, m_SkinDarkShadowPen;
static int m_titleBarLeftOff, m_titleButtonTopOff, m_captionOffset, m_captionPadding,
- m_titleBarRightOff, m_sidebarTopOffset, m_sidebarBottomOffset, m_bRoundedCorner;
+ m_titleBarRightOff, m_sidebarTopOffset, m_sidebarBottomOffset, m_bRoundedCorner;
static SIZE m_titleBarButtonSize;
static int m_bAvatarBorderType;
static COLORREF m_avatarBorderClr, m_tmp_tb_low, m_tmp_tb_high;
@@ -333,7 +333,7 @@ public:
*/
static UINT m_aeroEffect; // effect id, initAeroEffect() is using it to set
- // the parameters below.
+ // the parameters below.
static AeroEffect m_aeroEffects[AERO_EFFECT_LAST];
static AeroEffect m_currentAeroEffect;
static AeroEffect* m_pCurrentAeroEffect;
@@ -342,7 +342,7 @@ public:
static COLORREF m_dwmColorRGB;
- static CImageItem *m_switchBarItem, *m_tabTop, *m_tabBottom, *m_tabGlowTop, *m_tabGlowBottom;
+ static CImageItem *m_switchBarItem, *m_tabTop, *m_tabBottom, *m_tabGlowTop, *m_tabGlowBottom;
static bool m_fAeroSkinsValid;
private:
diff --git a/plugins/TabSRMM/src/translator.cpp b/plugins/TabSRMM/src/translator.cpp
index 207287f787..5a789822fc 100644
--- a/plugins/TabSRMM/src/translator.cpp
+++ b/plugins/TabSRMM/src/translator.cpp
@@ -50,7 +50,7 @@ TOptionListItem m_lvItemsModPlus[] =
{ 0, NULL, 0, 0, 0, 0 }
};
-TOptionListItem m_lvItemsNEN [] =
+TOptionListItem m_lvItemsNEN[] =
{
{ 0, LPGENT("Show a preview of the event"), IDC_CHKPREVIEW, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bPreview, 1 },
{ 0, LPGENT("Don't announce event when message dialog is open"), IDC_CHKWINDOWCHECK, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bWindowCheck, 1 },
@@ -178,24 +178,24 @@ TOptionListItem m_lvItemsTab[] =
TOptionListItem* CTranslator::getTree(UINT id)
{
- switch(id) {
- case TREE_MODPLUS: return m_lvItemsModPlus;
- case TREE_NEN: return m_lvItemsNEN;
- case TREE_MSG: return m_lvItemsMsg;
- case TREE_LOG: return m_lvItemsLog;
- case TREE_TAB: return m_lvItemsTab;
+ switch (id) {
+ case TREE_MODPLUS: return m_lvItemsModPlus;
+ case TREE_NEN: return m_lvItemsNEN;
+ case TREE_MSG: return m_lvItemsMsg;
+ case TREE_LOG: return m_lvItemsLog;
+ case TREE_TAB: return m_lvItemsTab;
}
return 0;
}
TOptionListGroup* CTranslator::getGroupTree(UINT id)
{
- switch(id) {
- case TREE_MODPLUS: return m_lvGroupsModPlus;
- case TREE_NEN: return m_lvGroupsNEN;
- case TREE_MSG: return m_lvGroupsMsg;
- case TREE_LOG: return m_lvGroupsLog;
- case TREE_TAB: return m_lvGroupsTab;
+ switch (id) {
+ case TREE_MODPLUS: return m_lvGroupsModPlus;
+ case TREE_NEN: return m_lvGroupsNEN;
+ case TREE_MSG: return m_lvGroupsMsg;
+ case TREE_LOG: return m_lvGroupsLog;
+ case TREE_TAB: return m_lvGroupsTab;
}
return 0;
}
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp
index 2800e61076..852e3256ce 100644
--- a/plugins/TabSRMM/src/trayicon.cpp
+++ b/plugins/TabSRMM/src/trayicon.cpp
@@ -38,7 +38,7 @@ static TCHAR g_eventName[100];
static void TrayAnimThread(LPVOID)
{
int iAnimMode = (PluginConfig.m_AnimTrayIcons[0] && PluginConfig.m_AnimTrayIcons[1] && PluginConfig.m_AnimTrayIcons[2] &&
- PluginConfig.m_AnimTrayIcons[3]);
+ PluginConfig.m_AnimTrayIcons[3]);
DWORD dwElapsed = 0, dwAnimStep = 0;
HICON hIconDefault = iAnimMode ? PluginConfig.m_AnimTrayIcons[0] : PluginConfig.g_iconContainer;
DWORD idleTimer = 0;
@@ -83,8 +83,7 @@ static void TrayAnimThread(LPVOID)
if (idleTimer >= 2000) {
idleTimer = 0;
}
- }
- while (isAnimThreadRunning);
+ } while (isAnimThreadRunning);
CloseHandle(hEvent);
}
@@ -101,9 +100,9 @@ void TSAPI CreateTrayMenus(int mode)
PluginConfig.g_hMenuRecent = CreatePopupMenu();
PluginConfig.g_hMenuTrayContext = GetSubMenu(PluginConfig.g_hMenuContext, 6);
ModifyMenu(PluginConfig.g_hMenuTrayContext, 0, MF_BYPOSITION | MF_POPUP,
- (UINT_PTR)PluginConfig.g_hMenuFavorites, TranslateT("Favorites"));
+ (UINT_PTR)PluginConfig.g_hMenuFavorites, TranslateT("Favorites"));
ModifyMenu(PluginConfig.g_hMenuTrayContext, 2, MF_BYPOSITION | MF_POPUP,
- (UINT_PTR)PluginConfig.g_hMenuRecent, TranslateT("Recent sessions"));
+ (UINT_PTR)PluginConfig.g_hMenuRecent, TranslateT("Recent sessions"));
LoadFavoritesAndRecent();
}
else {
@@ -192,7 +191,7 @@ void TSAPI FlashTrayIcon(HICON hIcon)
void TSAPI AddContactToFavorites(MCONTACT hContact, const TCHAR *szNickname, const char *szProto, TCHAR *szStatus, WORD wStatus, HICON hIcon, BOOL mode, HMENU hMenu)
{
- MENUITEMINFO mii = {0};
+ MENUITEMINFO mii = { 0 };
TCHAR szMenuEntry[80];
TCHAR szFinalNick[100];
@@ -232,12 +231,12 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const TCHAR *szNickname, con
db_set_dw((MCONTACT)uid, SRMSGMOD_T, "isRecent", 0);
}
}
- addnew:
+ addnew:
db_set_dw(hContact, SRMSGMOD_T, "isRecent", time(NULL));
AppendMenu(hMenu, MF_BYCOMMAND, (UINT_PTR)hContact, szMenuEntry);
}
else if (hMenu == PluginConfig.g_hMenuFavorites) { // insert the item sorted...
- MENUITEMINFO mii2 = {0};
+ MENUITEMINFO mii2 = { 0 };
TCHAR szBuffer[142];
int i, c = GetMenuItemCount(PluginConfig.g_hMenuFavorites);
mii2.fMask = MIIM_STRING;
@@ -245,7 +244,7 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const TCHAR *szNickname, con
if (c == 0)
InsertMenu(PluginConfig.g_hMenuFavorites, 0, MF_BYPOSITION, (UINT_PTR)hContact, szMenuEntry);
else {
- for (i=0; i <= c; i++) {
+ for (i = 0; i <= c; i++) {
mii2.cch = 0;
mii2.dwTypeData = NULL;
GetMenuItemInfo(PluginConfig.g_hMenuFavorites, i, TRUE, &mii2);
@@ -306,16 +305,16 @@ void TSAPI LoadFavoritesAndRecent()
return;
}
- for (i=0; i < iIndex - 1; i++) {
+ for (i = 0; i < iIndex - 1; i++) {
for (j = 0; j < iIndex - 1; j++) {
- if (recentEntries[j].dwTimestamp > recentEntries[j+1].dwTimestamp) {
+ if (recentEntries[j].dwTimestamp > recentEntries[j + 1].dwTimestamp) {
RCENTRY rceTemp = recentEntries[j];
- recentEntries[j] = recentEntries[j+1];
- recentEntries[j+1] = rceTemp;
+ recentEntries[j] = recentEntries[j + 1];
+ recentEntries[j + 1] = rceTemp;
}
}
}
- for (i=0; i < iIndex; i++)
+ for (i = 0; i < iIndex; i++)
AddContactToFavorites(recentEntries[i].hContact, NULL, NULL, NULL, 0, 0, 1, PluginConfig.g_hMenuRecent);
delete[] recentEntries;
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp
index 7480ae94a2..e40fcbfadf 100644
--- a/plugins/TabSRMM/src/typingnotify.cpp
+++ b/plugins/TabSRMM/src/typingnotify.cpp
@@ -35,10 +35,10 @@ struct
}
static colorPicker[4] =
{
- { IDC_TYPEON_BG, "ON_BG", RGB(255,255,255)},
- { IDC_TYPEON_TX, "ON_TX", RGB(0,0,0)},
- { IDC_TYPEOFF_BG, "OFF_BG", RGB(255,255,255)},
- { IDC_TYPEOFF_TX, "OFF_TX", RGB(0,0,0)}
+ { IDC_TYPEON_BG, "ON_BG", RGB(255, 255, 255) },
+ { IDC_TYPEON_TX, "ON_TX", RGB(0, 0, 0) },
+ { IDC_TYPEOFF_BG, "OFF_BG", RGB(255, 255, 255) },
+ { IDC_TYPEOFF_TX, "OFF_TX", RGB(0, 0, 0) }
};
static INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM)
@@ -238,229 +238,229 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
break;
case WM_COMMAND:
- {
- WORD idCtrl = LOWORD(wParam), wNotifyCode = HIWORD(wParam);
+ {
+ WORD idCtrl = LOWORD(wParam), wNotifyCode = HIWORD(wParam);
+
+ if (wNotifyCode == CPN_COLOURCHANGED) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
+ }
+
+ switch (idCtrl) {
+ case IDC_USEWINCOLORS:
+ if (wNotifyCode == BN_CLICKED) {
+ bool bEnableOthers;
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_USEWINCOLORS)) {
+ newColorMode = COLOR_WINDOWS;
+ bEnableOthers = false;
+ }
+ else {
+ newColorMode = COLOR_OWN;
+ bEnableOthers = true;
+ }
+
+ for (i = 0; i < SIZEOF(colorPicker); i++)
+ Utils::enableDlgControl(hwndDlg, colorPicker[i].res, bEnableOthers);
+
+ Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, bEnableOthers);
- if (wNotifyCode == CPN_COLOURCHANGED) {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- return TRUE;
}
+ break;
- switch (idCtrl) {
- case IDC_USEWINCOLORS:
- if (wNotifyCode == BN_CLICKED) {
- bool bEnableOthers;
+ case IDC_USEPOPUPCOLORS:
+ if (wNotifyCode == BN_CLICKED) {
+ bool bEnableOthers;
- if (IsDlgButtonChecked(hwndDlg, IDC_USEWINCOLORS)) {
- newColorMode = COLOR_WINDOWS;
- bEnableOthers = false;
- }
- else {
- newColorMode = COLOR_OWN;
- bEnableOthers = true;
- }
+ if (IsDlgButtonChecked(hwndDlg, IDC_USEPOPUPCOLORS)) {
+ newColorMode = COLOR_POPUP;
+ bEnableOthers = false;
+ }
+ else {
+ newColorMode = COLOR_OWN;
+ bEnableOthers = true;
+ }
- for (i = 0; i < SIZEOF(colorPicker); i++)
- Utils::enableDlgControl(hwndDlg, colorPicker[i].res, bEnableOthers);
+ for (i = 0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++)
+ Utils::enableDlgControl(hwndDlg, colorPicker[i].res, bEnableOthers);
- Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, bEnableOthers);
+ Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, bEnableOthers);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
- case IDC_USEPOPUPCOLORS:
- if (wNotifyCode == BN_CLICKED) {
- bool bEnableOthers;
+ case IDC_ONEPOPUP:
+ case IDC_CLIST:
+ case IDC_DISABLED:
+ case IDC_SHOWMENU:
+ case IDC_START:
+ case IDC_STOP:
+ case IDC_WOCL:
+ if (wNotifyCode == BN_CLICKED)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- if (IsDlgButtonChecked(hwndDlg, IDC_USEPOPUPCOLORS)) {
- newColorMode = COLOR_POPUP;
- bEnableOthers = false;
+ case IDC_PREVIEW:
+ if (PluginConfig.g_bPopupAvail) {
+ POPUPDATAT ppd = { 0 };
+ for (i = 0; i < 2; i++) {
+ int notyping;
+ if (i == PROTOTYPE_CONTACTTYPING_OFF) {
+ _tcsncpy_s(ppd.lptzContactName, TranslateT("Contact"), _TRUNCATE);
+ _tcsncpy_s(ppd.lptzText, szStop, _TRUNCATE);
+ notyping = 1;
}
else {
- newColorMode = COLOR_OWN;
- bEnableOthers = true;
+ _tcsncpy_s(ppd.lptzContactName, TranslateT("Contact"), _TRUNCATE);
+ _tcsncpy_s(ppd.lptzText, szStart, _TRUNCATE);
+ notyping = 0;
}
- for (i = 0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++)
- Utils::enableDlgControl(hwndDlg, colorPicker[i].res, bEnableOthers);
-
- Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, bEnableOthers);
-
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
-
- case IDC_ONEPOPUP:
- case IDC_CLIST:
- case IDC_DISABLED:
- case IDC_SHOWMENU:
- case IDC_START:
- case IDC_STOP:
- case IDC_WOCL:
- if (wNotifyCode == BN_CLICKED)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+ switch (newColorMode) {
+ case COLOR_OWN:
+ ppd.colorText = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping + 1].res, CPM_GETCOLOUR, 0, 0);
+ ppd.colorBack = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping].res, CPM_GETCOLOUR, 0, 0);
+ break;
+ case COLOR_WINDOWS:
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ break;
+ case COLOR_POPUP:
+ default:
+ ppd.colorBack = ppd.colorText = 0;
+ break;
+ }
- case IDC_PREVIEW:
- if (PluginConfig.g_bPopupAvail) {
- POPUPDATAT ppd = { 0 };
- for (i = 0; i < 2; i++) {
- int notyping;
- if (i == PROTOTYPE_CONTACTTYPING_OFF) {
- _tcsncpy_s(ppd.lptzContactName, TranslateT("Contact"), _TRUNCATE);
- _tcsncpy_s(ppd.lptzText, szStop, _TRUNCATE);
- notyping = 1;
- }
- else {
- _tcsncpy_s(ppd.lptzContactName, TranslateT("Contact"), _TRUNCATE);
- _tcsncpy_s(ppd.lptzText, szStart, _TRUNCATE);
- notyping = 0;
- }
-
- switch (newColorMode) {
- case COLOR_OWN:
- ppd.colorText = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping + 1].res, CPM_GETCOLOUR, 0, 0);
- ppd.colorBack = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping].res, CPM_GETCOLOUR, 0, 0);
+ if (notyping)
+ switch (newTimeoutMode2) {
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = newTimeout2;
break;
- case COLOR_WINDOWS:
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
break;
- case COLOR_POPUP:
+ case TIMEOUT_POPUP:
default:
- ppd.colorBack = ppd.colorText = 0;
+ ppd.iSeconds = 0;
break;
- }
-
- if (notyping)
- switch (newTimeoutMode2) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = newTimeout2;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
- else
- switch (newTimeoutMode) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = newTimeout;
- break;
- case TIMEOUT_PROTO:
- ppd.iSeconds = 10;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
-
- ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
- ppd.lchContact = wParam;
- ppd.PluginWindowProc = NULL;
- ppd.PluginData = NULL;
- PUAddPopupT(&ppd);
}
+ else
+ switch (newTimeoutMode) {
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = newTimeout;
+ break;
+ case TIMEOUT_PROTO:
+ ppd.iSeconds = 10;
+ break;
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
+ break;
+ case TIMEOUT_POPUP:
+ default:
+ ppd.iSeconds = 0;
+ break;
+ }
+
+ ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
+ ppd.lchContact = wParam;
+ ppd.PluginWindowProc = NULL;
+ ppd.PluginData = NULL;
+ PUAddPopupT(&ppd);
}
- break;
+ }
+ break;
- case IDC_TIMEOUT_POPUP2:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode2 = TIMEOUT_POPUP;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_TIMEOUT_POPUP2:
+ if (wNotifyCode != BN_CLICKED)
break;
+ newTimeoutMode2 = TIMEOUT_POPUP;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case IDC_TIMEOUT_CUSTOM2:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode2 = TIMEOUT_CUSTOM;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 1);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_TIMEOUT_CUSTOM2:
+ if (wNotifyCode != BN_CLICKED)
break;
+ newTimeoutMode2 = TIMEOUT_CUSTOM;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 1);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case IDC_TIMEOUT_POPUP:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_POPUP;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_TIMEOUT_POPUP:
+ if (wNotifyCode != BN_CLICKED)
break;
+ newTimeoutMode = TIMEOUT_POPUP;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case IDC_TIMEOUT_PERMANENT:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_PERMANENT;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_TIMEOUT_PERMANENT:
+ if (wNotifyCode != BN_CLICKED)
break;
+ newTimeoutMode = TIMEOUT_PERMANENT;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case IDC_TIMEOUT_PERMANENT2:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode2 = TIMEOUT_PERMANENT;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_TIMEOUT_PERMANENT2:
+ if (wNotifyCode != BN_CLICKED)
break;
+ newTimeoutMode2 = TIMEOUT_PERMANENT;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case IDC_TIMEOUT_CUSTOM:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_CUSTOM;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 1);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_TIMEOUT_CUSTOM:
+ if (wNotifyCode != BN_CLICKED)
break;
+ newTimeoutMode = TIMEOUT_CUSTOM;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 1);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case IDC_TIMEOUT_PROTO:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_PROTO;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_TIMEOUT_PROTO:
+ if (wNotifyCode != BN_CLICKED)
break;
+ newTimeoutMode = TIMEOUT_PROTO;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case IDC_TIMEOUT_VALUE:
- case IDC_TIMEOUT_VALUE2:
- int newValue = GetDlgItemInt(hwndDlg, idCtrl, NULL, 0);
-
- if (wNotifyCode == EN_KILLFOCUS) {
- int oldValue;
-
- if (idCtrl == IDC_TIMEOUT_VALUE)
- oldValue = newTimeout;
- else
- oldValue = newTimeout2;
-
- if (newValue != oldValue)
- SetDlgItemInt(hwndDlg, idCtrl, oldValue, 0);
- return TRUE;
- }
- if (wNotifyCode != EN_CHANGE || (HWND)lParam != GetFocus())
- return TRUE;
+ case IDC_TIMEOUT_VALUE:
+ case IDC_TIMEOUT_VALUE2:
+ int newValue = GetDlgItemInt(hwndDlg, idCtrl, NULL, 0);
- if (newValue > TIMEOUT_MAXVALUE)
- newValue = TIMEOUT_MAXVALUE;
- else if (newValue < TIMEOUT_MINVALUE)
- newValue = TIMEOUT_MINVALUE;
+ if (wNotifyCode == EN_KILLFOCUS) {
+ int oldValue;
if (idCtrl == IDC_TIMEOUT_VALUE)
- newTimeout = newValue;
+ oldValue = newTimeout;
else
- newTimeout2 = newValue;
+ oldValue = newTimeout2;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ if (newValue != oldValue)
+ SetDlgItemInt(hwndDlg, idCtrl, oldValue, 0);
+ return TRUE;
}
+ if (wNotifyCode != EN_CHANGE || (HWND)lParam != GetFocus())
+ return TRUE;
+
+ if (newValue > TIMEOUT_MAXVALUE)
+ newValue = TIMEOUT_MAXVALUE;
+ else if (newValue < TIMEOUT_MINVALUE)
+ newValue = TIMEOUT_MINVALUE;
+
+ if (idCtrl == IDC_TIMEOUT_VALUE)
+ newTimeout = newValue;
+ else
+ newTimeout2 = newValue;
+
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- break;
+ }
+ break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index 84d96a5fbe..e0fa5dde0a 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -38,14 +38,14 @@ typedef std::basic_string<TCHAR> tstring;
static TRTFColorTable _rtf_ctable[] =
{
- { _T("red"), RGB(255, 0, 0), ID_FONT_RED },
- { _T("blue"), RGB(0, 0, 255), ID_FONT_BLUE },
- { _T("green"), RGB(0, 255, 0), ID_FONT_GREEN },
- { _T("magenta"), RGB(255, 0, 255), ID_FONT_MAGENTA },
- { _T("yellow"), RGB(255, 255, 0), ID_FONT_YELLOW },
- { _T("cyan"), RGB(0, 255, 255), ID_FONT_CYAN },
- { _T("black"), 0, ID_FONT_BLACK },
- { _T("white"), RGB(255, 255, 255), ID_FONT_WHITE },
+ { _T("red"), RGB(255, 0, 0), ID_FONT_RED },
+ { _T("blue"), RGB(0, 0, 255), ID_FONT_BLUE },
+ { _T("green"), RGB(0, 255, 0), ID_FONT_GREEN },
+ { _T("magenta"), RGB(255, 0, 255), ID_FONT_MAGENTA },
+ { _T("yellow"), RGB(255, 255, 0), ID_FONT_YELLOW },
+ { _T("cyan"), RGB(0, 255, 255), ID_FONT_CYAN },
+ { _T("black"), 0, ID_FONT_BLACK },
+ { _T("white"), RGB(255, 255, 255), ID_FONT_WHITE },
{ _T(""), 0, 0 }
};
@@ -80,8 +80,8 @@ TCHAR* Utils::FilterEventMarkers(TCHAR *wszText)
}
while (true) {
- if ((beginmark = text.find( _T("\xAA"))) != text.npos) {
- endmark = beginmark+2;
+ if ((beginmark = text.find(_T("\xAA"))) != text.npos) {
+ endmark = beginmark + 2;
if (endmark != text.npos && (endmark - beginmark) > 1) {
text.erase(beginmark, endmark - beginmark);
continue;
@@ -113,7 +113,7 @@ const TCHAR* Utils::FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOO
if (dwFlags & MWF_LOG_BBCODE) {
beginmark = 0;
while (true) {
- for (i=0; i < NR_CODES; i++) {
+ for (i = 0; i < NR_CODES; i++) {
if ((tempmark = message.find(w_bbcodes_begin[i], 0)) != message.npos)
break;
}
@@ -133,7 +133,7 @@ const TCHAR* Utils::FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOO
}
tstring colorname = message.substr(beginmark + 7, 8);
-search_again:
+ search_again:
bool clr_found = false;
for (int ii = 0; ii < rtf_ctable_size; ii++) {
if (!_tcsnicmp((TCHAR*)colorname.c_str(), rtf_ctable[ii].szName, mir_tstrlen(rtf_ctable[ii].szName))) {
@@ -173,7 +173,7 @@ search_again:
else goto invalid_code;
}
else {
-invalid_code:
+ invalid_code:
if (endmark != message.npos)
message.erase(endmark, 8);
if (closing != message.npos && closing < (size_t)endmark)
@@ -217,7 +217,7 @@ invalid_code:
if ((endmark = message.find(endmarker, beginmark + 1)) == message.npos)
break;
}
-ok:
+ ok:
if ((endmark - beginmark) < 2) {
beginmark++;
continue;
@@ -240,7 +240,7 @@ ok:
if (PluginConfig.g_SmileyAddAvail && (endmark > (beginmark + 1))) {
tstring smcode;
smcode.assign(message, beginmark, (endmark - beginmark) + 1);
- SMADD_BATCHPARSE2 smbp = {0};
+ SMADD_BATCHPARSE2 smbp = { 0 };
SMADD_BATCHPARSERES *smbpr;
smbp.cbSize = sizeof(smbp);
@@ -278,7 +278,7 @@ TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat)
tstring title(szFormat);
- for ( size_t curpos = 0; curpos < title.length(); ) {
+ for (size_t curpos = 0; curpos < title.length();) {
if (title[curpos] != '%') {
curpos++;
continue;
@@ -340,7 +340,7 @@ TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat)
BYTE xStatus = dat->cache->getXStatusId();
if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
if (!db_get_ts(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
_tcsncpy(szTemp, dbv.ptszVal, 500);
@@ -361,7 +361,7 @@ TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat)
TCHAR *szFinalStatus = NULL;
BYTE xStatus = dat->cache->getXStatusId();
if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
if (!db_get_ts(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) {
_tcsncpy(szTemp, dbv.ptszVal, 500);
@@ -382,7 +382,7 @@ TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat)
break;
}
- // status message (%T will skip the "No status message" for empty messages)
+ // status message (%T will skip the "No status message" for empty messages)
case 't':
case 'T': {
TCHAR *tszStatusMsg = dat->cache->getNormalizedStatusMsg(dat->cache->getStatusMsg(), true);
@@ -427,8 +427,8 @@ char* Utils::FilterEventMarkers(char *szText)
}
while (true) {
- if ((beginmark = text.find( "\xAA")) != text.npos) {
- endmark = beginmark+2;
+ if ((beginmark = text.find("\xAA")) != text.npos) {
+ endmark = beginmark + 2;
if (endmark != text.npos && (endmark - beginmark) > 1) {
text.erase(beginmark, endmark - beginmark);
continue;
@@ -449,10 +449,10 @@ const TCHAR* Utils::DoubleAmpersands(TCHAR *pszText)
size_t textPos = 0;
while (true) {
- if ((textPos = text.find(_T("&"),textPos)) != text.npos) {
- text.insert(textPos,_T("%"));
+ if ((textPos = text.find(_T("&"), textPos)) != text.npos) {
+ text.insert(textPos, _T("%"));
text.replace(textPos, 2, _T("&&"));
- textPos+=2;
+ textPos += 2;
continue;
}
break;
@@ -514,7 +514,7 @@ int Utils::FindRTLLocale(TWindowData *dat)
if (dat->iHaveRTLLang == 0) {
memset(layouts, 0, sizeof(layouts));
GetKeyboardLayoutList(20, layouts);
- for (i=0; i < 20 && layouts[i]; i++) {
+ for (i = 0; i < 20 && layouts[i]; i++) {
lcid = MAKELCID(LOWORD(layouts[i]), 0);
GetStringTypeA(lcid, CT_CTYPE2, "���", 3, wCtype2);
if (wCtype2[0] == C2_RIGHTTOLEFT || wCtype2[1] == C2_RIGHTTOLEFT || wCtype2[2] == C2_RIGHTTOLEFT)
@@ -640,7 +640,7 @@ void Utils::ContainerToSettings(TContainerData *pContainer)
void Utils::ReadPrivateContainerSettings(TContainerData *pContainer, bool fForce)
{
char szCname[50];
- TContainerSettings csTemp = {0};
+ TContainerSettings csTemp = { 0 };
mir_snprintf(szCname, SIZEOF(szCname), "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
Utils::ReadContainerSettingsFromDB(0, &csTemp, szCname);
@@ -733,7 +733,7 @@ HICON Utils::iconFromAvatar(const TWindowData *dat)
HBITMAP hbmResized = CSkin::ResizeBitmap(ace->hbmPic, (LONG)dNewWidth, (LONG)dNewHeight, fFree);
HIMAGELIST hIml_c = ::ImageList_Create(lIconSize, lIconSize, ILC_COLOR32 | ILC_MASK, 1, 0);
- RECT rc = {0, 0, lIconSize, lIconSize};
+ RECT rc = { 0, 0, lIconSize, lIconSize };
HDC hdc = ::GetDC(dat->pContainer->hwnd);
HDC dc = ::CreateCompatibleDC(hdc);
@@ -884,7 +884,7 @@ DWORD CALLBACK Utils::StreamOut(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG
// tszPath must end with \
bool Utils::extractResource(const HMODULE h, const UINT uID, const TCHAR *tszName, const TCHAR *tszPath,
- const TCHAR *tszFilename, bool fForceOverwrite)
+ const TCHAR *tszFilename, bool fForceOverwrite)
{
HRSRC hRes = FindResource(h, MAKEINTRESOURCE(uID), tszName);
if (hRes) {
@@ -918,7 +918,7 @@ bool Utils::extractResource(const HMODULE h, const UINT uID, const TCHAR *tszNam
TCHAR* Utils::extractURLFromRichEdit(const ENLINK* _e, const HWND hwndRich)
{
- CHARRANGE sel = {0};
+ CHARRANGE sel = { 0 };
::SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax)
return 0;
@@ -970,7 +970,7 @@ void Utils::sanitizeFilename(wchar_t* tszFilename)
static wchar_t *forbiddenCharacters = L"%/\\':|\"<>?";
static size_t forbiddenCharactersLen = mir_wstrlen(forbiddenCharacters);
- for (size_t i=0; i < forbiddenCharactersLen; i++) {
+ for (size_t i = 0; i < forbiddenCharactersLen; i++) {
wchar_t* szFound = 0;
while ((szFound = wcschr(tszFilename, (int)forbiddenCharacters[i])) != NULL)
@@ -1064,8 +1064,7 @@ void Utils::AddToFileList(TCHAR ***pppFiles, int *totalCount, LPCTSTR szFilename
mir_tstrcat(szPath, _T("\\"));
mir_tstrcat(szPath, fd.cFileName);
AddToFileList(pppFiles, totalCount, szPath);
- }
- while (FindNextFile(hFind, &fd));
+ } while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
}
@@ -1106,8 +1105,8 @@ static wchar_t* warnings[] = {
};
CWarning::CWarning(const wchar_t *tszTitle, const wchar_t *tszText, const UINT uId, const DWORD dwFlags) :
- m_szTitle( mir_wstrdup(tszTitle)),
- m_szText( mir_wstrdup(tszText))
+m_szTitle(mir_wstrdup(tszTitle)),
+m_szText(mir_wstrdup(tszText))
{
m_uId = uId;
m_hFontCaption = 0;
@@ -1243,7 +1242,7 @@ INT_PTR CALLBACK CWarning::stubDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
if (w)
return(w->dlgProc(hwnd, msg, wParam, lParam));
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
w = reinterpret_cast<CWarning *>(lParam);
if (w) {
@@ -1266,108 +1265,108 @@ INT_PTR CALLBACK CWarning::stubDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
*/
INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
- {
- HICON hIcon = 0;
- UINT uResId = 0;
- TCHAR temp[1024];
- SETTEXTEX stx = {ST_SELECTION, CP_UTF8};
- size_t pos = 0;
-
- m_hwnd = hwnd;
-
- ::SetWindowTextW(hwnd, TranslateT("TabSRMM warning message"));
- ::SendMessage(hwnd, WM_SETICON, ICON_BIG, LPARAM(::LoadSkinnedIconBig(SKINICON_OTHER_MIRANDA)));
- ::SendMessage(hwnd, WM_SETICON, ICON_SMALL, LPARAM(::LoadSkinnedIcon(SKINICON_OTHER_MIRANDA)));
- ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_AUTOURLDETECT, TRUE, 0);
- ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_SETEVENTMASK, 0, ENM_LINK);
-
- mir_sntprintf(temp, SIZEOF(temp), RTF_DEFAULT_HEADER, 0, 0, 0, 30*15);
- tstring *str = new tstring(temp);
-
- str->append(m_szText);
- str->append(L"}");
-
- TranslateDialogDefault(hwnd);
-
- /*
- * convert normal line breaks to rtf
- */
- while((pos = str->find(L"\n")) != str->npos) {
- str->erase(pos, 1);
- str->insert(pos, L"\\line ");
- }
+ {
+ HICON hIcon = 0;
+ UINT uResId = 0;
+ TCHAR temp[1024];
+ SETTEXTEX stx = { ST_SELECTION, CP_UTF8 };
+ size_t pos = 0;
+
+ m_hwnd = hwnd;
+
+ ::SetWindowTextW(hwnd, TranslateT("TabSRMM warning message"));
+ ::SendMessage(hwnd, WM_SETICON, ICON_BIG, LPARAM(::LoadSkinnedIconBig(SKINICON_OTHER_MIRANDA)));
+ ::SendMessage(hwnd, WM_SETICON, ICON_SMALL, LPARAM(::LoadSkinnedIcon(SKINICON_OTHER_MIRANDA)));
+ ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_AUTOURLDETECT, TRUE, 0);
+ ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_SETEVENTMASK, 0, ENM_LINK);
+
+ mir_sntprintf(temp, SIZEOF(temp), RTF_DEFAULT_HEADER, 0, 0, 0, 30 * 15);
+ tstring *str = new tstring(temp);
+
+ str->append(m_szText);
+ str->append(L"}");
+
+ TranslateDialogDefault(hwnd);
+
+ /*
+ * convert normal line breaks to rtf
+ */
+ while ((pos = str->find(L"\n")) != str->npos) {
+ str->erase(pos, 1);
+ str->insert(pos, L"\\line ");
+ }
- char *utf8 = mir_utf8encodeT(str->c_str());
- ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)utf8);
- mir_free(utf8);
- delete str;
+ char *utf8 = mir_utf8encodeT(str->c_str());
+ ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)utf8);
+ mir_free(utf8);
+ delete str;
- ::SetDlgItemTextW(hwnd, IDC_CAPTION, m_szTitle);
+ ::SetDlgItemTextW(hwnd, IDC_CAPTION, m_szTitle);
- if (m_dwFlags & CWF_NOALLOWHIDE)
- Utils::showDlgControl(hwnd, IDC_DONTSHOWAGAIN, SW_HIDE);
- if (m_dwFlags & MB_YESNO || m_dwFlags & MB_YESNOCANCEL) {
- Utils::showDlgControl(hwnd, IDOK, SW_HIDE);
- ::SetFocus(::GetDlgItem(hwnd, IDCANCEL));
- }
- else {
- Utils::showDlgControl(hwnd, IDCANCEL, SW_HIDE);
- Utils::showDlgControl(hwnd, IDYES, SW_HIDE);
- Utils::showDlgControl(hwnd, IDNO, SW_HIDE);
- ::SetFocus(::GetDlgItem(hwnd, IDOK));
- }
- if (m_dwFlags & MB_ICONERROR || m_dwFlags & MB_ICONHAND)
- uResId = 32513;
- else if (m_dwFlags & MB_ICONEXCLAMATION || m_dwFlags & MB_ICONWARNING)
- uResId = 32515;
- else if (m_dwFlags & MB_ICONASTERISK || m_dwFlags & MB_ICONINFORMATION)
- uResId = 32516;
- else if (m_dwFlags & MB_ICONQUESTION)
- uResId = 32514;
-
- if (uResId)
- hIcon = reinterpret_cast<HICON>(::LoadImage(0, MAKEINTRESOURCE(uResId), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
- else
- hIcon = ::LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE);
+ if (m_dwFlags & CWF_NOALLOWHIDE)
+ Utils::showDlgControl(hwnd, IDC_DONTSHOWAGAIN, SW_HIDE);
+ if (m_dwFlags & MB_YESNO || m_dwFlags & MB_YESNOCANCEL) {
+ Utils::showDlgControl(hwnd, IDOK, SW_HIDE);
+ ::SetFocus(::GetDlgItem(hwnd, IDCANCEL));
+ }
+ else {
+ Utils::showDlgControl(hwnd, IDCANCEL, SW_HIDE);
+ Utils::showDlgControl(hwnd, IDYES, SW_HIDE);
+ Utils::showDlgControl(hwnd, IDNO, SW_HIDE);
+ ::SetFocus(::GetDlgItem(hwnd, IDOK));
+ }
+ if (m_dwFlags & MB_ICONERROR || m_dwFlags & MB_ICONHAND)
+ uResId = 32513;
+ else if (m_dwFlags & MB_ICONEXCLAMATION || m_dwFlags & MB_ICONWARNING)
+ uResId = 32515;
+ else if (m_dwFlags & MB_ICONASTERISK || m_dwFlags & MB_ICONINFORMATION)
+ uResId = 32516;
+ else if (m_dwFlags & MB_ICONQUESTION)
+ uResId = 32514;
+
+ if (uResId)
+ hIcon = reinterpret_cast<HICON>(::LoadImage(0, MAKEINTRESOURCE(uResId), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
+ else
+ hIcon = ::LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE);
- ::SendDlgItemMessageW(hwnd, IDC_WARNICON, STM_SETICON, reinterpret_cast<WPARAM>(hIcon), 0);
- if (!(m_dwFlags & MB_YESNO || m_dwFlags & MB_YESNOCANCEL))
- ::ShowWindow(hwnd, SW_SHOWNORMAL);
+ ::SendDlgItemMessageW(hwnd, IDC_WARNICON, STM_SETICON, reinterpret_cast<WPARAM>(hIcon), 0);
+ if (!(m_dwFlags & MB_YESNO || m_dwFlags & MB_YESNOCANCEL))
+ ::ShowWindow(hwnd, SW_SHOWNORMAL);
- WindowList_Add(hWindowList, hwnd, (MCONTACT)hwnd);
- }
- return TRUE;
+ WindowList_Add(hWindowList, hwnd, (MCONTACT)hwnd);
+ }
+ return TRUE;
case WM_CTLCOLORSTATIC:
- {
- HWND hwndChild = reinterpret_cast<HWND>(lParam);
- UINT id = ::GetDlgCtrlID(hwndChild);
- if (0 == m_hFontCaption) {
- HFONT hFont = reinterpret_cast<HFONT>(::SendDlgItemMessage(hwnd, IDC_CAPTION, WM_GETFONT, 0, 0));
- LOGFONT lf = {0};
-
- ::GetObject(hFont, sizeof(lf), &lf);
- lf.lfHeight = (int)((double)lf.lfHeight * 1.7f);
- m_hFontCaption = ::CreateFontIndirect(&lf);
- ::SendDlgItemMessage(hwnd, IDC_CAPTION, WM_SETFONT, (WPARAM)m_hFontCaption, FALSE);
- }
+ {
+ HWND hwndChild = reinterpret_cast<HWND>(lParam);
+ UINT id = ::GetDlgCtrlID(hwndChild);
+ if (0 == m_hFontCaption) {
+ HFONT hFont = reinterpret_cast<HFONT>(::SendDlgItemMessage(hwnd, IDC_CAPTION, WM_GETFONT, 0, 0));
+ LOGFONT lf = { 0 };
+
+ ::GetObject(hFont, sizeof(lf), &lf);
+ lf.lfHeight = (int)((double)lf.lfHeight * 1.7f);
+ m_hFontCaption = ::CreateFontIndirect(&lf);
+ ::SendDlgItemMessage(hwnd, IDC_CAPTION, WM_SETFONT, (WPARAM)m_hFontCaption, FALSE);
+ }
- if (IDC_CAPTION == id) {
- ::SetTextColor(reinterpret_cast<HDC>(wParam), ::GetSysColor(COLOR_HIGHLIGHT));
- ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_hFontCaption, FALSE);
- }
+ if (IDC_CAPTION == id) {
+ ::SetTextColor(reinterpret_cast<HDC>(wParam), ::GetSysColor(COLOR_HIGHLIGHT));
+ ::SendMessage(hwndChild, WM_SETFONT, (WPARAM)m_hFontCaption, FALSE);
+ }
- if (IDC_WARNGROUP != id && IDC_DONTSHOWAGAIN != id) {
- ::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
- return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
- }
+ if (IDC_WARNGROUP != id && IDC_DONTSHOWAGAIN != id) {
+ ::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
+ return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
}
- break;
+ }
+ break;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
case IDYES:
@@ -1400,9 +1399,9 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
break;
case WM_NOTIFY:
- switch (((NMHDR*) lParam)->code) {
+ switch (((NMHDR*)lParam)->code) {
case EN_LINK:
- switch (((ENLINK*) lParam)->msg) {
+ switch (((ENLINK*)lParam)->msg) {
case WM_LBUTTONUP:
ENLINK *e = reinterpret_cast<ENLINK *>(lParam);
diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h
index 4e210597b3..b37a022c27 100644
--- a/plugins/TabSRMM/src/utils.h
+++ b/plugins/TabSRMM/src/utils.h
@@ -38,9 +38,9 @@
struct TRTFColorTable
{
- TCHAR szName[10];
- COLORREF clr;
- int menuid;
+ TCHAR szName[10];
+ COLORREF clr;
+ int menuid;
};
class Utils {
@@ -109,7 +109,7 @@ public:
{
size_t s = 0;
- while(s < maxlen && *(src++))
+ while (s < maxlen && *(src++))
s++;
return (s >= maxlen && *src != 0) ? 0 : s;
@@ -137,24 +137,24 @@ public:
* the warning IDs
*/
enum {
- WARN_RELNOTES = 0,
- WARN_ICONPACK_VERSION = 1,
- WARN_EDITUSERNOTES = 2,
- WARN_ICONPACKMISSING = 3,
- WARN_AEROPEEK_SKIN = 4,
- WARN_SENDFILE = 5,
- WARN_HPP_APICHECK = 6,
- WARN_NO_SENDLATER = 7,
- WARN_CLOSEWINDOW = 8,
- WARN_OPTION_CLOSE = 9,
- WARN_THEME_OVERWRITE = 10,
- WARN_LAST = 11
+ WARN_RELNOTES = 0,
+ WARN_ICONPACK_VERSION = 1,
+ WARN_EDITUSERNOTES = 2,
+ WARN_ICONPACKMISSING = 3,
+ WARN_AEROPEEK_SKIN = 4,
+ WARN_SENDFILE = 5,
+ WARN_HPP_APICHECK = 6,
+ WARN_NO_SENDLATER = 7,
+ WARN_CLOSEWINDOW = 8,
+ WARN_OPTION_CLOSE = 9,
+ WARN_THEME_OVERWRITE = 10,
+ WARN_LAST = 11
};
// the flags(low word is reserved for default windows flags like MB_OK etc.
enum {
CWF_UNTRANSLATED = 0x00010000, // do not translate the msg (useful for some error messages)
- CWF_NOALLOWHIDE = 0x00020000 // critical message, hide the "do not show this again" check box
+ CWF_NOALLOWHIDE = 0x00020000 // critical message, hide the "do not show this again" check box
};
CWarning(const wchar_t* tszTitle, const wchar_t* tszText, const UINT uId, const DWORD dwFlags);