summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-04 16:05:07 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-04 16:05:07 +0000
commitd4eaaec055bbdc940f5758cc1fd7b22b2cb105d8 (patch)
tree7130325db52e44fbe8e0daac05b9fbee0d94f2c4 /plugins/TabSRMM/src
parenteabc40e7c9cc64ae9a24f05fa5ed553e0d181a63 (diff)
further code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@3883 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/chat/colorchooser.cpp159
-rw-r--r--plugins/TabSRMM/src/chat/log.cpp460
-rw-r--r--plugins/TabSRMM/src/chat/message.cpp302
-rw-r--r--plugins/TabSRMM/src/chat/options.cpp979
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp328
-rw-r--r--plugins/TabSRMM/src/container.cpp1
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp386
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp80
-rw-r--r--plugins/TabSRMM/src/themes.cpp485
9 files changed, 1455 insertions, 1725 deletions
diff --git a/plugins/TabSRMM/src/chat/colorchooser.cpp b/plugins/TabSRMM/src/chat/colorchooser.cpp
index 72366db24b..2bf8b4ded2 100644
--- a/plugins/TabSRMM/src/chat/colorchooser.cpp
+++ b/plugins/TabSRMM/src/chat/colorchooser.cpp
@@ -81,101 +81,97 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
static HWND hPreviousActiveWindow;
switch (msg) {
- case WM_INITDIALOG: {
- RECT rc;
- int iSquareRoot;
- int width ;
- int height;
-
- TranslateDialogDefault(hwndDlg);
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ {
pCC = (COLORCHOOSER*) lParam;
iCurrentHotTrack = -2;
bChoosing = FALSE;
- iSquareRoot = (int)sqrt(static_cast<float>(pCC->pModule->nColorCount));
+ int iSquareRoot = (int)sqrt(static_cast<float>(pCC->pModule->nColorCount));
iColumns = iSquareRoot * iSquareRoot == pCC->pModule->nColorCount ? iSquareRoot : iSquareRoot + 1;
iRows = iSquareRoot;
+ RECT rc;
rc.top = rc.left = 100;
rc.right = 100 + iColumns * 25 + 1;
rc.bottom = iRows * 20 + 100 + 20;
AdjustWindowRectEx(&rc, GetWindowLongPtr(hwndDlg, GWL_STYLE), FALSE, GetWindowLongPtr(hwndDlg, GWL_EXSTYLE));
- width = rc.right - rc.left;
- height = rc.bottom - rc.top;
+ int width = rc.right - rc.left;
+ int height = rc.bottom - rc.top;
pCC->yPosition -= height;
-
- SetDlgItemText(hwndDlg, IDC_COLORTEXT, pCC->bForeground ? TranslateT("Text color") :
- TranslateT("Background color"));
+ SetDlgItemText(hwndDlg, IDC_COLORTEXT, pCC->bForeground ? TranslateT("Text color") : TranslateT("Background color"));
SetWindowPos(GetDlgItem(hwndDlg, IDC_COLORTEXT), NULL, 0, 0, width, 20, 0);
SetWindowPos(hwndDlg, NULL, pCC->xPosition, pCC->yPosition, width, height, SWP_SHOWWINDOW);
}
break;
- case WM_CTLCOLOREDIT:
- case WM_CTLCOLORSTATIC:
- if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_COLORTEXT)) {
- SetTextColor((HDC)wParam, RGB(60, 60, 150));
- SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
- return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
- }
- break;
+ case WM_CTLCOLOREDIT:
+ case WM_CTLCOLORSTATIC:
+ if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_COLORTEXT)) {
+ SetTextColor((HDC)wParam, RGB(60, 60, 150));
+ SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+ return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
+ }
+ break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- if (iCurrentHotTrack >= 0)
- PostMessage(hwndDlg, WM_LBUTTONUP, 0, 0);
- break;
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
- }
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ if (iCurrentHotTrack >= 0)
+ PostMessage(hwndDlg, WM_LBUTTONUP, 0, 0);
+ break;
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
break;
+ }
+ break;
- case WM_LBUTTONUP:
- if (iCurrentHotTrack >= 0 && iCurrentHotTrack < pCC->pModule->nColorCount && pCC->hWndTarget != NULL) {
- HWND hWindow;
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = 0;
- cf.dwEffects = 0;
- hWindow = GetParent(pCC->hWndTarget);
-
- if (pCC->bForeground) {
- pCC->si->bFGSet = TRUE;
- pCC->si->iFG = iCurrentHotTrack;
- if (IsDlgButtonChecked(hWindow, IDC_COLOR)) {
- cf.dwMask = CFM_COLOR;
- cf.crTextColor = pCC->pModule->crColors[iCurrentHotTrack];
- SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- } else {
- pCC->si->bBGSet = TRUE;
- pCC->si->iBG = iCurrentHotTrack;
- if (IsDlgButtonChecked(hWindow, IDC_BKGCOLOR)) {
- cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = pCC->pModule->crColors[iCurrentHotTrack];
- SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
+ case WM_LBUTTONUP:
+ if (iCurrentHotTrack >= 0 && iCurrentHotTrack < pCC->pModule->nColorCount && pCC->hWndTarget != NULL) {
+ HWND hWindow;
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = 0;
+ cf.dwEffects = 0;
+ hWindow = GetParent(pCC->hWndTarget);
+
+ if (pCC->bForeground) {
+ pCC->si->bFGSet = TRUE;
+ pCC->si->iFG = iCurrentHotTrack;
+ if (IsDlgButtonChecked(hWindow, IDC_COLOR)) {
+ cf.dwMask = CFM_COLOR;
+ cf.crTextColor = pCC->pModule->crColors[iCurrentHotTrack];
+ SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ }
+ } else {
+ pCC->si->bBGSet = TRUE;
+ pCC->si->iBG = iCurrentHotTrack;
+ if (IsDlgButtonChecked(hWindow, IDC_BKGCOLOR)) {
+ cf.dwMask = CFM_BACKCOLOR;
+ cf.crBackColor = pCC->pModule->crColors[iCurrentHotTrack];
+ SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
- PostMessage(hwndDlg, WM_CLOSE, 0, 0);
- break;
+ }
+ PostMessage(hwndDlg, WM_CLOSE, 0, 0);
+ break;
- case WM_ACTIVATE:
- if (wParam == WA_INACTIVE)
- PostMessage(hwndDlg, WM_CLOSE, 0, 0);
- else if ((wParam == WA_ACTIVE) || (wParam == WA_CLICKACTIVE))
- hPreviousActiveWindow = (HWND)lParam;
- break;
+ case WM_ACTIVATE:
+ if (wParam == WA_INACTIVE)
+ PostMessage(hwndDlg, WM_CLOSE, 0, 0);
+ else if ((wParam == WA_ACTIVE) || (wParam == WA_CLICKACTIVE))
+ hPreviousActiveWindow = (HWND)lParam;
+ break;
- case WM_MOUSEMOVE: {
+ case WM_MOUSEMOVE:
+ {
HDC hdc = GetDC(hwndDlg);
POINT pt;
RECT rect;
@@ -207,26 +203,22 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
break;
- case WM_PAINT: {
+ case WM_PAINT:
+ {
PAINTSTRUCT ps;
- HDC hdc;
- RECT rc;
- int i = 0;
int iThisRow = 1;
int iThisColumn = 0;
+ RECT rc;
GetClientRect(hwndDlg, &rc);
-
rc.top += 20;
- hdc = BeginPaint(hwndDlg, &ps);
+ HDC hdc = BeginPaint(hwndDlg, &ps);
// fill background
FillRect(hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
- for (i; i < pCC->pModule->nColorCount; i++) {
- HBRUSH hbr;
-
+ for (int i=0; i < pCC->pModule->nColorCount; i++) {
// decide place to draw the color block in the window
iThisColumn ++;
if (iThisColumn > iColumns) {
@@ -234,8 +226,7 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
iThisRow++;
}
- if (pCC->bForeground && pCC->si->bFGSet && pCC->si->iFG == i ||
- !pCC->bForeground && pCC->si->bBGSet && pCC->si->iBG == i) {
+ if (pCC->bForeground && pCC->si->bFGSet && pCC->si->iFG == i || !pCC->bForeground && pCC->si->bBGSet && pCC->si->iBG == i) {
rc.top = (iThisRow - 1) * 20 + 1 + 20 ;
rc.left = (iThisColumn - 1) * 25 + 1 + 1 ;
rc.bottom = iThisRow * 20 - 1 + 20 ;
@@ -251,7 +242,7 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
FillRect(hdc, &rc, CSkin::m_BrushBack);
- hbr = CreateSolidBrush(pCC->pModule->crColors[i]);
+ HBRUSH hbr = CreateSolidBrush(pCC->pModule->crColors[i]);
rc.top = (iThisRow - 1) * 20 + 4 + 20;
rc.left = (iThisColumn - 1) * 25 + 4 + 1;
@@ -267,14 +258,14 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
break;
- case WM_CLOSE:
- SetFocus(pCC->hWndTarget);
- DestroyWindow(hwndDlg);
- break;
+ case WM_CLOSE:
+ SetFocus(pCC->hWndTarget);
+ DestroyWindow(hwndDlg);
+ break;
- case WM_DESTROY:
- mir_free(pCC);
- return TRUE;
+ case WM_DESTROY:
+ mir_free(pCC);
+ return TRUE;
}
return FALSE;
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp
index 57b6fadff8..9aa450af3d 100644
--- a/plugins/TabSRMM/src/chat/log.cpp
+++ b/plugins/TabSRMM/src/chat/log.cpp
@@ -344,34 +344,34 @@ static void LogEventIEView(LOGSTREAMDATA *streamData, TCHAR *ptszNick)
static int EventToIndex(LOGINFO * lin)
{
switch (lin->iType) {
- case GC_EVENT_MESSAGE:
- if (lin->bIsMe)
- return 10;
- else
- return 9;
-
- case GC_EVENT_JOIN:
- return 3;
- case GC_EVENT_PART:
- return 4;
- case GC_EVENT_QUIT:
- return 5;
- case GC_EVENT_NICK:
- return 7;
- case GC_EVENT_KICK:
- return 6;
- case GC_EVENT_NOTICE:
- return 8;
- case GC_EVENT_TOPIC:
- return 11;
- case GC_EVENT_INFORMATION:
- return 12;
- case GC_EVENT_ADDSTATUS:
- return 13;
- case GC_EVENT_REMOVESTATUS:
- return 14;
- case GC_EVENT_ACTION:
- return 15;
+ case GC_EVENT_MESSAGE:
+ if (lin->bIsMe)
+ return 10;
+ else
+ return 9;
+
+ case GC_EVENT_JOIN:
+ return 3;
+ case GC_EVENT_PART:
+ return 4;
+ case GC_EVENT_QUIT:
+ return 5;
+ case GC_EVENT_NICK:
+ return 7;
+ case GC_EVENT_KICK:
+ return 6;
+ case GC_EVENT_NOTICE:
+ return 8;
+ case GC_EVENT_TOPIC:
+ return 11;
+ case GC_EVENT_INFORMATION:
+ return 12;
+ case GC_EVENT_ADDSTATUS:
+ return 13;
+ case GC_EVENT_REMOVESTATUS:
+ return 14;
+ case GC_EVENT_ACTION:
+ return 15;
}
return 0;
}
@@ -379,28 +379,28 @@ static int EventToIndex(LOGINFO * lin)
static BYTE EventToSymbol(LOGINFO *lin)
{
switch (lin->iType) {
- case GC_EVENT_MESSAGE:
- return (lin->bIsMe) ? 0x37 : 0x38;
- case GC_EVENT_JOIN:
- return 0x34;
- case GC_EVENT_PART:
- return 0x33;
- case GC_EVENT_QUIT:
- return 0x39;
- case GC_EVENT_NICK:
- return 0x71;
- case GC_EVENT_KICK:
- return 0x72;
- case GC_EVENT_NOTICE:
- return 0x28;
- case GC_EVENT_INFORMATION:
- return 0x69;
- case GC_EVENT_ADDSTATUS:
- return 0x35;
- case GC_EVENT_REMOVESTATUS:
- return 0x36;
- case GC_EVENT_ACTION:
- return 0x60;
+ case GC_EVENT_MESSAGE:
+ return (lin->bIsMe) ? 0x37 : 0x38;
+ case GC_EVENT_JOIN:
+ return 0x34;
+ case GC_EVENT_PART:
+ return 0x33;
+ case GC_EVENT_QUIT:
+ return 0x39;
+ case GC_EVENT_NICK:
+ return 0x71;
+ case GC_EVENT_KICK:
+ return 0x72;
+ case GC_EVENT_NOTICE:
+ return 0x28;
+ case GC_EVENT_INFORMATION:
+ return 0x69;
+ case GC_EVENT_ADDSTATUS:
+ return 0x35;
+ case GC_EVENT_REMOVESTATUS:
+ return 0x36;
+ case GC_EVENT_ACTION:
+ return 0x60;
}
return 0x73;
}
@@ -408,34 +408,34 @@ static BYTE EventToSymbol(LOGINFO *lin)
static int EventToIcon(LOGINFO * lin)
{
switch (lin->iType) {
- case GC_EVENT_MESSAGE:
- if (lin->bIsMe)
- return ICON_MESSAGEOUT;
- else
- return ICON_MESSAGE;
-
- case GC_EVENT_JOIN:
- return ICON_JOIN;
- case GC_EVENT_PART:
- return ICON_PART;
- case GC_EVENT_QUIT:
- return ICON_QUIT;
- case GC_EVENT_NICK:
- return ICON_NICK;
- case GC_EVENT_KICK:
- return ICON_KICK;
- case GC_EVENT_NOTICE:
- return ICON_NOTICE;
- case GC_EVENT_TOPIC:
- return ICON_TOPIC;
- case GC_EVENT_INFORMATION:
- return ICON_INFO;
- case GC_EVENT_ADDSTATUS:
- return ICON_ADDSTATUS;
- case GC_EVENT_REMOVESTATUS:
- return ICON_REMSTATUS;
- case GC_EVENT_ACTION:
- return ICON_ACTION;
+ case GC_EVENT_MESSAGE:
+ if (lin->bIsMe)
+ return ICON_MESSAGEOUT;
+ else
+ return ICON_MESSAGE;
+
+ case GC_EVENT_JOIN:
+ return ICON_JOIN;
+ case GC_EVENT_PART:
+ return ICON_PART;
+ case GC_EVENT_QUIT:
+ return ICON_QUIT;
+ case GC_EVENT_NICK:
+ return ICON_NICK;
+ case GC_EVENT_KICK:
+ return ICON_KICK;
+ case GC_EVENT_NOTICE:
+ return ICON_NOTICE;
+ case GC_EVENT_TOPIC:
+ return ICON_TOPIC;
+ case GC_EVENT_INFORMATION:
+ return ICON_INFO;
+ case GC_EVENT_ADDSTATUS:
+ return ICON_ADDSTATUS;
+ case GC_EVENT_REMOVESTATUS:
+ return ICON_REMSTATUS;
+ case GC_EVENT_ACTION:
+ return ICON_ACTION;
}
return 0;
}
@@ -557,61 +557,61 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff
szTemp[0] = '\0';
switch (*++line) {
- case '\0':
- case '%':
- *d++ = '%';
- break;
-
- case 'c':
- case 'f':
- if (g_Settings.StripFormat || streamData->bStripFormat)
- line += 2;
+ case '\0':
+ case '%':
+ *d++ = '%';
+ break;
- else 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';
- line += 2;
+ case 'c':
+ case 'f':
+ if (g_Settings.StripFormat || streamData->bStripFormat)
+ line += 2;
+
+ else 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';
+ line += 2;
+
+ col = _ttoi(szTemp3);
+ col += (OPTIONS_FONTCOUNT + 1);
+ mir_snprintf(szTemp, SIZEOF(szTemp), (c == 'c') ? "\\cf%u " : "\\highlight%u ", col);
+ }
+ break;
+ case 'C':
+ case 'F':
+ if (!g_Settings.StripFormat && !streamData->bStripFormat) {
+ int j = streamData->lin->bIsHighlighted ? 16 : EventToIndex(streamData->lin);
+ if (*line == 'C')
+ mir_snprintf(szTemp, SIZEOF(szTemp), "\\cf%u ", j + 1);
+ else
+ mir_snprintf(szTemp, SIZEOF(szTemp), "\\highlight0 ");
+ }
+ break;
+ case 'b':
+ case 'u':
+ case 'i':
+ if (!streamData->bStripFormat)
+ mir_snprintf(szTemp, SIZEOF(szTemp), (*line == 'u') ? "\\%cl " : "\\%c ", *line);
+ break;
- col = _ttoi(szTemp3);
- col += (OPTIONS_FONTCOUNT + 1);
- mir_snprintf(szTemp, SIZEOF(szTemp), (c == 'c') ? "\\cf%u " : "\\highlight%u ", col);
- }
- break;
- case 'C':
- case 'F':
- if (!g_Settings.StripFormat && !streamData->bStripFormat) {
- int j = streamData->lin->bIsHighlighted ? 16 : EventToIndex(streamData->lin);
- if (*line == 'C')
- mir_snprintf(szTemp, SIZEOF(szTemp), "\\cf%u ", j + 1);
- else
- mir_snprintf(szTemp, SIZEOF(szTemp), "\\highlight0 ");
- }
- break;
- case 'b':
- case 'u':
- case 'i':
- if (!streamData->bStripFormat)
- mir_snprintf(szTemp, SIZEOF(szTemp), (*line == 'u') ? "\\%cl " : "\\%c ", *line);
- break;
-
- case 'B':
- case 'U':
- case 'I':
- if (!streamData->bStripFormat) {
- mir_snprintf(szTemp, SIZEOF(szTemp), (*line == 'U') ? "\\%cl0 " : "\\%c0 ", *line);
- CharLowerA(szTemp);
- }
- break;
+ case 'B':
+ case 'U':
+ case 'I':
+ if (!streamData->bStripFormat) {
+ mir_snprintf(szTemp, SIZEOF(szTemp), (*line == 'U') ? "\\%cl0 " : "\\%c0 ", *line);
+ CharLowerA(szTemp);
+ }
+ break;
- case 'r':
- if (!streamData->bStripFormat) {
- int index = EventToIndex(streamData->lin);
- mir_snprintf(szTemp, SIZEOF(szTemp), "%s ", Log_SetStyle(index, index));
- }
- break;
+ case 'r':
+ if (!streamData->bStripFormat) {
+ int index = EventToIndex(streamData->lin);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "%s ", Log_SetStyle(index, index));
+ }
+ break;
}
if (szTemp[0]) {
@@ -665,85 +665,85 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced,
}
switch (streamData->lin->iType) {
- case GC_EVENT_MESSAGE:
- if (streamData->lin->ptszText)
- Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
- break;
- case GC_EVENT_ACTION:
- if (streamData->lin->ptszNick && streamData->lin->ptszText) {
- Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, _T("%s "), streamData->lin->ptszNick);
- Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
- }
- break;
- case GC_EVENT_JOIN:
- if (pszNick) {
- if (!streamData->lin->bIsMe)
- /* replace nick of a newcomer with a link */
+ case GC_EVENT_MESSAGE:
+ if (streamData->lin->ptszText)
+ Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
+ break;
+ case GC_EVENT_ACTION:
+ if (streamData->lin->ptszNick && streamData->lin->ptszText) {
+ Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, _T("%s "), streamData->lin->ptszNick);
+ Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
+ }
+ break;
+ case GC_EVENT_JOIN:
+ 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);
- else
- Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You have joined %s"), streamData->si->ptszName);
- }
- break;
- case GC_EVENT_PART:
- if (pszNick)
- Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has left"), pszNick);
- if (streamData->lin->ptszText)
- Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T(": %s"), streamData->lin->ptszText);
- break;
- case GC_EVENT_QUIT:
- if (pszNick)
- Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has disconnected"), pszNick);
- if (streamData->lin->ptszText)
- Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T(": %s"), streamData->lin->ptszText);
- break;
- case GC_EVENT_NICK:
- if (pszNick && streamData->lin->ptszText) {
- if (!streamData->lin->bIsMe)
- Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s is now known as %s"), pszNick, streamData->lin->ptszText);
- else
- Log_AppendRTF(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_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
- TranslateT("%s kicked %s"), streamData->lin->ptszStatus, pszNick);
-
- if (streamData->lin->ptszText)
- Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T(": %s"), streamData->lin->ptszText);
- break;
- case GC_EVENT_NOTICE:
- if (pszNick && streamData->lin->ptszText) {
- Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("Notice from %s: "), pszNick);
- Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
- }
- break;
- case GC_EVENT_TOPIC:
- if (streamData->lin->ptszText)
- Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, TranslateT("The topic is \'%s%s\'"), streamData->lin->ptszText, _T("%r"));
- if (pszNick)
- Log_AppendRTF(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_AppendRTF(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_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
- TranslateT("%s enables \'%s\' status for %s"),
- streamData->lin->ptszText, streamData->lin->ptszStatus, pszNick);
- break;
- case GC_EVENT_REMOVESTATUS:
- 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);
- }
- break;
+ else
+ Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You have joined %s"), streamData->si->ptszName);
+ }
+ break;
+ case GC_EVENT_PART:
+ if (pszNick)
+ Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has left"), pszNick);
+ if (streamData->lin->ptszText)
+ Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T(": %s"), streamData->lin->ptszText);
+ break;
+ case GC_EVENT_QUIT:
+ if (pszNick)
+ Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has disconnected"), pszNick);
+ if (streamData->lin->ptszText)
+ Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T(": %s"), streamData->lin->ptszText);
+ break;
+ case GC_EVENT_NICK:
+ if (pszNick && streamData->lin->ptszText) {
+ if (!streamData->lin->bIsMe)
+ Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s is now known as %s"), pszNick, streamData->lin->ptszText);
+ else
+ Log_AppendRTF(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_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
+ TranslateT("%s kicked %s"), streamData->lin->ptszStatus, pszNick);
+
+ if (streamData->lin->ptszText)
+ Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T(": %s"), streamData->lin->ptszText);
+ break;
+ case GC_EVENT_NOTICE:
+ if (pszNick && streamData->lin->ptszText) {
+ Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("Notice from %s: "), pszNick);
+ Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
+ }
+ break;
+ case GC_EVENT_TOPIC:
+ if (streamData->lin->ptszText)
+ Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, TranslateT("The topic is \'%s%s\'"), streamData->lin->ptszText, _T("%r"));
+ if (pszNick)
+ Log_AppendRTF(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_AppendRTF(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_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
+ TranslateT("%s enables \'%s\' status for %s"),
+ streamData->lin->ptszText, streamData->lin->ptszStatus, pszNick);
+ break;
+ case GC_EVENT_REMOVESTATUS:
+ 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);
+ }
+ break;
}
}
@@ -861,28 +861,28 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
if (ti && (int)ti->hIcon < streamData->si->iStatusCount) {
int id = streamData->si->iStatusCount - (int)ti->hIcon - 1;
switch (id) {
- case 1:
- pszIndicator[0] = '+';
- crNickIndex = 2;
- break;
- case 2:
- pszIndicator[0] = '%';
- crNickIndex = 1;
- break;
- case 3:
- pszIndicator[0] = '@';
- crNickIndex = 0;
- break;
- case 4:
- pszIndicator[0] = '!';
- crNickIndex = 3;
- break;
- case 5:
- pszIndicator[0] = '*';
- crNickIndex = 4;
- break;
- default:
- pszIndicator[0] = 0;
+ case 1:
+ pszIndicator[0] = '+';
+ crNickIndex = 2;
+ break;
+ case 2:
+ pszIndicator[0] = '%';
+ crNickIndex = 1;
+ break;
+ case 3:
+ pszIndicator[0] = '@';
+ crNickIndex = 0;
+ break;
+ case 4:
+ pszIndicator[0] = '!';
+ crNickIndex = 3;
+ break;
+ case 5:
+ pszIndicator[0] = '*';
+ crNickIndex = 4;
+ break;
+ default:
+ pszIndicator[0] = 0;
}
}
break;
diff --git a/plugins/TabSRMM/src/chat/message.cpp b/plugins/TabSRMM/src/chat/message.cpp
index 48ccf0ff64..5fb99a38c4 100644
--- a/plugins/TabSRMM/src/chat/message.cpp
+++ b/plugins/TabSRMM/src/chat/message.cpp
@@ -119,167 +119,167 @@ TCHAR* Chat_DoRtfToTags(char* pszText, SESSION_INFO* si)
iRemoveChars = 0;
switch (*p1) {
- case '\\':
- if (!memcmp(p1, "\\cf", 3)) { // foreground color
- int iCol, iInd;
- iRemoveChars = 3 + ReadInteger(p1 + 3, &iCol);
- iInd = RTFColorToIndex(pIndex, iCol, si);
- bJustRemovedRTF = TRUE;
-
- if (bTextHasStarted || iInd >= 0)
- mir_snprintf(InsertThis, SIZEOF(InsertThis), (iInd >= 0) ? "%%c%02u" : "%%C", iInd);
- } else if (!memcmp(p1, "\\highlight", 10)) { //background color
- int iCol, iInd;
- iRemoveChars = 10 + ReadInteger(p1 + 10, &iCol);
- iInd = RTFColorToIndex(pIndex, iCol, si);
- bJustRemovedRTF = TRUE;
-
- if (bTextHasStarted || iInd >= 0)
- mir_snprintf(InsertThis, SIZEOF(InsertThis), (iInd >= 0) ? "%%f%02u" : "%%F", iInd);
- } else if (!memcmp(p1, "\\lang", 5)) { // language id
- bTextHasStarted = bJustRemovedRTF = TRUE;
- iRemoveChars = 5 + ReadInteger(p1 + 5, NULL);
- } else if (!memcmp(p1, "\\par", 4)) { // newline
- bTextHasStarted = bJustRemovedRTF = TRUE;
- iRemoveChars = 4;
- strcpy(InsertThis, "\n");
- } else if (!memcmp(p1, "\\endash", 7)) {
- bTextHasStarted = bJustRemovedRTF = TRUE;
- iRemoveChars = 7;
- strcpy(InsertThis, "\xE2\x80\x93");
- } else if (!memcmp(p1, "\\emdash", 7)) {
- bTextHasStarted = bJustRemovedRTF = TRUE;
- iRemoveChars = 7;
- strcpy(InsertThis, "\xE2\x80\x94");
- } else if (!memcmp(p1, "\\bullet", 7)) {
- bTextHasStarted = bJustRemovedRTF = TRUE;
+ case '\\':
+ if (!memcmp(p1, "\\cf", 3)) { // foreground color
+ int iCol, iInd;
+ iRemoveChars = 3 + ReadInteger(p1 + 3, &iCol);
+ iInd = RTFColorToIndex(pIndex, iCol, si);
+ bJustRemovedRTF = TRUE;
+
+ if (bTextHasStarted || iInd >= 0)
+ mir_snprintf(InsertThis, SIZEOF(InsertThis), (iInd >= 0) ? "%%c%02u" : "%%C", iInd);
+ } else if (!memcmp(p1, "\\highlight", 10)) { //background color
+ int iCol, iInd;
+ iRemoveChars = 10 + ReadInteger(p1 + 10, &iCol);
+ iInd = RTFColorToIndex(pIndex, iCol, si);
+ bJustRemovedRTF = TRUE;
+
+ if (bTextHasStarted || iInd >= 0)
+ mir_snprintf(InsertThis, SIZEOF(InsertThis), (iInd >= 0) ? "%%f%02u" : "%%F", iInd);
+ } else if (!memcmp(p1, "\\lang", 5)) { // language id
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ iRemoveChars = 5 + ReadInteger(p1 + 5, NULL);
+ } else if (!memcmp(p1, "\\par", 4)) { // newline
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ iRemoveChars = 4;
+ strcpy(InsertThis, "\n");
+ } else if (!memcmp(p1, "\\endash", 7)) {
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ iRemoveChars = 7;
+ strcpy(InsertThis, "\xE2\x80\x93");
+ } else if (!memcmp(p1, "\\emdash", 7)) {
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ iRemoveChars = 7;
+ strcpy(InsertThis, "\xE2\x80\x94");
+ } else if (!memcmp(p1, "\\bullet", 7)) {
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ iRemoveChars = 7;
+ strcpy(InsertThis, "\xE2\x80\xA2");
+ } else if (!memcmp(p1, "\\line", 5)) { // newline
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ iRemoveChars = 5;
+ strcpy(InsertThis, "\n");
+ } else if (!memcmp(p1, "\\b", 2)) { //bold
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ iRemoveChars = (p1[2] != '0') ? 2 : 3;
+ strcpy(InsertThis, (p1[2] != '0') ? "%b" : "%B");
+ } else if (!memcmp(p1, "\\i", 2)) { // italics
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ iRemoveChars = (p1[2] != '0') ? 2 : 3;
+ strcpy(InsertThis, (p1[2] != '0') ? "%i" : "%I");
+ } else if (!memcmp(p1, "\\uc", 3)) { // number of Unicode chars
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ iUcMode = p1[3] - '0';
+ iRemoveChars = 4;
+ } else if (!memcmp(p1, "\\ul", 3)) { // underlined
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ if (p1[3] == 'n')
iRemoveChars = 7;
- strcpy(InsertThis, "\xE2\x80\xA2");
- } else if (!memcmp(p1, "\\line", 5)) { // newline
- bTextHasStarted = bJustRemovedRTF = TRUE;
- iRemoveChars = 5;
- strcpy(InsertThis, "\n");
- } else if (!memcmp(p1, "\\b", 2)) { //bold
- bTextHasStarted = bJustRemovedRTF = TRUE;
- iRemoveChars = (p1[2] != '0') ? 2 : 3;
- strcpy(InsertThis, (p1[2] != '0') ? "%b" : "%B");
- } else if (!memcmp(p1, "\\i", 2)) { // italics
- bTextHasStarted = bJustRemovedRTF = TRUE;
- iRemoveChars = (p1[2] != '0') ? 2 : 3;
- strcpy(InsertThis, (p1[2] != '0') ? "%i" : "%I");
- } else if (!memcmp(p1, "\\uc", 3)) { // number of Unicode chars
- bTextHasStarted = bJustRemovedRTF = TRUE;
- iUcMode = p1[3] - '0';
+ else if (p1[3] == '0')
iRemoveChars = 4;
- } else if (!memcmp(p1, "\\ul", 3)) { // underlined
- bTextHasStarted = bJustRemovedRTF = TRUE;
- if (p1[3] == 'n')
- iRemoveChars = 7;
- else if (p1[3] == '0')
- iRemoveChars = 4;
- else
- iRemoveChars = 3;
- mir_snprintf(InsertThis, SIZEOF(InsertThis), (p1[3] != '0' && p1[3] != 'n') ? "%%u" : "%%U");
- } else if (p1[1] == 'f' && isdigit(p1[2])) { // unicode char
- bTextHasStarted = bJustRemovedRTF = TRUE;
- iRemoveChars = 2 + ReadInteger(p1 + 2, NULL);
- } else if (p1[1] == '\\' || p1[1] == '{' || p1[1] == '}') { // escaped characters
- bTextHasStarted = TRUE;
- bJustRemovedRTF = FALSE;
- iRemoveChars = 2;
- mir_snprintf(InsertThis, SIZEOF(InsertThis), "%c", p1[1]);
- } else if (p1[1] == '~') { // non-breaking space
- bTextHasStarted = TRUE;
- bJustRemovedRTF = FALSE;
- iRemoveChars = 2;
- strcpy(InsertThis, "\xC2\xA0");
- }
-
-
- else if (!memcmp(p1, "\\tab",4)) { // tab
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 4;
- strcpy(InsertThis, "\x09");
- }
- else if (!memcmp(p1, "\\ldblquote",10)) {
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 10;
- strcpy(InsertThis, "\xe2\x80\x9c");
- }
- else if (!memcmp(p1, "\\rdblquote",10)) {
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 10;
- strcpy(InsertThis, "\xe2\x80\x9d");
- }
- else if (!memcmp(p1, "\\lquote",7)) {
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 7;
- strcpy(InsertThis, "\xE2\x80\x98");
- }
- else if (!memcmp(p1, "\\rquote",7)) {
- bTextHasStarted = TRUE;
- bJustRemovedRTF = TRUE;
- iRemoveChars = 7;
- strcpy(InsertThis, "\xE2\x80\x99");
- }
-
- else if (p1[1] == '\'') { // special character
- char tmp[4], *p3 = tmp;
- bTextHasStarted = TRUE;
- bJustRemovedRTF = FALSE;
- if (p1[2] != ' ' && p1[2] != '\\') {
- *p3++ = p1[2];
- iRemoveChars = 3;
- if (p1[3] != ' ' && p1[3] != '\\') {
- *p3++ = p1[3];
- iRemoveChars++;
- }
- *p3 = 0;
- sscanf(tmp, "%x", InsertThis);
-
- InsertThis[1] = 0;
- } else iRemoveChars = 2;
- } else if (bJustRemovedRTF) { // remove unknown RTF command
- int j = 1;
- bJustRemovedRTF = TRUE;
- while (p1[j] != ' ' && p1[j] != '\\' && p1[j] != '\0')
- j++;
- iRemoveChars = j;
- }
- break;
-
- case '{': // other RTF control characters
- case '}':
- iRemoveChars = 1;
- break;
-
- case '\r': case '\n':
+ else
+ iRemoveChars = 3;
+ mir_snprintf(InsertThis, SIZEOF(InsertThis), (p1[3] != '0' && p1[3] != 'n') ? "%%u" : "%%U");
+ } else if (p1[1] == 'f' && isdigit(p1[2])) { // unicode char
+ bTextHasStarted = bJustRemovedRTF = TRUE;
+ iRemoveChars = 2 + ReadInteger(p1 + 2, NULL);
+ } else if (p1[1] == '\\' || p1[1] == '{' || p1[1] == '}') { // escaped characters
bTextHasStarted = TRUE;
bJustRemovedRTF = FALSE;
- iRemoveChars = 1;
- break;
-
- case '%': // escape chat -> protocol control character
+ iRemoveChars = 2;
+ mir_snprintf(InsertThis, SIZEOF(InsertThis), "%c", p1[1]);
+ } else if (p1[1] == '~') { // non-breaking space
bTextHasStarted = TRUE;
bJustRemovedRTF = FALSE;
- iRemoveChars = 1;
- strcpy(InsertThis, "%%");
- break;
- case ' ': // remove spaces following a RTF command
- if (bJustRemovedRTF)
- iRemoveChars = 1;
- bJustRemovedRTF = FALSE;
+ iRemoveChars = 2;
+ strcpy(InsertThis, "\xC2\xA0");
+ }
+
+
+ else if (!memcmp(p1, "\\tab",4)) { // tab
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 4;
+ strcpy(InsertThis, "\x09");
+ }
+ else if (!memcmp(p1, "\\ldblquote",10)) {
bTextHasStarted = TRUE;
- break;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 10;
+ strcpy(InsertThis, "\xe2\x80\x9c");
+ }
+ else if (!memcmp(p1, "\\rdblquote",10)) {
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 10;
+ strcpy(InsertThis, "\xe2\x80\x9d");
+ }
+ else if (!memcmp(p1, "\\lquote",7)) {
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 7;
+ strcpy(InsertThis, "\xE2\x80\x98");
+ }
+ else if (!memcmp(p1, "\\rquote",7)) {
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = TRUE;
+ iRemoveChars = 7;
+ strcpy(InsertThis, "\xE2\x80\x99");
+ }
- default: // other text that should not be touched
+ else if (p1[1] == '\'') { // special character
+ char tmp[4], *p3 = tmp;
bTextHasStarted = TRUE;
bJustRemovedRTF = FALSE;
- break;
+ if (p1[2] != ' ' && p1[2] != '\\') {
+ *p3++ = p1[2];
+ iRemoveChars = 3;
+ if (p1[3] != ' ' && p1[3] != '\\') {
+ *p3++ = p1[3];
+ iRemoveChars++;
+ }
+ *p3 = 0;
+ sscanf(tmp, "%x", InsertThis);
+
+ InsertThis[1] = 0;
+ } else iRemoveChars = 2;
+ } else if (bJustRemovedRTF) { // remove unknown RTF command
+ int j = 1;
+ bJustRemovedRTF = TRUE;
+ while (p1[j] != ' ' && p1[j] != '\\' && p1[j] != '\0')
+ j++;
+ iRemoveChars = j;
+ }
+ break;
+
+ case '{': // other RTF control characters
+ case '}':
+ iRemoveChars = 1;
+ break;
+
+ case '\r': case '\n':
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = FALSE;
+ iRemoveChars = 1;
+ break;
+
+ case '%': // escape chat -> protocol control character
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = FALSE;
+ iRemoveChars = 1;
+ strcpy(InsertThis, "%%");
+ break;
+ case ' ': // remove spaces following a RTF command
+ if (bJustRemovedRTF)
+ iRemoveChars = 1;
+ bJustRemovedRTF = FALSE;
+ bTextHasStarted = TRUE;
+ break;
+
+ default: // other text that should not be touched
+ bTextHasStarted = TRUE;
+ bJustRemovedRTF = FALSE;
+ break;
}
// move the memory and paste in new commands instead of the old RTF
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp
index 302a64fd91..b1fa380e26 100644
--- a/plugins/TabSRMM/src/chat/options.cpp
+++ b/plugins/TabSRMM/src/chat/options.cpp
@@ -235,11 +235,10 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM
int j = (i >= 100 ? i - 100 : i);
struct FontOptionsList *fol = fontOptionsList;
- switch (section)
- {
- case FONTSECTION_CHAT: fol = CHAT_fontOptionsList; break;
- case FONTSECTION_IM: fol = IM_fontOptionsList; break;
- case FONTSECTION_IP: fol = IP_fontOptionsList; break;
+ switch (section) {
+ case FONTSECTION_CHAT: fol = CHAT_fontOptionsList; break;
+ case FONTSECTION_IM: fol = IM_fontOptionsList; break;
+ case FONTSECTION_IP: fol = IP_fontOptionsList; break;
}
if (colour) {
@@ -398,15 +397,14 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p
{
char szDir[MAX_PATH];
switch (uMsg) {
- case BFFM_INITIALIZED: {
- const TCHAR *szData = M->getUserDir();
- SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)szData);
- break;
- }
- case BFFM_SELCHANGED:
- if (SHGetPathFromIDListA((LPITEMIDLIST) lp , szDir))
- SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir);
- break;
+ case BFFM_INITIALIZED:
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)M->getUserDir());
+ break;
+
+ case BFFM_SELCHANGED:
+ if (SHGetPathFromIDListA((LPITEMIDLIST) lp , szDir))
+ SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir);
+ break;
}
return 0;
}
@@ -512,131 +510,125 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
static HTREEITEM hListHeading2 = 0;
switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- if (PluginConfig.m_chat_enabled) {
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
-
- HIMAGELIST himlOptions = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_CHECKBOXES, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)CreateStateImageList());
- ImageList_Destroy(himlOptions);
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ if (PluginConfig.m_chat_enabled) {
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- 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);
+ HIMAGELIST himlOptions = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_CHECKBOXES, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)CreateStateImageList());
+ ImageList_Destroy(himlOptions);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, SIZEOF(branch1), 0x0000);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, SIZEOF(branch2), 0x0000);
+ 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);
- {
- TCHAR* pszGroup = NULL;
- InitSetting(&pszGroup, "AddToGroup", _T("Chat rooms"));
- SetWindowText(GetDlgItem(hwndDlg, IDC_GROUP), pszGroup);
- mir_free(pszGroup);
- Utils::showDlgControl(hwndDlg, IDC_STATIC_MESSAGE, SW_HIDE);
- }
- } else {
- int i = 0;
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, SIZEOF(branch1), 0x0000);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, SIZEOF(branch2), 0x0000);
- while (_o1controls[i])
- Utils::showDlgControl(hwndDlg, _o1controls[i++], SW_HIDE);
+ {
+ TCHAR* pszGroup = NULL;
+ InitSetting(&pszGroup, "AddToGroup", _T("Chat rooms"));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_GROUP), pszGroup);
+ mir_free(pszGroup);
+ Utils::showDlgControl(hwndDlg, IDC_STATIC_MESSAGE, SW_HIDE);
}
- break;
+ }
+ else {
+ int i = 0;
- case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_GROUP)
- && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
+ while (_o1controls[i])
+ Utils::showDlgControl(hwndDlg, _o1controls[i++], SW_HIDE);
+ }
+ break;
- if (lParam != 0)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+ case WM_COMMAND:
+ if ((LOWORD(wParam) == IDC_GROUP) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
+ return 0;
- case WM_NOTIFY: {
- switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_CHECKBOXES:
- if (((LPNMHDR)lParam)->code == NM_CLICK || (((LPNMHDR)lParam)->code == TVN_KEYDOWN && ((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)) {
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) || ((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
- if (((LPNMHDR)lParam)->code == TVN_KEYDOWN)
- hti.flags |= TVHT_ONITEMSTATEICON;
- if (hti.flags&TVHT_ONITEMSTATEICON) {
- TVITEM tvi = {0};
-
- tvi.mask = TVIF_HANDLE | TVIF_STATE;
- tvi.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
-
- if (((LPNMHDR)lParam)->code == TVN_KEYDOWN)
- tvi.hItem = TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom);
- else
- tvi.hItem = (HTREEITEM)hti.hItem;
-
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
-
- if (tvi.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
- tvi.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
- SendDlgItemMessageA(hwndDlg, IDC_CHECKBOXES, TVM_SETITEMA, 0, (LPARAM)&tvi);
- } else if (hti.flags&TVHT_ONITEMSTATEICON) {
- if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
- tvi.state = INDEXTOSTATEIMAGEMASK(1);
- SendDlgItemMessageA(hwndDlg, IDC_CHECKBOXES, TVM_SETITEMA, 0, (LPARAM)&tvi);
- }
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- }
+ if (lParam != 0)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- break;
-
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY: {
- if (PluginConfig.m_chat_enabled) {
- int iLen;
- TCHAR *pszText = NULL;
- BYTE b;
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP));
- if (iLen > 0) {
- pszText = (TCHAR *)realloc(pszText, (iLen + 2) * sizeof(TCHAR));
- GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1);
- M->WriteTString(NULL, "Chat", "AddToGroup", pszText);
- } else
- M->WriteTString(NULL, "Chat", "AddToGroup", _T(""));
-
- g_Settings.hGroup = 0;
-
- if (pszText)
- free(pszText);
-
- b = M->GetByte("Chat", "Tabs", 1);
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, sizeof(branch1) / sizeof(branch1[0]));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, sizeof(branch2) / sizeof(branch2[0]));
-
- LoadGlobalSettings();
- MM_FontsChanged();
- FreeMsgLogBitmaps();
- LoadMsgLogBitmaps();
- SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
- SM_ReconfigureFilters();
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case IDC_CHECKBOXES:
+ if (((LPNMHDR)lParam)->code == NM_CLICK || (((LPNMHDR)lParam)->code == TVN_KEYDOWN && ((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)) {
+ TVHITTESTINFO hti;
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) || ((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
+ if (((LPNMHDR)lParam)->code == TVN_KEYDOWN)
+ hti.flags |= TVHT_ONITEMSTATEICON;
+ if (hti.flags&TVHT_ONITEMSTATEICON) {
+ TVITEM tvi = {0};
+
+ tvi.mask = TVIF_HANDLE | TVIF_STATE;
+ tvi.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
+
+ if (((LPNMHDR)lParam)->code == TVN_KEYDOWN)
+ tvi.hItem = TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom);
+ else
+ tvi.hItem = (HTREEITEM)hti.hItem;
+
+ TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
+
+ if (tvi.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
+ tvi.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
+ SendDlgItemMessageA(hwndDlg, IDC_CHECKBOXES, TVM_SETITEMA, 0, (LPARAM)&tvi);
+ } else if (hti.flags&TVHT_ONITEMSTATEICON) {
+ if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
+ tvi.state = INDEXTOSTATEIMAGEMASK(1);
+ SendDlgItemMessageA(hwndDlg, IDC_CHECKBOXES, TVM_SETITEMA, 0, (LPARAM)&tvi);
}
}
- return TRUE;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
+ }
+ }
+ break;
+
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ if (PluginConfig.m_chat_enabled) {
+ int iLen;
+ TCHAR *pszText = NULL;
+ BYTE b;
+
+ iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP));
+ if (iLen > 0) {
+ pszText = (TCHAR *)realloc(pszText, (iLen + 2) * sizeof(TCHAR));
+ GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1);
+ M->WriteTString(NULL, "Chat", "AddToGroup", pszText);
+ } else
+ M->WriteTString(NULL, "Chat", "AddToGroup", _T(""));
+
+ g_Settings.hGroup = 0;
+
+ if (pszText)
+ free(pszText);
+
+ b = M->GetByte("Chat", "Tabs", 1);
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, sizeof(branch1) / sizeof(branch1[0]));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, sizeof(branch2) / sizeof(branch2[0]));
+
+ LoadGlobalSettings();
+ MM_FontsChanged();
+ FreeMsgLogBitmaps();
+ LoadMsgLogBitmaps();
+ SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
+ SM_ReconfigureFilters();
+ }
+ return TRUE;
}
- }
- break;
- case WM_DESTROY: {
- BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0;
- M->WriteByte("Chat", "Branch1Exp", b);
- b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0;
- M->WriteByte("Chat", "Branch2Exp", b);
}
break;
- default:
- break;
+ case WM_DESTROY:
+ BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0;
+ M->WriteByte("Chat", "Branch1Exp", b);
+ b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0;
+ M->WriteByte("Chat", "Branch2Exp", b);
}
return FALSE;
}
@@ -652,7 +644,7 @@ static TCHAR* chatcolorsnames[] ={
LPGENT("Selection background"),
LPGENT("Selected text"),
LPGENT("Incremental search highlight")
- };
+};
void RegisterFontServiceFonts() {
char szTemp[100];
@@ -681,48 +673,48 @@ void RegisterFontServiceFonts() {
_tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), SIZEOF(fid.group));
switch (i) {
- case MSGFONTID_MYMSG:
- case 1:
- case MSGFONTID_MYNAME:
- case MSGFONTID_MYTIME:
- case 21:
- _tcsncpy(fid.backgroundName, LPGENT("Outgoing background"), SIZEOF(fid.backgroundName));
- break;
- case 8:
- case 9:
- case 12:
- case 13:
- _tcsncpy(fid.backgroundName, LPGENT("Outgoing background(old)"), SIZEOF(fid.backgroundName));
- break;
- case 10:
- case 11:
- case 14:
- case 15:
- _tcsncpy(fid.backgroundName, LPGENT("Incoming background(old)"), SIZEOF(fid.backgroundName));
- break;
- case MSGFONTID_MESSAGEAREA:
- _tcsncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group));
- _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup));
- _tcsncpy(fid.backgroundName, LPGENT("Input area background"), SIZEOF(fid.backgroundName));
- fid.flags |= FIDF_DISABLESTYLES;
- fid.flags &= ~FIDF_ALLOWEFFECTS;
- break;
- case 17:
- _tcsncpy(fid.backgroundName, LPGENT("Status background"), SIZEOF(fid.backgroundName));
- break;
- case 18:
- _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup));
- _tcsncpy(fid.backgroundName, LPGENT("Log background"), SIZEOF(fid.backgroundName));
- break;
- case 19:
- _tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName));
- break;
- default:
- _tcsncpy(fid.backgroundName, LPGENT("Incoming background"), SIZEOF(fid.backgroundName));
- break;
- }
- FontRegisterT(&fid);
+ case MSGFONTID_MYMSG:
+ case 1:
+ case MSGFONTID_MYNAME:
+ case MSGFONTID_MYTIME:
+ case 21:
+ _tcsncpy(fid.backgroundName, LPGENT("Outgoing background"), SIZEOF(fid.backgroundName));
+ break;
+ case 8:
+ case 9:
+ case 12:
+ case 13:
+ _tcsncpy(fid.backgroundName, LPGENT("Outgoing background(old)"), SIZEOF(fid.backgroundName));
+ break;
+ case 10:
+ case 11:
+ case 14:
+ case 15:
+ _tcsncpy(fid.backgroundName, LPGENT("Incoming background(old)"), SIZEOF(fid.backgroundName));
+ break;
+ case MSGFONTID_MESSAGEAREA:
+ _tcsncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group));
+ _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup));
+ _tcsncpy(fid.backgroundName, LPGENT("Input area background"), SIZEOF(fid.backgroundName));
+ fid.flags |= FIDF_DISABLESTYLES;
+ fid.flags &= ~FIDF_ALLOWEFFECTS;
+ break;
+ case 17:
+ _tcsncpy(fid.backgroundName, LPGENT("Status background"), SIZEOF(fid.backgroundName));
+ break;
+ case 18:
+ _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup));
+ _tcsncpy(fid.backgroundName, LPGENT("Log background"), SIZEOF(fid.backgroundName));
+ break;
+ case 19:
+ _tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName));
+ break;
+ default:
+ _tcsncpy(fid.backgroundName, LPGENT("Incoming background"), SIZEOF(fid.backgroundName));
+ break;
}
+ FontRegisterT(&fid);
+ }
fontOptionsList = IP_fontOptionsList;
fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS;
@@ -841,12 +833,11 @@ void RegisterFontServiceFonts() {
int FontServiceFontsChanged(WPARAM,LPARAM)
{
if (PluginConfig.m_chat_enabled) {
- LOGFONT lf;
-
LoadLogFonts();
FreeMsgLogBitmaps();
LoadMsgLogBitmaps();
+ LOGFONT lf;
LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE);
HFONT hFont = CreateFontIndirect(&lf);
int iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, TRUE);
@@ -882,287 +873,280 @@ static UINT _o3chatcontrols[] = {0};
INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
- case WM_INITDIALOG: {
-
- TranslateDialogDefault(hwndDlg);
-
- if (PluginConfig.m_chat_enabled) {
-
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "Chat", "LogLimit", 100), 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETRANGE, 0, MAKELONG(255, 10));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(M->GetByte("Chat", "NicklistRowDist", 12), 0));
- SetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, g_Settings.pszTimeStampLog);
- SetDlgItemText(hwndDlg, IDC_TIMESTAMP, g_Settings.pszTimeStamp);
- SetDlgItemText(hwndDlg, IDC_OUTSTAMP, g_Settings.pszOutgoingNick);
- SetDlgItemText(hwndDlg, IDC_INSTAMP, g_Settings.pszIncomingNick);
- CheckDlgButton(hwndDlg, IDC_LOGGING, g_Settings.LoggingEnabled);
- SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, g_Settings.pszLogDir);
- Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, g_Settings.LoggingEnabled ? TRUE : FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, g_Settings.LoggingEnabled ? TRUE : FALSE);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETRANGE, 0, MAKELONG(10000, 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "Chat", "LoggingLimit", 100), 0));
- Utils::enableDlgControl(hwndDlg, IDC_LIMIT, g_Settings.LoggingEnabled ? TRUE : FALSE);
-
- if (ServiceExists(MS_UTILS_REPLACEVARS)) {
- TCHAR tszTooltipText[2048];
-
- mir_sntprintf(tszTooltipText, SIZEOF(tszTooltipText),
- _T("%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\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 multiaccounts"),
- _T("%userid%"), TranslateT("UserID of current contact (if defined). It is like UIN Number for ICQ, JID for Jabber, etc."),
- // global vars
- _T("%miranda_path%"), TranslateT("path to root miranda folder"),
- _T("%miranda_profile%"), TranslateT("path to current miranda profile"),
- _T("%miranda_profilename%"), TranslateT("name of current miranda profile (filename, without extension)"),
- _T("%miranda_userdata%"), TranslateT("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%"),
- _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"));
- hPathTip = CreateToolTip(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), tszTooltipText, TranslateT("Variables"));
- }
-
- } else {
- int i = 0;
-
- while (_o2chatcontrols[i])
- Utils::enableDlgControl(hwndDlg, _o2chatcontrols[i++], FALSE);
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ if (PluginConfig.m_chat_enabled) {
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "Chat", "LogLimit", 100), 0));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETRANGE, 0, MAKELONG(255, 10));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(M->GetByte("Chat", "NicklistRowDist", 12), 0));
+ SetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, g_Settings.pszTimeStampLog);
+ SetDlgItemText(hwndDlg, IDC_TIMESTAMP, g_Settings.pszTimeStamp);
+ SetDlgItemText(hwndDlg, IDC_OUTSTAMP, g_Settings.pszOutgoingNick);
+ SetDlgItemText(hwndDlg, IDC_INSTAMP, g_Settings.pszIncomingNick);
+ CheckDlgButton(hwndDlg, IDC_LOGGING, g_Settings.LoggingEnabled);
+ SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, g_Settings.pszLogDir);
+ Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, g_Settings.LoggingEnabled ? TRUE : FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, g_Settings.LoggingEnabled ? TRUE : FALSE);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETRANGE, 0, MAKELONG(10000, 0));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "Chat", "LoggingLimit", 100), 0));
+ Utils::enableDlgControl(hwndDlg, IDC_LIMIT, g_Settings.LoggingEnabled ? TRUE : FALSE);
+
+ if (ServiceExists(MS_UTILS_REPLACEVARS)) {
+ TCHAR tszTooltipText[2048];
+
+ mir_sntprintf(tszTooltipText, SIZEOF(tszTooltipText),
+ _T("%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\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 multiaccounts"),
+ _T("%userid%"), TranslateT("UserID of current contact (if defined). It is like UIN Number for ICQ, JID for Jabber, etc."),
+ // global vars
+ _T("%miranda_path%"), TranslateT("path to root miranda folder"),
+ _T("%miranda_profile%"), TranslateT("path to current miranda profile"),
+ _T("%miranda_profilename%"), TranslateT("name of current miranda profile (filename, without extension)"),
+ _T("%miranda_userdata%"), TranslateT("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%"),
+ _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"));
+ hPathTip = CreateToolTip(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), tszTooltipText, TranslateT("Variables"));
}
- if (hPathTip)
- SetTimer(hwndDlg, 0, 3000, NULL);
- break;
}
- case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_INSTAMP
- || LOWORD(wParam) == IDC_OUTSTAMP
- || LOWORD(wParam) == IDC_TIMESTAMP
- || LOWORD(wParam) == IDC_LOGLIMIT
- || LOWORD(wParam) == IDC_NICKROW2
- || LOWORD(wParam) == IDC_LOGDIRECTORY
- || LOWORD(wParam) == IDC_LIMIT
- || LOWORD(wParam) == IDC_LOGTIMESTAMP)
- && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
-
- switch (LOWORD(wParam)) {
- /*
- * open the base directory for MUC logs, using a standard file selector
- * dialog. Simply allows the user to view what log files are there
- * and possibly delete archived logs.
- */
- case IDC_MUC_OPENLOGBASEDIR: {
- OPENFILENAME ofn = {0};
- SESSION_INFO si = {0};
- TCHAR tszReturnName[MAX_PATH];
- TCHAR tszInitialDir[_MAX_DRIVE + _MAX_PATH + 10];
- TCHAR tszTemp[MAX_PATH + 20], *p = 0, *p1 = 0;
-
- mir_sntprintf(tszTemp, MAX_PATH + 20, _T("%s"), g_Settings.pszLogDir);
-
- p = tszTemp;
- while(*p && (*p == '\\' || *p == '.'))
- p++;
-
- if (*p) {
- if ((p1 = _tcschr(p, '\\')))
- *p1 = 0;
- }
+ else {
+ int i = 0;
+ while (_o2chatcontrols[i])
+ Utils::enableDlgControl(hwndDlg, _o2chatcontrols[i++], FALSE);
+ }
+ if (hPathTip)
+ SetTimer(hwndDlg, 0, 3000, NULL);
+ break;
- mir_sntprintf(tszInitialDir, MAX_PATH, _T("%s%s"), M->getChatLogPath(), p);
- if (PathFileExists(tszInitialDir))
- ofn.lpstrInitialDir = tszInitialDir;
- else {
- mir_sntprintf(tszInitialDir, MAX_PATH, _T("%s"), M->getChatLogPath());
- ofn.lpstrInitialDir = tszInitialDir;
- }
+ case WM_COMMAND:
+ if ((LOWORD(wParam) == IDC_INSTAMP
+ || LOWORD(wParam) == IDC_OUTSTAMP
+ || LOWORD(wParam) == IDC_TIMESTAMP
+ || LOWORD(wParam) == IDC_LOGLIMIT
+ || LOWORD(wParam) == IDC_NICKROW2
+ || LOWORD(wParam) == IDC_LOGDIRECTORY
+ || LOWORD(wParam) == IDC_LIMIT
+ || LOWORD(wParam) == IDC_LOGTIMESTAMP)
+ && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
+
+ switch (LOWORD(wParam)) {
+ /*
+ * open the base directory for MUC logs, using a standard file selector
+ * dialog. Simply allows the user to view what log files are there
+ * and possibly delete archived logs.
+ */
+ case IDC_MUC_OPENLOGBASEDIR: {
+ OPENFILENAME ofn = {0};
+ SESSION_INFO si = {0};
+ TCHAR tszReturnName[MAX_PATH];
+ TCHAR tszInitialDir[_MAX_DRIVE + _MAX_PATH + 10];
+ TCHAR tszTemp[MAX_PATH + 20], *p = 0, *p1 = 0;
+
+ mir_sntprintf(tszTemp, MAX_PATH + 20, _T("%s"), g_Settings.pszLogDir);
+
+ p = tszTemp;
+ while(*p && (*p == '\\' || *p == '.'))
+ p++;
+
+ if (*p) {
+ if ((p1 = _tcschr(p, '\\')))
+ *p1 = 0;
+ }
- tszReturnName[0] = 0;
- mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%s%c*.*%c%c"), TranslateT("All Files"), 0, 0, 0);
-
- ofn.lpstrFilter = tszTemp;
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- ofn.hwndOwner = 0;
- ofn.lpstrFile = tszReturnName;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
- ofn.lpstrDefExt = _T("log");
- GetOpenFileName(&ofn);
- break;
- }
+ mir_sntprintf(tszInitialDir, MAX_PATH, _T("%s%s"), M->getChatLogPath(), p);
+ if (PathFileExists(tszInitialDir))
+ ofn.lpstrInitialDir = tszInitialDir;
+ else {
+ mir_sntprintf(tszInitialDir, MAX_PATH, _T("%s"), M->getChatLogPath());
+ ofn.lpstrInitialDir = tszInitialDir;
+ }
- case IDC_FONTCHOOSE: {
- TCHAR tszDirectory[MAX_PATH];
- LPITEMIDLIST idList;
- LPMALLOC psMalloc;
- BROWSEINFO bi = {0};
-
- if (SUCCEEDED(CoGetMalloc(1, &psMalloc))) {
- TCHAR tszTemp[MAX_PATH];
- 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;
-
-
- idList = SHBrowseForFolder(&bi);
- if (idList) {
- const TCHAR *szUserDir = M->getUserDir();
- SHGetPathFromIDList(idList, tszDirectory);
- lstrcat(tszDirectory, _T("\\"));
- M->pathToRelative(tszDirectory, tszTemp, const_cast<TCHAR *>(szUserDir));
- SetWindowText(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), lstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
- }
- psMalloc->Free(idList);
- psMalloc->Release();
- }
- break;
+ tszReturnName[0] = 0;
+ mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%s%c*.*%c%c"), TranslateT("All Files"), 0, 0, 0);
+
+ ofn.lpstrFilter = tszTemp;
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ ofn.hwndOwner = 0;
+ 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];
+ LPITEMIDLIST idList;
+ LPMALLOC psMalloc;
+ BROWSEINFO bi = {0};
+
+ if (SUCCEEDED(CoGetMalloc(1, &psMalloc))) {
+ TCHAR tszTemp[MAX_PATH];
+ 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;
+
+
+ idList = SHBrowseForFolder(&bi);
+ if (idList) {
+ const TCHAR *szUserDir = M->getUserDir();
+ SHGetPathFromIDList(idList, tszDirectory);
+ lstrcat(tszDirectory, _T("\\"));
+ M->pathToRelative(tszDirectory, tszTemp, const_cast<TCHAR *>(szUserDir));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), lstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
}
-
- case IDC_LOGGING:
- if (PluginConfig.m_chat_enabled) {
- Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_LIMIT, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
- }
- break;
+ psMalloc->Free(idList);
+ psMalloc->Release();
}
-
- if (lParam != 0)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+ }
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) {
- int iLen;
- TCHAR *p2 = NULL;
- char *pszText = NULL;
- TCHAR *ptszPath = NULL;
-
- if (PluginConfig.m_chat_enabled) {
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY));
- if (iLen > 0) {
- TCHAR *pszText1 = (TCHAR *)malloc(iLen*sizeof(TCHAR) + 2);
- GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText1, iLen + 1);
- M->WriteTString(NULL, "Chat", "LogDirectory", pszText1);
- free(pszText1);
- g_Settings.LoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE;
- M->WriteByte("Chat", "LoggingEnabled", (BYTE)g_Settings.LoggingEnabled);
- } else {
- DBDeleteContactSetting(NULL, "Chat", "LogDirectory");
- M->WriteByte("Chat", "LoggingEnabled", 0);
- }
- SM_InvalidateLogDirectories();
-
- iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_GETPOS, 0, 0);
- DBWriteContactSettingWord(NULL, "Chat", "LoggingLimit", (WORD)iLen);
-
- iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0);
- if (iLen > 0)
- M->WriteByte("Chat", "NicklistRowDist", (BYTE)iLen);
- else
- DBDeleteContactSetting(NULL, "Chat", "NicklistRowDist");
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP));
- if (iLen > 0) {
- pszText = (char *)realloc(pszText, iLen + 1);
- GetDlgItemTextA(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1);
- DBWriteContactSettingString(NULL, "Chat", "LogTimestamp", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "LogTimestamp");
+ case IDC_LOGGING:
+ if (PluginConfig.m_chat_enabled) {
+ Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_LIMIT, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
+ }
+ break;
+ }
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP));
- if (iLen > 0) {
- pszText = (char *)realloc(pszText, iLen + 1);
- GetDlgItemTextA(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1);
- DBWriteContactSettingString(NULL, "Chat", "HeaderTime", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "HeaderTime");
+ if (lParam != 0)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP));
- if (iLen > 0) {
- pszText = (char *)realloc(pszText, iLen + 1);
- GetDlgItemTextA(hwndDlg, IDC_INSTAMP, pszText, iLen + 1);
- DBWriteContactSettingString(NULL, "Chat", "HeaderIncoming", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "HeaderIncoming");
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) {
+ int iLen;
+ TCHAR *p2 = NULL;
+ char *pszText = NULL;
+ TCHAR *ptszPath = NULL;
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP));
- if (iLen > 0) {
- pszText = (char *)realloc(pszText, iLen + 1);
- GetDlgItemTextA(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1);
- DBWriteContactSettingString(NULL, "Chat", "HeaderOutgoing", pszText);
- } else DBDeleteContactSetting(NULL, "Chat", "HeaderOutgoing");
+ if (PluginConfig.m_chat_enabled) {
- iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
- DBWriteContactSettingWord(NULL, "Chat", "LogLimit", (WORD)iLen);
+ iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY));
+ if (iLen > 0) {
+ TCHAR *pszText1 = (TCHAR *)malloc(iLen*sizeof(TCHAR) + 2);
+ GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText1, iLen + 1);
+ M->WriteTString(NULL, "Chat", "LogDirectory", pszText1);
+ free(pszText1);
+ g_Settings.LoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE;
+ M->WriteByte("Chat", "LoggingEnabled", (BYTE)g_Settings.LoggingEnabled);
+ } else {
+ DBDeleteContactSetting(NULL, "Chat", "LogDirectory");
+ M->WriteByte("Chat", "LoggingEnabled", 0);
}
+ SM_InvalidateLogDirectories();
+
+ iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_GETPOS, 0, 0);
+ DBWriteContactSettingWord(NULL, "Chat", "LoggingLimit", (WORD)iLen);
+
+ iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0);
+ if (iLen > 0)
+ M->WriteByte("Chat", "NicklistRowDist", (BYTE)iLen);
+ else
+ DBDeleteContactSetting(NULL, "Chat", "NicklistRowDist");
+
+ iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP));
+ if (iLen > 0) {
+ pszText = (char *)realloc(pszText, iLen + 1);
+ GetDlgItemTextA(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1);
+ DBWriteContactSettingString(NULL, "Chat", "LogTimestamp", pszText);
+ } else DBDeleteContactSetting(NULL, "Chat", "LogTimestamp");
+
+ iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP));
+ if (iLen > 0) {
+ pszText = (char *)realloc(pszText, iLen + 1);
+ GetDlgItemTextA(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1);
+ DBWriteContactSettingString(NULL, "Chat", "HeaderTime", pszText);
+ } else DBDeleteContactSetting(NULL, "Chat", "HeaderTime");
+
+ iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP));
+ if (iLen > 0) {
+ pszText = (char *)realloc(pszText, iLen + 1);
+ GetDlgItemTextA(hwndDlg, IDC_INSTAMP, pszText, iLen + 1);
+ DBWriteContactSettingString(NULL, "Chat", "HeaderIncoming", pszText);
+ } else DBDeleteContactSetting(NULL, "Chat", "HeaderIncoming");
+
+ iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP));
+ if (iLen > 0) {
+ pszText = (char *)realloc(pszText, iLen + 1);
+ GetDlgItemTextA(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1);
+ DBWriteContactSettingString(NULL, "Chat", "HeaderOutgoing", pszText);
+ } else DBDeleteContactSetting(NULL, "Chat", "HeaderOutgoing");
+
+ iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
+ DBWriteContactSettingWord(NULL, "Chat", "LogLimit", (WORD)iLen);
+ }
+ if (pszText != NULL)
+ free(pszText);
+ if (hListBkgBrush)
+ DeleteObject(hListBkgBrush);
+ hListBkgBrush = CreateSolidBrush(M->GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));
- if (pszText != NULL)
- free(pszText);
- if (hListBkgBrush)
- DeleteObject(hListBkgBrush);
- hListBkgBrush = CreateSolidBrush(M->GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));
-
-
- if (PluginConfig.m_chat_enabled) {
- LOGFONT lf;
- HFONT hFont;
- int iText;
-
- LoadLogFonts();
- FreeMsgLogBitmaps();
- LoadMsgLogBitmaps();
+ if (PluginConfig.m_chat_enabled) {
+ LoadLogFonts();
+ FreeMsgLogBitmaps();
+ LoadMsgLogBitmaps();
+
+ LOGFONT lf;
+ LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE);
+ HFONT hFont = CreateFontIndirect(&lf);
+ int iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, TRUE);
+ DeleteObject(hFont);
+ g_Settings.LogTextIndent = iText;
+ g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
+ g_Settings.LogIndentEnabled = (M->GetByte("Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
+
+ LoadGlobalSettings();
+ MM_FontsChanged();
+ MM_FixColors();
+ SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
+ }
- LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE);
- hFont = CreateFontIndirect(&lf);
- iText = GetTextPixelSize(MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, TRUE);
- DeleteObject(hFont);
- g_Settings.LogTextIndent = iText;
- g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
- g_Settings.LogIndentEnabled = (M->GetByte("Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
+ PluginConfig.reloadSettings();
+ CacheMsgLogIcons();
+ CacheLogFonts();
+ return TRUE;
+ }
+ break;
- LoadGlobalSettings();
- MM_FontsChanged();
- MM_FixColors();
- SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
- }
+ case WM_TIMER:
+ if (IsWindow(hPathTip))
+ KillTimer(hPathTip, 4); // It will prevent tooltip autoclosing
+ break;
- PluginConfig.reloadSettings();
- CacheMsgLogIcons();
- CacheLogFonts();
- return TRUE;
- }
- break;
- case WM_TIMER:
- if (IsWindow(hPathTip))
- KillTimer(hPathTip, 4); // It will prevent tooltip autoclosing
- break;
- case WM_DESTROY:
- if (hPathTip)
- {
- KillTimer(hwndDlg, 0);
- DestroyWindow(hPathTip);
- hPathTip = 0;
- }
- break;
+ case WM_DESTROY:
+ if (hPathTip) {
+ KillTimer(hwndDlg, 0);
+ DestroyWindow(hPathTip);
+ hPathTip = 0;
+ }
+ break;
}
return FALSE;
}
@@ -1196,82 +1180,75 @@ static UINT _eventorder[] = { GC_EVENT_ACTION,
INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ if (PluginConfig.m_chat_enabled) {
+ DWORD dwFilterFlags = M->GetDword("Chat", "FilterFlags", GC_EVENT_ALL);
+ DWORD dwTrayFlags = M->GetDword("Chat", "TrayIconFlags", GC_EVENT_ALL);
+ DWORD dwPopupFlags = M->GetDword("Chat", "PopupFlags", GC_EVENT_ALL);
+ DWORD dwLogFlags = M->GetDword("Chat", "DiskLogFlags", GC_EVENT_ALL);
+
+ for (int i = 0; _eventorder[i]; 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);
+ }
+ CheckDlgButton(hwndDlg, IDC_P1 + i, dwPopupFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_T1 + i, dwTrayFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
+ }
+ SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("No markers"));
+ SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("Show as icons"));
+ SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("Show as text symbols"));
- TranslateDialogDefault(hwndDlg);
+ SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_SETCURSEL, (g_Settings.LogSymbols ? 2 : (g_Settings.dwIconFlags ? 1 : 0)), 0);
- if (PluginConfig.m_chat_enabled) {
- DWORD dwFilterFlags = M->GetDword("Chat", "FilterFlags", GC_EVENT_ALL);
- DWORD dwTrayFlags = M->GetDword("Chat", "TrayIconFlags", GC_EVENT_ALL);
- DWORD dwPopupFlags = M->GetDword("Chat", "PopupFlags", GC_EVENT_ALL);
- DWORD dwLogFlags = M->GetDword("Chat", "DiskLogFlags", GC_EVENT_ALL);
+ CheckDlgButton(hwndDlg, IDC_NOPOPUPSFORCLOSEDWINDOWS, M->GetByte("Chat", "SkipWhenNoWindow", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TRAYONLYFORINACTIVE, M->GetByte("Chat", "TrayIconInactiveOnly", 0) ? BST_CHECKED : BST_UNCHECKED);
+ }
+ break;
+
+ case WM_COMMAND:
+ if (lParam != 0)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ DWORD dwFilterFlags = 0, dwTrayFlags = 0,
+ dwPopupFlags = 0, dwLogFlags = 0;
for (int i = 0; _eventorder[i]; 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);
+ dwFilterFlags |= (IsDlgButtonChecked(hwndDlg, IDC_1 + i) ? _eventorder[i] : 0);
+ dwLogFlags |= (IsDlgButtonChecked(hwndDlg, IDC_L1 + i) ? _eventorder[i] : 0);
}
- CheckDlgButton(hwndDlg, IDC_P1 + i, dwPopupFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_T1 + i, dwTrayFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
+ dwPopupFlags |= (IsDlgButtonChecked(hwndDlg, IDC_P1 + i) ? _eventorder[i] : 0);
+ dwTrayFlags |= (IsDlgButtonChecked(hwndDlg, IDC_T1 + i) ? _eventorder[i] : 0);
}
- SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("No markers"));
- SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("Show as icons"));
- SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("Show as text symbols"));
-
- SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_SETCURSEL, (g_Settings.LogSymbols ? 2 : (g_Settings.dwIconFlags ? 1 : 0)), 0);
-
- CheckDlgButton(hwndDlg, IDC_NOPOPUPSFORCLOSEDWINDOWS, M->GetByte("Chat", "SkipWhenNoWindow", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TRAYONLYFORINACTIVE, M->GetByte("Chat", "TrayIconInactiveOnly", 0) ? BST_CHECKED : BST_UNCHECKED);
+ M->WriteDword("Chat", "FilterFlags", dwFilterFlags);
+ M->WriteDword("Chat", "PopupFlags", dwPopupFlags);
+ M->WriteDword("Chat", "TrayIconFlags", dwTrayFlags);
+ M->WriteDword("Chat", "DiskLogFlags", dwLogFlags);
+
+ LRESULT lr = SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_GETCURSEL, 0, 0);
+
+ M->WriteDword("Chat", "IconFlags", lr == 1 ? 1 : 0);
+ M->WriteByte("Chat", "LogSymbols", lr == 2 ? 1 : 0);
+
+ M->WriteByte("Chat", "SkipWhenNoWindow", IsDlgButtonChecked(hwndDlg, IDC_NOPOPUPSFORCLOSEDWINDOWS) ? 1 : 0);
+ M->WriteByte("Chat", "TrayIconInactiveOnly", IsDlgButtonChecked(hwndDlg, IDC_TRAYONLYFORINACTIVE) ? 1 : 0);
+ LoadGlobalSettings();
+ MM_FontsChanged();
+ SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
+ SM_ReconfigureFilters();
+ return TRUE;
}
- break;
}
- case WM_COMMAND:
- if (lParam != 0)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY: {
- DWORD dwFilterFlags = 0, dwTrayFlags = 0,
- dwPopupFlags = 0, dwLogFlags = 0;
-
- for (int i = 0; _eventorder[i]; 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);
- }
- dwPopupFlags |= (IsDlgButtonChecked(hwndDlg, IDC_P1 + i) ? _eventorder[i] : 0);
- dwTrayFlags |= (IsDlgButtonChecked(hwndDlg, IDC_T1 + i) ? _eventorder[i] : 0);
- }
- M->WriteDword("Chat", "FilterFlags", dwFilterFlags);
- M->WriteDword("Chat", "PopupFlags", dwPopupFlags);
- M->WriteDword("Chat", "TrayIconFlags", dwTrayFlags);
- M->WriteDword("Chat", "DiskLogFlags", dwLogFlags);
-
- LRESULT lr = SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_GETCURSEL, 0, 0);
-
- M->WriteDword("Chat", "IconFlags", lr == 1 ? 1 : 0);
- M->WriteByte("Chat", "LogSymbols", lr == 2 ? 1 : 0);
-
- M->WriteByte("Chat", "SkipWhenNoWindow", IsDlgButtonChecked(hwndDlg, IDC_NOPOPUPSFORCLOSEDWINDOWS) ? 1 : 0);
- M->WriteByte("Chat", "TrayIconInactiveOnly", IsDlgButtonChecked(hwndDlg, IDC_TRAYONLYFORINACTIVE) ? 1 : 0);
- LoadGlobalSettings();
- MM_FontsChanged();
- SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
- SM_ReconfigureFilters();
- break;
- }
- return TRUE;
- }
- }
- break;
-
- case WM_DESTROY:
- break;
-
+ break;
}
return FALSE;
}
@@ -1325,7 +1302,6 @@ void LoadGlobalSettings(void)
g_Settings.ShowContactStatus = M->GetByte("Chat", "ShowContactStatus", 1);
g_Settings.ContactStatusFirst = M->GetByte("Chat", "ContactStatusFirst", 0);
-
if (hListBkgBrush)
DeleteObject(hListBkgBrush);
hListBkgBrush = CreateSolidBrush(M->GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));
@@ -1340,14 +1316,13 @@ void LoadGlobalSettings(void)
if (!M->GetTString(NULL, "Chat", "LogDirectory", &dbv)) {
lstrcpyn(g_Settings.pszLogDir, dbv.ptszVal, MAX_PATH);
db_free(&dbv);
- } else
- lstrcpyn(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH);
+ }
+ else lstrcpyn(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH);
g_Settings.pszLogDir[MAX_PATH - 1] = 0;
g_Settings.LogIndentEnabled = (M->GetByte("Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
-
// nicklist
if (g_Settings.UserListFont) {
@@ -1397,9 +1372,9 @@ static void FreeGlobalSettings(void)
int OptionsInit(void)
{
- LOGFONT lf;
-
LoadLogFonts();
+
+ LOGFONT lf;
LoadMsgDlgFont(FONTSECTION_CHAT, 17, &lf, NULL, CHAT_FONTMODULE);
lstrcpy(lf.lfFaceName, _T("MS Shell Dlg"));
lf.lfUnderline = lf.lfItalic = lf.lfStrikeOut = 0;
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 20e6058a91..17c8f5580a 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -469,86 +469,87 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
//ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_TOGGLESIDEBAR), dat->pContainer->dwFlags & CNT_SIDEBAR ? SW_SHOW : SW_HIDE);
switch (urc->wId) {
- case IDC_PANELSPLITTER:
- urc->rcItem.bottom = panelHeight;
- urc->rcItem.top = panelHeight - 2;
- return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP;
- case IDC_CHAT_LOG:
- urc->rcItem.top = 0;
- urc->rcItem.left = 0;
- urc->rcItem.right = bNick ? urc->dlgNewSize.cx - si->iSplitterX : urc->dlgNewSize.cx;
- urc->rcItem.bottom = (bToolbar&&!bBottomToolbar) ? (urc->dlgNewSize.cy - si->iSplitterY - (PluginConfig.g_DPIscaleY > 1.0 ? DPISCALEY_S(24) : DPISCALEY_S(23))) : (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(2));
- if (fInfoPanel)
- urc->rcItem.top += panelHeight;
- 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;
- }
- }
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
-
- case IDC_LIST:
- urc->rcItem.top = 0;
- urc->rcItem.right = urc->dlgNewSize.cx ;
- urc->rcItem.left = urc->dlgNewSize.cx - si->iSplitterX + 2;
- urc->rcItem.bottom = (bToolbar&&!bBottomToolbar) ? (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(23)) : (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(2));
- if (fInfoPanel)
- urc->rcItem.top += panelHeight;
- if (CSkin::m_skinEnabled) {
- CSkinItem *item = &SkinItems[ID_EXTBKUSERLIST];
- 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_CUSTOM;
-
- case IDC_SPLITTERX:
- urc->rcItem.right = urc->dlgNewSize.cx - si->iSplitterX + 2;
- urc->rcItem.left = urc->dlgNewSize.cx - si->iSplitterX;
- urc->rcItem.bottom = (bToolbar&&!bBottomToolbar) ? (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(23)) : (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(2));
- urc->rcItem.top = 0;
- if (fInfoPanel)
- urc->rcItem.top += panelHeight;
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
-
- case IDC_SPLITTERY:
- urc->rcItem.right = urc->dlgNewSize.cx;
- urc->rcItem.top = (bToolbar&&!bBottomToolbar) ? urc->dlgNewSize.cy - si->iSplitterY : urc->dlgNewSize.cy - si->iSplitterY;
- urc->rcItem.bottom = (bToolbar&&!bBottomToolbar) ? (urc->dlgNewSize.cy - si->iSplitterY + DPISCALEY_S(2)) : (urc->dlgNewSize.cy - si->iSplitterY + DPISCALEY_S(2));
- urc->rcItem.left = 0;
- urc->rcItem.bottom++;
- urc->rcItem.top++;
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
-
- case IDC_CHAT_MESSAGE:
- urc->rcItem.right = urc->dlgNewSize.cx ;
- urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 3;
- urc->rcItem.bottom = urc->dlgNewSize.cy; // - 1 ;
- msgBottom = urc->rcItem.bottom;
-
- if (dat->fIsAutosizingInput)
- urc->rcItem.top -= DPISCALEY_S(1);
-
- msgTop = urc->rcItem.top;
- if (bBottomToolbar&&bToolbar)
- urc->rcItem.bottom -= DPISCALEY_S(22);
- 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_CUSTOM;
+ case IDC_PANELSPLITTER:
+ urc->rcItem.bottom = panelHeight;
+ urc->rcItem.top = panelHeight - 2;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP;
+
+ case IDC_CHAT_LOG:
+ urc->rcItem.top = 0;
+ urc->rcItem.left = 0;
+ urc->rcItem.right = bNick ? urc->dlgNewSize.cx - si->iSplitterX : urc->dlgNewSize.cx;
+ urc->rcItem.bottom = (bToolbar&&!bBottomToolbar) ? (urc->dlgNewSize.cy - si->iSplitterY - (PluginConfig.g_DPIscaleY > 1.0 ? DPISCALEY_S(24) : DPISCALEY_S(23))) : (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(2));
+ if (fInfoPanel)
+ urc->rcItem.top += panelHeight;
+ 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;
+ }
+ }
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
+
+ case IDC_LIST:
+ urc->rcItem.top = 0;
+ urc->rcItem.right = urc->dlgNewSize.cx ;
+ urc->rcItem.left = urc->dlgNewSize.cx - si->iSplitterX + 2;
+ urc->rcItem.bottom = (bToolbar&&!bBottomToolbar) ? (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(23)) : (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(2));
+ if (fInfoPanel)
+ urc->rcItem.top += panelHeight;
+ if (CSkin::m_skinEnabled) {
+ CSkinItem *item = &SkinItems[ID_EXTBKUSERLIST];
+ 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_CUSTOM;
+
+ case IDC_SPLITTERX:
+ urc->rcItem.right = urc->dlgNewSize.cx - si->iSplitterX + 2;
+ urc->rcItem.left = urc->dlgNewSize.cx - si->iSplitterX;
+ urc->rcItem.bottom = (bToolbar&&!bBottomToolbar) ? (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(23)) : (urc->dlgNewSize.cy - si->iSplitterY - DPISCALEY_S(2));
+ urc->rcItem.top = 0;
+ if (fInfoPanel)
+ urc->rcItem.top += panelHeight;
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
+
+ case IDC_SPLITTERY:
+ urc->rcItem.right = urc->dlgNewSize.cx;
+ urc->rcItem.top = (bToolbar&&!bBottomToolbar) ? urc->dlgNewSize.cy - si->iSplitterY : urc->dlgNewSize.cy - si->iSplitterY;
+ urc->rcItem.bottom = (bToolbar&&!bBottomToolbar) ? (urc->dlgNewSize.cy - si->iSplitterY + DPISCALEY_S(2)) : (urc->dlgNewSize.cy - si->iSplitterY + DPISCALEY_S(2));
+ urc->rcItem.left = 0;
+ urc->rcItem.bottom++;
+ urc->rcItem.top++;
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
+
+ case IDC_CHAT_MESSAGE:
+ urc->rcItem.right = urc->dlgNewSize.cx ;
+ urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 3;
+ urc->rcItem.bottom = urc->dlgNewSize.cy; // - 1 ;
+ msgBottom = urc->rcItem.bottom;
+
+ if (dat->fIsAutosizingInput)
+ urc->rcItem.top -= DPISCALEY_S(1);
+
+ msgTop = urc->rcItem.top;
+ if (bBottomToolbar&&bToolbar)
+ urc->rcItem.bottom -= DPISCALEY_S(22);
+ 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_CUSTOM;
}
return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
@@ -1180,8 +1181,8 @@ 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: {
-
+ case WM_INITDIALOG:
+ {
si = (SESSION_INFO *)lParam;
DWORD dwMask = M->GetDword(si->hContact, "Chat", "FilterMask", 0);
DWORD dwFlags = M->GetDword(si->hContact, "Chat", "FilterFlags", 0);
@@ -1199,89 +1200,90 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
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);
}
- case WM_CTLCOLOREDIT:
- case WM_CTLCOLORSTATIC:
- SetTextColor((HDC)wParam, RGB(60, 60, 150));
- SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
- return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
+ return FALSE;
- case WM_CLOSE:
- if (wParam == 1 && lParam == 1) {
- int iFlags = 0, i;
- UINT result;
- DWORD dwMask = 0, dwFlags = 0;
-
- for (i=0; _eventorder[i]; i++) {
- result = IsDlgButtonChecked(hwndDlg, IDC_1 + i);
- dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
- iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
- }
+ case WM_CTLCOLOREDIT:
+ case WM_CTLCOLORSTATIC:
+ SetTextColor((HDC)wParam, RGB(60, 60, 150));
+ SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+ return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
- if (iFlags&GC_EVENT_ADDSTATUS)
- iFlags |= GC_EVENT_REMOVESTATUS;
+ case WM_CLOSE:
+ if (wParam == 1 && lParam == 1) {
+ int iFlags = 0, i;
+ UINT result;
+ DWORD dwMask = 0, dwFlags = 0;
- if (si) {
- if (dwMask == 0) {
- DBDeleteContactSetting(si->hContact, "Chat", "FilterFlags");
- DBDeleteContactSetting(si->hContact, "Chat", "FilterMask");
- } else {
- M->WriteDword(si->hContact, "Chat", "FilterFlags", iFlags);
- M->WriteDword(si->hContact, "Chat", "FilterMask", dwMask);
- }
- }
+ for (i=0; _eventorder[i]; i++) {
+ result = IsDlgButtonChecked(hwndDlg, IDC_1 + i);
+ dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
+ iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
+ }
- dwMask = iFlags = 0;
+ if (iFlags&GC_EVENT_ADDSTATUS)
+ iFlags |= GC_EVENT_REMOVESTATUS;
- for (i=0; _eventorder[i]; i++) {
- result = IsDlgButtonChecked(hwndDlg, IDC_P1 + i);
- dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
- iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
+ if (si) {
+ if (dwMask == 0) {
+ DBDeleteContactSetting(si->hContact, "Chat", "FilterFlags");
+ DBDeleteContactSetting(si->hContact, "Chat", "FilterMask");
+ } else {
+ M->WriteDword(si->hContact, "Chat", "FilterFlags", iFlags);
+ M->WriteDword(si->hContact, "Chat", "FilterMask", dwMask);
}
+ }
- if (iFlags&GC_EVENT_ADDSTATUS)
- iFlags |= GC_EVENT_REMOVESTATUS;
+ dwMask = iFlags = 0;
- if (si) {
- if (dwMask == 0) {
- DBDeleteContactSetting(si->hContact, "Chat", "PopupFlags");
- DBDeleteContactSetting(si->hContact, "Chat", "PopupMask");
- } else {
- M->WriteDword(si->hContact, "Chat", "PopupFlags", iFlags);
- M->WriteDword(si->hContact, "Chat", "PopupMask", dwMask);
- }
- }
+ for (i=0; _eventorder[i]; i++) {
+ result = IsDlgButtonChecked(hwndDlg, IDC_P1 + i);
+ dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
+ iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
+ }
- dwMask = iFlags = 0;
+ if (iFlags&GC_EVENT_ADDSTATUS)
+ iFlags |= GC_EVENT_REMOVESTATUS;
- for (i=0; _eventorder[i]; i++) {
- result = IsDlgButtonChecked(hwndDlg, IDC_T1 + i);
- dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
- iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
+ if (si) {
+ if (dwMask == 0) {
+ DBDeleteContactSetting(si->hContact, "Chat", "PopupFlags");
+ DBDeleteContactSetting(si->hContact, "Chat", "PopupMask");
+ } else {
+ M->WriteDword(si->hContact, "Chat", "PopupFlags", iFlags);
+ M->WriteDword(si->hContact, "Chat", "PopupMask", dwMask);
}
- if (iFlags&GC_EVENT_ADDSTATUS)
- iFlags |= GC_EVENT_REMOVESTATUS;
+ }
- if (si) {
- if (dwMask == 0) {
- DBDeleteContactSetting(si->hContact, "Chat", "TrayIconFlags");
- DBDeleteContactSetting(si->hContact, "Chat", "TrayIconMask");
- } else {
- M->WriteDword(si->hContact, "Chat", "TrayIconFlags", iFlags);
- M->WriteDword(si->hContact, "Chat", "TrayIconMask", dwMask);
- }
- Chat_SetFilters(si);
- SendMessage(si->hWnd, GC_CHANGEFILTERFLAG, 0, (LPARAM)iFlags);
- if (si->bFilterEnabled)
- SendMessage(si->hWnd, GC_REDRAWLOG, 0, 0);
+ dwMask = iFlags = 0;
+
+ for (i=0; _eventorder[i]; i++) {
+ result = IsDlgButtonChecked(hwndDlg, IDC_T1 + i);
+ dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
+ iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
+ }
+ if (iFlags&GC_EVENT_ADDSTATUS)
+ iFlags |= GC_EVENT_REMOVESTATUS;
+
+ if (si) {
+ if (dwMask == 0) {
+ DBDeleteContactSetting(si->hContact, "Chat", "TrayIconFlags");
+ DBDeleteContactSetting(si->hContact, "Chat", "TrayIconMask");
+ } else {
+ M->WriteDword(si->hContact, "Chat", "TrayIconFlags", iFlags);
+ M->WriteDword(si->hContact, "Chat", "TrayIconMask", dwMask);
}
+ Chat_SetFilters(si);
+ SendMessage(si->hWnd, GC_CHANGEFILTERFLAG, 0, (LPARAM)iFlags);
+ if (si->bFilterEnabled)
+ SendMessage(si->hWnd, GC_REDRAWLOG, 0, 0);
}
- DestroyWindow(hwndDlg);
- break;
- case WM_DESTROY:
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- break;
+ }
+ DestroyWindow(hwndDlg);
+ break;
+ case WM_DESTROY:
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ break;
}
return(FALSE);
}
@@ -1295,19 +1297,18 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
HWND hwndParent = GetParent(hwnd);
switch (msg) {
- case WM_RBUTTONUP: {
- HWND hFilter = GetDlgItem(hwndParent, IDC_FILTER);
- HWND hColor = GetDlgItem(hwndParent, IDC_COLOR);
- HWND hBGColor = GetDlgItem(hwndParent, IDC_BKGCOLOR);
-
- if (M->GetByte("Chat", "RightClickFilter", 0) != 0) {
- if (hFilter == hwnd)
- SendMessage(hwndParent, GC_SHOWFILTERMENU, 0, 0);
- if (hColor == hwnd)
- SendMessage(hwndParent, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_COLOR);
- if (hBGColor == hwnd)
- SendMessage(hwndParent, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_BKGCOLOR);
- }
+ case WM_RBUTTONUP:
+ HWND hFilter = GetDlgItem(hwndParent, IDC_FILTER);
+ HWND hColor = GetDlgItem(hwndParent, IDC_COLOR);
+ HWND hBGColor = GetDlgItem(hwndParent, IDC_BKGCOLOR);
+
+ if (M->GetByte("Chat", "RightClickFilter", 0) != 0) {
+ if (hFilter == hwnd)
+ SendMessage(hwndParent, GC_SHOWFILTERMENU, 0, 0);
+ if (hColor == hwnd)
+ SendMessage(hwndParent, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_COLOR);
+ if (hBGColor == hwnd)
+ SendMessage(hwndParent, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_BKGCOLOR);
}
break;
}
@@ -1315,7 +1316,6 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
return mir_callNextSubclass(hwnd, ButtonSubclassProc, msg, wParam, lParam);
}
-
/*
* subclassing for the message history display (rich edit control in which the chat history appears)
*/
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 0cbfd39b5f..9568e34161 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -586,6 +586,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
pContainer = (struct TContainerData *) lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pContainer);
+ mir_subclassWindow(hwndDlg, ContainerWndProc);
pContainer->hwnd = hwndDlg;
dwCreateFlags = pContainer->dwFlags;
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index 7af941f3bb..5399a6da56 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -222,6 +222,7 @@ void CInfoPanel::showHide() const
*
* @return bool: panel is visible for this session
*/
+
bool CInfoPanel::getVisibility()
{
if (m_dat->hContact == 0) {
@@ -271,6 +272,7 @@ HFONT CInfoPanel::setUnderlinedFont(const HDC hdc, HFONT hFontOrig)
HFONT hFontNew = ::CreateFontIndirect(&lf);
return(reinterpret_cast<HFONT>(::SelectObject(hdc, hFontNew)));
}
+
/**
* Render the info panel background.
*
@@ -281,40 +283,38 @@ HFONT CInfoPanel::setUnderlinedFont(const HDC hdc, HFONT hFontOrig)
*/
void CInfoPanel::renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool fAero, bool fAutoCalc) const
{
- if (m_active) {
+ if (!m_active)
+ return;
- if (fAutoCalc)
- rc.bottom = m_height + 1;
- if (fAero) {
- RECT rcBlack = rc;
+ if (fAutoCalc)
+ rc.bottom = m_height + 1;
+ if (fAero) {
+ RECT rcBlack = rc;
+ rc.bottom -= 2;
+ ::FillRect(hdc, &rc, CSkin::m_BrushBack);
+ CSkin::ApplyAeroEffect(hdc, &rc, CSkin::AERO_EFFECT_AREA_INFOPANEL);
+ rcBlack.top = rc.bottom;// + 1;
+ rcBlack.bottom = rcBlack.top + 2;
+ if (CSkin::m_pCurrentAeroEffect && CSkin::m_pCurrentAeroEffect->m_clrBack != 0)
+ ::DrawAlpha(hdc, &rcBlack, CSkin::m_pCurrentAeroEffect->m_clrBack, 90, CSkin::m_pCurrentAeroEffect->m_clrBack, 0, 0, 0, 1, 0);
+ }
+ else {
+ if (CSkin::m_skinEnabled) {
rc.bottom -= 2;
- ::FillRect(hdc, &rc, CSkin::m_BrushBack);
- CSkin::ApplyAeroEffect(hdc, &rc, CSkin::AERO_EFFECT_AREA_INFOPANEL);
- rcBlack.top = rc.bottom;// + 1;
- rcBlack.bottom = rcBlack.top + 2;
- if (CSkin::m_pCurrentAeroEffect && CSkin::m_pCurrentAeroEffect->m_clrBack != 0)
- ::DrawAlpha(hdc, &rcBlack, CSkin::m_pCurrentAeroEffect->m_clrBack, 90, CSkin::m_pCurrentAeroEffect->m_clrBack, 0,
- 0, 0, 1, 0);
- }
- else {
- if (CSkin::m_skinEnabled) {
- 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)
- CSkin::DrawItem(hdc, &rc, item);
- } else {
- rc.bottom -= 2;
- ::DrawAlpha(hdc, &rc, PluginConfig.m_ipBackgroundGradient, 100, PluginConfig.m_ipBackgroundGradientHigh, 0, 17,
- 0, 0, 0);
- if (fAutoCalc) {
- rc.top = rc.bottom - 1;
- rc.left--; rc.right++;
- }
+ 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)
+ CSkin::DrawItem(hdc, &rc, item);
+ } else {
+ rc.bottom -= 2;
+ ::DrawAlpha(hdc, &rc, PluginConfig.m_ipBackgroundGradient, 100, PluginConfig.m_ipBackgroundGradientHigh, 0, 17, 0, 0, 0);
+ if (fAutoCalc) {
+ rc.top = rc.bottom - 1;
+ rc.left--; rc.right++;
}
}
}
@@ -630,18 +630,18 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem)
* @param hdc HDC: device context for drawing.
* @param rcItem RECT &: target rectangle for drawing
*/
+
void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem)
{
- SESSION_INFO *si = reinterpret_cast<SESSION_INFO *>(m_dat->si);
-
- HFONT hOldFont = 0;
-
+ SESSION_INFO *si = reinterpret_cast<SESSION_INFO *>(m_dat->si);
if (si == 0)
return;
::SetBkMode(hdc, TRANSPARENT);
m_szNick.cx = m_szNick.cy = 0;
+ HFONT hOldFont = 0;
+
if (m_height < DEGRADE_THRESHOLD) {
TCHAR tszText[2048];
@@ -726,11 +726,11 @@ void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem)
/**
* Invalidate the info panel rectangle
*/
+
void CInfoPanel::Invalidate(BOOL fErase) const
{
- RECT rc;
-
if (m_active) {
+ RECT rc;
::GetClientRect(m_dat->hwnd, &rc);
rc.bottom = m_height;
::InvalidateRect(m_dat->hwnd, &rc, fErase);
@@ -788,27 +788,26 @@ HMENU CInfoPanel::constructContextualMenu() const
LRESULT CInfoPanel::cmdHandler(UINT cmd)
{
switch(cmd) {
- case CMD_IP_COPY:
- if (m_hoverFlags & HOVER_NICK) {
- Utils::CopyToClipBoard(const_cast<wchar_t *>(m_dat->cache->getNick()), m_dat->hwnd);
- return(S_OK);
- }
- else if (m_hoverFlags & HOVER_UIN) {
- Utils::CopyToClipBoard(m_isChat ? m_dat->si->ptszTopic : const_cast<wchar_t *>(m_dat->cache->getUIN()), m_dat->hwnd);
- return(S_OK);
- }
- break;
- case IDC_CHAT_HISTORY:
- case IDC_CHANMGR:
- if (m_isChat) {
- SendMessage(m_dat->hwnd, WM_COMMAND, cmd, 0);
- return(S_OK);
- }
- break;
- default:
- break;
+ case CMD_IP_COPY:
+ if (m_hoverFlags & HOVER_NICK) {
+ Utils::CopyToClipBoard(const_cast<wchar_t *>(m_dat->cache->getNick()), m_dat->hwnd);
+ return(S_OK);
+ }
+ if (m_hoverFlags & HOVER_UIN) {
+ Utils::CopyToClipBoard(m_isChat ? m_dat->si->ptszTopic : const_cast<wchar_t *>(m_dat->cache->getUIN()), m_dat->hwnd);
+ return(S_OK);
+ }
+ break;
+
+ case IDC_CHAT_HISTORY:
+ case IDC_CHANMGR:
+ if (m_isChat) {
+ SendMessage(m_dat->hwnd, WM_COMMAND, cmd, 0);
+ return(S_OK);
+ }
+ break;
}
- return(S_FALSE); // not handled
+ return S_FALSE; // not handled
}
/**
@@ -1022,82 +1021,78 @@ void CInfoPanel::hideTip(const HWND hwndNew)
*/
LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
- case WM_ERASEBKGND:
- {
- /*
- * parent window of the infopanel ACC control
- */
- RECT rc, rcItem;
- TWindowData* dat = (TWindowData *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+ switch (msg) {
+ case WM_ERASEBKGND:
+ /*
+ * parent window of the infopanel ACC control
+ */
+ RECT rc, rcItem;
+ TWindowData *dat = (TWindowData *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+ if (dat == 0)
+ break;
- if (dat == 0)
- break;
+ GetClientRect(hwnd, &rcItem);
+ rc = rcItem;
+ if (!IsWindowEnabled(hwnd) || !dat->Panel->isActive() || dat->showInfoPic == 0)
+ return TRUE;
- GetClientRect(hwnd, &rcItem);
- rc = rcItem;
- if (!IsWindowEnabled(hwnd) || !dat->Panel->isActive() || dat->showInfoPic == 0)
- return(TRUE);
+ HDC dcWin = (HDC)wParam;
- HDC dcWin = (HDC)wParam;
+ if (M->isAero()) {
+ HDC hdc;
+ HBITMAP hbm, hbmOld;
+ LONG cx = rcItem.right - rcItem.left;
+ LONG cy = rcItem.bottom - rcItem.top;
- if (M->isAero()) {
- HDC hdc;
- HBITMAP hbm, hbmOld;
- LONG cx = rcItem.right - rcItem.left;
- LONG cy = rcItem.bottom - rcItem.top;
-
- rc.left -= 3; rc.right += 3;
- rc.bottom += 2;
-
- hdc = CreateCompatibleDC(dcWin);
- hbm = CSkin::CreateAeroCompatibleBitmap(rc, dcWin);
- hbmOld = (HBITMAP)SelectObject(hdc, hbm);
-
- if (CSkin::m_pCurrentAeroEffect == 0)
- FillRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
- else {
- if (CSkin::m_pCurrentAeroEffect->m_finalAlpha == 0)
- CSkin::ApplyAeroEffect(hdc, &rc, CSkin::AERO_EFFECT_AREA_INFOPANEL, 0);
- else {
- FillRect(hdc, &rc, CSkin::m_BrushBack);
- CSkin::ApplyAeroEffect(hdc, &rc, CSkin::AERO_EFFECT_AREA_INFOPANEL, 0);
- }
- }
- BitBlt(dcWin, 0, 0, cx, cy, hdc, 0, 0, SRCCOPY);
- SelectObject(hdc, hbmOld);
- DeleteObject(hbm);
- DeleteDC(hdc);
- }
+ rc.left -= 3; rc.right += 3;
+ rc.bottom += 2;
+
+ hdc = CreateCompatibleDC(dcWin);
+ hbm = CSkin::CreateAeroCompatibleBitmap(rc, dcWin);
+ hbmOld = (HBITMAP)SelectObject(hdc, hbm);
+
+ if (CSkin::m_pCurrentAeroEffect == 0)
+ FillRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
+ else {
+ if (CSkin::m_pCurrentAeroEffect->m_finalAlpha == 0)
+ CSkin::ApplyAeroEffect(hdc, &rc, CSkin::AERO_EFFECT_AREA_INFOPANEL, 0);
else {
- rc.bottom += 2;
- rc.left -= 3; rc.right += 3;
- dat->Panel->renderBG(dcWin, rc, &SkinItems[ID_EXTBKINFOPANELBG], M->isAero(), false);
+ FillRect(hdc, &rc, CSkin::m_BrushBack);
+ CSkin::ApplyAeroEffect(hdc, &rc, CSkin::AERO_EFFECT_AREA_INFOPANEL, 0);
}
- if (CSkin::m_bAvatarBorderType == 1) {
- HRGN clipRgn = 0;
+ }
+ BitBlt(dcWin, 0, 0, cx, cy, hdc, 0, 0, SRCCOPY);
+ SelectObject(hdc, hbmOld);
+ DeleteObject(hbm);
+ DeleteDC(hdc);
+ }
+ else {
+ rc.bottom += 2;
+ rc.left -= 3; rc.right += 3;
+ dat->Panel->renderBG(dcWin, rc, &SkinItems[ID_EXTBKINFOPANELBG], M->isAero(), false);
+ }
+ if (CSkin::m_bAvatarBorderType == 1) {
+ HRGN clipRgn = 0;
- if (dat->hwndPanelPic) {
- RECT rcPic;
- GetClientRect(dat->hwndPanelPic, &rcPic);
- LONG ix = ((rcItem.right - rcItem.left) - rcPic.right) / 2 - 1;
- LONG iy = ((rcItem.bottom - rcItem.top) - rcPic.bottom) / 2 - 1;
+ if (dat->hwndPanelPic) {
+ RECT rcPic;
+ GetClientRect(dat->hwndPanelPic, &rcPic);
+ LONG ix = ((rcItem.right - rcItem.left) - rcPic.right) / 2 - 1;
+ LONG iy = ((rcItem.bottom - rcItem.top) - rcPic.bottom) / 2 - 1;
- clipRgn = CreateRectRgn(ix, iy, ix + rcPic.right + 2, iy + rcPic.bottom + 2);
- }
- else
- clipRgn = CreateRectRgn(rcItem.left, rcItem.top, rcItem.right, rcItem.bottom);
- HBRUSH hbr = CreateSolidBrush(CSkin::m_avatarBorderClr);
- FrameRgn(dcWin, clipRgn, hbr, 1, 1);
- DeleteObject(hbr);
- DeleteObject(clipRgn);
- }
- return(TRUE);
+ clipRgn = CreateRectRgn(ix, iy, ix + rcPic.right + 2, iy + rcPic.bottom + 2);
+ }
+ else
+ clipRgn = CreateRectRgn(rcItem.left, rcItem.top, rcItem.right, rcItem.bottom);
+ HBRUSH hbr = CreateSolidBrush(CSkin::m_avatarBorderClr);
+ FrameRgn(dcWin, clipRgn, hbr, 1, 1);
+ DeleteObject(hbr);
+ DeleteObject(clipRgn);
}
- default:
- break;
+ return TRUE;
}
- return(DefWindowProc(hwnd, msg, wParam, lParam));
+
+ return DefWindowProc(hwnd, msg, wParam, lParam);
}
/**
@@ -1111,18 +1106,15 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProcStub(HWND hwnd, UINT msg, WPARAM wPara
CInfoPanel *infoPanel = reinterpret_cast<CInfoPanel *>(::GetWindowLongPtr(hwnd, GWLP_USERDATA));
if (infoPanel)
- return(infoPanel->ConfigDlgProc(hwnd, msg, wParam, lParam));
+ return infoPanel->ConfigDlgProc(hwnd, msg, wParam, lParam);
switch(msg) {
- case WM_INITDIALOG: {
- ::SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
- infoPanel = reinterpret_cast<CInfoPanel *>(lParam);
- return(infoPanel->ConfigDlgProc(hwnd, msg, wParam, lParam));
- }
- default:
- break;
+ case WM_INITDIALOG:
+ ::SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
+ infoPanel = reinterpret_cast<CInfoPanel *>(lParam);
+ return infoPanel->ConfigDlgProc(hwnd, msg, wParam, lParam);
}
- return(FALSE);
+ return FALSE;
}
/**
@@ -1131,15 +1123,16 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProcStub(HWND hwnd, UINT msg, WPARAM wPara
INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
+ {
TCHAR tszTitle[100];
mir_sntprintf(tszTitle, 100, TranslateT("Set panel visibility for this %s"),
- m_isChat ? TranslateT("chat room") : TranslateT("contact"));
+ m_isChat ? TranslateT("chat room") : TranslateT("contact"));
::SetDlgItemText(hwnd, IDC_STATIC_VISIBILTY, tszTitle);
mir_sntprintf(tszTitle, 100, m_isChat ? TranslateT("Do not synchronize the panel height with IM windows") :
- TranslateT("Do not synchronize the panel height with group chat windows"));
+ TranslateT("Do not synchronize the panel height with group chat windows"));
::SetDlgItemText(hwnd, IDC_NOSYNC, tszTitle);
@@ -1166,14 +1159,13 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
::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);
+ else Utils::enableDlgControl(hwnd, IDC_PANELPICTUREVIS, FALSE);
- return(FALSE);
}
+ return FALSE;
- case WM_CTLCOLOREDIT:
- case WM_CTLCOLORSTATIC:
+ case WM_CTLCOLOREDIT:
+ case WM_CTLCOLORSTATIC:
{
HWND hwndChild = (HWND)lParam;
UINT id = ::GetDlgCtrlID(hwndChild);
@@ -1203,13 +1195,13 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
}
- case WM_COMMAND: {
+ case WM_COMMAND:
+ {
LONG lOldHeight = m_height;
-
switch(LOWORD(wParam)) {
- case IDC_PANELSIZE: {
+ case IDC_PANELSIZE:
+ {
LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELSIZE, CB_GETCURSEL, 0, 0);
-
if (iResult == 0) {
if (m_fPrivateHeight) {
M->WriteDword(m_dat->hContact, SRMSGMOD_T, "panelheight", m_height);
@@ -1218,13 +1210,14 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
}
else if (iResult == 1) {
M->WriteDword(m_dat->hContact, SRMSGMOD_T, "panelheight",
- MAKELONG(M->GetDword(m_dat->hContact, "panelheight", m_height), 0xffff));
+ MAKELONG(M->GetDword(m_dat->hContact, "panelheight", m_height), 0xffff));
loadHeight();
}
- break;
}
+ break;
- case IDC_PANELPICTUREVIS: {
+ case IDC_PANELPICTUREVIS:
+ {
BYTE vOld = M->GetByte(m_dat->hContact, SRMSGMOD_T, "hideavatar", -1);
LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELPICTUREVIS, CB_GETCURSEL, 0, 0);
@@ -1239,10 +1232,11 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
::SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
::DM_ScrollToBottom(m_dat, 0, 1);
}
- break;
}
+ break;
- case IDC_PANELVISIBILITY: {
+ case IDC_PANELVISIBILITY:
+ {
BYTE vOld = M->GetByte(m_dat->hContact, SRMSGMOD_T, "infopanel", 0);
LRESULT iResult = ::SendDlgItemMessage(hwnd, IDC_PANELVISIBILITY, CB_GETCURSEL, 0, 0);
@@ -1252,36 +1246,36 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
getVisibility();
showHide();
}
- break;
}
+ break;
- case IDC_SIZECOMPACT:
- setHeight(MIN_PANELHEIGHT + 2, true);
- break;
+ case IDC_SIZECOMPACT:
+ setHeight(MIN_PANELHEIGHT + 2, true);
+ break;
- case IDC_SIZENORMAL:
- setHeight(DEGRADE_THRESHOLD, true);
- break;
+ case IDC_SIZENORMAL:
+ setHeight(DEGRADE_THRESHOLD, true);
+ break;
- case IDC_SIZELARGE:
- setHeight(51, true);
- break;
+ case IDC_SIZELARGE:
+ setHeight(51, true);
+ break;
- case IDC_NOSYNC:
- M->WriteByte(SRMSGMOD_T, "syncAllPanels", ::IsDlgButtonChecked(hwnd, IDC_NOSYNC) ? 0 : 1);
- if (!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_NOSYNC:
+ M->WriteByte(SRMSGMOD_T, "syncAllPanels", ::IsDlgButtonChecked(hwnd, IDC_NOSYNC) ? 0 : 1);
+ if (!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;
}
if (m_height != lOldHeight) {
::SendMessage(m_dat->hwnd, WM_SIZE, 0, 0);
@@ -1290,25 +1284,24 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
::RedrawWindow(m_dat->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
::RedrawWindow(GetParent(m_dat->hwnd), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
}
- break;
}
+ break;
- case WM_CLOSE:
- if (wParam == 1 && lParam == 1) {
- ::DestroyWindow(hwnd);
- }
- break;
+ case WM_CLOSE:
+ if (wParam == 1 && lParam == 1) {
+ ::DestroyWindow(hwnd);
+ }
+ break;
- case WM_DESTROY: {
- ::DeleteObject(m_configDlgBoldFont);
- ::DeleteObject(m_configDlgFont);
+ case WM_DESTROY:
+ ::DeleteObject(m_configDlgBoldFont);
+ ::DeleteObject(m_configDlgFont);
- m_configDlgBoldFont = m_configDlgFont = 0;
- ::SetWindowLongPtr(hwnd, GWLP_USERDATA, 0L);
- break;
- }
+ m_configDlgBoldFont = m_configDlgFont = 0;
+ ::SetWindowLongPtr(hwnd, GWLP_USERDATA, 0L);
+ break;
}
- return(FALSE);
+ return FALSE;
}
/**
@@ -1365,11 +1358,11 @@ void CInfoPanel::dismissConfig(bool fForced)
if (m_hwndConfig == 0)
return;
- POINT pt;
- RECT rc;
-
if (!m_fDialogCreated) {
+ POINT pt;
::GetCursorPos(&pt);
+
+ RECT rc;
::GetWindowRect(m_hwndConfig, &rc);
if (fForced || !PtInRect(&rc, pt)) {
SendMessage(m_hwndConfig, WM_CLOSE, 1, 1);
@@ -1551,12 +1544,9 @@ INT_PTR CALLBACK CTip::WndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
return(tip->WndProc(hwnd, msg, wParam, lParam));
switch(msg) {
- case WM_CREATE: {
- CREATESTRUCT *cs = reinterpret_cast<CREATESTRUCT *>(lParam);
- ::SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(cs->lpCreateParams));
- }
- default:
- break;
+ case WM_CREATE:
+ CREATESTRUCT *cs = reinterpret_cast<CREATESTRUCT *>(lParam);
+ ::SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(cs->lpCreateParams));
}
return(::DefWindowProc(hwnd, msg, wParam, lParam));
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 889c96f0c7..1de04854b4 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -270,10 +270,10 @@ LRESULT CALLBACK IEViewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
struct TWindowData *mwdat = (struct 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));
+ 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);
}
@@ -290,23 +290,20 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
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) {
+ 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;
}
@@ -618,9 +615,10 @@ static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- LONG lastEnterTime = GetWindowLongPtr(hwnd, GWLP_USERDATA);
HWND hwndParent = GetParent(hwnd);
struct TWindowData *mwdat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ if (mwdat == NULL)
+ return 0;
/*
* prevent the rich edit from switching text direction or keyboard layout when
@@ -630,11 +628,11 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
GetKeyboardState(mwdat->kstate);
if (mwdat->kstate[VK_CONTROL] & 0x80 || mwdat->kstate[VK_SHIFT] & 0x80)
return 0;
- else {
- mwdat->fkeyProcessed = false;
- return 0;
- }
+
+ mwdat->fkeyProcessed = false;
+ return 0;
}
+
switch (msg) {
case WM_NCCALCSIZE:
return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageEditSubclassProc);
@@ -754,6 +752,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
break;
if (PluginConfig.m_SendOnDblEnter) {
+ LONG lastEnterTime = GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (lastEnterTime + 2 < time(NULL)) {
lastEnterTime = time(NULL);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lastEnterTime);
@@ -1743,30 +1742,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
* this allows border-less textboxes to appear "skinned" and blended with the
* background
*/
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint(hwndDlg, &ps);
+ PAINTSTRUCT ps;
+ HDC hdc = BeginPaint(hwndDlg, &ps);
EndPaint(hwndDlg, &ps);
- return 0;
}
+ return 0;
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd;
- BITMAP bminfo;
- RECT rc;
- int saved = 0;
- HBITMAP hbm = ((dat->Panel->isActive()) && m_pContainer->avatarMode != 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown);
-
- if (IsIconic(hwndDlg))
- break;
- ZeroMemory(&urd, sizeof(urd));
- urd.cbSize = sizeof(urd);
- urd.hInstance = g_hInst;
- urd.hwndDlg = hwndDlg;
- urd.lParam = (LPARAM) dat;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_MSGSPLITNEW);
- urd.pfnResizer = MessageDialogResize;
-
+ if ( !IsIconic(hwndDlg)) {
if (dat->ipFieldHeight == 0)
dat->ipFieldHeight = CInfoPanel::m_ipConfig.height2;
@@ -1780,13 +1763,24 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
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);
}
+ RECT rc;
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);
/*
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index 9afa313492..a40902dc0d 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -1406,227 +1406,6 @@ void CSkin::ReadImageItem(const TCHAR *itemname)
delete szImageFileName;
}
-/* DISABLED code
-
-void CSkin::ReadButtonItem(const TCHAR *itemName) const
-{
- ButtonItem tmpItem, *newItem;
- TCHAR szBuffer[1024];
- char szBufferA[1024];
- CImageItem *imgItem = m_ImageItems;
- HICON *phIcon;
-
- ZeroMemory(&tmpItem, sizeof(tmpItem));
- mir_snprintf(tmpItem.szName, safe_sizeof(tmpItem.szName), "%s", &szItemNameA[1]);
- tmpItem.width = GetPrivateProfileInt(itemName, _T("Width"), 16, m_tszFileName);
- tmpItem.height = GetPrivateProfileInt(itemName,_T( "Height"), 16, m_tszFileName);
- tmpItem.xOff = GetPrivateProfileInt(itemName, _T("xoff"), 0, m_tszFileName);
- tmpItem.yOff = GetPrivateProfileInt(itemName, _T("yoff"), 0, m_tszFileName);
-
- tmpItem.dwFlags |= GetPrivateProfileInt(itemName, _T("toggle"), 0, m_tszFileName) ? BUTTON_ISTOGGLE : 0;
-
- GetPrivateProfileString(itemName, _T("Pressed"), _T("None"), szBuffer, 1000, m_tszFileName);
- if (!_tcsicmp(szBuffer, _T("default")))
- tmpItem.imgPressed = SkinItems[ID_EXTBKBUTTONSPRESSED].imageItem;
- else {
- while (imgItem) {
- if (!_tcsicmp(imgItem->getName(), szBuffer)) {
- tmpItem.imgPressed = imgItem;
- break;
- }
- imgItem = imgItem->getNextItem();
- }
- }
-
- imgItem = m_ImageItems;
- GetPrivateProfileString(itemName, _T("Normal"), _T("None"), szBuffer, 1000, m_tszFileName);
- if (!_tcsicmp(szBuffer, _T("default")))
- tmpItem.imgNormal = SkinItems[ID_EXTBKBUTTONSNPRESSED].imageItem;
- else {
- while (imgItem) {
- if (!_tcsicmp(imgItem->getName(), szBuffer)) {
- tmpItem.imgNormal = imgItem;
- break;
- }
- imgItem = imgItem->getNextItem();
- }
- }
-
- imgItem = m_ImageItems;
- GetPrivateProfileString(itemName, _T("Hover"), _T("None"), szBuffer, 1000, m_tszFileName);
- if (!_tcsicmp(szBuffer, _T("default")))
- tmpItem.imgHover = SkinItems[ID_EXTBKBUTTONSMOUSEOVER].imageItem;
- else {
- while (imgItem) {
- if (!_tcsicmp(imgItem->getName(), szBuffer)) {
- tmpItem.imgHover = imgItem;
- break;
- }
- imgItem = imgItem->getNextItem();
- }
- }
-
- tmpItem.uId = IDC_TBFIRSTUID - 1;
- tmpItem.pfnAction = tmpItem.pfnCallback = NULL;
-
- GetPrivateProfileString(itemName, _T("Action"), _T("Custom"), szBuffer, 1000, m_tszFileName);
- if (!_tcsicmp(szBuffer, _T("service"))) {
- tmpItem.szService[0] = 0;
- GetPrivateProfileStringA(szItemNameA, "Service", "None", szBufferA, 1000, szFileNameA);
- if (_stricmp(szBufferA, "None")) {
- mir_snprintf(tmpItem.szService, 256, "%s", szBufferA);
- tmpItem.dwFlags |= BUTTON_ISSERVICE;
- tmpItem.uId = nextButtonID++;
- }
- } else if (!_tcsicmp(szBuffer, _T("protoservice"))) {
- tmpItem.szService[0] = 0;
- GetPrivateProfileStringA(szItemNameA, "Service", "None", szBufferA, 1000, szFileNameA);
- if (_stricmp(szBufferA, "None")) {
- mir_snprintf(tmpItem.szService, 256, "%s", szBufferA);
- tmpItem.dwFlags |= BUTTON_ISPROTOSERVICE;
- tmpItem.uId = nextButtonID++;
- }
- } else if (!_tcsicmp(szBuffer, _T("database"))) {
- int n;
-
- GetPrivateProfileStringA(szItemNameA, "Module", "None", szBufferA, 1000, szFileNameA);
- if (_stricmp(szBufferA, "None"))
- mir_snprintf(tmpItem.szModule, 256, "%s", szBufferA);
- GetPrivateProfileStringA(szItemNameA, "Setting", "None", szBufferA, 1000, szFileNameA);
- if (_stricmp(szBufferA, "None"))
- mir_snprintf(tmpItem.szSetting, 256, "%s", szBufferA);
- if (GetPrivateProfileIntA(szItemNameA, "contact", 0, szFileNameA) != 0)
- tmpItem.dwFlags |= BUTTON_DBACTIONONCONTACT;
-
- for (n = 0; n <= 1; n++) {
- char szKey[20];
- BYTE *pValue;
-
- strcpy(szKey, n == 0 ? "dbonpush" : "dbonrelease");
- pValue = (n == 0 ? tmpItem.bValuePush : tmpItem.bValueRelease);
-
- GetPrivateProfileStringA(szItemNameA, szKey, "None", szBufferA, 1000, szFileNameA);
- switch (szBufferA[0]) {
- case 'b': {
- BYTE value = (BYTE)atol(&szBufferA[1]);
- pValue[0] = value;
- tmpItem.type = DBVT_BYTE;
- break;
- }
- case 'w': {
- WORD value = (WORD)atol(&szBufferA[1]);
- *((WORD *)&pValue[0]) = value;
- tmpItem.type = DBVT_WORD;
- break;
- }
- case 'd': {
- DWORD value = (DWORD)atol(&szBufferA[1]);
- *((DWORD *)&pValue[0]) = value;
- tmpItem.type = DBVT_DWORD;
- break;
- }
- case 's': {
- mir_snprintf((char *)pValue, 256, &szBufferA[1]);
- tmpItem.type = DBVT_ASCIIZ;
- break;
- }
- }
- }
- if (tmpItem.szModule[0] && tmpItem.szSetting[0]) {
- tmpItem.dwFlags |= BUTTON_ISDBACTION;
- if (tmpItem.szModule[0] == '$' && (tmpItem.szModule[1] == 'c' || tmpItem.szModule[1] == 'C'))
- tmpItem.dwFlags |= BUTTON_ISCONTACTDBACTION;
- tmpItem.uId = nextButtonID++;
- }
- } else if (_tcsicmp(szBuffer, _T("Custom"))) {
- if (BTN_GetStockItem(&tmpItem, szBuffer))
- goto create_it;
- }
- GetPrivateProfileString(itemName, _T("PassContact"), _T("None"), szBuffer, 1000, m_tszFileName);
- if (_tcsicmp(szBuffer, _T("None"))) {
- if (szBuffer[0] == 'w' || szBuffer[0] == 'W')
- tmpItem.dwFlags |= BUTTON_PASSHCONTACTW;
- else if (szBuffer[0] == 'l' || szBuffer[0] == 'L')
- tmpItem.dwFlags |= BUTTON_PASSHCONTACTL;
- }
-
- GetPrivateProfileString(itemName, _T("Tip"), _T("None"), szBuffer, 1000, m_tszFileName);
- if (_tcsicmp(szBuffer, _T("None"))) {
- mir_sntprintf(tmpItem.szTip, 256, _T("%s"), szBuffer);
- } else
- tmpItem.szTip[0] = 0;
-
-create_it:
-
- GetPrivateProfileString(itemName, _T("Label"), _T("None"), szBuffer, 40, m_tszFileName);
- if (_tcsicmp(szBuffer, _T("None"))) {
- mir_sntprintf(tmpItem.tszLabel, 40, _T("%s"), szBuffer);
- tmpItem.dwFlags |= BUTTON_HASLABEL;
- } else
- tmpItem.tszLabel[0] = 0;
-
- GetPrivateProfileString(itemName, _T("NormalGlyph"), _T("0, 0, 0, 0"), szBuffer, 1000, m_tszFileName);
- if (_tcsicmp(szBuffer, _T("default"))) {
- tmpItem.dwFlags &= ~BUTTON_NORMALGLYPHISICON;
- if ((phIcon = BTN_GetIcon(szBuffer)) != 0) {
- tmpItem.dwFlags |= BUTTON_NORMALGLYPHISICON;
- tmpItem.normalGlyphMetrics[0] = (LONG_PTR)phIcon;
- } else {
- _tscanf(szBuffer, _T("%d,%d,%d,%d"), &tmpItem.normalGlyphMetrics[0], &tmpItem.normalGlyphMetrics[1],
- &tmpItem.normalGlyphMetrics[2], &tmpItem.normalGlyphMetrics[3]);
- tmpItem.normalGlyphMetrics[2] = (tmpItem.normalGlyphMetrics[2] - tmpItem.normalGlyphMetrics[0]) + 1;
- tmpItem.normalGlyphMetrics[3] = (tmpItem.normalGlyphMetrics[3] - tmpItem.normalGlyphMetrics[1]) + 1;
- }
- }
-
- GetPrivateProfileString(itemName, _T("PressedGlyph"), _T("0, 0, 0, 0"), szBuffer, 1000, m_tszFileName);
- if (_tcsicmp(szBuffer, _T("default"))) {
- tmpItem.dwFlags &= ~BUTTON_PRESSEDGLYPHISICON;
- if ((phIcon = BTN_GetIcon(szBuffer)) != 0) {
- tmpItem.pressedGlyphMetrics[0] = (LONG_PTR)phIcon;
- tmpItem.dwFlags |= BUTTON_PRESSEDGLYPHISICON;
- } else {
- _tscanf(szBuffer, _T("%d,%d,%d,%d"), &tmpItem.pressedGlyphMetrics[0], &tmpItem.pressedGlyphMetrics[1],
- &tmpItem.pressedGlyphMetrics[2], &tmpItem.pressedGlyphMetrics[3]);
- tmpItem.pressedGlyphMetrics[2] = (tmpItem.pressedGlyphMetrics[2] - tmpItem.pressedGlyphMetrics[0]) + 1;
- tmpItem.pressedGlyphMetrics[3] = (tmpItem.pressedGlyphMetrics[3] - tmpItem.pressedGlyphMetrics[1]) + 1;
- }
- }
-
- GetPrivateProfileString(itemName, _T("HoverGlyph"), _T("0, 0, 0, 0"), szBuffer, 1000, m_tszFileName);
- if (_tcsicmp(szBuffer, _T("default"))) {
- tmpItem.dwFlags &= ~BUTTON_HOVERGLYPHISICON;
- if ((phIcon = BTN_GetIcon(szBuffer)) != 0) {
- tmpItem.hoverGlyphMetrics[0] = (LONG_PTR)phIcon;
- tmpItem.dwFlags |= BUTTON_HOVERGLYPHISICON;
- } else {
- _tscanf(szBuffer, _T("%d,%d,%d,%d"), &tmpItem.hoverGlyphMetrics[0], &tmpItem.hoverGlyphMetrics[1],
- &tmpItem.hoverGlyphMetrics[2], &tmpItem.hoverGlyphMetrics[3]);
- tmpItem.hoverGlyphMetrics[2] = (tmpItem.hoverGlyphMetrics[2] - tmpItem.hoverGlyphMetrics[0]) + 1;
- tmpItem.hoverGlyphMetrics[3] = (tmpItem.hoverGlyphMetrics[3] - tmpItem.hoverGlyphMetrics[1]) + 1;
- }
- }
-
- newItem = (ButtonItem *)malloc(sizeof(ButtonItem));
- ZeroMemory(newItem, sizeof(ButtonItem));
- if (g_ButtonSet.items == NULL) {
- g_ButtonSet.items = newItem;
- *newItem = tmpItem;
- newItem->nextItem = 0;
- } else {
- ButtonItem *curItem = g_ButtonSet.items;
- while (curItem->nextItem)
- curItem = curItem->nextItem;
- *newItem = tmpItem;
- newItem->nextItem = 0;
- curItem->nextItem = newItem;
- }
- mir_free((void*)szItemNameA);
- return;
-}
-
-*/
-
/**
* Load the skin from the .tsk file
* It reads and initializes all static values for the skin. Afterwards
@@ -1645,158 +1424,156 @@ void CSkin::Load(void)
m_fHaveGlyph = false;
- if (m_tszFileName[0]) {
- if (::PathFileExists(m_tszFileName)) {
- TCHAR *p;
- TCHAR *szSections = (TCHAR *)malloc(6004);
- int i = 1, j = 0;
- UINT data;
- TCHAR buffer[500];
+ if ( !m_tszFileName[0] || !::PathFileExists(m_tszFileName))
+ return;
- if (!(GetPrivateProfileInt(_T("Global"), _T("Version"), 0, m_tszFileName) >= 1 &&
- GetPrivateProfileInt(_T("Global"), _T("Signature"), 0, m_tszFileName) == 101))
- return;
+ TCHAR *p;
+ TCHAR *szSections = (TCHAR *)malloc(6004);
+ int i = 1, j = 0;
+ UINT data;
+ TCHAR buffer[500];
- i = 0;
- while (_tagSettings[i].szIniKey != NULL) {
- data = 0;
- data = GetPrivateProfileInt(_tagSettings[i].szIniKey, _tagSettings[i].szIniName,
- _tagSettings[i].defaultval, m_tszFileName);
- switch (_tagSettings[i].size) {
- case 1:
- M->WriteByte(SRMSGMOD_T, _tagSettings[i].szSetting, (BYTE)data);
- break;
- case 4:
- M->WriteDword(SRMSGMOD_T, _tagSettings[i].szSetting, data);
- break;
- case 2:
- DBWriteContactSettingWord(NULL, SRMSGMOD_T, _tagSettings[i].szSetting, (WORD)data);
- break;
- case 5:
- GetPrivateProfileString(_tagSettings[i].szIniKey, _tagSettings[i].szIniName, _T("000000"),
- buffer, 10, m_tszFileName);
- M->WriteDword(SRMSGMOD_T, _tagSettings[i].szSetting, HexStringToLong(buffer));
- break;
- }
- i++;
- }
+ if (!(GetPrivateProfileInt(_T("Global"), _T("Version"), 0, m_tszFileName) >= 1 && GetPrivateProfileInt(_T("Global"), _T("Signature"), 0, m_tszFileName) == 101))
+ return;
- m_DisableScrollbars = M->GetByte("disableVScroll", 0) ? true : false;
-
- ZeroMemory(szSections, 6000);
- p = szSections;
- GetPrivateProfileSectionNames(szSections, 3000, m_tszFileName);
- szSections[3001] = szSections[3000] = 0;
- p = szSections;
- while (lstrlen(p) > 1) {
- if (p[0] != '%') {
- p += (lstrlen(p) + 1);
- continue;
- }
- for (i=0; i <= ID_EXTBK_LAST; i++) {
- if (!_tcsicmp(&p[1], SkinItems[i].szName[0] == '{' ? &SkinItems[i].szName[3] : SkinItems[i].szName)) {
- ReadItem(i, p);
- break;
- }
- }
- p += (lstrlen(p) + 1);
- j++;
- }
+ i = 0;
+ while (_tagSettings[i].szIniKey != NULL) {
+ data = 0;
+ data = GetPrivateProfileInt(_tagSettings[i].szIniKey, _tagSettings[i].szIniName,
+ _tagSettings[i].defaultval, m_tszFileName);
+ switch (_tagSettings[i].size) {
+ case 1:
+ M->WriteByte(SRMSGMOD_T, _tagSettings[i].szSetting, (BYTE)data);
+ break;
+ case 4:
+ M->WriteDword(SRMSGMOD_T, _tagSettings[i].szSetting, data);
+ break;
+ case 2:
+ DBWriteContactSettingWord(NULL, SRMSGMOD_T, _tagSettings[i].szSetting, (WORD)data);
+ break;
+ case 5:
+ GetPrivateProfileString(_tagSettings[i].szIniKey, _tagSettings[i].szIniName, _T("000000"),
+ buffer, 10, m_tszFileName);
+ M->WriteDword(SRMSGMOD_T, _tagSettings[i].szSetting, HexStringToLong(buffer));
+ break;
+ }
+ i++;
+ }
+
+ m_DisableScrollbars = M->GetByte("disableVScroll", 0) ? true : false;
- if (j > 0) {
- m_skinEnabled = true;
- M->getAeroState(); // refresh aero state (set to false when a skin is successfully loaded and active)
+ ZeroMemory(szSections, 6000);
+ p = szSections;
+ GetPrivateProfileSectionNames(szSections, 3000, m_tszFileName);
+ szSections[3001] = szSections[3000] = 0;
+ p = szSections;
+ while (lstrlen(p) > 1) {
+ if (p[0] != '%') {
+ p += (lstrlen(p) + 1);
+ continue;
+ }
+ for (i=0; i <= ID_EXTBK_LAST; i++) {
+ if (!_tcsicmp(&p[1], SkinItems[i].szName[0] == '{' ? &SkinItems[i].szName[3] : SkinItems[i].szName)) {
+ ReadItem(i, p);
+ break;
}
+ }
+ p += (lstrlen(p) + 1);
+ j++;
+ }
- GetPrivateProfileString(_T("Avatars"), _T("BorderColor"), _T("000000"), buffer, 20, m_tszFileName);
- m_avatarBorderClr = (COLORREF)HexStringToLong(buffer);
+ if (j > 0) {
+ m_skinEnabled = true;
+ M->getAeroState(); // refresh aero state (set to false when a skin is successfully loaded and active)
+ }
+
+ GetPrivateProfileString(_T("Avatars"), _T("BorderColor"), _T("000000"), buffer, 20, m_tszFileName);
+ m_avatarBorderClr = (COLORREF)HexStringToLong(buffer);
- GetPrivateProfileString(_T("Global"), _T("SideBarBG"), _T("None"), buffer, 20, m_tszFileName);
- if (_tcscmp(buffer, _T("None")))
- m_sideBarContainerBG = (COLORREF)HexStringToLong(buffer);
- else
- m_sideBarContainerBG = SkinItems[ID_EXTBKSIDEBARBG].COLOR;
+ GetPrivateProfileString(_T("Global"), _T("SideBarBG"), _T("None"), buffer, 20, m_tszFileName);
+ if (_tcscmp(buffer, _T("None")))
+ m_sideBarContainerBG = (COLORREF)HexStringToLong(buffer);
+ else
+ m_sideBarContainerBG = SkinItems[ID_EXTBKSIDEBARBG].COLOR;
- m_bAvatarBorderType = GetPrivateProfileInt(_T("Avatars"), _T("BorderType"), 1, m_tszFileName);
+ m_bAvatarBorderType = GetPrivateProfileInt(_T("Avatars"), _T("BorderType"), 1, m_tszFileName);
- LoadIcon(_T("Global"), _T("CloseGlyph"), &CSkin::m_closeIcon);
- LoadIcon(_T("Global"), _T("MaximizeGlyph"), &CSkin::m_maxIcon);
- LoadIcon(_T("Global"), _T("MinimizeGlyph"), &CSkin::m_minIcon);
+ LoadIcon(_T("Global"), _T("CloseGlyph"), &CSkin::m_closeIcon);
+ LoadIcon(_T("Global"), _T("MaximizeGlyph"), &CSkin::m_maxIcon);
+ LoadIcon(_T("Global"), _T("MinimizeGlyph"), &CSkin::m_minIcon);
- m_frameSkins = GetPrivateProfileInt(_T("Global"), _T("framelessmode"), 0, m_tszFileName) ? true : false;
- m_DisableScrollbars = GetPrivateProfileInt(_T("Global"), _T("NoScrollbars"), 0, m_tszFileName) ? true : false;
+ m_frameSkins = GetPrivateProfileInt(_T("Global"), _T("framelessmode"), 0, m_tszFileName) ? true : false;
+ m_DisableScrollbars = GetPrivateProfileInt(_T("Global"), _T("NoScrollbars"), 0, m_tszFileName) ? true : false;
- m_SkinnedFrame_left = GetPrivateProfileInt(_T("WindowFrame"), _T("left"), 4, m_tszFileName);
- m_SkinnedFrame_right = GetPrivateProfileInt(_T("WindowFrame"), _T("right"), 4, m_tszFileName);
- m_SkinnedFrame_caption = GetPrivateProfileInt(_T("WindowFrame"), _T("Caption"), 24, m_tszFileName);
- m_SkinnedFrame_bottom = GetPrivateProfileInt(_T("WindowFrame"), _T("bottom"), 4, m_tszFileName);
+ m_SkinnedFrame_left = GetPrivateProfileInt(_T("WindowFrame"), _T("left"), 4, m_tszFileName);
+ m_SkinnedFrame_right = GetPrivateProfileInt(_T("WindowFrame"), _T("right"), 4, m_tszFileName);
+ m_SkinnedFrame_caption = GetPrivateProfileInt(_T("WindowFrame"), _T("Caption"), 24, m_tszFileName);
+ m_SkinnedFrame_bottom = GetPrivateProfileInt(_T("WindowFrame"), _T("bottom"), 4, m_tszFileName);
- m_titleBarButtonSize.cx = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonWidth"), 24, m_tszFileName);
- m_titleBarButtonSize.cy = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonHeight"), 12, m_tszFileName);
- m_titleButtonTopOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonTopOffset"), 0, m_tszFileName);
+ m_titleBarButtonSize.cx = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonWidth"), 24, m_tszFileName);
+ m_titleBarButtonSize.cy = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonHeight"), 12, m_tszFileName);
+ m_titleButtonTopOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonTopOffset"), 0, m_tszFileName);
- m_titleBarRightOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleBarRightOffset"), 0, m_tszFileName);
- m_titleBarLeftOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleBarLeftOffset"), 0, m_tszFileName);
+ m_titleBarRightOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleBarRightOffset"), 0, m_tszFileName);
+ m_titleBarLeftOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleBarLeftOffset"), 0, m_tszFileName);
- m_captionOffset = GetPrivateProfileInt(_T("WindowFrame"), _T("CaptionOffset"), 3, m_tszFileName);
- m_captionPadding = GetPrivateProfileInt(_T("WindowFrame"), _T("CaptionPadding"), 0, m_tszFileName);
- m_sidebarTopOffset = GetPrivateProfileInt(_T("ClientArea"), _T("SidebarTop"), -1, m_tszFileName);
- m_sidebarBottomOffset = GetPrivateProfileInt(_T("ClientArea"), _T("SidebarBottom"), -1, m_tszFileName);
+ m_captionOffset = GetPrivateProfileInt(_T("WindowFrame"), _T("CaptionOffset"), 3, m_tszFileName);
+ m_captionPadding = GetPrivateProfileInt(_T("WindowFrame"), _T("CaptionPadding"), 0, m_tszFileName);
+ m_sidebarTopOffset = GetPrivateProfileInt(_T("ClientArea"), _T("SidebarTop"), -1, m_tszFileName);
+ m_sidebarBottomOffset = GetPrivateProfileInt(_T("ClientArea"), _T("SidebarBottom"), -1, m_tszFileName);
- m_bClipBorder = GetPrivateProfileInt(_T("WindowFrame"), _T("ClipFrame"), 0, m_tszFileName) ? true : false;;
+ m_bClipBorder = GetPrivateProfileInt(_T("WindowFrame"), _T("ClipFrame"), 0, m_tszFileName) ? true : false;;
- BYTE radius_tl, radius_tr, radius_bl, radius_br;
- TCHAR szFinalName[MAX_PATH];
- TCHAR szDrive[MAX_PATH], szPath[MAX_PATH];
+ BYTE radius_tl, radius_tr, radius_bl, radius_br;
+ TCHAR szFinalName[MAX_PATH];
+ TCHAR szDrive[MAX_PATH], szPath[MAX_PATH];
- radius_tl = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusTL"), 0, m_tszFileName);
- radius_tr = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusTR"), 0, m_tszFileName);
- radius_bl = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusBL"), 0, m_tszFileName);
- radius_br = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusBR"), 0, m_tszFileName);
+ radius_tl = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusTL"), 0, m_tszFileName);
+ radius_tr = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusTR"), 0, m_tszFileName);
+ radius_bl = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusBL"), 0, m_tszFileName);
+ radius_br = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusBR"), 0, m_tszFileName);
- CSkin::m_bRoundedCorner = radius_tl;
+ CSkin::m_bRoundedCorner = radius_tl;
- GetPrivateProfileString(_T("Theme"), _T("File"), _T("None"), buffer, MAX_PATH, m_tszFileName);
+ GetPrivateProfileString(_T("Theme"), _T("File"), _T("None"), buffer, MAX_PATH, m_tszFileName);
- _tsplitpath(m_tszFileName, szDrive, szPath, NULL, NULL);
- mir_sntprintf(szFinalName, MAX_PATH, _T("%s\\%s\\%s"), szDrive, szPath, buffer);
- if (PathFileExists(szFinalName)) {
- ReadThemeFromINI(szFinalName, 0, FALSE, m_fLoadOnStartup ? 0 : M->GetByte("skin_loadmode", 0));
- CacheLogFonts();
- CacheMsgLogIcons();
- }
+ _tsplitpath(m_tszFileName, szDrive, szPath, NULL, NULL);
+ mir_sntprintf(szFinalName, MAX_PATH, _T("%s\\%s\\%s"), szDrive, szPath, buffer);
+ if (PathFileExists(szFinalName)) {
+ ReadThemeFromINI(szFinalName, 0, FALSE, m_fLoadOnStartup ? 0 : M->GetByte("skin_loadmode", 0));
+ CacheLogFonts();
+ CacheMsgLogIcons();
+ }
- GetPrivateProfileString(_T("Global"), _T("MenuBarBG"), _T("None"), buffer, 20, m_tszFileName);
- data = HexStringToLong(buffer);
- if (m_MenuBGBrush) {
- DeleteObject(m_MenuBGBrush);
- m_MenuBGBrush = 0;
- }
- if (_tcscmp(buffer, _T("None")))
- m_MenuBGBrush = CreateSolidBrush(data);
+ GetPrivateProfileString(_T("Global"), _T("MenuBarBG"), _T("None"), buffer, 20, m_tszFileName);
+ data = HexStringToLong(buffer);
+ if (m_MenuBGBrush) {
+ DeleteObject(m_MenuBGBrush);
+ m_MenuBGBrush = 0;
+ }
+ if (_tcscmp(buffer, _T("None")))
+ m_MenuBGBrush = CreateSolidBrush(data);
- GetPrivateProfileString(_T("Global"), _T("LightShadow"), _T("000000"), buffer, 20, m_tszFileName);
- data = HexStringToLong(buffer);
- CSkin::m_SkinLightShadowPen = CreatePen(PS_SOLID, 1, RGB(GetRValue(data), GetGValue(data), GetBValue(data)));
- GetPrivateProfileString(_T("Global"), _T("DarkShadow"), _T("000000"), buffer, 20, m_tszFileName);
- data = HexStringToLong(buffer);
- CSkin::m_SkinDarkShadowPen = CreatePen(PS_SOLID, 1, RGB(GetRValue(data), GetGValue(data), GetBValue(data)));
+ GetPrivateProfileString(_T("Global"), _T("LightShadow"), _T("000000"), buffer, 20, m_tszFileName);
+ data = HexStringToLong(buffer);
+ CSkin::m_SkinLightShadowPen = CreatePen(PS_SOLID, 1, RGB(GetRValue(data), GetGValue(data), GetBValue(data)));
+ GetPrivateProfileString(_T("Global"), _T("DarkShadow"), _T("000000"), buffer, 20, m_tszFileName);
+ data = HexStringToLong(buffer);
+ CSkin::m_SkinDarkShadowPen = CreatePen(PS_SOLID, 1, RGB(GetRValue(data), GetGValue(data), GetBValue(data)));
- SkinCalcFrameWidth();
+ SkinCalcFrameWidth();
- GetPrivateProfileString(_T("Global"), _T("FontColor"), _T("None"), buffer, 20, m_tszFileName);
- if (_tcscmp(buffer, _T("None")))
- CSkin::m_DefaultFontColor = HexStringToLong(buffer);
- else
- CSkin::m_DefaultFontColor = GetSysColor(COLOR_BTNTEXT);
- buffer[499] = 0;
- free(szSections);
+ GetPrivateProfileString(_T("Global"), _T("FontColor"), _T("None"), buffer, 20, m_tszFileName);
+ if (_tcscmp(buffer, _T("None")))
+ CSkin::m_DefaultFontColor = HexStringToLong(buffer);
+ else
+ CSkin::m_DefaultFontColor = GetSysColor(COLOR_BTNTEXT);
+ buffer[499] = 0;
+ free(szSections);
- LoadItems();
- ::FreeTabConfig();
- ::ReloadTabConfig();
- }
- }
+ LoadItems();
+ ::FreeTabConfig();
+ ::ReloadTabConfig();
}
#define SECT_BUFFER_SIZE 2500
@@ -2272,9 +2049,8 @@ UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID
}
LRESULT orig = mir_callNextSubclass(hwnd, MyWndProc, msg, wParam, lParam);
-
if (0 == mwdat)
- return(orig);
+ return orig;
if (CSkin::m_skinEnabled) {
CSkinItem *item = &SkinItems[skinID];
@@ -2312,7 +2088,8 @@ UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID
UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc)
{
- LRESULT result = mir_callNextSubclass(hwnd, OldWndProc, msg, wParam, lParam); // do default processing (otherwise, NO scrollbar as it is painted in NC_PAINT)
+ // do default processing (otherwise, NO scrollbar as it is painted in NC_PAINT)
+ LRESULT result = mir_callNextSubclass(hwnd, OldWndProc, msg, wParam, lParam);
if (0 == mwdat)
return result;
@@ -2339,7 +2116,8 @@ UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID,
if (CSkin::m_skinEnabled && !item->IGNORED) {
right_off = item->MARGIN_RIGHT;
bottom_off = item->MARGIN_BOTTOM;
- } else {
+ }
+ else {
right_off = left_off;
bottom_off = top_off;
}
@@ -2352,7 +2130,8 @@ UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID,
if (CSkin::m_skinEnabled && !item->IGNORED) {
ReleaseDC(hwnd, hdc);
return result;
- } else if (CMimAPI::m_pfnDrawThemeBackground) {
+ }
+ if (CMimAPI::m_pfnDrawThemeBackground) {
if (isMultipleReason || isEditNotesReason || isSendLaterReason) {
HBRUSH br = CreateSolidBrush(isMultipleReason ? RGB(255, 130, 130) : (isEditNotesReason ? RGB(80, 255, 80) : RGB(80, 80, 255)));
FillRect(hdc, &rcWindow, br);