summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-11 17:07:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-11 17:07:25 +0000
commit3e5dab1a8298130da0ebfb20d91b6963a64367b1 (patch)
treec0f8badf4e4f1d980596f0e7277674d5f684f600
parent36f10b6de1ae80d94ef5ffd618b50b6c95466fbe (diff)
chat's component COLORCHOOSER standardized in the core
git-svn-id: http://svn.miranda-ng.org/main/trunk@11332 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_chat_int.h2
-rw-r--r--plugins/Scriver/res/resource.rc9
-rw-r--r--plugins/Scriver/scriver_10.vcxproj3
-rw-r--r--plugins/Scriver/scriver_10.vcxproj.filters3
-rw-r--r--plugins/Scriver/scriver_12.vcxproj3
-rw-r--r--plugins/Scriver/scriver_12.vcxproj.filters3
-rw-r--r--plugins/Scriver/src/chat/chat.h13
-rw-r--r--plugins/Scriver/src/chat/colorchooser.cpp270
-rw-r--r--plugins/Scriver/src/chat/window.cpp80
-rw-r--r--plugins/Scriver/src/resource.h1
-rw-r--r--plugins/TabSRMM/res/chat.rc10
-rw-r--r--plugins/TabSRMM/src/chat/chat.h12
-rw-r--r--plugins/TabSRMM/src/chat/chat_resource.h2
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp38
-rw-r--r--plugins/TabSRMM/tabsrmm_10.vcxproj3
-rw-r--r--plugins/TabSRMM/tabsrmm_10.vcxproj.filters3
-rw-r--r--plugins/TabSRMM/tabsrmm_12.vcxproj3
-rw-r--r--plugins/TabSRMM/tabsrmm_12.vcxproj.filters3
-rw-r--r--src/core/commonheaders.h1
-rw-r--r--src/core/stdchat/res/chat.rc67
-rw-r--r--src/core/stdchat/src/chat.h14
-rw-r--r--src/core/stdchat/src/colorchooser.cpp266
-rw-r--r--src/core/stdchat/src/resource.h2
-rw-r--r--src/core/stdchat/src/window.cpp57
-rw-r--r--src/core/stdchat/stdchat_10.vcxproj1
-rw-r--r--src/core/stdchat/stdchat_10.vcxproj.filters3
-rw-r--r--src/core/stdchat/stdchat_12.vcxproj1
-rw-r--r--src/core/stdchat/stdchat_12.vcxproj.filters3
-rw-r--r--src/miranda32_10.vcxproj3
-rw-r--r--src/miranda32_10.vcxproj.filters3
-rw-r--r--src/miranda32_12.vcxproj3
-rw-r--r--src/miranda32_12.vcxproj.filters3
-rw-r--r--src/modules/chat/chat.h3
-rw-r--r--src/modules/chat/colorchooser.cpp (renamed from plugins/TabSRMM/src/chat/colorchooser.cpp)97
-rw-r--r--src/modules/chat/manager.cpp1
-rw-r--r--src/resource.h3
-rw-r--r--src/resource.rc8
37 files changed, 153 insertions, 847 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index ab50127791..cd6848a111 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -396,6 +396,8 @@ struct CHAT_MANAGER
TCHAR* (*RemoveFormatting)(const TCHAR *pszText);
void (*ReloadSettings)(void);
+ void (*ColorChooser)(SESSION_INFO *si, BOOL bFG, HWND hwndDlg, HWND hwndTarget, HWND hwndChooser);
+
int logPixelSY, logPixelSX;
char *szActiveWndModule;
TCHAR *szActiveWndID;
diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc
index 76c9d9c465..c95625e672 100644
--- a/plugins/Scriver/res/resource.rc
+++ b/plugins/Scriver/res/resource.rc
@@ -341,15 +341,6 @@ BEGIN
LTEXT "(0 means default setting, -1 means indefinite time)",IDC_STATIC,170,208,130,19
END
-IDD_COLORCHOOSER DIALOGEX 0, 0, 198, 150
-STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_BORDER
-EXSTYLE WS_EX_TOPMOST
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,172,136,26,14,NOT WS_TABSTOP
- CTEXT "",IDC_CHAT_COLORTEXT,0,0,197,12,SS_CENTERIMAGE
-END
-
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/plugins/Scriver/scriver_10.vcxproj b/plugins/Scriver/scriver_10.vcxproj
index 0fca234354..5d468959be 100644
--- a/plugins/Scriver/scriver_10.vcxproj
+++ b/plugins/Scriver/scriver_10.vcxproj
@@ -211,9 +211,6 @@
<ClCompile Include="src\statusicon.cpp" />
<ClCompile Include="src\srmm.cpp" />
<ClCompile Include="src\utils.cpp" />
- <ClCompile Include="src\chat\colorchooser.cpp">
- <PrecompiledHeaderFile>..\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
<ClCompile Include="src\chat\log.cpp">
<PrecompiledHeaderFile>..\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/plugins/Scriver/scriver_10.vcxproj.filters b/plugins/Scriver/scriver_10.vcxproj.filters
index 22197102e1..d4c413c760 100644
--- a/plugins/Scriver/scriver_10.vcxproj.filters
+++ b/plugins/Scriver/scriver_10.vcxproj.filters
@@ -63,9 +63,6 @@
<ClCompile Include="src\utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\chat\colorchooser.cpp">
- <Filter>Source Files\chat</Filter>
- </ClCompile>
<ClCompile Include="src\chat\log.cpp">
<Filter>Source Files\chat</Filter>
</ClCompile>
diff --git a/plugins/Scriver/scriver_12.vcxproj b/plugins/Scriver/scriver_12.vcxproj
index 8c6a3b6fc8..a5561c6056 100644
--- a/plugins/Scriver/scriver_12.vcxproj
+++ b/plugins/Scriver/scriver_12.vcxproj
@@ -214,9 +214,6 @@
<ClCompile Include="src\statusicon.cpp" />
<ClCompile Include="src\srmm.cpp" />
<ClCompile Include="src\utils.cpp" />
- <ClCompile Include="src\chat\colorchooser.cpp">
- <PrecompiledHeaderFile>..\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
<ClCompile Include="src\chat\log.cpp">
<PrecompiledHeaderFile>..\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/plugins/Scriver/scriver_12.vcxproj.filters b/plugins/Scriver/scriver_12.vcxproj.filters
index 22197102e1..d4c413c760 100644
--- a/plugins/Scriver/scriver_12.vcxproj.filters
+++ b/plugins/Scriver/scriver_12.vcxproj.filters
@@ -63,9 +63,6 @@
<ClCompile Include="src\utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\chat\colorchooser.cpp">
- <Filter>Source Files\chat</Filter>
- </ClCompile>
<ClCompile Include="src\chat\log.cpp">
<Filter>Source Files\chat</Filter>
</ClCompile>
diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h
index 324daba31f..e3bde037eb 100644
--- a/plugins/Scriver/src/chat/chat.h
+++ b/plugins/Scriver/src/chat/chat.h
@@ -73,22 +73,9 @@ struct GlobalLogSettings : public GlobalLogSettingsBase
};
extern GlobalLogSettings g_Settings;
-typedef struct{
- MODULEINFO* pModule;
- int xPosition;
- int yPosition;
- HWND hWndTarget;
- BOOL bForeground;
- SESSION_INFO *si;
-}
- COLORCHOOSER;
-
// main.c
void UpgradeCheck(void);
-// colorchooser.c
-INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
// log.c
void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw);
void LoadMsgLogBitmaps(void);
diff --git a/plugins/Scriver/src/chat/colorchooser.cpp b/plugins/Scriver/src/chat/colorchooser.cpp
deleted file mode 100644
index 0eff2d4b3a..0000000000
--- a/plugins/Scriver/src/chat/colorchooser.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
-Chat module plugin for Miranda IM
-
-Copyright (C) 2003 Jörgen Persson
-Copyright 2003-2009 Miranda ICQ/IM project,
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-// this color chooser window is inspired by PeaCow's smiley chooser window for the Smileyadd plugin
-
-#include "../commonheaders.h"
-
-static int CalculateCoordinatesToButton(COLORCHOOSER * pCC, POINT pt)
-{
- int iSquareRoot = (int)sqrt((double)pCC->pModule->nColorCount);
- int nCols = iSquareRoot * iSquareRoot < pCC->pModule->nColorCount ? iSquareRoot + 1 : iSquareRoot;
-
- int col = pt.x / 25;
- int row = (pt.y - 20) / 20;
- int pos = nCols * row + col;
-
- if (pt.y < 20 && pos >= pCC->pModule->nColorCount)
- pos = -1;
-
- return pos;
-}
-
-static RECT CalculateButtonToCoordinates(COLORCHOOSER * pCC, int buttonPosition)
-{
- RECT pt;
- int iSquareRoot = (int)sqrt((double)pCC->pModule->nColorCount);
- int nCols = iSquareRoot * iSquareRoot < pCC->pModule->nColorCount ? iSquareRoot + 1 : iSquareRoot;
-
- int row = buttonPosition / nCols;
- int col = buttonPosition % nCols;
-
- pt.left = col * 25 + 1;
- pt.top = row * 20 + 20;
- pt.right = pt.left + 25 - 1;
- pt.bottom = pt.top + 20;
-
- return pt;
-}
-
-INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static COLORCHOOSER* pCC = NULL;
- static int iCurrentHotTrack;
- static BOOL bChoosing;
- static int iRows;
- static int iColumns;
- static HWND hPreviousActiveWindow;
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- pCC = (COLORCHOOSER*)lParam;
-
- iCurrentHotTrack = -2;
- bChoosing = FALSE;
-
- int iSquareRoot = (int)sqrt((double)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));
-
- int width = rc.right - rc.left;
- int height = rc.bottom - rc.top;
-
- pCC->yPosition -= height;
-
- SetDlgItemText(hwndDlg, IDC_CHAT_COLORTEXT, pCC->bForeground ? TranslateT("Text color") : TranslateT("Background color"));
- SetWindowPos(GetDlgItem(hwndDlg, IDC_CHAT_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_CHAT_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;
- }
- 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_CHAT_COLOR)) {
- cf.dwMask = CFM_COLOR;
- cf.crTextColor = pCC->pModule->crColors[iCurrentHotTrack];
- if (pCC->pModule->bSingleFormat)
- SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- else
- SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
- else {
- pCC->si->bBGSet = TRUE;
- pCC->si->iBG = iCurrentHotTrack;
- if (IsDlgButtonChecked(hWindow, IDC_CHAT_BKGCOLOR)) {
- cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = pCC->pModule->crColors[iCurrentHotTrack];
- if (pCC->pModule->bSingleFormat)
- SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- else
- SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
- }
- 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_MOUSEMOVE:
- {
- HDC hdc = GetDC(hwndDlg);
- POINT pt;
- RECT rect;
- int but;
-
- pt.x = LOWORD(lParam);
- pt.y = HIWORD(lParam);
-
- if (iCurrentHotTrack == -2)
- return 0; // prevent focussing when not drawn yet!
-
- but = CalculateCoordinatesToButton(pCC, pt);
-
- // weird stuff
- if (but != iCurrentHotTrack) {
- if (iCurrentHotTrack >= 0) {
- rect = CalculateButtonToCoordinates(pCC, iCurrentHotTrack);
- DrawFocusRect(hdc, &rect);
- iCurrentHotTrack = -1;
- }
- iCurrentHotTrack = but;
-
- if (iCurrentHotTrack >= 0) {
- rect = CalculateButtonToCoordinates(pCC, iCurrentHotTrack);
- DrawFocusRect(hdc, &rect);
- }
- }
- ReleaseDC(hwndDlg, hdc);
- }
- break;
-
- case WM_PAINT:
- {
- PAINTSTRUCT ps;
- HDC hdc;
- RECT rc;
- int i;
- int iThisRow = 1;
- int iThisColumn = 0;
-
- GetClientRect(hwndDlg, &rc);
-
- rc.top += 20;
-
- hdc = BeginPaint(hwndDlg, &ps);
-
- // fill background
- FillRect(hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
-
- for (i=0; i < pCC->pModule->nColorCount; i++)
- {
- HBRUSH hbr;
-
- // decide place to draw the color block in the window
- iThisColumn ++;
- if (iThisColumn > iColumns) {
- iThisColumn = 1;
- iThisRow++;
- }
-
- 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 ;
- rc.right = iThisColumn * 25-1 ;
-
- DrawEdge(hdc, &rc, EDGE_RAISED, BF_TOP|BF_LEFT|BF_RIGHT|BF_BOTTOM);
- }
-
- rc.top = (iThisRow-1) * 20+ 3 +20 ;
- rc.left = (iThisColumn-1) * 25 + 3 + 1 ;
- rc.bottom = iThisRow * 20- 3 + 20 ;
- rc.right = iThisColumn * 25-3 ;
-
- FillRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
-
- hbr = CreateSolidBrush(pCC->pModule->crColors[i]);
-
- rc.top = (iThisRow-1) * 20+4 +20;
- rc.left = (iThisColumn-1) * 25+ 4 + 1;
- rc.bottom = iThisRow * 20-4 + 20;
- rc.right = iThisColumn * 25-4;
-
- FillRect(hdc, &rc, hbr);
- DeleteObject(hbr);
- }
-
- EndPaint(hwndDlg, &ps);
- iCurrentHotTrack = -1;
- }
- break;
-
- case WM_CLOSE:
- SetFocus(pCC->hWndTarget);
- DestroyWindow(hwndDlg);
- break;
-
- case WM_DESTROY:
- mir_free( pCC );
- return TRUE;
- }
-
- return FALSE;
-}
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 12ab38d527..9b1d60e7d5 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -1058,6 +1058,7 @@ static void __cdecl phase2(void *lParam)
static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static HMENU hToolbarMenu;
+ RECT rc;
SESSION_INFO *si = (SESSION_INFO *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (!si && uMsg != WM_INITDIALOG)
@@ -1256,7 +1257,6 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) {
int dlgWidth, dlgHeight;
- RECT rc;
dlgWidth = LOWORD(lParam);
dlgHeight = HIWORD(lParam);
GetClientRect(hwndDlg, &rc);
@@ -1526,7 +1526,6 @@ LABEL_SHOWWINDOW:
case GC_SPLITTERMOVED:
if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX)) {
POINT pt;
- RECT rc;
GetClientRect(hwndDlg, &rc);
pt.x = wParam; pt.y = 0;
ScreenToClient(hwndDlg, &pt);
@@ -1541,7 +1540,6 @@ LABEL_SHOWWINDOW:
}
else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERY)) {
POINT pt;
- RECT rc;
GetClientRect(hwndDlg, &rc);
pt.x = 0; pt.y = wParam;
ScreenToClient(hwndDlg, &pt);
@@ -1573,7 +1571,6 @@ LABEL_SHOWWINDOW:
case GC_SHOWFILTERMENU:
{
- RECT rc;
HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), hwndDlg, FilterWndProc, (LPARAM)si);
TranslateDialogDefault(hwnd);
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_FILTER), &rc);
@@ -1582,36 +1579,24 @@ LABEL_SHOWWINDOW:
break;
case GC_SHOWCOLORCHOOSER:
- {
- RECT rc;
- BOOL bFG = lParam == IDC_CHAT_COLOR ? TRUE : FALSE;
- COLORCHOOSER * pCC = (COLORCHOOSER *)mir_alloc(sizeof(COLORCHOOSER));
- GetWindowRect(GetDlgItem(hwndDlg, bFG ? IDC_CHAT_COLOR : IDC_CHAT_BKGCOLOR), &rc);
- pCC->hWndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
- pCC->pModule = pci->MM_FindModule(si->pszModule);
- pCC->xPosition = rc.left + 3;
- pCC->yPosition = IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_COLOR)) ? rc.top - 1 : rc.top + 20;
- pCC->bForeground = bFG;
- pCC->si = si;
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM)pCC);
- }
- break;
+ pci->ColorChooser(si, lParam == IDC_CHAT_COLOR, hwndDlg, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), GetDlgItem(hwndDlg, lParam));
+ break;
case GC_SCROLLTOBOTTOM:
- {
+ if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_LOG), GWL_STYLE) & WS_VSCROLL) != 0) {
SCROLLINFO si = { 0 };
- if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_LOG), GWL_STYLE) & WS_VSCROLL) != 0) {
- CHARRANGE sel;
- si.cbSize = sizeof(si);
- si.fMask = SIF_PAGE | SIF_RANGE;
- GetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &si);
- si.fMask = SIF_POS;
- si.nPos = si.nMax - si.nPage + 1;
- SetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &si, TRUE);
- sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOG), CP_ACP, FALSE);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXSETSEL, 0, (LPARAM)&sel);
- PostMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
- }
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_PAGE | SIF_RANGE;
+ GetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &si);
+
+ si.fMask = SIF_POS;
+ si.nPos = si.nMax - si.nPage + 1;
+ SetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &si, TRUE);
+
+ CHARRANGE sel;
+ sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOG), CP_ACP, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXSETSEL, 0, (LPARAM)&sel);
+ PostMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
}
break;
@@ -1785,24 +1770,21 @@ LABEL_SHOWWINDOW:
break;
case IDC_CHAT_SMILEY:
- {
- RECT rc;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_SMILEY), &rc);
-
- SMADD_SHOWSEL3 smaddInfo;
- smaddInfo.cbSize = sizeof(SMADD_SHOWSEL3);
- smaddInfo.hwndParent = GetParent(hwndDlg);
- smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
- smaddInfo.targetMessage = EM_REPLACESEL;
- smaddInfo.targetWParam = TRUE;
- smaddInfo.Protocolname = si->pszModule;
- //smaddInfo.Direction = 3;
- smaddInfo.Direction = 0;
- smaddInfo.xPosition = rc.left;
- smaddInfo.yPosition = rc.bottom;
- smaddInfo.hContact = si->hContact;
- CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
- }
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_SMILEY), &rc);
+
+ SMADD_SHOWSEL3 smaddInfo;
+ smaddInfo.cbSize = sizeof(SMADD_SHOWSEL3);
+ smaddInfo.hwndParent = GetParent(hwndDlg);
+ smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
+ smaddInfo.targetMessage = EM_REPLACESEL;
+ smaddInfo.targetWParam = TRUE;
+ smaddInfo.Protocolname = si->pszModule;
+ //smaddInfo.Direction = 3;
+ smaddInfo.Direction = 0;
+ smaddInfo.xPosition = rc.left;
+ smaddInfo.yPosition = rc.bottom;
+ smaddInfo.hContact = si->hContact;
+ CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
break;
case IDC_CHAT_HISTORY:
diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h
index b6d02a3b40..b516adfe7f 100644
--- a/plugins/Scriver/src/resource.h
+++ b/plugins/Scriver/src/resource.h
@@ -63,7 +63,6 @@
#define IDI_REMSTATUS 442
#define IDI_ACTION 443
#define IDR_MENU 451
-#define IDD_COLORCHOOSER 452
#define IDI_STATUS3 453
#define IDI_STATUS2 454
#define IDI_STATUS4 455
diff --git a/plugins/TabSRMM/res/chat.rc b/plugins/TabSRMM/res/chat.rc
index 6f91ca1700..6e260f305f 100644
--- a/plugins/TabSRMM/res/chat.rc
+++ b/plugins/TabSRMM/res/chat.rc
@@ -220,16 +220,6 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,211,278,11
END
-IDD_COLORCHOOSER DIALOGEX 0, 0, 198, 150
-STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_BORDER
-EXSTYLE WS_EX_TOPMOST
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,172,136,26,14,NOT WS_TABSTOP
- CTEXT "",IDC_COLORTEXT,0,0,197,12,SS_CENTERIMAGE
-END
-
-
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h
index a3196ebb2c..52c2067274 100644
--- a/plugins/TabSRMM/src/chat/chat.h
+++ b/plugins/TabSRMM/src/chat/chat.h
@@ -106,22 +106,10 @@ struct FLASH_PARAMS
extern TMUCSettings g_Settings;
extern CHAT_MANAGER saveCI;
-struct COLORCHOOSER
-{
- MODULEINFO *pModule;
- int xPosition, yPosition;
- HWND hWndTarget;
- bool bForeground;
- SESSION_INFO *si;
-};
-
#pragma comment(lib,"comctl32.lib")
//////////////////////////////////////////////////////////////////////////////////
-// colorchooser.c
-INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
// log.c
void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedraw, bool bPhaseTwo);
char* Log_CreateRtfHeader(MODULEINFO *mi);
diff --git a/plugins/TabSRMM/src/chat/chat_resource.h b/plugins/TabSRMM/src/chat/chat_resource.h
index 07a9bb8ba4..3be170399d 100644
--- a/plugins/TabSRMM/src/chat/chat_resource.h
+++ b/plugins/TabSRMM/src/chat/chat_resource.h
@@ -8,7 +8,6 @@
#define IDD_OPTIONS2 403
#define IDD_FILTER 404
#define IDD_OPTIONSPOPUP 405
-#define IDD_COLORCHOOSER 406
#define IDD_OPTIONS3 407
#define IDD_OPTIONS4 408
#define IDD_ADDHIGHLIGHT 409
@@ -48,7 +47,6 @@
#define IDC_TIMEOUT 1067
#define IDC_TEXTO 1069
#define IDC_LOGGING 1069
-#define IDC_COLORTEXT 1070
#define IDC_TEXTO2 1070
#define IDC_TEXTO3 1071
#define IDC_LIST 1072
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 8a60369600..1c027c954f 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1823,6 +1823,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
CHARFORMAT2 cf;
POINT pt, tmp, cur;
+ RECT rc;
switch (uMsg) {
case WM_INITDIALOG:
@@ -1935,7 +1936,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
SendMessage(hwndDlg, GC_UPDATETITLE, 0, 1);
- RECT rc;
SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
SetWindowPos(hwndDlg, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), 0);
ShowWindow(hwndDlg, SW_SHOW);
@@ -2121,7 +2121,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
BB_SetButtonsPos(dat);
- RECT rc;
GetClientRect(hwndDlg, &rc);
int cx = rc.right;
@@ -2415,8 +2414,8 @@ LABEL_SHOWWINDOW:
break;
case DM_SPLITTERMOVED:
+ RECT rcLog;
{
- RECT rc, rcLog;
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcLog);
if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERX)) {
GetClientRect(hwndDlg, &rc);
@@ -2485,15 +2484,15 @@ LABEL_SHOWWINDOW:
case GC_SHOWFILTERMENU:
si->hwndStatus = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), dat->pContainer->hwnd, FilterWndProc, (LPARAM)si);
TranslateDialogDefault(si->hwndStatus);
- {
- RECT rcFilter, rcLog;
- GetClientRect(si->hwndStatus, &rcFilter);
- GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcLog);
- POINT pt = { rcLog.right, rcLog.bottom };
- ScreenToClient(dat->pContainer->hwnd, &pt);
- SetWindowPos(si->hwndStatus, HWND_TOP, pt.x - rcFilter.right, pt.y - rcFilter.bottom, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
- }
+ RECT rcFilter;
+ GetClientRect(si->hwndStatus, &rcFilter);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcLog);
+
+ pt.x = rcLog.right; pt.y = rcLog.bottom;
+ ScreenToClient(dat->pContainer->hwnd, &pt);
+
+ SetWindowPos(si->hwndStatus, HWND_TOP, pt.x - rcFilter.right, pt.y - rcFilter.bottom, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
break;
case DM_SPLITTERGLOBALEVENT:
@@ -2501,20 +2500,7 @@ LABEL_SHOWWINDOW:
return 0;
case GC_SHOWCOLORCHOOSER:
- {
- bool bFG = (lParam == IDC_COLOR);
-
- RECT rc;
- GetWindowRect(GetDlgItem(hwndDlg, bFG ? IDC_COLOR : IDC_BKGCOLOR), &rc);
- COLORCHOOSER *pCC = (COLORCHOOSER *)mir_alloc(sizeof(COLORCHOOSER));
- pCC->hWndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
- pCC->pModule = pci->MM_FindModule(si->pszModule);
- pCC->xPosition = rc.left + 3;
- pCC->yPosition = IsWindowVisible(GetDlgItem(hwndDlg, IDC_COLOR)) ? rc.top - 1 : rc.top + 20;
- pCC->bForeground = bFG;
- pCC->si = si;
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM)pCC);
- }
+ pci->ColorChooser(si, lParam == IDC_COLOR, hwndDlg, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), GetDlgItem(hwndDlg, lParam));
break;
case GC_SCROLLTOBOTTOM:
@@ -3048,7 +3034,6 @@ LABEL_SHOWWINDOW:
case IDC_SMILEY:
case IDC_SMILEYBTN:
{
- RECT rc;
if (lParam == 0)
GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYBTN), &rc);
else
@@ -3414,7 +3399,6 @@ LABEL_SHOWWINDOW:
TabCtrl_GetItem(hwndTab, i, &item); // retrieve dialog hwnd for the now active tab...
dat->pContainer->hwndActive = (HWND) item.lParam;
- RECT rc;
SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
SetWindowPos(dat->pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW);
ShowWindow((HWND)item.lParam, SW_SHOW);
diff --git a/plugins/TabSRMM/tabsrmm_10.vcxproj b/plugins/TabSRMM/tabsrmm_10.vcxproj
index e3ce7cd7f9..8738c1763b 100644
--- a/plugins/TabSRMM/tabsrmm_10.vcxproj
+++ b/plugins/TabSRMM/tabsrmm_10.vcxproj
@@ -194,9 +194,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\buttonsbar.cpp" />
- <ClCompile Include="src\chat\colorchooser.cpp">
- <PrecompiledHeaderFile>..\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
<ClCompile Include="src\chat\log.cpp">
<PrecompiledHeaderFile>..\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/plugins/TabSRMM/tabsrmm_10.vcxproj.filters b/plugins/TabSRMM/tabsrmm_10.vcxproj.filters
index 83d79be3e6..6a9f205fce 100644
--- a/plugins/TabSRMM/tabsrmm_10.vcxproj.filters
+++ b/plugins/TabSRMM/tabsrmm_10.vcxproj.filters
@@ -18,9 +18,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="src\chat\colorchooser.cpp">
- <Filter>Source Files\Chat</Filter>
- </ClCompile>
<ClCompile Include="src\chat\log.cpp">
<Filter>Source Files\Chat</Filter>
</ClCompile>
diff --git a/plugins/TabSRMM/tabsrmm_12.vcxproj b/plugins/TabSRMM/tabsrmm_12.vcxproj
index a29db39d5d..148e1928d2 100644
--- a/plugins/TabSRMM/tabsrmm_12.vcxproj
+++ b/plugins/TabSRMM/tabsrmm_12.vcxproj
@@ -197,9 +197,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\buttonsbar.cpp" />
- <ClCompile Include="src\chat\colorchooser.cpp">
- <PrecompiledHeaderFile>..\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
<ClCompile Include="src\chat\log.cpp">
<PrecompiledHeaderFile>..\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/plugins/TabSRMM/tabsrmm_12.vcxproj.filters b/plugins/TabSRMM/tabsrmm_12.vcxproj.filters
index b49df8a9bd..1ce38ff7fc 100644
--- a/plugins/TabSRMM/tabsrmm_12.vcxproj.filters
+++ b/plugins/TabSRMM/tabsrmm_12.vcxproj.filters
@@ -18,9 +18,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="src\chat\colorchooser.cpp">
- <Filter>Source Files\Chat</Filter>
- </ClCompile>
<ClCompile Include="src\chat\log.cpp">
<Filter>Source Files\Chat</Filter>
</ClCompile>
diff --git a/src/core/commonheaders.h b/src/core/commonheaders.h
index bcf4291b89..73a91c4028 100644
--- a/src/core/commonheaders.h
+++ b/src/core/commonheaders.h
@@ -48,6 +48,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <malloc.h>
#include <stdio.h>
+#include <math.h>
#include <time.h>
#include <stddef.h>
#include <process.h>
diff --git a/src/core/stdchat/res/chat.rc b/src/core/stdchat/res/chat.rc
index 1465655e61..c4fc84fc82 100644
--- a/src/core/stdchat/res/chat.rc
+++ b/src/core/stdchat/res/chat.rc
@@ -277,7 +277,6 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
-
/////////////////////////////////////////////////////////////////////////////
//
// Icon
@@ -287,42 +286,6 @@ END
// remains consistent on all systems.
IDI_TAG1 ICON "tag1.ico"
IDI_TAG2 ICON "tag2.ico"
-#endif // Neutral (Default) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Swedish resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE)
-#ifdef _WIN32
-LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_COLORCHOOSER DIALOGEX 0, 0, 198, 150
-STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP |
- WS_VISIBLE | WS_BORDER
-EXSTYLE WS_EX_TOPMOST
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,172,136,26,14,NOT WS_TABSTOP
- CTEXT "",IDC_COLORTEXT,0,0,197,12,SS_CENTERIMAGE
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
IDI_BUNDERLINE ICON "underline.ico"
IDI_BBOLD ICON "bold.ico"
IDI_BITALICS ICON "italics.ico"
@@ -360,33 +323,6 @@ IDI_OVERLAY ICON "overlay.ico"
IDI_NICKLIST2 ICON "nicklist2.ico"
IDI_FILTER2 ICON "filter2.ico"
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "..\\src\\resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""winres.h""\r\n"
- "#include ""richedit.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
/////////////////////////////////////////////////////////////////////////////
//
// Menu
@@ -438,11 +374,10 @@ BEGIN
END
END
-#endif // Swedish resources
+#endif // Neutral (Default) resources
/////////////////////////////////////////////////////////////////////////////
-
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h
index 3507e8f5c5..d0702be5d2 100644
--- a/src/core/stdchat/src/chat.h
+++ b/src/core/stdchat/src/chat.h
@@ -137,23 +137,9 @@ struct CREOleCallback : public IRichEditOleCallback
extern CREOleCallback reOleCallback;
-struct COLORCHOOSER
-{
- MODULEINFO* pModule;
- int xPosition;
- int yPosition;
- HWND hWndTarget;
- BOOL bForeground;
- SESSION_INFO *si;
-};
-
//main.c
-
void LoadIcons(void);
-//colorchooser.c
-INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
// log.c
void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw, BOOL bPhaseTwo);
void ValidateFilename (TCHAR * filename);
diff --git a/src/core/stdchat/src/colorchooser.cpp b/src/core/stdchat/src/colorchooser.cpp
deleted file mode 100644
index b7a1066e7d..0000000000
--- a/src/core/stdchat/src/colorchooser.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
-Chat module plugin for Miranda IM
-
-Copyright (C) 2003 Jörgen Persson
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-
-// this color chooser window is inspired by PeaCow's smiley chooser window for the Smileyadd plugin
-
-#include "chat.h"
-#include <math.h>
-
-static int CalculateCoordinatesToButton(COLORCHOOSER * pCC, POINT pt)
-{
- int iSquareRoot = (int)sqrt((double)pCC->pModule->nColorCount);
- int nCols = iSquareRoot * iSquareRoot < pCC->pModule->nColorCount?iSquareRoot+1:iSquareRoot;
-
- int col = pt.x / 25;
- int row = (pt.y-20) / 20;
- int pos = nCols * row + col;
-
- if (pt.y < 20 && pos >= pCC->pModule->nColorCount)
- pos = -1;
-
- return pos;
-}
-
-static RECT CalculateButtonToCoordinates(COLORCHOOSER * pCC, int buttonPosition)
-{
- RECT pt;
- int iSquareRoot = (int)sqrt((double)pCC->pModule->nColorCount);
- int nCols = iSquareRoot * iSquareRoot < pCC->pModule->nColorCount?iSquareRoot+1:iSquareRoot;
-
- int row = buttonPosition / nCols;
- int col = buttonPosition % nCols;
-
- pt.left = col * 25+1;
- pt.top = row * 20 + 20;
- pt.right = pt.left + 25-1;
- pt.bottom = pt.top + 20;
-
- return pt;
-}
-
-INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static COLORCHOOSER* pCC = NULL;
- static int iCurrentHotTrack;
- static BOOL bChoosing;
- static int iRows;
- static int iColumns;
- static HWND hPreviousActiveWindow;
-
- switch(msg) {
- case WM_INITDIALOG:
- {
- RECT rc;
- int iSquareRoot;
- int width ;
- int height;
-
- TranslateDialogDefault(hwndDlg);
- pCC = (COLORCHOOSER*) lParam;
-
- iCurrentHotTrack = -2;
- bChoosing = FALSE;
-
- iSquareRoot = (int)sqrt((double)pCC->pModule->nColorCount);
-
- iColumns = iSquareRoot * iSquareRoot == pCC->pModule->nColorCount?iSquareRoot:iSquareRoot+1;
- iRows = iSquareRoot;
-
- 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;
-
- pCC->yPosition -= height;
-
-
- 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_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);
- } } }
- 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_MOUSEMOVE:
- {
- HDC hdc = GetDC(hwndDlg);
- POINT pt;
- RECT rect;
- int but;
-
- pt.x = LOWORD(lParam);
- pt.y = HIWORD(lParam);
-
- if (iCurrentHotTrack == -2)
- return 0; // prevent focussing when not drawn yet!
-
- but = CalculateCoordinatesToButton(pCC, pt);
-
- // weird stuff
- if (but != iCurrentHotTrack) {
- if (iCurrentHotTrack >= 0) {
- rect = CalculateButtonToCoordinates(pCC, iCurrentHotTrack);
- DrawFocusRect(hdc, &rect);
- iCurrentHotTrack = -1;
- }
- iCurrentHotTrack = but;
-
- if (iCurrentHotTrack >= 0) {
- rect = CalculateButtonToCoordinates(pCC, iCurrentHotTrack);
- DrawFocusRect(hdc, &rect);
- } }
- ReleaseDC(hwndDlg, hdc);
- }
- break;
-
- case WM_PAINT:
- {
- PAINTSTRUCT ps;
- HDC hdc;
- RECT rc;
- int i = 0;
- int iThisRow = 1;
- int iThisColumn = 0;
-
- GetClientRect(hwndDlg, &rc);
-
- rc.top += 20;
-
- hdc = BeginPaint(hwndDlg, &ps);
-
- // fill background
- FillRect(hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
-
- for (i; i < pCC->pModule->nColorCount; i++) {
- HBRUSH hbr;
-
- // decide place to draw the color block in the window
- iThisColumn ++;
- if (iThisColumn > iColumns) {
- iThisColumn = 1;
- iThisRow++;
- }
-
- 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 ;
- rc.right = iThisColumn * 25-1 ;
-
- DrawEdge(hdc, &rc, EDGE_RAISED, BF_TOP|BF_LEFT|BF_RIGHT|BF_BOTTOM);
- }
-
- rc.top = (iThisRow-1) * 20+ 3 +20 ;
- rc.left = (iThisColumn-1) * 25 + 3 + 1 ;
- rc.bottom = iThisRow * 20- 3 + 20 ;
- rc.right = iThisColumn * 25-3 ;
-
- FillRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
-
- hbr = CreateSolidBrush(pCC->pModule->crColors[i]);
-
- rc.top = (iThisRow-1) * 20+4 +20;
- rc.left = (iThisColumn-1) * 25+ 4 + 1;
- rc.bottom = iThisRow * 20-4 + 20;
- rc.right = iThisColumn * 25-4;
-
- FillRect(hdc, &rc, hbr);
- DeleteObject(hbr);
- }
-
- EndPaint(hwndDlg, &ps);
- iCurrentHotTrack = -1;
- }
- break;
-
- case WM_CLOSE:
- SetFocus(pCC->hWndTarget);
- DestroyWindow(hwndDlg);
- break;
-
- case WM_DESTROY:
- mir_free( pCC );
- return TRUE;
- }
-
- return FALSE;
-}
diff --git a/src/core/stdchat/src/resource.h b/src/core/stdchat/src/resource.h
index f95fa7dd01..439c6d3639 100644
--- a/src/core/stdchat/src/resource.h
+++ b/src/core/stdchat/src/resource.h
@@ -36,7 +36,6 @@
#define IDI_TAG1 149
#define IDI_TAG2 150
#define IDR_MENU 151
-#define IDD_COLORCHOOSER 152
#define IDI_STATUS3 153
#define IDI_STATUS2 154
#define IDI_STATUS4 155
@@ -94,7 +93,6 @@
#define IDC_HIGHLIGHT 1068
#define IDC_TEXTO 1069
#define IDC_LOGGING 1069
-#define IDC_COLORTEXT 1070
#define IDC_LIST 1072
#define IDC_TAB 1074
#define IDC_1 1075
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
index 4a73524523..f3dbde1bb6 100644
--- a/src/core/stdchat/src/window.cpp
+++ b/src/core/stdchat/src/window.cpp
@@ -1121,6 +1121,7 @@ static void __cdecl phase2(void * lParam)
INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ RECT rc;
switch (uMsg) {
case WM_INITDIALOG:
@@ -1876,7 +1877,6 @@ LABEL_SHOWWINDOW:
case GC_SPLITTERMOVED:
{
POINT pt;
- RECT rc;
RECT rcLog;
BOOL bFormat = IsWindowVisible(GetDlgItem(hwndDlg,IDC_SMILEY));
@@ -1940,7 +1940,6 @@ LABEL_SHOWWINDOW:
case GC_SHOWFILTERMENU:
{
- RECT rc;
HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), hwndDlg, FilterWndProc, (LPARAM)si);
TranslateDialogDefault(hwnd);
GetWindowRect(GetDlgItem(hwndDlg, IDC_FILTER), &rc);
@@ -1949,38 +1948,25 @@ LABEL_SHOWWINDOW:
break;
case GC_SHOWCOLORCHOOSER:
- {
- BOOL bFG = lParam == IDC_COLOR ? TRUE : FALSE;
- COLORCHOOSER * pCC = (COLORCHOOSER *)mir_alloc(sizeof(COLORCHOOSER));
-
- RECT rc;
- GetWindowRect(GetDlgItem(hwndDlg, bFG ? IDC_COLOR : IDC_BKGCOLOR), &rc);
- pCC->hWndTarget = GetDlgItem(hwndDlg, IDC_MESSAGE);
- pCC->pModule = pci->MM_FindModule(si->pszModule);
- pCC->xPosition = rc.left+3;
- pCC->yPosition = IsWindowVisible(GetDlgItem(hwndDlg, IDC_COLOR))?rc.top-1:rc.top+20;
- pCC->bForeground = bFG;
- pCC->si = si;
-
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM) pCC);
- }
+ pci->ColorChooser(si, lParam == IDC_COLOR, hwndDlg, GetDlgItem(hwndDlg, IDC_MESSAGE), GetDlgItem(hwndDlg, lParam));
break;
case GC_SCROLLTOBOTTOM:
- {
+ if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWL_STYLE) & WS_VSCROLL) != 0) {
SCROLLINFO si = { 0 };
- if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWL_STYLE) & WS_VSCROLL) != 0) {
- CHARRANGE sel;
- si.cbSize = sizeof(si);
- si.fMask = SIF_PAGE | SIF_RANGE;
- GetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &si);
- si.fMask = SIF_POS;
- si.nPos = si.nMax - si.nPage + 1;
- SetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &si, TRUE);
- sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG));
- SendMessage(GetDlgItem(hwndDlg, IDC_LOG), EM_EXSETSEL, 0, (LPARAM) &sel);
- PostMessage(GetDlgItem(hwndDlg, IDC_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
- } }
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_PAGE | SIF_RANGE;
+ GetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &si);
+
+ si.fMask = SIF_POS;
+ si.nPos = si.nMax - si.nPage + 1;
+ SetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &si, TRUE);
+
+ CHARRANGE sel;
+ sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG));
+ SendMessage(GetDlgItem(hwndDlg, IDC_LOG), EM_EXSETSEL, 0, (LPARAM) &sel);
+ PostMessage(GetDlgItem(hwndDlg, IDC_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
+ }
break;
case WM_TIMER:
@@ -2363,10 +2349,9 @@ LABEL_SHOWWINDOW:
break;
case IDC_SMILEY:
- {
- RECT rc;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEY), &rc);
-
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEY), &rc);
+
+ if (SmileyAddInstalled) {
SMADD_SHOWSEL3 smaddInfo = { sizeof(smaddInfo) };
smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_MESSAGE);
smaddInfo.targetMessage = EM_REPLACESEL;
@@ -2377,9 +2362,7 @@ LABEL_SHOWWINDOW:
smaddInfo.yPosition = rc.top - 1;
smaddInfo.hContact = si->hContact;
smaddInfo.hwndParent = hwndDlg;
-
- if (SmileyAddInstalled)
- CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo);
+ CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
}
break;
diff --git a/src/core/stdchat/stdchat_10.vcxproj b/src/core/stdchat/stdchat_10.vcxproj
index 2367473f54..610b1baf71 100644
--- a/src/core/stdchat/stdchat_10.vcxproj
+++ b/src/core/stdchat/stdchat_10.vcxproj
@@ -201,7 +201,6 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="src\colorchooser.cpp" />
<ClCompile Include="src\log.cpp" />
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
diff --git a/src/core/stdchat/stdchat_10.vcxproj.filters b/src/core/stdchat/stdchat_10.vcxproj.filters
index 3db0ba41e8..1250407396 100644
--- a/src/core/stdchat/stdchat_10.vcxproj.filters
+++ b/src/core/stdchat/stdchat_10.vcxproj.filters
@@ -19,9 +19,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="src\colorchooser.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/src/core/stdchat/stdchat_12.vcxproj b/src/core/stdchat/stdchat_12.vcxproj
index a3d1589a8b..0912c9dd3d 100644
--- a/src/core/stdchat/stdchat_12.vcxproj
+++ b/src/core/stdchat/stdchat_12.vcxproj
@@ -204,7 +204,6 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="src\colorchooser.cpp" />
<ClCompile Include="src\log.cpp" />
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
diff --git a/src/core/stdchat/stdchat_12.vcxproj.filters b/src/core/stdchat/stdchat_12.vcxproj.filters
index 3db0ba41e8..1250407396 100644
--- a/src/core/stdchat/stdchat_12.vcxproj.filters
+++ b/src/core/stdchat/stdchat_12.vcxproj.filters
@@ -19,9 +19,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="src\colorchooser.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/src/miranda32_10.vcxproj b/src/miranda32_10.vcxproj
index 4ed44e12c8..9ce0ade5ad 100644
--- a/src/miranda32_10.vcxproj
+++ b/src/miranda32_10.vcxproj
@@ -301,6 +301,9 @@
<ClCompile Include="modules\chat\clist.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
+ <ClCompile Include="modules\chat\colorchooser.cpp">
+ <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
<ClCompile Include="modules\chat\log.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/src/miranda32_10.vcxproj.filters b/src/miranda32_10.vcxproj.filters
index 858975caad..b1caef1af9 100644
--- a/src/miranda32_10.vcxproj.filters
+++ b/src/miranda32_10.vcxproj.filters
@@ -627,6 +627,9 @@
<ClCompile Include="modules\langpack\lpopts.cpp">
<Filter>Modules\langpack</Filter>
</ClCompile>
+ <ClCompile Include="modules\chat\colorchooser.cpp">
+ <Filter>Modules\chat</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc">
diff --git a/src/miranda32_12.vcxproj b/src/miranda32_12.vcxproj
index aba0a38ee2..f9ad51416b 100644
--- a/src/miranda32_12.vcxproj
+++ b/src/miranda32_12.vcxproj
@@ -305,6 +305,9 @@
<ClCompile Include="modules\chat\clist.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
+ <ClCompile Include="modules\chat\colorchooser.cpp">
+ <PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
+ </ClCompile>
<ClCompile Include="modules\chat\log.cpp">
<PrecompiledHeaderFile>..\..\core\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/src/miranda32_12.vcxproj.filters b/src/miranda32_12.vcxproj.filters
index b7364b661c..6bce7c5112 100644
--- a/src/miranda32_12.vcxproj.filters
+++ b/src/miranda32_12.vcxproj.filters
@@ -636,6 +636,9 @@
<ClCompile Include="modules\langpack\langpack.cpp">
<Filter>Modules\langpack</Filter>
</ClCompile>
+ <ClCompile Include="modules\chat\colorchooser.cpp">
+ <Filter>Modules\chat</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc">
diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h
index 09bdb7c3f4..68ef108dfb 100644
--- a/src/modules/chat/chat.h
+++ b/src/modules/chat/chat.h
@@ -68,6 +68,9 @@ INT_PTR LeaveChat(WPARAM wParam, LPARAM lParam);
int PrebuildContactMenu(WPARAM wParam, LPARAM lParam);
INT_PTR PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam);
+// colorchooser.c
+void ColorChooser(SESSION_INFO *si, BOOL bFG, HWND hwndDlg, HWND hwndTarget, HWND hwndChooser);
+
// options.c
int OptionsInit(void);
int OptionsUnInit(void);
diff --git a/plugins/TabSRMM/src/chat/colorchooser.cpp b/src/modules/chat/colorchooser.cpp
index 12d25fa73b..7f20a1d6fd 100644
--- a/plugins/TabSRMM/src/chat/colorchooser.cpp
+++ b/src/modules/chat/colorchooser.cpp
@@ -1,32 +1,37 @@
-/////////////////////////////////////////////////////////////////////////////////////////
-// Miranda NG: the free IM client for Microsoft* Windows*
-//
-// Copyright (c) 2012-14 Miranda NG project,
-// Copyright (c) 2000-09 Miranda ICQ/IM project,
-// all portions of this codebase are copyrighted to the people
-// listed in contributors.txt.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// you should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-// part of tabSRMM messaging plugin for Miranda.
-//
-// (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
-//
-// Color chooser for group chats
-
-#include "..\commonheaders.h"
+/*
+Chat module plugin for Miranda IM
+
+Copyright 2000-12 Miranda IM, 2012-14 Miranda NG project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "..\..\core\commonheaders.h"
+
+#include "chat.h"
+
+struct COLORCHOOSER
+{
+ MODULEINFO *pModule;
+ int xPosition, yPosition;
+ HWND hWndTarget, hWndChooser;
+ BOOL bForeground;
+ GCSessionInfoBase *si;
+};
static int CalculateCoordinatesToButton(COLORCHOOSER * pCC, POINT pt)
{
@@ -45,13 +50,13 @@ static int CalculateCoordinatesToButton(COLORCHOOSER * pCC, POINT pt)
static RECT CalculateButtonToCoordinates(COLORCHOOSER * pCC, int buttonPosition)
{
- RECT pt;
int iSquareRoot = (int)sqrt(static_cast<float>(pCC->pModule->nColorCount));
int nCols = iSquareRoot * iSquareRoot < pCC->pModule->nColorCount ? iSquareRoot + 1 : iSquareRoot;
int row = buttonPosition / nCols;
int col = buttonPosition % nCols;
+ RECT pt;
pt.left = col * 25 + 1;
pt.top = row * 20 + 20;
pt.right = pt.left + 25 - 1;
@@ -60,7 +65,7 @@ static RECT CalculateButtonToCoordinates(COLORCHOOSER * pCC, int buttonPosition)
return pt;
}
-INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static COLORCHOOSER* pCC = NULL;
static int iCurrentHotTrack;
@@ -124,25 +129,27 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
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);
+
+ HWND hWindow = GetParent(pCC->hWndTarget);
+ int ctrlId = GetDlgCtrlID(pCC->hWndChooser);
if (pCC->bForeground) {
pCC->si->bFGSet = TRUE;
pCC->si->iFG = iCurrentHotTrack;
- if (IsDlgButtonChecked(hWindow, IDC_COLOR)) {
+ if (IsDlgButtonChecked(hWindow, ctrlId)) {
cf.dwMask = CFM_COLOR;
cf.crTextColor = pCC->pModule->crColors[iCurrentHotTrack];
SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
- } else {
+ }
+ else {
pCC->si->bBGSet = TRUE;
pCC->si->iBG = iCurrentHotTrack;
- if (IsDlgButtonChecked(hWindow, IDC_BKGCOLOR)) {
+ if (IsDlgButtonChecked(hWindow, ctrlId)) {
cf.dwMask = CFM_BACKCOLOR;
cf.crBackColor = pCC->pModule->crColors[iCurrentHotTrack];
SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
@@ -229,7 +236,7 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
rc.bottom = iThisRow * 20 - 3 + 20 ;
rc.right = iThisColumn * 25 - 3 ;
- FillRect(hdc, &rc, CSkin::m_BrushBack);
+ FillRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
HBRUSH hbr = CreateSolidBrush(pCC->pModule->crColors[i]);
@@ -259,3 +266,19 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
return FALSE;
}
+
+void ColorChooser(SESSION_INFO *si, BOOL bFG, HWND hwndDlg, HWND hwndTarget, HWND hwndChooser)
+{
+ RECT rc;
+ GetWindowRect(hwndChooser, &rc);
+
+ COLORCHOOSER *pCC = (COLORCHOOSER *)mir_alloc(sizeof(COLORCHOOSER));
+ pCC->hWndTarget = hwndTarget;
+ pCC->pModule = ci.MM_FindModule(si->pszModule);
+ pCC->xPosition = rc.left + 3;
+ pCC->yPosition = IsWindowVisible(hwndChooser) ? rc.top - 1 : rc.top + 20;
+ pCC->bForeground = bFG;
+ pCC->hWndChooser = hwndChooser;
+ pCC->si = si;
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM)pCC);
+}
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp
index 675af06f8d..e5912e801c 100644
--- a/src/modules/chat/manager.cpp
+++ b/src/modules/chat/manager.cpp
@@ -1314,6 +1314,7 @@ INT_PTR SvcGetChatManager(WPARAM wParam, LPARAM lParam)
ci.IsHighlighted = IsHighlighted;
ci.RemoveFormatting = RemoveFormatting;
ci.ReloadSettings = LoadGlobalSettings;
+ ci.ColorChooser = ColorChooser;
ci.pLogIconBmpBits = pLogIconBmpBits;
ci.logIconBmpSize = logIconBmpSize;
diff --git a/src/resource.h b/src/resource.h
index a9496fb22c..f7c544191e 100644
--- a/src/resource.h
+++ b/src/resource.h
@@ -23,6 +23,7 @@
#define IDI_NOTLOADED_GRAY 114
#define IDD_ADDED 115
#define IDD_ENTER_STRING 116
+
#define IDD_URLSEND 119
#define IDD_URLRECV 120
#define IDD_AUTHREQ 121
@@ -78,6 +79,7 @@
#define IDD_HISTORY_FIND 192
#define IDI_SENDEMAIL 193
#define IDD_FILERECV 194
+#define IDD_COLORCHOOSER 195
#define IDD_PROFILEMANAGER 197
#define IDI_MAINMENU 198
#define IDR_CLISTMENU 199
@@ -217,6 +219,7 @@
#define IDC_ABOUT 1032
#define IDC_MYNOTES 1033
#define IDC_URLS 1037
+#define IDC_COLORTEXT 1038
#define IDC_REPLY 1039
#define IDC_URL 1041
#define IDC_FONTGROUP 1042
diff --git a/src/resource.rc b/src/resource.rc
index 32aeba4aeb..346178c68c 100644
--- a/src/resource.rc
+++ b/src/resource.rc
@@ -810,6 +810,14 @@ BEGIN
CONTROL "Download more language packs",IDC_MORELANG,"Hyperlink",WS_GROUP | WS_TABSTOP | 0x1,9,173,283,10
END
+IDD_COLORCHOOSER DIALOGEX 0, 0, 198, 150
+STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_BORDER
+EXSTYLE WS_EX_TOPMOST
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,172,136,26,14,NOT WS_TABSTOP
+ CTEXT "",IDC_COLORTEXT,0,0,197,12,SS_CENTERIMAGE
+END
/////////////////////////////////////////////////////////////////////////////
//