diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-04 07:23:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-04 07:23:42 +0000 |
commit | 66cb770a982a2502456d10d73838df2b7239fd89 (patch) | |
tree | fc419dde94a9be3ebe8f2266ff46feb90d2bcbec | |
parent | bc256df33a57e585367edffe33d3e58d53f82ce8 (diff) |
new subclassing functions applied to all plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@3880 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
107 files changed, 7218 insertions, 7958 deletions
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index d52f5425bb..84c5760282 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -578,6 +578,9 @@ function mir_utf8checkstring(const astr:PAnsiChar):bool;stdcall; procedure mir_subclassWindow(Wnd: HWND; WndProc: WNDPROC); stdcall;
external CoreDLL name 'mir_subclassWindow';
+procedure mir_subclassWindowFull(Wnd: HWND; WndProc, OldWndProc: WNDPROC); stdcall;
+ external CoreDLL name 'mir_subclassWindowFull';
+
function mir_callNextSubclass(Wnd: HWND; WndProc: WNDPROC; uMsg: uint; wParam: WPARAM; lParam: LPARAM ): LRESULT; stdcall;
external CoreDLL name 'mir_callNextSubclass';
diff --git a/include/m_core.h b/include/m_core.h index 6617f192d1..220289995e 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -584,6 +584,7 @@ __forceinline char* mir_utf8decodeA(const char* src) // Window subclassing
MIR_CORE_DLL(void) mir_subclassWindow(HWND hWnd, WNDPROC wndProc);
+MIR_CORE_DLL(void) mir_subclassWindowFull(HWND hWnd, WNDPROC wndProc, WNDPROC oldWndProc);
MIR_CORE_DLL(LRESULT) mir_callNextSubclass(HWND hWnd, WNDPROC wndProc, UINT uMsg, WPARAM wParam, LPARAM lParam);
MIR_CORE_DLL(void) KillModuleSubclassing(HMODULE hInst);
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index e6fb90a317..ad40340a57 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -76,7 +76,7 @@ static LRESULT CALLBACK ProgressBarSubclassProc(HWND hwndProgress,UINT msg,WPARA case WM_LBUTTONDBLCLK:
return SendMessage(GetParent(hwndProgress),msg,wParam,lParam);
}
- return CallWindowProc((WNDPROC)GetWindowLongPtr(hwndProgress, GWLP_USERDATA), hwndProgress, msg, wParam, lParam);
+ return mir_callNextSubclass(hwndProgress, ProgressBarSubclassProc, msg, wParam, lParam);
}
/************************* Window Class *******************************/
@@ -153,7 +153,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA NULL);
if(dat->hwndProgress==NULL) return -1; /* creation failed, calls WM_DESTROY */
SendMessage(dat->hwndProgress,PBM_SETSTEP,(WPARAM)1,0);
- SetWindowLongPtr(dat->hwndProgress, GWLP_USERDATA, SetWindowLongPtr(dat->hwndProgress, GWLP_WNDPROC, (LONG)ProgressBarSubclassProc));
+ mir_subclassWindow(dat->hwndProgress, ProgressBarSubclassProc);
dat->hwndDesc=CreateWindowEx(WS_EX_NOPARENTNOTIFY,
_T("Static"),
(dat->fTimeFlags&SDWTF_ST_TIME)?TranslateT("Shutdown at:"):TranslateT("Time left:"),
diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index d477ba81bb..0d94cba08c 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -325,8 +325,6 @@ static void EnableFrameIcon(bool bEnable) }
}
-static WNDPROC OldSliderWndProc = 0;
-
static void fnPainter(MButtonCtrl *btn, HDC hdc)
{
DrawIconEx(hdc, 0, 0, btn->hIcon, 16, 16, 0, hBkgBrush, DI_NORMAL);
@@ -338,7 +336,7 @@ static LRESULT CALLBACK SliderWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_ERASEBKGND:
return TRUE;
}
- return CallWindowProc(OldSliderWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, SliderWndProc, msg, wParam, lParam);
}
static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -358,7 +356,7 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR hwnd, (HMENU)0, (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE), NULL);
SendMessage(hwndSlider, TBM_SETRANGE, FALSE, MAKELONG(SLIDER_MIN, SLIDER_MAX));
SendMessage(hwndSlider, TBM_SETPOS, TRUE, Volume);
- OldSliderWndProc = (WNDPROC)SetWindowLongPtr(hwndSlider, GWLP_WNDPROC, (LPARAM)SliderWndProc);
+ mir_subclassWindow(hwndSlider, SliderWndProc);
break;
case WM_COMMAND:
@@ -409,11 +407,6 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR }
break;
- case WM_DESTROY:
- if (hwndSlider && IsWindow(hwndSlider) && OldSliderWndProc != 0)
- SetWindowLongPtr(hwndSlider, GWLP_WNDPROC, (LONG)OldSliderWndProc);
- break;
-
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 98ca26771c..8fefc1062b 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -40,7 +40,6 @@ void ResetCList(HWND hWnd); HistoryWindow::HistoryWindow(HANDLE _hContact) :
isDestroyed(true),
- OldSplitterProc(0),
splitterY(0),
splitterOrgY(0),
splitterX(0),
@@ -1174,8 +1173,8 @@ void HistoryWindow::Initialise() {
splitterXhWnd = GetDlgItem(hWnd, IDC_SPLITTER);
splitterYhWnd = GetDlgItem(hWnd, IDC_SPLITTERV);
- OldSplitterProc = (WNDPROC)SetWindowLongPtr(splitterXhWnd, GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
- SetWindowLongPtr(splitterYhWnd, GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
+ mir_subclassWindow(splitterXhWnd, SplitterSubclassProc);
+ mir_subclassWindow(splitterYhWnd, SplitterSubclassProc);
editWindow = GetDlgItem(hWnd, IDC_EDIT);
findWindow = GetDlgItem(hWnd, IDC_FIND_TEXT);
@@ -1327,10 +1326,6 @@ void HistoryWindow::Destroy() hIcon = (HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0);
Skin_ReleaseIcon(hIcon);
-
- UnregisterHotkeyControl(GetDlgItem(hWnd, IDC_SHOWHIDE));
- UnregisterHotkeyControl(GetDlgItem(hWnd, IDC_LIST_CONTACTS));
- UnregisterHotkeyControl(findWindow);
isDestroyed = true;
HistoryWindow::Close(this);
@@ -1749,7 +1744,7 @@ LRESULT CALLBACK HistoryWindow::SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM return 0;
}
}
- return CallWindowProc(dat->OldSplitterProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, HistoryWindow::SplitterSubclassProc, msg, wParam, lParam);
}
void HistoryWindow::EnableWindows(BOOL enable)
diff --git a/plugins/BasicHistory/src/HistoryWindow.h b/plugins/BasicHistory/src/HistoryWindow.h index afc00c787d..66202937b4 100644 --- a/plugins/BasicHistory/src/HistoryWindow.h +++ b/plugins/BasicHistory/src/HistoryWindow.h @@ -59,7 +59,6 @@ private: HICON *eventIcons;
int allIconNumber;
HICON plusIco, minusIco, findNextIco, findPrevIco, configIco, deleteIco;
- WNDPROC OldSplitterProc;
bool isContactList;
LONG listOryginalPos;
bool isLoading;
diff --git a/plugins/BasicHistory/src/HotkeyHelper.cpp b/plugins/BasicHistory/src/HotkeyHelper.cpp index 29f916ea3c..89db08013e 100644 --- a/plugins/BasicHistory/src/HotkeyHelper.cpp +++ b/plugins/BasicHistory/src/HotkeyHelper.cpp @@ -21,91 +21,76 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "resource.h"
#include "Options.h"
-LRESULT CALLBACK HotkeySubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-void RegisterHotkeyControl(HWND control)
-{
- WNDPROC oldProc = (WNDPROC)SetWindowLongPtr(control, GWLP_WNDPROC, (LONG_PTR) HotkeySubclassProc);
- SetWindowLongPtr(control, GWLP_USERDATA, (LONG_PTR) oldProc);
-}
-
-void UnregisterHotkeyControl(HWND control)
-{
- WNDPROC oldProc = (WNDPROC)GetWindowLongPtr(control, GWLP_USERDATA);
- if(oldProc != NULL)
- {
- SetWindowLongPtr(control, GWLP_WNDPROC, (LONG_PTR) oldProc);
- SetWindowLongPtr(control, GWLP_USERDATA, NULL);
- }
-}
-
static bool isPresed = false;
-LRESULT CALLBACK HotkeySubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK HotkeySubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WNDPROC oldProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-
switch (msg) {
- case WM_NCPAINT:
- if(Options::instance->noFindBorder && GetDlgCtrlID(hwnd) == IDC_FIND_TEXT)
- return 0;
- break;
- case WM_CHAR:
- case WM_SYSCHAR:
- case WM_UNICHAR:
- case WM_DEADCHAR:
- case WM_SYSDEADCHAR:
- if(isPresed)
- return 0;
- break;
- case WM_KEYUP:
- case WM_SYSKEYUP:
- if(isPresed)
+ case WM_NCPAINT:
+ if(Options::instance->noFindBorder && GetDlgCtrlID(hwnd) == IDC_FIND_TEXT)
+ return 0;
+ break;
+ case WM_CHAR:
+ case WM_SYSCHAR:
+ case WM_UNICHAR:
+ case WM_DEADCHAR:
+ case WM_SYSDEADCHAR:
+ if(isPresed)
+ return 0;
+ break;
+ case WM_KEYUP:
+ case WM_SYSKEYUP:
+ if(isPresed)
+ {
+ isPresed = false;
+ return 0;
+ }
+ break;
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ {
+ isPresed = false;
+ HWND hwndParent = GetParent(hwnd);
+ MSGFILTER filter;
+ filter.msg = msg;
+ filter.lParam = lParam;
+ filter.wParam = wParam;
+ filter.nmhdr.hwndFrom = hwnd;
+ filter.nmhdr.code = EN_MSGFILTER;
+ filter.nmhdr.idFrom = GetDlgCtrlID(hwnd);
+ if(SendMessage(hwndParent, WM_NOTIFY, NULL, (LPARAM)&filter))
{
- isPresed = false;
+ isPresed = true;
return 0;
}
- break;
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- {
- isPresed = false;
- HWND hwndParent = GetParent(hwnd);
- MSGFILTER filter;
- filter.msg = msg;
- filter.lParam = lParam;
- filter.wParam = wParam;
- filter.nmhdr.hwndFrom = hwnd;
- filter.nmhdr.code = EN_MSGFILTER;
- filter.nmhdr.idFrom = GetDlgCtrlID(hwnd);
- if(SendMessage(hwndParent, WM_NOTIFY, NULL, (LPARAM)&filter))
- {
- isPresed = true;
- return 0;
- }
- LRESULT res = CallWindowProc(oldProc, hwnd, msg, wParam, lParam);
- filter.nmhdr.code = CLN_MYSELCHANGED;
- SendMessage(hwndParent, WM_NOTIFY, NULL, (LPARAM)&filter);
- return res;
- }
- break;
- case WM_LBUTTONDOWN:
- {
- HWND hwndParent = GetParent(hwnd);
- MSGFILTER filter;
- filter.msg = msg;
- filter.lParam = lParam;
- filter.wParam = wParam;
- filter.nmhdr.hwndFrom = hwnd;
- filter.nmhdr.code = CLN_MYSELCHANGED;
- filter.nmhdr.idFrom = GetDlgCtrlID(hwnd);
+ LRESULT res = mir_callNextSubclass(hwnd, HotkeySubclassProc, msg, wParam, lParam);
+ filter.nmhdr.code = CLN_MYSELCHANGED;
+ SendMessage(hwndParent, WM_NOTIFY, NULL, (LPARAM)&filter);
+ return res;
+ }
+ break;
+ case WM_LBUTTONDOWN:
+ {
+ HWND hwndParent = GetParent(hwnd);
+ MSGFILTER filter;
+ filter.msg = msg;
+ filter.lParam = lParam;
+ filter.wParam = wParam;
+ filter.nmhdr.hwndFrom = hwnd;
+ filter.nmhdr.code = CLN_MYSELCHANGED;
+ filter.nmhdr.idFrom = GetDlgCtrlID(hwnd);
- LRESULT res = CallWindowProc(oldProc, hwnd, msg, wParam, lParam);
- SendMessage(hwndParent, WM_NOTIFY, NULL, (LPARAM)&filter);
- return res;
- }
- break;
+ LRESULT res = mir_callNextSubclass(hwnd, HotkeySubclassProc, msg, wParam, lParam);
+ SendMessage(hwndParent, WM_NOTIFY, NULL, (LPARAM)&filter);
+ return res;
+ }
+ break;
}
- return CallWindowProc(oldProc, hwnd, msg, wParam, lParam);
-}
\ No newline at end of file + return mir_callNextSubclass(hwnd, HotkeySubclassProc, msg, wParam, lParam);
+}
+
+void RegisterHotkeyControl(HWND control)
+{
+ mir_subclassWindow(control, HotkeySubclassProc);
+}
diff --git a/plugins/BasicHistory/src/HotkeyHelper.h b/plugins/BasicHistory/src/HotkeyHelper.h index f31b1c6666..ab2b80b977 100644 --- a/plugins/BasicHistory/src/HotkeyHelper.h +++ b/plugins/BasicHistory/src/HotkeyHelper.h @@ -21,4 +21,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define CLN_MYSELCHANGED (CLN_FIRST-50)
void RegisterHotkeyControl(HWND control);
-void UnregisterHotkeyControl(HWND control);
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index d1aac55e82..63a30b58de 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -234,14 +234,11 @@ void cliRecalcScrollBar(HWND hwnd,ClcData *dat) }
-static WNDPROC OldRenameEditWndProc;
static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
- {
+ switch(msg) {
case WM_KEYDOWN:
- switch(wParam)
- {
+ switch(wParam) {
case VK_RETURN:
pcli->pfnEndRename(GetParent(hwnd),(ClcData*)GetWindowLongPtr(hwnd,GWLP_USERDATA),1);
return 0;
@@ -251,8 +248,7 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara }
break;
case WM_GETDLGCODE:
- if (lParam)
- {
+ if (lParam) {
MSG *msg = (MSG*)lParam;
if (msg->message == WM_KEYDOWN && msg->wParam == VK_TAB) return 0;
if (msg->message == WM_CHAR && msg->wParam == '\t') return 0;
@@ -263,7 +259,7 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara SendMessage(pcli->hwndContactTree,WM_SIZE, 0, 0);
return 0;
}
- return CallWindowProc(OldRenameEditWndProc,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, RenameEditSubclassProc, msg, wParam, lParam);
}
void cliBeginRenameSelection(HWND hwnd,ClcData *dat)
@@ -335,11 +331,11 @@ void cliBeginRenameSelection(HWND hwnd,ClcData *dat) }
SetWindowLongPtr(dat->hwndRenameEdit,GWL_STYLE,GetWindowLongPtr(dat->hwndRenameEdit,GWL_STYLE)&(~WS_CAPTION)|WS_BORDER);
SetWindowLongPtr(dat->hwndRenameEdit,GWLP_USERDATA,(LONG_PTR)dat);
- OldRenameEditWndProc = (WNDPROC)SetWindowLongPtr(dat->hwndRenameEdit,GWLP_WNDPROC,(LONG_PTR)RenameEditSubclassProc);
+ mir_subclassWindow(dat->hwndRenameEdit, RenameEditSubclassProc);
SendMessage(dat->hwndRenameEdit,WM_SETFONT,(WPARAM)(contact->type == CLCIT_GROUP?dat->fontModernInfo[FONTID_OPENGROUPS].hFont:dat->fontModernInfo[FONTID_CONTACTS].hFont),0);
SendMessage(dat->hwndRenameEdit,EM_SETMARGINS,EC_LEFTMARGIN|EC_RIGHTMARGIN|EC_USEFONTINFO,0);
SendMessage(dat->hwndRenameEdit,EM_SETSEL, 0, (LPARAM)(-1));
- // SetWindowLongPtr(dat->hwndRenameEdit,GWLP_USERDATA,(LONG_PTR)hwnd);
+
r.top = 1;
r.bottom = h-1;
r.left = 0;
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index b8fb2365c3..f1e57fa4fc 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -1816,8 +1816,7 @@ LRESULT CLUI::OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam ) CLUI::SnappingToEdge( wp );
return DefWindowProc(m_hWnd,msg,wParam,lParam);
}
- switch (msg)
- {
+ switch (msg) {
case WM_DISPLAYCHANGE:
SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0);
return TRUE;
diff --git a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp index 5d6288269c..f5d577d70c 100644 --- a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp @@ -266,7 +266,7 @@ void DrawBackGround(HWND hwnd,HDC mhdc) EndPaint(hwnd,&paintst);
}
-LRESULT CALLBACK StatusBarOwnerDrawProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK StatusBarOwnerDrawProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (UseOwnerDrawStatusBar) {
switch(uMsg) {
@@ -282,7 +282,7 @@ LRESULT CALLBACK StatusBarOwnerDrawProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPA return 0;
}
}
- return CallWindowProc(OldWindowProc, hwnd, uMsg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, StatusBarOwnerDrawProc, uMsg, wParam, lParam);
}
LRESULT CALLBACK StatusHelperProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -485,7 +485,7 @@ int RecreateStatusBar(HWND parent) WS_CHILD | ( db_get_b(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), _T(""), helperhwnd, 0);
OldWindowProc = (WNDPROC)GetWindowLongPtr(pcli->hwndStatus,GWLP_WNDPROC);
- SetWindowLongPtr(pcli->hwndStatus,GWLP_WNDPROC,(LONG_PTR)&StatusBarOwnerDrawProc);
+ mir_subclassWindow(pcli->hwndStatus, StatusBarOwnerDrawProc);
CreateStatusBarFrame();
SetWindowPos(helperhwnd,NULL,1,1,1,1,SWP_NOZORDER);
diff --git a/plugins/Clist_nicer/src/Coolsb/coolsb_internal.h b/plugins/Clist_nicer/src/Coolsb/coolsb_internal.h index 8a394f8a51..64249c355c 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolsb_internal.h +++ b/plugins/Clist_nicer/src/Coolsb/coolsb_internal.h @@ -41,7 +41,6 @@ typedef struct typedef struct
{
UINT bars; //which of the scrollbars do we handle? SB_VERT / SB_HORZ / SB_BOTH
- WNDPROC oldproc; //old window procedure to call for every message
SCROLLBAR sbarHorz; //one scrollbar structure each for
SCROLLBAR sbarVert; //the horizontal and vertical scrollbars
diff --git a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp index beb4d164e8..127d11f173 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp @@ -240,7 +240,7 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) sw->bPreventStyleChange = FALSE;
- sw->oldproc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)CoolSBWndProc);
+ mir_subclassWindow(hwnd, CoolSBWndProc);
CoolSB_SetMinThumbSize(hwnd, SB_BOTH, CoolSB_GetDefaultMinThumbSize());
@@ -574,17 +574,14 @@ HRESULT WINAPI UninitializeCoolSB(HWND hwnd) SCROLLWND *sw = GetScrollWndFromHwnd(hwnd);
if ( !sw) return E_FAIL;
- //restore the window procedure with the original one
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)sw->oldproc);
-
RemoveProp(hwnd, szPropStr);
//SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
//finally, release the memory needed for the cool scrollbars
HeapFree(GetProcessHeap(), 0, sw);
- //Force WM_NCCALCSIZE and WM_NCPAINT so the original scrollbars can kick in
- RedrawNonClient(hwnd, TRUE);
+ //Force WM_NCCALCSIZE and WM_NCPAINT so the original scrollbars can kick in
+ RedrawNonClient(hwnd, TRUE);
return S_OK;
}
diff --git a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp index b3fde57c58..dcafafdd7c 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp @@ -92,6 +92,8 @@ static HWND hwndCurCoolSB = 0; extern int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd);
+LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+
//
// Provide this so there are NO dependencies on CRT
//
@@ -1541,25 +1543,24 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) //new window region. ** region must be in SCREEN coordinates **
dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
- // If the window has WS_(H-V)SCROLL bits set, we should reset them
- // to avoid windows taking the scrollbars into account.
- // We temporarily set a flag preventing the subsecuent
- // WM_STYLECHANGING/WM_STYLECHANGED to be forwarded to
- // the original window procedure
- if ( dwStyle & (WS_VSCROLL|WS_HSCROLL))
- {
- sw->bPreventStyleChange = TRUE;
- SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~(WS_VSCROLL|WS_HSCROLL));
- }
-
- ret = CallWindowProc(sw->oldproc, hwnd, WM_NCPAINT, (WPARAM)hrgn, lParam);
-
- if ( dwStyle & (WS_VSCROLL|WS_HSCROLL))
- {
- SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle);
- sw->bPreventStyleChange = FALSE;
- }
+ // If the window has WS_(H-V)SCROLL bits set, we should reset them
+ // to avoid windows taking the scrollbars into account.
+ // We temporarily set a flag preventing the subsecuent
+ // WM_STYLECHANGING/WM_STYLECHANGED to be forwarded to
+ // the original window procedure
+ if ( dwStyle & (WS_VSCROLL|WS_HSCROLL))
+ {
+ sw->bPreventStyleChange = TRUE;
+ SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~(WS_VSCROLL|WS_HSCROLL));
+ }
+
+ ret = mir_callNextSubclass(hwnd, CoolSBWndProc, WM_NCPAINT, (WPARAM)hrgn, lParam);
+ if ( dwStyle & (WS_VSCROLL|WS_HSCROLL))
+ {
+ SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle);
+ sw->bPreventStyleChange = FALSE;
+ }
// DRAW THE DEAD AREA
// only do this if the horizontal and vertical bars are visible
@@ -1581,7 +1582,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) rect.right -= sw->cxRightEdge;
rect.left = rect.right - GetScrollMetric(&sw->sbarVert, SM_CXVERTSB);
}
-
+
if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, SB_BOTH, &rect, 32, 0, 0, 0);
else
@@ -1604,7 +1605,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) OffsetRect(&rect2, winrect.left, winrect.top);
if ( !sw->fLeftScrollbar && parent.right == rect2.right+sw->cxRightEdge && parent.bottom == rect2.bottom+sw->cyBottomEdge
- || sw->fLeftScrollbar && parent.left == rect2.left -sw->cxLeftEdge && parent.bottom == rect2.bottom+sw->cyBottomEdge)
+ || sw->fLeftScrollbar && parent.left == rect2.left -sw->cxLeftEdge && parent.bottom == rect2.bottom+sw->cyBottomEdge)
DrawFrameControl(hdc, &rect, DFC_SCROLL, sw->fLeftScrollbar ? DFCS_SCROLLSIZEGRIPRIGHT : DFCS_SCROLLSIZEGRIP );
else
PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE));
@@ -1634,19 +1635,14 @@ static LRESULT NCHitTest(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) //Clicked in the horizontal scrollbar area
if (sw->sbarHorz.fScrollVisible && PtInRect(&hrect, pt))
- {
return HTHSCROLL;
- }
+
//Clicked in the vertical scrollbar area
- else if (sw->sbarVert.fScrollVisible && PtInRect(&vrect, pt))
- {
+ if (sw->sbarVert.fScrollVisible && PtInRect(&vrect, pt))
return HTVSCROLL;
- }
+
//clicked somewhere else
- else
- {
- return CallWindowProc(sw->oldproc, hwnd, WM_NCHITTEST, wParam, lParam);
- }
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_NCHITTEST, wParam, lParam);
}
//
@@ -1965,7 +1961,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa else
{
uCurrentScrollPortion = HTSCROLL_NONE;
- return CallWindowProc(sw->oldproc, hwnd, WM_NCLBUTTONDOWN, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_NCLBUTTONDOWN, wParam, lParam);
}
//
@@ -2095,7 +2091,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID1, COOLSB_TIMERINTERVAL1, 0);
break;
default:
- return CallWindowProc(sw->oldproc, hwnd, WM_NCLBUTTONDOWN, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_NCLBUTTONDOWN, wParam, lParam);
//return 0;
}
@@ -2236,7 +2232,7 @@ static LRESULT LButtonUp(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) }*/
}
- return CallWindowProc(sw->oldproc, hwnd, WM_LBUTTONUP, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_LBUTTONUP, wParam, lParam);
}
//
@@ -2409,188 +2405,175 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) if (uCurrentScrollbar == SB_HORZ)
return ThumbTrackHorz(&sw->sbarHorz, hwnd, x,y);
-
else if (uCurrentScrollbar == SB_VERT)
return ThumbTrackVert(&sw->sbarVert, hwnd, x,y);
}
if (uCurrentScrollPortion == HTSCROLL_NONE)
- {
- return CallWindowProc(sw->oldproc, hwnd, WM_MOUSEMOVE, wParam, lParam);
- }
- else
- {
- LPARAM nlParam;
- SCROLLBAR *sb = &sw->sbarHorz;
- SCROLLBUT *sbut = 0;
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_MOUSEMOVE, wParam, lParam);
+
+ LPARAM nlParam;
+ SCROLLBAR *sb = &sw->sbarHorz;
+ SCROLLBUT *sbut = 0;
- nlParam = GetMessagePos();
+ nlParam = GetMessagePos();
- GetWindowRect(hwnd, &winrect);
+ GetWindowRect(hwnd, &winrect);
- pt.x = LOWORD(nlParam);
- pt.y = HIWORD(nlParam);
+ pt.x = LOWORD(nlParam);
+ pt.y = HIWORD(nlParam);
- //emulate the mouse input on a scrollbar here...
- if (uCurrentScrollbar == SB_HORZ)
- {
- sb = &sw->sbarHorz;
- }
- else if (uCurrentScrollbar == SB_VERT)
- {
- sb = &sw->sbarVert;
- }
+ //emulate the mouse input on a scrollbar here...
+ if (uCurrentScrollbar == SB_HORZ)
+ {
+ sb = &sw->sbarHorz;
+ }
+ else if (uCurrentScrollbar == SB_VERT)
+ {
+ sb = &sw->sbarVert;
+ }
- //get the total area of the normal scrollbar area
- GetScrollRect(sw, sb->nBarType, hwnd, &rect);
+ //get the total area of the normal scrollbar area
+ GetScrollRect(sw, sb->nBarType, hwnd, &rect);
- //see if we clicked in the inserted buttons / normal scrollbar
- //thisportion = GetPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam));
- thisportion = GetPortion(sb, hwnd, &rect, pt.x, pt.y);
+ //see if we clicked in the inserted buttons / normal scrollbar
+ //thisportion = GetPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam));
+ thisportion = GetPortion(sb, hwnd, &rect, pt.x, pt.y);
- //we need to do different things depending on if the
- //user is activating the scrollbar itself, or one of
- //the inserted buttons
- switch(uCurrentScrollPortion)
- {
+ //we need to do different things depending on if the
+ //user is activating the scrollbar itself, or one of
+ //the inserted buttons
+ switch(uCurrentScrollPortion) {
#ifdef INCLUDE_BUTTONS
- //inserted buttons are being clicked
- case HTSCROLL_INSERTED:
+ //inserted buttons are being clicked
+ case HTSCROLL_INSERTED:
- //find the index of the button that has been clicked
- //Don't adjust the rectangle though
- buttonIdx = GetButtonFromPt(sb, &rect, pt, FALSE);
+ //find the index of the button that has been clicked
+ //Don't adjust the rectangle though
+ buttonIdx = GetButtonFromPt(sb, &rect, pt, FALSE);
- //Get the rectangle of the active button
- GetButtonRectFromId(sb, &rect, uCurrentButton);
+ //Get the rectangle of the active button
+ GetButtonRectFromId(sb, &rect, uCurrentButton);
- //if the button to the LEFT of the current
- //button is resizable, then resize it
+ //if the button to the LEFT of the current
+ //button is resizable, then resize it
#ifdef RESIZABLE_BUTTONS
- if (uCurrentButton > 0)
- {
- sbut = &sb->sbButtons[uCurrentButton - 1];
+ if (uCurrentButton > 0)
+ {
+ sbut = &sb->sbButtons[uCurrentButton - 1];
- //only resize if BOTH buttons are on same side of scrollbar
- if (sbut->uPlacement == (sbut+1)->uPlacement && (sbut->uButType & SBBM_RESIZABLE))
+ //only resize if BOTH buttons are on same side of scrollbar
+ if (sbut->uPlacement == (sbut+1)->uPlacement && (sbut->uButType & SBBM_RESIZABLE))
+ {
+ int oldsize = sbut->nSize;
+ int butsize1, butsize2;
+ RECT rect2;
+ int scrollsize;
+
+ if (uCurrentScrollbar == SB_HORZ)
{
- int oldsize = sbut->nSize;
- int butsize1, butsize2;
- RECT rect2;
- int scrollsize;
-
- if (uCurrentScrollbar == SB_HORZ)
- {
- rect.left -= GetSingleButSize(sb, sbut);
- sbut->nSize = pt.x - rect.left;
- }
- else
- {
- rect.top -= GetSingleButSize(sb, sbut);
- sbut->nSize = pt.y - rect.top;
- }
+ rect.left -= GetSingleButSize(sb, sbut);
+ sbut->nSize = pt.x - rect.left;
+ }
+ else
+ {
+ rect.top -= GetSingleButSize(sb, sbut);
+ sbut->nSize = pt.y - rect.top;
+ }
- //if (sbut->nSize < 0) sbut->nSize = 0;
- if (sbut->nSize < (int)sbut->nMinSize)
- sbut->nSize = sbut->nMinSize;
+ //if (sbut->nSize < 0) sbut->nSize = 0;
+ if (sbut->nSize < (int)sbut->nMinSize)
+ sbut->nSize = sbut->nMinSize;
- if ((UINT)sbut->nSize > (UINT)sbut->nMaxSize)
- sbut->nSize = sbut->nMaxSize;
+ if ((UINT)sbut->nSize > (UINT)sbut->nMaxSize)
+ sbut->nSize = sbut->nMaxSize;
- GetScrollRect(sw, uCurrentScrollbar, hwnd, &rect2);
+ GetScrollRect(sw, uCurrentScrollbar, hwnd, &rect2);
- if (uCurrentScrollbar == SB_HORZ)
- scrollsize = rect2.right-rect2.left;
- else
- scrollsize = rect2.bottom-rect2.top;
+ if (uCurrentScrollbar == SB_HORZ)
+ scrollsize = rect2.right-rect2.left;
+ else
+ scrollsize = rect2.bottom-rect2.top;
- butsize1 = GetButtonSize(sb, hwnd, SBBP_LEFT);
- butsize2 = GetButtonSize(sb, hwnd, SBBP_RIGHT);
+ butsize1 = GetButtonSize(sb, hwnd, SBBP_LEFT);
+ butsize2 = GetButtonSize(sb, hwnd, SBBP_RIGHT);
- //adjust the button size if it gets too big
- if (butsize1 + butsize2 > scrollsize - MINSCROLLSIZE)
- {
- sbut->nSize -= (butsize1+butsize2) - (scrollsize - MINSCROLLSIZE);
- }
-
- //remember what size the USER set the button to
- sbut->nSizeReserved = sbut->nSize;
- NCPaint(sw, hwnd, (WPARAM)1, 0);
- return 0;
+ //adjust the button size if it gets too big
+ if (butsize1 + butsize2 > scrollsize - MINSCROLLSIZE)
+ {
+ sbut->nSize -= (butsize1+butsize2) - (scrollsize - MINSCROLLSIZE);
}
+
+ //remember what size the USER set the button to
+ sbut->nSizeReserved = sbut->nSize;
+ NCPaint(sw, hwnd, (WPARAM)1, 0);
+ return 0;
}
+ }
#endif //RESIZABLE_BUTTONS
- OffsetRect(&rect, -winrect.left, -winrect.top);
+ OffsetRect(&rect, -winrect.left, -winrect.top);
- hdc = GetWindowDC(hwnd);
+ hdc = GetWindowDC(hwnd);
- //if the button under the mouse is not the active button,
- //then display the active button in its normal state
- if (buttonIdx != uCurrentButton
- //include this if toggle buttons always stay depressed
- //if they are being activated
- && (sb->sbButtons[uCurrentButton].uButType & SBBT_MASK) != SBBT_TOGGLEBUTTON)
- {
- if (lastbutton != buttonIdx)
- DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_NORMAL);
- }
- //otherwise, depress the active button if the mouse is over
- //it (just like a normal scroll button works)
- else
- {
- if (lastbutton != buttonIdx)
- DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_PUSHED);
- }
+ //if the button under the mouse is not the active button,
+ //then display the active button in its normal state
+ if (buttonIdx != uCurrentButton
+ //include this if toggle buttons always stay depressed
+ //if they are being activated
+ && (sb->sbButtons[uCurrentButton].uButType & SBBT_MASK) != SBBT_TOGGLEBUTTON)
+ {
+ if (lastbutton != buttonIdx)
+ DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_NORMAL);
+ }
+ //otherwise, depress the active button if the mouse is over
+ //it (just like a normal scroll button works)
+ else
+ {
+ if (lastbutton != buttonIdx)
+ DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_PUSHED);
+ }
- ReleaseDC(hwnd, hdc);
- return CallWindowProc(sw->oldproc, hwnd, WM_MOUSEMOVE, wParam, lParam);
- //break;
+ ReleaseDC(hwnd, hdc);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_MOUSEMOVE, wParam, lParam);
+ //break;
#endif //INCLUDE_BUTTONS
- //The scrollbar is active
- case HTSCROLL_LEFT: case HTSCROLL_RIGHT:case HTSCROLL_THUMB:
- case HTSCROLL_PAGELEFT: case HTSCROLL_PAGERIGHT:
- case HTSCROLL_NONE:
-
- //adjust the total scroll area to become where the scrollbar
- //really is (take into account the inserted buttons)
- GetRealScrollRect(sb, &rect);
+ //The scrollbar is active
+ case HTSCROLL_LEFT: case HTSCROLL_RIGHT:case HTSCROLL_THUMB:
+ case HTSCROLL_PAGELEFT: case HTSCROLL_PAGERIGHT:
+ case HTSCROLL_NONE:
+ //adjust the total scroll area to become where the scrollbar
+ //really is (take into account the inserted buttons)
+ GetRealScrollRect(sb, &rect);
- OffsetRect(&rect, -winrect.left, -winrect.top);
- hdc = GetWindowDC(hwnd);
+ OffsetRect(&rect, -winrect.left, -winrect.top);
+ hdc = GetWindowDC(hwnd);
- if (thisportion != uCurrentScrollPortion)
- {
- uScrollTimerPortion = HTSCROLL_NONE;
-
- if (lastportion != thisportion)
- NCDrawScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NORMAL);
- }
- //otherwise, draw the button in its depressed / clicked state
- else
- {
- uScrollTimerPortion = uCurrentScrollPortion;
-
- if (lastportion != thisportion)
- NCDrawScrollbar(sb, hwnd, hdc, &rect, thisportion);
- }
-
- ReleaseDC(hwnd, hdc);
+ if (thisportion != uCurrentScrollPortion)
+ {
+ uScrollTimerPortion = HTSCROLL_NONE;
- break;
+ if (lastportion != thisportion)
+ NCDrawScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NORMAL);
}
+ //otherwise, draw the button in its depressed / clicked state
+ else
+ {
+ uScrollTimerPortion = uCurrentScrollPortion;
+ if (lastportion != thisportion)
+ NCDrawScrollbar(sb, hwnd, hdc, &rect, thisportion);
+ }
- lastportion = thisportion;
- lastbutton = buttonIdx;
-
- //must return zero here, because we might get cursor anomilies
- //CallWindowProc(sw->oldproc, hwnd, WM_MOUSEMOVE, wParam, lParam);
- return 0;
-
+ ReleaseDC(hwnd, hdc);
+ break;
}
+
+ lastportion = thisportion;
+ lastbutton = buttonIdx;
+ return 0;
}
#ifdef INCLUDE_BUTTONS
@@ -2693,7 +2676,7 @@ static LRESULT NCCalcSize(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam }
//call the default procedure to get the borders allocated
- ret = CallWindowProc(sw->oldproc, hwnd, WM_NCCALCSIZE, wParam, lParam);
+ ret = mir_callNextSubclass(hwnd, CoolSBWndProc, WM_NCCALCSIZE, wParam, lParam);
// RESTORE PREVIOUS STYLES (if present at all)
if ( dwStyle & (WS_VSCROLL|WS_HSCROLL))
@@ -2767,7 +2750,7 @@ static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lPa if (wHitTest == HTHSCROLL)
{
if (uMouseOverScrollbar == SB_HORZ)
- return CallWindowProc(sw->oldproc, hwnd, WM_NCMOUSEMOVE, wHitTest, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_NCMOUSEMOVE, wHitTest, lParam);
uLastHitTestPortion = HTSCROLL_NONE;
uHitTestPortion = HTSCROLL_NONE;
@@ -2780,7 +2763,7 @@ static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lPa else if (wHitTest == HTVSCROLL)
{
if (uMouseOverScrollbar == SB_VERT)
- return CallWindowProc(sw->oldproc, hwnd, WM_NCMOUSEMOVE, wHitTest, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_NCMOUSEMOVE, wHitTest, lParam);
uLastHitTestPortion = HTSCROLL_NONE;
uHitTestPortion = HTSCROLL_NONE;
@@ -2792,7 +2775,7 @@ static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lPa }
#endif //HOT_TRACKING
- return CallWindowProc(sw->oldproc, hwnd, WM_NCMOUSEMOVE, wHitTest, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_NCMOUSEMOVE, wHitTest, lParam);
}
//
@@ -2802,9 +2785,7 @@ static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM {
//let all timer messages go past if we don't have a timer installed ourselves
if (uScrollTimerId == 0 && uMouseOverId == 0)
- {
- return CallWindowProc(swnd->oldproc, hwnd, WM_TIMER, wTimerId, lParam);
- }
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_TIMER, wTimerId, lParam);
#ifdef HOT_TRACKING
//mouse-over timer
@@ -2893,10 +2874,8 @@ static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM return 0;
}
- else
- {
- return CallWindowProc(swnd->oldproc, hwnd, WM_TIMER, wTimerId, lParam);
- }
+
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_TIMER, wTimerId, lParam);
}
//
@@ -2915,7 +2894,7 @@ static LRESULT CoolSB_StyleChange(SCROLLWND *swnd, HWND hwnd, UINT msg, WPARAM w swnd->fLeftScrollbar = FALSE;
}
- return CallWindowProc(swnd->oldproc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, msg, wParam, lParam);
}
static UINT curTool = -1;
@@ -2940,7 +2919,7 @@ static LRESULT CoolSB_Notify(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARAM l }
#endif //COOLSB_TOOLTIPS
- return CallWindowProc(swnd->oldproc, hwnd, WM_NOTIFY, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_NOTIFY, wParam, lParam);
}
static LRESULT SendToolTipMessage0(HWND hwndTT, UINT message, WPARAM wParam, LPARAM lParam)
@@ -2977,7 +2956,7 @@ static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARA if (lastmsg == WM_LBUTTONDOWN)
{
lastmsg = hi;
- return CallWindowProc(swnd->oldproc, hwnd, WM_SETCURSOR, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_SETCURSOR, wParam, lParam);
}
else
lastmsg = hi;
@@ -3011,7 +2990,7 @@ static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARA SendToolTipMessage(swnd->hwndToolTip, TTM_POP, 0, 0);
}
- return CallWindowProc(swnd->oldproc, hwnd, WM_SETCURSOR, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_SETCURSOR, wParam, lParam);
}
if (swnd->hwndToolTip != 0)
@@ -3052,7 +3031,7 @@ static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARA }
#endif //INCLUDE_BUTTONS
- return CallWindowProc(swnd->oldproc, hwnd, WM_SETCURSOR, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_SETCURSOR, wParam, lParam);
}
@@ -3083,12 +3062,10 @@ static void __stdcall RelayMouseEvent(HWND hwnd, HWND hwndToolTip, UINT event) //
LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- WNDPROC oldproc;
SCROLLWND *swnd = GetScrollWndFromHwnd(hwnd);
static int count;
- switch(message)
- {
+ switch(message) {
case WM_NCDESTROY:
//this should NEVER be called, because the user
//should have called Uninitialize() themselves.
@@ -3096,13 +3073,12 @@ LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lP //However, if the user tries to call Uninitialize()..
//after this window is destroyed, this window's entry in the lookup
//table will not be there, and the call will fail
- oldproc = swnd->oldproc;
UninitializeCoolSB(hwnd);
//we must call the original window procedure, otherwise it
//will never get the WM_NCDESTROY message, and it wouldn't
//be able to clean up etc.
- return CallWindowProc(oldproc, hwnd, message, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, message, wParam, lParam);
case WM_NCCALCSIZE:
return NCCalcSize(swnd, hwnd, wParam, lParam);
@@ -3201,6 +3177,6 @@ LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lP break;
}
- return CallWindowProc(swnd->oldproc, hwnd, message, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CoolSBWndProc, message, wParam, lParam);
}
diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index c099b8fa54..09c205686b 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -461,7 +461,6 @@ void SetGroupExpand(HWND hwnd,struct ClcData *dat,ClcGroup *group,int newState) SendMessage(GetParent(hwnd),WM_NOTIFY,0,(LPARAM)&nm);
}
-static WNDPROC OldRenameEditWndProc;
static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -488,7 +487,7 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara pcli->pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 1);
return 0;
}
- return CallWindowProc(OldRenameEditWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, RenameEditSubclassProc, msg, wParam, lParam);
}
void BeginRenameSelection(HWND hwnd, struct ClcData *dat)
@@ -536,7 +535,7 @@ void BeginRenameSelection(HWND hwnd, struct ClcData *dat) }
//dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, x, y, clRect.right - x, dat->rowHeight, hwnd, NULL, g_hInst, NULL);
- OldRenameEditWndProc = (WNDPROC) SetWindowLongPtr(dat->hwndRenameEdit, GWLP_WNDPROC, (LONG_PTR) RenameEditSubclassProc);
+ mir_subclassWindow(dat->hwndRenameEdit, RenameEditSubclassProc);
SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
SendMessage(dat->hwndRenameEdit, EM_SETSEL, 0, (LPARAM) (-1));
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index e371b70a0a..e6dcd1022b 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -52,7 +52,6 @@ static int disableautoupd = 1; HANDLE hFrameContactTree;
extern HIMAGELIST hCListImages;
extern PLUGININFOEX pluginInfo;
-extern WNDPROC OldStatusBarProc;
extern RECT old_window_rect, new_window_rect;
extern BOOL g_trayTooltipActive;
@@ -808,7 +807,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l ShowWindow(pcli->hwndStatus, SW_SHOW);
SendMessage(pcli->hwndStatus, WM_SIZE, 0, 0);
}
- OldStatusBarProc = (WNDPROC)SetWindowLongPtr(pcli->hwndStatus, GWLP_WNDPROC, (LONG_PTR)NewStatusBarWndProc);
+ mir_subclassWindow(pcli->hwndStatus, NewStatusBarWndProc);
SetClassLong(pcli->hwndStatus, GCL_STYLE, GetClassLong(pcli->hwndStatus, GCL_STYLE) & ~(CS_VREDRAW | CS_HREDRAW));
}
g_oldSize.cx = g_oldSize.cy = 0;
diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp index 82c5a5e2e6..cdb83b3e66 100644 --- a/plugins/Clist_nicer/src/statusbar.cpp +++ b/plugins/Clist_nicer/src/statusbar.cpp @@ -73,7 +73,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_ERASEBKGND:
if (cfg::dat.bSkinnedStatusBar)
return 1;
- return CallWindowProc(OldStatusBarProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, NewStatusBarWndProc, msg, wParam, lParam);
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
@@ -187,5 +187,5 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
}
- return CallWindowProc(OldStatusBarProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, NewStatusBarWndProc, msg, wParam, lParam);
}
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index 0039df55bb..e0a12e53c3 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -248,89 +248,82 @@ static LRESULT CALLBACK SubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lPa switch (msg) {
- case WM_KEYDOWN:
- if ( wParam == VK_DELETE && !ctrl) {
- SendMessage(GetParent(hwnd), WM_COMMAND, IDC_DELETE, 0);
- break;
- }
+ case WM_KEYDOWN:
+ if ( wParam == VK_DELETE && !ctrl) {
+ SendMessage(GetParent(hwnd), WM_COMMAND, IDC_DELETE, 0);
+ break;
+ }
- if (wParam == VK_LEFT && ctrl)
- {
- NMHDR nmhdr = {0};
- int tab = TabCtrl_GetCurSel(hTabs);
+ if (wParam == VK_LEFT && ctrl)
+ {
+ NMHDR nmhdr = {0};
+ int tab = TabCtrl_GetCurSel(hTabs);
- if (tab == 0)
- tab = TabCtrl_GetItemCount(hTabs)-1;
- else
- tab--;
+ if (tab == 0)
+ tab = TabCtrl_GetItemCount(hTabs)-1;
+ else
+ tab--;
- TabCtrl_SetCurSel(hTabs, tab);
- nmhdr.code = TCN_SELCHANGE;
- SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr);
- break;
- }
+ TabCtrl_SetCurSel(hTabs, tab);
+ nmhdr.code = TCN_SELCHANGE;
+ SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr);
+ break;
+ }
- if (wParam == VK_RIGHT && ctrl)
- {
- NMHDR nmhdr = {0};
- int tab = TabCtrl_GetCurSel(hTabs);
- int count = TabCtrl_GetItemCount(hTabs);
- tab = (tab + 1) % count;
-
- TabCtrl_SetCurSel(hTabs, tab);
- nmhdr.code = TCN_SELCHANGE;
- SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr);
- break;
- }
+ if (wParam == VK_RIGHT && ctrl)
+ {
+ NMHDR nmhdr = {0};
+ int tab = TabCtrl_GetCurSel(hTabs);
+ int count = TabCtrl_GetItemCount(hTabs);
+ tab = (tab + 1) % count;
+ TabCtrl_SetCurSel(hTabs, tab);
+ nmhdr.code = TCN_SELCHANGE;
+ SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr);
break;
+ }
- case WM_CHAR:
-/*
- {
- char t[32];
- sprintf(t,"%u\n",wParam);
- OutputDebugStringA(t);
- }
-*/
- // CTRL
- if ( !(GetKeyState(VK_CONTROL)&0x8000))
- break;
+ break;
- switch(wParam) {
+ case WM_CHAR:
+ // CTRL
+ if ( !(GetKeyState(VK_CONTROL)&0x8000))
+ break;
- case 1: // Ctrl+A
- if ( ListView_GetSelectedCount(hwnd) != (UINT)ListView_GetItemCount(hwnd))
- ListView_SetItemState(hwnd, -1, LVIS_SELECTED, LVIS_SELECTED);
- return 0;
+ switch(wParam) {
- case 3: // Ctrl+D
- SendMessage(GetParent(hwnd), WM_COMMAND, IDC_COPY, 0);
- return 0;
+ case 1: // Ctrl+A
+ if ( ListView_GetSelectedCount(hwnd) != (UINT)ListView_GetItemCount(hwnd))
+ ListView_SetItemState(hwnd, -1, LVIS_SELECTED, LVIS_SELECTED);
+ return 0;
- case 15: // Ctrl+O
- SendMessage(GetParent(hwnd), WM_COMMAND, IDC_OPTIONS, 0);
- return 0;
+ case 3: // Ctrl+D
+ SendMessage(GetParent(hwnd), WM_COMMAND, IDC_COPY, 0);
+ return 0;
- case 16: // Ctrl+P
- SendMessage(GetParent(hwnd), WM_COMMAND, IDC_PAUSE, 0);
- return 0;
+ case 15: // Ctrl+O
+ SendMessage(GetParent(hwnd), WM_COMMAND, IDC_OPTIONS, 0);
+ return 0;
- case 17: // Ctrl+Q
- SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SCROLL, 0);
- return 0;
+ case 16: // Ctrl+P
+ SendMessage(GetParent(hwnd), WM_COMMAND, IDC_PAUSE, 0);
+ return 0;
- case 19: // Ctrl+S
- SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SAVE, 0);
- return 0;
+ case 17: // Ctrl+Q
+ SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SCROLL, 0);
+ return 0;
- case 23: // Ctrl+W
- SendMessage(GetParent(hwnd), WM_COMMAND, IDC_CLOSE, 0);
- return 0;
- }
- break;
- }
- return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA),hwnd,msg,wParam,lParam);
+ case 19: // Ctrl+S
+ SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SAVE, 0);
+ return 0;
+
+ case 23: // Ctrl+W
+ SendMessage(GetParent(hwnd), WM_COMMAND, IDC_CLOSE, 0);
+ return 0;
+ }
+ break;
+ }
+ return mir_callNextSubclass(hwnd, SubclassProc, msg, wParam, lParam);
}
////////////////////////////////////////////////////////////////////////////////
@@ -351,7 +344,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA dat->hList = GetDlgItem(hwndDlg, IDC_LIST);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG)dat);
- SetWindowLongPtr(dat->hList, GWLP_USERDATA, SetWindowLongPtr(dat->hList, GWLP_WNDPROC, (LONG)SubclassProc));
+ mir_subclassWindow(dat->hList, SubclassProc);
// init buttons
{
@@ -641,8 +634,8 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA case WM_CLOSE:
DestroyWindow(hwndDlg);
break;
+
case WM_DESTROY:
- SetWindowLongPtr(dat->hList, GWLP_WNDPROC, GetWindowLongPtr(dat->hList, GWLP_USERDATA));
SendMessage(hwndConsole, HM_REMOVE, 0, (LPARAM)dat);
break;
}
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index c1608498a6..814361037d 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -9,8 +9,6 @@ int Hex; extern BOOL bServiceMode;
-static WNDPROC SettingListSubClass, ModuleTreeSubClass, SplitterSubClass;
-
void moduleListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
void SettingsListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
@@ -79,7 +77,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LP return 0;
}
- return CallWindowProc(SplitterSubClass,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
@@ -149,7 +147,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM }
break;
}
- return CallWindowProc(ModuleTreeSubClass,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, ModuleTreeSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK SettingListSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
@@ -186,7 +184,7 @@ static LRESULT CALLBACK SettingListSubclassProc(HWND hwnd,UINT msg,WPARAM wParam CreateDialog(hInst, MAKEINTRESOURCE(IDD_FIND), hwnd, FindWindowDlgProc);
break;
}
- return CallWindowProc(SettingListSubClass,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, SettingListSubclassProc, msg, wParam, lParam);
}
INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -203,13 +201,13 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) // setup the splitter
SetWindowLongPtr(GetDlgItem(hwnd,IDC_SPLITTER),GWLP_USERDATA,(LPARAM)DBGetContactSettingWord(NULL, modname, "Splitter", 300));
SendMessage(hwnd, GC_SPLITTERMOVED, 0,0);
- SplitterSubClass=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwnd,IDC_SPLITTER),GWLP_WNDPROC,(LONG)SplitterSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwnd,IDC_SPLITTER), SplitterSubclassProc);
// module tree
TreeView_SetUnicodeFormat(GetDlgItem(hwnd,IDC_MODULES), TRUE);
- ModuleTreeSubClass=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwnd,IDC_MODULES),GWLP_WNDPROC,(LONG)ModuleTreeSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwnd,IDC_MODULES), ModuleTreeSubclassProc);
//setting list
setupSettingsList(GetDlgItem(hwnd,IDC_SETTINGS));
- SettingListSubClass=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwnd,IDC_SETTINGS),GWLP_WNDPROC,(LONG)SettingListSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwnd,IDC_SETTINGS), SettingListSubclassProc);
HMENU hMenu = GetMenu(hwnd);
TranslateMenu(hMenu);
@@ -420,9 +418,6 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ImageList_Destroy(himl);
if (himl2)
ImageList_Destroy(himl2);
- SetWindowLongPtr(GetDlgItem(hwnd,IDC_SETTINGS),GWLP_WNDPROC,(LONG)SettingListSubClass);
- SetWindowLongPtr(GetDlgItem(hwnd,IDC_MODULES),GWLP_WNDPROC,(LONG)ModuleTreeSubClass);
- SetWindowLongPtr(GetDlgItem(hwnd,IDC_SPLITTER),GWLP_WNDPROC,(LONG)SplitterSubClass);
if (!DBGetContactSettingByte(NULL,modname,"Maximised",0)) {
RECT rc;
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index f7667f6f27..ea520eacc2 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -564,15 +564,11 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) }
-
-static WNDPROC ModuleTreeLabelEditSubClass;
-
static LRESULT CALLBACK ModuleTreeLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg) {
case WM_KEYUP:
- switch (wParam)
- {
+ switch (wParam) {
case VK_RETURN:
TreeView_EndEditLabelNow(GetParent(hwnd),0);
return 0;
@@ -582,8 +578,9 @@ static LRESULT CALLBACK ModuleTreeLabelEditSubClassProc(HWND hwnd,UINT msg,WPARA }
break;
}
- return CallWindowProc(ModuleTreeLabelEditSubClass,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, ModuleTreeLabelEditSubClassProc, msg, wParam, lParam);
}
+
void moduleListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam);
void moduleListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)// hwnd here is to the main window, NOT the treview
@@ -751,7 +748,7 @@ void moduleListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)// hwnd SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
break;
}
- ModuleTreeLabelEditSubClass = (WNDPROC)SetWindowLongPtr(hwnd2Edit, GWLP_WNDPROC, (LONG)ModuleTreeLabelEditSubClassProc);
+ mir_subclassWindow(hwnd2Edit, ModuleTreeLabelEditSubClassProc);
SetWindowLongPtr(hwnd, DWLP_MSGRESULT, FALSE);
}
break;
diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp index 9553a42dae..20cbeb3105 100644 --- a/plugins/FTPFileYM/src/dialog.cpp +++ b/plugins/FTPFileYM/src/dialog.cpp @@ -22,7 +22,6 @@ UploadDialog *UploadDialog::instance = NULL; UploadDialog *uDlg = NULL;
Mutex UploadDialog::mutexTabs;
-WNDPROC UploadDialog::oldTabControlProc;
extern Options &opt;
extern BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD);
@@ -141,12 +140,11 @@ void UploadDialog::Tab::labelCompleted() TabCtrl_SetItem(uDlg->hwndTabs, this->index(), &tab);
}
-INT_PTR CALLBACK UploadDialog::TabControlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK UploadDialog::TabControlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_LBUTTONDBLCLK:
- case WM_MBUTTONDOWN:
+ switch (msg) {
+ case WM_LBUTTONDBLCLK:
+ case WM_MBUTTONDOWN:
{
POINT pt;
GetCursorPos(&pt);
@@ -163,7 +161,7 @@ INT_PTR CALLBACK UploadDialog::TabControlProc(HWND hwnd, UINT msg, WPARAM wParam break;
}
- return CallWindowProc(UploadDialog::oldTabControlProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, UploadDialog::TabControlProc, msg, wParam, lParam);
}
INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -175,7 +173,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar TranslateDialogDefault(hwndDlg);
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Utils::loadIconEx("main"));
- UploadDialog::oldTabControlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TAB), GWLP_WNDPROC, (LONG_PTR)TabControlProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_TAB), TabControlProc);
LOGFONT logFont = {0};
HFONT hFont = (HFONT)SendMessage(GetDlgItem(hwndDlg, IDC_ST_FILE), WM_GETFONT, 0, 0);
diff --git a/plugins/FTPFileYM/src/dialog.h b/plugins/FTPFileYM/src/dialog.h index 1c1cd38ff8..c7d3ceb81a 100644 --- a/plugins/FTPFileYM/src/dialog.h +++ b/plugins/FTPFileYM/src/dialog.h @@ -33,7 +33,6 @@ class UploadDialog private:
static UploadDialog *instance;
static Mutex mutexTabs;
- static WNDPROC oldTabControlProc;
TCHAR stzToolTipText[1024];
UploadDialog();
@@ -79,6 +78,6 @@ public: void selectTab(int index);
void show();
- static INT_PTR CALLBACK TabControlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK TabControlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
};
\ No newline at end of file diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index 4d647fb642..37c92cf33f 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -1023,14 +1023,6 @@ void CreateDirectoryTree(char *szDir) CreateDirectory(szTestDir,NULL);
}
-void SubclassWnd(HWND hwnd, WNDPROC lpfnWndProc)
-{
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG)GetWindowLongPtr(hwnd, GWLP_WNDPROC));
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG)lpfnWndProc);
-}
-#define CallSubclassed(hwnd, uMsg, wParam, lParam)\
- CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA), hwnd, uMsg, wParam, lParam)
-
LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
@@ -1134,7 +1126,7 @@ LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa return 0;
}
}
- return CallSubclassed(hwnd, uMsg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ProgressWndProc, uMsg, wParam, lParam);
}
INT_PTR CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
@@ -1158,7 +1150,7 @@ INT_PTR CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam //SetDlgItemText(hDlg, IDC_FILENAME, "C:\\!Developer\\!Miranda\\miranda\\bin\\release\\emo\\biggrin.gif");
- SubclassWnd(GetDlgItem(hDlg, IDC_PROGRESS), ProgressWndProc);
+ mir_subclassWindow(GetDlgItem(hDlg, IDC_PROGRESS), ProgressWndProc);
SendDlgItemMessage(hDlg, IDC_PLAY, BUTTONSETASFLATBTN,0,0);
SendDlgItemMessage(hDlg, IDC_PLAY, BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[ICON_PLAY]);
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 900e6e7c7b..47d17555c5 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -62,9 +62,6 @@ static INT_PTR OnMainMenu_HideAll ( WPARAM wParam, LPARAM lParam ); static INT_PTR OnHotKey_HideWhenCListShow( WPARAM wParam, LPARAM lParam );
static VOID CALLBACK ToTopTimerProc ( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
-WNDPROC oldMirandaWndProc;
-
-
HINSTANCE hInst = NULL;
HMODULE hUserDll = NULL;
HFONT hFont[FLT_FONTIDS] = {NULL};
@@ -260,12 +257,9 @@ static int OnModulesLoded( WPARAM wParam, LPARAM lParam ) hevPrebuildMenu = HookEvent( ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu );
hwndMiranda = (HWND)CallService( MS_CLUI_GETHWND, 0, 0 );
- oldMirandaWndProc = (WNDPROC)SetWindowLongPtr( hwndMiranda, GWLP_WNDPROC, (LONG)newMirandaWndProc);
-
-
+ mir_subclassWindow(hwndMiranda, newMirandaWndProc);
// No thumbs yet
-// pThumbsList = NULL;
bEnableTip = ServiceExists("mToolTip/ShowTip");
RegisterWindowClass();
@@ -1222,5 +1216,5 @@ static LRESULT __stdcall newMirandaWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, }
}
}
- return( CallWindowProc(oldMirandaWndProc, hwnd, uMsg, wParam, lParam));
+ return mir_callNextSubclass(hwnd, newMirandaWndProc, uMsg, wParam, lParam);
}
diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp index c5b6a145b2..bde839a30c 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp @@ -23,7 +23,6 @@ extern HANDLE hWindowList; extern HCURSOR splitCursor;
MYCOLOURSET colourSet;
-WNDPROC wndSplitterProc;
LISTOPTIONS options;
/*
MainDlgProc handles messages to the main dialog box
@@ -90,7 +89,7 @@ INT_PTR WINAPI MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
- wndSplitterProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR)SplitterProc);
+ mir_subclassWindow(GetDlgItem(hDlg, IDC_SPLITTER), SplitterProc);
SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETEVENTMASK, 0, (LPARAM)ENM_LINK );
SendDlgItemMessage( hDlg, IDC_MAIN, EM_AUTOURLDETECT, TRUE, 0 );
@@ -977,5 +976,5 @@ LRESULT CALLBACK SplitterProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) ReleaseCapture();
return 0;
}
- return CallWindowProc(wndSplitterProc, hWnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hWnd, SplitterProc, msg, wParam, lParam);
}
\ No newline at end of file diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 4d88b91996..7f84855802 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -26,7 +26,6 @@ PROTOACCOUNT **accs; OPENOPTIONSDIALOG ood;
int protoCount;
int hLangpack;
-static LONG_PTR OldAuthReqEditProc;
struct {
char *module;
@@ -409,21 +408,21 @@ LPSTR getMirVer(HANDLE hContact) static LRESULT CALLBACK AuthReqEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg) {
- case WM_CHAR:
- if(wParam == '\n' && CTRL_IS_PRESSED) { // ctrl + ENTER
- PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
- return 0;
- }
- if(wParam == 1 && CTRL_IS_PRESSED) { // ctrl + a
- SendMessage(hwnd, EM_SETSEL, 0, -1);
- return 0;
- }
- break;
- case WM_SETFOCUS:
+ case WM_CHAR:
+ if(wParam == '\n' && CTRL_IS_PRESSED) { // ctrl + ENTER
+ PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ if(wParam == 1 && CTRL_IS_PRESSED) { // ctrl + a
SendMessage(hwnd, EM_SETSEL, 0, -1);
- break;
+ return 0;
+ }
+ break;
+ case WM_SETFOCUS:
+ SendMessage(hwnd, EM_SETSEL, 0, -1);
+ break;
}
- return CallWindowProc((WNDPROC)OldAuthReqEditProc,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, AuthReqEditSubclassProc, msg, wParam, lParam);
}
INT_PTR CALLBACK AuthReqWndProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
@@ -433,7 +432,7 @@ INT_PTR CALLBACK AuthReqWndProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) switch(msg){
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
- OldAuthReqEditProc = SetWindowLongPtr(GetDlgItem(hdlg, IDC_REASON), GWLP_WNDPROC, (LONG_PTR)AuthReqEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hdlg, IDC_REASON), AuthReqEditSubclassProc);
SendDlgItemMessage(hdlg, IDC_REASON, EM_LIMITTEXT, (WPARAM)255, 0);
SetDlgItemText(hdlg, IDC_REASON, TranslateT("Please authorize me to add you to my contact list."));
hcontact = (HANDLE)lparam;
@@ -441,15 +440,15 @@ INT_PTR CALLBACK AuthReqWndProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) case WM_COMMAND:
switch(LOWORD(wparam)) {
- case IDOK:
- {
- TCHAR tszReason[256] = {0};
- GetDlgItemText(hdlg,IDC_REASON,tszReason,255);
- CallContactService(hcontact,PSS_AUTHREQUESTT,0,(LPARAM)tszReason);
- } // fall through
- case IDCANCEL:
- DestroyWindow(hdlg);
- break;
+ case IDOK:
+ {
+ TCHAR tszReason[256] = {0};
+ GetDlgItemText(hdlg,IDC_REASON,tszReason,255);
+ CallContactService(hcontact,PSS_AUTHREQUESTT,0,(LPARAM)tszReason);
+ } // fall through
+ case IDCANCEL:
+ DestroyWindow(hdlg);
+ break;
}
break;
}
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index c2f05bf8b4..5fcc1fb8ce 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -106,8 +106,6 @@ class CLHistoryDlg HANDLE hContact;
tstring sPath;
- WNDPROC wpOrigEditProc;
-
HWND hFindDlg;
FINDREPLACE fr;
_TCHAR acFindStr[100];
@@ -928,9 +926,8 @@ LRESULT CALLBACK EditSubclassProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP SendMessage(hwnd , EM_EXSETSEL, 0, (LPARAM)&ft.chrg);
return 0;
}
-
}
- return CallWindowProc(pclDlg->wpOrigEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, EditSubclassProc, msg, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////
@@ -1040,9 +1037,8 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, {
CLHistoryDlg * pclDlg = (CLHistoryDlg *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
SetWindowLongPtr(hwndDlg,GWLP_USERDATA,lParam);
CLHistoryDlg * pclDlg = (CLHistoryDlg *)lParam;
@@ -1050,7 +1046,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, (LPARAM)LoadIcon( hInstance, MAKEINTRESOURCE(IDI_EXPORT_MESSAGE)));
HWND hRichEdit = GetDlgItem( hwndDlg , IDC_RICHEDIT );
- pclDlg->wpOrigEditProc = (WNDPROC) SetWindowLongPtr( hRichEdit, GWLP_WNDPROC, (LONG) EditSubclassProc);
+ mir_subclassWindow(hRichEdit, EditSubclassProc);
SetWindowLongPtr( hRichEdit, GWLP_USERDATA, (LONG) pclDlg );
@@ -1068,22 +1064,18 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION | ( bUseCC ? MF_CHECKED : 0 ) , ID_FV_COLOR, LPGENT("Color...") );
if( bUseCC )
- {
- SendMessage( hRichEdit , EM_SETBKGNDCOLOR, 0 ,
- db_get_dw( NULL , MODULE , szFileViewDB "CustomC" , RGB(255,255,255) )
- );
- }
+ SendMessage( hRichEdit , EM_SETBKGNDCOLOR, 0,
+ db_get_dw( NULL , MODULE , szFileViewDB "CustomC" , RGB(255,255,255)));
InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION , ID_FV_FONT, LPGENT("Font...") );
-
bool bUseSyntaxHL = db_get_b( NULL , MODULE , szFileViewDB "UseSyntaxHL" , 1 )!=0;
InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION | ( bUseSyntaxHL ? MF_CHECKED : 0 ) , ID_FV_SYNTAX_HL, LPGENT("Syntax highlight") );
SetRichEditFont( hRichEdit , bUseSyntaxHL );
TranslateDialogDefault(hwndDlg);
-
+
Utils_RestoreWindowPosition(hwndDlg,pclDlg->hContact,MODULE,szFileViewDB);
pclDlg->sPath = GetFilePathFromUser( pclDlg->hContact );
@@ -1105,44 +1097,39 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, sPath.erase( 0 , n + 1 );
if( _sntprintf( szTitle , sizeof( szTitle ) , szFormat , pszNick , sPath.c_str() , (pclDlg->bUtf8File ? _T("UTF8"):_T("ANSI")) ) > 0 )
- {
SetWindowText( hwndDlg , szTitle);
- }
}
}
-
+
WindowList_Add(hInternalWindowList,hwndDlg,pclDlg->hContact);
- return TRUE;
- }
- case WM_RELOAD_FILE:
- {
- bLoadFile(hwndDlg , pclDlg );
- return TRUE;
}
- case WM_SIZE:
- case WM_SIZING:
- {
- SetWindowsCtrls( hwndDlg );
- return TRUE;
- }
- case WM_NCDESTROY:
- {
- EnterCriticalSection( &csHistoryList );
- clHistoryDlgList.remove( pclDlg );
- LeaveCriticalSection( &csHistoryList );
-
- delete pclDlg;
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,NULL);
- return 0;
- }
- case WM_DESTROY:
- {
- Utils_SaveWindowPosition(hwndDlg,pclDlg->hContact,MODULE,szFileViewDB);
- WindowList_Remove(hInternalWindowList,hwndDlg);
- return 0;
- }
- case WM_SYSCOMMAND:
+ return TRUE;
+
+ case WM_RELOAD_FILE:
+ bLoadFile(hwndDlg , pclDlg );
+ return TRUE;
+
+ case WM_SIZE:
+ case WM_SIZING:
+ SetWindowsCtrls( hwndDlg );
+ return TRUE;
+
+ case WM_NCDESTROY:
+ EnterCriticalSection( &csHistoryList );
+ clHistoryDlgList.remove( pclDlg );
+ LeaveCriticalSection( &csHistoryList );
+
+ delete pclDlg;
+ SetWindowLongPtr(hwndDlg,GWLP_USERDATA,NULL);
+ return 0;
+
+ case WM_DESTROY:
+ Utils_SaveWindowPosition(hwndDlg,pclDlg->hContact,MODULE,szFileViewDB);
+ WindowList_Remove(hInternalWindowList,hwndDlg);
+ return 0;
+
+ case WM_SYSCOMMAND:
{
HMENU hSysMenu = GetSystemMenu( hwndDlg , FALSE );
bool bUseSyntaxHL = (GetMenuState( hSysMenu , ID_FV_SYNTAX_HL , MF_BYCOMMAND ) & MF_CHECKED)!=0;
@@ -1154,10 +1141,10 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, lf.lfHeight = 14L;
{ DWORD dwEffects = db_get_dw( NULL , MODULE , szFileViewDB "TEffects" , 0 );
- lf.lfWeight = (dwEffects & CFE_BOLD) ? FW_BOLD : 0;
- lf.lfUnderline = (dwEffects & CFE_UNDERLINE) != 0;
- lf.lfStrikeOut = (dwEffects & CFE_STRIKEOUT) != 0;
- lf.lfItalic = (dwEffects & CFE_ITALIC) != 0;
+ lf.lfWeight = (dwEffects & CFE_BOLD) ? FW_BOLD : 0;
+ lf.lfUnderline = (dwEffects & CFE_UNDERLINE) != 0;
+ lf.lfStrikeOut = (dwEffects & CFE_STRIKEOUT) != 0;
+ lf.lfItalic = (dwEffects & CFE_ITALIC) != 0;
}
_tcscpy(lf.lfFaceName, _DBGetString( NULL , MODULE , szFileViewDB "TFace" , _T("Courier New")).c_str());
CHOOSEFONT cf = { 0 };
@@ -1170,9 +1157,9 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, if( ChooseFont( &cf ) )
{
DWORD dwEffects = (lf.lfWeight == FW_BOLD ? CFE_BOLD : 0) |
- (lf.lfItalic ? CFE_ITALIC : 0) |
- (lf.lfStrikeOut ? CFE_STRIKEOUT : 0) |
- (lf.lfUnderline ? CFE_UNDERLINE : 0);
+ (lf.lfItalic ? CFE_ITALIC : 0) |
+ (lf.lfStrikeOut ? CFE_STRIKEOUT : 0) |
+ (lf.lfUnderline ? CFE_UNDERLINE : 0);
db_set_dw( NULL , MODULE , szFileViewDB "TEffects" , dwEffects );
db_set_dw( NULL , MODULE , szFileViewDB "THeight" , cf.iPointSize * 2 );
@@ -1264,70 +1251,61 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, return FALSE;
}
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDCANCEL:
+ case IDOK:
+ DestroyWindow(hwndDlg);
+ return TRUE;
+ case IDC_FV_EXTERNAL:
+ bOpenExternaly( pclDlg->hContact );
+ return TRUE;
+ case IDC_FV_FIND:
{
- case IDCANCEL:
- case IDOK:
- DestroyWindow(hwndDlg);
- return TRUE;
- case IDC_FV_EXTERNAL:
- bOpenExternaly( pclDlg->hContact );
- return TRUE;
- case IDC_FV_FIND:
+ if( pclDlg->hFindDlg )
{
- if( pclDlg->hFindDlg )
- {
- BringWindowToTop( pclDlg->hFindDlg );
- return TRUE;
- }
- pclDlg->fr.hwndOwner = GetDlgItem( hwndDlg , IDC_RICHEDIT );
- pclDlg->hFindDlg = FindText( &pclDlg->fr );
+ BringWindowToTop( pclDlg->hFindDlg );
return TRUE;
}
+ pclDlg->fr.hwndOwner = GetDlgItem( hwndDlg , IDC_RICHEDIT );
+ pclDlg->hFindDlg = FindText( &pclDlg->fr );
+ return TRUE;
}
- break;
}
- case WM_NOTIFY:
+ break;
+
+ case WM_NOTIFY:
+ if( ((NMHDR*)lParam)->idFrom == IDC_RICHEDIT )
{
- if( ((NMHDR*)lParam)->idFrom == IDC_RICHEDIT )
+ if( ((NMHDR*)lParam)->code == EN_LINK )
{
- if( ((NMHDR*)lParam)->code == EN_LINK )
+ ENLINK* pstLink = (ENLINK*)lParam;
+ if( pstLink->msg == WM_LBUTTONUP )
{
- ENLINK* pstLink = (ENLINK*)lParam;
- if( pstLink->msg == WM_LBUTTONUP )
+ _TCHAR szUrl[ 500 ];
+ if( (pstLink->chrg.cpMax - pstLink->chrg.cpMin) > (sizeof( szUrl ) - 2) )
+ return FALSE;
+
+ TEXTRANGE stToGet;
+ stToGet.chrg = pstLink->chrg;
+ stToGet.lpstrText = szUrl;
+ if( SendMessage( pstLink->nmhdr.hwndFrom , EM_GETTEXTRANGE , 0 , (LPARAM)&stToGet ) > 0 )
{
- _TCHAR szUrl[ 500 ];
- if( (pstLink->chrg.cpMax - pstLink->chrg.cpMin) > (sizeof( szUrl ) - 2) )
- return FALSE;
-
- TEXTRANGE stToGet;
- stToGet.chrg = pstLink->chrg;
- stToGet.lpstrText = szUrl;
- if( SendMessage( pstLink->nmhdr.hwndFrom , EM_GETTEXTRANGE , 0 , (LPARAM)&stToGet ) > 0 )
- {
- CallService(MS_UTILS_OPENURL,1,(LPARAM)szUrl);
- }
- return TRUE;
+ CallService(MS_UTILS_OPENURL,1,(LPARAM)szUrl);
}
+ return TRUE;
}
}
- break;
- }
- case WM_CLOSE:
- {
- DestroyWindow(hwndDlg);
- return TRUE;
}
+ break;
+
+ case WM_CLOSE:
+ DestroyWindow(hwndDlg);
+ return TRUE;
}
return FALSE;
-//FALSE;//DefWindowProc( hwndDlg, msg, wParam, lParam );
-//DefDlgProc( hwndDlg, msg, wParam, lParam );
}
-
-
/////////////////////////////////////////////////////////////////////
// Member Function : bShowFileViewer
// Type : Global
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index 513f9c40ef..9551211069 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -378,7 +378,7 @@ static LRESULT CALLBACK StatusMsgEditSubclassProc(HWND hwnd, UINT msg, WPARAM wP break;
}
- return CallWindowProc((WNDPROC) GetWindowLong(hwnd, GWLP_USERDATA), hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, StatusMsgEditSubclassProc, msg, wParam, lParam);
}
struct SetStatusMessageData {
@@ -391,13 +391,8 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SendMessage(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), EM_LIMITTEXT,
- MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE - 1, 0);
- {
- WNDPROC old_proc = (WNDPROC) SetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE),
- GWLP_WNDPROC, (LONG) StatusMsgEditSubclassProc);
- SetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWLP_USERDATA, (long) old_proc);
- }
+ SendMessage(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), EM_LIMITTEXT, MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE - 1, 0);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), StatusMsgEditSubclassProc);
return TRUE;
case WMU_SETDATA:
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 32cc4160ac..3f378fa70f 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -747,22 +747,15 @@ static INT_PTR CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, HWND hPubKeyEdit = NULL; -LONG_PTR default_edit_proc = NULL; - -static BOOL CALLBACK editctrl_ctrl_a(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) +static LRESULT CALLBACK editctrl_ctrl_a(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) { - LRESULT ret = 0; - switch(msg) - { + switch(msg) { case WM_KEYDOWN: if(wParam == 0x41 && GetKeyState(VK_CONTROL)< 0 ) SendMessage(hwndDlg, EM_SETSEL, 0, -1); - break; - default: - ret = CallWindowProc((WNDPROC)default_edit_proc, hwndDlg, msg, wParam, lParam); - break; + return 0; } - return ret; + return mir_callNextSubclass(hwndDlg, editctrl_ctrl_a, msg, wParam, lParam); } static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) @@ -771,611 +764,601 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam TCHAR *tmp = NULL; wstring key_buf; wstring::size_type ws1 = 0, ws2 = 0; - switch (msg) - { - case WM_INITDIALOG: - { - hContact = user_data[1]; - default_edit_proc = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), GWLP_WNDPROC); - SetWindowPos(hwndDlg, 0, load_key_rect.left, load_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), GWLP_WNDPROC, (LONG_PTR)editctrl_ctrl_a); - HANDLE hcnt = hContact; - if(metaIsProtoMetaContacts(hcnt)) - hcnt = metaGetMostOnline(hcnt); - TranslateDialogDefault(hwndDlg); + switch (msg) { + case WM_INITDIALOG: { - string msg = Translate("Load Public GPG Key for "); - msg += (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, 0); - SetWindowTextA(hwndDlg, msg.c_str()); - } - bool isContactSecured(HANDLE); - if(!hcnt) - { - EnableWindow(GetDlgItem(hwndDlg, IDC_SELECT_EXISTING), 0); - EnableWindow(GetDlgItem(hwndDlg, IDC_ENABLE_ENCRYPTION), 0); - } - if(isContactSecured(hcnt)) - SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateT("Turn off encryption")); - else - { - SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateT("Turn on encryption")); - CheckDlgButton(hwndDlg, IDC_ENABLE_ENCRYPTION, 1); - } - if(hcnt) - { - tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T("")); - wstring str = tmp; - mir_free(tmp); tmp = NULL; - wstring::size_type p = 0, stop = 0; - if(!str.empty()) + hContact = user_data[1]; + SetWindowPos(hwndDlg, 0, load_key_rect.left, load_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); + mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), editctrl_ctrl_a); + HANDLE hcnt = hContact; + if(metaIsProtoMetaContacts(hcnt)) + hcnt = metaGetMostOnline(hcnt); + TranslateDialogDefault(hwndDlg); + { + string msg = Translate("Load Public GPG Key for "); + msg += (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, 0); + SetWindowTextA(hwndDlg, msg.c_str()); + } + bool isContactSecured(HANDLE); + if(!hcnt) { - for(;;) + EnableWindow(GetDlgItem(hwndDlg, IDC_SELECT_EXISTING), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_ENABLE_ENCRYPTION), 0); + } + if(isContactSecured(hcnt)) + SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateT("Turn off encryption")); + else + { + SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateT("Turn on encryption")); + CheckDlgButton(hwndDlg, IDC_ENABLE_ENCRYPTION, 1); + } + if(hcnt) + { + tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T("")); + wstring str = tmp; + mir_free(tmp); tmp = NULL; + wstring::size_type p = 0, stop = 0; + if(!str.empty()) { - if((p = str.find(_T("\n"), p+2)) != wstring::npos) + for(;;) { - if(p > stop) + if((p = str.find(_T("\n"), p+2)) != wstring::npos) { - stop = p; - str.insert(p, _T("\r")); - } - else - break; + if(p > stop) + { + stop = p; + str.insert(p, _T("\r")); + } + else + break; + } + } + } + // char *tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "KeyID_Prescense", ""); + if(!hcontact_data[hcnt].key_in_prescense.empty()) + { + char *tmp2 = UniGetContactSettingUtf(hcnt, szGPGModuleName, "KeyID", ""); + if(!tmp2[0]) + { + string out; + DWORD code; + std::vector<wstring> cmd; + cmd.push_back(L"--export"); + cmd.push_back(L"-a"); + cmd.push_back(toUTF16(hcontact_data[hcnt].key_in_prescense)); + gpg_execution_params params(cmd); + pxResult result; + params.out = &out; + params.code = &code; + params.result = &result; + gpg_launcher(params); //TODO: handle errors + if((out.find("-----BEGIN PGP PUBLIC KEY BLOCK-----") != string::npos) && (out.find("-----END PGP PUBLIC KEY BLOCK-----") != string::npos)) + { + string::size_type p = 0, stop = 0; + for(;;) + { + if((p = out.find("\n", p+2)) != string::npos) + { + if(p > stop) + { + stop = p; + out.insert(p, "\r"); + } + else + break; + } + } + TCHAR *tmp3 = mir_a2t(out.c_str()); + str.clear(); + str.append(tmp3); + string msg = Translate("Load Public GPG Key for "); + msg += (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, 0); + msg += " (Key ID: "; + msg += hcontact_data[hcnt].key_in_prescense; + msg += Translate(" found in prescense, and exists in keyring.)"); + SetWindowTextA(hwndDlg, msg.c_str()); + } + else + { + string msg = Translate("Load Public GPG Key (Key ID: "); + msg += hcontact_data[hcnt].key_in_prescense; + msg += Translate(" found in prescense.)"); + SetWindowTextA(hwndDlg, msg.c_str()); + EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT), 1); + } } + mir_free(tmp2); } + if(tmp) + mir_free(tmp); + SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, !str.empty()?str.c_str():_T("")); } -// char *tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "KeyID_Prescense", ""); - if(!hcontact_data[hcnt].key_in_prescense.empty()) + hPubKeyEdit = GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT); + return TRUE; + } + + case WM_COMMAND: + { + switch (LOWORD(wParam)) { - char *tmp2 = UniGetContactSettingUtf(hcnt, szGPGModuleName, "KeyID", ""); - if(!tmp2[0]) + case ID_OK: { - string out; - DWORD code; - std::vector<wstring> cmd; - cmd.push_back(L"--export"); - cmd.push_back(L"-a"); - cmd.push_back(toUTF16(hcontact_data[hcnt].key_in_prescense)); - gpg_execution_params params(cmd); - pxResult result; - params.out = &out; - params.code = &code; - params.result = &result; - gpg_launcher(params); //TODO: handle errors - if((out.find("-----BEGIN PGP PUBLIC KEY BLOCK-----") != string::npos) && (out.find("-----END PGP PUBLIC KEY BLOCK-----") != string::npos)) + tmp = new TCHAR [40960]; + TCHAR *begin, *end; + GetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, tmp, 40960); + key_buf.append(tmp); + key_buf.append(_T("\n")); //no new line at end of file ) + delete [] tmp; + while((ws1 = key_buf.find(_T("\r"), ws1)) != wstring::npos) + { + key_buf.erase(ws1, 1); //remove windows specific trash + } + ws1 = 0; + if(((ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) != wstring::npos)) + { + begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")) + 1)); + _tcscpy(begin, _T("-----BEGIN PGP PUBLIC KEY BLOCK-----")); + end = (TCHAR*)mir_alloc(sizeof( TCHAR) * (_tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")) + 1)); + _tcscpy(end, _T("-----END PGP PUBLIC KEY BLOCK-----")); + } + else if(((ws2 = key_buf.find(_T("-----END PGP PRIVATE KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"))) != wstring::npos)) + { + begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")) + 1)); + _tcscpy(begin, _T("-----BEGIN PGP PRIVATE KEY BLOCK-----")); + end = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----END PGP PRIVATE KEY BLOCK-----")) + 1)); + _tcscpy(end, _T("-----END PGP PRIVATE KEY BLOCK-----")); + } + else { - string::size_type p = 0, stop = 0; - for(;;) + MessageBox(0, TranslateT("This is not public or private key"), _T("INFO"), MB_OK); + break; + } + ws2 += _tcslen(end); + bool allsubcontacts = false; + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(MessageBox(0, TranslateT("Do you want load key for all subcontacts ?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) + { + allsubcontacts = true; + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + DBWriteContactSettingTString(hcnt, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); + } + } + else + DBWriteContactSettingTString(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); + } + else + DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); + } + tmp = (TCHAR*)mir_alloc(sizeof( TCHAR) * (key_buf.length()+1)); + _tcscpy(tmp, key_buf.substr(ws1,ws2-ws1).c_str()); + { //gpg execute block + std::vector<wstring> cmd; + TCHAR tmp2[MAX_PATH] = {0}; + TCHAR *ptmp; + string output; + DWORD exitcode; + { + HANDLE hcnt = hContact; + if(metaIsProtoMetaContacts(hcnt)) + hcnt = metaGetMostOnline(hcnt); + ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + _tcscpy(tmp2, ptmp); + mir_free(ptmp); + _tcscat(tmp2, _T("\\")); + _tcscat(tmp2, _T("temporary_exported.asc")); + boost::filesystem::remove(tmp2); + wfstream f(tmp2, std::ios::out); + ptmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T("")); + wstring str = ptmp; + mir_free(ptmp); + wstring::size_type s = 0; + while((s = str.find(_T("\r"), s)) != wstring::npos) + { + str.erase(s, 1); + } + f<<str.c_str(); + f.close(); + cmd.push_back(L"--batch"); + cmd.push_back(L"--import"); + cmd.push_back(tmp2); + } + gpg_execution_params params(cmd); + pxResult result; + params.out = &output; + params.code = &exitcode; + params.result = &result; + if(!gpg_launcher(params)) + break; + if(result == pxNotFound) + break; + mir_free(begin); + mir_free(end); + if(hContact) + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + DBDeleteContactSetting(hcnt, szGPGModuleName, "bAlwatsTrust"); + } + } + else + DBDeleteContactSetting(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust"); + } + else + DBDeleteContactSetting(hContact, szGPGModuleName, "bAlwatsTrust"); + } { - if((p = out.find("\n", p+2)) != string::npos) + TCHAR *tmp; + if(output.find("already in secret keyring") != string::npos) + { + MessageBox(0, TranslateT("Key already in scret key ring."), TranslateT("Info"), MB_OK); + boost::filesystem::remove(tmp2); + break; + } + char *tmp2; + string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); + string::size_type s2 = output.find(":", s); + tmp2 = (char*)mir_alloc((output.substr(s,s2-s).length()+1)*sizeof(char)); + strcpy(tmp2, output.substr(s,s2-s).c_str()); + mir_utf8decode(tmp2, 0); + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyID", tmp2); + } + } + else + DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", tmp2); + } + else + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyID", tmp2); + } + mir_free(tmp2); + tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str()); + if(hContact && hwndList_p) + ListView_SetItemText(hwndList_p, item_num, 1, tmp); + mir_free(tmp); + s = output.find("“", s2); + if(s == string::npos) + { + s = output.find("\"", s2); + s += 1; + } + else + s += 3; + bool uncommon = false; + if((s2 = output.find("(", s)) == string::npos) + { + if((s2 = output.find("<", s)) == string::npos) + { + s2 = output.find("”", s); + uncommon = true; + } + } + else if(s2 > output.find("<", s)) + s2 = output.find("<", s); + if(s2 != string::npos && s != string::npos) { - if(p > stop) + tmp2 = (char*)mir_alloc(sizeof(char)*(output.substr(s,s2-s-(uncommon?1:0)).length()+1)); + strcpy(tmp2, output.substr(s,s2-s-(uncommon?1:0)).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + } + } + else + DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + } + else + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + } + mir_free(tmp2); + tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s-1)).c_str()); + if(hContact && hwndList_p) + ListView_SetItemText(hwndList_p, item_num, 2, tmp); + mir_free(tmp); + if((s = output.find(")", s2)) == string::npos) + s = output.find(">", s2); + else if(s > output.find(">", s2)) + s = output.find(">", s2); + s2++; + if(s != string::npos && s2 != string::npos) { - stop = p; - out.insert(p, "\r"); - } - else + if(output[s] == ')') + { + tmp2 = (char*)mir_alloc((output.substr(s2,s-s2).length()+1)*sizeof(char)); + strcpy(tmp2, output.substr(s2,s-s2).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + } + } + else + DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + } + else + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + } + mir_free(tmp2); + s+=3; + s2 = output.find(">", s); + tmp2 = new char [output.substr(s,s2-s).length()+1]; + strcpy(tmp2, output.substr(s,s2-s).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + } + } + else + DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + } + else + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + } + mir_free(tmp2); + tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str()); + if(hContact && hwndList_p) + ListView_SetItemText(hwndList_p, item_num, 3, tmp); + mir_free(tmp); + } + else + { + tmp2 = (char*)mir_alloc(output.substr(s2,s-s2).length()+1); + strcpy(tmp2, output.substr(s2,s-s2).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + } + } + else + DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + } + else + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + } + mir_free(tmp2); + tmp = mir_wstrdup(toUTF16(output.substr(s2,s-s2)).c_str()); + if(hContact && hwndList_p) + ListView_SetItemText(hwndList_p, item_num, 3, tmp); + mir_free(tmp); + } + } + } + if(hContact && hwndList_p) + { + ListView_SetColumnWidth(hwndList_p, 0, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList_p, 1, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList_p, 2, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList_p, 3, LVSCW_AUTOSIZE); + } + } + if(!hContact) + { + TCHAR *fp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", _T("")); + { + string out; + DWORD code; + std::vector<wstring> cmd; + cmd.push_back(L"--batch"); + cmd.push_back(L"-a"); + cmd.push_back(L"--export"); + cmd.push_back(fp); + mir_free(fp); + gpg_execution_params params(cmd); + pxResult result; + params.out = &out; + params.code = &code; + params.result = &result; + if(!gpg_launcher(params)) break; + if(result == pxNotFound) + break; + string::size_type s = 0; + while((s = out.find("\r", s)) != string::npos) + { + out.erase(s, 1); + } + DBWriteContactSettingString(hContact, szGPGModuleName, "GPGPubKey", out.c_str()); } } - TCHAR *tmp3 = mir_a2t(out.c_str()); - str.clear(); - str.append(tmp3); - string msg = Translate("Load Public GPG Key for "); - msg += (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, 0); - msg += " (Key ID: "; - msg += hcontact_data[hcnt].key_in_prescense; - msg += Translate(" found in prescense, and exists in keyring.)"); - SetWindowTextA(hwndDlg, msg.c_str()); + tmp = mir_wstrdup(toUTF16(output).c_str()); + MessageBox(0, tmp, _T(""), MB_OK); + mir_free(tmp); + boost::filesystem::remove(tmp2); } - else + key_buf.clear(); + if(IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ENCRYPTION)) { - string msg = Translate("Load Public GPG Key (Key ID: "); - msg += hcontact_data[hcnt].key_in_prescense; - msg += Translate(" found in prescense.)"); - SetWindowTextA(hwndDlg, msg.c_str()); - EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT), 1); + void setSrmmIcon(HANDLE); + void setClistIcon(HANDLE); + if(hContact) + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + { + if(!isContactSecured(hcnt)) + DBWriteContactSettingByte(hcnt, szGPGModuleName, "GPGEncryption", 1); + else + DBWriteContactSettingByte(hcnt, szGPGModuleName, "GPGEncryption", 0); + setSrmmIcon(hContact); + setClistIcon(hContact); + } + } + } + else if(!isContactSecured(hContact)) + DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1); + else + DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0); + } + else if(!isContactSecured(hContact)) + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); + else + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); + } } + DestroyWindow(hwndDlg); } - mir_free(tmp2); + break; + case ID_LOAD_FROM_FILE: + { + tmp = GetFilePath(TranslateT("Set file containing GPG public key"), _T("*"), TranslateT("GPG public key file")); + if(!tmp) + { + break; + } + wfstream f(tmp, std::ios::in | std::ios::ate | std::ios::binary); + delete [] tmp; + if(!f.is_open()) + { + MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); + break; + } + if(f.is_open()) + { + std::wifstream::pos_type size = f.tellg(); + TCHAR *tmp = new TCHAR [(std::ifstream::pos_type)size+(std::ifstream::pos_type)1]; + f.seekg(0, std::ios::beg); + f.read(tmp, size); + tmp[size]= '\0'; + key_buf.append(tmp); + delete [] tmp; + f.close(); + } + if(key_buf.empty()) + { + key_buf.clear(); + if(bDebugLog) + debuglog<<std::string(time_str()+": info: Failed to read key file"); + break; + } + ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----")); + ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")); + if(ws2 == wstring::npos || ws1 == wstring::npos) + { + ws2 = key_buf.find(_T("-----END PGP PRIVATE KEY BLOCK-----")); + ws1 = key_buf.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")); + } + if(ws2 == wstring::npos || ws1 == wstring::npos) + { + MessageBox(0, TranslateT("Where is no public or private key."), TranslateT("Info"), MB_OK); + break; + } + ws2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")); + SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, key_buf.substr(ws1,ws2-ws1).c_str()); + key_buf.clear(); + } + break; + case IDC_IMPORT: + extern HANDLE new_key_hcnt; + extern boost::mutex new_key_hcnt_mutex; + new_key_hcnt_mutex.lock(); + new_key_hcnt = hContact; + void ShowImportKeyDialog(); + ShowImportKeyDialog(); + break; + case IDC_SELECT_EXISTING: + void ShowSelectExistingKeyDialog(); + ShowSelectExistingKeyDialog(); + break; } - if(tmp) - mir_free(tmp); - SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, !str.empty()?str.c_str():_T("")); + break; } - hPubKeyEdit = GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT); - return TRUE; - } - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case ID_OK: - { - tmp = new TCHAR [40960]; - TCHAR *begin, *end; - GetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, tmp, 40960); - key_buf.append(tmp); - key_buf.append(_T("\n")); //no new line at end of file ) - delete [] tmp; - while((ws1 = key_buf.find(_T("\r"), ws1)) != wstring::npos) - { - key_buf.erase(ws1, 1); //remove windows specific trash - } - ws1 = 0; - if(((ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) != wstring::npos)) - { - begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")) + 1)); - _tcscpy(begin, _T("-----BEGIN PGP PUBLIC KEY BLOCK-----")); - end = (TCHAR*)mir_alloc(sizeof( TCHAR) * (_tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")) + 1)); - _tcscpy(end, _T("-----END PGP PUBLIC KEY BLOCK-----")); - } - else if(((ws2 = key_buf.find(_T("-----END PGP PRIVATE KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"))) != wstring::npos)) - { - begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")) + 1)); - _tcscpy(begin, _T("-----BEGIN PGP PRIVATE KEY BLOCK-----")); - end = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----END PGP PRIVATE KEY BLOCK-----")) + 1)); - _tcscpy(end, _T("-----END PGP PRIVATE KEY BLOCK-----")); - } - else - { - MessageBox(0, TranslateT("This is not public or private key"), _T("INFO"), MB_OK); - break; - } - ws2 += _tcslen(end); - bool allsubcontacts = false; - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(MessageBox(0, TranslateT("Do you want load key for all subcontacts ?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) - { - allsubcontacts = true; - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - DBWriteContactSettingTString(hcnt, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); - } - } - else - DBWriteContactSettingTString(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); - } - else - DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); - } - tmp = (TCHAR*)mir_alloc(sizeof( TCHAR) * (key_buf.length()+1)); - _tcscpy(tmp, key_buf.substr(ws1,ws2-ws1).c_str()); - { //gpg execute block - std::vector<wstring> cmd; - TCHAR tmp2[MAX_PATH] = {0}; - TCHAR *ptmp; - string output; - DWORD exitcode; - { - HANDLE hcnt = hContact; - if(metaIsProtoMetaContacts(hcnt)) - hcnt = metaGetMostOnline(hcnt); - ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - _tcscpy(tmp2, ptmp); - mir_free(ptmp); - _tcscat(tmp2, _T("\\")); - _tcscat(tmp2, _T("temporary_exported.asc")); - boost::filesystem::remove(tmp2); - wfstream f(tmp2, std::ios::out); - ptmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T("")); - wstring str = ptmp; - mir_free(ptmp); - wstring::size_type s = 0; - while((s = str.find(_T("\r"), s)) != wstring::npos) - { - str.erase(s, 1); - } - f<<str.c_str(); - f.close(); - cmd.push_back(L"--batch"); - cmd.push_back(L"--import"); - cmd.push_back(tmp2); - } - gpg_execution_params params(cmd); - pxResult result; - params.out = &output; - params.code = &exitcode; - params.result = &result; - if(!gpg_launcher(params)) - break; - if(result == pxNotFound) - break; - mir_free(begin); - mir_free(end); - if(hContact) - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - DBDeleteContactSetting(hcnt, szGPGModuleName, "bAlwatsTrust"); - } - } - else - DBDeleteContactSetting(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust"); - } - else - DBDeleteContactSetting(hContact, szGPGModuleName, "bAlwatsTrust"); - } - { - TCHAR *tmp; - if(output.find("already in secret keyring") != string::npos) - { - MessageBox(0, TranslateT("Key already in scret key ring."), TranslateT("Info"), MB_OK); - boost::filesystem::remove(tmp2); - break; - } - char *tmp2; - string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); - string::size_type s2 = output.find(":", s); - tmp2 = (char*)mir_alloc((output.substr(s,s2-s).length()+1)*sizeof(char)); - strcpy(tmp2, output.substr(s,s2-s).c_str()); - mir_utf8decode(tmp2, 0); - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyID", tmp2); - } - } - else - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", tmp2); - } - else - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyID", tmp2); - } - mir_free(tmp2); - tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str()); - if(hContact && hwndList_p) - ListView_SetItemText(hwndList_p, item_num, 1, tmp); - mir_free(tmp); - s = output.find("“", s2); - if(s == string::npos) - { - s = output.find("\"", s2); - s += 1; - } - else - s += 3; - bool uncommon = false; - if((s2 = output.find("(", s)) == string::npos) - { - if((s2 = output.find("<", s)) == string::npos) - { - s2 = output.find("”", s); - uncommon = true; - } - } - else if(s2 > output.find("<", s)) - s2 = output.find("<", s); - if(s2 != string::npos && s != string::npos) - { - tmp2 = (char*)mir_alloc(sizeof(char)*(output.substr(s,s2-s-(uncommon?1:0)).length()+1)); - strcpy(tmp2, output.substr(s,s2-s-(uncommon?1:0)).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); - } - } - else - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); - } - else - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); - } - mir_free(tmp2); - tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s-1)).c_str()); - if(hContact && hwndList_p) - ListView_SetItemText(hwndList_p, item_num, 2, tmp); - mir_free(tmp); - if((s = output.find(")", s2)) == string::npos) - s = output.find(">", s2); - else if(s > output.find(">", s2)) - s = output.find(">", s2); - s2++; - if(s != string::npos && s2 != string::npos) - { - if(output[s] == ')') - { - tmp2 = (char*)mir_alloc((output.substr(s2,s-s2).length()+1)*sizeof(char)); - strcpy(tmp2, output.substr(s2,s-s2).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); - } - } - else - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); - } - else - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); - } - mir_free(tmp2); - s+=3; - s2 = output.find(">", s); - tmp2 = new char [output.substr(s,s2-s).length()+1]; - strcpy(tmp2, output.substr(s,s2-s).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); - } - } - else - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); - } - else - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); - } - mir_free(tmp2); - tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str()); - if(hContact && hwndList_p) - ListView_SetItemText(hwndList_p, item_num, 3, tmp); - mir_free(tmp); - } - else - { - tmp2 = (char*)mir_alloc(output.substr(s2,s-s2).length()+1); - strcpy(tmp2, output.substr(s2,s-s2).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); - } - } - else - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); - } - else - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); - } - mir_free(tmp2); - tmp = mir_wstrdup(toUTF16(output.substr(s2,s-s2)).c_str()); - if(hContact && hwndList_p) - ListView_SetItemText(hwndList_p, item_num, 3, tmp); - mir_free(tmp); - } - } - } - if(hContact && hwndList_p) - { - ListView_SetColumnWidth(hwndList_p, 0, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList_p, 1, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList_p, 2, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList_p, 3, LVSCW_AUTOSIZE); - } - } - if(!hContact) - { - TCHAR *fp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", _T("")); - { - string out; - DWORD code; - std::vector<wstring> cmd; - cmd.push_back(L"--batch"); - cmd.push_back(L"-a"); - cmd.push_back(L"--export"); - cmd.push_back(fp); - mir_free(fp); - gpg_execution_params params(cmd); - pxResult result; - params.out = &out; - params.code = &code; - params.result = &result; - if(!gpg_launcher(params)) - break; - if(result == pxNotFound) - break; - string::size_type s = 0; - while((s = out.find("\r", s)) != string::npos) - { - out.erase(s, 1); - } - DBWriteContactSettingString(hContact, szGPGModuleName, "GPGPubKey", out.c_str()); - } - } - tmp = mir_wstrdup(toUTF16(output).c_str()); - MessageBox(0, tmp, _T(""), MB_OK); - mir_free(tmp); - boost::filesystem::remove(tmp2); - } - key_buf.clear(); - if(IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ENCRYPTION)) - { - void setSrmmIcon(HANDLE); - void setClistIcon(HANDLE); - if(hContact) - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - { - if(!isContactSecured(hcnt)) - DBWriteContactSettingByte(hcnt, szGPGModuleName, "GPGEncryption", 1); - else - DBWriteContactSettingByte(hcnt, szGPGModuleName, "GPGEncryption", 0); - setSrmmIcon(hContact); - setClistIcon(hContact); - } - } - } - else if(!isContactSecured(hContact)) - DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1); - else - DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0); - } - else if(!isContactSecured(hContact)) - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); - else - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); - } - } - DestroyWindow(hwndDlg); - } - break; - case ID_LOAD_FROM_FILE: - { - tmp = GetFilePath(TranslateT("Set file containing GPG public key"), _T("*"), TranslateT("GPG public key file")); - if(!tmp) - { - break; - } - wfstream f(tmp, std::ios::in | std::ios::ate | std::ios::binary); - delete [] tmp; - if(!f.is_open()) - { - MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); - break; - } - if(f.is_open()) - { - std::wifstream::pos_type size = f.tellg(); - TCHAR *tmp = new TCHAR [(std::ifstream::pos_type)size+(std::ifstream::pos_type)1]; - f.seekg(0, std::ios::beg); - f.read(tmp, size); - tmp[size]= '\0'; - key_buf.append(tmp); - delete [] tmp; - f.close(); - } - if(key_buf.empty()) - { - key_buf.clear(); - if(bDebugLog) - debuglog<<std::string(time_str()+": info: Failed to read key file"); - break; - } - ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----")); - ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")); - if(ws2 == wstring::npos || ws1 == wstring::npos) - { - ws2 = key_buf.find(_T("-----END PGP PRIVATE KEY BLOCK-----")); - ws1 = key_buf.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")); - } - if(ws2 == wstring::npos || ws1 == wstring::npos) - { - MessageBox(0, TranslateT("Where is no public or private key."), TranslateT("Info"), MB_OK); - break; - } - ws2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")); - SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, key_buf.substr(ws1,ws2-ws1).c_str()); - key_buf.clear(); - } - break; - case IDC_IMPORT: - extern HANDLE new_key_hcnt; - extern boost::mutex new_key_hcnt_mutex; - new_key_hcnt_mutex.lock(); - new_key_hcnt = hContact; - void ShowImportKeyDialog(); - ShowImportKeyDialog(); - break; - case IDC_SELECT_EXISTING: - void ShowSelectExistingKeyDialog(); - ShowSelectExistingKeyDialog(); - break; - } - break; - } - - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) - { - - case PSN_APPLY: - { - return TRUE; - } - } - } - break; + + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->code) { + case PSN_APPLY: + return TRUE; + } + break; + case WM_CLOSE: DestroyWindow(hwndDlg); break; + case WM_DESTROY: - { - GetWindowRect(hwndDlg, &load_key_rect); - DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowX", load_key_rect.left); - DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top); - } + GetWindowRect(hwndDlg, &load_key_rect); + DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowX", load_key_rect.left); + DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top); break; - } + } - return FALSE; + return FALSE; } - - void ShowLoadPublicKeyDialog() { DialogBox(hInst, MAKEINTRESOURCE(IDD_LOAD_PUBLIC_KEY), NULL, DlgProcLoadPublicKey); diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 4f702b1931..82f4d1aece 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -1064,13 +1064,12 @@ static LRESULT CALLBACK DatePickerWndProc(HWND hWnd, UINT message, WPARAM wParam return FALSE;
}
- return CallWindowProc((WNDPROC)GetProp(hWnd, TEXT("OldWndProc")), hWnd, message, wParam, lParam);
+ return mir_callNextSubclass(hWnd, DatePickerWndProc, message, wParam, lParam);
}
static void InitDatePicker(HWND Dialog, UINT nIDDate)
{
// subclass date picker to prevent user editing (should only use the dropdown calender to ensure valid dates)
- WNDPROC pOldWndProc;
HWND hCtrl = GetDlgItem(Dialog, nIDDate);
// tweak style of picker
@@ -1081,13 +1080,7 @@ static void InitDatePicker(HWND Dialog, UINT nIDDate) SendDlgItemMessage(Dialog,nIDDate,DTM_SETMCSTYLE,0,dw);
}
-#ifdef _WIN64
- pOldWndProc = (WNDPROC)SetWindowLongPtr(hCtrl, GWLP_WNDPROC, (LONG_PTR)DatePickerWndProc);
-#else
- pOldWndProc = (WNDPROC)SetWindowLong(hCtrl, GWL_WNDPROC, (LONG)DatePickerWndProc);
-#endif
-
- SetProp(hCtrl, TEXT("OldWndProc"), pOldWndProc);
+ mir_subclassWindow(hCtrl, DatePickerWndProc);
}
static BOOL ParseTime(LPCSTR s, int *hout, int *mout, BOOL bTimeOffset, BOOL bAllowOffsetOverride)
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp index d0a2b416d6..e3634f32c5 100644 --- a/plugins/PackUpdater/Src/Options.cpp +++ b/plugins/PackUpdater/Src/Options.cpp @@ -19,8 +19,6 @@ Boston, MA 02111-1307, USA. #include "common.h"
-WNDPROC g_pOldProc;
-
LRESULT CALLBACK MyEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
@@ -29,7 +27,7 @@ LRESULT CALLBACK MyEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara SendMessage(GetParent(GetParent(hwnd)), PSM_CHANGED, 0, 0);
break;
}
- return CallWindowProc (g_pOldProc, hwnd, message, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MyEditProc, message, wParam, lParam);
}
INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -53,7 +51,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETPOS, 0, (LPARAM)Period);
Edit_LimitText(GetDlgItem(hwndDlg, IDC_PERIOD), 2);
- g_pOldProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PERIOD), GWLP_WNDPROC, (LONG)MyEditProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PERIOD), MyEditProc);
ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 0, TranslateT("hours"));
ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 1, TranslateT("days"));
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 415f9d7fcc..bf2e0053c8 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -930,8 +930,6 @@ void UpdateFrame() { SetWindowPos(hpwnd, 0, r_clist.left, r_clist.top - height, (r_clist.right - r_clist.left), height, SWP_NOZORDER | SWP_NOACTIVATE);
}
-WNDPROC wpOrigClistProc;
-
// Subclass procedure
LRESULT APIENTRY ClistSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@@ -948,11 +946,10 @@ LRESULT APIENTRY ClistSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l }
}
- if(uMsg == WM_SHOWWINDOW) {
+ if(uMsg == WM_SHOWWINDOW)
ShowWindow(hpwnd, wParam);
- }
- return CallWindowProc(wpOrigClistProc, hwnd, uMsg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ClistSubclassProc, uMsg, wParam, lParam);
}
void AttachToClist(bool attach)
@@ -965,15 +962,13 @@ void AttachToClist(bool attach) SetWindowPos(hpwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
// subclass clist to trap move/size
- wpOrigClistProc = (WNDPROC) SetWindowLongPtr(hwnd_clist, GWLP_WNDPROC, (LONG_PTR) ClistSubclassProc);
-
+ mir_subclassWindow(hwnd_clist, ClistSubclassProc);
UpdateFrame();
- } else {
+ }
+ else {
SetWindowLong(hpwnd, GWL_STYLE, (WS_POPUPWINDOW | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_VISIBLE | WS_CLIPCHILDREN));
SetWindowLong(hpwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
SetWindowPos(hpwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
-
- SetWindowLongPtr(hwnd_clist, GWLP_WNDPROC, (LONG_PTR) wpOrigClistProc);
}
}
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 952ba48951..32ef2068ab 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -29,7 +29,7 @@ LRESULT CALLBACK MyEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara SendMessage(GetParent(GetParent(hwnd)), PSM_CHANGED, 0, 0);
break;
}
- return CallWindowProc (g_pOldProc, hwnd, message, wParam, lParam);
+ return CallWindowProc(g_pOldProc, hwnd, message, wParam, lParam);
}
INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 3469238530..44fae7fca9 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -25,8 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HWND hwndBox = NULL;
-INT_PTR CALLBACK AvatarTrackBarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK AlphaTrackBarWndProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+LRESULT CALLBACK AlphaTrackBarWndProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
//effekt name for drop down box
LIST<TCHAR> g_lstPopupVfx(5, _tcsicmp);
@@ -121,8 +121,7 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SetDlgItemInt(hwnd, IDC_AVT_RADIUS, PopUpOptions.avatarRadius, FALSE);
SendDlgItemMessage(hwnd, IDC_AVT_RADIUS_SPIN,UDM_SETRANGE, 0, (LPARAM)MAKELONG((PopUpOptions.avatarSize / 2),0));
//Size
- SetWindowLongPtr(GetDlgItem(hwnd, IDC_AVT_SIZE_SLIDE), GWLP_USERDATA, GetWindowLongPtr(GetDlgItem(hwnd, IDC_AVT_SIZE_SLIDE), GWLP_WNDPROC));
- SetWindowLongPtr(GetDlgItem(hwnd, IDC_AVT_SIZE_SLIDE), GWLP_WNDPROC, (LONG_PTR)AvatarTrackBarWndProc);
+ mir_subclassWindow(GetDlgItem(hwnd, IDC_AVT_SIZE_SLIDE), AvatarTrackBarWndProc);
SendDlgItemMessage(hwnd, IDC_AVT_SIZE_SLIDE, TBM_SETRANGE,FALSE,
MAKELONG(SETTING_AVTSIZE_MIN, SETTING_AVTSIZE_MAX));
@@ -577,22 +576,21 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return FALSE;
}
-INT_PTR CALLBACK AvatarTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (!IsWindowEnabled(hwnd))
- return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA), hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, AvatarTrackBarWndProc, msg, wParam, lParam);
static int oldVal = -1;
switch (msg) {
- case WM_MOUSEWHEEL:
- case WM_KEYDOWN:
- case WM_KEYUP:
- {
- if (!IsWindowVisible(hwndBox))
- break;
- }
- case WM_MOUSEMOVE:
- {
+ case WM_MOUSEWHEEL:
+ case WM_KEYDOWN:
+ case WM_KEYUP:
+ if (!IsWindowVisible(hwndBox))
+ break;
+
+ case WM_MOUSEMOVE:
+ {
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
@@ -615,69 +613,31 @@ INT_PTR CALLBACK AvatarTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA InvalidateRect(hwndBox, NULL, FALSE);
oldVal = newVal;
}
- }
- break;
- case WM_MOUSELEAVE:
- {
-/*
- SetWindowLongPtr(hwndBox, GWLP_USERDATA, 2);
- SetWindowPos(hwndBox, NULL,
- 0, 0, 201, 201,
- SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW);
-
- HRGN hrgnWindow, hrgnTmp, hrgnTmp2;
- hrgnWindow = CreateRectRgn(0, 0, 201, 201);
- hrgnTmp = CreateEllipticRgn(-90, -90, 90, 90);
- SubtractRgn(hrgnWindow, hrgnWindow, hrgnTmp);
- hrgnTmp = CreateEllipticRgn(112, -90, 292, 90);
- SubtractRgn(hrgnWindow, hrgnWindow, hrgnTmp);
- hrgnTmp = CreateEllipticRgn(-90, 112, 90, 292);
- SubtractRgn(hrgnWindow, hrgnWindow, hrgnTmp);
- hrgnTmp = CreateEllipticRgn(112, 112, 292, 292);
- SubtractRgn(hrgnWindow, hrgnWindow, hrgnTmp);
-
- hrgnTmp = CreateRectRgn(5, 5, 196, 196);
- hrgnTmp2 = CreateRoundRectRgn(89, 0, 113, 201, 8, 8);
- UnionRgn(hrgnTmp, hrgnTmp, hrgnTmp2);
- hrgnTmp2 = CreateRoundRectRgn(0, 89, 201, 113, 8, 8);
- UnionRgn(hrgnTmp, hrgnTmp, hrgnTmp2);
- IntersectRgn(hrgnWindow, hrgnWindow, hrgnTmp);
-
- SetWindowRgn(hwndBox, hrgnWindow, FALSE);
-
- if (MySetLayeredWindowAttributes)
- {
- SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED);
- MySetLayeredWindowAttributes(hwndBox, NULL, PopUpOptions.Alpha, LWA_ALPHA);
- }
-*/
- SetWindowRgn(hwndBox, NULL, TRUE);
- ShowWindow(hwndBox, SW_HIDE);
- oldVal = -1;
- }
- break;
- default:
- break;
+ }
+ break;
+ case WM_MOUSELEAVE:
+ SetWindowRgn(hwndBox, NULL, TRUE);
+ ShowWindow(hwndBox, SW_HIDE);
+ oldVal = -1;
+ break;
}
- return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA), hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, AvatarTrackBarWndProc, msg, wParam, lParam);
}
-INT_PTR CALLBACK AlphaTrackBarWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK AlphaTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (!IsWindowEnabled(hwnd))
- return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA), hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, AlphaTrackBarWndProc, msg, wParam, lParam);
static int oldVal = -1;
- switch (msg)
- {
- case WM_MOUSEWHEEL:
- case WM_KEYDOWN:
- case WM_KEYUP:
- {
- if (!IsWindowVisible(hwndBox))
- break;
- }
- case WM_MOUSEMOVE:
+ switch (msg) {
+ case WM_MOUSEWHEEL:
+ case WM_KEYDOWN:
+ case WM_KEYUP:
+ if (!IsWindowVisible(hwndBox))
+ break;
+
+ case WM_MOUSEMOVE:
{
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
@@ -706,17 +666,14 @@ INT_PTR CALLBACK AlphaTrackBarWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARA }
break;
}
- case WM_MOUSELEAVE:
- {
-
- SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) & ~WS_EX_LAYERED);
- SetLayeredWindowAttributes(hwndBox, NULL, 255, LWA_ALPHA);
+ case WM_MOUSELEAVE:
+ SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) & ~WS_EX_LAYERED);
+ SetLayeredWindowAttributes(hwndBox, NULL, 255, LWA_ALPHA);
- ShowWindow(hwndBox, SW_HIDE);
- oldVal = -1;
- break;
- }
+ ShowWindow(hwndBox, SW_HIDE);
+ oldVal = -1;
+ break;
}
- return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA), hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, AlphaTrackBarWndProc, msg, wParam, lParam);
}
diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 62996597e2..3110a6283b 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -149,35 +149,29 @@ static void DrawPreview(HWND hwnd, HDC hdc) FrameRect(hdc, &rc, GetStockBrush(LTGRAY_BRUSH));
}
-static WNDPROC WndProcPreviewBoxSave;
LRESULT CALLBACK WndProcPreviewBox(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (!wndPreview)
- return CallWindowProc(WndProcPreviewBoxSave, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, WndProcPreviewBox, msg, wParam, lParam);
- switch (msg)
- {
- case WM_PAINT:
- {
- if (GetUpdateRect(hwnd, 0, FALSE))
- {
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint(hwnd, &ps);
- DrawPreview(hwnd, hdc);
- EndPaint(hwnd, &ps);
- return 0;
- }
- }
-
- case WM_PRINT:
- case WM_PRINTCLIENT:
+ switch (msg) {
+ case WM_PAINT:
+ if (GetUpdateRect(hwnd, 0, FALSE))
{
- HDC hdc = (HDC)wParam;
+ PAINTSTRUCT ps;
+ HDC hdc = BeginPaint(hwnd, &ps);
DrawPreview(hwnd, hdc);
+ EndPaint(hwnd, &ps);
return 0;
}
+
+ case WM_PRINT:
+ case WM_PRINTCLIENT:
+ HDC hdc = (HDC)wParam;
+ DrawPreview(hwnd, hdc);
+ return 0;
}
- return CallWindowProc(WndProcPreviewBoxSave, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, WndProcPreviewBox, msg, wParam, lParam);
}
int SkinOptionList_AddSkin(OPTTREE_OPTION* &options, int *OptionsCount, int pos, DWORD *dwGlobalOptions) {
@@ -332,26 +326,24 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
else if (lstrcmp(skinOptions[index].pszSettingName, _T("Global settings")) == 0) {
switch (skinOptions[index].dwFlag) {
- case (1 << 0):
- PopUpOptions.DisplayTime = skinOptions[index].bState;
- break;
- case (1 << 1):
- PopUpOptions.DropShadow = skinOptions[index].bState;
- break;
- case (1 << 2):
- PopUpOptions.EnableFreeformShadows = skinOptions[index].bState;
- break;
- case (1 << 3):
- PopUpOptions.EnableAeroGlass = skinOptions[index].bState;
- break;
- case (1 << 4):
- PopUpOptions.UseWinColors = skinOptions[index].bState;
- break;
- case (1 << 5):
- PopUpOptions.UseMText = skinOptions[index].bState;
- break;
- default:
- break;
+ case (1 << 0):
+ PopUpOptions.DisplayTime = skinOptions[index].bState;
+ break;
+ case (1 << 1):
+ PopUpOptions.DropShadow = skinOptions[index].bState;
+ break;
+ case (1 << 2):
+ PopUpOptions.EnableFreeformShadows = skinOptions[index].bState;
+ break;
+ case (1 << 3):
+ PopUpOptions.EnableAeroGlass = skinOptions[index].bState;
+ break;
+ case (1 << 4):
+ PopUpOptions.UseWinColors = skinOptions[index].bState;
+ break;
+ case (1 << 5):
+ PopUpOptions.UseMText = skinOptions[index].bState;
+ break;
}
}
updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX));
@@ -360,8 +352,8 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
switch (msg) {
- case WM_INITDIALOG:
- {
+ case WM_INITDIALOG:
+ {
HWND hCtrl = NULL;
DWORD dwIndex = 0;
@@ -385,7 +377,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SkinOptionList_Update (skinOptions, &skinOptionsCount, hwndDlg);
//PreviewBox
- WndProcPreviewBoxSave = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PREVIEWBOX), GWLP_WNDPROC, (LONG_PTR)WndProcPreviewBox);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PREVIEWBOX), WndProcPreviewBox);
updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX));
//hooks
@@ -393,164 +385,149 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TranslateDialogDefault(hwndDlg);
bDlgInit = true;
- }
- return TRUE;
+ }
+ return TRUE;
- case WM_USER:
- {
- updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX));
- }
- return TRUE;
+ case WM_USER:
+ updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX));
+ return TRUE;
- case WM_COMMAND: {
+ case WM_COMMAND:
+ {
HWND hCtrl = NULL;
UINT idCtrl = LOWORD(wParam);
switch (HIWORD(wParam)) {
- case BN_KILLFOCUS: //Button controls
- case BN_SETFOCUS: //Button controls
- return TRUE;
+ case BN_KILLFOCUS: //Button controls
+ case BN_SETFOCUS: //Button controls
+ return TRUE;
+ break;
+ case BN_CLICKED: //Button controls
+ switch(idCtrl) {
+ case IDC_PREVIEW:
+ PopUpPreview();
break;
- case BN_CLICKED: //Button controls
- switch(idCtrl)
+
+ case IDC_BTN_RELOAD:
{
- case IDC_PREVIEW:
- {
- PopUpPreview();
- }
- break;
- case IDC_BTN_RELOAD:
- {
- LPTSTR Temp = NULL;
- DWORD dwIndex = 0;
- TCHAR szNewSkin[128];
- LPTSTR pszOldSkin = mir_tstrdup(PopUpOptions.SkinPack);
- skins.load(_T(""));
- hCtrl = GetDlgItem(hwndDlg, IDC_SKINLIST);
- ListBox_ResetContent(hCtrl);
- for (const Skins::SKINLIST *sl = skins.getSkinList(); sl; sl = sl->next)
- {
- dwIndex = ListBox_AddString(hCtrl, sl->name);
- ListBox_SetItemData(hCtrl, dwIndex, sl->name);
- }
- ListBox_SetCurSel(hCtrl, ListBox_FindString(hCtrl, 0, PopUpOptions.SkinPack));
- //make shure we have select skin (ListBox_SetCurSel may be fail)
- ListBox_GetText(hCtrl, ListBox_GetCurSel(hCtrl), &szNewSkin);
- if (lstrcmp(pszOldSkin, szNewSkin) != 0) {
- mir_free(PopUpOptions.SkinPack);
- PopUpOptions.SkinPack = mir_tstrdup(szNewSkin);
- }
- mir_free(pszOldSkin);
-
- const PopupSkin *skin = 0;
- if (skin = skins.getSkin(PopUpOptions.SkinPack)) {
- //update Skin Option List from reload SkinPack
- bDlgInit = false;
- bDlgInit = SkinOptionList_Update (skinOptions, &skinOptionsCount, hwndDlg);
- }
-
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }//end IDC_BTN_RELOAD:
- break;
- case IDC_GETSKINS:
- CallService(MS_UTILS_OPENURL,0,(LPARAM)"http://miranda-ng.org/");
- break;
- default:
- break;
- }//end switch(idCtrl)
- updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX));
- break;
- case CBN_SELCHANGE: //combo box controls
- switch(idCtrl) {
- case IDC_SKINLIST: {
- //Skin list change
+ LPTSTR Temp = NULL;
+ DWORD dwIndex = 0;
+ TCHAR szNewSkin[128];
+ LPTSTR pszOldSkin = mir_tstrdup(PopUpOptions.SkinPack);
+ skins.load(_T(""));
+ hCtrl = GetDlgItem(hwndDlg, IDC_SKINLIST);
+ ListBox_ResetContent(hCtrl);
+ for (const Skins::SKINLIST *sl = skins.getSkinList(); sl; sl = sl->next)
+ {
+ dwIndex = ListBox_AddString(hCtrl, sl->name);
+ ListBox_SetItemData(hCtrl, dwIndex, sl->name);
+ }
+ ListBox_SetCurSel(hCtrl, ListBox_FindString(hCtrl, 0, PopUpOptions.SkinPack));
+ //make shure we have select skin (ListBox_SetCurSel may be fail)
+ ListBox_GetText(hCtrl, ListBox_GetCurSel(hCtrl), &szNewSkin);
+ if (lstrcmp(pszOldSkin, szNewSkin) != 0) {
mir_free(PopUpOptions.SkinPack);
- PopUpOptions.SkinPack = mir_tstrdup((TCHAR *)SendDlgItemMessage(
- hwndDlg,
- IDC_SKINLIST,
- LB_GETITEMDATA,
- (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SKINLIST, LB_GETCURSEL,0,0),
- 0));
- const PopupSkin *skin = 0;
- if (skin = skins.getSkin(PopUpOptions.SkinPack)) {
- mir_free(PopUpOptions.SkinPack);
- PopUpOptions.SkinPack = mir_tstrdup(skin->getName());
-
- //update Skin Option List
- bDlgInit = false;
- bDlgInit = SkinOptionList_Update (skinOptions, &skinOptionsCount, hwndDlg);
- }
- updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX));
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- default:
- break;
- }//end switch(idCtrl)
- break;
- default:
- break;
- }//end switch (HIWORD(wParam))
- break;
- }// end WM_COMMAND
- return FALSE;
+ PopUpOptions.SkinPack = mir_tstrdup(szNewSkin);
+ }
+ mir_free(pszOldSkin);
- case WM_NOTIFY: {
- if (!bDlgInit) return FALSE;
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0: {
- switch (((LPNMHDR)lParam)->code) {
- case PSN_RESET:
- LoadOption_Skins();
- return TRUE;
- case PSN_APPLY:
- { //skin pack
- DBWriteContactSettingTString(NULL, MODULNAME, "SkinPack", PopUpOptions.SkinPack);
- //skin options
const PopupSkin *skin = 0;
- if (skin = skins.getSkin(PopUpOptions.SkinPack))
- skin->saveOpts();
- skins.freeAllButActive();
- //more Skin options
- DBWriteContactSettingByte(NULL, MODULNAME, "DisplayTime", PopUpOptions.DisplayTime);
- DBWriteContactSettingByte(NULL, MODULNAME, "DropShadow", PopUpOptions.DropShadow);
- DBWriteContactSettingByte(NULL, MODULNAME, "EnableShadowRegion", PopUpOptions.EnableFreeformShadows);
- DBWriteContactSettingByte(NULL, MODULNAME, "EnableAeroGlass", PopUpOptions.EnableAeroGlass);
- DBWriteContactSettingByte(NULL, MODULNAME, "UseMText", PopUpOptions.UseMText);
- }//end PSN_APPLY:
- return TRUE;
+ if (skin = skins.getSkin(PopUpOptions.SkinPack)) {
+ //update Skin Option List from reload SkinPack
+ bDlgInit = false;
+ bDlgInit = SkinOptionList_Update (skinOptions, &skinOptionsCount, hwndDlg);
+ }
+
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }//end IDC_BTN_RELOAD:
+ break;
+ case IDC_GETSKINS:
+ CallService(MS_UTILS_OPENURL,0,(LPARAM)"http://miranda-ng.org/");
+ break;
default:
break;
- }//switch (((LPNMHDR)lParam)->code)
- }// end case 0:
- break;
- default:
+ }//end switch(idCtrl)
+ updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX));
break;
- }//end switch (((LPNMHDR)lParam)->idFrom)
- }//end WM_NOTIFY:
- return FALSE;
+ case CBN_SELCHANGE: //combo box controls
+ switch(idCtrl) {
+ case IDC_SKINLIST:
+ {
+ //Skin list change
+ mir_free(PopUpOptions.SkinPack);
+ PopUpOptions.SkinPack = mir_tstrdup((TCHAR *)SendDlgItemMessage(
+ hwndDlg,
+ IDC_SKINLIST,
+ LB_GETITEMDATA,
+ (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SKINLIST, LB_GETCURSEL,0,0),
+ 0));
+ const PopupSkin *skin = 0;
+ if (skin = skins.getSkin(PopUpOptions.SkinPack)) {
+ mir_free(PopUpOptions.SkinPack);
+ PopUpOptions.SkinPack = mir_tstrdup(skin->getName());
- case WM_DESTROY:
- {
- if (wndPreview) {
- delete wndPreview;
- wndPreview = NULL;
- gPreviewOk = false;
- }
- if (hhkFontsReload) UnhookEvent(hhkFontsReload);
- if (skinOptions) {
- for (int i=0; i < skinOptionsCount; ++i) {
- mir_free(skinOptions[i].pszOptionName);
- mir_free(skinOptions[i].pszSettingName);
+ //update Skin Option List
+ bDlgInit = false;
+ bDlgInit = SkinOptionList_Update (skinOptions, &skinOptionsCount, hwndDlg);
+ }
+ updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX));
}
- mir_free(skinOptions);
- skinOptions = NULL;
- skinOptionsCount = 0;
- }
- }
- return TRUE;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }//end switch(idCtrl)
+ break;
+ }//end switch (HIWORD(wParam))
+ break;
+ }// end WM_COMMAND
+ return FALSE;
+
+ case WM_NOTIFY:
+ if (!bDlgInit) return FALSE;
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_RESET:
+ LoadOption_Skins();
+ return TRUE;
- default:
+ case PSN_APPLY:
+ {
+ //skin pack
+ DBWriteContactSettingTString(NULL, MODULNAME, "SkinPack", PopUpOptions.SkinPack);
+ //skin options
+ const PopupSkin *skin = 0;
+ if (skin = skins.getSkin(PopUpOptions.SkinPack))
+ skin->saveOpts();
+ skins.freeAllButActive();
+ //more Skin options
+ DBWriteContactSettingByte(NULL, MODULNAME, "DisplayTime", PopUpOptions.DisplayTime);
+ DBWriteContactSettingByte(NULL, MODULNAME, "DropShadow", PopUpOptions.DropShadow);
+ DBWriteContactSettingByte(NULL, MODULNAME, "EnableShadowRegion", PopUpOptions.EnableFreeformShadows);
+ DBWriteContactSettingByte(NULL, MODULNAME, "EnableAeroGlass", PopUpOptions.EnableAeroGlass);
+ DBWriteContactSettingByte(NULL, MODULNAME, "UseMText", PopUpOptions.UseMText);
+ }//end PSN_APPLY:
+ return TRUE;
+ }//switch (((LPNMHDR)lParam)->code)
break;
+ }//end switch (((LPNMHDR)lParam)->idFrom)
+ return FALSE;
+
+ case WM_DESTROY:
+ if (wndPreview) {
+ delete wndPreview;
+ wndPreview = NULL;
+ gPreviewOk = false;
+ }
+ if (hhkFontsReload) UnhookEvent(hhkFontsReload);
+ if (skinOptions) {
+ for (int i=0; i < skinOptionsCount; ++i) {
+ mir_free(skinOptions[i].pszOptionName);
+ mir_free(skinOptions[i].pszSettingName);
+ }
+ mir_free(skinOptions);
+ skinOptions = NULL;
+ skinOptionsCount = 0;
+ }
+ return TRUE;
}//end switch (msg)
return FALSE;
}
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 6ee218d4d2..000af4664c 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -601,16 +601,13 @@ int GetItemPos(HANDLE hcontact) }
-WNDPROC wpEditMainProc;
-
// callback function for edit-box of the listbox
// without this the autofill function isn't possible
// this was done like ie does it..as far as spy++ could tell ;)
LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
- switch(msg)
- {
- case WM_CHAR:
+ switch(msg) {
+ case WM_CHAR:
{
if (wparam<32 && wparam != VK_BACK)
break;
@@ -648,7 +645,7 @@ LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) return 1;
}
- case WM_KEYUP:
+ case WM_KEYUP:
{
TCHAR sztext[120] = _T("");
@@ -656,13 +653,13 @@ LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) {
switch(SendMessage(GetParent(hdlg),CB_GETDROPPEDSTATE,0,0))
{
- case FALSE:
- SendMessage(GetParent(GetParent(hdlg)),WM_COMMAND,MAKEWPARAM(IDC_ENTER,STN_CLICKED),0);
- break;
+ case FALSE:
+ SendMessage(GetParent(GetParent(hdlg)),WM_COMMAND,MAKEWPARAM(IDC_ENTER,STN_CLICKED),0);
+ break;
- case TRUE:
- SendMessage(GetParent(hdlg),CB_SHOWDROPDOWN,(WPARAM)FALSE,0);
- break;
+ case TRUE:
+ SendMessage(GetParent(hdlg),CB_SHOWDROPDOWN,(WPARAM)FALSE,0);
+ break;
}
}
else if (wparam == VK_DELETE)
@@ -673,15 +670,14 @@ LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) return 0;
}
- case WM_GETDLGCODE:
- return DLGC_WANTCHARS|DLGC_WANTARROWS;
+ case WM_GETDLGCODE:
+ return DLGC_WANTCHARS|DLGC_WANTARROWS;
}
- return CallWindowProc(wpEditMainProc,hdlg,msg,wparam,lparam);
+ return mir_callNextSubclass(hdlg, EditProc, msg, wparam, lparam);
}
-
HACCEL hAcct;
HHOOK hHook;
@@ -694,9 +690,7 @@ LRESULT CALLBACK HookProc(int code, WPARAM wparam, LPARAM lparam) MSG *msg = (MSG*)lparam;
-
- if (hasNewHotkeyModule)
- {
+ if (hasNewHotkeyModule) {
int action = CallService(MS_HOTKEY_CHECK, (WPARAM) msg, (LPARAM) "Quick Contacts");
if (action != 0)
{
@@ -704,8 +698,7 @@ LRESULT CALLBACK HookProc(int code, WPARAM wparam, LPARAM lparam) return 1;
}
}
- else
- {
+ else {
HWND htemp = msg->hwnd;
msg->hwnd = hwndMain;
@@ -715,17 +708,15 @@ LRESULT CALLBACK HookProc(int code, WPARAM wparam, LPARAM lparam) msg->hwnd=htemp;
}
- if (msg->message == WM_KEYDOWN && msg->wParam == VK_ESCAPE)
- {
- switch(SendMessage(GetDlgItem(hwndMain, IDC_USERNAME), CB_GETDROPPEDSTATE, 0, 0))
- {
- case FALSE:
- SendMessage(hwndMain, WM_CLOSE, 0, 0);
- break;
+ if (msg->message == WM_KEYDOWN && msg->wParam == VK_ESCAPE) {
+ switch(SendMessage(GetDlgItem(hwndMain, IDC_USERNAME), CB_GETDROPPEDSTATE, 0, 0)) {
+ case FALSE:
+ SendMessage(hwndMain, WM_CLOSE, 0, 0);
+ break;
- case TRUE:
- SendMessage(GetDlgItem(hwndMain, IDC_USERNAME), CB_SHOWDROPDOWN, (WPARAM)FALSE, 0);
- break;
+ case TRUE:
+ SendMessage(GetDlgItem(hwndMain, IDC_USERNAME), CB_SHOWDROPDOWN, (WPARAM)FALSE, 0);
+ break;
}
}
@@ -818,7 +809,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA // Combo
SendMessage(GetDlgItem(hwndDlg, IDC_USERNAME), EM_LIMITTEXT, (WPARAM)119,0);
- wpEditMainProc = (WNDPROC) SetWindowLongPtr(GetWindow(GetDlgItem(hwndDlg, IDC_USERNAME),GW_CHILD), GWLP_WNDPROC, (LONG)EditProc);
+ mir_subclassWindow(GetWindow(GetDlgItem(hwndDlg, IDC_USERNAME),GW_CHILD), EditProc);
// Buttons
FillCheckbox(hwndDlg, IDC_SHOW_ALL_CONTACTS, LPGENT("Show all contacts"), hasNewHotkeyModule ? NULL : LPGENT("Ctrl+A"));
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp index b5add8e26f..7b53dfc933 100644 --- a/plugins/QuickMessages/src/options.cpp +++ b/plugins/QuickMessages/src/options.cpp @@ -26,14 +26,14 @@ HTREEITEM hDragItem = NULL; HWND hButtonsList = NULL;
HWND hMenuTree = NULL;
HWND hwndEdit = NULL;
-WNDPROC oldEditProc = 0, oldBNameProc = 0, oldMNameProc = 0;
HWND g_opHdlg = NULL, g_varhelpDlg = NULL;
INT_PTR CALLBACK HelpDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
- {
+{
switch(msg){
- case WM_INITDIALOG:{
+ case WM_INITDIALOG:
+ {
LOGFONT logFont;
HFONT hFont;
RECT rc;
@@ -52,154 +52,156 @@ INT_PTR CALLBACK HelpDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) SendMessage(GetDlgItem(hdlg, IDC_VARCNAME), WM_SETFONT, (WPARAM)hFont, 0);
SendMessage(GetDlgItem(hdlg, IDC_VARCFNAME), WM_SETFONT, (WPARAM)hFont, 0);
SendMessage(GetDlgItem(hdlg, IDC_VARCLNAME), WM_SETFONT, (WPARAM)hFont, 0);
-
+
GetWindowRect(g_opHdlg,&rc);
SetWindowPos(hdlg,0,rc.left,rc.top,0,0,SWP_SHOWWINDOW|SWP_NOSIZE);
- }break;
+ }
+ break;
- case WM_LBUTTONDOWN:{
- PostMessage( hdlg,WM_NCLBUTTONDOWN, HTCAPTION,lparam);
- }break;
+ case WM_LBUTTONDOWN:
+ PostMessage( hdlg,WM_NCLBUTTONDOWN, HTCAPTION,lparam);
+ break;
- case WM_CLOSE:
- case WM_DESTROY:
- DestroyWindow(g_varhelpDlg);
- g_varhelpDlg=NULL;
- break;
- default:
- return FALSE;
- }
- return TRUE;
+ case WM_CLOSE:
+ case WM_DESTROY:
+ DestroyWindow(g_varhelpDlg);
+ g_varhelpDlg=NULL;
+ break;
+
+ default:
+ return FALSE;
}
+ return TRUE;
+}
static LRESULT CALLBACK LabelEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
- {
+{
switch (msg) {
- case WM_GETDLGCODE:
- return DLGC_WANTALLKEYS;
- }
- return CallWindowProc(oldEditProc, hwnd, msg, wParam, lParam);
- }
+ case WM_GETDLGCODE:
+ return DLGC_WANTALLKEYS;
+ }
+ return mir_callNextSubclass(hwnd, LabelEditSubclassProc, msg, wParam, lParam);
+}
static LRESULT CALLBACK EditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
- {
- HWND hParent=GetParent(hwnd);
+{
+ HWND hParent = GetParent(hwnd);
switch (msg) {
- case WM_GETDLGCODE:
- return DLGC_WANTALLKEYS|DLGC_HASSETSEL;
- case WM_SETFOCUS:
- PostMessage(hwnd,EM_SETSEL,0,-1);
- break;
- case WM_KEYDOWN:
- {
+ case WM_GETDLGCODE:
+ return DLGC_WANTALLKEYS|DLGC_HASSETSEL;
+
+ case WM_SETFOCUS:
+ PostMessage(hwnd,EM_SETSEL,0,-1);
+ break;
+
+ case WM_KEYDOWN:
+ {
if(wParam==VK_RETURN)
if(hwnd==GetDlgItem(hParent,IDC_BUTTONNAME))
SendMessage(hParent,WM_COMMAND,IDC_BLISTADD,0);
else
SendMessage(hParent,WM_COMMAND,IDC_MTREEADD,0);
- }break;
- }
- if(hwnd==GetDlgItem(hParent,IDC_BUTTONNAME))
- return CallWindowProc(oldBNameProc, hwnd, msg, wParam, lParam);
- else
- return CallWindowProc(oldMNameProc, hwnd, msg, wParam, lParam);
- }
+ }break;
+ }
+
+ return mir_callNextSubclass(hwnd, EditSubclassProc, msg, wParam, lParam);
+}
void SetMenuEntryProperties(HWND hdlg)
- {
+{
TVITEM tvi;
HTREEITEM hItem=NULL;
ButtonData* bd=NULL;
int pos=0;
if(TreeView_GetCount(hButtonsList)&&(tvi.hItem=TreeView_GetSelection(hButtonsList)))
- {
+ {
tvi.mask=TVIF_HANDLE|TVIF_PARAM;
TreeView_GetItem(hButtonsList,&tvi);
if (tvi.lParam)
- {
+ {
ListData* ld = ( ListData* )tvi.lParam;
TCHAR szValue[256];
GetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE), szValue, sizeof(szValue));
if(_tcslen(szValue))
- {
+ {
if(ld->ptszOPQValue&&(ld->ptszOPQValue!=ld->ptszQValue))
mir_free(ld->ptszOPQValue);
ld->ptszOPQValue=mir_tstrdup(szValue);
- }
- ld->bIsOpServName=IsDlgButtonChecked(hdlg,IDC_ISSERVNAME2);
}
+ ld->bIsOpServName=IsDlgButtonChecked(hdlg,IDC_ISSERVNAME2);
}
+ }
tvi.hItem=NULL;
if(TreeView_GetCount(hMenuTree)&&(tvi.hItem=TreeView_GetSelection(hMenuTree)))
- {
+ {
tvi.mask=TVIF_HANDLE|TVIF_PARAM;
TreeView_GetItem(hMenuTree,&tvi);
if (tvi.lParam)
- {
+ {
ButtonData* bd = ( ButtonData* )tvi.lParam;
TCHAR szValue[256];
GetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE), szValue, sizeof(szValue));
if(_tcslen(szValue))
- {
+ {
if(_tcslen(bd->pszOpValue)&&(bd->pszOpValue!=bd->pszValue))
mir_free(bd->pszOpValue);
bd->pszOpValue=mir_tstrdup(szValue);
- }
+ }
bd->bOpInQMenu=IsDlgButtonChecked(hdlg,IDC_INQMENU);
bd->bIsOpServName=IsDlgButtonChecked(hdlg,IDC_ISSERVNAME);
- }
-
+ }
+
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = TreeView_GetRoot(hMenuTree);
- }
- while (tvi.hItem) {
- TreeView_GetItem(hMenuTree, &tvi);
- bd= (ButtonData*)tvi.lParam;
+ }
+ while (tvi.hItem) {
+ TreeView_GetItem(hMenuTree, &tvi);
+ bd= (ButtonData*)tvi.lParam;
- bd->dwOPPos=pos++;
+ bd->dwOPPos=pos++;
- if(hItem=TreeView_GetChild(hMenuTree, tvi.hItem)) {
+ if(hItem=TreeView_GetChild(hMenuTree, tvi.hItem)) {
- bd->fEntryOpType&=~QMF_EX_CHILD;
+ bd->fEntryOpType&=~QMF_EX_CHILD;
+ if(bd->pszOpValue){
+ mir_free(bd->pszOpValue);
+ bd->pszOpValue=NULL;
+ }
+ tvi.hItem=hItem;
+ continue;
+ }
+ else
+ {
+ if(bd->fEntryOpType&QMF_EX_SEPARATOR){
if(bd->pszOpValue){
mir_free(bd->pszOpValue);
bd->pszOpValue=NULL;
- }
- tvi.hItem=hItem;
- continue;
- }
- else
- {
- if(bd->fEntryOpType&QMF_EX_SEPARATOR){
- if(bd->pszOpValue){
- mir_free(bd->pszOpValue);
- bd->pszOpValue=NULL;
- }}
- else
- {
- if (!bd->pszOpValue)
- bd->pszOpValue=mir_tstrdup(LPGENT("Enter Value"));
- }
- if(TreeView_GetParent(hMenuTree, tvi.hItem))
- bd->fEntryOpType|=QMF_EX_CHILD;
- else bd->fEntryOpType&=~QMF_EX_CHILD;
-
- if (!(hItem=TreeView_GetNextSibling(hMenuTree, tvi.hItem)))
- tvi.hItem=TreeView_GetNextSibling(hMenuTree, TreeView_GetParent(hMenuTree,tvi.hItem));
- else
- tvi.hItem=hItem;
-
- }
+ }}
+ else
+ {
+ if (!bd->pszOpValue)
+ bd->pszOpValue=mir_tstrdup(LPGENT("Enter Value"));
}
+ if(TreeView_GetParent(hMenuTree, tvi.hItem))
+ bd->fEntryOpType|=QMF_EX_CHILD;
+ else bd->fEntryOpType&=~QMF_EX_CHILD;
+
+ if (!(hItem=TreeView_GetNextSibling(hMenuTree, tvi.hItem)))
+ tvi.hItem=TreeView_GetNextSibling(hMenuTree, TreeView_GetParent(hMenuTree,tvi.hItem));
+ else
+ tvi.hItem=hItem;
+
+ }
}
+}
void SaveMenuTree(HWND hdlg)
- {
+{
int iBl=0,i=0,k=0;
int iBtd=g_iButtonsCount;
BOOL bDeleted=FALSE;
@@ -214,7 +216,7 @@ void SaveMenuTree(HWND hdlg) tvi.cchTextMax = 256;
tvi.mask=TVIF_HANDLE|TVIF_TEXT ;
tvi.hItem=TreeView_GetRoot(hButtonsList);
-
+
TreeView_GetItem(hButtonsList,&tvi);
li_ZeroQuickList(QuickList);
@@ -222,7 +224,7 @@ void SaveMenuTree(HWND hdlg) BalanceButtons(iBtd,g_iButtonsCount);
while(ButtonsList[iBl])
- {
+ {
SortedList * sl=NULL;
ListData* ld=ButtonsList[iBl];
@@ -231,133 +233,133 @@ void SaveMenuTree(HWND hdlg) sl=ld->sl;
if(ld->dwOPFlags&QMF_DELETNEEDED)
- {
+ {
bDeleted=(ld->dwOPFlags&QMF_NEW)?FALSE:TRUE;
if(bDeleted) CleanSettings(ld->dwPos,-1);
DestroyButton(iBl);
continue;
- }
+ }
if(ld->ptszQValue!=ld->ptszOPQValue)
- {
- if(ld->ptszQValue)
- mir_free(ld->ptszQValue);
+ {
+ if(ld->ptszQValue)
+ mir_free(ld->ptszQValue);
ld->ptszQValue=(ld->ptszOPQValue)?ld->ptszOPQValue:NULL;
- }
+ }
if(ld->ptszButtonName)
- mir_free(ld->ptszButtonName);
- if(iBl>0)
- if(hti=TreeView_GetNextSibling(hButtonsList,hti?hti:tvi.hItem))
- {
+ mir_free(ld->ptszButtonName);
+ if(iBl>0)
+ if(hti=TreeView_GetNextSibling(hButtonsList,hti?hti:tvi.hItem))
+ {
tvi.hItem=hti;
TreeView_GetItem(hButtonsList,&tvi);
- }
+ }
+
+ ld->ptszButtonName=mir_tstrdup(tvi.pszText);
- ld->ptszButtonName=mir_tstrdup(tvi.pszText);
-
- if(ld->ptszQValue)
+ if(ld->ptszQValue)
{
- mir_snprintf(szMEntry,255,"ButtonValue_%u",iBl);
- DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,ld->ptszQValue);
+ mir_snprintf(szMEntry,255,"ButtonValue_%u",iBl);
+ DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,ld->ptszQValue);
}
- if (ServiceExists(MS_BB_MODIFYBUTTON)&&((ld->dwOPFlags&QMF_NEW)||(ld->dwOPFlags&QMF_RENAMED)||bDeleted))
+ if (ServiceExists(MS_BB_MODIFYBUTTON)&&((ld->dwOPFlags&QMF_NEW)||(ld->dwOPFlags&QMF_RENAMED)||bDeleted))
{
- BBButton bb={0};
- bb.cbSize=sizeof(BBButton);
- bb.pszModuleName=PLGNAME;
- bb.dwButtonID=iBl;
- bb.ptszTooltip=ld->ptszButtonName;
- CallService(MS_BB_MODIFYBUTTON,0,(LPARAM)&bb);
+ BBButton bb={0};
+ bb.cbSize=sizeof(BBButton);
+ bb.pszModuleName=PLGNAME;
+ bb.dwButtonID=iBl;
+ bb.ptszTooltip=ld->ptszButtonName;
+ CallService(MS_BB_MODIFYBUTTON,0,(LPARAM)&bb);
}
-
-
- mir_snprintf(szMEntry,255,"ButtonName_%u",iBl);
- DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,ld->ptszButtonName);
- ld->dwOPFlags=0;
- ld->dwPos=iBl;
- ld->bIsServName=ld->bIsOpServName;
- mir_snprintf(szMEntry,255,"RCEntryIsServiceName_%u",iBl);
- DBWriteContactSettingByte(NULL, PLGNAME,szMEntry,ld->bIsServName);
-
- bDeleted=FALSE;
- qsort(sl->items,sl->realCount,sizeof(ButtonData *),sstSortButtons);
+ mir_snprintf(szMEntry,255,"ButtonName_%u",iBl);
+ DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,ld->ptszButtonName);
- for ( i=0; i < sl->realCount; i++ ) {
- ButtonData * bd= (ButtonData *)sl->items[i];
+ ld->dwOPFlags=0;
+ ld->dwPos=iBl;
+ ld->bIsServName=ld->bIsOpServName;
+ mir_snprintf(szMEntry,255,"RCEntryIsServiceName_%u",iBl);
+ DBWriteContactSettingByte(NULL, PLGNAME,szMEntry,ld->bIsServName);
- if(bd->dwOPFlags&QMF_DELETNEEDED){
- RemoveMenuEntryNode(sl, i--);
- continue;
+ bDeleted=FALSE;
+
+ qsort(sl->items,sl->realCount,sizeof(ButtonData *),sstSortButtons);
+
+ for ( i=0; i < sl->realCount; i++ ) {
+ ButtonData * bd= (ButtonData *)sl->items[i];
+
+ if(bd->dwOPFlags&QMF_DELETNEEDED){
+ RemoveMenuEntryNode(sl, i--);
+ continue;
}
- bd->bIsServName=bd->bIsOpServName;
- bd->bInQMenu=bd->bOpInQMenu;
- bd->dwPos=bd->dwOPPos;
- bd->fEntryType=bd->fEntryOpType;
- bd->dwOPFlags=0;
+ bd->bIsServName=bd->bIsOpServName;
+ bd->bInQMenu=bd->bOpInQMenu;
+ bd->dwPos=bd->dwOPPos;
+ bd->fEntryType=bd->fEntryOpType;
+ bd->dwOPFlags=0;
- if(bd->pszName!=bd->pszOpName)
+ if(bd->pszName!=bd->pszOpName)
{
- if(bd->pszName)
- mir_free(bd->pszName);
- bd->pszName=bd->pszOpName?bd->pszOpName:NULL;
+ if(bd->pszName)
+ mir_free(bd->pszName);
+ bd->pszName=bd->pszOpName?bd->pszOpName:NULL;
}
- if(bd->pszValue!=bd->pszOpValue)
+ if(bd->pszValue!=bd->pszOpValue)
{
- if(bd->pszValue)
- mir_free(bd->pszValue);
- bd->pszValue=bd->pszOpValue?bd->pszOpValue:NULL;
+ if(bd->pszValue)
+ mir_free(bd->pszValue);
+ bd->pszValue=bd->pszOpValue?bd->pszOpValue:NULL;
}
- if(bd->bInQMenu)
+ if(bd->bInQMenu)
{
- QuickData* qd = (QuickData *)mir_alloc(sizeof(QuickData));
- qd->dwPos=k++;
- qd->fEntryType=bd->fEntryType;
- qd->bIsService=bd->bIsServName;
- qd->ptszValue=bd->pszValue;
- qd->ptszValueName=bd->pszName;
- List_InsertPtr(QuickList,qd);
+ QuickData* qd = (QuickData *)mir_alloc(sizeof(QuickData));
+ qd->dwPos=k++;
+ qd->fEntryType=bd->fEntryType;
+ qd->bIsService=bd->bIsServName;
+ qd->ptszValue=bd->pszValue;
+ qd->ptszValueName=bd->pszName;
+ List_InsertPtr(QuickList,qd);
}
- SaveModuleSettings(iBl,bd);
+ SaveModuleSettings(iBl,bd);
}
- CleanSettings(iBl,sl->realCount);
+ CleanSettings(iBl,sl->realCount);
- iBl++;
- }
-
- DBWriteContactSettingByte(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount);
+ iBl++;
}
+ DBWriteContactSettingByte(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount);
+}
+
void RestoreModuleData(HWND hdlg)
- {
+{
int iBl=0,i=0;
char szMEntry[256]={'\0'};
while(ButtonsList[iBl])
- {
+ {
SortedList * sl=NULL;
ListData* ld=ButtonsList[iBl];
if (!(sl=ld->sl)) break;
if(ld->dwOPFlags&QMF_NEW)
- {
+ {
DestroyButton(iBl);
continue;
- }
+ }
if(ld->ptszQValue!=ld->ptszOPQValue)
- {
+ {
if(ld->ptszOPQValue)
mir_free(ld->ptszOPQValue);
ld->ptszOPQValue=(ld->ptszQValue)?ld->ptszQValue:NULL;
- }
+ }
ld->bIsOpServName=ld->bIsServName;
ld->dwOPFlags=0;
@@ -370,7 +372,7 @@ void RestoreModuleData(HWND hdlg) if(bd->dwOPFlags&QMF_NEW){
RemoveMenuEntryNode(sl, i--);
continue;
- }
+ }
bd->bIsOpServName=bd->bIsServName;
bd->bOpInQMenu=bd->bInQMenu;
bd->dwOPPos=bd->dwPos;
@@ -378,25 +380,25 @@ void RestoreModuleData(HWND hdlg) bd->dwOPFlags=0;
if(bd->pszName!=bd->pszOpName)
- {
+ {
if(bd->pszOpName)
mir_free(bd->pszOpName);
bd->pszOpName=bd->pszName?bd->pszName:NULL;
- }
+ }
if(bd->pszValue!=bd->pszOpValue)
- {
+ {
if(bd->pszOpValue)
mir_free(bd->pszOpValue);
bd->pszOpValue=bd->pszValue?bd->pszValue:NULL;
- }
}
- iBl++;
}
+ iBl++;
}
+}
static int BuildMenuTree(HWND hToolBarTree,SortedList * sl)
- {
+{
TVINSERTSTRUCT tvis;
int i;
HTREEITEM hParent=NULL;
@@ -424,18 +426,18 @@ static int BuildMenuTree(HWND hToolBarTree,SortedList * sl) hParent=TreeView_InsertItem( hToolBarTree, &tvis );
if(tvis.hParent) TreeView_Expand( hMenuTree, tvis.hParent, TVE_EXPAND );
if (!bd->pszOpValue&&bd->fEntryOpType==0)
- {
+ {
tvis.hParent = hParent;
- }
-// else if (!(bd->fEntryOpType&QMF_EX_CHILD))
-// tvis.hParent = NULL;
}
+ // else if (!(bd->fEntryOpType&QMF_EX_CHILD))
+ // tvis.hParent = NULL;
+ }
return 1;
- }
+}
static int BuildButtonsList(HWND hToolBarTree)
- {
+{
TVINSERTSTRUCT tvis;
int i=0;
tvis.hParent = NULL;
@@ -443,23 +445,23 @@ static int BuildButtonsList(HWND hToolBarTree) tvis.item.mask =TVIF_PARAM | TVIF_TEXT;
TreeView_DeleteAllItems( hToolBarTree );
-
+
//for(i=0;i<g_iButtonsCount;i++)
while(ButtonsList[i])
- {
+ {
tvis.item.lParam =(LPARAM) ButtonsList[i];
tvis.item.pszText = ButtonsList[i]->ptszButtonName;
TreeView_InsertItem( hToolBarTree, &tvis );
i++;
- }
- return 1;
}
+ return 1;
+}
///////////////////////////////////
//From UserInfoEx by DeathAxe
//
void MoveItem( HTREEITEM hItem, HTREEITEM hInsertAfter, BOOLEAN bAsChild )
- {
+{
TVINSERTSTRUCT tvis;
//TCHAR strbuf[128];
HTREEITEM hParent, hChild, hNewItem;
@@ -470,22 +472,22 @@ void MoveItem( HTREEITEM hItem, HTREEITEM hInsertAfter, BOOLEAN bAsChild ) return;
switch( ( ULONG_PTR )hInsertAfter ) {
- case TVI_ROOT:
- case TVI_FIRST:
- case TVI_LAST:
- hParent = NULL;
- bAsChild = FALSE;
- break;
- default:
- hParent = TreeView_GetParent( hMenuTree, hInsertAfter );
- break;
- }
+ case TVI_ROOT:
+ case TVI_FIRST:
+ case TVI_LAST:
+ hParent = NULL;
+ bAsChild = FALSE;
+ break;
+ default:
+ hParent = TreeView_GetParent( hMenuTree, hInsertAfter );
+ break;
+ }
// do not move a parent next to its own children!
if ( hItem == hParent )
return;
// prepare the insert structure
- {
+ {
TCHAR strbuf[128];
tvis.item.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
@@ -493,191 +495,191 @@ void MoveItem( HTREEITEM hItem, HTREEITEM hInsertAfter, BOOLEAN bAsChild ) tvis.item.cchTextMax=sizeof(strbuf);
tvis.item.hItem=hItem;
TreeView_GetItem(hMenuTree,&tvis.item);
- }
+ }
- // item should be inserted as the first child of an existing root item
- if ( bAsChild ) {
- tvis.hParent = hInsertAfter;
- tvis.hInsertAfter = ( bAsChild == 2 ) ? TVI_LAST : TVI_FIRST ;
- }
- // item should be inserted after an existing item
- else {
- tvis.hParent = hParent;
- tvis.hInsertAfter = hInsertAfter;
- }
- // insert the item
- if ( !( hNewItem = TreeView_InsertItem( hMenuTree, &tvis )) )
- return;
-
- // move children
- hInsertAfter = hNewItem;
- while( hChild = TreeView_GetChild( hMenuTree, hItem )) {
- MoveItem( hChild, hInsertAfter, 2 );
- }
- // delete old tree
- TreeView_DeleteItem( hMenuTree, hItem );
+ // item should be inserted as the first child of an existing root item
+ if ( bAsChild ) {
+ tvis.hParent = hInsertAfter;
+ tvis.hInsertAfter = ( bAsChild == 2 ) ? TVI_LAST : TVI_FIRST ;
+ }
+ // item should be inserted after an existing item
+ else {
+ tvis.hParent = hParent;
+ tvis.hInsertAfter = hInsertAfter;
+ }
+ // insert the item
+ if ( !( hNewItem = TreeView_InsertItem( hMenuTree, &tvis )) )
+ return;
- TreeView_SelectItem( hMenuTree, hNewItem );
- //TreeView_Expand( hMenuTree, hNewItem, TVE_EXPAND );
+ // move children
+ hInsertAfter = hNewItem;
+ while( hChild = TreeView_GetChild( hMenuTree, hItem )) {
+ MoveItem( hChild, hInsertAfter, 2 );
}
+ // delete old tree
+ TreeView_DeleteItem( hMenuTree, hItem );
+
+ TreeView_SelectItem( hMenuTree, hNewItem );
+ //TreeView_Expand( hMenuTree, hNewItem, TVE_EXPAND );
+}
///////
INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
- {
+{
switch(msg){
- case WM_INITDIALOG:{
- DWORD style;
- g_opHdlg=hdlg;
- bOptionsInit=TRUE;
- TranslateDialogDefault(hdlg);
- if(g_iButtonsCount!=DBGetContactSettingByte(NULL, PLGNAME,"ButtonsCount", 0))
- {
- LOGFONT logFont;
- HFONT hFont;
- bNeedRestart=TRUE;
- EnableWindow(GetDlgItem(hdlg,IDC_BUTTONSLIST),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_BLISTADD),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_BLISTREMOVE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_MENUTREE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_MTREEADD),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_MTREEREMOVE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_BUTTONNAME),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_MENUNAME),FALSE);
- ShowWindow(GetDlgItem(hdlg,IDC_WARNING),SW_SHOW);
-
- hFont = (HFONT)SendMessage(GetDlgItem(hdlg, IDC_WARNING), WM_GETFONT, 0, 0);
- GetObject(hFont, sizeof logFont, &logFont);
- logFont.lfWeight = FW_BOLD;
- hFont = CreateFontIndirect(&logFont);
- SendMessage(GetDlgItem(hdlg, IDC_WARNING), WM_SETFONT, (WPARAM)hFont, 0);
- break;
- }
-
- g_iOPButtonsCount=g_iButtonsCount;
+ case WM_INITDIALOG:{
+ DWORD style;
+ g_opHdlg=hdlg;
+ bOptionsInit=TRUE;
+ TranslateDialogDefault(hdlg);
+ if(g_iButtonsCount!=DBGetContactSettingByte(NULL, PLGNAME,"ButtonsCount", 0))
+ {
+ LOGFONT logFont;
+ HFONT hFont;
+ bNeedRestart=TRUE;
+ EnableWindow(GetDlgItem(hdlg,IDC_BUTTONSLIST),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_BLISTADD),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_BLISTREMOVE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUTREE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_MTREEADD),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_MTREEREMOVE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_BUTTONNAME),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUNAME),FALSE);
+ ShowWindow(GetDlgItem(hdlg,IDC_WARNING),SW_SHOW);
- hButtonsList=GetDlgItem(hdlg,IDC_BUTTONSLIST);
- hMenuTree=GetDlgItem(hdlg,IDC_MENUTREE);
+ hFont = (HFONT)SendMessage(GetDlgItem(hdlg, IDC_WARNING), WM_GETFONT, 0, 0);
+ GetObject(hFont, sizeof logFont, &logFont);
+ logFont.lfWeight = FW_BOLD;
+ hFont = CreateFontIndirect(&logFont);
+ SendMessage(GetDlgItem(hdlg, IDC_WARNING), WM_SETFONT, (WPARAM)hFont, 0);
+ break;
+ }
- style = GetWindowLongPtr(hButtonsList,GWL_STYLE);
- style |=TVS_NOHSCROLL;
- SetWindowLongPtr(hButtonsList,GWL_STYLE, style);
+ g_iOPButtonsCount=g_iButtonsCount;
- style = GetWindowLongPtr(hMenuTree,GWL_STYLE);
- style |=TVS_NOHSCROLL;
- SetWindowLongPtr(hMenuTree,GWL_STYLE, style);
- BuildButtonsList(hButtonsList);
-
- if (!TreeView_GetCount(hButtonsList)) EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
+ hButtonsList=GetDlgItem(hdlg,IDC_BUTTONSLIST);
+ hMenuTree=GetDlgItem(hdlg,IDC_MENUTREE);
- oldBNameProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hdlg,IDC_BUTTONNAME), GWLP_WNDPROC, (LONG) EditSubclassProc);
- oldMNameProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hdlg,IDC_MENUNAME) , GWLP_WNDPROC, (LONG) EditSubclassProc);
+ style = GetWindowLongPtr(hButtonsList,GWL_STYLE);
+ style |=TVS_NOHSCROLL;
+ SetWindowLongPtr(hButtonsList,GWL_STYLE, style);
-
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- CheckDlgButton(hdlg,IDC_RAUTOSEND,(g_bRClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"RClickAuto",0)));
- CheckDlgButton(hdlg,IDC_LAUTOSEND,(g_bLClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"LClickAuto",0)));
- CheckDlgButton(hdlg,IDC_ENABLEQUICKMENU,(g_bQuickMenu=DBGetContactSettingByte(NULL, PLGNAME,"QuickMenu", 1)));
-
- bOptionsInit=FALSE;
- }break;
+ style = GetWindowLongPtr(hMenuTree,GWL_STYLE);
+ style |=TVS_NOHSCROLL;
+ SetWindowLongPtr(hMenuTree,GWL_STYLE, style);
+ BuildButtonsList(hButtonsList);
- case WM_LBUTTONUP:
- if(drag) {
- TVHITTESTINFO hti;
- HTREEITEM htiAfter=NULL;
- ButtonData* bd=NULL;
- TVITEM tvi;
- RECT rc;
- BYTE height;
- BOOLEAN bAsChild = FALSE;
+ if (!TreeView_GetCount(hButtonsList))
+ EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
- TreeView_SetInsertMark(hMenuTree, NULL, 0 );
- ReleaseCapture();
- SetCursor( LoadCursor( NULL, IDC_ARROW ));
+ mir_subclassWindow( GetDlgItem(hdlg,IDC_BUTTONNAME), EditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hdlg,IDC_MENUNAME), EditSubclassProc);
- hti.pt.x = ( SHORT )LOWORD( lparam );
- hti.pt.y = ( SHORT )HIWORD( lparam );
- ClientToScreen(hdlg,&hti.pt);
- ScreenToClient(hMenuTree,&hti.pt);
- TreeView_HitTest( hMenuTree, &hti );
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ CheckDlgButton(hdlg,IDC_RAUTOSEND,(g_bRClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"RClickAuto",0)));
+ CheckDlgButton(hdlg,IDC_LAUTOSEND,(g_bLClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"LClickAuto",0)));
+ CheckDlgButton(hdlg,IDC_ENABLEQUICKMENU,(g_bQuickMenu=DBGetContactSettingByte(NULL, PLGNAME,"QuickMenu", 1)));
- if(TreeView_GetParent(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))
- break;
+ bOptionsInit=FALSE;
+ }break;
- if(TreeView_GetChild(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))
- break;
+ case WM_LBUTTONUP:
+ if(drag) {
+ TVHITTESTINFO hti;
+ HTREEITEM htiAfter=NULL;
+ ButtonData* bd=NULL;
+ TVITEM tvi;
+ RECT rc;
+ BYTE height;
+ BOOLEAN bAsChild = FALSE;
+
+ TreeView_SetInsertMark(hMenuTree, NULL, 0 );
+ ReleaseCapture();
+ SetCursor( LoadCursor( NULL, IDC_ARROW ));
+
+ hti.pt.x = ( SHORT )LOWORD( lparam );
+ hti.pt.y = ( SHORT )HIWORD( lparam );
+ ClientToScreen(hdlg,&hti.pt);
+ ScreenToClient(hMenuTree,&hti.pt);
+ TreeView_HitTest( hMenuTree, &hti );
+ if(TreeView_GetParent(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))
+ break;
+
+ if(TreeView_GetChild(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))
+ break;
- if ( hti.flags & TVHT_ABOVE ) {
- htiAfter = TVI_FIRST;
+
+ if ( hti.flags & TVHT_ABOVE ) {
+ htiAfter = TVI_FIRST;
+ }
+ else
+ if ( hti.flags & ( TVHT_NOWHERE|TVHT_BELOW )) {
+ htiAfter = TVI_LAST;
+ }
+ else
+ if ( hti.flags & ( TVHT_ONITEM|TVHT_ONITEMRIGHT )) {
+ // check where over the item, the pointer is
+ if ( !TreeView_GetItemRect( hMenuTree, hti.hItem, &rc, FALSE )) {
+ drag=0;
+ break;
}
- else
- if ( hti.flags & ( TVHT_NOWHERE|TVHT_BELOW )) {
- htiAfter = TVI_LAST;
+ height = ( BYTE )( rc.bottom - rc.top );
+
+ if ( hti.pt.y - ( height / 3 ) < rc.top ) {
+ HTREEITEM hItem = hti.hItem;
+
+ if ( !( hti.hItem = TreeView_GetPrevSibling( hMenuTree, hItem )) ) {
+ if ( !( hti.hItem = TreeView_GetParent(hMenuTree, hItem )))
+ htiAfter = TVI_FIRST;
+ else
+ bAsChild = TRUE;
}
- else
- if ( hti.flags & ( TVHT_ONITEM|TVHT_ONITEMRIGHT )) {
- // check where over the item, the pointer is
- if ( !TreeView_GetItemRect( hMenuTree, hti.hItem, &rc, FALSE )) {
- drag=0;
- break;
- }
- height = ( BYTE )( rc.bottom - rc.top );
-
- if ( hti.pt.y - ( height / 3 ) < rc.top ) {
- HTREEITEM hItem = hti.hItem;
-
- if ( !( hti.hItem = TreeView_GetPrevSibling( hMenuTree, hItem )) ) {
- if ( !( hti.hItem = TreeView_GetParent(hMenuTree, hItem )))
- htiAfter = TVI_FIRST;
- else
- bAsChild = TRUE;
- }
- }
- else
- if ( hti.pt.y + ( height / 3 ) <= rc.bottom ) {
- bAsChild = TRUE;
- }
- }
-
-
- if(TreeView_GetChild(hMenuTree,hDragItem)&&bAsChild)
- break;
+ }
+ else
+ if ( hti.pt.y + ( height / 3 ) <= rc.bottom ) {
+ bAsChild = TRUE;
+ }
+ }
- if(hti.hItem){
- tvi.hItem=hti.hItem;
- tvi.mask=TVIF_PARAM |TVIF_HANDLE;
- TreeView_GetItem(hMenuTree,&tvi);
- if ((bd=(ButtonData*)tvi.lParam)&&(bd->fEntryOpType&QMF_EX_SEPARATOR))
- bAsChild = FALSE;
- }
+ if(TreeView_GetChild(hMenuTree,hDragItem)&&bAsChild)
+ break;
- if(TreeView_GetParent(hMenuTree,hti.hItem))
- bAsChild = FALSE;
+ if(hti.hItem){
+ tvi.hItem=hti.hItem;
+ tvi.mask=TVIF_PARAM |TVIF_HANDLE;
+ TreeView_GetItem(hMenuTree,&tvi);
+ if ((bd=(ButtonData*)tvi.lParam)&&(bd->fEntryOpType&QMF_EX_SEPARATOR))
+ bAsChild = FALSE;
+ }
- MoveItem( hDragItem, htiAfter?htiAfter:hti.hItem, bAsChild );
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- drag=0;
+ if(TreeView_GetParent(hMenuTree,hti.hItem))
+ bAsChild = FALSE;
- }
- break;
+
+ MoveItem( hDragItem, htiAfter?htiAfter:hti.hItem, bAsChild );
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ drag=0;
+
+ }
+ break;
///////////////////////////////////
//From UserInfoEx by DeathAxe
//
- case WM_MOUSEMOVE:
- {
+ case WM_MOUSEMOVE:
+ {
if (!drag) break;
- {
+ {
TVHITTESTINFO hti;
hti.pt.x=(short)LOWORD(lparam);
@@ -695,460 +697,448 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) if ( hti.pt.y - ( height / 3 ) < rc.top ) {
SetCursor( LoadCursor( NULL, IDC_ARROW ));
TreeView_SetInsertMark( hMenuTree, hti.hItem, 0 );
- }
+ }
else
if ( hti.pt.y + ( height / 3 ) > rc.bottom ) {
SetCursor( LoadCursor( NULL, IDC_ARROW ));
TreeView_SetInsertMark( hMenuTree, hti.hItem, 1 );
- }
+ }
else {
TreeView_SetInsertMark( hMenuTree, NULL, 0 );
SetCursor( LoadCursor( GetModuleHandle(NULL), MAKEINTRESOURCE( 183 )) );
- }
- }
+ }
}
+ }
else {
if ( hti.flags & TVHT_ABOVE ) SendMessage( hMenuTree, WM_VSCROLL, MAKEWPARAM( SB_LINEUP, 0 ), 0 );
if ( hti.flags & TVHT_BELOW ) SendMessage( hMenuTree, WM_VSCROLL, MAKEWPARAM( SB_LINEDOWN, 0 ), 0 );
TreeView_SetInsertMark( hMenuTree, NULL, 0 );
- }
}
- }break;
- /////////////
- case WM_DESTROY:
- if (g_varhelpDlg)
- DestroyWindow(g_varhelpDlg);
- g_varhelpDlg=NULL;
- break;
+ }
+ }break;
+ /////////////
+ case WM_DESTROY:
+ if (g_varhelpDlg)
+ DestroyWindow(g_varhelpDlg);
+ g_varhelpDlg=NULL;
+ break;
- case WM_NOTIFY:{
- switch(((LPNMHDR)lparam)->idFrom) {
- case 0:{
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lparam)->idFrom) {
+ case 0:
if (((LPNMHDR)lparam)->code == PSN_APPLY ) {
if (!bNeedRestart){
- SetMenuEntryProperties(hdlg);
- SaveMenuTree(hdlg);
+ SetMenuEntryProperties(hdlg);
+ SaveMenuTree(hdlg);
}
DBWriteContactSettingByte(NULL,PLGNAME,"RClickAuto",(BYTE)(g_bRClickAuto=IsDlgButtonChecked(hdlg,IDC_RAUTOSEND)));
DBWriteContactSettingByte(NULL,PLGNAME,"LClickAuto",(BYTE)(g_bLClickAuto=IsDlgButtonChecked(hdlg,IDC_LAUTOSEND)));
DBWriteContactSettingByte(NULL,PLGNAME,"QuickMenu",(BYTE)(g_bQuickMenu=IsDlgButtonChecked(hdlg,IDC_ENABLEQUICKMENU)));
return 1;
- }
+ }
else if (((LPNMHDR)lparam)->code == PSN_RESET ) {
- if (!bNeedRestart)
- RestoreModuleData(hdlg);
+ if (!bNeedRestart)
+ RestoreModuleData(hdlg);
return 1;
- }
}
break;
case IDC_MENUTREE:
switch (((LPNMHDR)lparam)->code){
-
- case TVN_KEYDOWN:{
- TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*) ((LPNMHDR)lparam);
- if ( pTVKeyDown->wVKey == VK_F2 )
- TreeView_EditLabel(hMenuTree,TreeView_GetSelection(hMenuTree));
- else if ( pTVKeyDown->wVKey == VK_DELETE )
+ case TVN_KEYDOWN:{
+ TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*) ((LPNMHDR)lparam);
+ if ( pTVKeyDown->wVKey == VK_F2 )
+ TreeView_EditLabel(hMenuTree,TreeView_GetSelection(hMenuTree));
+ else if ( pTVKeyDown->wVKey == VK_DELETE )
SendMessage(hdlg,WM_COMMAND,IDC_MTREEREMOVE,0);
- }break;
+ }break;
- case TVN_BEGINLABELEDITA:
- case TVN_BEGINLABELEDITW:
- hwndEdit=TreeView_GetEditControl(hMenuTree);
- oldEditProc = (WNDPROC) SetWindowLongPtr(hwndEdit, GWLP_WNDPROC, (LONG) LabelEditSubclassProc);
- break;
+ case TVN_BEGINLABELEDITA:
+ case TVN_BEGINLABELEDITW:
+ hwndEdit=TreeView_GetEditControl(hMenuTree);
+ mir_subclassWindow(hwndEdit, LabelEditSubclassProc);
+ break;
- case TVN_ENDLABELEDITA:
- case TVN_ENDLABELEDITW:
- {
- TVITEM tvi;
- ButtonData* bd=NULL;
- TCHAR strbuf[256];
- TCHAR szLabel[256];
-
- SetWindowLongPtr(hwndEdit, GWLP_WNDPROC, (LONG) oldEditProc);
-
- tvi.pszText = strbuf;
- tvi.cchTextMax = sizeof(strbuf);
- tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
- tvi.hItem=TreeView_GetSelection(hMenuTree);
- TreeView_GetItem(hMenuTree,&tvi);
-
- GetWindowText(hwndEdit, szLabel, sizeof(szLabel));
- hwndEdit=NULL;
- if (!_tcslen(szLabel)) break;
- if (bd = (ButtonData*)tvi.lParam){
- if (!_tcscmp(szLabel,_T("---"))) {
- if(TreeView_GetChild(hMenuTree,tvi.hItem))
- break;
- else{
- bd->fEntryOpType=QMF_EX_SEPARATOR;
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ case TVN_ENDLABELEDITA:
+ case TVN_ENDLABELEDITW:
+ {
+ TVITEM tvi;
+ ButtonData* bd=NULL;
+ TCHAR strbuf[256];
+ TCHAR szLabel[256];
+
+ tvi.pszText = strbuf;
+ tvi.cchTextMax = sizeof(strbuf);
+ tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
+ tvi.hItem=TreeView_GetSelection(hMenuTree);
+ TreeView_GetItem(hMenuTree,&tvi);
+
+ GetWindowText(hwndEdit, szLabel, sizeof(szLabel));
+ hwndEdit=NULL;
+ if (!_tcslen(szLabel)) break;
+ if (bd = (ButtonData*)tvi.lParam){
+ if (!_tcscmp(szLabel,_T("---"))) {
+ if(TreeView_GetChild(hMenuTree,tvi.hItem))
+ break;
+ else{
+ bd->fEntryOpType=QMF_EX_SEPARATOR;
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ }
+ }
+ else {
+ bd->fEntryOpType&=~QMF_EX_SEPARATOR;
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),TRUE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),bd->pszOpValue/*?bd->pszOpValue:bd->pszValue*/);
}
- }
- else {
- bd->fEntryOpType&=~QMF_EX_SEPARATOR;
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),TRUE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),bd->pszOpValue/*?bd->pszOpValue:bd->pszValue*/);
- }
- bd->pszOpName=mir_tstrdup(szLabel);
-
- tvi.pszText=szLabel;
- TreeView_SetItem(hMenuTree, &tvi);
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- }
- }break;
+ bd->pszOpName=mir_tstrdup(szLabel);
- case NM_KILLFOCUS:
- TreeView_EndEditLabelNow(hButtonsList, 1);
- break;
+ tvi.pszText=szLabel;
+ TreeView_SetItem(hMenuTree, &tvi);
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ }
+ }break;
- case TVN_BEGINDRAGA:
- case TVN_BEGINDRAGW:
- SetCapture(hdlg);
- drag=1;
- hDragItem=((LPNMTREEVIEW)lparam)->itemNew.hItem;
- TreeView_SelectItem(hMenuTree,hDragItem);
- break;
+ case NM_KILLFOCUS:
+ TreeView_EndEditLabelNow(hButtonsList, 1);
+ break;
- case TVN_SELCHANGINGA:
- case TVN_SELCHANGINGW:
- {
- TVITEM tvi;
- HTREEITEM hti;
- ButtonData* bd;
+ case TVN_BEGINDRAGA:
+ case TVN_BEGINDRAGW:
+ SetCapture(hdlg);
+ drag=1;
+ hDragItem=((LPNMTREEVIEW)lparam)->itemNew.hItem;
+ TreeView_SelectItem(hMenuTree,hDragItem);
+ break;
+
+ case TVN_SELCHANGINGA:
+ case TVN_SELCHANGINGW:
+ {
+ TVITEM tvi;
+ HTREEITEM hti;
+ ButtonData* bd;
- hti=TreeView_GetSelection(hMenuTree);
+ hti=TreeView_GetSelection(hMenuTree);
- if (hti==NULL)
- break;
+ if (hti==NULL)
+ break;
- tvi.hItem=hti;
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- TreeView_GetItem(hMenuTree,&tvi);
+ tvi.hItem=hti;
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
+ TreeView_GetItem(hMenuTree,&tvi);
- if (tvi.lParam == 0)
- break;
+ if (tvi.lParam == 0)
+ break;
- bd = ( ButtonData* )tvi.lParam;
- if (bd) {
- TCHAR szValue[256];
- GetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE), szValue, sizeof(szValue));
- if(_tcslen(szValue))
- {
- if(bd->pszOpValue&&(bd->pszOpValue!=bd->pszValue))
- mir_free(bd->pszOpValue);
- bd->pszOpValue=mir_tstrdup(szValue);
+ bd = ( ButtonData* )tvi.lParam;
+ if (bd) {
+ TCHAR szValue[256];
+ GetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE), szValue, sizeof(szValue));
+ if(_tcslen(szValue))
+ {
+ if(bd->pszOpValue&&(bd->pszOpValue!=bd->pszValue))
+ mir_free(bd->pszOpValue);
+ bd->pszOpValue=mir_tstrdup(szValue);
+ }
+ bd->bOpInQMenu=IsDlgButtonChecked(hdlg,IDC_INQMENU);
+ bd->bIsOpServName=IsDlgButtonChecked(hdlg,IDC_ISSERVNAME);
}
- bd->bOpInQMenu=IsDlgButtonChecked(hdlg,IDC_INQMENU);
- bd->bIsOpServName=IsDlgButtonChecked(hdlg,IDC_ISSERVNAME);
- }
- }break;
- case TVN_SELCHANGEDA:
- case TVN_SELCHANGEDW:
- {
- TVITEM tvi;
- HTREEITEM hti;
- ButtonData* bd=NULL;
+ }break;
+ case TVN_SELCHANGEDA:
+ case TVN_SELCHANGEDW:
+ {
+ TVITEM tvi;
+ HTREEITEM hti;
+ ButtonData* bd=NULL;
- hti=TreeView_GetSelection(hMenuTree);
+ hti=TreeView_GetSelection(hMenuTree);
- if (hti==NULL)
- break;
+ if (hti==NULL)
+ break;
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- tvi.hItem=hti;
- TreeView_GetItem(hMenuTree,&tvi);
+ tvi.hItem=hti;
+ TreeView_GetItem(hMenuTree,&tvi);
- bd = ( ButtonData* )tvi.lParam;
- if (bd) {
- if (!TreeView_GetChild(hMenuTree, tvi.hItem)&&!(bd->fEntryOpType&QMF_EX_SEPARATOR))
- {
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),TRUE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),bd->pszOpValue/*?bd->pszOpValue:bd->pszValue*/);
- }
- else
- {
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- if (!(bd->fEntryOpType&QMF_EX_SEPARATOR))
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ bd = ( ButtonData* )tvi.lParam;
+ if (bd) {
+ if (!TreeView_GetChild(hMenuTree, tvi.hItem)&&!(bd->fEntryOpType&QMF_EX_SEPARATOR))
+ {
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),TRUE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),bd->pszOpValue/*?bd->pszOpValue:bd->pszValue*/);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ if (!(bd->fEntryOpType&QMF_EX_SEPARATOR))
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ }
+ CheckDlgButton(hdlg,IDC_INQMENU,bd->bOpInQMenu);
+ CheckDlgButton(hdlg,IDC_ISSERVNAME,bd->bIsOpServName);
}
- CheckDlgButton(hdlg,IDC_INQMENU,bd->bOpInQMenu);
- CheckDlgButton(hdlg,IDC_ISSERVNAME,bd->bIsOpServName);
}
- }
- }break;
+ }break;
case IDC_BUTTONSLIST:
switch (((LPNMHDR)lparam)->code) {
+ case TVN_KEYDOWN:{
+ TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*) ((LPNMHDR)lparam);
+ if ( pTVKeyDown->wVKey == VK_F2 )
+ TreeView_EditLabel(hButtonsList,TreeView_GetSelection(hButtonsList));
+ else if ( pTVKeyDown->wVKey == VK_DELETE )
+ SendMessage(hdlg,WM_COMMAND,IDC_BLISTREMOVE,0);
+ }break;
+
+ case TVN_BEGINLABELEDITA:
+ case TVN_BEGINLABELEDITW:
+ hwndEdit = TreeView_GetEditControl(hButtonsList);
+ mir_subclassWindow(hwndEdit, LabelEditSubclassProc);
+ break;
- case TVN_KEYDOWN:{
- TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*) ((LPNMHDR)lparam);
- if ( pTVKeyDown->wVKey == VK_F2 )
- TreeView_EditLabel(hButtonsList,TreeView_GetSelection(hButtonsList));
- else if ( pTVKeyDown->wVKey == VK_DELETE )
- SendMessage(hdlg,WM_COMMAND,IDC_BLISTREMOVE,0);
- }break;
-
- case TVN_BEGINLABELEDITA:
- case TVN_BEGINLABELEDITW:
- hwndEdit=TreeView_GetEditControl(hButtonsList);
- oldEditProc = (WNDPROC) SetWindowLongPtr(hwndEdit, GWLP_WNDPROC, (LONG) LabelEditSubclassProc);
- break;
-
- case TVN_ENDLABELEDITA:
- case TVN_ENDLABELEDITW:{
- TVITEM tvi;
- TCHAR strbuf[128];
- TCHAR szLabel[128];
-
- SetWindowLongPtr(hwndEdit, GWLP_WNDPROC, (LONG) oldEditProc);
+ case TVN_ENDLABELEDITA:
+ case TVN_ENDLABELEDITW:
+ {
+ TVITEM tvi;
+ TCHAR strbuf[128];
+ TCHAR szLabel[128];
- tvi.pszText = strbuf;
- tvi.cchTextMax = sizeof(strbuf);
- tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
- tvi.hItem=TreeView_GetSelection(hButtonsList);
- TreeView_GetItem(hButtonsList,&tvi);
+ tvi.pszText = strbuf;
+ tvi.cchTextMax = sizeof(strbuf);
+ tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
+ tvi.hItem=TreeView_GetSelection(hButtonsList);
+ TreeView_GetItem(hButtonsList,&tvi);
- GetWindowText(hwndEdit, szLabel, sizeof(szLabel));
- hwndEdit=NULL;
- if (!_tcslen(szLabel)) break;
+ GetWindowText(hwndEdit, szLabel, sizeof(szLabel));
+ hwndEdit=NULL;
+ if (!_tcslen(szLabel)) break;
- tvi.pszText=szLabel;
- ((ListData*)tvi.lParam)->dwOPFlags|=QMF_RENAMED;
+ tvi.pszText=szLabel;
+ ((ListData*)tvi.lParam)->dwOPFlags|=QMF_RENAMED;
- TreeView_SetItem(hButtonsList, &tvi);
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- }break;
+ TreeView_SetItem(hButtonsList, &tvi);
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ }break;
- case TVN_SELCHANGINGA:
- case TVN_SELCHANGINGW:
- SetMenuEntryProperties(hdlg);
- break;
+ case TVN_SELCHANGINGA:
+ case TVN_SELCHANGINGW:
+ SetMenuEntryProperties(hdlg);
+ break;
- case TVN_SELCHANGEDA:
- case TVN_SELCHANGEDW:{
- TVITEM tvi;
- HTREEITEM hti;
+ case TVN_SELCHANGEDA:
+ case TVN_SELCHANGEDW:
+ {
+ TVITEM tvi;
+ HTREEITEM hti;
- hti=TreeView_GetSelection(hButtonsList);
+ hti=TreeView_GetSelection(hButtonsList);
- if(hti==NULL||!TreeView_GetCount(hButtonsList)) {
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),FALSE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
- break;
- }
-
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- tvi.hItem=hti;
- TreeView_GetItem(hButtonsList,&tvi);
+ if(hti==NULL||!TreeView_GetCount(hButtonsList)) {
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),FALSE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ break;
+ }
- if(tvi.lParam==0) break;
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
+ tvi.hItem=hti;
+ TreeView_GetItem(hButtonsList,&tvi);
- BuildMenuTree(hMenuTree,(SortedList *)((ListData*)tvi.lParam)->sl);
+ if(tvi.lParam==0) break;
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
- EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),TRUE);
- CheckDlgButton(hdlg,IDC_ISSERVNAME2,((ListData*)tvi.lParam)->bIsOpServName);
+ BuildMenuTree(hMenuTree,(SortedList *)((ListData*)tvi.lParam)->sl);
- if (((ListData*)tvi.lParam)->ptszOPQValue)
- SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),((ListData*)tvi.lParam)->ptszOPQValue);
- else
- SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),_T(""));
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),TRUE);
+ CheckDlgButton(hdlg,IDC_ISSERVNAME2,((ListData*)tvi.lParam)->bIsOpServName);
- }break;
+ if (((ListData*)tvi.lParam)->ptszOPQValue)
+ SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),((ListData*)tvi.lParam)->ptszOPQValue);
+ else
+ SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),_T(""));
}break;
- }
}break;
+ }
+ break;
- case WM_COMMAND:{
+ case WM_COMMAND:
switch(LOWORD(wparam)) {
- case IDC_VARHELP:{
+ case IDC_VARHELP:
if (!g_varhelpDlg)
g_varhelpDlg=CreateDialog(hinstance,MAKEINTRESOURCE(IDD_HELPDIALOG), 0, HelpDlgProc);
else
//ShowWindow(g_varhelpDlg,SW_SHOWDEFAULT);
SetWindowPos(g_varhelpDlg,0,0,0,0,0,SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE);
- }break;
- case IDC_BLISTADD:{
- TVINSERTSTRUCT tvis;
- ListData* ld=NULL;
- TCHAR namebuff[MAX_PATH]={'\0'};
- int count=TreeView_GetCount(hButtonsList);
- if (count>10) break;
- if(g_iOPButtonsCount==99){
- MessageBox(NULL, TranslateT("Congratulation!\r\nYou have clicked this button 100 times!\r\nThere was access violation at this point...\r\nAnd now function for freeing resources must be called...\r\nBut no! there's only break :D"), TranslateT("You win!"),MB_OK);
- break;
+ break;
+ case IDC_BLISTADD:
+ {
+ TVINSERTSTRUCT tvis;
+ ListData* ld=NULL;
+ TCHAR namebuff[MAX_PATH]={'\0'};
+ int count=TreeView_GetCount(hButtonsList);
+ if (count>10) break;
+ if(g_iOPButtonsCount==99){
+ MessageBox(NULL, TranslateT("Congratulation!\r\nYou have clicked this button 100 times!\r\nThere was access violation at this point...\r\nAnd now function for freeing resources must be called...\r\nBut no! there's only break :D"), TranslateT("You win!"),MB_OK);
+ break;
}
- ld = (ListData *)mir_alloc(sizeof(ListData));
- ButtonsList[g_iOPButtonsCount++]=ld;
+ ld = (ListData *)mir_alloc(sizeof(ListData));
+ ButtonsList[g_iOPButtonsCount++]=ld;
- ld->sl=List_Create(0,1);
- ld->dwOPFlags=QMF_NEW;
- ld->bIsOpServName=0;
- ld->ptszButtonName=NULL;
- ld->ptszOPQValue=NULL;
- ld->ptszQValue=NULL;
- tvis.hParent = NULL;
- tvis.hInsertAfter = TVI_LAST;
-
- GetWindowText(GetDlgItem(hdlg,IDC_BUTTONNAME),namebuff,MAX_PATH);
+ ld->sl=List_Create(0,1);
+ ld->dwOPFlags=QMF_NEW;
+ ld->bIsOpServName=0;
+ ld->ptszButtonName=NULL;
+ ld->ptszOPQValue=NULL;
+ ld->ptszQValue=NULL;
+ tvis.hParent = NULL;
+ tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask=TVIF_PARAM|TVIF_TEXT;
- tvis.item.pszText=(_tcslen(namebuff))?namebuff:TranslateT("New Button");
- tvis.item.lParam=(LPARAM)ld;
- TreeView_SelectItem(hButtonsList,TreeView_InsertItem(hButtonsList,&tvis));
+ GetWindowText(GetDlgItem(hdlg,IDC_BUTTONNAME),namebuff,MAX_PATH);
+ tvis.item.mask=TVIF_PARAM|TVIF_TEXT;
+ tvis.item.pszText=(_tcslen(namebuff))?namebuff:TranslateT("New Button");
+ tvis.item.lParam=(LPARAM)ld;
+ TreeView_SelectItem(hButtonsList,TreeView_InsertItem(hButtonsList,&tvis));
}break;
- case IDC_BLISTREMOVE:{
- TVITEM tvi;
- ListData* ld;
+ case IDC_BLISTREMOVE:
+ {
+ TVITEM tvi;
+ ListData* ld;
- if (!(tvi.hItem=TreeView_GetSelection(hButtonsList)))
- break;
+ if (!(tvi.hItem=TreeView_GetSelection(hButtonsList)))
+ break;
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- TreeView_GetItem(hButtonsList,&tvi);
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
+ TreeView_GetItem(hButtonsList,&tvi);
- ld= (ListData*)tvi.lParam;
+ ld= (ListData*)tvi.lParam;
- ld->dwOPFlags|=QMF_DELETNEEDED;
+ ld->dwOPFlags|=QMF_DELETNEEDED;
- TreeView_DeleteItem(hButtonsList,tvi.hItem);
- if (!TreeView_GetCount(hButtonsList))
- {
- TreeView_DeleteAllItems(hMenuTree);
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),FALSE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
- SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),_T(""));
+ TreeView_DeleteItem(hButtonsList,tvi.hItem);
+ if (!TreeView_GetCount(hButtonsList)) {
+ TreeView_DeleteAllItems(hMenuTree);
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),FALSE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),_T(""));
}
}break;
- case IDC_MTREEADD:{
- TVINSERTSTRUCT tvis;
- TVITEM tvi;
- ButtonData *bd=NULL;
- SortedList *sl=NULL;
- TCHAR namebuff[MAX_PATH]={'\0'};
-
- if (!TreeView_GetCount(hButtonsList)) break;
- if (!(tvi.hItem=TreeView_GetSelection(hButtonsList))) break;
-
- bd = (ButtonData *)mir_alloc(sizeof(ButtonData));
- memset(bd,0,sizeof(ButtonData));
+ case IDC_MTREEADD:
+ {
+ TVINSERTSTRUCT tvis;
+ TVITEM tvi;
+ ButtonData *bd=NULL;
+ SortedList *sl=NULL;
+ TCHAR namebuff[MAX_PATH]={'\0'};
- GetWindowText(GetDlgItem(hdlg,IDC_MENUNAME),namebuff,MAX_PATH);
+ if (!TreeView_GetCount(hButtonsList)) break;
+ if (!(tvi.hItem=TreeView_GetSelection(hButtonsList))) break;
- bd->dwOPPos=TreeView_GetCount(hMenuTree)-1;
- bd->pszOpName=_tcslen(namebuff)?mir_tstrdup(namebuff):mir_tstrdup(TranslateT("New Menu Entry"));
- bd->pszOpValue=mir_tstrdup(bd->pszOpName);
- bd->fEntryOpType=!_tcscmp(namebuff,_T("---"))?QMF_EX_SEPARATOR:0;
- bd->dwOPFlags=QMF_NEW;
- bd->pszName=NULL;
- bd->pszValue=NULL;
+ bd = (ButtonData *)mir_alloc(sizeof(ButtonData));
+ memset(bd,0,sizeof(ButtonData));
+ GetWindowText(GetDlgItem(hdlg,IDC_MENUNAME),namebuff,MAX_PATH);
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
-
- TreeView_GetItem(hButtonsList,&tvi);
+ bd->dwOPPos=TreeView_GetCount(hMenuTree)-1;
+ bd->pszOpName=_tcslen(namebuff)?mir_tstrdup(namebuff):mir_tstrdup(TranslateT("New Menu Entry"));
+ bd->pszOpValue=mir_tstrdup(bd->pszOpName);
+ bd->fEntryOpType=!_tcscmp(namebuff,_T("---"))?QMF_EX_SEPARATOR:0;
+ bd->dwOPFlags=QMF_NEW;
+ bd->pszName=NULL;
+ bd->pszValue=NULL;
- sl=((ListData*)tvi.lParam)->sl;
- List_InsertPtr(sl,bd);
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- tvis.hParent = NULL;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask=TVIF_PARAM|TVIF_TEXT;
- tvis.item.pszText=bd->pszOpName;
- tvis.item.lParam=(LPARAM)bd;
- TreeView_SelectItem(hMenuTree,TreeView_InsertItem(hMenuTree,&tvis));
- }break;
+ TreeView_GetItem(hButtonsList,&tvi);
- case IDC_MTREEREMOVE:{
- TVITEM tvi;
- TVINSERTSTRUCT tvis;
- HTREEITEM hti=NULL;
- ButtonData *bd=NULL;
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- if (!(tvi.hItem=TreeView_GetSelection(hMenuTree)))
- break;
- TreeView_GetItem(hMenuTree,&tvi);
- hti=tvi.hItem;
+ sl=((ListData*)tvi.lParam)->sl;
- bd= (ButtonData*)tvi.lParam;
- bd->dwOPFlags|=QMF_DELETNEEDED;
+ List_InsertPtr(sl,bd);
- if(tvi.hItem=TreeView_GetChild(hMenuTree,tvi.hItem)) {
- TCHAR strbuf[128];
- while(tvi.hItem){
- tvis.hInsertAfter=hti;
- tvi.pszText = strbuf;
- tvi.cchTextMax = sizeof(strbuf);
- tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
+ tvis.hParent = NULL;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask=TVIF_PARAM|TVIF_TEXT;
+ tvis.item.pszText=bd->pszOpName;
+ tvis.item.lParam=(LPARAM)bd;
+ TreeView_SelectItem(hMenuTree,TreeView_InsertItem(hMenuTree,&tvis));
+ }break;
- TreeView_GetItem(hMenuTree,&tvi);
- tvis.hParent=NULL;
- tvis.item=tvi;
- TreeView_InsertItem(hMenuTree,&tvis);
- tvi.hItem=TreeView_GetNextSibling(hMenuTree,tvi.hItem);
+ case IDC_MTREEREMOVE:
+ {
+ TVITEM tvi;
+ TVINSERTSTRUCT tvis;
+ HTREEITEM hti=NULL;
+ ButtonData *bd=NULL;
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
+ if (!(tvi.hItem=TreeView_GetSelection(hMenuTree)))
+ break;
+ TreeView_GetItem(hMenuTree,&tvi);
+ hti=tvi.hItem;
+
+ bd= (ButtonData*)tvi.lParam;
+ bd->dwOPFlags|=QMF_DELETNEEDED;
+
+ if(tvi.hItem=TreeView_GetChild(hMenuTree,tvi.hItem)) {
+ TCHAR strbuf[128];
+ while(tvi.hItem){
+ tvis.hInsertAfter=hti;
+ tvi.pszText = strbuf;
+ tvi.cchTextMax = sizeof(strbuf);
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
+
+ TreeView_GetItem(hMenuTree,&tvi);
+ tvis.hParent=NULL;
+ tvis.item=tvi;
+ TreeView_InsertItem(hMenuTree,&tvis);
+ tvi.hItem=TreeView_GetNextSibling(hMenuTree,tvi.hItem);
}
}
- TreeView_DeleteItem(hMenuTree,hti);
- if (!TreeView_GetCount(hMenuTree)) {
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
- }
-
- }break;
-
+ TreeView_DeleteItem(hMenuTree,hti);
+ if (!TreeView_GetCount(hMenuTree)) {
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
}
}break;
-
- case WM_NCDESTROY:
- if(oldBNameProc) SetWindowLongPtr(GetDlgItem(hdlg,IDC_BUTTONNAME), GWLP_WNDPROC, (LONG) oldBNameProc);
- if(oldMNameProc) SetWindowLongPtr(GetDlgItem(hdlg,IDC_MENUNAME) , GWLP_WNDPROC, (LONG) oldMNameProc);
- break;
-
- case WM_CLOSE:
- EndDialog(hdlg,0);
- return 0;
}
- if (HIWORD(wparam)==BN_CLICKED && GetFocus()==(HWND)lparam)
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- else if ((HIWORD(wparam) == EN_CHANGE)&&(GetFocus()==(HWND)lparam))
- if (!bOptionsInit) SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ break;
- return 0;
+ case WM_CLOSE:
+ EndDialog(hdlg,0);
+ return 0;
}
+ if (HIWORD(wparam)==BN_CLICKED && GetFocus()==(HWND)lparam)
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ else if ((HIWORD(wparam) == EN_CHANGE)&&(GetFocus()==(HWND)lparam))
+ if (!bOptionsInit) SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+
+ return 0;
+}
int OptionsInit(WPARAM wparam,LPARAM lparam)
{
- OPTIONSDIALOGPAGE odp={0};
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 940000000;
odp.hInstance = hinstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp index b39cc2caa5..57b8535cc6 100644 --- a/plugins/QuickReplies/src/options.cpp +++ b/plugins/QuickReplies/src/options.cpp @@ -19,54 +19,48 @@ Boston, MA 02111-1307, USA. #include "common.h"
-static WNDPROC OldMessageEditProc;
-
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
- {
- case WM_CHAR:
- {
- if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000)
- { // ctrl-a
- SendMessage(hwnd, EM_SETSEL, 0, -1);
- return 0;
- }
+ switch(msg) {
+ case WM_CHAR:
+ if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000)
+ { // ctrl-a
+ SendMessage(hwnd, EM_SETSEL, 0, -1);
+ return 0;
+ }
- if (wParam == 26 && GetKeyState(VK_CONTROL) & 0x8000)
- { // ctrl-z
- SendMessage(hwnd, EM_UNDO, 0, 0);
- return 0;
- }
+ if (wParam == 26 && GetKeyState(VK_CONTROL) & 0x8000)
+ { // ctrl-z
+ SendMessage(hwnd, EM_UNDO, 0, 0);
+ return 0;
+ }
- if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000)
- { // ctrl-backspace
- DWORD start, end;
- WCHAR text[1024];
-
- SendMessage(hwnd, EM_GETSEL, (WPARAM) & end, (LPARAM) (PDWORD) NULL);
- SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0);
- SendMessage(hwnd, EM_GETSEL, (WPARAM) & start, (LPARAM) (PDWORD) NULL);
- GetWindowText(hwnd, text, 1024);
- MoveMemory(text + start, text + end, sizeof(WCHAR) * (wcslen(text) + 1 - end));
- SetWindowText(hwnd, text);
- //SAFE_FREE((void**)&text);
- SendMessage(hwnd, EM_SETSEL, start, start);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM) hwnd);
- return 0;
- }
+ if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000)
+ { // ctrl-backspace
+ DWORD start, end;
+ WCHAR text[1024];
+
+ SendMessage(hwnd, EM_GETSEL, (WPARAM) & end, (LPARAM) (PDWORD) NULL);
+ SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0);
+ SendMessage(hwnd, EM_GETSEL, (WPARAM) & start, (LPARAM) (PDWORD) NULL);
+ GetWindowText(hwnd, text, 1024);
+ MoveMemory(text + start, text + end, sizeof(WCHAR) * (wcslen(text) + 1 - end));
+ SetWindowText(hwnd, text);
+ //SAFE_FREE((void**)&text);
+ SendMessage(hwnd, EM_SETSEL, start, start);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM) hwnd);
+ return 0;
}
break;
}
- return CallWindowProc(OldMessageEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg)
- {
- case WM_INITDIALOG:
+ switch(uMsg) {
+ case WM_INITDIALOG:
{
char key[64];
int count = 0;
@@ -77,7 +71,7 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR variables_skin_helpbutton(hwndDlg, IDC_VARIABLES);
SendDlgItemMessage(hwndDlg, IDC_REPLIES, EM_LIMITTEXT, TEXT_LIMIT, 0);
- OldMessageEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_REPLIES), GWLP_WNDPROC, (LONG_PTR)MessageEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_REPLIES), MessageEditSubclassProc);
mir_snprintf(key, 64, "ImmediatelySend_%x", iNumber);
CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, (BYTE)DBGetContactSettingWord(NULL, MODULE_NAME, key, 1));
@@ -97,40 +91,29 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR SetDlgItemText(hwndDlg, IDC_REPLIES, replies.c_str());
DBFreeVariant(&dbv);
-
- return TRUE;
}
- break;
+ return TRUE;
- case WM_COMMAND:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- switch(LOWORD(wParam))
- {
- case IDC_VARIABLES:
- {
- variables_showhelp(hwndDlg, IDC_REPLIES, VHF_SIMPLEDLG, NULL, NULL);
- }
- break;
+ case WM_COMMAND:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch(LOWORD(wParam)) {
+ case IDC_VARIABLES:
+ variables_showhelp(hwndDlg, IDC_REPLIES, VHF_SIMPLEDLG, NULL, NULL);
+ break;
- case IDC_IMMEDIATELY:
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
- }
+ case IDC_IMMEDIATELY:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
}
}
break;
- case WM_NOTIFY:
+ case WM_NOTIFY:
{
NMHDR *p = ((LPNMHDR)lParam);
- switch (p->code)
- {
- case PSN_APPLY:
+ switch (p->code) {
+ case PSN_APPLY:
{
char key[64];
int count = 0;
@@ -138,7 +121,7 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR mir_snprintf(key, 64, "RepliesCount_%x", iNumber);
count = DBGetContactSettingByte(NULL, MODULE_NAME, key, 0);
-
+
for (int i = 0; i < count; i++)
{
mir_snprintf(key, 64, "Reply_%x_%x", iNumber, i);
@@ -167,7 +150,7 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR mir_snprintf(key, 64, "ImmediatelySend_%x", iNumber);
DBWriteContactSettingByte(NULL, MODULE_NAME, key, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY));
-
+
mir_free(key);
return TRUE;
@@ -189,16 +172,15 @@ int OnOptInitialized(WPARAM wParam, LPARAM lParam) char tabName[32];
mir_snprintf(tabName, SIZEOF(tabName), "Button %x", iNumber + 1);
- OPTIONSDIALOGPAGE odp = {0};
- odp.cbSize = sizeof(odp);
- odp.pszGroup = LPGEN("Message Sessions");
- odp.pszTitle = LPGEN("Quick Replies");
- odp.pszTab = tabName;
- odp.position = iNumber;
- odp.hInstance = hInstance;
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.pszGroup = LPGEN("Message Sessions");
+ odp.pszTitle = LPGEN("Quick Replies");
+ odp.pszTab = tabName;
+ odp.position = iNumber;
+ odp.hInstance = hInstance;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_PAGE);
- odp.pfnDlgProc = DlgProcOptionsPage;
+ odp.pszTemplate= MAKEINTRESOURCEA(IDD_OPTIONS_PAGE);
+ odp.pfnDlgProc = DlgProcOptionsPage;
Options_AddPage(wParam, &odp);
return 0;
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index 548d191827..5d3b9cf68e 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -611,30 +611,20 @@ void LoadMsgDlgFont(int i,LOGFONT *lf,COLORREF *colour) }
}
-
LRESULT CALLBACK MessageSubclassProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
LRESULT lrRet=0;
- WNDPROC OldMessageEditProc=(WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch(message){
case WM_CHAR:
if (wParam=='\n' && GetKeyState(VK_CONTROL)&0x8000)
- {
PostMessage(GetParent(hwnd),WM_COMMAND,IDOK,0);
- return 0;
- }
- break;
+ return 0;
}
- if (OldMessageEditProc) lrRet=CallWindowProc(OldMessageEditProc,hwnd,message,wParam,lParam);
-
-return(lrRet);
+ return mir_callNextSubclass(hwnd, MessageSubclassProc, message, wParam, lParam);
}
-
-
-
//This function refresh account list.
//It called when SMS plugin loaded and upon change in the account list.
int RefreshAccountList(WPARAM eventCode,LPARAM lParam)
diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index d765e231b4..adf33d554d 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -73,10 +73,8 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l prswdWindowData=(RECV_SMS_WINDOW_DATA*)lParam;
SetWindowLongPtr(hWndDlg,GWLP_USERDATA,(LONG_PTR)lParam);
- {
- WNDPROC OldEditWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hWndDlg,IDC_MESSAGE),GWLP_WNDPROC,(LONG_PTR)MessageSubclassProc);
- SetWindowLongPtr(GetDlgItem(hWndDlg,IDC_MESSAGE),GWLP_USERDATA,(LONG_PTR)OldEditWndProc);
- }
+
+ mir_subclassWindow(GetDlgItem(hWndDlg,IDC_MESSAGE), MessageSubclassProc);
{
HFONT hFont;
LOGFONT lf;
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index ccc59410b8..540b429781 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -28,20 +28,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define WM_UNICHAR 0x0109
#endif
-extern HBRUSH hListBkgBrush;
-extern HBRUSH hListSelectedBkgBrush;
-extern HANDLE hSendEvent;
-extern CREOleCallback reOleCallback;
-extern HMENU g_hMenu;
-extern TABLIST * g_TabList;
-extern HANDLE hHookWinPopup;
-extern HCURSOR hCurSplitNS, hCurSplitWE;
+extern HBRUSH hListBkgBrush;
+extern HBRUSH hListSelectedBkgBrush;
+extern HANDLE hSendEvent;
+extern HMENU g_hMenu;
+extern TABLIST *g_TabList;
+extern HANDLE hHookWinPopup;
+extern HCURSOR hCurSplitNS, hCurSplitWE;
-static WNDPROC OldSplitterProc;
-static WNDPROC OldMessageProc;
-static WNDPROC OldNicklistProc;
-static WNDPROC OldFilterButtonProc;
-static WNDPROC OldLogProc;
+extern CREOleCallback reOleCallback;
static ToolbarButton toolbarButtons[] = {
{LPGENT("Bold"), IDC_CHAT_BOLD, 0, 4, 24},
@@ -98,7 +93,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LP PostMessage(GetParent(hwnd),WM_SIZE, 0, 0);
return 0;
}
- return CallWindowProc(OldSplitterProc,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
static void InitButtons(HWND hwndDlg, SESSION_INFO* si)
@@ -581,7 +576,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return 0;
}
- return CallWindowProc(OldMessageProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageSubclassProc, msg, wParam, lParam);
}
static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
@@ -674,7 +669,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L break;
}
- return CallWindowProc(OldFilterButtonProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ButtonSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -795,7 +790,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
}
- return CallWindowProc(OldLogProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ButtonSubclassProc, msg, wParam, lParam);
}
static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESSION_INFO * parentdat)
@@ -1082,7 +1077,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break;
}
- return CallWindowProc(OldNicklistProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, NicklistSubclassProc, msg, wParam, lParam);
}
@@ -1133,13 +1128,13 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_LOG));
RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_LIST));
- OldSplitterProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERX),GWLP_WNDPROC,(LONG_PTR)SplitterSubclassProc);
- OldNicklistProc=(WNDPROC)SetWindowLongPtr(hNickList,GWLP_WNDPROC,(LONG_PTR)NicklistSubclassProc);
- OldLogProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_LOG),GWLP_WNDPROC,(LONG_PTR)LogSubclassProc);
- OldFilterButtonProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_FILTER),GWLP_WNDPROC,(LONG_PTR)ButtonSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_COLOR),GWLP_WNDPROC,(LONG_PTR)ButtonSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR),GWLP_WNDPROC,(LONG_PTR)ButtonSubclassProc);
- OldMessageProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), GWLP_WNDPROC,(LONG_PTR)MessageSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERX), SplitterSubclassProc);
+ mir_subclassWindow( hNickList, NicklistSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_LOG), LogSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_FILTER), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_COLOR), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE), MessageSubclassProc);
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), &minEditInit);
si->windowData.minEditBoxHeight = minEditInit.bottom - minEditInit.top;
@@ -1193,102 +1188,90 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) }
break;
- case GC_SETWNDPROPS:
- {
- LoadGlobalSettings();
- InitButtons(hwndDlg, si);
-
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
-
- { // log
- //int iIndent = 0;
- //PARAFORMAT2 pf2;
- //if (g_Settings.dwIconFlags)
- // iIndent += (14*1440)/g_dat->logPixelSX;
- //if (g_Settings.ShowTime && g_Settings.LogIndentEnabled)
- // iIndent += g_Settings.LogTextIndent*1440/g_dat->logPixelSX;
- //pf2.cbSize = sizeof(pf2);
- //pf2.dwMask = PFM_OFFSET;
- //pf2.dxOffset = iIndent * 1440 / g_dat->logPixelSX;
- //SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ case GC_SETWNDPROPS:
+ {
+ LoadGlobalSettings();
+ InitButtons(hwndDlg, si);
+
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
+ SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
+
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_SETBKGNDCOLOR , 0, g_Settings.crLogBackground);
- }
-
- { //messagebox
- COLORREF crFore;
-
- CHARFORMAT2 cf;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore, FALSE);
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_COLOR|CFM_BOLD|CFM_UNDERLINE|CFM_BACKCOLOR;
- cf.dwEffects = 0;
- cf.crTextColor = crFore;
- cf.crBackColor = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_SETBKGNDCOLOR , 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETFONT, (WPARAM) g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL , (LPARAM)&cf);
- }
- { // nicklist
- int ih;
- int ih2;
- int font;
- int height;
-
- ih = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListFont,FALSE);
- ih2 = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListHeadingsFont,FALSE);
- height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
- font = ih > ih2?ih:ih2;
- // make sure we have space for icon!
- if (DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0))
- font = font > 16 ? font : 16;
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_SETITEMHEIGHT, 0, (LPARAM)height > font ? height : font);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, TRUE);
- }
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
- }
- break;
+ { //messagebox
+ COLORREF crFore;
+
+ CHARFORMAT2 cf;
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore, FALSE);
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_COLOR|CFM_BOLD|CFM_UNDERLINE|CFM_BACKCOLOR;
+ cf.dwEffects = 0;
+ cf.crTextColor = crFore;
+ cf.crBackColor = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_SETBKGNDCOLOR , 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETFONT, (WPARAM) g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL , (LPARAM)&cf);
+ }
+ { // nicklist
+ int ih;
+ int ih2;
+ int font;
+ int height;
+
+ ih = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListFont,FALSE);
+ ih2 = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListHeadingsFont,FALSE);
+ height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
+ font = ih > ih2?ih:ih2;
+ // make sure we have space for icon!
+ if (DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0))
+ font = font > 16 ? font : 16;
+
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_SETITEMHEIGHT, 0, (LPARAM)height > font ? height : font);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, TRUE);
+ }
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
+ }
+ break;
- case DM_UPDATETITLEBAR:
- {
- TitleBarData tbd = {0};
- TCHAR szTemp [100];
- if (g_dat->flags & SMF_STATUSICON) {
- MODULEINFO* mi = MM_FindModule(si->pszModule);
- tbd.hIcon = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
- tbd.hIconBig = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIconBig : mi->hOfflineIconBig;
- }
- else {
- tbd.hIcon = GetCachedIcon("chat_window");
- tbd.hIconBig = g_dat->hIconChatBig;
+ case DM_UPDATETITLEBAR:
+ {
+ TitleBarData tbd = {0};
+ TCHAR szTemp [100];
+ if (g_dat->flags & SMF_STATUSICON) {
+ MODULEINFO* mi = MM_FindModule(si->pszModule);
+ tbd.hIcon = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
+ tbd.hIconBig = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIconBig : mi->hOfflineIconBig;
+ }
+ else {
+ tbd.hIcon = GetCachedIcon("chat_window");
+ tbd.hIconBig = g_dat->hIconChatBig;
+ }
+ tbd.hIconNot = (si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL;
+
+ switch(si->iType) {
+ case GCW_CHATROOM:
+ mir_sntprintf(szTemp, SIZEOF(szTemp),
+ (si->nUsersInNicklist == 1) ? TranslateT("%s: Chat Room (%u user)") : TranslateT("%s: Chat Room (%u users)"),
+ si->ptszName, si->nUsersInNicklist);
+ break;
+ case GCW_PRIVMESS:
+ mir_sntprintf(szTemp, SIZEOF(szTemp),
+ (si->nUsersInNicklist ==1) ? TranslateT("%s: Message Session") : TranslateT("%s: Message Session (%u users)"),
+ si->ptszName, si->nUsersInNicklist);
+ break;
+ case GCW_SERVER:
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s: Server"), si->ptszName);
+ break;
+ }
+ tbd.iFlags = TBDF_TEXT | TBDF_ICON;
+ tbd.pszText = szTemp;
+ SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM) &tbd, (LPARAM) hwndDlg);
+ SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0);
}
- tbd.hIconNot = (si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL;
-
- switch(si->iType) {
- case GCW_CHATROOM:
- mir_sntprintf(szTemp, SIZEOF(szTemp),
- (si->nUsersInNicklist == 1) ? TranslateT("%s: Chat Room (%u user)") : TranslateT("%s: Chat Room (%u users)"),
- si->ptszName, si->nUsersInNicklist);
- break;
- case GCW_PRIVMESS:
- mir_sntprintf(szTemp, SIZEOF(szTemp),
- (si->nUsersInNicklist ==1) ? TranslateT("%s: Message Session") : TranslateT("%s: Message Session (%u users)"),
- si->ptszName, si->nUsersInNicklist);
- break;
- case GCW_SERVER:
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s: Server"), si->ptszName);
- break;
- }
- tbd.iFlags = TBDF_TEXT | TBDF_ICON;
- tbd.pszText = szTemp;
- SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM) &tbd, (LPARAM) hwndDlg);
- SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0);
- }
- break;
+ break;
case DM_UPDATESTATUSBAR:
{
@@ -1314,24 +1297,25 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) sid.flags = 0;
ModifyStatusIcon((WPARAM)si->windowData.hContact, (LPARAM) &sid);
- // SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)si);
}
break;
+
case DM_GETCODEPAGE:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, si->windowData.codePage);
return TRUE;
+
case DM_SETCODEPAGE:
si->windowData.codePage = (int) lParam;
si->pszHeader = Log_CreateRtfHeader(MM_FindModule(si->pszModule), si);
- SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
+ SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
break;
+
case DM_SWITCHINFOBAR:
case DM_SWITCHTOOLBAR:
SendMessage(hwndDlg, WM_SIZE, 0, 0);
break;
- case WM_SIZE:
- {
+ case WM_SIZE:
if (wParam == SIZE_MAXIMIZED)
PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
@@ -1349,215 +1333,208 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) }
MessageDialogResize(hwndDlg, si, dlgWidth, dlgHeight);
-
}
- }
- break;
+ break;
- case GC_REDRAWWINDOW:
- InvalidateRect(hwndDlg, NULL, TRUE);
- break;
+ case GC_REDRAWWINDOW:
+ InvalidateRect(hwndDlg, NULL, TRUE);
+ break;
- case GC_REDRAWLOG:
- si->LastTime = 0;
- if (si->pLog) {
- LOGINFO * pLog = si->pLog;
- if (si->iEventCount > 60) {
- int index = 0;
- while ( index < 59) {
- if (pLog->next == NULL)
- break;
-
- pLog = pLog->next;
- if (si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags&pLog->iType) != 0)
- index++;
- }
- Log_StreamInEvent(hwndDlg, pLog, si, TRUE);
- mir_forkthread(phase2, si);
- }
- else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
- }
- else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER+500, WINDOW_CLEARLOG, 0);
- break;
+ case GC_REDRAWLOG:
+ si->LastTime = 0;
+ if (si->pLog) {
+ LOGINFO * pLog = si->pLog;
+ if (si->iEventCount > 60) {
+ int index = 0;
+ while ( index < 59) {
+ if (pLog->next == NULL)
+ break;
+
+ pLog = pLog->next;
+ if (si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags&pLog->iType) != 0)
+ index++;
+ }
+ Log_StreamInEvent(hwndDlg, pLog, si, TRUE);
+ mir_forkthread(phase2, si);
+ }
+ else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
+ }
+ else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER+500, WINDOW_CLEARLOG, 0);
+ break;
- case GC_REDRAWLOG2:
- si->LastTime = 0;
- if (si->pLog)
- Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
- break;
+ case GC_REDRAWLOG2:
+ si->LastTime = 0;
+ if (si->pLog)
+ Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
+ break;
- case GC_REDRAWLOG3:
- si->LastTime = 0;
- if (si->pLog)
- Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
- break;
+ case GC_REDRAWLOG3:
+ si->LastTime = 0;
+ if (si->pLog)
+ Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
+ break;
- case GC_ADDLOG:
- if (si->pLogEnd)
- Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE);
- else
- SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER+500, WINDOW_CLEARLOG, 0);
- break;
+ case GC_ADDLOG:
+ if (si->pLogEnd)
+ Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE);
+ else
+ SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER+500, WINDOW_CLEARLOG, 0);
+ break;
- case DM_UPDATETABCONTROL:
- {
- TabControlData tcd;
- tcd.iFlags = TCDF_TEXT;
- tcd.pszText = si->ptszName;
- SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg);
+ case DM_UPDATETABCONTROL:
+ {
+ TabControlData tcd;
+ tcd.iFlags = TCDF_TEXT;
+ tcd.pszText = si->ptszName;
+ SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg);
- }
- case GC_FIXTABICONS:
- {
- TabControlData tcd;
- HICON hIcon;
- if (!(si->wState & GC_EVENT_HIGHLIGHT))
- {
- if (si->wState & STATE_TALK)
- hIcon = (si->wStatus==ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineTalkIcon : MM_FindModule(si->pszModule)->hOfflineTalkIcon;
- else
- hIcon = (si->wStatus==ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineIcon : MM_FindModule(si->pszModule)->hOfflineIcon;
- } else {
- hIcon = g_dat->hMsgIcon;
- }
- tcd.iFlags = TCDF_ICON;
- tcd.hIcon = hIcon;
- SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg);
- }
- break;
+ }
+ case GC_FIXTABICONS:
+ {
+ TabControlData tcd;
+ HICON hIcon;
+ if (!(si->wState & GC_EVENT_HIGHLIGHT))
+ {
+ if (si->wState & STATE_TALK)
+ hIcon = (si->wStatus==ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineTalkIcon : MM_FindModule(si->pszModule)->hOfflineTalkIcon;
+ else
+ hIcon = (si->wStatus==ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineIcon : MM_FindModule(si->pszModule)->hOfflineIcon;
+ } else {
+ hIcon = g_dat->hMsgIcon;
+ }
+ tcd.iFlags = TCDF_ICON;
+ tcd.hIcon = hIcon;
+ SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg);
+ }
+ break;
- case GC_SETMESSAGEHIGHLIGHT:
- {
- si->wState |= GC_EVENT_HIGHLIGHT;
- SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- if (DBGetContactSettingByte(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != GetParent(hwndDlg))
- SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
- }
- break;
+ case GC_SETMESSAGEHIGHLIGHT:
+ {
+ si->wState |= GC_EVENT_HIGHLIGHT;
+ SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
+ if (DBGetContactSettingByte(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != GetParent(hwndDlg))
+ SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
+ }
+ break;
- case GC_SETTABHIGHLIGHT:
- {
- SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- if (g_Settings.FlashWindow && GetActiveWindow() != GetParent(hwndDlg) && GetForegroundWindow() != GetParent(hwndDlg))
- SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
- }
- break;
+ case GC_SETTABHIGHLIGHT:
+ {
+ SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
+ if (g_Settings.FlashWindow && GetActiveWindow() != GetParent(hwndDlg) && GetForegroundWindow() != GetParent(hwndDlg))
+ SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
+ }
+ break;
- case DM_ACTIVATE:
- {
- if (si->wState & STATE_TALK) {
- si->wState &= ~STATE_TALK;
+ case DM_ACTIVATE:
+ {
+ if (si->wState & STATE_TALK) {
+ si->wState &= ~STATE_TALK;
- DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
- }
+ DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
+ }
- if (si->wState & GC_EVENT_HIGHLIGHT) {
- si->wState &= ~GC_EVENT_HIGHLIGHT;
+ if (si->wState & GC_EVENT_HIGHLIGHT) {
+ si->wState &= ~GC_EVENT_HIGHLIGHT;
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
- }
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
+ }
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
- if (!si->hWnd) {
- ShowRoom(si, (WPARAM)WINDOW_VISIBLE, TRUE);
- SendMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0 );
- } }
- break;
+ SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
+ if (!si->hWnd) {
+ ShowRoom(si, (WPARAM)WINDOW_VISIBLE, TRUE);
+ SendMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0 );
+ }
+ }
+ break;
+ case GC_ACKMESSAGE:
+ SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,EM_SETREADONLY,FALSE,0);
+ SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,WM_SETTEXT,0, (LPARAM)_T(""));
+ return TRUE;
+ case WM_CTLCOLORLISTBOX:
+ SetBkColor((HDC) wParam, g_Settings.crUserListBGColor);
+ return (INT_PTR) hListBkgBrush;
- case GC_ACKMESSAGE:
- SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,EM_SETREADONLY,FALSE,0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,WM_SETTEXT,0, (LPARAM)_T(""));
- return TRUE;
+ case WM_MEASUREITEM:
+ if (!MeasureMenuItem(wParam, lParam)) {
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
- case WM_CTLCOLORLISTBOX:
- SetBkColor((HDC) wParam, g_Settings.crUserListBGColor);
- return (INT_PTR) hListBkgBrush;
-
- case WM_MEASUREITEM:
- if (!MeasureMenuItem(wParam, lParam)) {
- MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
-
- if (mis->CtlType == ODT_MENU)
- {
- return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
- } else
- {
- int ih = GetTextPixelSize( _T("AQGgl'"), g_Settings.UserListFont,FALSE);
- int ih2 = GetTextPixelSize( _T("AQGg'"), g_Settings.UserListHeadingsFont,FALSE);
- int font = ih > ih2?ih:ih2;
- int height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
- // make sure we have space for icon!
- if (DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0))
- font = font > 16 ? font : 16;
- mis->itemHeight = height > font?height:font;
- }
-
- return TRUE;
- }
+ if (mis->CtlType == ODT_MENU)
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+
+ int ih = GetTextPixelSize( _T("AQGgl'"), g_Settings.UserListFont,FALSE);
+ int ih2 = GetTextPixelSize( _T("AQGg'"), g_Settings.UserListHeadingsFont,FALSE);
+ int font = ih > ih2?ih:ih2;
+ int height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12);
+ // make sure we have space for icon!
+ if (DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0))
+ font = font > 16 ? font : 16;
+ mis->itemHeight = height > font?height:font;
+ return TRUE;
+ }
- case WM_DRAWITEM:
- if (!DrawMenuItem(wParam, lParam)) {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
- if (dis->CtlType == ODT_MENU) {
- return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- } else
- if (dis->CtlID == IDC_CHAT_LIST) {
- HFONT hFont, hOldFont;
- HICON hIcon;
- int offset;
- int height;
- int index = dis->itemID;
- USERINFO * ui = SM_GetUserFromIndex(si->ptszID, si->pszModule, index);
- if (ui) {
- int x_offset = 2;
-
- height = dis->rcItem.bottom - dis->rcItem.top;
-
- if (height&1)
- height++;
- if (height == 10)
- offset = 0;
- else
- offset = height/2 - 5;
- hIcon = SM_GetStatusIcon(si, ui);
- hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
- hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
- SetBkMode(dis->hDC, TRANSPARENT);
-
- if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
- FillRect(dis->hDC, &dis->rcItem, hListSelectedBkgBrush);
- else //if (dis->itemState & ODS_INACTIVE)
- FillRect(dis->hDC, &dis->rcItem, hListBkgBrush);
-
- if (g_Settings.ShowContactStatus && g_Settings.ContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top+offset-3,hIcon,16,16,0,NULL, DI_NORMAL);
- Skin_ReleaseIcon(hIcon);
- x_offset += 18;
- }
- DrawIconEx(dis->hDC,x_offset, dis->rcItem.top + offset,hIcon,10,10,0,NULL, DI_NORMAL);
- x_offset += 12;
- if (g_Settings.ShowContactStatus && !g_Settings.ContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top+offset-3,hIcon,16,16,0,NULL, DI_NORMAL);
- Skin_ReleaseIcon(hIcon);
- x_offset += 18;
- }
+ case WM_DRAWITEM:
+ if (!DrawMenuItem(wParam, lParam)) {
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
+ if (dis->CtlType == ODT_MENU)
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+
+ if (dis->CtlID == IDC_CHAT_LIST) {
+ HFONT hFont, hOldFont;
+ HICON hIcon;
+ int offset;
+ int height;
+ int index = dis->itemID;
+ USERINFO * ui = SM_GetUserFromIndex(si->ptszID, si->pszModule, index);
+ if (ui) {
+ int x_offset = 2;
+
+ height = dis->rcItem.bottom - dis->rcItem.top;
+
+ if (height&1)
+ height++;
+ if (height == 10)
+ offset = 0;
+ else
+ offset = height/2 - 5;
+ hIcon = SM_GetStatusIcon(si, ui);
+ hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
+ hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
+ SetBkMode(dis->hDC, TRANSPARENT);
+
+ if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
+ FillRect(dis->hDC, &dis->rcItem, hListSelectedBkgBrush);
+ else //if (dis->itemState & ODS_INACTIVE)
+ FillRect(dis->hDC, &dis->rcItem, hListBkgBrush);
+
+ if (g_Settings.ShowContactStatus && g_Settings.ContactStatusFirst && ui->ContactStatus) {
+ HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top+offset-3,hIcon,16,16,0,NULL, DI_NORMAL);
+ Skin_ReleaseIcon(hIcon);
+ x_offset += 18;
+ }
+ DrawIconEx(dis->hDC,x_offset, dis->rcItem.top + offset,hIcon,10,10,0,NULL, DI_NORMAL);
+ x_offset += 12;
+ if (g_Settings.ShowContactStatus && !g_Settings.ContactStatusFirst && ui->ContactStatus) {
+ HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top+offset-3,hIcon,16,16,0,NULL, DI_NORMAL);
+ Skin_ReleaseIcon(hIcon);
+ x_offset += 18;
+ }
- SetTextColor(dis->hDC, ui->iStatusEx == 0?g_Settings.crUserListColor:g_Settings.crUserListHeadingsColor);
- TextOut(dis->hDC, dis->rcItem.left+x_offset, dis->rcItem.top, ui->pszNick, lstrlen(ui->pszNick));
- SelectObject(dis->hDC, hOldFont);
- }
- return TRUE;
- } }
+ SetTextColor(dis->hDC, ui->iStatusEx == 0?g_Settings.crUserListColor:g_Settings.crUserListHeadingsColor);
+ TextOut(dis->hDC, dis->rcItem.left+x_offset, dis->rcItem.top, ui->pszNick, lstrlen(ui->pszNick));
+ SelectObject(dis->hDC, hOldFont);
+ }
+ return TRUE;
+ } }
- case GC_UPDATENICKLIST:
+ case GC_UPDATENICKLIST:
{
int index=0;
SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, WM_SETREDRAW, FALSE, 0);
@@ -1582,60 +1559,60 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) }
break;
- case GC_EVENT_CONTROL + WM_USER+500:
- {
- switch(wParam) {
- case SESSION_OFFLINE:
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
- return TRUE;
+ case GC_EVENT_CONTROL + WM_USER+500:
+ {
+ switch(wParam) {
+ case SESSION_OFFLINE:
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
+ return TRUE;
- case SESSION_ONLINE:
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- return TRUE;
+ case SESSION_ONLINE:
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ return TRUE;
- case WINDOW_HIDDEN:
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
+ case WINDOW_HIDDEN:
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
+ return TRUE;
- case WINDOW_CLEARLOG:
- SetDlgItemText(hwndDlg, IDC_CHAT_LOG, _T(""));
- return TRUE;
+ case WINDOW_CLEARLOG:
+ SetDlgItemText(hwndDlg, IDC_CHAT_LOG, _T(""));
+ return TRUE;
- case SESSION_TERMINATE:
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
- si->wState &= ~STATE_TALK;
- DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
+ case SESSION_TERMINATE:
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
+ si->wState &= ~STATE_TALK;
+ DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
+ return TRUE;
- case WINDOW_MINIMIZE:
- ShowWindow(hwndDlg, SW_MINIMIZE);
- goto LABEL_SHOWWINDOW;
-
- case WINDOW_MAXIMIZE:
- ShowWindow(hwndDlg, SW_MAXIMIZE);
- goto LABEL_SHOWWINDOW;
-
- case SESSION_INITDONE:
- if (DBGetContactSettingByte(NULL, "Chat", "PopupOnJoin", 0)!=0)
- return TRUE;
- // fall through
- case WINDOW_VISIBLE:
- if (IsIconic(hwndDlg))
- ShowWindow(hwndDlg, SW_NORMAL);
+ case WINDOW_MINIMIZE:
+ ShowWindow(hwndDlg, SW_MINIMIZE);
+ goto LABEL_SHOWWINDOW;
+
+ case WINDOW_MAXIMIZE:
+ ShowWindow(hwndDlg, SW_MAXIMIZE);
+ goto LABEL_SHOWWINDOW;
+
+ case SESSION_INITDONE:
+ if (DBGetContactSettingByte(NULL, "Chat", "PopupOnJoin", 0)!=0)
+ return TRUE;
+ // fall through
+ case WINDOW_VISIBLE:
+ if (IsIconic(hwndDlg))
+ ShowWindow(hwndDlg, SW_NORMAL);
LABEL_SHOWWINDOW:
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
- SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- ShowWindow(hwndDlg, SW_SHOW);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SetForegroundWindow(hwndDlg);
- return TRUE;
- } }
- break;
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ ShowWindow(hwndDlg, SW_SHOW);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SetForegroundWindow(hwndDlg);
+ return TRUE;
+ } }
+ break;
case GC_SPLITTERMOVED:
if ((HWND)lParam==GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERX)) {
@@ -1649,12 +1626,12 @@ LABEL_SHOWWINDOW: oldSplitterX=si->iSplitterX;
si->iSplitterX=rc.right-pt.x+1;
if (si->iSplitterX < 35)
- si->iSplitterX=35;
+ si->iSplitterX=35;
if (si->iSplitterX > rc.right-rc.left-35)
- si->iSplitterX = rc.right-rc.left-35;
+ si->iSplitterX = rc.right-rc.left-35;
g_Settings.iSplitterX = si->iSplitterX;
- }
- else if ((HWND)lParam==GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERY)) {
+ }
+ else if ((HWND)lParam==GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERY)) {
POINT pt;
RECT rc;
int oldSplitterY;
@@ -1664,133 +1641,131 @@ LABEL_SHOWWINDOW: oldSplitterY=si->iSplitterY;
si->iSplitterY=rc.bottom-pt.y;
g_Settings.iSplitterY = si->iSplitterY;
- }
+ }
PostMessage(hwndDlg,WM_SIZE,0,0);
break;
- case GC_FIREHOOK:
- if (lParam) {
- GCHOOK* gch = (GCHOOK *) lParam;
- NotifyEventHooks(hSendEvent,0,(WPARAM)gch);
- if ( gch->pDest ) {
- mir_free( gch->pDest->pszID );
- mir_free( gch->pDest->pszModule );
- mir_free( gch->pDest );
- }
- mir_free( gch->ptszText );
- mir_free( gch->ptszUID );
- mir_free( gch );
- }
- break;
+ case GC_FIREHOOK:
+ if (lParam) {
+ GCHOOK* gch = (GCHOOK *) lParam;
+ NotifyEventHooks(hSendEvent,0,(WPARAM)gch);
+ if ( gch->pDest ) {
+ mir_free( gch->pDest->pszID );
+ mir_free( gch->pDest->pszModule );
+ mir_free( gch->pDest );
+ }
+ mir_free( gch->ptszText );
+ mir_free( gch->ptszUID );
+ mir_free( gch );
+ }
+ break;
- case GC_CHANGEFILTERFLAG:
- si->iLogFilterFlags = lParam;
- break;
+ case GC_CHANGEFILTERFLAG:
+ si->iLogFilterFlags = lParam;
+ break;
- case GC_SHOWFILTERMENU:
- {
- RECT rc;
- HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), hwndDlg, FilterWndProc, (LPARAM)si);
+ 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);
- SetWindowPos(hwnd, HWND_TOP, rc.left-85, (IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_FILTER))||IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_BOLD)))?rc.top-206:rc.top-186, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);
- }
- break;
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_FILTER), &rc);
+ SetWindowPos(hwnd, HWND_TOP, rc.left-85, (IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_FILTER))||IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_BOLD)))?rc.top-206:rc.top-186, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);
+ }
+ break;
- case GC_SHOWCOLORCHOOSER:
- {
- HWND ColorWindow;
- 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 = 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;
-
- ColorWindow= CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM) pCC);
- }
- break;
+ case GC_SHOWCOLORCHOOSER:
+ {
+ HWND ColorWindow;
+ 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 = 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;
+
+ ColorWindow= CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM) pCC);
+ }
+ break;
- case GC_SCROLLTOBOTTOM:
- {
- 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);
- } }
- break;
+ case GC_SCROLLTOBOTTOM:
+ {
+ 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);
+ } }
+ break;
- case WM_ACTIVATE:
- if (LOWORD(wParam) != WA_ACTIVE)
- break;
+ case WM_ACTIVATE:
+ if (LOWORD(wParam) != WA_ACTIVE)
+ break;
- //fall through
- case WM_MOUSEACTIVATE:
- {
- if (uMsg != WM_ACTIVATE)
- SetFocus(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE));
+ //fall through
+ case WM_MOUSEACTIVATE:
+ {
+ if (uMsg != WM_ACTIVATE)
+ SetFocus(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE));
- SetActiveSession(si->ptszID, si->pszModule);
+ SetActiveSession(si->ptszID, si->pszModule);
- if (DBGetContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode", 0) != 0)
- DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
- }
- break;
+ if (DBGetContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode", 0) != 0)
+ DBWriteContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
+ }
+ break;
- case WM_NOTIFY:
- {
- LPNMHDR pNmhdr;
-
- pNmhdr = (LPNMHDR)lParam;
- switch (pNmhdr->code) {
- case EN_REQUESTRESIZE:
- if (pNmhdr->idFrom == IDC_CHAT_MESSAGE) {
- REQRESIZE *rr = (REQRESIZE *)lParam;
- int height = rr->rc.bottom - rr->rc.top + 1;
- if (height < g_dat->minInputAreaHeight) {
- height = g_dat->minInputAreaHeight;
+ case WM_NOTIFY:
+ {
+ LPNMHDR pNmhdr = (LPNMHDR)lParam;
+ switch (pNmhdr->code) {
+ case EN_REQUESTRESIZE:
+ if (pNmhdr->idFrom == IDC_CHAT_MESSAGE) {
+ REQRESIZE *rr = (REQRESIZE *)lParam;
+ int height = rr->rc.bottom - rr->rc.top + 1;
+ if (height < g_dat->minInputAreaHeight) {
+ height = g_dat->minInputAreaHeight;
+ }
+ if (si->desiredInputAreaHeight != height) {
+ si->desiredInputAreaHeight = height;
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
+ }
}
- if (si->desiredInputAreaHeight != height) {
- si->desiredInputAreaHeight = height;
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- PostMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
+ break;
+ case EN_MSGFILTER:
+ if (pNmhdr->idFrom == IDC_CHAT_LOG && ((MSGFILTER *) lParam)->msg == WM_RBUTTONUP){
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ return TRUE;
}
- }
- break;
- case EN_MSGFILTER:
- if (pNmhdr->idFrom == IDC_CHAT_LOG && ((MSGFILTER *) lParam)->msg == WM_RBUTTONUP){
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- break;
- case EN_LINK:
- if (pNmhdr->idFrom == IDC_CHAT_LOG) {
- switch (((ENLINK *) lParam)->msg) {
- case WM_RBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_LBUTTONDBLCLK:
- if (HandleLinkClick(g_hInst, hwndDlg, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE),(ENLINK*)lParam)) {
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- break;
- } }
- break;
+ break;
+ case EN_LINK:
+ if (pNmhdr->idFrom == IDC_CHAT_LOG) {
+ switch (((ENLINK *) lParam)->msg) {
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONUP:
+ case WM_LBUTTONDBLCLK:
+ if (HandleLinkClick(g_hInst, hwndDlg, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE),(ENLINK*)lParam)) {
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+ break;
+ } }
+ break;
case TTN_NEEDTEXT:
if (pNmhdr->idFrom == (UINT_PTR)GetDlgItem(hwndDlg,IDC_CHAT_LIST))
{
@@ -1811,9 +1786,9 @@ LABEL_SHOWWINDOW: TranslateT( "Unique id" ), ui->pszUID,
TranslateT( "Status" ), TM_WordToString( parentdat->pStatuses, ui->Status ));
lpttd->lpszText = ptszBuf;
- } }
+ } }
break;
- } }
+ } }
break;
case WM_COMMAND:
@@ -1855,241 +1830,241 @@ LABEL_SHOWWINDOW: RedrawWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, NULL, RDW_INVALIDATE);
break;
- case IDOK:
- {
- char* pszRtf;
- TCHAR* ptszText, *p1;
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDOK)))
- break;
+ case IDOK:
+ {
+ char* pszRtf;
+ TCHAR* ptszText, *p1;
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDOK)))
+ break;
- pszRtf = GetRichTextRTF(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- {
- TCmdList *cmdListNew = tcmdlist_last(si->windowData.cmdList);
- while (cmdListNew != NULL && cmdListNew->temporary) {
- si->windowData.cmdList = tcmdlist_remove(si->windowData.cmdList, cmdListNew);
- cmdListNew = tcmdlist_last(si->windowData.cmdList);
+ pszRtf = GetRichTextRTF(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ {
+ TCmdList *cmdListNew = tcmdlist_last(si->windowData.cmdList);
+ while (cmdListNew != NULL && cmdListNew->temporary) {
+ si->windowData.cmdList = tcmdlist_remove(si->windowData.cmdList, cmdListNew);
+ cmdListNew = tcmdlist_last(si->windowData.cmdList);
+ }
+ }
+ si->windowData.cmdList = tcmdlist_append(si->windowData.cmdList, pszRtf, 20, FALSE);
+ ptszText = DoRtfToTags(pszRtf, si);
+ p1 = _tcschr(ptszText, '\0');
+
+ //remove trailing linebreaks
+ while ( p1 > ptszText && (*p1 == '\0' || *p1 == '\r' || *p1 == '\n')) {
+ *p1 = '\0';
+ p1--;
}
- }
- si->windowData.cmdList = tcmdlist_append(si->windowData.cmdList, pszRtf, 20, FALSE);
- ptszText = DoRtfToTags(pszRtf, si);
- p1 = _tcschr(ptszText, '\0');
-
- //remove trailing linebreaks
- while ( p1 > ptszText && (*p1 == '\0' || *p1 == '\r' || *p1 == '\n')) {
- *p1 = '\0';
- p1--;
- }
- if ( MM_FindModule(si->pszModule)->bAckMsg ) {
- EnableWindow(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE),FALSE);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,EM_SETREADONLY,TRUE,0);
- }
- else SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,WM_SETTEXT,0,(LPARAM)_T(""));
+ if ( MM_FindModule(si->pszModule)->bAckMsg ) {
+ EnableWindow(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE),FALSE);
+ SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,EM_SETREADONLY,TRUE,0);
+ }
+ else SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,WM_SETTEXT,0,(LPARAM)_T(""));
- EnableWindow(GetDlgItem(hwndDlg,IDOK),FALSE);
+ EnableWindow(GetDlgItem(hwndDlg,IDOK),FALSE);
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0);
- mir_free(pszRtf);
- mir_free(ptszText);
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- }
- break;
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0);
+ mir_free(pszRtf);
+ mir_free(ptszText);
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ }
+ break;
- case IDC_CHAT_SHOWNICKLIST:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_SHOWNICKLIST)))
- break;
- if (si->iType == GCW_SERVER)
- break;
+ case IDC_CHAT_SHOWNICKLIST:
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_SHOWNICKLIST)))
+ break;
+ if (si->iType == GCW_SERVER)
+ break;
- si->bNicklistEnabled = !si->bNicklistEnabled;
+ si->bNicklistEnabled = !si->bNicklistEnabled;
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SHOWNICKLIST,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bNicklistEnabled?"chat_nicklist":"chat_nicklist2"));
- SendMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- break;
+ SendDlgItemMessage(hwndDlg,IDC_CHAT_SHOWNICKLIST,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bNicklistEnabled?"chat_nicklist":"chat_nicklist2"));
+ SendMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ break;
- case IDC_CHAT_MESSAGE:
- if (HIWORD(wParam) == EN_CHANGE) {
- si->windowData.cmdListCurrent = NULL;
- EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), si->windowData.codePage, FALSE) != 0);
- }
- break;
+ case IDC_CHAT_MESSAGE:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ si->windowData.cmdListCurrent = NULL;
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), si->windowData.codePage, FALSE) != 0);
+ }
+ break;
- case IDC_CHAT_SMILEY:
- {
- SMADD_SHOWSEL3 smaddInfo;
- RECT rc;
-
- GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_SMILEY), &rc);
-
- 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->windowData.hContact;
- CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo);
- }
- break;
+ case IDC_CHAT_SMILEY:
+ {
+ SMADD_SHOWSEL3 smaddInfo;
+ RECT rc;
+
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_SMILEY), &rc);
+
+ 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->windowData.hContact;
+ CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo);
+ }
+ break;
- case IDC_CHAT_HISTORY:
- {
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ case IDC_CHAT_HISTORY:
+ {
+ MODULEINFO * pInfo = MM_FindModule(si->pszModule);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_HISTORY)))
- break;
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_HISTORY)))
+ break;
- if ( pInfo )
- ShellExecute(hwndDlg, NULL, GetChatLogsFilename(si->windowData.hContact, 0), NULL, NULL, SW_SHOW);
- }
- break;
+ if ( pInfo )
+ ShellExecute(hwndDlg, NULL, GetChatLogsFilename(si->windowData.hContact, 0), NULL, NULL, SW_SHOW);
+ }
+ break;
- case IDC_CHAT_CHANMGR:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_CHANMGR)))
- break;
- DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
- break;
+ case IDC_CHAT_CHANMGR:
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_CHANMGR)))
+ break;
+ DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
+ break;
- case IDC_CHAT_FILTER:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_FILTER)))
- break;
+ case IDC_CHAT_FILTER:
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_FILTER)))
+ break;
- si->bFilterEnabled = !si->bFilterEnabled;
- SendDlgItemMessage(hwndDlg,IDC_CHAT_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bFilterEnabled?"chat_filter":"chat_filter2"));
- if (si->bFilterEnabled && DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0) {
- SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0);
- break;
- }
- SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
- break;
+ si->bFilterEnabled = !si->bFilterEnabled;
+ SendDlgItemMessage(hwndDlg,IDC_CHAT_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bFilterEnabled?"chat_filter":"chat_filter2"));
+ if (si->bFilterEnabled && DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0) {
+ SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0);
+ break;
+ }
+ SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
+ break;
- case IDC_CHAT_BKGCOLOR:
- {
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
- CHARFORMAT2 cf;
+ case IDC_CHAT_BKGCOLOR:
+ {
+ MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwEffects = 0;
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR)))
- break;
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR)))
+ break;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BKGCOLOR)) {
- if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
- SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_BKGCOLOR);
- else if (si->bBGSet){
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BKGCOLOR)) {
+ if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
+ SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_BKGCOLOR);
+ else if (si->bBGSet){
+ cf.dwMask = CFM_BACKCOLOR;
+ cf.crBackColor = pInfo->crColors[si->iBG];
+ if (pInfo->bSingleFormat) {
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
+ } else {
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ }
+ } }
+ else {
cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = pInfo->crColors[si->iBG];
+ cf.crBackColor = (COLORREF)DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
if (pInfo->bSingleFormat) {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
} else {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
- } }
- else {
- cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = (COLORREF)DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
- if (pInfo->bSingleFormat) {
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- } else {
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- } }
- break;
+ } }
+ break;
- case IDC_CHAT_COLOR:
- {
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
+ case IDC_CHAT_COLOR:
+ {
+ MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwEffects = 0;
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_COLOR)))
- break;
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_COLOR)))
+ break;
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_COLOR)) {
+ if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
+ SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_COLOR);
+ else if (si->bFGSet) {
+ cf.dwMask = CFM_COLOR;
+ cf.crTextColor = pInfo->crColors[si->iFG];
+ if (pInfo->bSingleFormat) {
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
+ } else {
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ }
+ } }
+ else {
+ COLORREF cr;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_COLOR)) {
- if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0)
- SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_COLOR);
- else if (si->bFGSet) {
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr, FALSE);
cf.dwMask = CFM_COLOR;
- cf.crTextColor = pInfo->crColors[si->iFG];
+ cf.crTextColor = cr;
if (pInfo->bSingleFormat) {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
} else {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
- } }
- else {
- COLORREF cr;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr, FALSE);
- cf.dwMask = CFM_COLOR;
- cf.crTextColor = cr;
+ } }
+ break;
+
+ case IDC_CHAT_BOLD:
+ case IDC_CHAT_ITALICS:
+ case IDC_CHAT_UNDERLINE:
+
+ {
+ MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE;
+ cf.dwEffects = 0;
+
+ if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_BOLD)))
+ break;
+ if (LOWORD(wParam) == IDC_CHAT_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_ITALICS)))
+ break;
+ if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_UNDERLINE)))
+ break;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BOLD))
+ cf.dwEffects |= CFE_BOLD;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_ITALICS))
+ cf.dwEffects |= CFE_ITALIC;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_UNDERLINE))
+ cf.dwEffects |= CFE_UNDERLINE;
if (pInfo->bSingleFormat) {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
} else {
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
-
- } }
- break;
-
- case IDC_CHAT_BOLD:
- case IDC_CHAT_ITALICS:
- case IDC_CHAT_UNDERLINE:
-
- {
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE;
- cf.dwEffects = 0;
-
- if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_BOLD)))
- break;
- if (LOWORD(wParam) == IDC_CHAT_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_ITALICS)))
- break;
- if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_UNDERLINE)))
- break;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BOLD))
- cf.dwEffects |= CFE_BOLD;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_ITALICS))
- cf.dwEffects |= CFE_ITALIC;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_UNDERLINE))
- cf.dwEffects |= CFE_UNDERLINE;
- if (pInfo->bSingleFormat) {
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- } else {
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
- }
- break;
+ break;
case IDCANCEL:
PostMessage(hwndDlg, WM_CLOSE, 0, 0);
- }
- break;
+ }
+ break;
- case WM_KEYDOWN:
- SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- break;
+ case WM_KEYDOWN:
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
+ break;
- case WM_GETMINMAXINFO:
- {
- MINMAXINFO* mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = si->iSplitterX + 43;
- if (mmi->ptMinTrackSize.x < 350)
- mmi->ptMinTrackSize.x = 350;
+ case WM_GETMINMAXINFO:
+ {
+ MINMAXINFO* mmi = (MINMAXINFO*)lParam;
+ mmi->ptMinTrackSize.x = si->iSplitterX + 43;
+ if (mmi->ptMinTrackSize.x < 350)
+ mmi->ptMinTrackSize.x = 350;
- mmi->ptMinTrackSize.y = si->windowData.minLogBoxHeight + TOOLBAR_HEIGHT + si->windowData.minEditBoxHeight + 5;
- }
- break;
+ mmi->ptMinTrackSize.y = si->windowData.minLogBoxHeight + TOOLBAR_HEIGHT + si->windowData.minEditBoxHeight + 5;
+ }
+ break;
case WM_LBUTTONDBLCLK:
if (LOWORD(lParam) < 30)
@@ -2120,7 +2095,7 @@ LABEL_SHOWWINDOW: mii.dwTypeData = TranslateTS((toolbarButtons[i].name));
InsertMenuItem(hToolbarMenu, i, TRUE, &mii);
}
-// TranslateMenu(hToolbarMenu);
+ // TranslateMenu(hToolbarMenu);
pt.x = (short) LOWORD(GetMessagePos());
pt.y = (short) HIWORD(GetMessagePos());
i = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
@@ -2150,27 +2125,20 @@ LABEL_SHOWWINDOW: }
break;
- case WM_CLOSE:
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- break;
+ case WM_CLOSE:
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
+ break;
- case GC_CLOSEWINDOW:
- DestroyWindow(hwndDlg);
- break;
+ case GC_CLOSEWINDOW:
+ DestroyWindow(hwndDlg);
+ break;
- case WM_DESTROY:
+ case WM_DESTROY:
NotifyLocalWinEvent(si->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING);
si->hWnd = NULL;
SetWindowLongPtr(hwndDlg,GWLP_USERDATA,0);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERY),GWLP_WNDPROC,(LONG_PTR)OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_LIST),GWLP_WNDPROC,(LONG_PTR)OldNicklistProc);
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE),GWLP_WNDPROC,(LONG_PTR)OldMessageProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_LOG),GWLP_WNDPROC,(LONG_PTR)OldLogProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_FILTER),GWLP_WNDPROC,(LONG_PTR)OldFilterButtonProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_COLOR),GWLP_WNDPROC,(LONG_PTR)OldFilterButtonProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR),GWLP_WNDPROC,(LONG_PTR)OldFilterButtonProc);
SendMessage(GetParent(hwndDlg), CM_REMOVECHILD, 0, (LPARAM) hwndDlg);
if (si->windowData.hwndLog != NULL) {
@@ -2183,6 +2151,6 @@ LABEL_SHOWWINDOW: NotifyLocalWinEvent(si->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE);
break;
- }
- return(FALSE);
+ }
+ return(FALSE);
}
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index aea89e4730..391a0ea16b 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -41,7 +41,6 @@ extern CREOleCallback reOleCallback, reOleCallback2; static void UpdateReadChars(HWND hwndDlg, struct SrmmWindowData * dat);
-static WNDPROC OldMessageEditProc, OldLogEditProc;
static ToolbarButton toolbarButtons[] = {
{LPGENT("Quote"), IDC_QUOTE, 0, 4, 24},
{LPGENT("Smiley"), IDC_SMILEYS, 0, 10, 24},
@@ -173,26 +172,26 @@ static BOOL IsUtfSendAvailable(HANDLE hContact) int RTL_Detect(WCHAR *pszwText)
{
- WORD *infoTypeC2;
- int i;
- int iLen = lstrlenW(pszwText);
+ WORD *infoTypeC2;
+ int i;
+ int iLen = lstrlenW(pszwText);
- infoTypeC2 = (WORD *)mir_alloc(sizeof(WORD) * (iLen + 2));
+ infoTypeC2 = (WORD *)mir_alloc(sizeof(WORD) * (iLen + 2));
- if (infoTypeC2) {
- ZeroMemory(infoTypeC2, sizeof(WORD) * (iLen + 2));
+ if (infoTypeC2) {
+ ZeroMemory(infoTypeC2, sizeof(WORD) * (iLen + 2));
- GetStringTypeW(CT_CTYPE2, pszwText, iLen, infoTypeC2);
+ GetStringTypeW(CT_CTYPE2, pszwText, iLen, infoTypeC2);
- for(i = 0; i < iLen; i++) {
- if (infoTypeC2[i] == C2_RIGHTTOLEFT) {
- mir_free(infoTypeC2);
- return 1;
- }
- }
- mir_free(infoTypeC2);
- }
- return 0;
+ for(i = 0; i < iLen; i++) {
+ if (infoTypeC2[i] == C2_RIGHTTOLEFT) {
+ mir_free(infoTypeC2);
+ return 1;
+ }
+ }
+ mir_free(infoTypeC2);
+ }
+ return 0;
}
static void AddToFileList(TCHAR ***pppFiles,int *totalCount,const TCHAR* szFilename)
@@ -215,7 +214,7 @@ static void AddToFileList(TCHAR ***pppFiles,int *totalCount,const TCHAR* szFilen lstrcat(szPath,fd.cFileName);
AddToFileList(pppFiles,totalCount,szPath);
}
- while( FindNextFile( hFind,&fd ));
+ while( FindNextFile( hFind,&fd ));
FindClose( hFind );
} } }
@@ -225,28 +224,27 @@ static void SetDialogToType(HWND hwndDlg) struct SrmmWindowData *dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
ParentWindowData *pdat = dat->parent;
- if (pdat->flags2 & SMF2_SHOWINFOBAR) {
+ if (pdat->flags2 & SMF2_SHOWINFOBAR)
ShowWindow(dat->infobarData->hWnd, SW_SHOW);
- } else {
+ else
ShowWindow(dat->infobarData->hWnd, SW_HIDE);
- }
+
if (dat->windowData.hContact) {
ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat->buttonVisibility, showToolbar ? SW_SHOW : SW_HIDE);
- if (!DBGetContactSettingByte(dat->windowData.hContact, "CList", "NotOnList", 0)) {
+ if (!DBGetContactSettingByte(dat->windowData.hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
- }
- if (!g_dat->smileyAddInstalled) {
+
+ if (!g_dat->smileyAddInstalled)
ShowWindow(GetDlgItem(hwndDlg, IDC_SMILEYS), SW_HIDE);
- }
- } else {
- ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat->buttonVisibility, SW_HIDE);
}
+ else ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat->buttonVisibility, SW_HIDE);
+
ShowWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), SW_SHOW);
- if (dat->windowData.hwndLog != NULL) {
+ if (dat->windowData.hwndLog != NULL)
ShowWindow (GetDlgItem(hwndDlg, IDC_LOG), SW_HIDE);
- } else {
+ else
ShowWindow (GetDlgItem(hwndDlg, IDC_LOG), SW_SHOW);
- }
+
ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SW_SHOW);
UpdateReadChars(hwndDlg, dat);
EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage, FALSE)?TRUE:FALSE);
@@ -254,36 +252,36 @@ static void SetDialogToType(HWND hwndDlg) SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
-
void SetStatusIcon(struct SrmmWindowData *dat) {
- if (dat->szProto != NULL) {
- char *szProto = dat->szProto;
- HANDLE hContact = dat->windowData.hContact;
-
- char* szMetaProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
- if ((INT_PTR)szMetaProto != CALLSERVICE_NOTFOUND && strcmp(dat->szProto, szMetaProto) == 0 &&
- DBGetContactSettingByte(NULL,"CLC","Meta",0) == 0) {
- hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)dat->windowData.hContact, 0);
- if (hContact != NULL)
- szProto = GetContactProto(hContact);
- else
- hContact = dat->windowData.hContact;
- }
+ if (dat->szProto == NULL)
+ return;
- Skin_ReleaseIcon(dat->statusIcon);
- dat->statusIcon = LoadSkinnedProtoIcon(szProto, dat->wStatus);
+ char *szProto = dat->szProto;
+ HANDLE hContact = dat->windowData.hContact;
- Skin_ReleaseIcon(dat->statusIconBig);
- dat->statusIconBig = LoadSkinnedProtoIconBig(szProto, dat->wStatus);
- if ((int)dat->statusIconBig == CALLSERVICE_NOTFOUND) {
- dat->statusIconBig = NULL;
- }
- if (dat->statusIconOverlay != NULL) DestroyIcon(dat->statusIconOverlay);
- {
- int index = ImageList_ReplaceIcon(g_dat->hHelperIconList, 0, dat->statusIcon);
- dat->statusIconOverlay = ImageList_GetIcon(g_dat->hHelperIconList, index, ILD_TRANSPARENT|INDEXTOOVERLAYMASK(1));
- }
+ char* szMetaProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
+ if ((INT_PTR)szMetaProto != CALLSERVICE_NOTFOUND && strcmp(dat->szProto, szMetaProto) == 0 &&
+ DBGetContactSettingByte(NULL,"CLC","Meta",0) == 0) {
+ hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)dat->windowData.hContact, 0);
+ if (hContact != NULL)
+ szProto = GetContactProto(hContact);
+ else
+ hContact = dat->windowData.hContact;
}
+
+ Skin_ReleaseIcon(dat->statusIcon);
+ dat->statusIcon = LoadSkinnedProtoIcon(szProto, dat->wStatus);
+
+ Skin_ReleaseIcon(dat->statusIconBig);
+ dat->statusIconBig = LoadSkinnedProtoIconBig(szProto, dat->wStatus);
+ if ((int)dat->statusIconBig == CALLSERVICE_NOTFOUND)
+ dat->statusIconBig = NULL;
+
+ if (dat->statusIconOverlay != NULL)
+ DestroyIcon(dat->statusIconOverlay);
+
+ int index = ImageList_ReplaceIcon(g_dat->hHelperIconList, 0, dat->statusIcon);
+ dat->statusIconOverlay = ImageList_GetIcon(g_dat->hHelperIconList, index, ILD_TRANSPARENT|INDEXTOOVERLAYMASK(1));
}
void GetTitlebarIcon(struct SrmmWindowData *dat, TitleBarData *tbd) {
@@ -300,15 +298,14 @@ void GetTitlebarIcon(struct SrmmWindowData *dat, TitleBarData *tbd) { }
HICON GetTabIcon(struct SrmmWindowData *dat) {
- if (dat->showTyping) {
+ if (dat->showTyping)
return GetCachedIcon("scriver_TYPING");
- } else if (dat->showUnread != 0) {
+ if (dat->showUnread != 0)
return dat->statusIconOverlay;
- }
+
return dat->statusIcon;
}
-
struct MsgEditSubclassData
{
DWORD lastEnterTime;
@@ -396,7 +393,7 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return TRUE;
}
}
- return CallWindowProc(OldLogEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, LogEditSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -449,21 +446,21 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar SendMessage(hwnd, WM_PASTE, 0, 0);
return 0;
}
-
}
break;
//fall through
case WM_MOUSEWHEEL:
- if ((GetWindowLongPtr(hwnd, GWL_STYLE) & WS_VSCROLL) == 0) {
+ if ((GetWindowLongPtr(hwnd, GWL_STYLE) & WS_VSCROLL) == 0)
SendMessage(GetDlgItem(GetParent(hwnd), IDC_LOG), WM_MOUSEWHEEL, wParam, lParam);
- }
break;
+
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_KILLFOCUS:
dat->lastEnterTime = 0;
break;
+
case WM_SYSCHAR:
dat->lastEnterTime = 0;
if ((wParam == 's' || wParam == 'S') && isAlt) {
@@ -495,27 +492,25 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar mir_free(dat);
return 0;
}
- return CallWindowProc(OldMessageEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
static void SubclassMessageEdit(HWND hwnd) {
- OldMessageEditProc = (WNDPROC) SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) MessageEditSubclassProc);
+ mir_subclassWindow(hwnd, MessageEditSubclassProc);
SendMessage(hwnd, EM_SUBCLASSED, 0, 0);
}
static void UnsubclassMessageEdit(HWND hwnd) {
SendMessage(hwnd, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) OldMessageEditProc);
}
static void SubclassLogEdit(HWND hwnd) {
- OldLogEditProc = (WNDPROC) SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) LogEditSubclassProc);
+ mir_subclassWindow(hwnd, LogEditSubclassProc);
SendMessage(hwnd, EM_SUBCLASSED, 0, 0);
}
static void UnsubclassLogEdit(HWND hwnd) {
SendMessage(hwnd, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) OldLogEditProc);
}
static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, int h) {
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index 4003851adf..93b08a0085 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -35,20 +35,18 @@ extern ITaskbarList3 * pTaskbarInterface; #define TIMERID_FLASHWND 1
#define TIMEOUT_FLASHWND 900
-static WNDPROC OldTabCtrlProc;
-static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lParam);
-BOOL CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lParam);
+LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
extern TCHAR *GetNickname(HANDLE hContact, const char* szProto);
void SubclassTabCtrl(HWND hwnd) {
- OldTabCtrlProc = (WNDPROC) SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) TabCtrlProc);
+ mir_subclassWindow(hwnd, TabCtrlProc);
SendMessage(hwnd, EM_SUBCLASSED, 0, 0);
}
void UnsubclassTabCtrl(HWND hwnd) {
SendMessage(hwnd, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) OldTabCtrlProc);
}
static const TCHAR *titleTokenNames[] = {_T("%name%"), _T("%status%"), _T("%statusmsg%"), _T("%account%")};
@@ -1278,7 +1276,7 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar }
}
-BOOL CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
TabCtrlData *dat;
dat = (TabCtrlData *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
@@ -1570,10 +1568,9 @@ BOOL CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) mir_free(dat);
return 0;
}
- return CallWindowProc(OldTabCtrlProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, TabCtrlProc, msg, wParam, lParam);
}
-
int ScriverRestoreWindowPosition(HWND hwnd,HANDLE hContact,const char *szModule,const char *szNamePrefix, int flags, int showCmd)
{
RECT rcDesktop;
diff --git a/plugins/Scriver/src/richutil.cpp b/plugins/Scriver/src/richutil.cpp index 4336b7dbe9..d5fe537adb 100644 --- a/plugins/Scriver/src/richutil.cpp +++ b/plugins/Scriver/src/richutil.cpp @@ -107,8 +107,7 @@ void RichUtil_Unload(void) int RichUtil_SubClass(HWND hwndEdit)
{
- if (IsWindow(hwndEdit))
- {
+ if (IsWindow(hwndEdit)) {
int idx;
TRichUtil *ru = (TRichUtil*)mir_calloc(sizeof(TRichUtil));
@@ -121,7 +120,7 @@ int RichUtil_SubClass(HWND hwndEdit) List_Insert(&sListInt, ru, idx);
LeaveCriticalSection(&csRich);
- ru->origProc = (WNDPROC)SetWindowLongPtr(ru->hwnd, GWLP_WNDPROC, (LONG_PTR)&RichUtil_Proc);
+ mir_subclassWindow(ru->hwnd, RichUtil_Proc);
RichUtil_ClearUglyBorder(ru);
return 1;
}
@@ -132,6 +131,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
TRichUtil *ru = NULL, tru;
int idx;
+ LRESULT ret;
tru.hwnd = hwnd;
@@ -140,72 +140,64 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ru = (TRichUtil*)sListInt.items[idx];
LeaveCriticalSection(&csRich);
- switch(msg)
- {
- case WM_THEMECHANGED:
- case WM_STYLECHANGED:
- {
- RichUtil_ClearUglyBorder(ru);
- break;
- }
+ switch(msg) {
+ case WM_THEMECHANGED:
+ case WM_STYLECHANGED:
+ RichUtil_ClearUglyBorder(ru);
+ break;
- case WM_NCPAINT:
+ case WM_NCPAINT:
+ ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
+ if (ru->hasUglyBorder && MyIsThemeActive())
{
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
- if (ru->hasUglyBorder && MyIsThemeActive())
+ HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT");
+
+ if (hTheme)
{
- HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT");
-
- if (hTheme)
- {
- RECT rcBorder;
- RECT rcClient;
- int nState;
- HDC hdc = GetWindowDC(ru->hwnd);
-
- GetWindowRect(hwnd, &rcBorder);
- rcBorder.right -= rcBorder.left; rcBorder.bottom -= rcBorder.top;
- rcBorder.left = rcBorder.top = 0;
- CopyRect(&rcClient, &rcBorder);
- rcClient.left += ru->rect.left;
- rcClient.top += ru->rect.top;
- rcClient.right -= ru->rect.right;
- rcClient.bottom -= ru->rect.bottom;
- ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
-
- if (MyIsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
- MyDrawThemeParentBackground(hwnd, hdc, &rcBorder);
-
- if (!IsWindowEnabled(hwnd))
- nState = ETS_DISABLED;
- else if (SendMessage(hwnd, EM_GETOPTIONS, 0, 0) & ECO_READONLY)
- nState = ETS_READONLY;
- else nState = ETS_NORMAL;
-
- MyDrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL);
- MyCloseThemeData(hTheme);
- ReleaseDC(hwnd, hdc);
- return 0;
- }
+ RECT rcBorder;
+ RECT rcClient;
+ int nState;
+ HDC hdc = GetWindowDC(ru->hwnd);
+
+ GetWindowRect(hwnd, &rcBorder);
+ rcBorder.right -= rcBorder.left; rcBorder.bottom -= rcBorder.top;
+ rcBorder.left = rcBorder.top = 0;
+ CopyRect(&rcClient, &rcBorder);
+ rcClient.left += ru->rect.left;
+ rcClient.top += ru->rect.top;
+ rcClient.right -= ru->rect.right;
+ rcClient.bottom -= ru->rect.bottom;
+ ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
+
+ if (MyIsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
+ MyDrawThemeParentBackground(hwnd, hdc, &rcBorder);
+
+ if (!IsWindowEnabled(hwnd))
+ nState = ETS_DISABLED;
+ else if (SendMessage(hwnd, EM_GETOPTIONS, 0, 0) & ECO_READONLY)
+ nState = ETS_READONLY;
+ else nState = ETS_NORMAL;
+
+ MyDrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL);
+ MyCloseThemeData(hTheme);
+ ReleaseDC(hwnd, hdc);
+ return 0;
}
- return ret;
}
- case WM_NCCALCSIZE:
+ return ret;
+
+ case WM_NCCALCSIZE:
{
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS*)lParam;
- if (ru->hasUglyBorder && MyIsThemeActive())
- {
+ if (ru->hasUglyBorder && MyIsThemeActive()) {
HANDLE hTheme = MyOpenThemeData(hwnd, L"EDIT");
-
- if (hTheme)
- {
+ if (hTheme) {
RECT rcClient ={0};
HDC hdc = GetDC(GetParent(hwnd));
- if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK)
- {
+ if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) {
ru->rect.left = rcClient.left-ncsParam->rgrc[0].left;
ru->rect.top = rcClient.top-ncsParam->rgrc[0].top;
ru->rect.right = ncsParam->rgrc[0].right-rcClient.right;
@@ -220,44 +212,36 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM MyCloseThemeData(hTheme);
}
}
- return ret;
}
+ return ret;
- case WM_ENABLE:
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
- break;
-
- case WM_GETDLGCODE:
- return CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam) & ~DLGC_HASSETSEL;
+ case WM_ENABLE:
+ RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
+ break;
- case WM_NCDESTROY:
- {
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ case WM_GETDLGCODE:
+ return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam) & ~DLGC_HASSETSEL;
- if (IsWindow(hwnd))
- {
- if ((WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC) == &RichUtil_Proc)
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)ru->origProc);
- }
+ case WM_NCDESTROY:
+ ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
- EnterCriticalSection(&csRich);
- List_Remove(&sListInt, idx);
- LeaveCriticalSection(&csRich);
+ EnterCriticalSection(&csRich);
+ List_Remove(&sListInt, idx);
+ LeaveCriticalSection(&csRich);
- mir_free(ru);
- return ret;
- }
+ mir_free(ru);
+ return ret;
}
- return (ru == NULL) ? 0 : CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
}
static void RichUtil_ClearUglyBorder(TRichUtil *ru)
{
- if (mTheme && MyIsThemeActive() && GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) & WS_EX_STATICEDGE)
- {
+ if (mTheme && MyIsThemeActive() && GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) & WS_EX_STATICEDGE) {
ru->hasUglyBorder = 1;
SetWindowLongPtr(ru->hwnd, GWL_EXSTYLE, GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) ^ WS_EX_STATICEDGE);
}
+
// Redraw window since the style may have changed
SetWindowPos(ru->hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
RedrawWindow(ru->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
diff --git a/plugins/Scriver/src/richutil.h b/plugins/Scriver/src/richutil.h index 75ecea16a3..07d8e06329 100644 --- a/plugins/Scriver/src/richutil.h +++ b/plugins/Scriver/src/richutil.h @@ -30,7 +30,6 @@ typedef struct { HWND hwnd;
RECT rect;
int hasUglyBorder;
- WNDPROC origProc;
} TRichUtil;
void RichUtil_Load();
diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp index 3bae7a700e..c407cb1445 100644 --- a/plugins/SeenPlugin/src/userinfo.cpp +++ b/plugins/SeenPlugin/src/userinfo.cpp @@ -24,25 +24,17 @@ Last change by : $Author: y_b $ */
#include "seen.h"
-
-
-WNDPROC MainProc;
-
-
-
extern HINSTANCE hInstance;
extern DWORD dwmirver;
-
-
-BOOL CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
+LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg){
case WM_SETCURSOR:
SetCursor(LoadCursor(NULL,IDC_ARROW));
return 1;
}
- return CallWindowProc(MainProc,hdlg,msg,wparam,lparam);
+ return mir_callNextSubclass(hdlg, EditProc, msg, wparam, lparam);
}
INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
@@ -51,7 +43,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) switch(msg) {
case WM_INITDIALOG:
- MainProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hdlg, IDC_INFOTEXT),GWLP_WNDPROC,(LONG)EditProc);
+ mir_subclassWindow( GetDlgItem(hdlg, IDC_INFOTEXT), EditProc);
{
TCHAR *szout;
if ( !DBGetContactSettingTString(NULL, S_MOD, "UserStamp", &dbv)) {
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index 756aeeee44..e2a2ac8f05 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -25,8 +25,6 @@ HICON hMarked,hNotMarked; HWND hComboBox=NULL;
HWND hComboBoxEdit=NULL;
-WNDPROC oldComboProc=0;
-
HWND hOpClistControl=NULL;
static BOOL bOptionsInit;
@@ -153,20 +151,19 @@ static LRESULT CALLBACK ComboBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_NCHITTEST:
{
- LRESULT lr = CallWindowProc( oldComboProc, hwnd, msg, wParam, lParam );
+ LRESULT lr = mir_callNextSubclass(hwnd, ComboBoxSubclassProc, msg, wParam, lParam );
if(lr==HTNOWHERE )
lr = HTOBJECT;
return lr;
}
}
- return CallWindowProc(oldComboProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ComboBoxSubclassProc, msg, wParam, lParam);
}
INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
- switch(msg)
- {
- case WM_INITDIALOG:
+ switch(msg) {
+ case WM_INITDIALOG:
{
int startupmode,exitmode;
COMBOBOXINFO cbi={0};
@@ -178,7 +175,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) TranslateDialogDefault(hdlg);
hMarked = Skin_GetIconByHandle(iconList[1].hIcolib);
hNotMarked = Skin_GetIconByHandle(iconList[2].hIcolib);
-
+
hIcon=(bChecked=IsMarkedUserDefSession(opses_count))?hMarked:hNotMarked;
SetDlgItemInt(hdlg, IDC_TRACK,ses_limit=DBGetContactSettingByte(0, __INTERNAL_NAME, "TrackCount", 10), FALSE);
@@ -189,17 +186,17 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) SetDlgItemInt(hdlg, IDC_STARTDELAY, DBGetContactSettingWord(NULL, __INTERNAL_NAME, "StartupModeDelay", 1500), FALSE);
startupmode = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "StartupMode", 3);
exitmode = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "ShutdownMode", 2);
-
+
g_bExclHidden = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "ExclHidden", 0);
g_bWarnOnHidden = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "WarnOnHidden", 0);
g_bOtherWarnings = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "OtherWarnings", 1);
g_bCrashRecovery = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "CrashRecovery", 0);
-
+
CheckDlgButton(hdlg,IDC_EXCLHIDDEN,g_bExclHidden?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hdlg,IDC_LASTHIDDENWARN,g_bWarnOnHidden?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hdlg,IDC_WARNINGS,g_bOtherWarnings?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hdlg,IDC_CRASHRECOVERY,g_bCrashRecovery?BST_CHECKED:BST_UNCHECKED);
-
+
if(startupmode==1)
CheckDlgButton(hdlg,IDC_STARTDIALOG,BST_CHECKED);
@@ -242,7 +239,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) }
GetComboBoxInfo(GetDlgItem(hdlg,IDC_LIST),&cbi);
- oldComboProc=(WNDPROC)SetWindowLongPtr(cbi.hwndItem, GWLP_WNDPROC, (LONG) ComboBoxSubclassProc);
+ mir_subclassWindow(cbi.hwndItem, ComboBoxSubclassProc);
hComboBoxEdit=cbi.hwndItem;
hComboBox=cbi.hwndCombo;
@@ -252,158 +249,144 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) bOptionsInit=FALSE;
}break;
- case WM_CTLCOLORLISTBOX:
- {
- switch(GetDlgCtrlID((HWND) lparam))
- {
- case IDC_OPCLIST:
- SetBkMode((HDC) wparam, TRANSPARENT);
- return (BOOL) CreateSolidBrush(GetSysColor(COLOR_3DFACE));
- default:
- break;
- }
- }break;
+ case WM_CTLCOLORLISTBOX:
+ switch(GetDlgCtrlID((HWND) lparam)) {
+ case IDC_OPCLIST:
+ SetBkMode((HDC) wparam, TRANSPARENT);
+ return (BOOL) CreateSolidBrush(GetSysColor(COLOR_3DFACE));
+ }
+ break;
- case WM_NOTIFY:
- switch(((LPNMHDR)lparam)->code)
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lparam)->code) {
+ case PSN_APPLY:
{
- case PSN_APPLY:
- {
- int iDelay=GetDlgItemInt(hdlg, IDC_STARTDELAY,NULL, FALSE);
- DBWriteContactSettingWord(0, __INTERNAL_NAME, "StartupModeDelay", (WORD)iDelay);
-
- DBWriteContactSettingByte(0, __INTERNAL_NAME, "TrackCount", (BYTE)(ses_limit=GetDlgItemInt(hdlg, IDC_TRACK,NULL, FALSE)));
- if(IsDlgButtonChecked(hdlg, IDC_REXSAVE)) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "ShutdownMode", 2);
- else if(IsDlgButtonChecked(hdlg, IDC_REXDSAVE)) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "ShutdownMode", 0);
- else if(IsDlgButtonChecked(hdlg, IDC_REXASK)) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "ShutdownMode", 1);
-
- if(IsDlgButtonChecked(hdlg, IDC_STARTDIALOG))
- {
- if (!IsDlgButtonChecked(hdlg, IDC_CHECKLAST))
- DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "StartupMode", 1);
- else DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "StartupMode", 3);
- }
- else if(IsDlgButtonChecked(hdlg, IDC_RLOADLAST)) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "StartupMode", 2);
- else if(IsDlgButtonChecked(hdlg, IDC_RNOTHING)) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "StartupMode", 0);
-
- DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "ExclHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_EXCLHIDDEN) ? (g_bExclHidden = 1) : (g_bExclHidden = 0)));
- DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "WarnOnHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_LASTHIDDENWARN) ? (g_bWarnOnHidden = 1) : (g_bWarnOnHidden = 0)));
- DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "OtherWarnings", (BYTE)(IsDlgButtonChecked(hdlg, IDC_WARNINGS) ? (g_bOtherWarnings = 1) : (g_bOtherWarnings = 0)));
- DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "CrashRecovery", (BYTE)(IsDlgButtonChecked(hdlg, IDC_CRASHRECOVERY) ? (g_bCrashRecovery = 1) : (g_bCrashRecovery = 0)));
-
- return 1;
+ int iDelay=GetDlgItemInt(hdlg, IDC_STARTDELAY,NULL, FALSE);
+ DBWriteContactSettingWord(0, __INTERNAL_NAME, "StartupModeDelay", (WORD)iDelay);
+
+ DBWriteContactSettingByte(0, __INTERNAL_NAME, "TrackCount", (BYTE)(ses_limit=GetDlgItemInt(hdlg, IDC_TRACK,NULL, FALSE)));
+ if(IsDlgButtonChecked(hdlg, IDC_REXSAVE)) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "ShutdownMode", 2);
+ else if(IsDlgButtonChecked(hdlg, IDC_REXDSAVE)) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "ShutdownMode", 0);
+ else if(IsDlgButtonChecked(hdlg, IDC_REXASK)) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "ShutdownMode", 1);
+
+ if(IsDlgButtonChecked(hdlg, IDC_STARTDIALOG))
+ {
+ if (!IsDlgButtonChecked(hdlg, IDC_CHECKLAST))
+ DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "StartupMode", 1);
+ else DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "StartupMode", 3);
}
+ else if(IsDlgButtonChecked(hdlg, IDC_RLOADLAST)) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "StartupMode", 2);
+ else if(IsDlgButtonChecked(hdlg, IDC_RNOTHING)) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "StartupMode", 0);
- case CLN_CHECKCHANGED:
- {
- if (((LPNMHDR)lparam)->idFrom ==IDC_EMCLIST)
- {
- int iSelection = (int)((NMCLISTCONTROL *)lparam)->hItem;
- HANDLE hContact = db_find_first();
- for ( ; hContact; hContact = db_find_next(hContact))
- if (SendDlgItemMessage(hdlg, IDC_EMCLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0) == iSelection)
- break;
- if (hContact)
- EnableWindow(GetDlgItem(hdlg,IDC_SAVE),TRUE);
- else
- EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE);
- }
- }
+ DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "ExclHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_EXCLHIDDEN) ? (g_bExclHidden = 1) : (g_bExclHidden = 0)));
+ DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "WarnOnHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_LASTHIDDENWARN) ? (g_bWarnOnHidden = 1) : (g_bWarnOnHidden = 0)));
+ DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "OtherWarnings", (BYTE)(IsDlgButtonChecked(hdlg, IDC_WARNINGS) ? (g_bOtherWarnings = 1) : (g_bOtherWarnings = 0)));
+ DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "CrashRecovery", (BYTE)(IsDlgButtonChecked(hdlg, IDC_CRASHRECOVERY) ? (g_bCrashRecovery = 1) : (g_bCrashRecovery = 0)));
+
+ return 1;
}
- break;
- case WM_COMMAND:
- switch(LOWORD(wparam))
+ case CLN_CHECKCHANGED:
+ if (((LPNMHDR)lparam)->idFrom ==IDC_EMCLIST)
{
- case IDC_LIST:
- switch(HIWORD(wparam))
- {
- case CBN_EDITCHANGE:
- EnableWindow(GetDlgItem(hdlg,IDC_SAVE),TRUE);
- bSesssionNameChanged=TRUE;
- break;
-
- case CBN_SELCHANGE:
- {
- HWND hCombo = GetDlgItem(hdlg, IDC_LIST);
- int index = SendMessage(hCombo, CB_GETCURSEL, 0, 0);
- if(index != CB_ERR)
- {
- opses_count = SendMessage(hCombo, CB_GETITEMDATA, (WPARAM)index, 0);
- SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
- if(IsMarkedUserDefSession(opses_count))
- {
- hIcon=hMarked;
- bChecked=TRUE;
- RedrawWindow(hComboBoxEdit, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME);
- }
- else
- {
- hIcon=hNotMarked;
- bChecked=FALSE;
- RedrawWindow(hComboBoxEdit, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME);
- }
- OpLoadSessionContacts(0,opses_count);
- if (!hOpClistControl)
- EnableWindow(GetDlgItem(hdlg,IDC_DEL),TRUE);
- else
- {
- int i;
- HANDLE hContact = db_find_first();
-
- for ( ; hContact; hContact = db_find_next(hContact))
- SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hContact,0);
- for (i=0 ; session_list_t[i]>0; i++)
- {
- hContact=(HANDLE)SendMessage(hOpClistControl,CLM_FINDCONTACT, (WPARAM)session_list_t[i], 0);
- //hItem=session_list[i];
- SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hContact,1);
- }
- EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE);
- }
- }
- }break;
- }break;
+ int iSelection = (int)((NMCLISTCONTROL *)lparam)->hItem;
+ HANDLE hContact = db_find_first();
+ for ( ; hContact; hContact = db_find_next(hContact))
+ if (SendDlgItemMessage(hdlg, IDC_EMCLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0) == iSelection)
+ break;
+ if (hContact)
+ EnableWindow(GetDlgItem(hdlg,IDC_SAVE),TRUE);
+ else
+ EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE);
+ }
+ }
+ break;
+
+ case WM_COMMAND:
+ switch(LOWORD(wparam)) {
+ case IDC_LIST:
+ switch(HIWORD(wparam)) {
+ case CBN_EDITCHANGE:
+ EnableWindow(GetDlgItem(hdlg,IDC_SAVE),TRUE);
+ bSesssionNameChanged=TRUE;
+ break;
- case IDC_EDIT:
+ case CBN_SELCHANGE:
{
- if (!hOpClistControl)
- {
- int i;
- HANDLE hItem;
- ShowWindow(GetDlgItem(hdlg,IDC_OPCLIST),SW_HIDE);
- EnableWindow(GetDlgItem(hdlg,IDC_DEL),FALSE);
- //EnableWindow(GetDlgItem(hdlg,IDC_SAVE),TRUE);
- SetWindowText(GetDlgItem(hdlg,IDC_EDIT),TranslateT("View"));
- hOpClistControl = CreateWindowEx(WS_EX_STATICEDGE, _T(CLISTCONTROL_CLASS), _T(""),
- WS_TABSTOP |WS_VISIBLE | WS_CHILD ,
- 14,198,161,163,hdlg, (HMENU)IDC_EMCLIST, hinstance, 0);
-
- SetWindowLongPtr(hOpClistControl, GWL_STYLE,
- GetWindowLongPtr(hOpClistControl, GWL_STYLE)|CLS_CHECKBOXES|CLS_HIDEEMPTYGROUPS|CLS_USEGROUPS|CLS_GREYALTERNATE|CLS_GROUPCHECKBOXES);
- SendMessage(hOpClistControl, CLM_SETEXSTYLE, CLS_EX_DISABLEDRAGDROP|CLS_EX_TRACKSELECT, 0);
-
- SendMessage(hOpClistControl,WM_TIMER,TIMERID_REBUILDAFTER,0);
-
- for (i=0 ; session_list_t[i]>0; i++)
- {
- hItem=(HANDLE)SendMessage(hOpClistControl,CLM_FINDCONTACT, (WPARAM)session_list_t[i], 0);
- //hItem=session_list[i];
- SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hItem,1);
- }
- }
- else
- {
- ShowWindow(GetDlgItem(hdlg,IDC_OPCLIST),SW_SHOWNA);
- EnableWindow(GetDlgItem(hdlg,IDC_DEL),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE);
- SetWindowText(GetDlgItem(hdlg,IDC_EDIT),TranslateT("Edit"));
- DestroyWindow(hOpClistControl);
- hOpClistControl=NULL;
+ HWND hCombo = GetDlgItem(hdlg, IDC_LIST);
+ int index = SendMessage(hCombo, CB_GETCURSEL, 0, 0);
+ if(index != CB_ERR) {
+ opses_count = SendMessage(hCombo, CB_GETITEMDATA, (WPARAM)index, 0);
+ SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
+ if(IsMarkedUserDefSession(opses_count)) {
+ hIcon=hMarked;
+ bChecked=TRUE;
+ RedrawWindow(hComboBoxEdit, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME);
+ }
+ else {
+ hIcon=hNotMarked;
+ bChecked=FALSE;
+ RedrawWindow(hComboBoxEdit, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME);
+ }
+ OpLoadSessionContacts(0,opses_count);
+ if (!hOpClistControl)
+ EnableWindow(GetDlgItem(hdlg,IDC_DEL),TRUE);
+ else {
+ int i;
+ HANDLE hContact = db_find_first();
+
+ for ( ; hContact; hContact = db_find_next(hContact))
+ SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hContact,0);
+ for (i=0 ; session_list_t[i]>0; i++)
+ {
+ hContact=(HANDLE)SendMessage(hOpClistControl,CLM_FINDCONTACT, (WPARAM)session_list_t[i], 0);
+ //hItem=session_list[i];
+ SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hContact,1);
+ }
+ EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE);
+ }
}
}break;
+ }break;
+
+ case IDC_EDIT:
+ if (!hOpClistControl)
+ {
+ int i;
+ HANDLE hItem;
+ ShowWindow(GetDlgItem(hdlg,IDC_OPCLIST),SW_HIDE);
+ EnableWindow(GetDlgItem(hdlg,IDC_DEL),FALSE);
+ //EnableWindow(GetDlgItem(hdlg,IDC_SAVE),TRUE);
+ SetWindowText(GetDlgItem(hdlg,IDC_EDIT),TranslateT("View"));
+ hOpClistControl = CreateWindowEx(WS_EX_STATICEDGE, _T(CLISTCONTROL_CLASS), _T(""),
+ WS_TABSTOP |WS_VISIBLE | WS_CHILD ,
+ 14,198,161,163,hdlg, (HMENU)IDC_EMCLIST, hinstance, 0);
+
+ SetWindowLongPtr(hOpClistControl, GWL_STYLE,
+ GetWindowLongPtr(hOpClistControl, GWL_STYLE)|CLS_CHECKBOXES|CLS_HIDEEMPTYGROUPS|CLS_USEGROUPS|CLS_GREYALTERNATE|CLS_GROUPCHECKBOXES);
+ SendMessage(hOpClistControl, CLM_SETEXSTYLE, CLS_EX_DISABLEDRAGDROP|CLS_EX_TRACKSELECT, 0);
+
+ SendMessage(hOpClistControl,WM_TIMER,TIMERID_REBUILDAFTER,0);
+
+ for (i=0 ; session_list_t[i]>0; i++)
+ {
+ hItem=(HANDLE)SendMessage(hOpClistControl,CLM_FINDCONTACT, (WPARAM)session_list_t[i], 0);
+ //hItem=session_list[i];
+ SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hItem,1);
+ }
+ }
+ else
+ {
+ ShowWindow(GetDlgItem(hdlg,IDC_OPCLIST),SW_SHOWNA);
+ EnableWindow(GetDlgItem(hdlg,IDC_DEL),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE);
+ SetWindowText(GetDlgItem(hdlg,IDC_EDIT),TranslateT("Edit"));
+ DestroyWindow(hOpClistControl);
+ hOpClistControl=NULL;
+ }
+ break;
- case IDC_SAVE:
+ case IDC_SAVE:
{
int i;
HANDLE hContact = db_find_first();
@@ -423,10 +406,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) SetInSessionOrder(hContact,1,opses_count,0);
}
}
- if(bSesssionNameChanged)
- {
- if(GetWindowTextLength(hComboBoxEdit))
- {
+ if(bSesssionNameChanged) {
+ if(GetWindowTextLength(hComboBoxEdit)) {
TCHAR szUserSessionName[MAX_PATH]={'\0'};
GetWindowText(hComboBoxEdit, szUserSessionName, SIZEOF(szUserSessionName));
RenameUserDefSession(opses_count,szUserSessionName);
@@ -438,11 +419,11 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE);
}break;
- case IDC_DEL:
+ case IDC_DEL:
{
int i=0,index=0;
DelUserDefSession(opses_count);
-
+
SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hdlg, IDC_LIST, CB_RESETCONTENT, 0, 0);
@@ -450,113 +431,98 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) opses_count=0;
- if(SendDlgItemMessage(hdlg, IDC_LIST, CB_GETCOUNT, 0, 0))
- {
+ if(SendDlgItemMessage(hdlg, IDC_LIST, CB_GETCOUNT, 0, 0)) {
EnableWindow(GetDlgItem(hdlg,IDC_EDIT),TRUE);
SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, 0, 0);
if (!OpLoadSessionContacts(0,opses_count))
EnableWindow(GetDlgItem(hdlg,IDC_DEL),FALSE);
}
- else
- {
+ else {
EnableWindow(GetDlgItem(hdlg,IDC_EDIT),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_DEL),FALSE);
}
}break;
- case IDC_STARTDIALOG:
- {
- EnableWindow(GetDlgItem(hdlg, IDC_STARTDELAY), TRUE);
- EnableWindow(GetDlgItem(hdlg, IDC_STATICOP), TRUE);
- EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), TRUE);
- EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), TRUE);
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- }break;
-
- case IDC_RLOADLAST:
- {
- EnableWindow(GetDlgItem(hdlg, IDC_STARTDELAY), TRUE);
- EnableWindow(GetDlgItem(hdlg, IDC_STATICOP), TRUE);
- EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), TRUE);
- EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), FALSE);
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- }break;
-
- case IDC_RNOTHING:
- {
- EnableWindow(GetDlgItem(hdlg, IDC_STARTDELAY), FALSE);
- EnableWindow(GetDlgItem(hdlg, IDC_STATICOP), FALSE);
- EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), FALSE);
- EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), FALSE);
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- }break;
-
- case IDC_REXSAVE:
- {
- EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC2),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_TRACK),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_SPIN1),TRUE);
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- }break;
+ case IDC_STARTDIALOG:
+ EnableWindow(GetDlgItem(hdlg, IDC_STARTDELAY), TRUE);
+ EnableWindow(GetDlgItem(hdlg, IDC_STATICOP), TRUE);
+ EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), TRUE);
+ EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), TRUE);
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ break;
- case IDC_REXDSAVE:
- {
- EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC2),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_TRACK),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_SPIN1),FALSE);
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- }break;
+ case IDC_RLOADLAST:
+ EnableWindow(GetDlgItem(hdlg, IDC_STARTDELAY), TRUE);
+ EnableWindow(GetDlgItem(hdlg, IDC_STATICOP), TRUE);
+ EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), TRUE);
+ EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), FALSE);
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ break;
- case IDC_REXASK:
- {
- EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC2),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_TRACK),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_SPIN1),TRUE);
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- }break;
+ case IDC_RNOTHING:
+ EnableWindow(GetDlgItem(hdlg, IDC_STARTDELAY), FALSE);
+ EnableWindow(GetDlgItem(hdlg, IDC_STATICOP), FALSE);
+ EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), FALSE);
+ EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), FALSE);
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ break;
+
+ case IDC_REXSAVE:
+ EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC2),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_TRACK),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_SPIN1),TRUE);
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ break;
+
+ case IDC_REXDSAVE:
+ EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC2),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_TRACK),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_SPIN1),FALSE);
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ break;
+
+ case IDC_REXASK:
+ EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC2),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_TRACK),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_SPIN1),TRUE);
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ break;
}
- if (HIWORD(wparam)==CBN_DROPDOWN&&!hOpClistControl)
- {
+ if (HIWORD(wparam)==CBN_DROPDOWN&&!hOpClistControl) {
SendMessage(hComboBoxEdit,EM_SETSEL ,0,0);
SendMessage(hComboBoxEdit,EM_SCROLLCARET ,0,0);
SendMessage(hComboBoxEdit,WM_KILLFOCUS ,0,0);
HideCaret(hComboBoxEdit);
}
- if ((HIWORD(wparam)!=CBN_DROPDOWN)&&(LOWORD(wparam)==IDC_LIST)&&!hOpClistControl)
- {
+ if ((HIWORD(wparam)!=CBN_DROPDOWN)&&(LOWORD(wparam)==IDC_LIST)&&!hOpClistControl) {
SendMessage(hComboBoxEdit,EM_SCROLLCARET ,0,0);
HideCaret(hComboBoxEdit);
}
-
+
if ((LOWORD(wparam) == IDC_STARTDELAY) && (HIWORD(wparam)!=EN_CHANGE || (HWND)lparam != GetFocus()))
return 0;
- if (lparam&&!bOptionsInit&&(HIWORD(wparam)==BN_CLICKED)&& (GetFocus()==(HWND)lparam)
+ if (lparam&&!bOptionsInit&&(HIWORD(wparam)==BN_CLICKED)&& (GetFocus()==(HWND)lparam)
&&((LOWORD(wparam)==IDC_CHECKLAST)||((LOWORD(wparam)>=IDC_EXCLHIDDEN)&&(LOWORD(wparam)<=IDC_CRASHRECOVERY))))
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
-
- return 0;
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- case WM_NCDESTROY:
- SetWindowLongPtr(hComboBoxEdit, GWLP_WNDPROC, (LONG)oldComboProc);
- break;
+ return 0;
- case WM_CLOSE:
- EndDialog(hdlg,0);
- return 0;
+ case WM_CLOSE:
+ EndDialog(hdlg,0);
+ return 0;
}
return 0;
}
int OptionsInit(WPARAM wparam,LPARAM lparam)
{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 955000000;
odp.hInstance = hinstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index c03ec64576..15f7bfb487 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -547,18 +547,15 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) DestroyMenu(hmenu);
}
-static WNDPROC MainDlgProc;
-
static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_CONTEXTMENU:
+ switch (uMsg) {
+ case WM_CONTEXTMENU:
{
POINT pt = {(LONG)LOWORD(lParam), (LONG)HIWORD(lParam)};
RECT rc;
GetClientRect(hwndDlg, &rc);
-
+
if (pt.x == -1 && pt.y == -1)
{
GetCursorPos(&pt);
@@ -573,47 +570,47 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L if (PtInRect(&rc, pt))
HandlePopupMenu(hwndDlg, pt, GetDlgItem(GetParent(hwndDlg), IDC_EDIT1));
-
+
return 0;
}
- case WM_CHAR:
- if (wParam=='\n' && GetKeyState(VK_CONTROL) & 0x8000)
- {
- PostMessage(GetParent(hwndDlg), WM_COMMAND, IDC_OK, 0);
- return 0;
- }
- if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + A
- {
- SendMessage(hwndDlg, EM_SETSEL, 0, -1);
- return 0;
- }
- if (wParam == 23 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + W
- {
- SendMessage(GetParent(hwndDlg), WM_COMMAND, IDC_CANCEL, 0);
- return 0;
- }
- if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + Backspace
- {
- DWORD start, end;
- TCHAR *text;
- int textLen;
- SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&end, (LPARAM)(PDWORD)NULL);
- SendMessage(hwndDlg, WM_KEYDOWN, VK_LEFT, 0);
- SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&start, (LPARAM)(PDWORD)NULL);
- textLen = GetWindowTextLength(hwndDlg);
- text = (TCHAR *)mir_alloc(sizeof(TCHAR) * (textLen + 1));
- GetWindowText(hwndDlg, text, textLen + 1);
- MoveMemory(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end));
- SetWindowText(hwndDlg, text);
- mir_free(text);
- SendMessage(hwndDlg, EM_SETSEL, start, start);
- SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwndDlg), EN_CHANGE), (LPARAM)hwndDlg);
- return 0;
- }
- break;
+ case WM_CHAR:
+ if (wParam=='\n' && GetKeyState(VK_CONTROL) & 0x8000)
+ {
+ PostMessage(GetParent(hwndDlg), WM_COMMAND, IDC_OK, 0);
+ return 0;
+ }
+ if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + A
+ {
+ SendMessage(hwndDlg, EM_SETSEL, 0, -1);
+ return 0;
+ }
+ if (wParam == 23 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + W
+ {
+ SendMessage(GetParent(hwndDlg), WM_COMMAND, IDC_CANCEL, 0);
+ return 0;
+ }
+ if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + Backspace
+ {
+ DWORD start, end;
+ TCHAR *text;
+ int textLen;
+ SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&end, (LPARAM)(PDWORD)NULL);
+ SendMessage(hwndDlg, WM_KEYDOWN, VK_LEFT, 0);
+ SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&start, (LPARAM)(PDWORD)NULL);
+ textLen = GetWindowTextLength(hwndDlg);
+ text = (TCHAR *)mir_alloc(sizeof(TCHAR) * (textLen + 1));
+ GetWindowText(hwndDlg, text, textLen + 1);
+ MoveMemory(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end));
+ SetWindowText(hwndDlg, text);
+ mir_free(text);
+ SendMessage(hwndDlg, EM_SETSEL, start, start);
+ SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwndDlg), EN_CHANGE), (LPARAM)hwndDlg);
+ return 0;
+ }
+ break;
- case WM_LBUTTONDBLCLK:
+ case WM_LBUTTONDBLCLK:
{
MsgEditCtrl* mec = (MsgEditCtrl*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (mec != NULL)
@@ -625,7 +622,7 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L break;
}
- case WM_LBUTTONDOWN:
+ case WM_LBUTTONDOWN:
{
MsgEditCtrl* mec = (MsgEditCtrl*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (mec != NULL && UINT(clock() - mec->ctLastDblClk) < mec->uClocksPerDblClk)
@@ -636,14 +633,14 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L break;
}
- case WM_SETFOCUS:
+ case WM_SETFOCUS:
{
MsgEditCtrl* mec = (MsgEditCtrl*)mir_calloc(sizeof(MsgEditCtrl));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)mec);
break;
}
- case WM_KILLFOCUS:
+ case WM_KILLFOCUS:
{
MsgEditCtrl* mec = (MsgEditCtrl*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
mir_free(mec);
@@ -653,7 +650,7 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L }
}
- return CallWindowProc(MainDlgProc, hwndDlg, uMsg, wParam, lParam);
+ return mir_callNextSubclass(hwndDlg, EditBoxSubProc, uMsg, wParam, lParam);
}
int AddToPredefined(HWND hwndDlg, struct MsgBoxData *data)
@@ -1168,7 +1165,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA mir_free(init_data);
- MainDlgProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT1), GWLP_WNDPROC, (LONG_PTR)EditBoxSubProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_EDIT1), EditBoxSubProc);
if (!init_data->m_bOnEvent && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EDIT1)))
{
SetFocus(GetDlgItem(hwndDlg, IDC_EDIT1));
@@ -1787,7 +1784,6 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT1), GWLP_WNDPROC, (LONG_PTR)MainDlgProc);
if (msgbox_data)
mir_free(msgbox_data);
hwndSAMsgDialog = NULL;
diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index 26b2c22349..76928064f3 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -24,8 +24,6 @@ extern UINT_PTR g_uUpdateMsgTimer; extern VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD);
extern VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control);
-static WNDPROC OldDlgProc;
-
static void RebuildStatusMenu(void)
{
CLIST_INTERFACE* pcli = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, 0);
@@ -35,14 +33,13 @@ static void RebuildStatusMenu(void) static LRESULT CALLBACK OptEditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_CONTEXTMENU:
+ switch (uMsg) {
+ case WM_CONTEXTMENU:
{
POINT pt = {(LONG)LOWORD(lParam), (LONG)HIWORD(lParam)};
RECT rc;
GetClientRect(hwndDlg, &rc);
-
+
if (pt.x == -1 && pt.y == -1)
{
GetCursorPos(&pt);
@@ -57,38 +54,38 @@ static LRESULT CALLBACK OptEditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam if (PtInRect(&rc, pt))
HandlePopupMenu(hwndDlg, pt, GetDlgItem(GetParent(hwndDlg), IDC_OPTEDIT1));
-
+
return 0;
}
- case WM_CHAR:
- if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + A
- {
- SendMessage(hwndDlg, EM_SETSEL, 0, -1);
- return 0;
- }
- if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + Backspace
- {
- DWORD start, end;
- TCHAR *text;
- int textLen;
- SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&end, (LPARAM)(PDWORD)NULL);
- SendMessage(hwndDlg, WM_KEYDOWN, VK_LEFT, 0);
- SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&start, (LPARAM)(PDWORD)NULL);
- textLen = GetWindowTextLength(hwndDlg);
- text = (TCHAR *)mir_alloc(sizeof(TCHAR) * (textLen + 1));
- GetWindowText(hwndDlg, text, textLen + 1);
- MoveMemory(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end));
- SetWindowText(hwndDlg, text);
- mir_free(text);
- SendMessage(hwndDlg, EM_SETSEL, start, start);
- SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwndDlg), EN_CHANGE), (LPARAM)hwndDlg);
- return 0;
- }
- break;
+ case WM_CHAR:
+ if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + A
+ {
+ SendMessage(hwndDlg, EM_SETSEL, 0, -1);
+ return 0;
+ }
+ if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + Backspace
+ {
+ DWORD start, end;
+ TCHAR *text;
+ int textLen;
+ SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&end, (LPARAM)(PDWORD)NULL);
+ SendMessage(hwndDlg, WM_KEYDOWN, VK_LEFT, 0);
+ SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&start, (LPARAM)(PDWORD)NULL);
+ textLen = GetWindowTextLength(hwndDlg);
+ text = (TCHAR *)mir_alloc(sizeof(TCHAR) * (textLen + 1));
+ GetWindowText(hwndDlg, text, textLen + 1);
+ MoveMemory(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end));
+ SetWindowText(hwndDlg, text);
+ mir_free(text);
+ SendMessage(hwndDlg, EM_SETSEL, start, start);
+ SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwndDlg), EN_CHANGE), (LPARAM)hwndDlg);
+ return 0;
+ }
+ break;
}
- return CallWindowProc(OldDlgProc, hwndDlg, uMsg, wParam, lParam);
+ return mir_callNextSubclass(hwndDlg, OptEditBoxSubProc, uMsg, wParam, lParam);
}
struct SingleProtoMsg
@@ -115,9 +112,8 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
struct OptDlgData *data = (struct OptDlgData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (uMsg)
- {
- case WM_INITDIALOG:
+ switch (uMsg) {
+ case WM_INITDIALOG:
{
int val, i, index;
DBVARIANT dbv;
@@ -193,7 +189,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L data->proto_ok = TRUE;
index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_ADDSTRING, 0, (LPARAM)TranslateT("Global status change"));
-// SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETITEMDATA, index, 0);
+ // SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETITEMDATA, index, 0);
if (index != CB_ERR && index != CB_ERRSPACE)
{
data->proto_msg[0].msg = NULL;
@@ -215,7 +211,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L }
index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_ADDSTRING, 0, (LPARAM)accounts->pa[i]->tszAccountName);
-// SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETITEMDATA, index, (LPARAM)i + 1);
+ // SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETITEMDATA, index, (LPARAM)i + 1);
if (index != CB_ERR && index != CB_ERRSPACE)
{
mir_snprintf(setting, SIZEOF(setting), "Proto%sDefault", accounts->pa[i]->szModuleName);
@@ -239,7 +235,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L if (accounts->statusMsgCount == 1)
{
-// ShowWindow(GetDlgItem(hwndDlg, IDC_BOPTPROTO), SW_HIDE);
+ // ShowWindow(GetDlgItem(hwndDlg, IDC_BOPTPROTO), SW_HIDE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTPROTO), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), FALSE);
SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETCURSEL, 1, 0);
@@ -278,856 +274,847 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L }
ShowWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), ServiceExists(MS_VARS_FORMATSTRING));
- OldDlgProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_OPTEDIT1), GWLP_WNDPROC, (LONG_PTR)OptEditBoxSubProc);
-
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_OPTEDIT1), OptEditBoxSubProc);
return TRUE;
}
- case WM_COMMAND:
- if ( ( (HIWORD(wParam) == BN_CLICKED) || /*(HIWORD(wParam) == EN_KILLFOCUS) ||*/ (HIWORD(wParam) == EN_CHANGE)
- || ( (HIWORD(wParam) == CBN_SELCHANGE) && (LOWORD(wParam) != IDC_CBOPTPROTO) && (LOWORD(wParam) != IDC_CBOPTSTATUS))
- ) && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- switch (LOWORD(wParam))
+ case WM_COMMAND:
+ if ( ( (HIWORD(wParam) == BN_CLICKED) || /*(HIWORD(wParam) == EN_KILLFOCUS) ||*/ (HIWORD(wParam) == EN_CHANGE)
+ || ( (HIWORD(wParam) == CBN_SELCHANGE) && (LOWORD(wParam) != IDC_CBOPTPROTO) && (LOWORD(wParam) != IDC_CBOPTSTATUS))
+ ) && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ switch (LOWORD(wParam)) {
+ case IDC_EMAXLENGTH:
+ switch (HIWORD(wParam)) {
+ case EN_KILLFOCUS:
+ {
+ BOOL translated;
+ int val, i;
+
+ val = GetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, &translated, FALSE);
+ if (translated && val > 1024)
+ SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1024, FALSE);
+ if (translated && val < 1)
+ SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1, FALSE);
+ val = GetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, &translated, FALSE);
+
+ i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ data->proto_msg[i].max_length = val;
+ break;
+ }
+ }
+ break;
+
+ case IDC_CBOPTPROTO:
+ switch (HIWORD(wParam))
{
- case IDC_EMAXLENGTH:
- switch (HIWORD(wParam))
+ case CBN_SELCHANGE:
+ case CBN_SELENDOK:
+ {
+ int i, j, l, k, status_modes = 0, newindex = 0;
+
+ i = SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
+
+ if (i == 0)
{
- case EN_KILLFOCUS:
- {
- BOOL translated;
- int val, i;
-
- val = GetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, &translated, FALSE);
- if (translated && val > 1024)
- SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1024, FALSE);
- if (translated && val < 1)
- SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1, FALSE);
- val = GetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, &translated, FALSE);
-
- i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- data->proto_msg[i].max_length = val;
- break;
- }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MAXLENGTH), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EMAXLENGTH), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SMAXLENGTH), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO3), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO4), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1024, FALSE);
+
+ if (data->proto_msg[i].flags & PROTO_POPUPDLG)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO1);
+ else if (data->proto_msg[i].flags & PROTO_NOCHANGE)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO2);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MAXLENGTH), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EMAXLENGTH), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SMAXLENGTH), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO3), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO4), TRUE);
+ SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, data->proto_msg[i].max_length, FALSE);
+
+ if (data->proto_msg[i].flags & PROTO_POPUPDLG)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO1);
+ else if (data->proto_msg[i].flags & PROTO_NOCHANGE)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO2);
+ else if (data->proto_msg[i].flags & PROTO_THIS_MSG)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO3);
+ else if (data->proto_msg[i].flags & PROTO_NO_MSG)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO4);
}
- break;
- case IDC_CBOPTPROTO:
- switch (HIWORD(wParam))
+ if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_THIS_MSG
+ || data->proto_msg[i].flags & PROTO_NOCHANGE)
{
- case CBN_SELCHANGE:
- case CBN_SELENDOK:
- {
- int i, j, l, k, status_modes = 0, newindex = 0;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
- i = SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
- if (i == 0)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_MAXLENGTH), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_EMAXLENGTH), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SMAXLENGTH), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO3), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO4), FALSE);
- SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1024, FALSE);
-
- if (data->proto_msg[i].flags & PROTO_POPUPDLG)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO1);
- else if (data->proto_msg[i].flags & PROTO_NOCHANGE)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO2);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_MAXLENGTH), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_EMAXLENGTH), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SMAXLENGTH), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO3), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO4), TRUE);
- SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, data->proto_msg[i].max_length, FALSE);
-
- if (data->proto_msg[i].flags & PROTO_POPUPDLG)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO1);
- else if (data->proto_msg[i].flags & PROTO_NOCHANGE)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO2);
- else if (data->proto_msg[i].flags & PROTO_THIS_MSG)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO3);
- else if (data->proto_msg[i].flags & PROTO_NO_MSG)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO4);
- }
+ if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_NOCHANGE)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
+ }
- if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_THIS_MSG
- || data->proto_msg[i].flags & PROTO_NOCHANGE)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), TRUE);
- if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_NOCHANGE)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), TRUE);
+ }
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), TRUE);
+ if (i)
+ {
+ k = i - 1;
+ status_modes = CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ }
+ else
+ status_modes = accounts->statusMsgFlags;
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_RESETCONTENT, 0, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), TRUE);
- }
+ for (l=ID_STATUS_ONLINE; l<=ID_STATUS_OUTTOLUNCH; l++)
+ {
+ int index;
+ if (status_modes & Proto_Status2Flag(l))
+ {
+ index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, l, GSMDF_TCHAR));
- if (i)
+ if (index != CB_ERR && index != CB_ERRSPACE)
{
- k = i - 1;
- status_modes = CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETITEMDATA, (WPARAM)index, (LPARAM)l - ID_STATUS_ONLINE);
+ if (j == l-ID_STATUS_ONLINE)
+ newindex=index;
}
- else
- status_modes = accounts->statusMsgFlags;
-
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_RESETCONTENT, 0, 0);
+ }
+ }
- for (l=ID_STATUS_ONLINE; l<=ID_STATUS_OUTTOLUNCH; l++)
- {
- int index;
- if (status_modes & Proto_Status2Flag(l))
- {
- index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, l, GSMDF_TCHAR));
+ if (!newindex)
+ {
+ SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETCURSEL, 0, 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ }
+ else
+ SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETCURSEL, (WPARAM)newindex, 0);
- if (index != CB_ERR && index != CB_ERRSPACE)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETITEMDATA, (WPARAM)index, (LPARAM)l - ID_STATUS_ONLINE);
- if (j == l-ID_STATUS_ONLINE)
- newindex=index;
- }
- }
- }
+ if (data->status_msg[i].flags[j] & STATUS_SHOW_DLG)
+ CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_CHECKED);
+ else
+ CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_UNCHECKED);
- if (!newindex)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETCURSEL, 0, 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- }
- else
- SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETCURSEL, (WPARAM)newindex, 0);
+ if (data->proto_msg[i].flags & PROTO_THIS_MSG)
+ {
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
+ if (data->proto_msg[i].msg)
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->proto_msg[i].msg);
+ else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ }
+ else
+ {
+ if (data->status_msg[i].flags[j] & STATUS_EMPTY_MSG)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_DEFAULT_MSG)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(j+ID_STATUS_ONLINE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_LAST_MSG)
+ {
+ char setting[80];
+ DBVARIANT dbv, dbv2;
- if (data->status_msg[i].flags[j] & STATUS_SHOW_DLG)
- CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_CHECKED);
+ if (i)
+ mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[k]->szModuleName);
else
- CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_UNCHECKED);
+ mir_snprintf(setting, SIZEOF(setting), "LastMsg");
- if (data->proto_msg[i].flags & PROTO_THIS_MSG)
- {
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
- if (data->proto_msg[i].msg)
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->proto_msg[i].msg);
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- }
- else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
{
- if (data->status_msg[i].flags[j] & STATUS_EMPTY_MSG)
+ if (dbv.pszVal)
{
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
- }
- else if (data->status_msg[i].flags[j] & STATUS_DEFAULT_MSG)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(j+ID_STATUS_ONLINE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
- }
- else if (data->status_msg[i].flags[j] & STATUS_LAST_MSG)
- {
- char setting[80];
- DBVARIANT dbv, dbv2;
-
- if (i)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[k]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
-
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
- {
- if (dbv.pszVal)
- {
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
- {
- if ((dbv2.ptszVal) && (lstrlen(dbv2.ptszVal)))
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
-
- DBFreeVariant(&dbv2);
- }
- }
- DBFreeVariant(&dbv);
- }
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
- }
- else if (data->status_msg[i].flags[j] & STATUS_THIS_MSG)
- {
- if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_NOCHANGE)
+ if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- }
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[i].msg[j]);
- }
- else if (data->status_msg[i].flags[j] & STATUS_LAST_STATUS_MSG)
- {
- char setting[80];
- DBVARIANT dbv;
-
- if (i)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[k]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
+ if ((dbv2.ptszVal) && (lstrlen(dbv2.ptszVal)))
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ DBFreeVariant(&dbv2);
}
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
}
+ DBFreeVariant(&dbv);
}
- break;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
}
- }
- break;
-
- case IDC_ROPTPROTO1:
- case IDC_ROPTPROTO2:
- case IDC_ROPTPROTO3:
- case IDC_ROPTPROTO4:
- switch (HIWORD(wParam))
- {
- case BN_CLICKED:
+ else if (data->status_msg[i].flags[j] & STATUS_THIS_MSG)
{
- int i, j;
-
- i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
-
- data->proto_msg[i].flags = 0;
-
- if ((LOWORD(wParam) == IDC_ROPTPROTO2) || (LOWORD(wParam) == IDC_ROPTPROTO4))
+ if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_NOCHANGE)
{
- data->proto_msg[i].flags |= (LOWORD(wParam) == IDC_ROPTPROTO4) ? PROTO_NO_MSG : PROTO_NOCHANGE;
- EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
}
- else if (LOWORD(wParam) == IDC_ROPTPROTO3)
+ else
{
- data->proto_msg[i].flags |= PROTO_THIS_MSG;
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- if (data->proto_msg[i].msg)
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->proto_msg[i].msg);
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
- }
- else if (LOWORD(wParam) == IDC_ROPTPROTO1)
- {
- data->proto_msg[i].flags |= PROTO_POPUPDLG;
- EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), TRUE);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), TRUE);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), TRUE);
}
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[i].msg[j]);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_LAST_STATUS_MSG)
+ {
+ char setting[80];
+ DBVARIANT dbv;
- if (LOWORD(wParam) != IDC_ROPTPROTO3)
+ if (i)
+ mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[k]->szModuleName);
+ else
+ mir_snprintf(setting, SIZEOF(setting), "Msg");
+
+ if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
{
- if (data->status_msg[i].flags[j] & STATUS_EMPTY_MSG)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
- }
- else if (data->status_msg[i].flags[j] & STATUS_DEFAULT_MSG)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(j+ID_STATUS_ONLINE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
- }
- else if (data->status_msg[i].flags[j] & STATUS_LAST_MSG)
- {
- char setting[80];
- DBVARIANT dbv, dbv2;
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
+ else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (i)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[i-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
+ }
+ }
+ break;
+ }
+ }
+ break;
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
- {
- if (dbv.pszVal)
- {
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
- {
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- DBFreeVariant(&dbv2);
- }
- }
- DBFreeVariant(&dbv);
- }
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
- }
- else if (data->status_msg[i].flags[j] & STATUS_THIS_MSG)
- {
- if ((LOWORD(wParam) == IDC_ROPTPROTO2) || (LOWORD(wParam) == IDC_ROPTPROTO4))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- }
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[i].msg[j]);
- }
- else if (data->status_msg[i].flags[j] & STATUS_LAST_STATUS_MSG)
- {
- char setting[80];
- DBVARIANT dbv;
+ case IDC_ROPTPROTO1:
+ case IDC_ROPTPROTO2:
+ case IDC_ROPTPROTO3:
+ case IDC_ROPTPROTO4:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ {
+ int i, j;
- if (i)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[i-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
+ i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ data->proto_msg[i].flags = 0;
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
- }
- }
- break;
- }
+ if ((LOWORD(wParam) == IDC_ROPTPROTO2) || (LOWORD(wParam) == IDC_ROPTPROTO4))
+ {
+ data->proto_msg[i].flags |= (LOWORD(wParam) == IDC_ROPTPROTO4) ? PROTO_NO_MSG : PROTO_NOCHANGE;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
+ }
+ else if (LOWORD(wParam) == IDC_ROPTPROTO3)
+ {
+ data->proto_msg[i].flags |= PROTO_THIS_MSG;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
+ if (data->proto_msg[i].msg)
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->proto_msg[i].msg);
+ else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
+ }
+ else if (LOWORD(wParam) == IDC_ROPTPROTO1)
+ {
+ data->proto_msg[i].flags |= PROTO_POPUPDLG;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), TRUE);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), TRUE);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), TRUE);
}
- break;
- case IDC_CBOPTSTATUS:
- switch (HIWORD(wParam))
+ if (LOWORD(wParam) != IDC_ROPTPROTO3)
{
- case CBN_SELCHANGE:
- case CBN_SELENDOK:
+ if (data->status_msg[i].flags[j] & STATUS_EMPTY_MSG)
{
- int i, j;
-
- i = SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_DEFAULT_MSG)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(j+ID_STATUS_ONLINE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_LAST_MSG)
+ {
+ char setting[80];
+ DBVARIANT dbv, dbv2;
- if (data->status_msg[j].flags[i] & STATUS_SHOW_DLG)
- CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_CHECKED);
+ if (i)
+ mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[i-1]->szModuleName);
else
- CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_UNCHECKED);
+ mir_snprintf(setting, SIZEOF(setting), "LastMsg");
- if (data->status_msg[j].flags[i] & STATUS_EMPTY_MSG)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
- }
- else if (data->status_msg[j].flags[i] & STATUS_DEFAULT_MSG)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(i+ID_STATUS_ONLINE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
- }
- else if (data->status_msg[j].flags[i] & STATUS_LAST_MSG)
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
{
- char setting[80];
- DBVARIANT dbv,dbv2;
-
- if (j)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[j-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
-
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
+ if (dbv.pszVal)
{
- if (dbv.pszVal)
+ if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
- {
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- DBFreeVariant(&dbv2);
- }
+ if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
+ DBFreeVariant(&dbv2);
}
- DBFreeVariant(&dbv);
}
+ DBFreeVariant(&dbv);
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_THIS_MSG)
+ {
+ if ((LOWORD(wParam) == IDC_ROPTPROTO2) || (LOWORD(wParam) == IDC_ROPTPROTO4))
+ {
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
}
- else if (data->status_msg[j].flags[i] & STATUS_THIS_MSG)
+ else
{
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[j].msg[i]);
}
- else if (data->status_msg[j].flags[i] & STATUS_LAST_STATUS_MSG)
- {
- char setting[80];
- DBVARIANT dbv;
-
- if (j)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[j-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
-
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i + ID_STATUS_ONLINE, setting), &dbv))
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
- }
- break;
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[i].msg[j]);
}
- }
- break;
-
- case IDC_COPTMSG1:
- switch (HIWORD(wParam))
- {
- case BN_CLICKED:
+ else if (data->status_msg[i].flags[j] & STATUS_LAST_STATUS_MSG)
{
- int i, j;
+ char setting[80];
+ DBVARIANT dbv;
+
+ if (i)
+ mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[i-1]->szModuleName);
+ else
+ mir_snprintf(setting, SIZEOF(setting), "Msg");
- i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- if (IsDlgButtonChecked(hwndDlg, IDC_COPTMSG1) == BST_CHECKED)
- data->status_msg[j].flags[i] |= STATUS_SHOW_DLG;
+ if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
else
- data->status_msg[j].flags[i] &= ~STATUS_SHOW_DLG;
- break;
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
}
}
break;
+ }
+ }
+ break;
- case IDC_ROPTMSG1:
- case IDC_ROPTMSG2:
- case IDC_ROPTMSG3:
- case IDC_ROPTMSG4:
- case IDC_ROPTMSG5:
- switch (HIWORD(wParam))
- {
- case BN_CLICKED:
- {
- int i, j;
+ case IDC_CBOPTSTATUS:
+ switch (HIWORD(wParam)) {
+ case CBN_SELCHANGE:
+ case CBN_SELENDOK:
+ {
+ int i, j;
- i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ i = SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- if (LOWORD(wParam) == IDC_ROPTMSG4 && data->proto_msg[j].flags & PROTO_THIS_MSG)
- break;
+ if (data->status_msg[j].flags[i] & STATUS_SHOW_DLG)
+ CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_CHECKED);
+ else
+ CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_UNCHECKED);
- data->status_msg[j].flags[i] = 0;
+ if (data->status_msg[j].flags[i] & STATUS_EMPTY_MSG)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
+ }
+ else if (data->status_msg[j].flags[i] & STATUS_DEFAULT_MSG)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(i+ID_STATUS_ONLINE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
+ }
+ else if (data->status_msg[j].flags[i] & STATUS_LAST_MSG)
+ {
+ char setting[80];
+ DBVARIANT dbv,dbv2;
- if (IsDlgButtonChecked(hwndDlg, IDC_COPTMSG1) == BST_CHECKED)
- data->status_msg[j].flags[i] |= STATUS_SHOW_DLG;
+ if (j)
+ mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[j-1]->szModuleName);
+ else
+ mir_snprintf(setting, SIZEOF(setting), "LastMsg");
- if (LOWORD(wParam) == IDC_ROPTMSG1)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- data->status_msg[j].flags[i] |= STATUS_EMPTY_MSG;
- }
- else if (LOWORD(wParam) == IDC_ROPTMSG2)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(i+ID_STATUS_ONLINE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- data->status_msg[j].flags[i] |= STATUS_DEFAULT_MSG;
- }
- else if (LOWORD(wParam) == IDC_ROPTMSG3)
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
+ {
+ if (dbv.pszVal)
{
- char setting[80];
- DBVARIANT dbv, dbv2;
-
- if (j)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[j-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
-
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
+ if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if (dbv.pszVal)
- {
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
- {
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- DBFreeVariant(&dbv2);
- }
- }
- DBFreeVariant(&dbv);
+ if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
+ DBFreeVariant(&dbv2);
}
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- data->status_msg[j].flags[i] |= STATUS_LAST_MSG;
}
- else if (LOWORD(wParam) == IDC_ROPTMSG4)
- {
- data->status_msg[j].flags[i] |= STATUS_THIS_MSG;
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[j].msg[i]);
- }
- else if (LOWORD(wParam) == IDC_ROPTMSG5)
- {
- char setting[80];
- DBVARIANT dbv;
-
- if (j)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[j-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
+ DBFreeVariant(&dbv);
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
+ }
+ else if (data->status_msg[j].flags[i] & STATUS_THIS_MSG)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[j].msg[i]);
+ }
+ else if (data->status_msg[j].flags[i] & STATUS_LAST_STATUS_MSG)
+ {
+ char setting[80];
+ DBVARIANT dbv;
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i+ID_STATUS_ONLINE, setting), &dbv))
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ if (j)
+ mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[j-1]->szModuleName);
+ else
+ mir_snprintf(setting, SIZEOF(setting), "Msg");
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- data->status_msg[j].flags[i] |= STATUS_LAST_STATUS_MSG;
- }
- break;
+ if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i + ID_STATUS_ONLINE, setting), &dbv))
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
+ else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
}
break;
+ }
+ }
+ break;
- case IDC_OPTEDIT1:
+ case IDC_COPTMSG1:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
{
- int i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- int j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ int i, j;
- if (HIWORD(wParam) == EN_KILLFOCUS)
+ i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ if (IsDlgButtonChecked(hwndDlg, IDC_COPTMSG1) == BST_CHECKED)
+ data->status_msg[j].flags[i] |= STATUS_SHOW_DLG;
+ else
+ data->status_msg[j].flags[i] &= ~STATUS_SHOW_DLG;
+ break;
+ }
+ }
+ break;
+
+ case IDC_ROPTMSG1:
+ case IDC_ROPTMSG2:
+ case IDC_ROPTMSG3:
+ case IDC_ROPTMSG4:
+ case IDC_ROPTMSG5:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ {
+ int i, j;
+
+ i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+
+ if (LOWORD(wParam) == IDC_ROPTMSG4 && data->proto_msg[j].flags & PROTO_THIS_MSG)
+ break;
+
+ data->status_msg[j].flags[i] = 0;
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_COPTMSG1) == BST_CHECKED)
+ data->status_msg[j].flags[i] |= STATUS_SHOW_DLG;
+
+ if (LOWORD(wParam) == IDC_ROPTMSG1)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ data->status_msg[j].flags[i] |= STATUS_EMPTY_MSG;
+ }
+ else if (LOWORD(wParam) == IDC_ROPTMSG2)
{
- TCHAR msg[1024];
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(i+ID_STATUS_ONLINE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ data->status_msg[j].flags[i] |= STATUS_DEFAULT_MSG;
+ }
+ else if (LOWORD(wParam) == IDC_ROPTMSG3)
+ {
+ char setting[80];
+ DBVARIANT dbv, dbv2;
- if (data->proto_msg[j].flags & PROTO_THIS_MSG)
+ if (j)
+ mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[j-1]->szModuleName);
+ else
+ mir_snprintf(setting, SIZEOF(setting), "LastMsg");
+
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
{
- int len = GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
- if (len > 0)
- {
- if (data->proto_msg[j].msg == NULL)
- data->proto_msg[j].msg = mir_tstrdup(msg);
- else
- {
- mir_free(data->proto_msg[j].msg);
- data->proto_msg[j].msg = mir_tstrdup(msg);
- }
- }
- else
+ if (dbv.pszVal)
{
- if (data->proto_msg[j].msg != NULL)
+ if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- mir_free(data->proto_msg[j].msg);
- data->proto_msg[j].msg = NULL;
+ if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
+ DBFreeVariant(&dbv2);
}
}
+ DBFreeVariant(&dbv);
}
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ data->status_msg[j].flags[i] |= STATUS_LAST_MSG;
+ }
+ else if (LOWORD(wParam) == IDC_ROPTMSG4)
+ {
+ data->status_msg[j].flags[i] |= STATUS_THIS_MSG;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[j].msg[i]);
+ }
+ else if (LOWORD(wParam) == IDC_ROPTMSG5)
+ {
+ char setting[80];
+ DBVARIANT dbv;
+
+ if (j)
+ mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[j-1]->szModuleName);
else
+ mir_snprintf(setting, SIZEOF(setting), "Msg");
+
+ if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i+ID_STATUS_ONLINE, setting), &dbv))
{
- GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
- lstrcpy(data->status_msg[j].msg[i], msg);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
+ else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ data->status_msg[j].flags[i] |= STATUS_LAST_STATUS_MSG;
}
break;
}
+ }
+ break;
- case IDC_VARSHELP:
- variables_showhelp(hwndDlg, IDC_OPTEDIT1, VHF_FULLDLG|VHF_SETLASTSUBJECT, NULL, NULL);
- break;
+ case IDC_OPTEDIT1:
+ {
+ int i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ int j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- case IDC_BOPTPROTO:
+ if (HIWORD(wParam) == EN_KILLFOCUS)
{
- int i, j, k;
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ TCHAR msg[1024];
- if (j)
+ if (data->proto_msg[j].flags & PROTO_THIS_MSG)
{
- for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ int len = GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
+ if (len > 0)
+ {
+ if (data->proto_msg[j].msg == NULL)
+ data->proto_msg[j].msg = mir_tstrdup(msg);
+ else
+ {
+ mir_free(data->proto_msg[j].msg);
+ data->proto_msg[j].msg = mir_tstrdup(msg);
+ }
+ }
+ else
{
- if (accounts->statusMsgFlags & Proto_Status2Flag(i))
+ if (data->proto_msg[j].msg != NULL)
{
- data->status_msg[0].flags[i-ID_STATUS_ONLINE] = data->status_msg[j].flags[i-ID_STATUS_ONLINE];
- if (data->status_msg[j].flags[i-ID_STATUS_ONLINE] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[0].msg[i-ID_STATUS_ONLINE], data->status_msg[j].msg[i-ID_STATUS_ONLINE]);
+ mir_free(data->proto_msg[j].msg);
+ data->proto_msg[j].msg = NULL;
}
}
}
-
- for (k = 0; k < accounts->count; k++)
+ else
{
- if (!IsAccountEnabled(accounts->pa[k]) || !CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) || !(CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
- continue;
+ GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
+ lstrcpy(data->status_msg[j].msg[i], msg);
+ }
+ }
+ break;
+ }
+
+ case IDC_VARSHELP:
+ variables_showhelp(hwndDlg, IDC_OPTEDIT1, VHF_FULLDLG|VHF_SETLASTSUBJECT, NULL, NULL);
+ break;
+
+ case IDC_BOPTPROTO:
+ {
+ int i, j, k;
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- if (k != j - 1)
+ if (j)
+ {
+ for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ {
+ if (accounts->statusMsgFlags & Proto_Status2Flag(i))
{
- data->proto_msg[k+1].flags = data->proto_msg[j].flags;
- if (j)
- data->proto_msg[k+1].max_length = data->proto_msg[j].max_length;
+ data->status_msg[0].flags[i-ID_STATUS_ONLINE] = data->status_msg[j].flags[i-ID_STATUS_ONLINE];
+ if (data->status_msg[j].flags[i-ID_STATUS_ONLINE] & STATUS_THIS_MSG)
+ lstrcpy(data->status_msg[0].msg[i-ID_STATUS_ONLINE], data->status_msg[j].msg[i-ID_STATUS_ONLINE]);
+ }
+ }
+ }
- if (data->proto_msg[j].flags & PROTO_THIS_MSG)
- {
- int len = lstrlen(data->proto_msg[j].msg);
- if (len > 0)
- {
- if (data->proto_msg[k+1].msg == NULL)
- data->proto_msg[k+1].msg = mir_tstrdup(data->proto_msg[j].msg);
- else
- {
- mir_free(data->proto_msg[k+1].msg);
- data->proto_msg[k+1].msg = mir_tstrdup(data->proto_msg[j].msg);
- }
- }
+ for (k = 0; k < accounts->count; k++)
+ {
+ if (!IsAccountEnabled(accounts->pa[k]) || !CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) || !(CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ continue;
+
+ if (k != j - 1)
+ {
+ data->proto_msg[k+1].flags = data->proto_msg[j].flags;
+ if (j)
+ data->proto_msg[k+1].max_length = data->proto_msg[j].max_length;
+
+ if (data->proto_msg[j].flags & PROTO_THIS_MSG)
+ {
+ int len = lstrlen(data->proto_msg[j].msg);
+ if (len > 0)
+ {
+ if (data->proto_msg[k+1].msg == NULL)
+ data->proto_msg[k+1].msg = mir_tstrdup(data->proto_msg[j].msg);
else
{
- if (data->proto_msg[k+1].msg != NULL)
- {
- mir_free(data->proto_msg[k+1].msg);
- data->proto_msg[k+1].msg = NULL;
- }
+ mir_free(data->proto_msg[k+1].msg);
+ data->proto_msg[k+1].msg = mir_tstrdup(data->proto_msg[j].msg);
}
}
- else if (data->proto_msg[j].flags & PROTO_POPUPDLG)
+ else
{
- for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ if (data->proto_msg[k+1].msg != NULL)
{
- if (CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
- {
- data->status_msg[k + 1].flags[i - ID_STATUS_ONLINE] = data->status_msg[j].flags[i - ID_STATUS_ONLINE];
- if (data->status_msg[j].flags[i - ID_STATUS_ONLINE] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[k + 1].msg[i - ID_STATUS_ONLINE], data->status_msg[j].msg[i - ID_STATUS_ONLINE]);
- }
+ mir_free(data->proto_msg[k+1].msg);
+ data->proto_msg[k+1].msg = NULL;
+ }
+ }
+ }
+ else if (data->proto_msg[j].flags & PROTO_POPUPDLG)
+ {
+ for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ {
+ if (CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
+ {
+ data->status_msg[k + 1].flags[i - ID_STATUS_ONLINE] = data->status_msg[j].flags[i - ID_STATUS_ONLINE];
+ if (data->status_msg[j].flags[i - ID_STATUS_ONLINE] & STATUS_THIS_MSG)
+ lstrcpy(data->status_msg[k + 1].msg[i - ID_STATUS_ONLINE], data->status_msg[j].msg[i - ID_STATUS_ONLINE]);
}
}
}
}
- break;
- } // case IDC_BOPTPROTO
+ }
+ break;
+ } // case IDC_BOPTPROTO
- case IDC_BOPTSTATUS:
- {
- int status_modes, i, j, k;
+ case IDC_BOPTSTATUS:
+ {
+ int status_modes, i, j, k;
- i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- if (j)
- status_modes = CallProtoService(accounts->pa[j-1]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
- else
- status_modes = accounts->statusMsgFlags;
+ if (j)
+ status_modes = CallProtoService(accounts->pa[j-1]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ else
+ status_modes = accounts->statusMsgFlags;
- for (k = ID_STATUS_ONLINE; k <= ID_STATUS_OUTTOLUNCH; k++)
+ for (k = ID_STATUS_ONLINE; k <= ID_STATUS_OUTTOLUNCH; k++)
+ {
+ if (k - ID_STATUS_ONLINE != i && status_modes & Proto_Status2Flag(k))
{
- if (k - ID_STATUS_ONLINE != i && status_modes & Proto_Status2Flag(k))
- {
- data->status_msg[j].flags[k - ID_STATUS_ONLINE] = data->status_msg[j].flags[i];
- if (data->status_msg[j].flags[i] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[j].msg[k - ID_STATUS_ONLINE], data->status_msg[j].msg[i]);
- }
+ data->status_msg[j].flags[k - ID_STATUS_ONLINE] = data->status_msg[j].flags[i];
+ if (data->status_msg[j].flags[i] & STATUS_THIS_MSG)
+ lstrcpy(data->status_msg[j].msg[k - ID_STATUS_ONLINE], data->status_msg[j].msg[i]);
}
- break;
- } //case IDC_BOPTSTATUS
- }
- break;
+ }
+ break;
+ } //case IDC_BOPTSTATUS
+ }
+ break;
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
- {
- char szSetting[80];
- int i;
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
+ {
+ char szSetting[80];
+ int i;
- for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ {
+ if (accounts->statusMsgFlags & Proto_Status2Flag(i))
{
- if (accounts->statusMsgFlags & Proto_Status2Flag(i))
- {
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, "Default"), data->status_msg[0].msg[i - ID_STATUS_ONLINE]);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, "Flags"), (BYTE)data->status_msg[0].flags[i - ID_STATUS_ONLINE]);
+ DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, "Default"), data->status_msg[0].msg[i - ID_STATUS_ONLINE]);
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, "Flags"), (BYTE)data->status_msg[0].flags[i - ID_STATUS_ONLINE]);
- for (int j = 0; j < accounts->count; j++)
- {
- if (!IsAccountEnabled(accounts->pa[j]))
- continue;
+ for (int j = 0; j < accounts->count; j++)
+ {
+ if (!IsAccountEnabled(accounts->pa[j]))
+ continue;
- if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
- continue;
+ if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ continue;
- if (CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
- {
- mir_snprintf(szSetting, SIZEOF(szSetting), "%sDefault", accounts->pa[j]->szModuleName);
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
+ if (CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
+ {
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%sDefault", accounts->pa[j]->szModuleName);
+ DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
- mir_snprintf(szSetting, SIZEOF(szSetting), "%sFlags", accounts->pa[j]->szModuleName);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
- }
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%sFlags", accounts->pa[j]->szModuleName);
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
}
}
}
+ }
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "PutDefInList", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_COPTMSG2) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "PutDefInList", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_COPTMSG2) == BST_CHECKED));
- if (data->proto_ok)
- {
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ProtoFlags", (BYTE)data->proto_msg[0].flags);
+ if (data->proto_ok)
+ {
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ProtoFlags", (BYTE)data->proto_msg[0].flags);
- for (i = 0; i < accounts->count; i++)
- {
- if (!IsAccountEnabled(accounts->pa[i]))
- continue;
+ for (i = 0; i < accounts->count; i++)
+ {
+ if (!IsAccountEnabled(accounts->pa[i]))
+ continue;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
- continue;
+ if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
- continue;
+ if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ continue;
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sDefault", accounts->pa[i]->szModuleName);
- if (data->proto_msg[i+1].msg && (data->proto_msg[i+1].flags & PROTO_THIS_MSG))
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", szSetting, data->proto_msg[i+1].msg);
-// else
-// DBDeleteContactSetting(NULL, "SimpleStatusMsg", szSetting);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sDefault", accounts->pa[i]->szModuleName);
+ if (data->proto_msg[i+1].msg && (data->proto_msg[i+1].flags & PROTO_THIS_MSG))
+ DBWriteContactSettingTString(NULL, "SimpleStatusMsg", szSetting, data->proto_msg[i+1].msg);
+ // else
+ // DBDeleteContactSetting(NULL, "SimpleStatusMsg", szSetting);
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sMaxLen", accounts->pa[i]->szModuleName);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->proto_msg[i+1].max_length);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sMaxLen", accounts->pa[i]->szModuleName);
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->proto_msg[i+1].max_length);
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", accounts->pa[i]->szModuleName);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", szSetting, (BYTE)data->proto_msg[i+1].flags);
- }
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", accounts->pa[i]->szModuleName);
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", szSetting, (BYTE)data->proto_msg[i+1].flags);
}
- RebuildStatusMenu();
- return TRUE;
}
- break;
+ RebuildStatusMenu();
+ return TRUE;
+ }
+ break;
- case WM_DESTROY:
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_OPTEDIT1), GWLP_WNDPROC, (LONG_PTR)OldDlgProc);
- if (data->proto_ok)
+ case WM_DESTROY:
+ if (data->proto_ok)
+ {
+ for (int i = 0; i < accounts->count + 1; ++i)
{
- for (int i = 0; i < accounts->count + 1; ++i)
- {
- if (data->proto_msg[i].msg) // they want to be free, do they?
- mir_free(data->proto_msg[i].msg);
- }
- mir_free(data->proto_msg);
+ if (data->proto_msg[i].msg) // they want to be free, do they?
+ mir_free(data->proto_msg[i].msg);
}
- mir_free(data->status_msg);
- mir_free(data);
- break;
+ mir_free(data->proto_msg);
+ }
+ mir_free(data->status_msg);
+ mir_free(data);
+ break;
}
return FALSE;
}
static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_INITDIALOG:
+ switch (uMsg) {
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
@@ -1155,7 +1142,7 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM return TRUE;
}
- case WM_USER + 2:
+ case WM_USER + 2:
{
BOOL bChecked = IsDlgButtonChecked(hwndDlg, IDC_CUPDATEMSG) == BST_CHECKED;
EnableWindow(GetDlgItem(hwndDlg, IDC_ESECUPDTMSG), bChecked);
@@ -1166,59 +1153,59 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM break;
}
- case WM_COMMAND:
- switch (LOWORD(wParam))
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDC_ESECUPDTMSG:
{
- case IDC_ESECUPDTMSG:
- {
- if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
- int val = GetDlgItemInt(hwndDlg, IDC_ESECUPDTMSG, NULL, FALSE);
- if (val == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ESECUPDTMSG)))
- SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETPOS, 0, MAKELONG((short)1, 0));
- break;
- }
+ if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
+ int val = GetDlgItemInt(hwndDlg, IDC_ESECUPDTMSG, NULL, FALSE);
+ if (val == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ESECUPDTMSG)))
+ SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETPOS, 0, MAKELONG((short)1, 0));
+ break;
+ }
- case IDC_CUPDATEMSG:
- SendMessage(hwndDlg, WM_USER + 2, 0, 0);
- break;
+ case IDC_CUPDATEMSG:
+ SendMessage(hwndDlg, WM_USER + 2, 0, 0);
+ break;
- case IDC_CVARIABLES:
- EnableWindow(GetDlgItem(hwndDlg, IDC_CDATEPARSING), IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED);
- break;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_CVARIABLES:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CDATEPARSING), IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED);
break;
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
- {
- if (g_uUpdateMsgTimer)
- KillTimer(NULL, g_uUpdateMsgTimer);
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
+ {
+ if (g_uUpdateMsgTimer)
+ KillTimer(NULL, g_uUpdateMsgTimer);
- int val = SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_GETPOS, 0, 0);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "UpdateMsgInt", (WORD)val);
+ int val = SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_GETPOS, 0, 0);
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "UpdateMsgInt", (WORD)val);
- if (IsDlgButtonChecked(hwndDlg, IDC_CUPDATEMSG) == BST_CHECKED && val)
- {
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)1);
- g_uUpdateMsgTimer = SetTimer(NULL, 0, val * 1000, (TIMERPROC)UpdateMsgTimerProc);
- }
- else
- {
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)0);
- }
+ if (IsDlgButtonChecked(hwndDlg, IDC_CUPDATEMSG) == BST_CHECKED && val)
+ {
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)1);
+ g_uUpdateMsgTimer = SetTimer(NULL, 0, val * 1000, (TIMERPROC)UpdateMsgTimerProc);
+ }
+ else
+ {
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)0);
+ }
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOIDLE) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnICQReq", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOICQREQ) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "AmpLeaveTitle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CLEAVEWINAMP) == BST_CHECKED));
- if (ServiceExists(MS_VARS_FORMATSTRING))
- {
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "EnableVariables", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ExclDateToken", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CDATEPARSING) == BST_CHECKED));
- }
- return TRUE;
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOIDLE) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnICQReq", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOICQREQ) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "AmpLeaveTitle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CLEAVEWINAMP) == BST_CHECKED));
+ if (ServiceExists(MS_VARS_FORMATSTRING))
+ {
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "EnableVariables", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ExclDateToken", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CDATEPARSING) == BST_CHECKED));
}
- break;
+ return TRUE;
+ }
+ break;
}
return FALSE;
}
@@ -1247,9 +1234,8 @@ static BOOL IsHistoryMsgsFound(HWND hwndDlg, int histMax) static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_INITDIALOG:
+ switch (uMsg) {
+ case WM_INITDIALOG:
{
int settingValue;
@@ -1326,7 +1312,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w return TRUE;
}
- case WM_USER + 2:
+ case WM_USER + 2:
{
BOOL bChecked = IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED;
EnableWindow(GetDlgItem(hwndDlg, IDC_ETIMEOUT), bChecked);
@@ -1334,133 +1320,133 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w break;
}
- case WM_COMMAND:
- switch (LOWORD(wParam))
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDC_CSTATUSLIST:
{
- case IDC_CSTATUSLIST:
- {
- BOOL bChecked = IsDlgButtonChecked(hwndDlg, IDC_CSTATUSLIST) == BST_CHECKED;
- EnableWindow(GetDlgItem(hwndDlg, IDC_CPROFILES), bChecked && ServiceExists(MS_SS_GETPROFILECOUNT));
- EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS1), bChecked);
- break;
- }
+ BOOL bChecked = IsDlgButtonChecked(hwndDlg, IDC_CSTATUSLIST) == BST_CHECKED;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CPROFILES), bChecked && ServiceExists(MS_SS_GETPROFILECOUNT));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS1), bChecked);
+ break;
+ }
- case IDC_CBOPTBUTTONS:
- if ((HWND)lParam != GetFocus() || HIWORD(wParam) != CBN_SELCHANGE) return 0;
- break;
+ case IDC_CBOPTBUTTONS:
+ if ((HWND)lParam != GetFocus() || HIWORD(wParam) != CBN_SELCHANGE) return 0;
+ break;
- case IDC_EMAXHIST:
- {
- if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
- int val = GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE);
- if (val > 25)
- SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETPOS, 0, MAKELONG((short)25, 0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS2), val != 0);
- break;
- }
+ case IDC_EMAXHIST:
+ {
+ if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
+ int val = GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE);
+ if (val > 25)
+ SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETPOS, 0, MAKELONG((short)25, 0));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS2), val != 0);
+ break;
+ }
- case IDC_CCLOSEWND:
- SendMessage(hwndDlg, WM_USER + 2, 0, 0);
- break;
+ case IDC_CCLOSEWND:
+ SendMessage(hwndDlg, WM_USER + 2, 0, 0);
+ break;
- case IDC_ETIMEOUT:
+ case IDC_ETIMEOUT:
+ {
+ if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
+ int val = GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE);
+ if (val == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ETIMEOUT)))
+ SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)1, 0));
+ else if (val > 60)
+ SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)60, 0));
+ break;
+ }
+
+ case IDC_BOPTHIST:
+ if (MessageBox(NULL, TranslateT("Are you sure you want to clear status message history?"), TranslateT("Confirm clearing history"), MB_ICONQUESTION | MB_YESNO) == IDYES)
+ {
+ int i, max_hist_msgs;
+ char text[8], setting[80];
+
+ if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog);
+
+ max_hist_msgs = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", 10);
+ for (i = 1; i <= max_hist_msgs; i++)
{
- if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
- int val = GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE);
- if (val == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ETIMEOUT)))
- SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)1, 0));
- else if (val > 60)
- SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)60, 0));
- break;
+ mir_snprintf(text, SIZEOF(text), "SMsg%d", i);
+ DBWriteContactSettingTString(NULL, "SimpleStatusMsg", text, _T(""));
}
+ DBWriteContactSettingString(NULL, "SimpleStatusMsg", "LastMsg", "");
+ for (i = 0; i < accounts->count; i++)
+ {
+ if (!IsAccountEnabled(accounts->pa[i]))
+ continue;
- case IDC_BOPTHIST:
- if (MessageBox(NULL, TranslateT("Are you sure you want to clear status message history?"), TranslateT("Confirm clearing history"), MB_ICONQUESTION | MB_YESNO) == IDYES)
- {
- int i, max_hist_msgs;
- char text[8], setting[80];
+ if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ continue;
- if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog);
+ if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ continue;
- max_hist_msgs = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", 10);
- for (i = 1; i <= max_hist_msgs; i++)
- {
- mir_snprintf(text, SIZEOF(text), "SMsg%d", i);
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", text, _T(""));
- }
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", "LastMsg", "");
- for (i = 0; i < accounts->count; i++)
- {
- if (!IsAccountEnabled(accounts->pa[i]))
- continue;
+ mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[i]->szModuleName);
+ DBWriteContactSettingString(NULL, "SimpleStatusMsg", setting, "");
+ }
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "LMMsg", (WORD)max_hist_msgs);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTHIST), FALSE);
+ }
+ return 0;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
- continue;
+ case IDC_BOPTDEF:
+ if (MessageBox(NULL, TranslateT("Are you sure you want to clear predefined status messages?"), TranslateT("Confirm clearing predefined"), MB_ICONQUESTION | MB_YESNO) == IDYES)
+ {
+ char szSetting[16];
+ int nDefMSgCount;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
- continue;
+ if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog);
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[i]->szModuleName);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", setting, "");
- }
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "LMMsg", (WORD)max_hist_msgs);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTHIST), FALSE);
- }
- return 0;
+ nDefMSgCount = DBGetContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
+ for (int i = 1; i <= nDefMSgCount; i++)
+ {
+ mir_snprintf(szSetting, SIZEOF(szSetting), "DefMsg%d", i);
+ DBDeleteContactSetting(NULL, "SimpleStatusMsg", szSetting);
+ }
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), FALSE);
+ }
+ return 0;
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case IDC_BOPTDEF:
- if (MessageBox(NULL, TranslateT("Are you sure you want to clear predefined status messages?"), TranslateT("Confirm clearing predefined"), MB_ICONQUESTION | MB_YESNO) == IDYES)
- {
- char szSetting[16];
- int nDefMSgCount;
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
+ {
+ // Layout
+ int flags = 0, curSel;
- if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog);
+ if (IsDlgButtonChecked(hwndDlg, IDC_CSTATUSLIST) == BST_CHECKED) flags |= DLG_SHOW_STATUS;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CICONS1) == BST_CHECKED) flags |= DLG_SHOW_STATUS_ICONS;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CICONS2) == BST_CHECKED) flags |= DLG_SHOW_LIST_ICONS;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CPROFILES) == BST_CHECKED) flags |= DLG_SHOW_STATUS_PROFILES;
- nDefMSgCount = DBGetContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
- for (int i = 1; i <= nDefMSgCount; i++)
- {
- mir_snprintf(szSetting, SIZEOF(szSetting), "DefMsg%d", i);
- DBDeleteContactSetting(NULL, "SimpleStatusMsg", szSetting);
- }
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), FALSE);
- }
- return 0;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+ curSel = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_GETCURSEL, 0, 0);
+ if (curSel != CB_ERR)
+ flags |= SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_GETITEMDATA, (WPARAM)curSel, 0);
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
- {
- // Layout
- int flags = 0, curSel;
-
- if (IsDlgButtonChecked(hwndDlg, IDC_CSTATUSLIST) == BST_CHECKED) flags |= DLG_SHOW_STATUS;
- if (IsDlgButtonChecked(hwndDlg, IDC_CICONS1) == BST_CHECKED) flags |= DLG_SHOW_STATUS_ICONS;
- if (IsDlgButtonChecked(hwndDlg, IDC_CICONS2) == BST_CHECKED) flags |= DLG_SHOW_LIST_ICONS;
- if (IsDlgButtonChecked(hwndDlg, IDC_CPROFILES) == BST_CHECKED) flags |= DLG_SHOW_STATUS_PROFILES;
-
- curSel = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_GETCURSEL, 0, 0);
- if (curSel != CB_ERR)
- flags |= SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_GETITEMDATA, (WPARAM)curSel, 0);
-
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "DlgFlags", (BYTE)flags);
-
- // Misc.
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "AutoClose", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowCopy", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWCOPY) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowGoToURL", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWGURL) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED));
- RebuildStatusMenu();
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "DlgFlags", (BYTE)flags);
- return TRUE;
- }
- break;
+ // Misc.
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "AutoClose", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowCopy", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWCOPY) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowGoToURL", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWGURL) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED));
+ RebuildStatusMenu();
+
+ return TRUE;
+ }
+ break;
}
return FALSE;
}
@@ -1476,9 +1462,8 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa {
struct StatusOptDlgData *data = (struct StatusOptDlgData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (uMsg)
- {
- case WM_INITDIALOG:
+ switch (uMsg) {
+ case WM_INITDIALOG:
{
int index, i;
@@ -1550,159 +1535,154 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa return TRUE;
}
- case WM_COMMAND:
- if ( ( (HIWORD(wParam) == BN_CLICKED) || /*(HIWORD(wParam) == EN_KILLFOCUS) ||*/ (HIWORD(wParam) == EN_CHANGE)
- || ( (HIWORD(wParam) == LBN_SELCHANGE) && (LOWORD(wParam) != IDC_LISTPROTO))
- ) && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- switch (LOWORD(wParam))
- {
- case IDC_ESETSTATUS:
- switch (HIWORD(wParam))
- {
- case EN_KILLFOCUS:
- {
- BOOL translated;
- int val = GetDlgItemInt(hwndDlg, IDC_ESETSTATUS, &translated, FALSE);
- if (translated && val > 9000)
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, 9000, FALSE);
- if (translated && val < 0)
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, 0, FALSE);
- val = GetDlgItemInt(hwndDlg, IDC_ESETSTATUS, &translated, FALSE);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
- {
- int i = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
- data->setdelay[i] = val;
- }
- else
- data->setglobaldelay = val;
- break;
- }
- }
- break;
-
- case IDC_SPECSET:
- switch (HIWORD(wParam))
+ case WM_COMMAND:
+ if ( ( (HIWORD(wParam) == BN_CLICKED) || /*(HIWORD(wParam) == EN_KILLFOCUS) ||*/ (HIWORD(wParam) == EN_CHANGE)
+ || ( (HIWORD(wParam) == LBN_SELCHANGE) && (LOWORD(wParam) != IDC_LISTPROTO))
+ ) && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ switch (LOWORD(wParam)) {
+ case IDC_ESETSTATUS:
+ switch (HIWORD(wParam)) {
+ case EN_KILLFOCUS:
+ {
+ BOOL translated;
+ int val = GetDlgItemInt(hwndDlg, IDC_ESETSTATUS, &translated, FALSE);
+ if (translated && val > 9000)
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, 9000, FALSE);
+ if (translated && val < 0)
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, 0, FALSE);
+ val = GetDlgItemInt(hwndDlg, IDC_ESETSTATUS, &translated, FALSE);
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
{
- case BN_CLICKED:
- if (SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
- {
- int i = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setdelay[i], FALSE);
- }
- else
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setglobaldelay, FALSE);
- break;
+ int i = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
+ data->setdelay[i] = val;
}
+ else
+ data->setglobaldelay = val;
break;
+ }
+ }
+ break;
- case IDC_POPUPDLG:
- switch (HIWORD(wParam))
- {
- case BN_CLICKED:
- if (accounts->statusCount == 1 && accounts->statusMsgCount == 1)
- break;
+ case IDC_SPECSET:
+ switch (HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ if (SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
+ {
+ int i = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setdelay[i], FALSE);
+ }
+ else
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setglobaldelay, FALSE);
+ break;
+ }
+ break;
- if (SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == BST_CHECKED)
- {
- if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED)
- {
- CheckDlgButton(hwndDlg, IDC_SPECSET, BST_UNCHECKED);
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setglobaldelay, FALSE);
- }
- EnableWindow(GetDlgItem(hwndDlg, IDC_SPECSET), FALSE);
- }
- else
- EnableWindow(GetDlgItem(hwndDlg, IDC_SPECSET), TRUE);
- break;
- }
+ case IDC_POPUPDLG:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ if (accounts->statusCount == 1 && accounts->statusMsgCount == 1)
break;
- case IDC_LISTPROTO:
- switch (HIWORD(wParam))
+ if (SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == BST_CHECKED)
+ {
+ if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED)
{
- case LBN_SELCHANGE:
- {
- int status_modes, i, l, index, newindex = 0;
+ CheckDlgButton(hwndDlg, IDC_SPECSET, BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setglobaldelay, FALSE);
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SPECSET), FALSE);
+ }
+ else
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SPECSET), TRUE);
+ break;
+ }
+ break;
- i = SendMessage((HWND)lParam, LB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0), 0);
- status_modes = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
+ case IDC_LISTPROTO:
+ switch (HIWORD(wParam)) {
+ case LBN_SELCHANGE:
+ {
+ int status_modes, i, l, index, newindex = 0;
- SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_RESETCONTENT, 0, 0);
- for (l = ID_STATUS_OFFLINE; l <= ID_STATUS_OUTTOLUNCH; l++)
- {
- if (status_modes & Proto_Status2Flag(l) || l == ID_STATUS_OFFLINE)
- {
- index = SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, l, GSMDF_TCHAR));
- if (index != LB_ERR && index != LB_ERRSPACE)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETITEMDATA, (WPARAM)index, (LPARAM)l - ID_STATUS_OFFLINE);
- if (data->status[i] == l)
- newindex = index;
- }
- }
- }
+ i = SendMessage((HWND)lParam, LB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0), 0);
+ status_modes = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
- index = SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_INSERTSTRING, -1, (LPARAM)TranslateT("<Last status>"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_RESETCONTENT, 0, 0);
+ for (l = ID_STATUS_OFFLINE; l <= ID_STATUS_OUTTOLUNCH; l++)
+ {
+ if (status_modes & Proto_Status2Flag(l) || l == ID_STATUS_OFFLINE)
+ {
+ index = SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, l, GSMDF_TCHAR));
if (index != LB_ERR && index != LB_ERRSPACE)
{
- SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETITEMDATA, (WPARAM)index, (LPARAM)ID_STATUS_CURRENT-ID_STATUS_OFFLINE);
- if (data->status[i] == ID_STATUS_CURRENT)
+ SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETITEMDATA, (WPARAM)index, (LPARAM)l - ID_STATUS_OFFLINE);
+ if (data->status[i] == l)
newindex = index;
}
-
- SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETCURSEL, (WPARAM)newindex, 0);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setdelay[i], FALSE);
- break;
}
}
- break;
- case IDC_LISTSTATUS:
- switch (HIWORD(wParam))
+ index = SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_INSERTSTRING, -1, (LPARAM)TranslateT("<Last status>"));
+ if (index != LB_ERR && index != LB_ERRSPACE)
{
- case LBN_SELCHANGE:
- {
- int i = SendMessage((HWND)lParam, LB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0), 0);
- int j = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
- data->status[j] = i + ID_STATUS_OFFLINE;
- break;
- }
+ SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETITEMDATA, (WPARAM)index, (LPARAM)ID_STATUS_CURRENT-ID_STATUS_OFFLINE);
+ if (data->status[i] == ID_STATUS_CURRENT)
+ newindex = index;
}
+
+ SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETCURSEL, (WPARAM)newindex, 0);
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setdelay[i], FALSE);
break;
+ }
}
break;
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
- {
- char szSetting[80];
- for (int i = 0; i < accounts->count; i++)
+ case IDC_LISTSTATUS:
+ switch (HIWORD(wParam)) {
+ case LBN_SELCHANGE:
{
- if (!IsAccountEnabled(accounts->pa[i]) || !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
- continue;
-
- mir_snprintf(szSetting, SIZEOF(szSetting), "Startup%sStatus", accounts->pa[i]->szModuleName);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->status[i]);
-
- mir_snprintf(szSetting, SIZEOF(szSetting), "Set%sStatusDelay", accounts->pa[i]->szModuleName);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->setdelay[i]);
+ int i = SendMessage((HWND)lParam, LB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0), 0);
+ int j = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
+ data->status[j] = i + ID_STATUS_OFFLINE;
+ break;
}
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "SetStatusDelay", (WORD)data->setglobaldelay);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "GlobalStatusDelay", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SPECSET) != BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "StartupPopupDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_POPUPDLG) == BST_CHECKED));
- return TRUE;
}
break;
+ }
+ break;
- case WM_DESTROY:
- mir_free(data->status);
- mir_free(data->setdelay);
- mir_free(data);
- break;
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
+ {
+ char szSetting[80];
+ for (int i = 0; i < accounts->count; i++)
+ {
+ if (!IsAccountEnabled(accounts->pa[i]) || !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ continue;
+
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Startup%sStatus", accounts->pa[i]->szModuleName);
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->status[i]);
+
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Set%sStatusDelay", accounts->pa[i]->szModuleName);
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->setdelay[i]);
+ }
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "SetStatusDelay", (WORD)data->setglobaldelay);
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "GlobalStatusDelay", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SPECSET) != BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "StartupPopupDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_POPUPDLG) == BST_CHECKED));
+ return TRUE;
+ }
+ break;
+
+ case WM_DESTROY:
+ mir_free(data->status);
+ mir_free(data->setdelay);
+ mir_free(data);
+ break;
}
return FALSE;
}
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index eee8db0025..9184bf10ab 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -61,7 +61,6 @@ public: mutable HBITMAP hSmlBmp;
mutable HICON hSmlIco;
int idxLastChar;
- WNDPROC wpOrigWndProc;
HANDLE hContact;
bool doSmileyReplace;
bool doSmileyButton;
@@ -87,7 +86,6 @@ public: OldButtonPlace = false;
isSplit = false;
isSend = false;
- wpOrigWndProc = NULL;
}
MsgWndData(const MsgWndData &dsb)
@@ -333,8 +331,7 @@ static void MsgWndDetect(HWND hwndDlg, HANDLE hContact, msgData* datm) WaitForSingleObject(g_hMutex, 2000);
MsgWndData* msgwnd = g_MsgWndList.find((MsgWndData*)&hwndDlg);
- if (msgwnd == NULL)
- {
+ if (msgwnd == NULL) {
msgwnd = new MsgWndData(dat);
g_MsgWndList.insert(msgwnd);
}
@@ -342,11 +339,11 @@ static void MsgWndDetect(HWND hwndDlg, HANDLE hContact, msgData* datm) msgwnd = NULL;
ReleaseMutex(g_hMutex);
- if (msgwnd != NULL)
- {
- msgwnd->wpOrigWndProc = (WNDPROC)SetWindowLongPtr(hwndDlg, GWLP_WNDPROC, (LONG_PTR)MessageDlgSubclass);
+ if (msgwnd != NULL) {
+ mir_subclassWindow(hwndDlg, MessageDlgSubclass);
msgwnd->CreateSmileyButton();
- if (hContact == NULL) SetRichCallback(msgwnd->REdit, msgwnd->hContact, true, true);
+ if (hContact == NULL)
+ SetRichCallback(msgwnd->REdit, msgwnd->hContact, true, true);
}
}
}
@@ -377,19 +374,16 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, break;
}
- LRESULT result = CallWindowProc(dat->wpOrigWndProc, hwnd, uMsg, wParam, lParam);
-
- if (!opt.PluginSupportEnabled) return result;
+ LRESULT result = mir_callNextSubclass(hwnd, MessageDlgSubclass, uMsg, wParam, lParam);
+ if (!opt.PluginSupportEnabled)
+ return result;
- switch(uMsg)
- {
+ switch(uMsg) {
case WM_DESTROY:
WaitForSingleObject(g_hMutex, 2000);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)dat->wpOrigWndProc);
{
int ind = g_MsgWndList.getIndex((MsgWndData*)&hwnd);
- if ( ind != -1 )
- {
+ if ( ind != -1 ) {
delete g_MsgWndList[ind];
g_MsgWndList.remove(ind);
}
diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp index d9b9123c48..463276baf4 100644 --- a/plugins/SmileyAdd/src/richcall.cpp +++ b/plugins/SmileyAdd/src/richcall.cpp @@ -30,7 +30,6 @@ typedef struct {
HWND hwnd;
HANDLE hContact;
- WNDPROC wpOrigWndProc;
HWND hToolTip;
int tipActive;
bool inputarea;
@@ -40,7 +39,6 @@ typedef struct typedef struct
{
HWND hwnd;
- WNDPROC wpOrigWndProc;
HWND hwndInput;
HWND hwndLog;
} RichEditOwnerData;
@@ -217,10 +215,7 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP CHARRANGE sel;
- WNDPROC wpOrigWndProc = rdt->wpOrigWndProc;
-
- switch(uMsg)
- {
+ switch(uMsg) {
case WM_DESTROY:
CloseRichCallback(hwnd, false);
break;
@@ -237,8 +232,7 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP case EM_STREAMOUT:
if (wParam & SFF_SELECTION)
SmileyToTextCutPrep(rdt);
- else
- {
+ else {
sel = allsel;
ReplaceContactSmileysWithText(rdt, sel, true);
}
@@ -264,10 +258,9 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP break;
}
- LRESULT result = CallWindowProc(wpOrigWndProc, hwnd, uMsg, wParam, lParam);
+ LRESULT result = mir_callNextSubclass(hwnd, RichEditSubclass, uMsg, wParam, lParam);
- switch(uMsg)
- {
+ switch(uMsg) {
case WM_DESTROY:
CloseRichCallback(hwnd, true);
break;
@@ -296,16 +289,12 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP case WM_KEYDOWN:
if ((wParam == 'C' || wParam == VK_INSERT) && (GetKeyState(VK_CONTROL) & 0x8000))
- {
SmileyToTextCutRest(rdt);
- }
- else if ((wParam == 'X' && (GetKeyState(VK_CONTROL) & 0x8000)) ||
- (wParam == VK_DELETE && (GetKeyState(VK_SHIFT) & 0x8000)))
- {
+
+ else if ((wParam == 'X' && (GetKeyState(VK_CONTROL) & 0x8000)) || (wParam == VK_DELETE && (GetKeyState(VK_SHIFT) & 0x8000)))
SmileyToTextCutRest(rdt);
- }
- else if (wParam == VK_TAB && ((GetKeyState(VK_CONTROL) | GetKeyState(VK_SHIFT)) & 0x8000) == 0)
- {
+
+ else if (wParam == VK_TAB && ((GetKeyState(VK_CONTROL) | GetKeyState(VK_SHIFT)) & 0x8000) == 0) {
sel.cpMax = LONG_MAX;
bool hascont = rdt->hContact != NULL;
ReplaceContactSmileys(rdt, sel, false, hascont);
@@ -325,27 +314,20 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP if (wParam > ' ' && opt.EnforceSpaces)
break;
- if (wParam == 0x16)
- {
+ if (wParam == 0x16) {
ReplaceContactSmileys(rdt, allsel, false, false);
break;
}
if (opt.DCursorSmiley)
- {
ReplaceContactSmileys(rdt, allsel, true, true);
- }
- else
- {
- if (wParam >= ' ' || wParam == '\n' || wParam == '\r')
- {
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- sel.cpMin = max(sel.cpMin - 20, 0);
- sel.cpMax += 20;
+ else if (wParam >= ' ' || wParam == '\n' || wParam == '\r') {
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
+ sel.cpMin = max(sel.cpMin - 20, 0);
+ sel.cpMax += 20;
- ReplaceContactSmileysWithText(rdt, sel, true);
- ReplaceContactSmileys(rdt, sel, false, true);
- }
+ ReplaceContactSmileysWithText(rdt, sel, true);
+ ReplaceContactSmileys(rdt, sel, false, true);
}
break;
@@ -369,13 +351,9 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP void CloseRichCallback(HWND hwnd, bool force)
{
int ind = g_RichEditList.getIndex((RichEditData*)&hwnd);
- if ( ind != -1 )
- {
+ if ( ind != -1 ) {
RichEditData* rdt = g_RichEditList[ind];
- bool richsub = GetWindowLongPtr(hwnd, GWLP_WNDPROC) == (LONG_PTR)RichEditSubclass;
- if (richsub) SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)rdt->wpOrigWndProc);
- if (richsub || force)
- {
+ if (force) {
if (rdt->hToolTip) DestroyWindow(rdt->hToolTip);
delete rdt;
g_RichEditList.remove(ind);
@@ -386,8 +364,7 @@ void CloseRichCallback(HWND hwnd, bool force) bool SetRichCallback(HWND hwnd, HANDLE hContact, bool subany, bool subnew)
{
RichEditData* rdt = g_RichEditList.find((RichEditData*)&hwnd);
- if (rdt == NULL)
- {
+ if (rdt == NULL) {
IRichEditOle* RichEditOle;
if (SendMessage(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
return false;
@@ -400,18 +377,18 @@ bool SetRichCallback(HWND hwnd, HANDLE hContact, bool subany, bool subnew) rdt->inputarea = (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_READONLY) == 0;
rdt->dontReplace = false;
rdt->tipActive = -1;
- rdt->wpOrigWndProc = NULL;
rdt->hToolTip = NULL;
g_RichEditList.insert(rdt);
if (subnew)
- rdt->wpOrigWndProc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)RichEditSubclass);
+ mir_subclassWindow(hwnd, RichEditSubclass);
}
- else
- {
- if (hContact && !rdt->hContact) rdt->hContact = hContact;
- if (subany && rdt->wpOrigWndProc == NULL)
- rdt->wpOrigWndProc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)RichEditSubclass);
+ else {
+ if (hContact && !rdt->hContact)
+ rdt->hContact = hContact;
+
+ if (subany)
+ mir_subclassWindow(hwnd, RichEditSubclass);
}
return true;
}
@@ -419,17 +396,21 @@ bool SetRichCallback(HWND hwnd, HANDLE hContact, bool subany, bool subnew) static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
RichEditOwnerData* rdto = g_RichEditOwnerList.find((RichEditOwnerData*)&hwnd);
- if (rdto == NULL) return 0;
-
- WNDPROC wpOrigWndProc = rdto->wpOrigWndProc;
+ if (rdto == NULL)
+ return 0;
- switch(uMsg)
- {
+ switch(uMsg) {
case WM_DESTROY:
- {
+ if ( !Miranda_Terminated()) {
+ CHARRANGE sel = allsel;
+ if (rdto->hwndInput)
+ ReplaceSmileysWithText(rdto->hwndInput, sel, false);
+ if (rdto->hwndLog)
+ ReplaceSmileysWithText(rdto->hwndLog, sel, false);
+ }
+ else {
RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
- if (rdt && (!rdt->inputarea || opt.InputSmileys))
- {
+ if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
CHARRANGE sel = allsel;
rdt->dontReplace = true;
ReplaceSmileysWithText(rdt->hwnd, sel, false);
@@ -438,13 +419,10 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara CloseRichOwnerCallback(hwnd, false);
break;
-
case WM_COMMAND:
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624)
- {
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
- if (rdt && (!rdt->inputarea || opt.InputSmileys))
- {
+ if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
rdt->dontReplace = true;
CHARRANGE sel = allsel;
ReplaceSmileysWithText(rdt->hwnd, sel, false);
@@ -453,20 +431,17 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara break;
}
- LRESULT result = CallWindowProc(wpOrigWndProc, hwnd, uMsg, wParam, lParam);
+ LRESULT result = mir_callNextSubclass(hwnd, RichEditOwnerSubclass, uMsg, wParam, lParam);
- switch(uMsg)
- {
+ switch(uMsg) {
case WM_DESTROY:
CloseRichOwnerCallback(hwnd, true);
break;
case WM_COMMAND:
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) // && lParam == 0)
- {
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
- if (rdt)
- {
+ if (rdt) {
CHARRANGE sel = allsel;
if (!result) ReplaceContactSmileys(rdt, sel, false, false);
rdt->dontReplace = false;
@@ -480,41 +455,32 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara void CloseRichOwnerCallback(HWND hwnd, bool force)
{
int ind = g_RichEditOwnerList.getIndex((RichEditOwnerData*)&hwnd);
- if ( ind != -1 )
- {
- RichEditOwnerData* rdto = g_RichEditOwnerList[ind];
- bool richsub = GetWindowLongPtr(hwnd, GWLP_WNDPROC) == (LONG_PTR)RichEditOwnerSubclass;
- if (richsub)
- {
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)rdto->wpOrigWndProc);
- rdto->wpOrigWndProc = NULL;
- }
- if (force)
- {
- CloseRichCallback(rdto->hwndInput, true);
- CloseRichCallback(rdto->hwndLog, true);
+ if (ind == -1)
+ return;
- delete rdto;
- g_RichEditOwnerList.remove(ind);
- }
+ RichEditOwnerData* rdto = g_RichEditOwnerList[ind];
+ if (rdto && force) {
+ CloseRichCallback(rdto->hwndInput, true);
+ CloseRichCallback(rdto->hwndLog, true);
+
+ delete rdto;
+ g_RichEditOwnerList.remove(ind);
}
}
void SetRichOwnerCallback(HWND hwnd, HWND hwndInput, HWND hwndLog)
{
RichEditOwnerData* rdto = g_RichEditOwnerList.find((RichEditOwnerData*)&hwnd);
- if (rdto == NULL)
- {
+ if (rdto == NULL) {
rdto = new RichEditOwnerData;
-
rdto->hwnd = hwnd;
rdto->hwndInput = hwndInput;
rdto->hwndLog = hwndLog;
- rdto->wpOrigWndProc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)RichEditOwnerSubclass);
g_RichEditOwnerList.insert(rdto);
+
+ mir_subclassWindow(hwnd, RichEditOwnerSubclass);
}
- else
- {
+ else {
if (rdto->hwndInput == NULL) rdto->hwndInput = hwndInput;
if (rdto->hwndLog == NULL) rdto->hwndLog = hwndLog;
}
@@ -522,25 +488,18 @@ void SetRichOwnerCallback(HWND hwnd, HWND hwndInput, HWND hwndLog) void ProcessAllInputAreas(bool restoreText)
{
- for (int i=g_RichEditList.getCount(); i--; )
- {
+ for (int i=g_RichEditList.getCount(); i--; ) {
RichEditData* rdt = g_RichEditList[i];
- if (rdt->inputarea)
- {
- if (restoreText)
- {
+ if (rdt->inputarea) {
+ if (restoreText) {
CHARRANGE sel = allsel;
ReplaceContactSmileysWithText(rdt, sel, false);
}
- else
- {
- ReplaceContactSmileys(rdt, allsel, false, false);
- }
+ else ReplaceContactSmileys(rdt, allsel, false, false);
}
}
}
-
void RichEditData_Destroy(void)
{
int i;
diff --git a/plugins/SmileyAdd/src/smileyroutines.cpp b/plugins/SmileyAdd/src/smileyroutines.cpp index 5175309d1b..88efdf2367 100644 --- a/plugins/SmileyAdd/src/smileyroutines.cpp +++ b/plugins/SmileyAdd/src/smileyroutines.cpp @@ -221,14 +221,11 @@ void UpdateSelection(CHARRANGE& sel, int pos, int dif) void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const CHARRANGE& sel,
bool useHidden, bool ignoreLast, bool unFreeze, bool fireView)
{
-/*
- LARGE_INTEGER freq, strt, end;
- QueryPerformanceFrequency(&freq);
- QueryPerformanceCounter(&strt);
-*/
- IRichEditOle* RichEditOle;
+ IRichEditOle* RichEditOle = NULL;
if (SendMessage(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
return;
+ if (RichEditOle == NULL)
+ return;
ITextDocument* TextDocument;
if (RichEditOle->QueryInterface(IID_ITextDocument, (void**)&TextDocument) != S_OK)
@@ -534,9 +531,11 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const void ReplaceSmileysWithText(HWND hwnd, CHARRANGE& sel, bool keepFrozen)
{
- IRichEditOle* RichEditOle;
+ IRichEditOle* RichEditOle = NULL;
if (SendMessage(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
return;
+ if (RichEditOle == NULL)
+ return;
ITextDocument* TextDocument;
if (RichEditOle->QueryInterface(IID_ITextDocument, (void**)&TextDocument) != S_OK)
diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp index 409ba5a6f1..a2e1cb05af 100644 --- a/plugins/SpellChecker/src/ardialog.cpp +++ b/plugins/SpellChecker/src/ardialog.cpp @@ -37,8 +37,6 @@ struct Data AutoReplaceDialogCallback callback;
void *param;
-
- WNDPROC old_edit_proc;
};
BOOL ShowAutoReplaceDialog(HWND parent, BOOL modal,
@@ -81,17 +79,15 @@ static LRESULT CALLBACK OnlyCharsEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP {
Data *data = (Data *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch(msg)
- {
- case WM_CHAR:
+ switch(msg) {
+ case WM_CHAR:
+ if (wParam == VK_BACK)
+ break;
+ if (lParam & (1 << 28)) // ALT key
+ break;
+ if (GetKeyState(VK_CONTROL) & 0x8000) // CTRL key
+ break;
{
- if (wParam == VK_BACK)
- break;
- if (lParam & (1 << 28)) // ALT key
- break;
- if (GetKeyState(VK_CONTROL) & 0x8000) // CTRL key
- break;
-
TCHAR c = (TCHAR) wParam;
if (!data->dict->autoReplace->isWordChar(c))
return 1;
@@ -104,12 +100,11 @@ static LRESULT CALLBACK OnlyCharsEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP }
}
- LRESULT ret = CallWindowProc(data->old_edit_proc, hwnd, msg, wParam, lParam);
+ LRESULT ret = mir_callNextSubclass(hwnd, OnlyCharsEditProc, msg, wParam, lParam);
- switch(msg)
- {
- case EM_PASTESPECIAL:
- case WM_PASTE:
+ switch(msg) {
+ case EM_PASTESPECIAL:
+ case WM_PASTE:
{
TCHAR text[256];
GetWindowText(hwnd, text, SIZEOF(text));
@@ -121,7 +116,6 @@ static LRESULT CALLBACK OnlyCharsEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP }
return ret;
-
}
@@ -159,14 +153,9 @@ static void Close(HWND hwndDlg, int ret) Data *data = (Data *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (!ret)
- {
data->callback(TRUE, data->dict,
data->find.c_str(), data->replace.c_str(), data->useVariables,
data->find.c_str(), data->param);
- }
-
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_OLD), GWLP_WNDPROC, (LONG_PTR) data->old_edit_proc);
- data->old_edit_proc = NULL;
if (data->modal)
EndDialog(hwndDlg, ret);
@@ -185,9 +174,8 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa Data *data = (Data *) lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) data);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_OLD), GWLP_USERDATA, (LONG_PTR) data);
- data->old_edit_proc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_OLD), GWLP_WNDPROC,
- (LONG_PTR) OnlyCharsEditProc);
+ SetWindowLongPtr( GetDlgItem(hwndDlg, IDC_OLD), GWLP_USERDATA, (LONG_PTR)data);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_OLD), OnlyCharsEditProc);
HICON hIcon = Skin_GetIcon("spellchecker_enabled");
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
diff --git a/plugins/SpellChecker/src/commons.h b/plugins/SpellChecker/src/commons.h index 55dcfacefc..9038fe26c4 100644 --- a/plugins/SpellChecker/src/commons.h +++ b/plugins/SpellChecker/src/commons.h @@ -120,15 +120,12 @@ struct Dialog char name[64];
Dictionary *lang;
TCHAR lang_name[32];
- WNDPROC old_edit_proc;
- WNDPROC owner_old_edit_proc;
BOOL enabled;
BOOL srmm;
RichEdit *re;
HWND hwnd_menu_owner;
- WNDPROC old_menu_proc;
BOOL changed;
BOOL markedSomeWord;
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 5b46486e6f..77d31a381f 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -523,7 +523,7 @@ LRESULT CALLBACK OwnerProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) dlg->changed = TRUE; } - return CallWindowProc(dlg->owner_old_edit_proc, hwnd, msg, wParam, lParam); + return mir_callNextSubclass(hwnd, OwnerProc, msg, wParam, lParam); } void ToggleEnabled(Dialog *dlg) @@ -565,7 +565,7 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return 1; } - LRESULT ret = CallWindowProc(dlg->old_edit_proc, hwnd, msg, wParam, lParam); + LRESULT ret = mir_callNextSubclass(hwnd, EditProc, msg, wParam, lParam); switch(msg) { case WM_KEYDOWN: @@ -932,12 +932,12 @@ int AddContactTextBox(HANDLE hContact, HWND hwnd, char *name, BOOL srmm, HWND hw if (opts.auto_locale) LoadDictFromKbdl(dlg); - dlg->old_edit_proc = (WNDPROC) SetWindowLongPtr(dlg->hwnd, GWLP_WNDPROC, (LONG_PTR) EditProc); + mir_subclassWindow(dlg->hwnd, EditProc); dialogs[hwnd] = dlg; if (dlg->srmm && hwndOwner != NULL) { dlg->hwnd_owner = hwndOwner; - dlg->owner_old_edit_proc = (WNDPROC) SetWindowLongPtr(dlg->hwnd_owner, GWLP_WNDPROC, (LONG_PTR) OwnerProc); + mir_subclassWindow(dlg->hwnd_owner, OwnerProc); dialogs[dlg->hwnd_owner] = dlg; ModifyIcon(dlg); @@ -959,14 +959,6 @@ void FreePopupData(Dialog *dlg) DESTROY_MENY(dlg->hLanguageSubMenu) DESTROY_MENY(dlg->hWrongWordsSubMenu) - if (dlg->old_menu_proc != NULL) - SetWindowLongPtr(dlg->hwnd_menu_owner, GWLP_WNDPROC, (LONG_PTR) dlg->old_menu_proc); - dlg->old_menu_proc = NULL; - - if (dlg->hwnd_menu_owner != NULL) - menus.erase(dlg->hwnd_menu_owner); - dlg->hwnd_menu_owner = NULL; - if (dlg->wrong_words != NULL) { for (unsigned i = 0; i < dlg->wrong_words->size(); i++) { FREE((*dlg->wrong_words)[i].word) @@ -1000,15 +992,9 @@ int RemoveContactTextBox(HWND hwnd) KillTimer(hwnd, TIMER_ID); - if (dlg->old_edit_proc != NULL) - SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) dlg->old_edit_proc); dialogs.erase(hwnd); - - if (dlg->hwnd_owner != NULL) { - if (dlg->owner_old_edit_proc != NULL) - SetWindowLongPtr(dlg->hwnd_owner, GWLP_WNDPROC, (LONG_PTR) dlg->owner_old_edit_proc); + if (dlg->hwnd_owner != NULL) dialogs.erase(dlg->hwnd_owner); - } delete dlg->re; FreePopupData(dlg); @@ -1200,7 +1186,7 @@ void AddItemsToMenu(Dialog *dlg, HMENU hMenu, POINT pt, HWND hwndOwner) dlg->hLanguageSubMenu = CreatePopupMenu(); if (dlg->hwnd_menu_owner != NULL) - dlg->old_menu_proc = (WNDPROC) SetWindowLongPtr(dlg->hwnd_menu_owner, GWLP_WNDPROC, (LONG_PTR) MenuWndProc); + mir_subclassWindow(dlg->hwnd_menu_owner, MenuWndProc); // First add languages for (int i = 0; i < languages.getCount(); i++) @@ -1450,7 +1436,7 @@ int IconPressed(WPARAM wParam, LPARAM lParam) if (opts.use_flags) { menus[dlg->hwnd] = dlg; dlg->hwnd_menu_owner = dlg->hwnd; - dlg->old_menu_proc = (WNDPROC) SetWindowLongPtr(dlg->hwnd_menu_owner, GWLP_WNDPROC, (LONG_PTR) MenuWndProc); + mir_subclassWindow(dlg->hwnd_menu_owner, MenuWndProc); } // First add languages @@ -1607,7 +1593,7 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } } - return CallWindowProc(dlg->old_menu_proc, hwnd, msg, wParam, lParam); + return mir_callNextSubclass(hwnd, MenuWndProc, msg, wParam, lParam); } TCHAR *lstrtrim(TCHAR *str) diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 7a2082e18e..20e6058a91 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -55,12 +55,7 @@ extern HBRUSH hListBkgBrush; extern HANDLE hSendEvent;
extern HICON hIcons[30];
extern HMENU g_hMenu;
-extern WNDPROC OldSplitterProc;
-static WNDPROC OldMessageProc;
-static WNDPROC OldNicklistProc;
-static WNDPROC OldFilterButtonProc;
-static WNDPROC OldLogProc;
static HKL hkl = NULL;
static HCURSOR hCurHyperlinkHand;
@@ -75,7 +70,6 @@ typedef struct } MESSAGESUBDATA;
static const CLSID IID_ITextDocument= { 0x8CC497C0,0xA1DF,0x11CE, { 0x80,0x98, 0x00,0xAA, 0x00,0x47,0xBE,0x5D} };
-extern WNDPROC OldIEViewProc;
static void Chat_SetMessageLog(TWindowData *dat)
{
@@ -356,8 +350,6 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) if (dat->hwndIEView) {
if (M->GetByte("subclassIEView", 0) && dat->oldIEViewProc == 0) {
WNDPROC wndProc = (WNDPROC)SetWindowLongPtr(dat->hwndIEView, GWLP_WNDPROC, (LONG_PTR)IEViewSubclassProc);
- if (OldIEViewProc == 0)
- OldIEViewProc = wndProc;
dat->oldIEViewProc = wndProc;
}
}
@@ -589,10 +581,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
switch (msg) {
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, OldMessageProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageSubclassProc);
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, OldMessageProc));
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageSubclassProc);
case EM_SUBCLASSED:
dat = (MESSAGESUBDATA *) mir_calloc(sizeof(MESSAGESUBDATA));
@@ -1161,7 +1153,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return 0;
}
- return CallWindowProc(OldMessageProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageSubclassProc, msg, wParam, lParam);
}
@@ -1320,7 +1312,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L break;
}
- return CallWindowProc(OldFilterButtonProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ButtonSubclassProc, msg, wParam, lParam);
}
@@ -1335,13 +1327,13 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR switch (msg) {
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldLogProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, LogSubclassProc);
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldLogProc));
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, LogSubclassProc);
case WM_COPY:
- return(DM_WMCopyHandler(hwnd, OldLogProc, wParam, lParam));
+ return DM_WMCopyHandler(hwnd, LogSubclassProc, wParam, lParam);
case WM_SETCURSOR:
if (g_Settings.ClickableNicks && (LOWORD(lParam) == HTCLIENT)) {
@@ -1430,7 +1422,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
}
- return CallWindowProc(OldLogProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, LogSubclassProc, msg, wParam, lParam);
}
@@ -1520,22 +1512,23 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, switch (msg) {
//MAD: attemp to fix weird bug, when combobox with hidden vscroll
//can't be scrolled with mouse-wheel.
- case WM_NCCALCSIZE: {
- if (CSkin::m_DisableScrollbars) {
- RECT lpRect;
- LONG itemHeight;
- GetClientRect (hwnd, &lpRect);
- itemHeight = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
- g_cLinesPerPage = (lpRect.bottom - lpRect.top) /itemHeight ;
- }
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKUSERLIST, msg, wParam, lParam, OldNicklistProc));
+ case WM_NCCALCSIZE:
+ if (CSkin::m_DisableScrollbars) {
+ RECT lpRect;
+ LONG itemHeight;
+
+ GetClientRect (hwnd, &lpRect);
+ itemHeight = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
+ g_cLinesPerPage = (lpRect.bottom - lpRect.top) /itemHeight ;
}
- //
- case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKUSERLIST, msg, wParam, lParam, OldNicklistProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKUSERLIST, msg, wParam, lParam, NicklistSubclassProc);
- case WM_ERASEBKGND: {
+ case WM_NCPAINT:
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKUSERLIST, msg, wParam, lParam, NicklistSubclassProc);
+
+ case WM_ERASEBKGND:
+ {
HDC dc = (HDC)wParam;
struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
SESSION_INFO *parentdat = (SESSION_INFO *)dat->si;
@@ -1562,154 +1555,154 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
return 1;
- //MAD
- case WM_MOUSEWHEEL: {
- if (CSkin::m_DisableScrollbars) {
- UINT uScroll;
- int dLines;
- short zDelta=(short)HIWORD(wParam);
- if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &uScroll, 0))
- uScroll = 3; /* default value */
-
- if (uScroll == WHEEL_PAGESCROLL)
- uScroll = g_cLinesPerPage;
- if (uScroll == 0)
- return 0;
+ case WM_MOUSEWHEEL:
+ if (CSkin::m_DisableScrollbars) {
+ UINT uScroll;
+ int dLines;
+ short zDelta=(short)HIWORD(wParam);
+ if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &uScroll, 0))
+ uScroll = 3; /* default value */
+
+ if (uScroll == WHEEL_PAGESCROLL)
+ uScroll = g_cLinesPerPage;
+ if (uScroll == 0)
+ return 0;
- zDelta += g_iWheelCarryover; /* Accumulate wheel motion */
+ zDelta += g_iWheelCarryover; /* Accumulate wheel motion */
- dLines = zDelta * (int)uScroll / WHEEL_DELTA;
+ dLines = zDelta * (int)uScroll / WHEEL_DELTA;
- //Record the unused portion as the next carryover.
- g_iWheelCarryover = zDelta - dLines * WHEEL_DELTA / (int)uScroll;
+ //Record the unused portion as the next carryover.
+ g_iWheelCarryover = zDelta - dLines * WHEEL_DELTA / (int)uScroll;
- // scrolling.
- while (abs(dLines)) {
- if (dLines > 0) {
- SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, 0);
- dLines--;
- } else {
- SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0);
- dLines++;
- }
+ // scrolling.
+ while (abs(dLines)) {
+ if (dLines > 0) {
+ SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, 0);
+ dLines--;
+ } else {
+ SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0);
+ dLines++;
}
- return 0;
}
- break;
+ return 0;
}
-//MAD_
- case WM_KEYDOWN:
- if (wParam == 0x57 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-w (close window)
- PostMessage(hwndParent, WM_CLOSE, 0, 1);
- return TRUE;
- }
- if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT ||
- wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) {
- if (mwdat && mwdat->si) {
- SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
- si->szSearch[0] = 0;
- si->iSearchItem = -1;
- }
- }
- break;
+ break;
- case WM_SETFOCUS:
- case WM_KILLFOCUS:
- if (mwdat && mwdat->si) { // set/kill focus invalidates incremental search status
+ case WM_KEYDOWN:
+ if (wParam == 0x57 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-w (close window)
+ PostMessage(hwndParent, WM_CLOSE, 0, 1);
+ return TRUE;
+ }
+ if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT ||
+ wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) {
+ if (mwdat && mwdat->si) {
SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
si->szSearch[0] = 0;
si->iSearchItem = -1;
}
- break;
+ }
+ break;
- case WM_CHAR:
- case WM_UNICHAR: {
- /*
- * simple incremental search for the user (nick) - list control
- * typing esc or movement keys will clear the current search string
- */
+ case WM_SETFOCUS:
+ case WM_KILLFOCUS:
+ if (mwdat && mwdat->si) { // set/kill focus invalidates incremental search status
+ SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
+ si->szSearch[0] = 0;
+ si->iSearchItem = -1;
+ }
+ break;
- if (mwdat && mwdat->si) {
- SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
- if (wParam == 27 && si->szSearch[0]) { // escape - reset everything
- si->szSearch[0] = 0;
- si->iSearchItem = -1;
- break;
- } else if (wParam == '\b' && si->szSearch[0]) // backspace
- si->szSearch[lstrlen(si->szSearch) - 1] = '\0';
- else if (wParam < ' ')
+ case WM_CHAR:
+ case WM_UNICHAR:
+ /*
+ * simple incremental search for the user (nick) - list control
+ * typing esc or movement keys will clear the current search string
+ */
+ if (mwdat && mwdat->si) {
+ SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
+ if (wParam == 27 && si->szSearch[0]) { // escape - reset everything
+ si->szSearch[0] = 0;
+ si->iSearchItem = -1;
+ break;
+ } else if (wParam == '\b' && si->szSearch[0]) // backspace
+ si->szSearch[lstrlen(si->szSearch) - 1] = '\0';
+ else if (wParam < ' ')
+ break;
+ else {
+ TCHAR szNew[2];
+ szNew[0] = (TCHAR) wParam;
+ szNew[1] = '\0';
+ if (lstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) {
+ MessageBeep(MB_OK);
break;
- else {
- TCHAR szNew[2];
- szNew[0] = (TCHAR) wParam;
- szNew[1] = '\0';
- if (lstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) {
- MessageBeep(MB_OK);
- break;
- }
- _tcscat(si->szSearch, szNew);
}
- if (si->szSearch[0]) {
- int iItems = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
- int i;
- USERINFO *ui;
-
- /*
- * iterate over the (sorted) list of nicknames and search for the
- * string we have
- */
-
- for (i=0; i < iItems; i++) {
- ui = UM_FindUserFromIndex(si->pUsers, i);
- if (ui) {
- if (!_tcsnicmp(ui->pszNick, si->szSearch, lstrlen(si->szSearch))) {
- SendMessage(hwnd, LB_SETSEL, FALSE, -1);
- SendMessage(hwnd, LB_SETSEL, TRUE, i);
- si->iSearchItem = i;
- InvalidateRect(hwnd, NULL, FALSE);
- return 0;
- }
+ _tcscat(si->szSearch, szNew);
+ }
+ if (si->szSearch[0]) {
+ int iItems = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
+ int i;
+ USERINFO *ui;
+
+ /*
+ * iterate over the (sorted) list of nicknames and search for the
+ * string we have
+ */
+
+ for (i=0; i < iItems; i++) {
+ ui = UM_FindUserFromIndex(si->pUsers, i);
+ if (ui) {
+ if (!_tcsnicmp(ui->pszNick, si->szSearch, lstrlen(si->szSearch))) {
+ SendMessage(hwnd, LB_SETSEL, FALSE, -1);
+ SendMessage(hwnd, LB_SETSEL, TRUE, i);
+ si->iSearchItem = i;
+ InvalidateRect(hwnd, NULL, FALSE);
+ return 0;
}
}
- if (i == iItems) {
- MessageBeep(MB_OK);
- si->szSearch[lstrlen(si->szSearch) - 1] = '\0';
- return 0;
- }
+ }
+ if (i == iItems) {
+ MessageBeep(MB_OK);
+ si->szSearch[lstrlen(si->szSearch) - 1] = '\0';
+ return 0;
}
}
- break;
}
+ break;
- case WM_RBUTTONDOWN: {
+ case WM_RBUTTONDOWN:
+ {
int iCounts = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
-
if (iCounts != LB_ERR && iCounts > 1)
return 0;
SendMessage(hwnd, WM_LBUTTONDOWN, wParam, lParam);
- break;
}
+ break;
- case WM_RBUTTONUP:
- SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam);
- break;
+ case WM_RBUTTONUP:
+ SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam);
+ break;
- case WM_MEASUREITEM: {
+ case WM_MEASUREITEM:
+ {
MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
if (mis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
- return FALSE;
}
+ return FALSE;
- case WM_DRAWITEM: {
+ case WM_DRAWITEM:
+ {
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
if (dis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- return FALSE;
}
- case WM_CONTEXTMENU: {
+ return FALSE;
+
+ case WM_CONTEXTMENU:
+ {
TVHITTESTINFO hti;
int item;
int height;
@@ -1717,7 +1710,6 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
SESSION_INFO *parentdat = (SESSION_INFO *)dat->si;
-
hti.pt.x = (short) LOWORD(lParam);
hti.pt.y = (short) HIWORD(lParam);
if (hti.pt.x == -1 && hti.pt.y == -1) {
@@ -1749,55 +1741,55 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, uID = CreateGCMenu(hwnd, &hMenu, 0, hti.pt, parentdat, uinew.pszUID, NULL);
switch (uID) {
- case 0:
- break;
+ case 0:
+ break;
- case 20020: { // add to highlight...
- RECT rc, rcWnd;
- THighLightEdit the = {THighLightEdit::CMD_ADD, parentdat, ui};
+ case 20020: { // add to highlight...
+ RECT rc, rcWnd;
+ THighLightEdit the = {THighLightEdit::CMD_ADD, parentdat, ui};
- if (parentdat && ui) {
- HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), parentdat->dat->pContainer->hwnd, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
- TranslateDialogDefault(hwnd);
- GetClientRect(parentdat->pContainer->hwnd, &rcWnd);
- GetWindowRect(hwnd, &rc);
+ if (parentdat && ui) {
+ HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), parentdat->dat->pContainer->hwnd, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
+ TranslateDialogDefault(hwnd);
+ GetClientRect(parentdat->pContainer->hwnd, &rcWnd);
+ GetWindowRect(hwnd, &rc);
- SetWindowPos(hwnd, HWND_TOP, (rcWnd.right - (rc.right - rc.left)) / 2, (rcWnd.bottom - (rc.bottom - rc.top)) / 2 , 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
- }
- break;
+ SetWindowPos(hwnd, HWND_TOP, (rcWnd.right - (rc.right - rc.left)) / 2, (rcWnd.bottom - (rc.bottom - rc.top)) / 2 , 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
}
+ break;
+ }
- case ID_MESS:
- DoEventHookAsync(GetParent(hwnd), parentdat->ptszID, parentdat->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
- break;
+ case ID_MESS:
+ DoEventHookAsync(GetParent(hwnd), parentdat->ptszID, parentdat->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
+ break;
- default: {
- int iCount = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
+ default: {
+ int iCount = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
- if (iCount != LB_ERR) {
- int iSelectedItems = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
+ if (iCount != LB_ERR) {
+ int iSelectedItems = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
- if (iSelectedItems != LB_ERR) {
- int *pItems = (int *)malloc(sizeof(int) * (iSelectedItems + 1));
+ if (iSelectedItems != LB_ERR) {
+ int *pItems = (int *)malloc(sizeof(int) * (iSelectedItems + 1));
- if (pItems) {
- if (SendMessage(hwnd, LB_GETSELITEMS, (WPARAM)iSelectedItems, (LPARAM)pItems) != LB_ERR) {
- USERINFO *ui1 = NULL;
- int i;
+ if (pItems) {
+ if (SendMessage(hwnd, LB_GETSELITEMS, (WPARAM)iSelectedItems, (LPARAM)pItems) != LB_ERR) {
+ USERINFO *ui1 = NULL;
+ int i;
- for (i=0; i < iSelectedItems; i++) {
- ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, pItems[i]);
- if (ui1)
- DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui1->pszUID, NULL, (LPARAM)uID);
- }
+ for (i=0; i < iSelectedItems; i++) {
+ ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, pItems[i]);
+ if (ui1)
+ DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui1->pszUID, NULL, (LPARAM)uID);
}
- free(pItems);
}
+ free(pItems);
}
}
- //DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
- break;
}
+ //DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
+ break;
+ }
}
DestroyGCMenu(&hMenu, 1);
return TRUE;
@@ -1805,7 +1797,8 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
break;
- case WM_MOUSEMOVE: {
+ case WM_MOUSEMOVE:
+ {
POINT pt;
RECT clientRect;
pt.x = LOWORD(lParam);
@@ -1832,7 +1825,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, CallService("mToolTip/HideTip", 0, 0);
isToolTip = FALSE;
}
-
+
if (nItemUnderMouse != -1)
SetTimer(hwnd, 1, 450, 0);
}
@@ -1852,7 +1845,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
break;
- case WM_TIMER:
+ case WM_TIMER:
{
CLCINFOTIP ti = {0};
USERINFO *ui1 = NULL;
@@ -1875,9 +1868,8 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, KillTimer(hwnd, 1);
break;
}
-
- ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
+ ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
if (ui1) {
ti.cbSize = sizeof(ti);
mir_snprintf(serviceName, SIZEOF(serviceName), "%s"MS_GC_PROTO_GETTOOLTIPTEXT, parentdat->pszModule);
@@ -1886,9 +1878,9 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("%s"), (TCHAR*)CallService(serviceName, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID));
else
mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s"),
- TranslateT("Nick"), ui1->pszNick,
- TranslateT("Unique id"), ui1->pszUID,
- TranslateT("Status"), TM_WordToString(parentdat->pStatuses, ui1->Status));
+ TranslateT("Nick"), ui1->pszNick,
+ TranslateT("Unique id"), ui1->pszUID,
+ TranslateT("Status"), TM_WordToString(parentdat->pStatuses, ui1->Status));
if (ptszBuf != NULL)
if (CallService("mToolTip/ShowTipW", (WPARAM)mir_tstrdup(ptszBuf), (LPARAM)&ti))
@@ -1898,7 +1890,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
break;
}
- return CallWindowProc(OldNicklistProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, NicklistSubclassProc, msg, wParam, lParam);
}
/*
@@ -1957,8 +1949,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SESSION_INFO *psi = (SESSION_INFO*)newData->hdbEvent;
RECT rc;
- dat = (struct TWindowData *)malloc(sizeof(struct TWindowData));
- ZeroMemory(dat, sizeof(struct TWindowData));
+ dat = (TWindowData*)calloc( sizeof(TWindowData), 1);
si = psi;
dat->si = psi;
dat->hContact = psi->hContact;
@@ -2011,14 +2002,15 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendMessage(GetDlgItem(hwndDlg,IDC_COLOR), BUTTONSETASPUSHBTN, TRUE, 0);
- OldSplitterProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTERX), GWLP_WNDPROC, (LONG_PTR)SplitterSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTERY), GWLP_WNDPROC, (LONG_PTR)SplitterSubclassProc);
- OldNicklistProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LIST), GWLP_WNDPROC, (LONG_PTR)NicklistSubclassProc);
- OldLogProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_LOG), GWLP_WNDPROC, (LONG_PTR)LogSubclassProc);
- OldFilterButtonProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FILTER), GWLP_WNDPROC, (LONG_PTR)ButtonSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_COLOR), GWLP_WNDPROC, (LONG_PTR)ButtonSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BKGCOLOR), GWLP_WNDPROC, (LONG_PTR)ButtonSubclassProc);
- OldMessageProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), GWLP_WNDPROC, (LONG_PTR)MessageSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_SPLITTERX), SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_SPLITTERY), SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_LIST), NicklistSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_CHAT_LOG), LogSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_FILTER), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_COLOR), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_BKGCOLOR), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), MessageSubclassProc);
+
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SUBCLASSED, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_AUTOURLDETECT, 1, 0);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
@@ -3772,16 +3764,7 @@ LABEL_SHOWWINDOW: si->dat = 0;
si->pContainer = 0;
- //SetWindowLongPtr(hwndDlg,GWLP_USERDATA,0);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTERX), GWLP_WNDPROC, (LONG_PTR)OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTERY), GWLP_WNDPROC, (LONG_PTR)OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LIST), GWLP_WNDPROC, (LONG_PTR)OldNicklistProc);
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), GWLP_WNDPROC, (LONG_PTR)OldMessageProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_LOG), GWLP_WNDPROC, (LONG_PTR)OldLogProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FILTER), GWLP_WNDPROC, (LONG_PTR)OldFilterButtonProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_COLOR), GWLP_WNDPROC, (LONG_PTR)OldFilterButtonProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BKGCOLOR), GWLP_WNDPROC, (LONG_PTR)OldFilterButtonProc);
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0);
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 1f78880826..0cbfd39b5f 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -42,7 +42,6 @@ extern ButtonSet g_ButtonSet; TContainerData *pFirstContainer = 0; // the linked list of struct ContainerWindowData
TContainerData *pLastActiveContainer = NULL;
-static WNDPROC OldContainerWndProc = 0;
static bool fForceOverlayIcons = false;
static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, HANDLE hContact)
@@ -153,8 +152,8 @@ struct TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDL if (M->GetByte("limittabs", 0) && !_tcscmp(name, _T("default")))
iTemp |= CNT_CREATEFLAG_CLONED;
/*
- * save container name to the db
- */
+ * save container name to the db
+ */
i = 0;
if (!M->GetByte("singlewinmode", 0)) {
do {
@@ -202,7 +201,7 @@ struct TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDL return NULL;
}
-static BOOL CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
BOOL bSkinned;
@@ -210,101 +209,226 @@ static BOOL CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA bSkinned = CSkin::m_skinEnabled ? TRUE : FALSE;
switch (msg) {
- case WM_NCPAINT: {
- PAINTSTRUCT ps;
- HDC hdcReal;
- RECT rcClient;
- LONG width, height;
- HDC hdc;
- CSkinItem *item = &SkinItems[0], *item_normal, *item_pressed, *item_hot;
- HICON hIcon;
- HFONT hOldFont = 0;
- TEXTMETRIC tm;
-
- if (!pContainer || !bSkinned)
- break;
+ case WM_NCPAINT: {
+ PAINTSTRUCT ps;
+ HDC hdcReal;
+ RECT rcClient;
+ LONG width, height;
+ HDC hdc;
+ CSkinItem *item = &SkinItems[0], *item_normal, *item_pressed, *item_hot;
+ HICON hIcon;
+ HFONT hOldFont = 0;
+ TEXTMETRIC tm;
+
+ if (!pContainer || !bSkinned)
+ break;
- if (CSkin::m_frameSkins) {
- RECT rcWindow, rcClient;
- HDC dcFrame = GetDCEx(hwndDlg, 0, DCX_WINDOW|/*DCX_INTERSECTRGN|*/0x10000); // GetWindowDC(hwndDlg);
- POINT pt, pt1;
- LONG clip_top, clip_left;
- HRGN rgn = 0;
- CSkinItem *item;
- TCHAR szWindowText[512];
- RECT rcText;
- HDC dcMem = CreateCompatibleDC(pContainer->cachedDC ? pContainer->cachedDC : dcFrame);
- HBITMAP hbmMem, hbmOld;
- int i;
- DRAWITEMSTRUCT dis = {0};
+ if (CSkin::m_frameSkins) {
+ RECT rcWindow, rcClient;
+ HDC dcFrame = GetDCEx(hwndDlg, 0, DCX_WINDOW|/*DCX_INTERSECTRGN|*/0x10000); // GetWindowDC(hwndDlg);
+ POINT pt, pt1;
+ LONG clip_top, clip_left;
+ HRGN rgn = 0;
+ CSkinItem *item;
+ TCHAR szWindowText[512];
+ RECT rcText;
+ HDC dcMem = CreateCompatibleDC(pContainer->cachedDC ? pContainer->cachedDC : dcFrame);
+ HBITMAP hbmMem, hbmOld;
+ int i;
+ DRAWITEMSTRUCT dis = {0};
- GetWindowRect(hwndDlg, &rcWindow);
- GetClientRect(hwndDlg, &rcClient);
- pt.y = 0;
- pt.x = 0;
- ClientToScreen(hwndDlg, &pt);
- pt1.x = rcClient.right;
- pt1.y = rcClient.bottom;
- ClientToScreen(hwndDlg, &pt1);
- clip_top = pt.y - rcWindow.top;
- clip_left = pt.x - rcWindow.left;
-
- rcWindow.right = rcWindow.right - rcWindow.left;
- rcWindow.bottom = rcWindow.bottom - rcWindow.top;
- rcWindow.left = rcWindow.top = 0;
-
- hbmMem = CreateCompatibleBitmap(dcFrame, rcWindow.right, rcWindow.bottom);
- hbmOld = (HBITMAP)SelectObject(dcMem, hbmMem);
-
- ExcludeClipRect(dcFrame, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
- ExcludeClipRect(dcMem, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
- item = pContainer->ncActive ? &SkinItems[ID_EXTBKFRAME] : &SkinItems[ID_EXTBKFRAMEINACTIVE];
-
- CSkin::DrawItem(dcMem, &rcWindow, item);
-
- GetWindowText(hwndDlg, szWindowText, 512);
- szWindowText[511] = 0;
- hOldFont = (HFONT)SelectObject(dcMem, PluginConfig.hFontCaption);
- GetTextMetrics(dcMem, &tm);
- SetTextColor(dcMem, CInfoPanel::m_ipConfig.clrs[IPFONTCOUNT - 1]);
- SetBkMode(dcMem, TRANSPARENT);
- rcText.left =20 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff;//26;
- rcText.right = rcWindow.right - 3 * CSkin::m_titleBarButtonSize.cx - 11 - CSkin::m_titleBarRightOff;
- rcText.top = CSkin::m_captionOffset + CSkin::m_bClipBorder;
- rcText.bottom = rcText.top + tm.tmHeight;
- rcText.left += CSkin::m_captionPadding;
- DrawText(dcMem, szWindowText, -1, &rcText, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
- SelectObject(dcMem, hOldFont);
- /*
- * icon
- */
+ GetWindowRect(hwndDlg, &rcWindow);
+ GetClientRect(hwndDlg, &rcClient);
+ pt.y = 0;
+ pt.x = 0;
+ ClientToScreen(hwndDlg, &pt);
+ pt1.x = rcClient.right;
+ pt1.y = rcClient.bottom;
+ ClientToScreen(hwndDlg, &pt1);
+ clip_top = pt.y - rcWindow.top;
+ clip_left = pt.x - rcWindow.left;
+
+ rcWindow.right = rcWindow.right - rcWindow.left;
+ rcWindow.bottom = rcWindow.bottom - rcWindow.top;
+ rcWindow.left = rcWindow.top = 0;
+
+ hbmMem = CreateCompatibleBitmap(dcFrame, rcWindow.right, rcWindow.bottom);
+ hbmOld = (HBITMAP)SelectObject(dcMem, hbmMem);
+
+ ExcludeClipRect(dcFrame, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
+ ExcludeClipRect(dcMem, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
+ item = pContainer->ncActive ? &SkinItems[ID_EXTBKFRAME] : &SkinItems[ID_EXTBKFRAMEINACTIVE];
+
+ CSkin::DrawItem(dcMem, &rcWindow, item);
+
+ GetWindowText(hwndDlg, szWindowText, 512);
+ szWindowText[511] = 0;
+ hOldFont = (HFONT)SelectObject(dcMem, PluginConfig.hFontCaption);
+ GetTextMetrics(dcMem, &tm);
+ SetTextColor(dcMem, CInfoPanel::m_ipConfig.clrs[IPFONTCOUNT - 1]);
+ SetBkMode(dcMem, TRANSPARENT);
+ rcText.left =20 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff;//26;
+ rcText.right = rcWindow.right - 3 * CSkin::m_titleBarButtonSize.cx - 11 - CSkin::m_titleBarRightOff;
+ rcText.top = CSkin::m_captionOffset + CSkin::m_bClipBorder;
+ rcText.bottom = rcText.top + tm.tmHeight;
+ rcText.left += CSkin::m_captionPadding;
+ DrawText(dcMem, szWindowText, -1, &rcText, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
+ SelectObject(dcMem, hOldFont);
+ /*
+ * icon
+ */
+
+ hIcon = (HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0);
+ DrawIconEx(dcMem, 4 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff, rcText.top + (rcText.bottom - rcText.top) / 2 - 8, hIcon, 16, 16, 0, 0, DI_NORMAL);
+
+ // title buttons;
+
+ pContainer->rcClose.top = pContainer->rcMin.top = pContainer->rcMax.top = CSkin::m_titleButtonTopOff;
+ pContainer->rcClose.bottom = pContainer->rcMin.bottom = pContainer->rcMax.bottom = CSkin::m_titleButtonTopOff + CSkin::m_titleBarButtonSize.cy;
+
+ pContainer->rcClose.right = rcWindow.right - 10 - CSkin::m_titleBarRightOff;
+ pContainer->rcClose.left = pContainer->rcClose.right - CSkin::m_titleBarButtonSize.cx;
+
+ pContainer->rcMax.right = pContainer->rcClose.left - 2;
+ pContainer->rcMax.left = pContainer->rcMax.right - CSkin::m_titleBarButtonSize.cx;
+
+ pContainer->rcMin.right = pContainer->rcMax.left - 2;
+ pContainer->rcMin.left = pContainer->rcMin.right - CSkin::m_titleBarButtonSize.cx;
+
+ item_normal = &SkinItems[ID_EXTBKTITLEBUTTON];
+ item_hot = &SkinItems[ID_EXTBKTITLEBUTTONMOUSEOVER];
+ item_pressed = &SkinItems[ID_EXTBKTITLEBUTTONPRESSED];
+
+ for (i=0; i < 3; i++) {
+ RECT *rc = 0;
+ HICON hIcon;
+
+ switch (i) {
+ case 0:
+ rc = &pContainer->rcMin;
+ hIcon = CSkin::m_minIcon;
+ break;
+ case 1:
+ rc = &pContainer->rcMax;
+ hIcon = CSkin::m_maxIcon;
+ break;
+ case 2:
+ rc = &pContainer->rcClose;
+ hIcon = CSkin::m_closeIcon;
+ break;
+ }
+ if (rc) {
+ item = pContainer->buttons[i].isPressed ? item_pressed : (pContainer->buttons[i].isHot ? item_hot : item_normal);
+ CSkin::DrawItem(dcMem, rc, item);
+ DrawIconEx(dcMem, rc->left + ((rc->right - rc->left) / 2 - 8), rc->top + ((rc->bottom - rc->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
+ }
+ }
+ SetBkMode(dcMem, TRANSPARENT);
+ BitBlt(dcFrame, 0, 0, rcWindow.right, rcWindow.bottom, dcMem, 0, 0, SRCCOPY);
+ SelectObject(dcMem, hbmOld);
+ DeleteObject(hbmMem);
+ DeleteDC(dcMem);
+ ReleaseDC(hwndDlg, dcFrame);
+ }
+ else mir_callNextSubclass(hwndDlg, ContainerWndProc, msg, wParam, lParam);
+
+ hdcReal = BeginPaint(hwndDlg, &ps);
- hIcon = (HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0);
- DrawIconEx(dcMem, 4 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff, rcText.top + (rcText.bottom - rcText.top) / 2 - 8, hIcon, 16, 16, 0, 0, DI_NORMAL);
+ GetClientRect(hwndDlg, &rcClient);
+ width = rcClient.right - rcClient.left;
+ height = rcClient.bottom - rcClient.top;
+ if (width != pContainer->oldDCSize.cx || height != pContainer->oldDCSize.cy) {
+ CSkinItem *sbaritem = &SkinItems[ID_EXTBKSTATUSBAR];
+ BOOL statusBarSkinnd = !(pContainer->dwFlags & CNT_NOSTATUSBAR) && !sbaritem->IGNORED;
+ LONG sbarDelta = statusBarSkinnd ? pContainer->statusBarHeight : 0;
- // title buttons;
+ pContainer->oldDCSize.cx = width;
+ pContainer->oldDCSize.cy = height;
- pContainer->rcClose.top = pContainer->rcMin.top = pContainer->rcMax.top = CSkin::m_titleButtonTopOff;
- pContainer->rcClose.bottom = pContainer->rcMin.bottom = pContainer->rcMax.bottom = CSkin::m_titleButtonTopOff + CSkin::m_titleBarButtonSize.cy;
+ if (pContainer->cachedDC) {
+ SelectObject(pContainer->cachedDC, pContainer->oldHBM);
+ DeleteObject(pContainer->cachedHBM);
+ DeleteDC(pContainer->cachedDC);
+ }
+ pContainer->cachedDC = CreateCompatibleDC(hdcReal);
+ pContainer->cachedHBM = CreateCompatibleBitmap(hdcReal, width, height);
+ pContainer->oldHBM = (HBITMAP)SelectObject(pContainer->cachedDC, pContainer->cachedHBM);
- pContainer->rcClose.right = rcWindow.right - 10 - CSkin::m_titleBarRightOff;
- pContainer->rcClose.left = pContainer->rcClose.right - CSkin::m_titleBarButtonSize.cx;
+ hdc = pContainer->cachedDC;
- pContainer->rcMax.right = pContainer->rcClose.left - 2;
- pContainer->rcMax.left = pContainer->rcMax.right - CSkin::m_titleBarButtonSize.cx;
+ if (!CSkin::DrawItem(hdc, &rcClient, item))
+ FillRect(hdc, &rcClient, GetSysColorBrush(COLOR_3DFACE));
- pContainer->rcMin.right = pContainer->rcMax.left - 2;
- pContainer->rcMin.left = pContainer->rcMin.right - CSkin::m_titleBarButtonSize.cx;
+ if (sbarDelta) {
+ rcClient.top = rcClient.bottom - sbarDelta;
+ CSkin::DrawItem(hdc, &rcClient, sbaritem);
+ }
+ }
+ BitBlt(hdcReal, 0, 0, width, height, pContainer->cachedDC, 0, 0, SRCCOPY);
+ EndPaint(hwndDlg, &ps);
+ return 0;
+ }
+ case WM_NCLBUTTONDOWN:
+ case WM_NCLBUTTONUP:
+ case WM_NCMOUSEHOVER:
+ case WM_NCMOUSEMOVE:
+ if (pContainer && CSkin::m_frameSkins) {
+ POINT pt;
+ RECT rcWindow;
+ BOOL isMin, isMax, isClose;
+ int i;
- item_normal = &SkinItems[ID_EXTBKTITLEBUTTON];
- item_hot = &SkinItems[ID_EXTBKTITLEBUTTONMOUSEOVER];
- item_pressed = &SkinItems[ID_EXTBKTITLEBUTTONPRESSED];
+ GetCursorPos(&pt);
+ GetWindowRect(hwndDlg, &rcWindow);
+ CopyMemory(&pContainer->oldbuttons[0], &pContainer->buttons[0], sizeof(struct TitleBtn) * 3);
+ ZeroMemory(&pContainer->buttons[0], sizeof(struct TitleBtn) * 3);
+ isMin = isMax = isClose = FALSE;
+
+ if (pt.x >= (rcWindow.left + pContainer->rcMin.left) && pt.x <= (rcWindow.left + pContainer->rcClose.right) && pt.y < rcWindow.top + 24 && wParam != HTTOPRIGHT) {
+ LRESULT result = 0; //DefWindowProc(hwndDlg, msg, wParam, lParam);
+ HDC hdc = GetWindowDC(hwndDlg);
+ LONG left = rcWindow.left;
+
+ pt.y = 10;
+ isMin = pt.x >= left + pContainer->rcMin.left && pt.x <= left + pContainer->rcMin.right;
+ isMax = pt.x >= left + pContainer->rcMax.left && pt.x <= left + pContainer->rcMax.right;
+ isClose = pt.x >= left + pContainer->rcClose.left && pt.x <= left + pContainer->rcClose.right;
+
+ if (msg == WM_NCMOUSEMOVE) {
+ if (isMax)
+ pContainer->buttons[BTN_MAX].isHot = TRUE;
+ else if (isMin)
+ pContainer->buttons[BTN_MIN].isHot = TRUE;
+ else if (isClose)
+ pContainer->buttons[BTN_CLOSE].isHot = TRUE;
+ }
+ else if (msg == WM_NCLBUTTONDOWN) {
+ if (isMax)
+ pContainer->buttons[BTN_MAX].isPressed = TRUE;
+ else if (isMin)
+ pContainer->buttons[BTN_MIN].isPressed = TRUE;
+ else if (isClose)
+ pContainer->buttons[BTN_CLOSE].isPressed = TRUE;
+ }
+ else if (msg == WM_NCLBUTTONUP) {
+ if (isMin)
+ SendMessage(hwndDlg, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ else if (isMax) {
+ if (IsZoomed(hwndDlg))
+ PostMessage(hwndDlg, WM_SYSCOMMAND, SC_RESTORE, 0);
+ else
+ PostMessage(hwndDlg, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
+ }
+ else if (isClose)
+ PostMessage(hwndDlg, WM_SYSCOMMAND, SC_CLOSE, 0);
+ }
for (i=0; i < 3; i++) {
- RECT *rc = 0;
- HICON hIcon;
+ if (pContainer->buttons[i].isHot != pContainer->oldbuttons[i].isHot) {
+ RECT *rc = 0;
+ HICON hIcon;
- switch (i) {
+ switch (i) {
case 0:
rc = &pContainer->rcMin;
hIcon = CSkin::m_minIcon;
@@ -317,243 +441,115 @@ static BOOL CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA rc = &pContainer->rcClose;
hIcon = CSkin::m_closeIcon;
break;
- }
- if (rc) {
- item = pContainer->buttons[i].isPressed ? item_pressed : (pContainer->buttons[i].isHot ? item_hot : item_normal);
- CSkin::DrawItem(dcMem, rc, item);
- DrawIconEx(dcMem, rc->left + ((rc->right - rc->left) / 2 - 8), rc->top + ((rc->bottom - rc->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
+ }
+ if (rc) {
+ CSkinItem *item = &SkinItems[pContainer->buttons[i].isPressed ? ID_EXTBKTITLEBUTTONPRESSED : (pContainer->buttons[i].isHot ? ID_EXTBKTITLEBUTTONMOUSEOVER : ID_EXTBKTITLEBUTTON)];
+ CSkin::DrawItem(hdc, rc, item);
+ DrawIconEx(hdc, rc->left + ((rc->right - rc->left) / 2 - 8), rc->top + ((rc->bottom - rc->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
+ }
}
}
- SetBkMode(dcMem, TRANSPARENT);
- BitBlt(dcFrame, 0, 0, rcWindow.right, rcWindow.bottom, dcMem, 0, 0, SRCCOPY);
- SelectObject(dcMem, hbmOld);
- DeleteObject(hbmMem);
- DeleteDC(dcMem);
- ReleaseDC(hwndDlg, dcFrame);
+ ReleaseDC(hwndDlg, hdc);
+ return result;
}
- else
- CallWindowProc(OldContainerWndProc, hwndDlg, msg, wParam, lParam);
-
- hdcReal = BeginPaint(hwndDlg, &ps);
+ else {
+ LRESULT result = DefWindowProc(hwndDlg, msg, wParam, lParam);
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN);
+ return result;
+ }
+ }
+ break;
+ case WM_SETCURSOR:
+ if (CSkin::m_frameSkins && (HWND)wParam == hwndDlg) {
+ DefWindowProc(hwndDlg, msg, wParam, lParam);
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN);
+ return 1;
+ }
+ break;
- GetClientRect(hwndDlg, &rcClient);
- width = rcClient.right - rcClient.left;
- height = rcClient.bottom - rcClient.top;
- if (width != pContainer->oldDCSize.cx || height != pContainer->oldDCSize.cy) {
- CSkinItem *sbaritem = &SkinItems[ID_EXTBKSTATUSBAR];
- BOOL statusBarSkinnd = !(pContainer->dwFlags & CNT_NOSTATUSBAR) && !sbaritem->IGNORED;
- LONG sbarDelta = statusBarSkinnd ? pContainer->statusBarHeight : 0;
-
- pContainer->oldDCSize.cx = width;
- pContainer->oldDCSize.cy = height;
-
- if (pContainer->cachedDC) {
- SelectObject(pContainer->cachedDC, pContainer->oldHBM);
- DeleteObject(pContainer->cachedHBM);
- DeleteDC(pContainer->cachedDC);
- }
- pContainer->cachedDC = CreateCompatibleDC(hdcReal);
- pContainer->cachedHBM = CreateCompatibleBitmap(hdcReal, width, height);
- pContainer->oldHBM = (HBITMAP)SelectObject(pContainer->cachedDC, pContainer->cachedHBM);
+ case WM_NCCALCSIZE:
+ if (!CSkin::m_frameSkins)
+ break;
- hdc = pContainer->cachedDC;
+ if (wParam) {
+ RECT *rc;
+ NCCALCSIZE_PARAMS *ncsp = (NCCALCSIZE_PARAMS *)lParam;
- if (!CSkin::DrawItem(hdc, &rcClient, item))
- FillRect(hdc, &rcClient, GetSysColorBrush(COLOR_3DFACE));
+ DefWindowProc(hwndDlg, msg, wParam, lParam);
+ rc = &ncsp->rgrc[0];
- if (sbarDelta) {
- rcClient.top = rcClient.bottom - sbarDelta;
- CSkin::DrawItem(hdc, &rcClient, sbaritem);
- }
- }
- BitBlt(hdcReal, 0, 0, width, height, pContainer->cachedDC, 0, 0, SRCCOPY);
- EndPaint(hwndDlg, &ps);
- return 0;
+ rc->left += CSkin::m_realSkinnedFrame_left;
+ rc->right -= CSkin::m_realSkinnedFrame_right;
+ rc->bottom -= CSkin::m_realSkinnedFrame_bottom;
+ rc->top += CSkin::m_realSkinnedFrame_caption;
+ return TRUE;
}
- case WM_NCLBUTTONDOWN:
- case WM_NCLBUTTONUP:
- case WM_NCMOUSEHOVER:
- case WM_NCMOUSEMOVE:
- if (pContainer && CSkin::m_frameSkins) {
- POINT pt;
- RECT rcWindow;
- BOOL isMin, isMax, isClose;
- int i;
- GetCursorPos(&pt);
- GetWindowRect(hwndDlg, &rcWindow);
+ return DefWindowProc(hwndDlg, msg, wParam, lParam);
- CopyMemory(&pContainer->oldbuttons[0], &pContainer->buttons[0], sizeof(struct TitleBtn) * 3);
- ZeroMemory(&pContainer->buttons[0], sizeof(struct TitleBtn) * 3);
- isMin = isMax = isClose = FALSE;
-
- if (pt.x >= (rcWindow.left + pContainer->rcMin.left) && pt.x <= (rcWindow.left + pContainer->rcClose.right) && pt.y < rcWindow.top + 24 && wParam != HTTOPRIGHT) {
- LRESULT result = 0; //DefWindowProc(hwndDlg, msg, wParam, lParam);
- HDC hdc = GetWindowDC(hwndDlg);
- LONG left = rcWindow.left;
-
- pt.y = 10;
- isMin = pt.x >= left + pContainer->rcMin.left && pt.x <= left + pContainer->rcMin.right;
- isMax = pt.x >= left + pContainer->rcMax.left && pt.x <= left + pContainer->rcMax.right;
- isClose = pt.x >= left + pContainer->rcClose.left && pt.x <= left + pContainer->rcClose.right;
-
- if (msg == WM_NCMOUSEMOVE) {
- if (isMax)
- pContainer->buttons[BTN_MAX].isHot = TRUE;
- else if (isMin)
- pContainer->buttons[BTN_MIN].isHot = TRUE;
- else if (isClose)
- pContainer->buttons[BTN_CLOSE].isHot = TRUE;
- }
- else if (msg == WM_NCLBUTTONDOWN) {
- if (isMax)
- pContainer->buttons[BTN_MAX].isPressed = TRUE;
- else if (isMin)
- pContainer->buttons[BTN_MIN].isPressed = TRUE;
- else if (isClose)
- pContainer->buttons[BTN_CLOSE].isPressed = TRUE;
- }
- else if (msg == WM_NCLBUTTONUP) {
- if (isMin)
- SendMessage(hwndDlg, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- else if (isMax) {
- if (IsZoomed(hwndDlg))
- PostMessage(hwndDlg, WM_SYSCOMMAND, SC_RESTORE, 0);
- else
- PostMessage(hwndDlg, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
- }
- else if (isClose)
- PostMessage(hwndDlg, WM_SYSCOMMAND, SC_CLOSE, 0);
- }
- for (i=0; i < 3; i++) {
- if (pContainer->buttons[i].isHot != pContainer->oldbuttons[i].isHot) {
- RECT *rc = 0;
- HICON hIcon;
-
- switch (i) {
- case 0:
- rc = &pContainer->rcMin;
- hIcon = CSkin::m_minIcon;
- break;
- case 1:
- rc = &pContainer->rcMax;
- hIcon = CSkin::m_maxIcon;
- break;
- case 2:
- rc = &pContainer->rcClose;
- hIcon = CSkin::m_closeIcon;
- break;
- }
- if (rc) {
- CSkinItem *item = &SkinItems[pContainer->buttons[i].isPressed ? ID_EXTBKTITLEBUTTONPRESSED : (pContainer->buttons[i].isHot ? ID_EXTBKTITLEBUTTONMOUSEOVER : ID_EXTBKTITLEBUTTON)];
- CSkin::DrawItem(hdc, rc, item);
- DrawIconEx(hdc, rc->left + ((rc->right - rc->left) / 2 - 8), rc->top + ((rc->bottom - rc->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
- }
- }
- }
- ReleaseDC(hwndDlg, hdc);
- return result;
- }
- else {
- LRESULT result = DefWindowProc(hwndDlg, msg, wParam, lParam);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN);
- return result;
- }
- }
- break;
- case WM_SETCURSOR: {
- if (CSkin::m_frameSkins && (HWND)wParam == hwndDlg) {
- DefWindowProc(hwndDlg, msg, wParam, lParam);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN);
+ case WM_NCACTIVATE:
+ if (pContainer) {
+ pContainer->ncActive = wParam;
+ if (bSkinned && CSkin::m_frameSkins) {
+ SendMessage(hwndDlg, WM_NCPAINT, 0, 0);
return 1;
}
- break;
}
- case WM_NCCALCSIZE: {
- if (!CSkin::m_frameSkins)
- break;
-
- if (wParam) {
- RECT *rc;
- NCCALCSIZE_PARAMS *ncsp = (NCCALCSIZE_PARAMS *)lParam;
-
- DefWindowProc(hwndDlg, msg, wParam, lParam);
- rc = &ncsp->rgrc[0];
-
- rc->left += CSkin::m_realSkinnedFrame_left;
- rc->right -= CSkin::m_realSkinnedFrame_right;
- rc->bottom -= CSkin::m_realSkinnedFrame_bottom;
- rc->top += CSkin::m_realSkinnedFrame_caption;
- return TRUE;
- }
- else {
- return DefWindowProc(hwndDlg, msg, wParam, lParam);
- }
+ break;
+ case WM_SETTEXT:
+ case WM_SETICON: {
+ if (CSkin::m_frameSkins) {
+ DefWindowProc(hwndDlg, msg, wParam, lParam);
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN);
+ return 0;
}
- case WM_NCACTIVATE:
- if (pContainer) {
- pContainer->ncActive = wParam;
- if (bSkinned && CSkin::m_frameSkins) {
- SendMessage(hwndDlg, WM_NCPAINT, 0, 0);
- return 1;
- }
- }
+ break;
+ }
+ case WM_NCHITTEST: {
+ RECT r;
+ POINT pt;
+ int k = 0;
+ int clip = CSkin::m_bClipBorder;
+
+ if (!pContainer)
break;
- case WM_SETTEXT:
- case WM_SETICON: {
- if (CSkin::m_frameSkins) {
- DefWindowProc(hwndDlg, msg, wParam, lParam);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN);
- return 0;
- }
- break;
- }
- case WM_NCHITTEST: {
- RECT r;
- POINT pt;
- int k = 0;
- int clip = CSkin::m_bClipBorder;
- if (!pContainer)
- break;
+ if (!(pContainer->dwFlags & CNT_NOTITLE))
+ break;
- if (!(pContainer->dwFlags & CNT_NOTITLE))
- break;
+ GetWindowRect(hwndDlg, &r);
+ GetCursorPos(&pt);
+ if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6) {
+ if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
+ return HTBOTTOM;
+ if (pt.x < r.left + clip + 10)
+ return HTBOTTOMLEFT;
+ if (pt.x > r.right - clip - 10)
+ return HTBOTTOMRIGHT;
- GetWindowRect(hwndDlg, &r);
- GetCursorPos(&pt);
- if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6) {
- if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
- return HTBOTTOM;
- if (pt.x < r.left + clip + 10)
- return HTBOTTOMLEFT;
- if (pt.x > r.right - clip - 10)
- return HTBOTTOMRIGHT;
-
- }
- else if (pt.y >= r.top && pt.y <= r.top + 6) {
- if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
- return HTTOP;
- if (pt.x < r.left + clip + 10)
- return HTTOPLEFT;
- if (pt.x > r.right - clip - 10)
- return HTTOPRIGHT;
- }
- else if (pt.x >= r.left && pt.x <= r.left + clip + 6)
- return HTLEFT;
- else if (pt.x >= r.right - clip - 6 && pt.x <= r.right)
- return HTRIGHT;
-
- return(DefWindowProc(hwndDlg, WM_NCHITTEST, wParam, lParam));
}
- case 0xae: // must be some undocumented message - seems it messes with the title bar...
- if (CSkin::m_frameSkins)
- return 0;
- default:
- break;
+ else if (pt.y >= r.top && pt.y <= r.top + 6) {
+ if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
+ return HTTOP;
+ if (pt.x < r.left + clip + 10)
+ return HTTOPLEFT;
+ if (pt.x > r.right - clip - 10)
+ return HTTOPRIGHT;
+ }
+ else if (pt.x >= r.left && pt.x <= r.left + clip + 6)
+ return HTLEFT;
+ else if (pt.x >= r.right - clip - 6 && pt.x <= r.right)
+ return HTRIGHT;
+
+ return(DefWindowProc(hwndDlg, WM_NCHITTEST, wParam, lParam));
+ }
+ case 0xae: // must be some undocumented message - seems it messes with the title bar...
+ if (CSkin::m_frameSkins)
+ return 0;
}
- return CallWindowProc(OldContainerWndProc, hwndDlg, msg, wParam, lParam);
+ return mir_callNextSubclass(hwndDlg, ContainerWndProc, msg, wParam, lParam);
}
+
/*
* container window procedure...
*/
@@ -588,8 +584,6 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, fHaveTipper = ServiceExists("mToolTip/ShowTip");
fForceOverlayIcons = M->GetByte("forceTaskBarStatusOverlays", 0) ? true : false;
- OldContainerWndProc = (WNDPROC)SetWindowLongPtr(hwndDlg, GWLP_WNDPROC, (LONG_PTR)ContainerWndProc);
-
pContainer = (struct TContainerData *) lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pContainer);
@@ -2055,7 +2049,6 @@ buttons_done: DeleteObject(pContainer->hbmToolbarBG);
DeleteDC(pContainer->cachedToolbarDC);
}
- SetWindowLongPtr(hwndDlg, GWLP_WNDPROC, (LONG_PTR)OldContainerWndProc);
return 0;
}
@@ -2069,6 +2062,7 @@ buttons_done: }
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
break;
+
case WM_CLOSE: {
//mad
if (PluginConfig.m_HideOnClose && !lParam) {
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 7dd0e4a4dd..e68961c72e 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -33,17 +33,17 @@ */
#include "commonheaders.h"
-static WNDPROC OldStatusBarproc = 0;
+static WNDPROC OldStatusBarproc = 0;
-extern int status_icon_list_size;
-extern TStatusBarIconNode *status_icon_list;
+extern int status_icon_list_size;
+extern TStatusBarIconNode *status_icon_list;
-bool CMenuBar::m_buttonsInit = false;
-HHOOK CMenuBar::m_hHook = 0;
-TBBUTTON CMenuBar::m_TbButtons[8] = {0};
-CMenuBar* CMenuBar::m_Owner = 0;
-HBITMAP CMenuBar::m_MimIcon = 0;
-int CMenuBar::m_MimIconRefCount = 0;
+bool CMenuBar::m_buttonsInit = false;
+HHOOK CMenuBar::m_hHook = 0;
+TBBUTTON CMenuBar::m_TbButtons[8] = {0};
+CMenuBar *CMenuBar::m_Owner = 0;
+HBITMAP CMenuBar::m_MimIcon = 0;
+int CMenuBar::m_MimIconRefCount = 0;
static int resetLP(WPARAM, LPARAM, LPARAM obj)
{
@@ -89,14 +89,12 @@ CMenuBar::CMenuBar(HWND hwndParent, const TContainerData *pContainer) m_isContactMenu = m_isMainMenu = false;
m_hevHook = HookEventParam(ME_LANGPACK_CHANGED, &::resetLP, (LPARAM)this);
- m_oldWndProc = (WNDPROC)::GetWindowLongPtr(m_hwndToolbar, GWLP_WNDPROC);
::SetWindowLongPtr(m_hwndToolbar, GWLP_USERDATA, (UINT_PTR)this);
- ::SetWindowLongPtr(m_hwndToolbar, GWLP_WNDPROC, (UINT_PTR)wndProc);
+ mir_subclassWindow(m_hwndToolbar, wndProc);
}
CMenuBar::~CMenuBar()
{
- ::SetWindowLongPtr(m_hwndToolbar, GWLP_WNDPROC, (UINT_PTR)m_oldWndProc);
::SetWindowLongPtr(m_hwndToolbar, GWLP_USERDATA, 0);
::DestroyWindow(m_hwndToolbar);
::UnhookEvent(m_hevHook);
@@ -161,20 +159,20 @@ LONG_PTR CMenuBar::processMsg(const UINT msg, const WPARAM wParam, const LPARAM if (msg == WM_NOTIFY) {
NMHDR* pNMHDR = (NMHDR*)lParam;
switch(pNMHDR->code) {
- case NM_CUSTOMDRAW: {
+ case NM_CUSTOMDRAW:
+ {
NMCUSTOMDRAW *nm = (NMCUSTOMDRAW*)lParam;
- return(customDrawWorker(nm));
+ return customDrawWorker(nm);
}
- case TBN_DROPDOWN: {
+ case TBN_DROPDOWN:
+ {
NMTOOLBAR *mtb = (NMTOOLBAR *)lParam;
-
- LRESULT result = Handle(mtb);
- return(result);
+ return Handle(mtb);
}
- case TBN_HOTITEMCHANGE: {
+ case TBN_HOTITEMCHANGE:
+ {
NMTBHOTITEM *nmtb = (NMTBHOTITEM *)lParam;
-
if (nmtb->idNew != 0 && m_fTracking && nmtb->idNew != m_activeID && m_activeID != 0) {
cancel(0);
return 0;
@@ -185,14 +183,14 @@ LONG_PTR CMenuBar::processMsg(const UINT msg, const WPARAM wParam, const LPARAM }
break;
}
- default:
- return(-1);
+
+ default:
+ return -1;
}
}
else if (msg == WM_LBUTTONDOWN) {
if (m_pContainer->dwFlags & CNT_NOTITLE) {
POINT pt;
-
::GetCursorPos(&pt);
return ::SendMessage(m_pContainer->hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
@@ -210,17 +208,14 @@ LRESULT CALLBACK CMenuBar::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP CMenuBar *menuBar = reinterpret_cast<CMenuBar *>(::GetWindowLongPtr(hWnd, GWLP_USERDATA));
switch(msg) {
- case WM_SYSKEYUP: {
- if (wParam == VK_MENU) {
- menuBar->Cancel();
- return 0;
- }
- break;
+ case WM_SYSKEYUP:
+ if (wParam == VK_MENU) {
+ menuBar->Cancel();
+ return 0;
}
- default:
- break;
+ break;
}
- return(::CallWindowProc(menuBar->m_oldWndProc, hWnd, msg, wParam, lParam));
+ return ::mir_callNextSubclass(hWnd, CMenuBar::wndProc, msg, wParam, lParam);
}
/**
@@ -331,13 +326,13 @@ LONG_PTR CMenuBar::customDrawWorker(NMCUSTOMDRAW *nm) (PluginConfig.m_fillColor ? PluginConfig.m_genericTxtColor :
(uState & (CDIS_SELECTED | CDIS_HOT | CDIS_MARKED)) ? ::GetSysColor(COLOR_HIGHLIGHTTEXT) : ::GetSysColor(COLOR_BTNTEXT));
- ::SetBkMode(m_hdcDraw, TRANSPARENT);
- CSkin::RenderText(m_hdcDraw, m_hTheme, szText, &nmtb->nmcd.rc, DT_SINGLELINE | DT_VCENTER | DT_CENTER, CSkin::m_glowSize, clr);
+ ::SetBkMode(m_hdcDraw, TRANSPARENT);
+ CSkin::RenderText(m_hdcDraw, m_hTheme, szText, &nmtb->nmcd.rc, DT_SINGLELINE | DT_VCENTER | DT_CENTER, CSkin::m_glowSize, clr);
}
if (iIndex == 0)
::DrawIconEx(m_hdcDraw, (nmtb->nmcd.rc.left + nmtb->nmcd.rc.right) / 2 - 8,
- (nmtb->nmcd.rc.top + nmtb->nmcd.rc.bottom) / 2 - 8, LoadSkinnedIcon(SKINICON_OTHER_MIRANDA),
- 16, 16, 0, 0, DI_NORMAL);
+ (nmtb->nmcd.rc.top + nmtb->nmcd.rc.bottom) / 2 - 8, LoadSkinnedIcon(SKINICON_OTHER_MIRANDA),
+ 16, 16, 0, 0, DI_NORMAL);
return(CDRF_SKIPDEFAULT);
}
@@ -721,13 +716,14 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR OldStatusBarproc = wc.lpfnWndProc;
}
switch (msg) {
- case WM_CREATE: {
+ case WM_CREATE:
+ {
CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
LRESULT ret;
HWND hwndParent = GetParent(hWnd);
/*
- * dirty trick to get rid of that annoying sizing gripper
- */
+ * dirty trick to get rid of that annoying sizing gripper
+ */
SetWindowLongPtr(hwndParent, GWL_STYLE, GetWindowLongPtr(hwndParent, GWL_STYLE) & ~WS_THICKFRAME);
SetWindowLongPtr(hwndParent, GWL_EXSTYLE, GetWindowLongPtr(hwndParent, GWL_EXSTYLE) & ~WS_EX_APPWINDOW);
cs->style &= ~SBARS_SIZEGRIP;
@@ -737,7 +733,8 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR return ret;
}
- case WM_NCHITTEST: {
+ case WM_NCHITTEST:
+ {
RECT r;
POINT pt;
LRESULT lr = SendMessage(GetParent(hWnd), WM_NCHITTEST, wParam, lParam);
@@ -750,15 +747,16 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR return HTBOTTOMRIGHT;
}
if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT
- || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
+ || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
return HTTRANSPARENT;
- break;
}
+ break;
- case WM_ERASEBKGND:
- return 1;
+ case WM_ERASEBKGND:
+ return 1;
- case WM_PAINT: {
+ case WM_PAINT:
+ {
PAINTSTRUCT ps;
TCHAR szText[1024];
int i;
@@ -825,8 +823,8 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR itemRect.left += 2;
/*
- * draw visual message length indicator in the leftmost status bar field
- */
+ * draw visual message length indicator in the leftmost status bar field
+ */
if (PluginConfig.m_visualMessageSizeIndicator && i == 0) {
@@ -894,7 +892,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR }
itemRect.left += 20;
CSkin::RenderText(hdcMem, hTheme, szText, &itemRect, DT_VCENTER | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX,
- CSkin::m_glowSize, clr);
+ CSkin::m_glowSize, clr);
}
else
DrawIconEx(hdcMem, itemRect.left + 3, (height / 2 - 8) + itemRect.top, hIcon, 16, 16, 0, 0, DI_NORMAL);
@@ -903,7 +901,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR itemRect.left += 2;
itemRect.right -= 2;
CSkin::RenderText(hdcMem, hTheme, szText, &itemRect, DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOPREFIX,
- CSkin::m_glowSize, clr);
+ CSkin::m_glowSize, clr);
}
}
}
@@ -921,14 +919,15 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR CMimAPI::m_pfnCloseThemeData(hTheme);
EndPaint(hWnd, &ps);
- return 0;
}
+ return 0;
- /*
- * tell status bar to update the part layout (re-calculate part widths)
- * needed when an icon is added to or removed from the icon area
- */
- case WM_USER + 101: {
+ /*
+ * tell status bar to update the part layout (re-calculate part widths)
+ * needed when an icon is added to or removed from the icon area
+ */
+ case WM_USER + 101:
+ {
struct TWindowData *dat = (struct TWindowData *)lParam;
RECT rcs;
int statwidths[5];
@@ -966,17 +965,18 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR statwidths[1] = (rcs.right - rcs.left) - (62 + ((list_icons) * (PluginConfig.m_smcxicon + 2)));
statwidths[2] = -1;
SendMessage(hWnd, SB_SETPARTS, 3, (LPARAM) statwidths);
- return 0;
}
+ return 0;
- case WM_SETCURSOR: {
+ case WM_SETCURSOR:
+ {
POINT pt;
GetCursorPos(&pt);
SendMessage(GetParent(hWnd), msg, wParam, lParam);
- if (pt.x == ptMouse.x && pt.y == ptMouse.y) {
+ if (pt.x == ptMouse.x && pt.y == ptMouse.y)
return 1;
- }
+
ptMouse = pt;
if (tooltip_active) {
KillTimer(hWnd, TIMERID_HOVER);
@@ -985,11 +985,12 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR }
KillTimer(hWnd, TIMERID_HOVER);
SetTimer(hWnd, TIMERID_HOVER, 450, 0);
- break;
}
+ break;
- case WM_LBUTTONDOWN:
- case WM_RBUTTONDOWN: {
+ case WM_LBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ {
POINT pt;
KillTimer(hWnd, TIMERID_HOVER);
@@ -1010,148 +1011,147 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR if (!PtInRect(&rcIconpart, pt1))
return SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
- break;
}
+ break;
- case WM_TIMER:
- if (wParam == TIMERID_HOVER) {
- POINT pt;
- char *szTTService = "mToolTip/ShowTipW";
- CLCINFOTIP ti = {0};
- ti.cbSize = sizeof(ti);
+ case WM_TIMER:
+ if (wParam == TIMERID_HOVER) {
+ POINT pt;
+ char *szTTService = "mToolTip/ShowTipW";
+ CLCINFOTIP ti = {0};
+ ti.cbSize = sizeof(ti);
- KillTimer(hWnd, TIMERID_HOVER);
- GetCursorPos(&pt);
- if (pt.x == ptMouse.x && pt.y == ptMouse.y) {
- RECT rc;
- struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
-//mad
- SIZE size;
- TCHAR szStatusBarText[512];
-//mad_
- ti.ptCursor = pt;
- ScreenToClient(hWnd, &pt);
- SendMessage(hWnd, SB_GETRECT, 2, (LPARAM)&rc);
- if (dat && PtInRect(&rc, pt)) {
- int gap = 2;
- TStatusBarIconNode *current = status_icon_list;
- TStatusBarIconNode *clicked = NULL;
- TStatusBarIconNode *currentSIN = NULL;
-
- unsigned int iconNum = (pt.x - rc.left) / (PluginConfig.m_smcxicon + gap);
- unsigned int list_icons = 0;
- char buff[100];
- DWORD flags;
-
- while (current) {
- if (current->sid.flags&MBF_OWNERSTATE&&dat->pSINod){
- TStatusBarIconNode *currentSIN = dat->pSINod;
- flags=current->sid.flags;
- while (currentSIN) {
- if (strcmp(currentSIN->sid.szModule, current->sid.szModule) == 0 && currentSIN->sid.dwId == current->sid.dwId) {
- flags=currentSIN->sid.flags;
- break;
- }
- currentSIN = currentSIN->next;
+ KillTimer(hWnd, TIMERID_HOVER);
+ GetCursorPos(&pt);
+ if (pt.x == ptMouse.x && pt.y == ptMouse.y) {
+ RECT rc;
+ struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ //mad
+ SIZE size;
+ TCHAR szStatusBarText[512];
+ //mad_
+ ti.ptCursor = pt;
+ ScreenToClient(hWnd, &pt);
+ SendMessage(hWnd, SB_GETRECT, 2, (LPARAM)&rc);
+ if (dat && PtInRect(&rc, pt)) {
+ int gap = 2;
+ TStatusBarIconNode *current = status_icon_list;
+ TStatusBarIconNode *clicked = NULL;
+ TStatusBarIconNode *currentSIN = NULL;
+
+ unsigned int iconNum = (pt.x - rc.left) / (PluginConfig.m_smcxicon + gap);
+ unsigned int list_icons = 0;
+ char buff[100];
+ DWORD flags;
+
+ while (current) {
+ if (current->sid.flags&MBF_OWNERSTATE&&dat->pSINod){
+ TStatusBarIconNode *currentSIN = dat->pSINod;
+ flags=current->sid.flags;
+ while (currentSIN) {
+ if (strcmp(currentSIN->sid.szModule, current->sid.szModule) == 0 && currentSIN->sid.dwId == current->sid.dwId) {
+ flags=currentSIN->sid.flags;
+ break;
}
+ currentSIN = currentSIN->next;
}
- else {
- sprintf(buff, "SRMMStatusIconFlags%d", (int)current->sid.dwId);
- flags = M->GetByte(dat->hContact, current->sid.szModule, buff, current->sid.flags);
- }
- if (!(flags & MBF_HIDDEN)) {
- if (list_icons++ == iconNum)
- clicked = current;
- }
- current = current->next;
}
-
- if (clicked&&clicked->sid.flags&MBF_OWNERSTATE) {
- currentSIN=dat->pSINod;
- while (currentSIN) {
- if (strcmp(currentSIN->sid.szModule, clicked->sid.szModule) == 0 && currentSIN->sid.dwId == clicked->sid.dwId) {
- clicked=currentSIN;
- break;
- }
- currentSIN = currentSIN->next;
- }
- }
-
- if ((int)iconNum == list_icons && pContainer) {
- TCHAR wBuf[512];
-
- mir_sntprintf(wBuf, safe_sizeof(wBuf), TranslateT("Sounds are %s. Click to toggle status, hold SHIFT and click to set for all open containers"),
- pContainer->dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
- CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
- tooltip_active = TRUE;
+ else {
+ sprintf(buff, "SRMMStatusIconFlags%d", (int)current->sid.dwId);
+ flags = M->GetByte(dat->hContact, current->sid.szModule, buff, current->sid.flags);
}
- else if ((int)iconNum == list_icons + 1 && dat && dat->bType == SESSIONTYPE_IM) {
- int mtnStatus = (int)M->GetByte(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M->GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
- TCHAR wBuf[512];
-
- mir_sntprintf(wBuf, safe_sizeof(wBuf), TranslateT("Sending typing notifications is %s."),
- mtnStatus ? TranslateT("enabled") : TranslateT("disabled"));
- CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
- tooltip_active = TRUE;
+ if (!(flags & MBF_HIDDEN)) {
+ if (list_icons++ == iconNum)
+ clicked = current;
}
- else if ((int)iconNum == list_icons + 2) {
- TCHAR wBuf[512];
-
- mir_sntprintf(wBuf, safe_sizeof(wBuf), _T("%s"), TranslateT("Session list.\nClick left for a list of open sessions.\nClick right to access favorites and quickly configure message window behavior"));
+ current = current->next;
+ }
- CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
- tooltip_active = TRUE;
- }
- else {
- if (clicked) {
- CallService("mToolTip/ShowTip", (WPARAM)clicked->sid.szTooltip, (LPARAM)&ti);
- tooltip_active = TRUE;
+ if (clicked&&clicked->sid.flags&MBF_OWNERSTATE) {
+ currentSIN=dat->pSINod;
+ while (currentSIN) {
+ if (strcmp(currentSIN->sid.szModule, clicked->sid.szModule) == 0 && currentSIN->sid.dwId == clicked->sid.dwId) {
+ clicked=currentSIN;
+ break;
}
+ currentSIN = currentSIN->next;
}
}
- SendMessage(hWnd, SB_GETRECT, 1, (LPARAM)&rc);
- if (dat && PtInRect(&rc, pt)) {
- int iLength = 0;
- GETTEXTLENGTHEX gtxl = {0};
- int iQueued = M->GetDword(dat->hContact, "SendLater", "count", 0);
- gtxl.codepage = CP_UTF8;
- gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
- iLength = SendDlgItemMessage(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM) & gtxl, 0);
- tooltip_active = TRUE;
+ if ((int)iconNum == list_icons && pContainer) {
TCHAR wBuf[512];
- const TCHAR *szFormat = TranslateT("There are %d pending send jobs. Message length: %d bytes, message length limit: %d bytes\n\n%d messages are queued for later delivery");
- mir_sntprintf(wBuf, safe_sizeof(wBuf), szFormat, dat->iOpenJobs, iLength, dat->nMax ? dat->nMax : 20000, iQueued);
+ mir_sntprintf(wBuf, safe_sizeof(wBuf), TranslateT("Sounds are %s. Click to toggle status, hold SHIFT and click to set for all open containers"),
+ pContainer->dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
+ tooltip_active = TRUE;
}
- //MAD
- if (SendMessage(dat->pContainer->hwndStatus, SB_GETTEXT, 0, (LPARAM)szStatusBarText)) {
- HDC hdc;
- int iLen=SendMessage(dat->pContainer->hwndStatus,SB_GETTEXTLENGTH,0,0);
- SendMessage(hWnd, SB_GETRECT, 0, (LPARAM)&rc);
- GetTextExtentPoint32( hdc=GetDC( dat->pContainer->hwndStatus), szStatusBarText, iLen, &size );
- ReleaseDC (dat->pContainer->hwndStatus,hdc);
+ else if ((int)iconNum == list_icons + 1 && dat && dat->bType == SESSIONTYPE_IM) {
+ int mtnStatus = (int)M->GetByte(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M->GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
+ TCHAR wBuf[512];
- if (dat && PtInRect(&rc,pt)&&((rc.right-rc.left)<size.cx)) {
- DBVARIANT dbv={0};
+ mir_sntprintf(wBuf, safe_sizeof(wBuf), TranslateT("Sending typing notifications is %s."),
+ mtnStatus ? TranslateT("enabled") : TranslateT("disabled"));
+ CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
+ tooltip_active = TRUE;
+ }
+ else if ((int)iconNum == list_icons + 2) {
+ TCHAR wBuf[512];
- if (dat->bType == SESSIONTYPE_CHAT)
- M->GetTString(dat->hContact,dat->szProto,"Topic",&dbv);
+ mir_sntprintf(wBuf, safe_sizeof(wBuf), _T("%s"), TranslateT("Session list.\nClick left for a list of open sessions.\nClick right to access favorites and quickly configure message window behavior"));
+ CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
+ tooltip_active = TRUE;
+ }
+ else {
+ if (clicked) {
+ CallService("mToolTip/ShowTip", (WPARAM)clicked->sid.szTooltip, (LPARAM)&ti);
tooltip_active = TRUE;
- CallService(szTTService, (WPARAM)dbv.ptszVal, (LPARAM)&ti);
- if (dbv.pszVal)
- DBFreeVariant(&dbv);
}
}
- // MAD_
+ }
+ SendMessage(hWnd, SB_GETRECT, 1, (LPARAM)&rc);
+ if (dat && PtInRect(&rc, pt)) {
+ int iLength = 0;
+ GETTEXTLENGTHEX gtxl = {0};
+ int iQueued = M->GetDword(dat->hContact, "SendLater", "count", 0);
+ gtxl.codepage = CP_UTF8;
+ gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
+ iLength = SendDlgItemMessage(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM) & gtxl, 0);
+ tooltip_active = TRUE;
+
+ TCHAR wBuf[512];
+ const TCHAR *szFormat = TranslateT("There are %d pending send jobs. Message length: %d bytes, message length limit: %d bytes\n\n%d messages are queued for later delivery");
+
+ mir_sntprintf(wBuf, safe_sizeof(wBuf), szFormat, dat->iOpenJobs, iLength, dat->nMax ? dat->nMax : 20000, iQueued);
+ CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
+ }
+ //MAD
+ if (SendMessage(dat->pContainer->hwndStatus, SB_GETTEXT, 0, (LPARAM)szStatusBarText)) {
+ HDC hdc;
+ int iLen=SendMessage(dat->pContainer->hwndStatus,SB_GETTEXTLENGTH,0,0);
+ SendMessage(hWnd, SB_GETRECT, 0, (LPARAM)&rc);
+ GetTextExtentPoint32( hdc=GetDC( dat->pContainer->hwndStatus), szStatusBarText, iLen, &size );
+ ReleaseDC (dat->pContainer->hwndStatus,hdc);
+
+ if (dat && PtInRect(&rc,pt)&&((rc.right-rc.left)<size.cx)) {
+ DBVARIANT dbv={0};
+
+ if (dat->bType == SESSIONTYPE_CHAT)
+ M->GetTString(dat->hContact,dat->szProto,"Topic",&dbv);
+
+ tooltip_active = TRUE;
+ CallService(szTTService, (WPARAM)dbv.ptszVal, (LPARAM)&ti);
+ if (dbv.pszVal)
+ DBFreeVariant(&dbv);
+ }
}
}
- break;
+ }
+ break;
- case WM_DESTROY:
- KillTimer(hWnd, TIMERID_HOVER);
+ case WM_DESTROY:
+ KillTimer(hWnd, TIMERID_HOVER);
}
return CallWindowProc(OldStatusBarproc, hWnd, msg, wParam, lParam);
}
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 5472031de8..90c8d5dd04 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1283,7 +1283,7 @@ LRESULT TSAPI DM_SaveLocale(TWindowData *dat, WPARAM wParam, LPARAM lParam) LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam)
{
- LRESULT result = CallWindowProc(oldWndProc, hwnd, WM_COPY, wParam, lParam);
+ LRESULT result = mir_callNextSubclass(hwnd, oldWndProc, WM_COPY, wParam, lParam);
if (OpenClipboard(hwnd)) {
HANDLE hClip = GetClipboardData(CF_UNICODETEXT);
diff --git a/plugins/TabSRMM/src/include/controls.h b/plugins/TabSRMM/src/include/controls.h index 7c2560afe8..ac4c0a3374 100644 --- a/plugins/TabSRMM/src/include/controls.h +++ b/plugins/TabSRMM/src/include/controls.h @@ -108,7 +108,6 @@ private: bool m_isAero;
bool m_mustAutoHide;
LONG m_size_y;
- WNDPROC m_oldWndProc;
HANDLE m_hevHook;
/*
* for custom drawing
diff --git a/plugins/TabSRMM/src/include/infopanel.h b/plugins/TabSRMM/src/include/infopanel.h index f7513b8930..a7c64e469a 100644 --- a/plugins/TabSRMM/src/include/infopanel.h +++ b/plugins/TabSRMM/src/include/infopanel.h @@ -90,7 +90,7 @@ private: INT_PTR CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK WndProcStub(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
HWND m_hwnd; // our window handle
HWND m_hRich; // handle of the rich edit child
@@ -104,9 +104,6 @@ private: int m_leftWidth;
const CInfoPanel *m_panel; // the info panel parent (if any)
-
-private:
- static WNDPROC m_OldMessageEditProc; // stores original richedit wnd proc
};
/**
@@ -182,7 +179,7 @@ public: public:
static TInfoPanelConfig m_ipConfig;
static int setPanelHandler(TWindowData *dat, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
private:
void mapRealRect(const RECT& rcSrc, RECT& rcDest, const SIZE& sz);
diff --git a/plugins/TabSRMM/src/include/msgs.h b/plugins/TabSRMM/src/include/msgs.h index 3e95b494c0..13f64e33e2 100644 --- a/plugins/TabSRMM/src/include/msgs.h +++ b/plugins/TabSRMM/src/include/msgs.h @@ -346,7 +346,6 @@ struct TWindowData int nMax; // max message size
int textLen; // current text len
LONG ipFieldHeight;
- WNDPROC oldIEViewProc;
BOOL clr_added;
BOOL fIsReattach;
WPARAM wParam; // used for "delayed" actions like moved splitters in minimized windows
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index d90b48d121..7af941f3bb 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -43,7 +43,6 @@ TCHAR *xStatusDescr[] = { _T("Angry"), _T("Duck"), _T("Tired"), _T("Party"), _T( TInfoPanelConfig CInfoPanel::m_ipConfig = {0};
-WNDPROC CTip::m_OldMessageEditProc = 0;
int CInfoPanel::setPanelHandler(TWindowData *dat, WPARAM wParam, LPARAM lParam)
{
@@ -1021,7 +1020,7 @@ void CInfoPanel::hideTip(const HWND hwndNew) * native avatar rendering does not support animated images.
* To avoid clipping issues, this is done during WM_ERASEBKGND.
*/
-INT_PTR CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_ERASEBKGND:
@@ -1407,7 +1406,7 @@ CTip::CTip(const HWND hwndParent, const HANDLE hContact, const TCHAR *pszText, c m_pszText = 0;
m_panel = panel;
m_hwndParent = hwndParent;
- m_OldMessageEditProc = (WNDPROC)SetWindowLongPtr(m_hRich, GWLP_WNDPROC, (LONG_PTR)RichEditProc);
+ mir_subclassWindow(m_hRich, RichEditProc);
}
/**
@@ -1518,26 +1517,26 @@ void CTip::registerClass() * subclass the rich edit control inside the tip. Needed to hide the blinking
* caret and prevent all scrolling actions.
*/
-INT_PTR CALLBACK CTip::RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK CTip::RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_SETCURSOR:
- ::HideCaret(hwnd);
- break;
+ case WM_SETCURSOR:
+ ::HideCaret(hwnd);
+ break;
- case WM_ERASEBKGND:
- return 1;
+ case WM_ERASEBKGND:
+ return 1;
- case WM_NCCALCSIZE:
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_VSCROLL);
- EnableScrollBar(hwnd, SB_VERT, ESB_DISABLE_BOTH);
- ShowScrollBar(hwnd, SB_VERT, FALSE);
- break;
+ case WM_NCCALCSIZE:
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_VSCROLL);
+ EnableScrollBar(hwnd, SB_VERT, ESB_DISABLE_BOTH);
+ ShowScrollBar(hwnd, SB_VERT, FALSE);
+ break;
- case WM_VSCROLL:
- return 0;
+ case WM_VSCROLL:
+ return 0;
}
- return(::CallWindowProc(m_OldMessageEditProc, hwnd, msg, wParam, lParam));
+ return ::mir_callNextSubclass(hwnd, CTip::RichEditProc, msg, wParam, lParam);
}
/**
@@ -1568,21 +1567,22 @@ INT_PTR CALLBACK CTip::WndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_ACTIVATE:
- case WM_SETCURSOR:
- ::KillTimer(hwnd, 1000);
- ::SetTimer(hwnd, 1000, 200, 0);
+ case WM_ACTIVATE:
+ case WM_SETCURSOR:
+ ::KillTimer(hwnd, 1000);
+ ::SetTimer(hwnd, 1000, 200, 0);
- if (msg == WM_ACTIVATE && LOWORD(wParam) == WA_INACTIVE)
- ::DestroyWindow(hwnd);
- break;
+ if (msg == WM_ACTIVATE && LOWORD(wParam) == WA_INACTIVE)
+ ::DestroyWindow(hwnd);
+ break;
- /* prevent resizing */
- case WM_NCHITTEST:
- return(HTCLIENT);
- break;
+ /* prevent resizing */
+ case WM_NCHITTEST:
+ return(HTCLIENT);
+ break;
- case WM_ERASEBKGND: {
+ case WM_ERASEBKGND:
+ {
HDC hdc = (HDC) wParam;
RECT rc;
TCHAR szTitle[128];
@@ -1602,7 +1602,6 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam HBITMAP hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(hdcMem, hbm));
HFONT hOldFont = reinterpret_cast<HFONT>(::SelectObject(hdcMem, CInfoPanel::m_ipConfig.hFonts[IPFONTID_NICK]));
-
::SetBkMode(hdcMem, TRANSPARENT);
rc.bottom += 2;
rc.left -= 4;rc.right += 4;
@@ -1623,7 +1622,7 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam else {
::FillRect(hdcMem, &rc, br);
::DrawAlpha(hdcMem, &rcText, PluginConfig.m_ipBackgroundGradientHigh, 100, PluginConfig.m_ipBackgroundGradient,
- 0, GRADIENT_TB + 1, 0, 2, 0);
+ 0, GRADIENT_TB + 1, 0, 2, 0);
}
::DeleteObject(br);
rcText.left = 20;
@@ -1650,64 +1649,56 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ::DeleteObject(hbm);
::DeleteDC(hdcMem);
}
- return 1;
}
-
- case WM_NOTIFY: {
- switch (((NMHDR *) lParam)->code) {
- case EN_LINK:
- ::SetFocus(m_hRich);
- switch (((ENLINK *) lParam)->msg) {
- case WM_LBUTTONUP: {
- ENLINK* e = reinterpret_cast<ENLINK *>(lParam);
-
- const TCHAR* tszUrl = Utils::extractURLFromRichEdit(e, m_hRich);
- if (tszUrl) {
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)tszUrl);
- mir_free(const_cast<TCHAR *>(tszUrl));
- }
- ::DestroyWindow(hwnd);
- break;
- }
+ return 1;
+
+ case WM_NOTIFY:
+ switch (((NMHDR *) lParam)->code) {
+ case EN_LINK:
+ ::SetFocus(m_hRich);
+ switch (((ENLINK *) lParam)->msg) {
+ case WM_LBUTTONUP:
+ {
+ ENLINK *e = reinterpret_cast<ENLINK *>(lParam);
+ const TCHAR *tszUrl = Utils::extractURLFromRichEdit(e, m_hRich);
+ if (tszUrl) {
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)tszUrl);
+ mir_free(const_cast<TCHAR *>(tszUrl));
}
+ ::DestroyWindow(hwnd);
break;
- default:
- break;
+ }
}
break;
}
+ break;
- case WM_COMMAND: {
- if ((HWND)lParam == m_hRich && HIWORD(wParam) == EN_SETFOCUS)
- ::HideCaret(m_hRich);
- break;
- }
-
- case WM_TIMER:
- if (wParam == 1000) {
- POINT pt;
- RECT rc;
-
- ::KillTimer(hwnd, 1000);
- ::GetCursorPos(&pt);
- ::GetWindowRect(hwnd, &rc);
- if (!PtInRect(&rc, pt))
- ::DestroyWindow(hwnd);
- else
- break;
- if (::GetActiveWindow() != hwnd)
- ::DestroyWindow(hwnd);
- }
- break;
+ case WM_COMMAND:
+ if ((HWND)lParam == m_hRich && HIWORD(wParam) == EN_SETFOCUS)
+ ::HideCaret(m_hRich);
+ break;
- case WM_DESTROY:
- ::SetWindowLongPtr(m_hRich, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(m_OldMessageEditProc));
- break;
+ case WM_TIMER:
+ if (wParam == 1000) {
+ POINT pt;
+ RECT rc;
- case WM_NCDESTROY: {
- ::SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- delete this;
+ ::KillTimer(hwnd, 1000);
+ ::GetCursorPos(&pt);
+ ::GetWindowRect(hwnd, &rc);
+ if (!PtInRect(&rc, pt))
+ ::DestroyWindow(hwnd);
+ else
+ break;
+ if (::GetActiveWindow() != hwnd)
+ ::DestroyWindow(hwnd);
}
+ break;
+
+ case WM_NCDESTROY:
+ ::SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ delete this;
}
+
return(::DefWindowProc(hwnd, msg, wParam, lParam));
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 119b7a078a..889c96f0c7 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -40,11 +40,6 @@ extern TTemplateSet RTL_Active, LTR_Active;
const TCHAR* pszIDCSAVE_close = 0, *pszIDCSAVE_save = 0;
-static WNDPROC OldMessageEditProc=0, OldAvatarWndProc=0, OldMessageLogProc=0, oldAvatarParentWndProc=0;
- WNDPROC OldIEViewProc = 0;
-
-WNDPROC OldSplitterProc = 0;
-
static const UINT sendControls[] = { IDC_MESSAGE, IDC_LOG };
static const UINT formatControls[] = { IDC_SMILEYBTN, IDC_FONTBOLD, IDC_FONTITALIC, IDC_FONTUNDERLINE, IDC_FONTFACE,IDC_FONTSTRIKEOUT };
static const UINT addControls[] = { IDC_ADD, IDC_CANCELADD };
@@ -276,11 +271,11 @@ LRESULT CALLBACK IEViewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l switch (msg) {
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldIEViewProc));
+ return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, IEViewSubclassProc));
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldIEViewProc));
+ return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, IEViewSubclassProc));
}
- return CallWindowProc(OldIEViewProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, IEViewSubclassProc, msg, wParam, lParam);
}
/*
@@ -289,7 +284,6 @@ LRESULT CALLBACK IEViewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
-
struct TWindowData *mwdat = (struct TWindowData *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
if (mwdat) {
BOOL isCtrl, isShift, isAlt;
@@ -297,9 +291,9 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP switch(msg) {
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, mwdat->oldIEViewProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, HPPKFSubclassProc);
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, mwdat->oldIEViewProc));
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, HPPKFSubclassProc);
case WM_KEYDOWN:
if (!isCtrl && !isAlt&&!isShift) {
@@ -318,7 +312,7 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP }
}
}
- return CallWindowProc(mwdat->oldIEViewProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, HPPKFSubclassProc, msg, wParam, lParam);
}
/*
@@ -431,11 +425,8 @@ static void MsgWindowUpdateState(TWindowData *dat, UINT msg) pt.x = rcRTF.left;
pt.y = rcRTF.top;
if (dat->hwndIEView) {
- if (M->GetByte("subclassIEView", 0) && dat->oldIEViewProc == 0) {
- WNDPROC wndProc = (WNDPROC)SetWindowLongPtr(dat->hwndIEView, GWLP_WNDPROC, (LONG_PTR)IEViewSubclassProc);
- if (OldIEViewProc == 0)
- OldIEViewProc = wndProc;
- dat->oldIEViewProc = wndProc;
+ if (M->GetByte("subclassIEView", 0)) {
+ mir_subclassWindow(dat->hwndIEView, IEViewSubclassProc);
SetWindowPos(dat->hwndIEView, 0, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME);
RedrawWindow(dat->hwndIEView, 0, 0, RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW);
}
@@ -596,40 +587,33 @@ static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara break;
//MAD_
case WM_COPY:
- return(DM_WMCopyHandler(hwnd, OldMessageLogProc, wParam, lParam));
+ return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, wParam, lParam);
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldMessageLogProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, MessageLogSubclassProc);
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldMessageLogProc));
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, MessageLogSubclassProc);
case WM_CONTEXTMENU:
- {
- POINT pt;
-
- if (lParam == 0xFFFFFFFF) {
- CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel);
- SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM) sel.cpMax);
- ClientToScreen(hwnd, &pt);
- }
- else {
- pt.x = (short) LOWORD(lParam);
- pt.y = (short) HIWORD(lParam);
- }
+ POINT pt;
- ShowPopupMenu(mwdat, IDC_LOG, hwnd, pt);
+ if (lParam == 0xFFFFFFFF) {
+ CHARRANGE sel;
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel);
+ SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM) sel.cpMax);
+ ClientToScreen(hwnd, &pt);
+ }
+ else {
+ pt.x = (short) LOWORD(lParam);
+ pt.y = (short) HIWORD(lParam);
}
- return TRUE;
-
- case WM_NCDESTROY:
- if (OldMessageLogProc)
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) OldMessageLogProc);
- break;
+ ShowPopupMenu(mwdat, IDC_LOG, hwnd, pt);
+ return TRUE;
}
- return CallWindowProc(OldMessageLogProc, hwnd, msg, wParam, lParam);
+
+ return mir_callNextSubclass(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -639,9 +623,9 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar struct TWindowData *mwdat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
/*
- * prevent the rich edit from switching text direction or keyboard layout when
- * using hotkeys with ctrl-shift or alt-shift modifiers
- */
+ * prevent the rich edit from switching text direction or keyboard layout when
+ * using hotkeys with ctrl-shift or alt-shift modifiers
+ */
if (mwdat->fkeyProcessed && (msg == WM_KEYUP)) {
GetKeyboardState(mwdat->kstate);
if (mwdat->kstate[VK_CONTROL] & 0x80 || mwdat->kstate[VK_SHIFT] & 0x80)
@@ -653,12 +637,15 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar }
switch (msg) {
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, OldMessageEditProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageEditSubclassProc);
+
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, OldMessageEditProc));
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageEditSubclassProc);
+
case WM_DROPFILES:
SendMessage(hwndParent, WM_DROPFILES, (WPARAM)wParam, (LPARAM)lParam);
break;
+
case WM_CHAR:
{
BOOL isCtrl, isShift, isAlt;
@@ -728,7 +715,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar CloseClipboard();
}
- return CallWindowProc(OldMessageEditProc, hwnd, msg, wParam, lParam);
+ break;
case WM_KEYDOWN:
{
@@ -888,7 +875,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar case WM_USER + 100:
SetFocus(hwnd);
break;
- case WM_CONTEXTMENU: {
+ case WM_CONTEXTMENU:
POINT pt;
if (lParam == 0xFFFFFFFF) {
@@ -903,13 +890,8 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar ShowPopupMenu(mwdat, IDC_MESSAGE, hwnd, pt);
return TRUE;
- }
- case WM_NCDESTROY:
- if (OldMessageEditProc)
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) OldMessageEditProc);
- break;
}
- return CallWindowProc(OldMessageEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
/*
@@ -920,13 +902,12 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar static LRESULT CALLBACK AvatarSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
-
- case WM_ERASEBKGND:
- return TRUE;
- case WM_UPDATEUISTATE:
- return TRUE;
+ case WM_ERASEBKGND:
+ return TRUE;
+ case WM_UPDATEUISTATE:
+ return TRUE;
}
- return CallWindowProc(OldAvatarWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, AvatarSubclassProc, msg, wParam, lParam);
}
LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -935,43 +916,48 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM TWindowData *dat = (TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
switch (msg) {
- case WM_NCHITTEST:
- return HTCLIENT;
- case WM_SETCURSOR: {
+ case WM_NCHITTEST:
+ return HTCLIENT;
+ case WM_SETCURSOR:
+ {
RECT rc;
GetClientRect(hwnd, &rc);
SetCursor(rc.right > rc.bottom ? PluginConfig.hCurSplitNS : PluginConfig.hCurSplitWE);
- return TRUE;
}
- case WM_LBUTTONDOWN: {
- if (hwnd == GetDlgItem(hwndParent, IDC_SPLITTER) || hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY)) {
- RECT rc;
+ return TRUE;
- if (dat) {
- GetClientRect(hwnd, &rc);
- dat->savedSplitter = rc.right > rc.bottom ? (short) HIWORD(GetMessagePos()) + rc.bottom / 2 : (short) LOWORD(GetMessagePos()) + rc.right / 2;
- if (dat->bType == SESSIONTYPE_IM)
- dat->savedSplitY = dat->splitterY;
- else {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
- dat->savedSplitY = si->iSplitterY;
- }
- dat->savedDynaSplit = dat->dynaSplitter;
+ case WM_LBUTTONDOWN:
+ if (hwnd == GetDlgItem(hwndParent, IDC_SPLITTER) || hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY)) {
+ RECT rc;
+
+ if (dat) {
+ GetClientRect(hwnd, &rc);
+ dat->savedSplitter = rc.right > rc.bottom ? (short) HIWORD(GetMessagePos()) + rc.bottom / 2 : (short) LOWORD(GetMessagePos()) + rc.right / 2;
+ if (dat->bType == SESSIONTYPE_IM)
+ dat->savedSplitY = dat->splitterY;
+ else {
+ SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ dat->savedSplitY = si->iSplitterY;
}
+ dat->savedDynaSplit = dat->dynaSplitter;
}
- SetCapture(hwnd);
- return 0;
}
- case WM_MOUSEMOVE:
- if (GetCapture() == hwnd) {
- RECT rc;
- GetClientRect(hwnd, &rc);
- SendMessage(hwndParent, DM_SPLITTERMOVED, rc.right > rc.bottom ? (short) HIWORD(GetMessagePos()) + rc.bottom / 2 : (short) LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM) hwnd);
- }
- return 0;
- case WM_ERASEBKGND:
- return 1;
- case WM_PAINT: {
+ SetCapture(hwnd);
+ return 0;
+
+ case WM_MOUSEMOVE:
+ if (GetCapture() == hwnd) {
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+ SendMessage(hwndParent, DM_SPLITTERMOVED, rc.right > rc.bottom ? (short) HIWORD(GetMessagePos()) + rc.bottom / 2 : (short) LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM) hwnd);
+ }
+ return 0;
+
+ case WM_ERASEBKGND:
+ return 1;
+
+ case WM_PAINT:
+ {
RECT rc;
PAINTSTRUCT ps;
HDC dc = BeginPaint(hwnd, &ps);
@@ -991,20 +977,21 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM else
CSkin::FillBack(dc, &rc);
EndPaint(hwnd, &ps);
- return 0;
}
+ return 0;
- case WM_LBUTTONUP: {
- HWND hwndCapture = GetCapture();
+ case WM_LBUTTONUP: {
+ HWND hwndCapture = GetCapture();
- ReleaseCapture();
- DM_ScrollToBottom(dat, 0, 1);
- if (dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_PANELSPLITTER)) {
- SendMessage(hwndParent, WM_SIZE, 0, 0);
- dat->panelWidth = -1;
- RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
- } else if ((dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_SPLITTER)) ||
- (dat && dat->bType == SESSIONTYPE_CHAT && hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY))) {
+ ReleaseCapture();
+ DM_ScrollToBottom(dat, 0, 1);
+ if (dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_PANELSPLITTER)) {
+ SendMessage(hwndParent, WM_SIZE, 0, 0);
+ dat->panelWidth = -1;
+ RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
+ }
+ else if ((dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_SPLITTER)) ||
+ (dat && dat->bType == SESSIONTYPE_CHAT && hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY))) {
RECT rc;
POINT pt;
int selection;
@@ -1024,26 +1011,29 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM selection = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, NULL);
#endif
switch (selection) {
- case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY: {
+ case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY:
+ {
HWND hwndParent = GetParent(hwnd);
dat->dwFlagsEx |= MWF_SHOW_SPLITTEROVERRIDE;
M->WriteByte(dat->hContact, SRMSGMOD_T, "splitoverride", 1);
if (dat->bType == SESSIONTYPE_IM)
SaveSplitter(dat);
- break;
}
- case ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION:
+ break;
+
+ case ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION:
#if defined(__FEAT_EXP_AUTOSPLITTER)
- if (dat->fIsAutosizingInput) {
- RECT rc;
- GetWindowRect(GetDlgItem(dat->hwnd, IDC_MESSAGE), &rc);
- dat->iInputAreaHeight = 0;
- }
+ if (dat->fIsAutosizingInput) {
+ RECT rc;
+ GetWindowRect(GetDlgItem(dat->hwnd, IDC_MESSAGE), &rc);
+ dat->iInputAreaHeight = 0;
+ }
#endif
- break;
- case ID_SPLITTERCONTEXT_SAVEGLOBALFORALLSESSIONS: {
+ break;
+ case ID_SPLITTERCONTEXT_SAVEGLOBALFORALLSESSIONS:
+ {
RECT rcWin;
BYTE bSync = M->GetByte("Chat", "SyncSplitter", 0);
DWORD dwOff_IM = 0, dwOff_CHAT = 0;
@@ -1062,27 +1052,28 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM PluginConfig.lastSPlitterPos.bSync = bSync;
SendMessage(dat->hwnd, DM_SPLITTERGLOBALEVENT, 0, 0);
M->BroadcastMessage(DM_SPLITTERGLOBALEVENT, 0, 0);
- break;
}
- default:
- dat->splitterY = dat->savedSplitY;
- dat->dynaSplitter = dat->savedDynaSplit;
- DM_RecalcPictureSize(dat);
- if (dat->bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
- si->iSplitterY = dat->savedSplitY;
- dat->splitterY =si->iSplitterY + DPISCALEY_S(22);
- }
- CSkin::UpdateToolbarBG(dat);
- SendMessage(hwndParent, WM_SIZE, 0, 0);
- DM_ScrollToBottom(dat, 0, 1);
- break;
+ break;
+
+ default:
+ dat->splitterY = dat->savedSplitY;
+ dat->dynaSplitter = dat->savedDynaSplit;
+ DM_RecalcPictureSize(dat);
+ if (dat->bType == SESSIONTYPE_CHAT) {
+ SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ si->iSplitterY = dat->savedSplitY;
+ dat->splitterY =si->iSplitterY + DPISCALEY_S(22);
+ }
+ CSkin::UpdateToolbarBG(dat);
+ SendMessage(hwndParent, WM_SIZE, 0, 0);
+ DM_ScrollToBottom(dat, 0, 1);
+ break;
}
- }
- return 0;
+ }
+ return 0;
}
}
- return CallWindowProc(OldSplitterProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
/*
@@ -1301,8 +1292,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP struct TNewWindowData *newData = (struct TNewWindowData *) lParam;
- dat = (struct TWindowData *) malloc(sizeof(struct TWindowData));
- ZeroMemory((void*) dat, sizeof(struct TWindowData));
+ dat = (TWindowData *)calloc(sizeof(TWindowData), 1);
if (newData->iTabID >= 0) {
dat->pContainer = newData->pContainer;
m_pContainer = dat->pContainer;
@@ -1357,14 +1347,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP CreateWindowEx(0, _T("TSButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
hwndDlg, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL);
dat->hwndPanelPicParent = CreateWindowEx(WS_EX_TOPMOST, _T("Static"), _T(""), SS_OWNERDRAW | WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, hwndDlg, (HMENU)6000, NULL, NULL);
- oldAvatarParentWndProc = (WNDPROC)SetWindowLongPtr(dat->hwndPanelPicParent, GWLP_WNDPROC, (INT_PTR)CInfoPanel::avatarParentSubclass);
+ mir_subclassWindow(dat->hwndPanelPicParent, CInfoPanel::avatarParentSubclass);
dat->showUIElements = m_pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
dat->sendMode |= M->GetByte(dat->hContact, "forceansi", 0) ? SMODE_FORCEANSI : 0;
dat->sendMode |= dat->hContact == 0 ? SMODE_MULTIPLE : 0;
dat->sendMode |= M->GetByte(dat->hContact, "no_ack", 0) ? SMODE_NOACK : 0;
- dat->hQueuedEvents = (HANDLE *)malloc(sizeof(HANDLE) * EVENT_QUEUE_SIZE);
+ dat->hQueuedEvents = (HANDLE*)calloc(sizeof(HANDLE), EVENT_QUEUE_SIZE);
dat->iEventQueueSize = EVENT_QUEUE_SIZE;
dat->iCurrentQueueError = -1;
@@ -1507,11 +1497,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP * subclassing stuff
*/
- OldMessageEditProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE), GWLP_WNDPROC, (LONG_PTR) MessageEditSubclassProc);
- OldAvatarWndProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CONTACTPIC), GWLP_WNDPROC, (LONG_PTR) AvatarSubclassProc);
- OldSplitterProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MULTISPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MESSAGE), MessageEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_CONTACTPIC), AvatarSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_SPLITTER), SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MULTISPLITTER), SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_PANELSPLITTER), SplitterSubclassProc);
/*
* load old messages from history (if wanted...)
@@ -1576,8 +1566,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ZeroMemory(&wndClass, sizeof(wndClass));
GetClassInfoA(g_hInst, "RichEdit20A", &wndClass);
- OldMessageLogProc = wndClass.lpfnWndProc;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWLP_WNDPROC, (LONG_PTR) MessageLogSubclassProc);
+ mir_subclassWindowFull( GetDlgItem(hwndDlg, IDC_LOG), MessageLogSubclassProc, wndClass.lpfnWndProc);
}
SetWindowPos(hwndDlg, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), newData->iActivate ? 0 : SWP_NOZORDER | SWP_NOACTIVATE);
LoadSplitter(dat);
@@ -1616,10 +1605,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->dwLastActivity = GetTickCount() - 1000;
m_pContainer->dwLastActivity = dat->dwLastActivity;
- if (dat->hwndHPP) {
- WNDPROC wndProc = (WNDPROC)SetWindowLongPtr(dat->hwndHPP, GWLP_WNDPROC, (LONG_PTR)HPPKFSubclassProc);
- dat->oldIEViewProc = wndProc;
- }
+ if (dat->hwndHPP)
+ mir_subclassWindow(dat->hwndHPP, HPPKFSubclassProc);
dat->dwFlags &= ~MWF_INITMODE;
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPEN, 0);
@@ -3352,18 +3339,19 @@ quote_from_last: case DM_UINTOCLIPBOARD:
Utils::CopyToClipBoard(const_cast<TCHAR *>(dat->cache->getUIN()), hwndDlg);
return 0;
- /*
- * broadcasted when GLOBAL info panel setting changes
- */
+
+ /*
+ * broadcasted when GLOBAL info panel setting changes
+ */
case DM_SETINFOPANEL:
CInfoPanel::setPanelHandler(dat, wParam, lParam);
return 0;
- /*
- * show the balloon tooltip control.
- * wParam == id of the "anchor" element, defaults to the panel status field (for away msg retrieval)
- * lParam == new text to show
- */
+ /*
+ * show the balloon tooltip control.
+ * wParam == id of the "anchor" element, defaults to the panel status field (for away msg retrieval)
+ * lParam == new text to show
+ */
case DM_ACTIVATETOOLTIP: {
if (IsIconic(hwndContainer) || m_pContainer->hwndActive != hwndDlg)
@@ -3677,11 +3665,8 @@ quote_from_last: if (dat->hClientIcon)
DestroyIcon(dat->hClientIcon);
- if (dat->hwndPanelPicParent) {
- if (oldAvatarParentWndProc)
- SetWindowLongPtr(dat->hwndPanelPicParent, GWLP_WNDPROC, (LONG_PTR)oldAvatarParentWndProc);
+ if (dat->hwndPanelPicParent)
DestroyWindow(dat->hwndPanelPicParent);
- }
if (dat->cache->isValid()) { // not valid means the contact was deleted
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0);
@@ -3711,15 +3696,15 @@ quote_from_last: free(dat->sendBuffer);
if (dat->hHistoryEvents)
free(dat->hHistoryEvents);
+
+ /*
+ * search the sendqueue for unfinished send jobs and free them. Leave unsent
+ * messages in the queue as they can be acked later
+ */
{
- int i;
- /*
- * search the sendqueue for unfinished send jobs and free them. Leave unsent
- * messages in the queue as they can be acked later
- */
SendJob *jobs = sendQueue->getJobByIndex(0);
- for (i=0; i < SendQueue::NR_SENDJOBS; i++) {
+ for (int i=0; i < SendQueue::NR_SENDJOBS; i++) {
if (jobs[i].hOwner == dat->hContact) {
if (jobs[i].iStatus > (unsigned)SendQueue::SQ_INPROGRESS)
sendQueue->clearJob(i);
@@ -3732,10 +3717,11 @@ quote_from_last: jobs[i].hwndOwner = 0;
}
}
- if (dat->hQueuedEvents)
- free(dat->hQueuedEvents);
}
+ if (dat->hQueuedEvents)
+ free(dat->hQueuedEvents);
+
if (dat->hSmileyIcon)
DestroyIcon(dat->hSmileyIcon);
@@ -3757,26 +3743,15 @@ quote_from_last: M->WriteDword(SRMSGMOD, "multisplit", dat->multiSplitterX);
WriteStatsOnClose(dat);
}
-
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MULTISPLITTER), GWLP_WNDPROC, (LONG_PTR) OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR) OldSplitterProc);
-
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CONTACTPIC), GWLP_WNDPROC, (LONG_PTR) OldAvatarWndProc);
-
{
- HFONT hFont;
- TCITEM item;
- int i;
-
- hFont = (HFONT) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
+ HFONT hFont = (HFONT) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
if (hFont != NULL && hFont != (HFONT) SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0))
DeleteObject(hFont);
- ZeroMemory((void*)&item, sizeof(item));
+ TCITEM item = { 0 };
item.mask = TCIF_PARAM;
- i = GetTabIndexFromHWND(hwndTab, hwndDlg);
+ int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
if (i >= 0) {
SendMessage(hwndTab, WM_USER + 100, 0, 0); // remove tooltip
TabCtrl_DeleteItem(hwndTab, i);
@@ -3784,6 +3759,7 @@ quote_from_last: dat->iTabID = -1;
}
}
+
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE, 0);
/*
@@ -3795,10 +3771,6 @@ quote_from_last: ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_DESTROY;
ieWindow.hwnd = dat->hwndIEView;
- if (dat->oldIEViewProc) {
- SetWindowLongPtr(dat->hwndIEView, GWLP_WNDPROC, (LONG_PTR)dat->oldIEViewProc);
- dat->oldIEViewProc = 0;
- }
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
if (dat->hwndHPP) {
@@ -3806,10 +3778,6 @@ quote_from_last: ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_DESTROY;
ieWindow.hwnd = dat->hwndHPP;
- if (dat->oldIEViewProc) {
- SetWindowLongPtr(dat->hwndHPP, GWLP_WNDPROC, (LONG_PTR)dat->oldIEViewProc);
- dat->oldIEViewProc = 0;
- }
CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
}
if (dat->pWnd) {
@@ -3817,6 +3785,7 @@ quote_from_last: dat->pWnd = 0;
}
break;
+
case WM_DWMCOMPOSITIONCHANGED:
BB_RefreshTheme(dat);
memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 156c4d4ba7..d5c9b5a9f4 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -681,21 +681,22 @@ static POINT ptMouseT = {0}; static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct TabControlData *tabdat = 0;
-
- tabdat = (struct TabControlData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ TabControlData *tabdat = (TabControlData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (tabdat) {
if (tabdat->pContainer == NULL)
tabdat->pContainer = (TContainerData *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
tabdat->dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
}
+ POINT pt;
+
switch (msg) {
- case WM_NCCREATE: {
+ case WM_NCCREATE:
+ {
WNDCLASSEXA wcl = {0};
-
wcl.cbSize = sizeof(wcl);
GetClassInfoExA(g_hInst, "SysTabControl32", &wcl);
+ OldTabControlClassProc = wcl.lpfnWndProc;
tabdat = (struct TabControlData *)mir_alloc(sizeof(struct TabControlData));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)tabdat);
@@ -706,116 +707,117 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara tabdat->fTipActive = FALSE;
tabdat->iHoveredCloseIcon = -1;
SendMessage(hwnd, EM_THEMECHANGED, 0, 0);
- OldTabControlClassProc = wcl.lpfnWndProc;
- return TRUE;
}
- case EM_THEMECHANGED:
- tabdat->m_xpad = M->GetByte("x-pad", 3);
- tabdat->m_VisualStyles = FALSE;
- if (PluginConfig.m_bIsXP && M->isVSAPIState()) {
- if (CMimAPI::m_pfnIsThemeActive != 0)
- if (CMimAPI::m_pfnIsThemeActive()) {
- tabdat->m_VisualStyles = TRUE;
- if (tabdat->hTheme != 0 && CMimAPI::m_pfnCloseThemeData != 0) {
- CMimAPI::m_pfnCloseThemeData(tabdat->hTheme);
- CMimAPI::m_pfnCloseThemeData(tabdat->hThemeButton);
- }
- if (CMimAPI::m_pfnOpenThemeData != 0) {
- if ((tabdat->hTheme = CMimAPI::m_pfnOpenThemeData(hwnd, L"TAB")) == 0 || (tabdat->hThemeButton = CMimAPI::m_pfnOpenThemeData(hwnd, L"BUTTON")) == 0)
- tabdat->m_VisualStyles = FALSE;
- }
+ return TRUE;
+
+ case EM_THEMECHANGED:
+ tabdat->m_xpad = M->GetByte("x-pad", 3);
+ tabdat->m_VisualStyles = FALSE;
+ if (PluginConfig.m_bIsXP && M->isVSAPIState()) {
+ if (CMimAPI::m_pfnIsThemeActive != 0)
+ if (CMimAPI::m_pfnIsThemeActive()) {
+ tabdat->m_VisualStyles = TRUE;
+ if (tabdat->hTheme != 0 && CMimAPI::m_pfnCloseThemeData != 0) {
+ CMimAPI::m_pfnCloseThemeData(tabdat->hTheme);
+ CMimAPI::m_pfnCloseThemeData(tabdat->hThemeButton);
}
- }
- return 0;
- case EM_SEARCHSCROLLER: {
+ if (CMimAPI::m_pfnOpenThemeData != 0) {
+ if ((tabdat->hTheme = CMimAPI::m_pfnOpenThemeData(hwnd, L"TAB")) == 0 || (tabdat->hThemeButton = CMimAPI::m_pfnOpenThemeData(hwnd, L"BUTTON")) == 0)
+ tabdat->m_VisualStyles = FALSE;
+ }
+ }
+ }
+ return 0;
+
+ case EM_SEARCHSCROLLER:
+ {
HWND hwndChild;
/*
- * search the updown control (scroll arrows) to subclass it...
- * the control is dynamically created and may not exist as long as it is
- * not needed. So we have to search it everytime we need to paint. However,
- * it is sufficient to search it once. So this message is called, whenever
- * a new tab is inserted
- */
+ * search the updown control (scroll arrows) to subclass it...
+ * the control is dynamically created and may not exist as long as it is
+ * not needed. So we have to search it everytime we need to paint. However,
+ * it is sufficient to search it once. So this message is called, whenever
+ * a new tab is inserted
+ */
if ((hwndChild = FindWindowEx(hwnd, 0, _T("msctls_updown32"), NULL)) != 0)
DestroyWindow(hwndChild);
- return 0;
}
- case EM_VALIDATEBOTTOM: {
+ return 0;
+
+ case EM_VALIDATEBOTTOM:
+ {
BOOL bClassicDraw = (tabdat->m_VisualStyles == FALSE);
if ((tabdat->dwStyle & TCS_BOTTOM) && !bClassicDraw && PluginConfig.tabConfig.m_bottomAdjust != 0)
InvalidateRect(hwnd, NULL, FALSE);
- break;
}
- case EM_REFRESHWITHOUTCLIP:
- if (TabCtrl_GetItemCount(hwnd) > 1)
- return 0;
- else {
- tabdat->bRefreshWithoutClip = TRUE;
- RedrawWindow(hwnd, NULL, NULL, RDW_UPDATENOW | RDW_NOCHILDREN | RDW_INVALIDATE);
- tabdat->bRefreshWithoutClip = FALSE;
- return 0;
- }
- case TCM_INSERTITEM:
- case TCM_DELETEITEM:
- tabdat->iHoveredCloseIcon = -1;
- if (!(tabdat->dwStyle & TCS_MULTILINE) || tabdat->dwStyle & TCS_BUTTONS) {
- LRESULT result;
- RECT rc;
- int iTabs = TabCtrl_GetItemCount(hwnd);
- if (iTabs >= 1 && msg == TCM_INSERTITEM) {
- TabCtrl_GetItemRect(hwnd, 0, &rc);
- TabCtrl_SetItemSize(hwnd, 10, rc.bottom - rc.top);
- }
- result = CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
+ break;
+
+ case EM_REFRESHWITHOUTCLIP:
+ if (TabCtrl_GetItemCount(hwnd) > 1)
+ return 0;
+
+ tabdat->bRefreshWithoutClip = TRUE;
+ RedrawWindow(hwnd, NULL, NULL, RDW_UPDATENOW | RDW_NOCHILDREN | RDW_INVALIDATE);
+ tabdat->bRefreshWithoutClip = FALSE;
+ return 0;
+
+ case TCM_INSERTITEM:
+ case TCM_DELETEITEM:
+ tabdat->iHoveredCloseIcon = -1;
+ if (!(tabdat->dwStyle & TCS_MULTILINE) || tabdat->dwStyle & TCS_BUTTONS) {
+ LRESULT result;
+ RECT rc;
+ int iTabs = TabCtrl_GetItemCount(hwnd);
+ if (iTabs >= 1 && msg == TCM_INSERTITEM) {
TabCtrl_GetItemRect(hwnd, 0, &rc);
- SendMessage(hwnd, WM_SIZE, 0, 0);
- return result;
+ TabCtrl_SetItemSize(hwnd, 10, rc.bottom - rc.top);
}
- break;
- case WM_DESTROY:
- if (tabdat) {
- if (tabdat->hTheme != 0 && CMimAPI::m_pfnCloseThemeData != 0) {
- CMimAPI::m_pfnCloseThemeData(tabdat->hTheme);
- CMimAPI::m_pfnCloseThemeData(tabdat->hThemeButton);
- }
- }
- break;
- case WM_NCDESTROY:
- if (tabdat) {
- mir_free(tabdat);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0L);
- }
- break;
- case WM_MBUTTONDOWN: {
- POINT pt;
- GetCursorPos(&pt);
- SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
- return 1;
+ result = CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
+ TabCtrl_GetItemRect(hwnd, 0, &rc);
+ SendMessage(hwnd, WM_SIZE, 0, 0);
+ return result;
}
- case WM_SETCURSOR: {
- POINT pt;
+ break;
- GetCursorPos(&pt);
- SendMessage(GetParent(hwnd), msg, wParam, lParam);
- if (abs(pt.x - ptMouseT.x) < 4 && abs(pt.y - ptMouseT.y) < 4)
- return 1;
- ptMouseT = pt;
- if (tabdat->fTipActive) {
- KillTimer(hwnd, TIMERID_HOVER_T);
- CallService("mToolTip/HideTip", 0, 0);
- tabdat->fTipActive = FALSE;
+ case WM_DESTROY:
+ if (tabdat) {
+ if (tabdat->hTheme != 0 && CMimAPI::m_pfnCloseThemeData != 0) {
+ CMimAPI::m_pfnCloseThemeData(tabdat->hTheme);
+ CMimAPI::m_pfnCloseThemeData(tabdat->hThemeButton);
}
+ }
+ break;
+ case WM_NCDESTROY:
+ if (tabdat) {
+ mir_free(tabdat);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, 0L);
+ }
+ break;
+ case WM_MBUTTONDOWN:
+ GetCursorPos(&pt);
+ SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
+ return 1;
+
+ case WM_SETCURSOR:
+ GetCursorPos(&pt);
+ SendMessage(GetParent(hwnd), msg, wParam, lParam);
+ if (abs(pt.x - ptMouseT.x) < 4 && abs(pt.y - ptMouseT.y) < 4)
+ return 1;
+ ptMouseT = pt;
+ if (tabdat->fTipActive) {
KillTimer(hwnd, TIMERID_HOVER_T);
- if (tabdat->pContainer && (!tabdat->pContainer->SideBar->isActive() && (TabCtrl_GetItemCount(hwnd) > 1 || !(tabdat->pContainer->dwFlags & CNT_HIDETABS))))
- SetTimer(hwnd, TIMERID_HOVER_T, 750, 0);
- break;
+ CallService("mToolTip/HideTip", 0, 0);
+ tabdat->fTipActive = FALSE;
}
- case WM_SIZE: {
- int iTabs = TabCtrl_GetItemCount(hwnd);
+ KillTimer(hwnd, TIMERID_HOVER_T);
+ if (tabdat->pContainer && (!tabdat->pContainer->SideBar->isActive() && (TabCtrl_GetItemCount(hwnd) > 1 || !(tabdat->pContainer->dwFlags & CNT_HIDETABS))))
+ SetTimer(hwnd, TIMERID_HOVER_T, 750, 0);
+ break;
- if (!tabdat->pContainer)
- break;
+ case WM_SIZE:
+ if (tabdat->pContainer) {
+ int iTabs = TabCtrl_GetItemCount(hwnd);
if (!(tabdat->dwStyle & TCS_MULTILINE)) {
RECT rcClient, rc;
@@ -825,11 +827,11 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara TabCtrl_GetItemRect(hwnd, iTabs - 1, &rc);
newItemSize = (rcClient.right - 6) - (tabdat->dwStyle & TCS_BUTTONS ? (iTabs) * 10 : 0);
newItemSize = newItemSize / iTabs;
- if (newItemSize < PluginConfig.tabConfig.m_fixedwidth) {
+ if (newItemSize < PluginConfig.tabConfig.m_fixedwidth)
TabCtrl_SetItemSize(hwnd, newItemSize, rc.bottom - rc.top);
- } else {
+ else
TabCtrl_SetItemSize(hwnd, PluginConfig.tabConfig.m_fixedwidth, rc.bottom - rc.top);
- }
+
SendMessage(hwnd, EM_SEARCHSCROLLER, 0, 0);
}
} else if (tabdat->dwStyle & TCS_BUTTONS && iTabs > 0) {
@@ -843,174 +845,171 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara else
TabCtrl_SetItemSize(hwnd, PluginConfig.tabConfig.m_fixedwidth, rcItem.bottom - rcItem.top);
}
- break;
}
- case WM_LBUTTONDBLCLK: {
- POINT pt;
- GetCursorPos(&pt);
- SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
- break;
- }
- case WM_RBUTTONDOWN:
- KillTimer(hwnd, TIMERID_HOVER_T);
- CallService("mToolTip/HideTip", 0, 0);
- tabdat->fTipActive = FALSE;
- break;
+ break;
- case WM_LBUTTONDOWN: {
- TCHITTESTINFO tci = {0};
+ case WM_LBUTTONDBLCLK:
+ GetCursorPos(&pt);
+ SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
+ break;
- KillTimer(hwnd, TIMERID_HOVER_T);
- CallService("mToolTip/HideTip", 0, 0);
- tabdat->fTipActive = FALSE;
+ case WM_RBUTTONDOWN:
+ KillTimer(hwnd, TIMERID_HOVER_T);
+ CallService("mToolTip/HideTip", 0, 0);
+ tabdat->fTipActive = FALSE;
+ break;
- if (GetKeyState(VK_CONTROL) & 0x8000) {
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
- int i;
- tci.flags = TCHT_ONITEM;
-
- ScreenToClient(hwnd, &tci.pt);
- i = TabCtrl_HitTest(hwnd, &tci);
- if (i != -1) {
- TCITEM tc;
- struct TWindowData *dat = NULL;
-
- tc.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwnd, i, &tc);
- dat = (struct TWindowData *)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
- if (dat) {
- tabdat->bDragging = TRUE;
- tabdat->iBeginIndex = i;
- tabdat->hwndDrag = (HWND)tc.lParam;
- tabdat->dragDat = dat;
- tabdat->fSavePos = TRUE;
- tabdat->himlDrag = ImageList_Create(16, 16, ILC_MASK | (PluginConfig.m_bIsXP ? ILC_COLOR32 : ILC_COLOR16), 1, 0);
- ImageList_AddIcon(tabdat->himlDrag, dat->hTabIcon);
- ImageList_BeginDrag(tabdat->himlDrag, 0, 8, 8);
- ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
- SetCapture(hwnd);
- }
- return TRUE;
+ case WM_LBUTTONDOWN:
+ KillTimer(hwnd, TIMERID_HOVER_T);
+ CallService("mToolTip/HideTip", 0, 0);
+ tabdat->fTipActive = FALSE;
+
+ if (GetKeyState(VK_CONTROL) & 0x8000) {
+ TCHITTESTINFO tci = {0};
+ tci.pt.x = (short)LOWORD(GetMessagePos());
+ tci.pt.y = (short)HIWORD(GetMessagePos());
+ if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
+ int i;
+ tci.flags = TCHT_ONITEM;
+
+ ScreenToClient(hwnd, &tci.pt);
+ i = TabCtrl_HitTest(hwnd, &tci);
+ if (i != -1) {
+ TCITEM tc;
+ struct TWindowData *dat = NULL;
+
+ tc.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwnd, i, &tc);
+ dat = (struct TWindowData *)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
+ if (dat) {
+ tabdat->bDragging = TRUE;
+ tabdat->iBeginIndex = i;
+ tabdat->hwndDrag = (HWND)tc.lParam;
+ tabdat->dragDat = dat;
+ tabdat->fSavePos = TRUE;
+ tabdat->himlDrag = ImageList_Create(16, 16, ILC_MASK | (PluginConfig.m_bIsXP ? ILC_COLOR32 : ILC_COLOR16), 1, 0);
+ ImageList_AddIcon(tabdat->himlDrag, dat->hTabIcon);
+ ImageList_BeginDrag(tabdat->himlDrag, 0, 8, 8);
+ ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
+ SetCapture(hwnd);
}
+ return TRUE;
}
}
+ }
- if (GetKeyState(VK_MENU) & 0x8000) {
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
- int i;
- tci.flags = TCHT_ONITEM;
-
- ScreenToClient(hwnd, &tci.pt);
- i = TabCtrl_HitTest(hwnd, &tci);
- if (i != -1) {
- TCITEM tc;
- TWindowData *dat = NULL;
-
- tc.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwnd, i, &tc);
- dat = (TWindowData *)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
- if (dat) {
- tabdat->bDragging = TRUE;
- tabdat->iBeginIndex = i;
- tabdat->hwndDrag = (HWND)tc.lParam;
- tabdat->dragDat = dat;
- tabdat->himlDrag = ImageList_Create(16, 16, ILC_MASK | (PluginConfig.m_bIsXP ? ILC_COLOR32 : ILC_COLOR16), 1, 0);
- tabdat->fSavePos = FALSE;
- ImageList_AddIcon(tabdat->himlDrag, dat->hTabIcon);
- ImageList_BeginDrag(tabdat->himlDrag, 0, 8, 8);
- ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
- SetCapture(hwnd);
- }
- return TRUE;
+ if (GetKeyState(VK_MENU) & 0x8000) {
+ TCHITTESTINFO tci = {0};
+ tci.pt.x = (short)LOWORD(GetMessagePos());
+ tci.pt.y = (short)HIWORD(GetMessagePos());
+ if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
+ int i;
+ tci.flags = TCHT_ONITEM;
+
+ ScreenToClient(hwnd, &tci.pt);
+ i = TabCtrl_HitTest(hwnd, &tci);
+ if (i != -1) {
+ TCITEM tc;
+ TWindowData *dat = NULL;
+
+ tc.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwnd, i, &tc);
+ dat = (TWindowData *)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
+ if (dat) {
+ tabdat->bDragging = TRUE;
+ tabdat->iBeginIndex = i;
+ tabdat->hwndDrag = (HWND)tc.lParam;
+ tabdat->dragDat = dat;
+ tabdat->himlDrag = ImageList_Create(16, 16, ILC_MASK | (PluginConfig.m_bIsXP ? ILC_COLOR32 : ILC_COLOR16), 1, 0);
+ tabdat->fSavePos = FALSE;
+ ImageList_AddIcon(tabdat->himlDrag, dat->hTabIcon);
+ ImageList_BeginDrag(tabdat->himlDrag, 0, 8, 8);
+ ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
+ SetCapture(hwnd);
}
+ return TRUE;
}
}
- if (tabdat->fCloseButton) {
- POINT pt;
- GetCursorPos(&pt);
+ }
+
+ if (tabdat->fCloseButton) {
+ GetCursorPos(&pt);
+ if (TabCtrl_TestForCloseButton(tabdat, hwnd, pt) != -1)
+ return(TRUE);
+ }
+ break;
- if (TabCtrl_TestForCloseButton(tabdat, hwnd, pt) != -1)
- return(TRUE);
- }
+ case WM_CAPTURECHANGED:
+ tabdat->bDragging = FALSE;
+ ImageList_DragLeave(hwnd);
+ ImageList_EndDrag();
+ if (tabdat->himlDrag) {
+ ImageList_RemoveAll(tabdat->himlDrag);
+ ImageList_Destroy(tabdat->himlDrag);
+ tabdat->himlDrag = 0;
}
break;
- case WM_CAPTURECHANGED: {
+ case WM_MOUSEMOVE:
+ if (tabdat->bDragging) {
+ TCHITTESTINFO tci = {0};
+ tci.pt.x = (short)LOWORD(GetMessagePos());
+ tci.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(hwnd, &tci.pt);
+ ImageList_DragMove(tci.pt.x, tci.pt.y);
+ }
+ if (tabdat->fCloseButton) {
+ POINT pt;
+
+ GetCursorPos(&pt);
+ int iOldHovered = tabdat->iHoveredCloseIcon;
+ tabdat->iHoveredCloseIcon = TabCtrl_TestForCloseButton(tabdat, hwnd, pt);
+ if (tabdat->iHoveredCloseIcon != iOldHovered)
+ InvalidateRect(hwnd, NULL, FALSE);
+ }
+ break;
+
+ case WM_LBUTTONUP:
+ CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
+ if (tabdat->bDragging && ReleaseCapture()) {
+ TCHITTESTINFO tci = {0};
+ int i;
+ tci.pt.x = (short)LOWORD(GetMessagePos());
+ tci.pt.y = (short)HIWORD(GetMessagePos());
+ tci.flags = TCHT_ONITEM;
tabdat->bDragging = FALSE;
ImageList_DragLeave(hwnd);
ImageList_EndDrag();
+
+ ScreenToClient(hwnd, &tci.pt);
+ i = TabCtrl_HitTest(hwnd, &tci);
+ if (i != -1 && i != tabdat->iBeginIndex)
+ RearrangeTab(tabdat->hwndDrag, tabdat->dragDat, MAKELONG(i, 0xffff), tabdat->fSavePos);
+ tabdat->hwndDrag = (HWND) - 1;
+ tabdat->dragDat = NULL;
if (tabdat->himlDrag) {
ImageList_RemoveAll(tabdat->himlDrag);
ImageList_Destroy(tabdat->himlDrag);
tabdat->himlDrag = 0;
}
}
- break;
-
- case WM_MOUSEMOVE: {
- if (tabdat->bDragging) {
- TCHITTESTINFO tci = {0};
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(hwnd, &tci.pt);
- ImageList_DragMove(tci.pt.x, tci.pt.y);
- }
- if (tabdat->fCloseButton) {
- POINT pt;
+ if (tabdat->fCloseButton) {
+ POINT pt;
- GetCursorPos(&pt);
- int iOldHovered = tabdat->iHoveredCloseIcon;
- tabdat->iHoveredCloseIcon = TabCtrl_TestForCloseButton(tabdat, hwnd, pt);
- if (tabdat->iHoveredCloseIcon != iOldHovered)
- InvalidateRect(hwnd, NULL, FALSE);
- }
+ GetCursorPos(&pt);
+ int iItem = TabCtrl_TestForCloseButton(tabdat, hwnd, pt);
+ if (iItem != -1)
+ SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
}
break;
- case WM_LBUTTONUP: {
- CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
- if (tabdat->bDragging && ReleaseCapture()) {
- TCHITTESTINFO tci = {0};
- int i;
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- tci.flags = TCHT_ONITEM;
- tabdat->bDragging = FALSE;
- ImageList_DragLeave(hwnd);
- ImageList_EndDrag();
-
- ScreenToClient(hwnd, &tci.pt);
- i = TabCtrl_HitTest(hwnd, &tci);
- if (i != -1 && i != tabdat->iBeginIndex)
- RearrangeTab(tabdat->hwndDrag, tabdat->dragDat, MAKELONG(i, 0xffff), tabdat->fSavePos);
- tabdat->hwndDrag = (HWND) - 1;
- tabdat->dragDat = NULL;
- if (tabdat->himlDrag) {
- ImageList_RemoveAll(tabdat->himlDrag);
- ImageList_Destroy(tabdat->himlDrag);
- tabdat->himlDrag = 0;
- }
- }
- if (tabdat->fCloseButton) {
- POINT pt;
-
- GetCursorPos(&pt);
- int iItem = TabCtrl_TestForCloseButton(tabdat, hwnd, pt);
- if (iItem != -1)
- SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
- }
- }
- break;
+ case WM_ERASEBKGND:
+ if (tabdat->pContainer && (CSkin::m_skinEnabled || M->isAero()))
+ return TRUE;
+ return 0;
- case WM_ERASEBKGND:
- if (tabdat->pContainer && (CSkin::m_skinEnabled || M->isAero()))
- return TRUE;
- return 0;
- case WM_PAINT: {
+ case WM_PAINT:
+ {
PAINTSTRUCT ps;
HDC hdcreal, hdc;
RECT rectTemp, rctPage, rctActive, rcItem, rctClip, rctOrig;
@@ -1056,10 +1055,10 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara hdcreal = BeginPaint(hwnd, &ps);
/*
- * switchbar is active, don't paint a single pixel, the tab control won't be visible at all
- * same when we have only ONE tab and do not want it to be visible because of the container
- * option "Show tab bar only when needed".
- */
+ * switchbar is active, don't paint a single pixel, the tab control won't be visible at all
+ * same when we have only ONE tab and do not want it to be visible because of the container
+ * option "Show tab bar only when needed".
+ */
if ((tabdat->pContainer->dwFlags & CNT_SIDEBAR) || (nCount == 1 && tabdat->pContainer->dwFlags & CNT_HIDETABS)) {
if (nCount == 0)
@@ -1076,8 +1075,8 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara cy = rctPage.bottom - rctPage.top;
/*
- * draw everything to a memory dc to avoid flickering
- */
+ * draw everything to a memory dc to avoid flickering
+ */
if (CMimAPI::m_haveBufferedPaint)
hpb = tabdat->hbp = CSkin::InitiateBufferedPaint(hdcreal, rctPage, hdc);
@@ -1124,8 +1123,8 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara hPenOld = (HPEN)SelectObject(hdc, PluginConfig.tabConfig.m_hPenLight);
/*
- * visual style support
- */
+ * visual style support
+ */
CopyRect(&rcTabPage, &rctPage);
if (!tabdat->bRefreshWithoutClip)
@@ -1152,7 +1151,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara if (!item->IGNORED) {
DrawAlpha(hdc, &rctPage, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT,
- item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
+ item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
goto page_done;
}
}
@@ -1233,9 +1232,9 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara }
page_done:
/*
- * if aero is active _and_ the infopanel is visible in the current window, we "flatten" out the top area
- * of the tab page by overpainting it black (thus it will appear transparent)
- */
+ * if aero is active _and_ the infopanel is visible in the current window, we "flatten" out the top area
+ * of the tab page by overpainting it black (thus it will appear transparent)
+ */
if (isAero && tabdat->helperDat) {
RECT rcLog, rcPage;
POINT pt;
@@ -1260,8 +1259,8 @@ page_done: uiFlags = 0;
/*
- * figure out hottracked item (if any)
- */
+ * figure out hottracked item (if any)
+ */
if (tabdat->bRefreshWithoutClip)
goto skip_tabs;
@@ -1298,8 +1297,8 @@ page_done: }
}
/*
- * draw the active item
- */
+ * draw the active item
+ */
if (!bClassicDraw && uiBottom) {
rctActive.top -= PluginConfig.tabConfig.m_bottomAdjust;
rctActive.bottom -= PluginConfig.tabConfig.m_bottomAdjust;
@@ -1342,15 +1341,15 @@ skip_tabs: SelectObject(hdc, hPenOld);
/*
- * finally, bitblt the contents of the memory dc to the real dc
- */
+ * finally, bitblt the contents of the memory dc to the real dc
+ */
//if (!tabdat->pContainer->bSkinned)
if (!tabdat->bRefreshWithoutClip)
ExcludeClipRect(hdcreal, rctClip.left, rctClip.top, rctClip.right, rctClip.bottom);
if (hpb)
CSkin::FinalizeBufferedPaint(hpb, &rctOrig);
- //CMimAPI::m_pfnEndBufferedPaint(hpb, TRUE);
+ //CMimAPI::m_pfnEndBufferedPaint(hpb, TRUE);
else {
BitBlt(hdcreal, 0, 0, cx, cy, hdc, 0, 0, SRCCOPY);
SelectObject(hdc, bmpOld);
@@ -1358,47 +1357,49 @@ skip_tabs: DeleteDC(hdc);
}
EndPaint(hwnd, &ps);
- return 0;
}
- case WM_TIMER: {
- if (wParam == TIMERID_HOVER_T && M->GetByte("d_tooltips", 0)) {
- POINT pt;
- CLCINFOTIP ti = {0};
- ti.cbSize = sizeof(ti);
-
- KillTimer(hwnd, TIMERID_HOVER_T);
- GetCursorPos(&pt);
- if (abs(pt.x - ptMouseT.x) < 5 && abs(pt.y - ptMouseT.y) < 5) {
- TCITEM item = {0};
- int nItem = 0;
- struct TWindowData *dat = 0;
-
- ti.ptCursor = pt;
- //ScreenToClient(hwnd, &pt);
-
- item.mask = TCIF_PARAM;
- nItem = GetTabItemFromMouse(hwnd, &pt);
- if (nItem >= 0 && nItem < TabCtrl_GetItemCount(hwnd)) {
- TabCtrl_GetItem(hwnd, nItem, &item);
- /*
- * get the message window data for the session to which this tab item belongs
- */
-
- if (IsWindow((HWND)item.lParam) && item.lParam != 0)
- dat = (struct TWindowData *)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
- if (dat) {
- tabdat->fTipActive = TRUE;
- ti.isGroup = 0;
- ti.hItem = dat->hContact;
- ti.isTreeFocused = 0;
- CallService("mToolTip/ShowTip", 0, (LPARAM)&ti);
- }
+ return 0;
+
+ case WM_TIMER:
+ if (wParam == TIMERID_HOVER_T && M->GetByte("d_tooltips", 0)) {
+ POINT pt;
+ CLCINFOTIP ti = {0};
+ ti.cbSize = sizeof(ti);
+
+ KillTimer(hwnd, TIMERID_HOVER_T);
+ GetCursorPos(&pt);
+ if (abs(pt.x - ptMouseT.x) < 5 && abs(pt.y - ptMouseT.y) < 5) {
+ TCITEM item = {0};
+ int nItem = 0;
+ struct TWindowData *dat = 0;
+
+ ti.ptCursor = pt;
+ //ScreenToClient(hwnd, &pt);
+
+ item.mask = TCIF_PARAM;
+ nItem = GetTabItemFromMouse(hwnd, &pt);
+ if (nItem >= 0 && nItem < TabCtrl_GetItemCount(hwnd)) {
+ TabCtrl_GetItem(hwnd, nItem, &item);
+ /*
+ * get the message window data for the session to which this tab item belongs
+ */
+
+ if (IsWindow((HWND)item.lParam) && item.lParam != 0)
+ dat = (struct TWindowData *)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ if (dat) {
+ tabdat->fTipActive = TRUE;
+ ti.isGroup = 0;
+ ti.hItem = dat->hContact;
+ ti.isTreeFocused = 0;
+ CallService("mToolTip/ShowTip", 0, (LPARAM)&ti);
}
}
}
- break;
}
- case WM_MOUSEWHEEL: {
+ break;
+
+ case WM_MOUSEWHEEL:
+ {
short amount = (short)(HIWORD(wParam));
if (lParam != -1)
break;
@@ -1407,21 +1408,21 @@ skip_tabs: else if (amount < 0)
SendMessage(GetParent(hwnd), DM_SELECTTAB, DM_SELECT_NEXT, 0);
InvalidateRect(hwnd, NULL, FALSE);
- break;
}
- case WM_USER + 100: {
- if (tabdat->fTipActive) {
- tabdat->fTipActive = FALSE;
- CallService("mToolTip/HideTip", 0, 0);
- }
+ break;
+
+ case WM_USER + 100:
+ if (tabdat->fTipActive) {
+ tabdat->fTipActive = FALSE;
+ CallService("mToolTip/HideTip", 0, 0);
}
}
return CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
}
/*
- * load the tab control configuration data (colors, fonts, flags...
- */
+* load the tab control configuration data (colors, fonts, flags...
+*/
void TSAPI ReloadTabConfig()
{
@@ -1475,116 +1476,113 @@ void TSAPI FreeTabConfig() }
/*
- * options dialog for setting up tab options
- */
+* options dialog for setting up tab options
+*/
static bool tconfig_init = false;
INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG: {
- tconfig_init = false;
- TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_USER + 100, 0, 0);
- tconfig_init = true;
- return TRUE;
- }
- case WM_USER + 100: {
- DWORD dwFlags = M->GetDword("tabconfig", TCF_DEFAULT);
- int i = 0;
-
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPIN, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder" : "tborder", 2));
- SetDlgItemInt(hwndDlg, IDC_TABBORDER, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder" : "tborder", 2), FALSE);;
-
- SendDlgItemMessage(hwndDlg, IDC_BOTTOMTABADJUSTSPIN, UDM_SETRANGE, 0, MAKELONG(3, -3));
- SendDlgItemMessage(hwndDlg, IDC_BOTTOMTABADJUSTSPIN, UDM_SETPOS, 0, PluginConfig.tabConfig.m_bottomAdjust);
- SetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, PluginConfig.tabConfig.m_bottomAdjust, TRUE);
-
- SendDlgItemMessage(hwndDlg, IDC_TABWIDTHSPIN, UDM_SETRANGE, 0, MAKELONG(400, 50));
- SendDlgItemMessage(hwndDlg, IDC_TABWIDTHSPIN, UDM_SETPOS, 0, PluginConfig.tabConfig.m_fixedwidth);
- SetDlgItemInt(hwndDlg, IDC_TABWIDTH, PluginConfig.tabConfig.m_fixedwidth, TRUE);
-
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTER, UDM_SETRANGE, 0, MAKELONG(50, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERRIGHT, UDM_SETRANGE, 0, MAKELONG(50, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERTOP, UDM_SETRANGE, 0, MAKELONG(40, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERBOTTOM, UDM_SETRANGE, 0, MAKELONG(40, 0));
-
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTER, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", 2));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERRIGHT, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", 2));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERTOP, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", 2));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERBOTTOM, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", 2));
-
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 1));
- SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETRANGE, 0, MAKELONG(10, 1));
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, (LPARAM)M->GetByte("y-pad", 3));
- SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETPOS, 0, (LPARAM)M->GetByte("x-pad", 4));
- SetDlgItemInt(hwndDlg, IDC_TABPADDING, (int)M->GetByte("y-pad", 3), FALSE);;
- SetDlgItemInt(hwndDlg, IDC_HTABPADDING, (int)M->GetByte("x-pad", 4), FALSE);;
- return 0;
- }
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY: {
- int i = 0;
- BOOL translated;
- int fixedWidth;
-
- struct TContainerData *pContainer = pFirstContainer;
-
- M->WriteByte(SRMSGMOD_T, "y-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE)));
- M->WriteByte(SRMSGMOD_T, "x-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE)));
- M->WriteByte(SRMSGMOD_T, "tborder", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDER, &translated, FALSE));
- M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTER, &translated, FALSE));
- M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERRIGHT, &translated, FALSE));
- M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERTOP, &translated, FALSE));
- M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERBOTTOM, &translated, FALSE));
- M->WriteDword(SRMSGMOD_T, "bottomadjust", GetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, &translated, TRUE));
-
- fixedWidth = GetDlgItemInt(hwndDlg, IDC_TABWIDTH, &translated, FALSE);
- fixedWidth = (fixedWidth < 60 ? 60 : fixedWidth);
- M->WriteDword(SRMSGMOD_T, "fixedwidth", fixedWidth);
- FreeTabConfig();
- ReloadTabConfig();
- while (pContainer) {
- TabCtrl_SetPadding(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE), GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE));
- RedrawWindow(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
- pContainer = pContainer->pNextContainer;
- }
- return TRUE;
- }
+ case WM_INITDIALOG:
+ tconfig_init = false;
+ TranslateDialogDefault(hwndDlg);
+ SendMessage(hwndDlg, WM_USER + 100, 0, 0);
+ tconfig_init = true;
+ return TRUE;
+
+ case WM_USER + 100:
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPIN, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder" : "tborder", 2));
+ SetDlgItemInt(hwndDlg, IDC_TABBORDER, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder" : "tborder", 2), FALSE);;
+
+ SendDlgItemMessage(hwndDlg, IDC_BOTTOMTABADJUSTSPIN, UDM_SETRANGE, 0, MAKELONG(3, -3));
+ SendDlgItemMessage(hwndDlg, IDC_BOTTOMTABADJUSTSPIN, UDM_SETPOS, 0, PluginConfig.tabConfig.m_bottomAdjust);
+ SetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, PluginConfig.tabConfig.m_bottomAdjust, TRUE);
+
+ SendDlgItemMessage(hwndDlg, IDC_TABWIDTHSPIN, UDM_SETRANGE, 0, MAKELONG(400, 50));
+ SendDlgItemMessage(hwndDlg, IDC_TABWIDTHSPIN, UDM_SETPOS, 0, PluginConfig.tabConfig.m_fixedwidth);
+ SetDlgItemInt(hwndDlg, IDC_TABWIDTH, PluginConfig.tabConfig.m_fixedwidth, TRUE);
+
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTER, UDM_SETRANGE, 0, MAKELONG(50, 0));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERRIGHT, UDM_SETRANGE, 0, MAKELONG(50, 0));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERTOP, UDM_SETRANGE, 0, MAKELONG(40, 0));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERBOTTOM, UDM_SETRANGE, 0, MAKELONG(40, 0));
+
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTER, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", 2));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERRIGHT, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", 2));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERTOP, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", 2));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERBOTTOM, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", 2));
+
+ SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 1));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETRANGE, 0, MAKELONG(10, 1));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, (LPARAM)M->GetByte("y-pad", 3));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETPOS, 0, (LPARAM)M->GetByte("x-pad", 4));
+ SetDlgItemInt(hwndDlg, IDC_TABPADDING, (int)M->GetByte("y-pad", 3), FALSE);;
+ SetDlgItemInt(hwndDlg, IDC_HTABPADDING, (int)M->GetByte("x-pad", 4), FALSE);;
+ return 0;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR) lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ {
+ BOOL translated;
+ int fixedWidth;
+
+ struct TContainerData *pContainer = pFirstContainer;
+
+ M->WriteByte(SRMSGMOD_T, "y-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE)));
+ M->WriteByte(SRMSGMOD_T, "x-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE)));
+ M->WriteByte(SRMSGMOD_T, "tborder", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDER, &translated, FALSE));
+ M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTER, &translated, FALSE));
+ M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERRIGHT, &translated, FALSE));
+ M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERTOP, &translated, FALSE));
+ M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERBOTTOM, &translated, FALSE));
+ M->WriteDword(SRMSGMOD_T, "bottomadjust", GetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, &translated, TRUE));
+
+ fixedWidth = GetDlgItemInt(hwndDlg, IDC_TABWIDTH, &translated, FALSE);
+ fixedWidth = (fixedWidth < 60 ? 60 : fixedWidth);
+ M->WriteDword(SRMSGMOD_T, "fixedwidth", fixedWidth);
+ FreeTabConfig();
+ ReloadTabConfig();
+ while (pContainer) {
+ TabCtrl_SetPadding(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE), GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE));
+ RedrawWindow(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
+ pContainer = pContainer->pNextContainer;
}
- break;
+ return TRUE;
+ }
}
break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_TABWIDTH:
- case IDC_TABPADDING:
- case IDC_HTABPADDING:
- case IDC_TABBORDER:
- case IDC_TABBORDEROUTER:
- case IDC_TABBORDEROUTERBOTTOM:
- case IDC_TABBORDEROUTERRIGHT:
- case IDC_TABBORDEROUTERTOP:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return TRUE;
- break;
-
- default:
- break;
+ }
+ break;
- }
- if (tconfig_init)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_TABWIDTH:
+ case IDC_TABPADDING:
+ case IDC_HTABPADDING:
+ case IDC_TABBORDER:
+ case IDC_TABBORDEROUTER:
+ case IDC_TABBORDEROUTERBOTTOM:
+ case IDC_TABBORDEROUTERRIGHT:
+ case IDC_TABBORDEROUTERTOP:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ return TRUE;
+ break;
+
+ default:
break;
- case WM_DESTROY:
- tconfig_init = false;
+ }
+ if (tconfig_init)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_DESTROY:
+ tconfig_init = false;
}
return FALSE;
}
-
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 24880019a5..e98e222075 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -136,13 +136,13 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
switch (msg) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ {
TemplateEditorNew *teNew = (TemplateEditorNew *)lParam;
COLORREF url_visited = RGB(128, 0, 128);
COLORREF url_unvisited = RGB(0, 0, 255);
- dat = (struct TWindowData *) malloc(sizeof(struct TWindowData));
-
- TranslateDialogDefault(hwndDlg);
+ dat = (TWindowData*)calloc( sizeof(TWindowData), 1);
ZeroMemory((void*) dat, sizeof(struct TWindowData));
dat->pContainer = (struct TContainerData *)malloc(sizeof(struct TContainerData));
@@ -197,120 +197,128 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_COLOR4, CPM_SETCOLOUR, 0, M->GetDword("cc4", SRMSGDEFSET_BKGCOLOUR));
SendDlgItemMessage(hwndDlg, IDC_COLOR5, CPM_SETCOLOUR, 0, M->GetDword("cc5", SRMSGDEFSET_BKGCOLOUR));
SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
- return(TRUE);
}
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
+ break;
+
+ case IDC_RESETALLTEMPLATES:
+ if (MessageBox(0, TranslateT("This will reset the template set to the default built-in templates. Are you sure you want to do this?"),
+ TranslateT("Template Set Editor"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ M->WriteByte(teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, "setup", 0);
+ LoadDefaultTemplates();
+ MessageBox(0, TranslateT("Template set was successfully reset, please close and reopen all message windows. This template editor window will now close."),
+ TranslateT("Template Set Editor"), MB_OK);
DestroyWindow(hwndDlg);
- break;
- case IDC_RESETALLTEMPLATES:
- if (MessageBox(0, TranslateT("This will reset the template set to the default built-in templates. Are you sure you want to do this?"),
- TranslateT("Template Set Editor"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- M->WriteByte(teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, "setup", 0);
- LoadDefaultTemplates();
- MessageBox(0, TranslateT("Template set was successfully reset, please close and reopen all message windows. This template editor window will now close."),
- TranslateT("Template Set Editor"), MB_OK);
- DestroyWindow(hwndDlg);
- }
- break;
- case IDC_TEMPLATELIST:
- switch (HIWORD(wParam)) {
- case LBN_DBLCLK: {
- LRESULT iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
- if (iIndex != LB_ERR) {
- SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[iIndex]);
- teInfo->inEdit = iIndex;
- teInfo->changed = FALSE;
- teInfo->selchanging = FALSE;
- SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
- SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, FALSE, 0);
- }
- break;
- }
- case LBN_SELCHANGE: {
- LRESULT iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
- teInfo->selchanging = TRUE;
- if (iIndex != LB_ERR) {
- SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[iIndex]);
- teInfo->inEdit = iIndex;
- teInfo->changed = FALSE;
- }
- SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
- break;
- }
- }
- break;
- case IDC_VARIABLESHELP:
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/Templates");
- break;
- case IDC_EDITTEMPLATE:
- if (HIWORD(wParam) == EN_CHANGE) {
- if (!teInfo->selchanging) {
- teInfo->changed = TRUE;
- teInfo->updateInfo[teInfo->inEdit] = TRUE;
- Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_FORGET, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_REVERT, TRUE);
- }
- InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
- }
- break;
- case IDC_SAVETEMPLATE: {
- TCHAR newTemplate[TEMPLATE_LENGTH + 2];
-
- GetWindowText(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), newTemplate, TEMPLATE_LENGTH);
- CopyMemory(tSet->szTemplates[teInfo->inEdit], newTemplate, sizeof(TCHAR) * TEMPLATE_LENGTH);
- teInfo->changed = FALSE;
- teInfo->updateInfo[teInfo->inEdit] = FALSE;
- Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
- M->WriteTString(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit], newTemplate);
- SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
- break;
- }
- case IDC_FORGET: {
+ }
+ break;
+
+ case IDC_TEMPLATELIST:
+ switch (HIWORD(wParam)) {
+ LRESULT iIndex;
+ case LBN_DBLCLK:
+ iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
+ if (iIndex != LB_ERR) {
+ SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[iIndex]);
+ teInfo->inEdit = iIndex;
teInfo->changed = FALSE;
- teInfo->updateInfo[teInfo->inEdit] = FALSE;
- teInfo->selchanging = TRUE;
- SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit]);
- SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
- InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
teInfo->selchanging = FALSE;
- SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
- break;
+ SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
+ SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, FALSE, 0);
}
- case IDC_REVERT: {
+ break;
+
+ case LBN_SELCHANGE:
+ iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
+ teInfo->selchanging = TRUE;
+ if (iIndex != LB_ERR) {
+ SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[iIndex]);
+ teInfo->inEdit = iIndex;
teInfo->changed = FALSE;
- teInfo->updateInfo[teInfo->inEdit] = FALSE;
- teInfo->selchanging = TRUE;
- CopyMemory(tSet->szTemplates[teInfo->inEdit], LTR_Default.szTemplates[teInfo->inEdit], sizeof(TCHAR) * TEMPLATE_LENGTH);
- SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit]);
- DBDeleteContactSetting(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit]);
- SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
- InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
- teInfo->selchanging = FALSE;
- Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
- SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
- break;
}
- case IDC_UPDATEPREVIEW:
- SendMessage(hwndDlg, DM_UPDATETEMPLATEPREVIEW, 0, 0);
- break;
+ SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
+ }
+ break;
+
+ case IDC_VARIABLESHELP:
+ CallService(MS_UTILS_OPENURL, 0, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/Templates");
+ break;
+
+ case IDC_EDITTEMPLATE:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ if (!teInfo->selchanging) {
+ teInfo->changed = TRUE;
+ teInfo->updateInfo[teInfo->inEdit] = TRUE;
+ Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_FORGET, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_REVERT, TRUE);
+ }
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
+ }
+ break;
+ case IDC_SAVETEMPLATE:
+ {
+ TCHAR newTemplate[TEMPLATE_LENGTH + 2];
+
+ GetWindowText(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), newTemplate, TEMPLATE_LENGTH);
+ CopyMemory(tSet->szTemplates[teInfo->inEdit], newTemplate, sizeof(TCHAR) * TEMPLATE_LENGTH);
+ teInfo->changed = FALSE;
+ teInfo->updateInfo[teInfo->inEdit] = FALSE;
+ Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
+ M->WriteTString(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit], newTemplate);
+ SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
}
break;
- case WM_DRAWITEM: {
+
+ case IDC_FORGET:
+ teInfo->changed = FALSE;
+ teInfo->updateInfo[teInfo->inEdit] = FALSE;
+ teInfo->selchanging = TRUE;
+ SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit]);
+ SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
+ teInfo->selchanging = FALSE;
+ SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
+ break;
+
+ case IDC_REVERT:
+ teInfo->changed = FALSE;
+ teInfo->updateInfo[teInfo->inEdit] = FALSE;
+ teInfo->selchanging = TRUE;
+ CopyMemory(tSet->szTemplates[teInfo->inEdit], LTR_Default.szTemplates[teInfo->inEdit], sizeof(TCHAR) * TEMPLATE_LENGTH);
+ SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit]);
+ DBDeleteContactSetting(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit]);
+ SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
+ teInfo->selchanging = FALSE;
+ Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
+ break;
+
+ case IDC_UPDATEPREVIEW:
+ SendMessage(hwndDlg, DM_UPDATETEMPLATEPREVIEW, 0, 0);
+ break;
+ }
+ break;
+
+ case WM_DRAWITEM:
+ {
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
int iItem = dis->itemData;
HBRUSH bkg, oldBkg;
@@ -335,57 +343,58 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
char *pszName = Translate(TemplateNames[iItem]);
TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, pszName, lstrlenA(pszName));
- return(TRUE);
}
- case DM_UPDATETEMPLATEPREVIEW: {
- DBEVENTINFO dbei = {0};
- int iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
- TCHAR szTemp[TEMPLATE_LENGTH + 2];
-
- if (teInfo->changed) {
- CopyMemory(szTemp, tSet->szTemplates[teInfo->inEdit], TEMPLATE_LENGTH * sizeof(TCHAR));
- GetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit], TEMPLATE_LENGTH);
- }
- dbei.szModule = dat->szProto;
- dbei.timestamp = time(NULL);
- dbei.eventType = (iIndex == 6) ? EVENTTYPE_STATUSCHANGE : EVENTTYPE_MESSAGE;
- dbei.eventType = (iIndex == 7) ? EVENTTYPE_ERRMSG : dbei.eventType;
- if (dbei.eventType == EVENTTYPE_ERRMSG)
- dbei.szModule = "Sample error message";
- dbei.cbSize = sizeof(dbei);
- dbei.pBlob = (iIndex == 6) ? (BYTE *)"is now offline (was online)" : (BYTE *)"The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.";
- dbei.cbBlob = lstrlenA((char *)dbei.pBlob) + 1;
- dbei.flags = (iIndex == 1 || iIndex == 3 || iIndex == 5) ? DBEF_SENT : 0;
- dbei.flags |= (teInfo->rtl ? DBEF_RTL : 0);
- dat->lastEventTime = (iIndex == 4 || iIndex == 5) ? time(NULL) - 1 : 0;
- dat->iLastEventType = MAKELONG(dbei.flags, dbei.eventType);
- SetWindowText(GetDlgItem(hwndDlg, IDC_PREVIEW), _T(""));
- dat->dwFlags = MWF_LOG_ALL;
- dat->dwFlags = (teInfo->rtl ? dat->dwFlags | MWF_LOG_RTL : dat->dwFlags & ~MWF_LOG_RTL);
- dat->dwFlags = (iIndex == 0 || iIndex == 1) ? dat->dwFlags & ~MWF_LOG_GROUPMODE : dat->dwFlags | MWF_LOG_GROUPMODE;
- mir_sntprintf(dat->szMyNickname, safe_sizeof(dat->szMyNickname), _T("My Nickname"));
- StreamInEvents(hwndDlg, 0, 1, 1, &dbei);
- SendDlgItemMessage(hwndDlg, IDC_PREVIEW, EM_SETSEL, -1, -1);
- if (teInfo->changed)
- CopyMemory(tSet->szTemplates[teInfo->inEdit], szTemp, TEMPLATE_LENGTH * sizeof(TCHAR));
- break;
+ return(TRUE);
+
+ case DM_UPDATETEMPLATEPREVIEW: {
+ DBEVENTINFO dbei = {0};
+ int iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
+ TCHAR szTemp[TEMPLATE_LENGTH + 2];
+
+ if (teInfo->changed) {
+ CopyMemory(szTemp, tSet->szTemplates[teInfo->inEdit], TEMPLATE_LENGTH * sizeof(TCHAR));
+ GetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit], TEMPLATE_LENGTH);
}
- case WM_DESTROY:
- Utils::enableDlgControl(teInfo->hwndParent, IDC_MODIFY, TRUE);
- Utils::enableDlgControl(teInfo->hwndParent, IDC_RTLMODIFY, TRUE);
- if (dat->pContainer)
- free(dat->pContainer);
- if (dat)
- free(dat);
-
- M->WriteDword(SRMSGMOD_T, "cc1", SendDlgItemMessage(hwndDlg, IDC_COLOR1, CPM_GETCOLOUR, 0, 0));
- M->WriteDword(SRMSGMOD_T, "cc2", SendDlgItemMessage(hwndDlg, IDC_COLOR2, CPM_GETCOLOUR, 0, 0));
- M->WriteDword(SRMSGMOD_T, "cc3", SendDlgItemMessage(hwndDlg, IDC_COLOR3, CPM_GETCOLOUR, 0, 0));
- M->WriteDword(SRMSGMOD_T, "cc4", SendDlgItemMessage(hwndDlg, IDC_COLOR4, CPM_GETCOLOUR, 0, 0));
- M->WriteDword(SRMSGMOD_T, "cc5", SendDlgItemMessage(hwndDlg, IDC_COLOR5, CPM_GETCOLOUR, 0, 0));
-
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- break;
+ dbei.szModule = dat->szProto;
+ dbei.timestamp = time(NULL);
+ dbei.eventType = (iIndex == 6) ? EVENTTYPE_STATUSCHANGE : EVENTTYPE_MESSAGE;
+ dbei.eventType = (iIndex == 7) ? EVENTTYPE_ERRMSG : dbei.eventType;
+ if (dbei.eventType == EVENTTYPE_ERRMSG)
+ dbei.szModule = "Sample error message";
+ dbei.cbSize = sizeof(dbei);
+ dbei.pBlob = (iIndex == 6) ? (BYTE *)"is now offline (was online)" : (BYTE *)"The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.";
+ dbei.cbBlob = lstrlenA((char *)dbei.pBlob) + 1;
+ dbei.flags = (iIndex == 1 || iIndex == 3 || iIndex == 5) ? DBEF_SENT : 0;
+ dbei.flags |= (teInfo->rtl ? DBEF_RTL : 0);
+ dat->lastEventTime = (iIndex == 4 || iIndex == 5) ? time(NULL) - 1 : 0;
+ dat->iLastEventType = MAKELONG(dbei.flags, dbei.eventType);
+ SetWindowText(GetDlgItem(hwndDlg, IDC_PREVIEW), _T(""));
+ dat->dwFlags = MWF_LOG_ALL;
+ dat->dwFlags = (teInfo->rtl ? dat->dwFlags | MWF_LOG_RTL : dat->dwFlags & ~MWF_LOG_RTL);
+ dat->dwFlags = (iIndex == 0 || iIndex == 1) ? dat->dwFlags & ~MWF_LOG_GROUPMODE : dat->dwFlags | MWF_LOG_GROUPMODE;
+ mir_sntprintf(dat->szMyNickname, safe_sizeof(dat->szMyNickname), _T("My Nickname"));
+ StreamInEvents(hwndDlg, 0, 1, 1, &dbei);
+ SendDlgItemMessage(hwndDlg, IDC_PREVIEW, EM_SETSEL, -1, -1);
+ if (teInfo->changed)
+ CopyMemory(tSet->szTemplates[teInfo->inEdit], szTemp, TEMPLATE_LENGTH * sizeof(TCHAR));
+ break;
+ }
+ case WM_DESTROY:
+ Utils::enableDlgControl(teInfo->hwndParent, IDC_MODIFY, TRUE);
+ Utils::enableDlgControl(teInfo->hwndParent, IDC_RTLMODIFY, TRUE);
+ if (dat->pContainer)
+ free(dat->pContainer);
+ if (dat)
+ free(dat);
+
+ M->WriteDword(SRMSGMOD_T, "cc1", SendDlgItemMessage(hwndDlg, IDC_COLOR1, CPM_GETCOLOUR, 0, 0));
+ M->WriteDword(SRMSGMOD_T, "cc2", SendDlgItemMessage(hwndDlg, IDC_COLOR2, CPM_GETCOLOUR, 0, 0));
+ M->WriteDword(SRMSGMOD_T, "cc3", SendDlgItemMessage(hwndDlg, IDC_COLOR3, CPM_GETCOLOUR, 0, 0));
+ M->WriteDword(SRMSGMOD_T, "cc4", SendDlgItemMessage(hwndDlg, IDC_COLOR4, CPM_GETCOLOUR, 0, 0));
+ M->WriteDword(SRMSGMOD_T, "cc5", SendDlgItemMessage(hwndDlg, IDC_COLOR5, CPM_GETCOLOUR, 0, 0));
+
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ break;
}
return(FALSE);
}
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 05b5631bfd..9afa313492 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -2260,9 +2260,8 @@ void CSkin::DrawDimmedIcon(HDC hdc, LONG left, LONG top, LONG dx, LONG dy, HICON DeleteDC(dcMem);
}
-UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc)
+UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC MyWndProc)
{
- LRESULT orig = 0;
NCCALCSIZE_PARAMS *nccp = (NCCALCSIZE_PARAMS *)lParam;
BOOL bReturn = FALSE;
@@ -2271,8 +2270,8 @@ UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID EnableScrollBar(hwnd, SB_VERT, ESB_DISABLE_BOTH);
ShowScrollBar(hwnd, SB_VERT, FALSE);
}
- if (OldWndProc)
- orig = CallWindowProc(OldWndProc, hwnd, msg, wParam, lParam);
+
+ LRESULT orig = mir_callNextSubclass(hwnd, MyWndProc, msg, wParam, lParam);
if (0 == mwdat)
return(orig);
@@ -2313,12 +2312,7 @@ 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)
{
- CSkinItem *item = &SkinItems[skinID];
- LRESULT result = 0;
-
- if (OldWndProc)
- result = CallWindowProc(OldWndProc, hwnd, msg, wParam, lParam); // do default processing (otherwise, NO scrollbar as it is painted in NC_PAINT)
-
+ LRESULT result = mir_callNextSubclass(hwnd, OldWndProc, msg, wParam, lParam); // do default processing (otherwise, NO scrollbar as it is painted in NC_PAINT)
if (0 == mwdat)
return result;
@@ -2341,6 +2335,7 @@ UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, left_off -= PluginConfig.m_ncm.iScrollWidth;
top_off = pt.y - rcWindow.top;
+ CSkinItem *item = &SkinItems[skinID];
if (CSkin::m_skinEnabled && !item->IGNORED) {
right_off = item->MARGIN_RIGHT;
bottom_off = item->MARGIN_BOTTOM;
diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp index a057ee2b21..d21e7cc19e 100644 --- a/plugins/UserInfoEx/src/classPsTree.cpp +++ b/plugins/UserInfoEx/src/classPsTree.cpp @@ -22,9 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
#include "dlg_propsheet.h"
-
-static WNDPROC DefEditProc;
-
/***********************************************************************************************************
* construction and destruction
***********************************************************************************************************/
@@ -611,25 +608,25 @@ VOID CPsTree::DBResetState() **/
static LRESULT CALLBACK TPropsheetTree_LabelEditProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
- switch(uMsg)
- {
- case WM_KEYDOWN:
- switch(wParam)
- {
- case VK_RETURN:
- return ((CPsTree*)GetUserData(hwnd))->EndLabelEdit(TRUE);
- case VK_TAB:
- case VK_ESCAPE:
- return ((CPsTree*)GetUserData(hwnd))->EndLabelEdit(FALSE);
- }
- break;
- case WM_KILLFOCUS:
- ((CPsTree*)GetUserData(hwnd))->EndLabelEdit(FALSE);
- break;
- case WM_GETDLGCODE:
- return DLGC_WANTALLKEYS | CallWindowProc(DefEditProc, hwnd, uMsg, wParam, lParam );
+ switch(uMsg) {
+ case WM_KEYDOWN:
+ switch(wParam) {
+ case VK_RETURN:
+ return ((CPsTree*)GetUserData(hwnd))->EndLabelEdit(TRUE);
+ case VK_TAB:
+ case VK_ESCAPE:
+ return ((CPsTree*)GetUserData(hwnd))->EndLabelEdit(FALSE);
+ }
+ break;
+
+ case WM_KILLFOCUS:
+ ((CPsTree*)GetUserData(hwnd))->EndLabelEdit(FALSE);
+ break;
+
+ case WM_GETDLGCODE:
+ return DLGC_WANTALLKEYS | mir_callNextSubclass(hwnd, TPropsheetTree_LabelEditProc, uMsg, wParam, lParam );
}
- return CallWindowProc(DefEditProc, hwnd, uMsg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, TPropsheetTree_LabelEditProc, uMsg, wParam, lParam);
}
/**
@@ -671,7 +668,7 @@ INT CPsTree::BeginLabelEdit(HTREEITEM hItem) {
_hDragItem = hItem;
SetUserData(_hLabelEdit, this);
- DefEditProc = (WNDPROC)SetWindowLongPtr(_hLabelEdit,GWLP_WNDPROC, (LONG_PTR)TPropsheetTree_LabelEditProc );
+ mir_subclassWindow(_hLabelEdit, TPropsheetTree_LabelEditProc);
SendMessage(_hLabelEdit, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0 );
Edit_SetSel(_hLabelEdit, 0, -1);
Edit_LimitText(_hLabelEdit, MAX_TINAME);
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index 132d5b4107..90f59753d9 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -21,20 +21,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\commonheaders.h"
-
- #include <dlgs.h>
-
+#include <dlgs.h>
#include "m_db3xSA.h"
#include "dlg_ExImOpenSaveFile.h"
-
-
#define HKEY_MIRANDA_PLACESBAR _T("Software\\Miranda NG\\PlacesBar")
#define HKEY_WINPOL_PLACESBAR _T("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\ComDlg32\\PlacesBar")
-static WNDPROC DefPlacesBarProc;
-
/**
* This function maps the current users registry to a dummy key and
* changes the policy hive which is responsible for the places to be displayed,
@@ -121,68 +115,61 @@ static VOID ResetAlteredPlaceBars() * lParam - message dependend parameter
* return: depends on message
**/
-static LRESULT PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case TB_ADDBUTTONS:
- {
- TBBUTTON *tbb = (TBBUTTON *)lParam;
- TCHAR szBtnText[MAX_PATH];
- INT iString;
- HWND hWndToolTip;
-
- if (tbb)
- {
- switch (tbb->idCommand)
- {
- // miranda button
- case 41063:
- ZeroMemory(szBtnText, sizeof(szBtnText));
-
- mir_tcsncpy(szBtnText, TranslateT("Miranda NG"), SIZEOF(szBtnText));
- iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM)szBtnText);
- if (iString != -1) tbb->iString = iString;
- // set tooltip
- hWndToolTip = (HWND)SendMessage(hWnd, TB_GETTOOLTIPS, NULL, NULL);
- if (hWndToolTip) {
- TOOLINFO ti;
-
- ZeroMemory(&ti, sizeof(ti));
- ti.cbSize = sizeof(ti);
- ti.hwnd = hWnd;
- ti.lpszText = TranslateT("Shows Miranda's installation directory.");
- ti.uId = tbb->idCommand;
- SendMessage(hWndToolTip, TTM_ADDTOOL, NULL, (LPARAM)&ti);
- }
- break;
- // profile button
- case 41064:
- // set button text
- iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM) TranslateT("Profile"));
- if (iString != -1) tbb->iString = iString;
-
- // set tooltip
- hWndToolTip = (HWND)SendMessage(hWnd, TB_GETTOOLTIPS, NULL, NULL);
- if (hWndToolTip) {
- TOOLINFO ti;
-
- ZeroMemory(&ti, sizeof(ti));
- ti.cbSize = sizeof(ti);
- ti.hwnd = hWnd;
- ti.lpszText = TranslateT("Shows the directory with all your Miranda's profiles.");
- ti.uId = tbb->idCommand;
- SendMessage(hWndToolTip, TTM_ADDTOOL, NULL, (LPARAM)&ti);
- }
- // unmap registry and delete keys
- ResetAlteredPlaceBars();
- break;
+ if (uMsg == TB_ADDBUTTONS) {
+ TBBUTTON *tbb = (TBBUTTON *)lParam;
+ TCHAR szBtnText[MAX_PATH];
+ INT iString;
+ HWND hWndToolTip;
+
+ if (tbb) {
+ // miranda button
+ switch (tbb->idCommand) {
+ case 41063:
+ ZeroMemory(szBtnText, sizeof(szBtnText));
+
+ mir_tcsncpy(szBtnText, TranslateT("Miranda NG"), SIZEOF(szBtnText));
+ iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM)szBtnText);
+ if (iString != -1) tbb->iString = iString;
+ // set tooltip
+ hWndToolTip = (HWND)SendMessage(hWnd, TB_GETTOOLTIPS, NULL, NULL);
+ if (hWndToolTip) {
+ TOOLINFO ti;
+
+ ZeroMemory(&ti, sizeof(ti));
+ ti.cbSize = sizeof(ti);
+ ti.hwnd = hWnd;
+ ti.lpszText = TranslateT("Shows Miranda's installation directory.");
+ ti.uId = tbb->idCommand;
+ SendMessage(hWndToolTip, TTM_ADDTOOL, NULL, (LPARAM)&ti);
}
+ break;
+ // profile button
+ case 41064:
+ // set button text
+ iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM) TranslateT("Profile"));
+ if (iString != -1) tbb->iString = iString;
+
+ // set tooltip
+ hWndToolTip = (HWND)SendMessage(hWnd, TB_GETTOOLTIPS, NULL, NULL);
+ if (hWndToolTip) {
+ TOOLINFO ti;
+
+ ZeroMemory(&ti, sizeof(ti));
+ ti.cbSize = sizeof(ti);
+ ti.hwnd = hWnd;
+ ti.lpszText = TranslateT("Shows the directory with all your Miranda's profiles.");
+ ti.uId = tbb->idCommand;
+ SendMessage(hWndToolTip, TTM_ADDTOOL, NULL, (LPARAM)&ti);
+ }
+ // unmap registry and delete keys
+ ResetAlteredPlaceBars();
+ break;
}
- break;
}
}
- return CallWindowProc(DefPlacesBarProc, hWnd, uMsg, wParam,lParam);
+ return mir_callNextSubclass(hWnd, PlacesBarSubclassProc, uMsg, wParam,lParam);
}
/**
@@ -194,26 +181,26 @@ static LRESULT PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM * lParam - message dependend parameter
* return: depends on message
**/
-static UINT_PTR CALLBACK OpenSaveFileDialogHook(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK OpenSaveFileDialogHook(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == CDN_INITDONE) {
- HWND hPlacesBar = GetDlgItem(GetParent(hDlg), ctl1);
-
- // we have a places bar?
- if (hPlacesBar != NULL) {
- InitAlteredPlacesBar();
- // finally subclass the places bar
- DefPlacesBarProc = SubclassWindow(hPlacesBar, PlacesBarSubclassProc);
- }
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->code == CDN_INITDONE) {
+ HWND hPlacesBar = GetDlgItem(GetParent(hDlg), ctl1);
+
+ // we have a places bar?
+ if (hPlacesBar != NULL) {
+ InitAlteredPlacesBar();
+ // finally subclass the places bar
+ mir_subclassWindow(hPlacesBar, PlacesBarSubclassProc);
}
- break;
- case WM_DESTROY:
- // unmap registry and delete keys
- // (is to make it sure, if somehow the last places button was not added which also calls this function)
- ResetAlteredPlaceBars();
- break;
+ }
+ break;
+ case WM_DESTROY:
+ // unmap registry and delete keys
+ // (is to make it sure, if somehow the last places button was not added which also calls this function)
+ ResetAlteredPlaceBars();
+ break;
}
return FALSE;
}
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index 9e29db9665..f86d9c81b7 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -76,11 +76,7 @@ static const PROFILEENTRY pFmt[3] = { { LPGENT("Interest"), "Interest%dCat", "Interest%dText", (MIRANDASERVICE)GetInterestsList }
};
-static WNDPROC OldListViewProc = NULL; // listview control's default window procedure
-static WNDPROC OldEditProc = NULL; // edit control's default window procedure
-static WNDPROC OldDropdownProc = NULL; // listbox control's default window procedure
-
-static INT_PTR CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+static LRESULT CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
extern COLORREF clrBoth;
extern COLORREF clrChanged;
@@ -203,6 +199,7 @@ static VOID ProfileList_Clear(HWND hList) * bSave - tells, whether to save changes (TRUE) or not (FALSE)
* return: returns 0 on success or nonzero
**/
+
static INT ProfileList_EndLabelEdit(LPLISTCTRL pList, BOOLEAN bSave)
{
HWND hEdit;
@@ -276,6 +273,7 @@ static INT ProfileList_EndLabelEdit(HWND hList, BOOLEAN bSave) * iSubItem - subitem (column) index
* return: handle to the edit control
**/
+
static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, INT iItem, INT iSubItem)
{
LVITEM lvi;
@@ -361,7 +359,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, INT iItem, INT iSubItem pList->labelEdit.iTopIndex = ListView_GetTopIndex(pList->hList);
pList->labelEdit.pItem = pItem;
SetFocus(pList->labelEdit.hEdit);
- OldEditProc = (WNDPROC)SetWindowLongPtr(pList->labelEdit.hEdit, GWLP_WNDPROC, (LONG_PTR)ProfileList_LabelEditProc);
+ mir_subclassWindow(pList->labelEdit.hEdit, ProfileList_LabelEditProc);
return pList->labelEdit.hEdit;
}
@@ -569,72 +567,72 @@ static INT ProfileList_AddItemlistFromDB( * wParam - message specific parameter
* lParam - message specific parameter
* return: message specific
- **/
-static INT_PTR CALLBACK ProfileList_DropdownProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+**/
+
+static LRESULT CALLBACK ProfileList_DropdownProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
LPLISTCTRL pList;
switch (msg) {
- case WM_KEYDOWN:
- switch (wParam) {
- case VK_ESCAPE:
- SetFocus(GetParent(hwnd));
- return 0;
+ case WM_KEYDOWN:
+ switch (wParam) {
+ case VK_ESCAPE:
+ SetFocus(GetParent(hwnd));
+ return 0;
- case VK_RETURN:
- case VK_F4:
- {
- LPIDSTRLIST pItem;
-
- if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) return CB_ERR;
- pList->labelEdit.dropDown.iItem = ListBox_GetCurSel(hwnd);
- if (pList->labelEdit.dropDown.iItem >= 0 && PtrIsValid(pItem = (LPIDSTRLIST)ListBox_GetItemData(hwnd, pList->labelEdit.dropDown.iItem)))
- SetWindowText(pList->labelEdit.hEdit, pItem->ptszTranslated);
- else
- pList->labelEdit.dropDown.iItem = -1;
- SetFocus(pList->labelEdit.hEdit);
- return 0;
- }
+ case VK_RETURN:
+ case VK_F4:
+ {
+ LPIDSTRLIST pItem;
+
+ if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) return CB_ERR;
+ pList->labelEdit.dropDown.iItem = ListBox_GetCurSel(hwnd);
+ if (pList->labelEdit.dropDown.iItem >= 0 && PtrIsValid(pItem = (LPIDSTRLIST)ListBox_GetItemData(hwnd, pList->labelEdit.dropDown.iItem)))
+ SetWindowText(pList->labelEdit.hEdit, pItem->ptszTranslated);
+ else
+ pList->labelEdit.dropDown.iItem = -1;
+ SetFocus(pList->labelEdit.hEdit);
+ return 0;
}
- break;
- case WM_LBUTTONUP:
+ }
+ break;
+ case WM_LBUTTONUP:
{
POINT pt;
LPIDSTRLIST pItem;
if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) return CB_ERR;
- CallWindowProc(OldDropdownProc, hwnd, msg, wParam, lParam);
+ mir_callNextSubclass(hwnd, ProfileList_DropdownProc, msg, wParam, lParam);
- pt.x = (short)LOWORD(lParam);
- pt.y = (short)HIWORD(lParam);
- ClientToScreen(hwnd, &pt);
+ pt.x = (short)LOWORD(lParam);
+ pt.y = (short)HIWORD(lParam);
+ ClientToScreen(hwnd, &pt);
if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y)) == HTVSCROLL)
return CB_ERR;
-
+
pList->labelEdit.dropDown.iItem = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
-
- if (pList->labelEdit.dropDown.iItem >= 0 && PtrIsValid(pItem = (LPIDSTRLIST)ListBox_GetItemData(hwnd, pList->labelEdit.dropDown.iItem))) {
+
+ if (pList->labelEdit.dropDown.iItem >= 0 && PtrIsValid(pItem = (LPIDSTRLIST)ListBox_GetItemData(hwnd, pList->labelEdit.dropDown.iItem)))
SetWindowText(pList->labelEdit.hEdit, pItem->ptszTranslated);
- }
else
pList->labelEdit.dropDown.iItem = -1;
ProfileList_EndLabelEdit(pList->hList, TRUE);
return 0;
}
- case WM_KILLFOCUS:
- if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) {
- if (GetFocus() == pList->labelEdit.hEdit) {
- ShowWindow(hwnd, SW_HIDE);
- return 0;
- }
- ProfileList_EndLabelEdit(pList, FALSE);
+ case WM_KILLFOCUS:
+ if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) {
+ if (GetFocus() == pList->labelEdit.hEdit) {
+ ShowWindow(hwnd, SW_HIDE);
+ return 0;
}
- return 0;
+ ProfileList_EndLabelEdit(pList, FALSE);
+ }
+ return 0;
}
- return CallWindowProc(OldDropdownProc, hwnd, msg, wParam, lParam);
-}
+ return mir_callNextSubclass(hwnd, ProfileList_DropdownProc, msg, wParam, lParam);
+ }
/**
* name: ProfileList_LabelEditProc
@@ -645,7 +643,7 @@ static INT_PTR CALLBACK ProfileList_DropdownProc(HWND hwnd, UINT msg, WPARAM wPa * lParam - message specific parameter
* return: message specific
**/
-static INT_PTR CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
LPLISTCTRL pList;
@@ -728,7 +726,7 @@ static INT_PTR CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wP }
break;
case WM_GETDLGCODE:
- return DLGC_WANTALLKEYS | CallWindowProc(OldEditProc, hwnd, msg, wParam, lParam);
+ return DLGC_WANTALLKEYS | mir_callNextSubclass(hwnd, ProfileList_LabelEditProc, msg, wParam, lParam);
case WM_KILLFOCUS:
{
HWND hwndFocus = GetFocus();
@@ -741,7 +739,7 @@ static INT_PTR CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wP return 0;
}
}
- return CallWindowProc(OldEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ProfileList_LabelEditProc, msg, wParam, lParam);
}
/**
@@ -753,247 +751,244 @@ static INT_PTR CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wP * lParam - message specific parameter
* return: message specific
**/
-static INT_PTR CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
LPLISTCTRL pList;
switch (msg) {
- case WM_KEYDOWN:
+ case WM_KEYDOWN:
{
INT nCurSel, newSel;
LVITEM lvi;
switch (wParam) {
- case VK_F2:
- nCurSel = ListView_GetSelectionMark(hwnd);
- if (nCurSel == -1) break;
- ProfileList_BeginLabelEdit(hwnd, nCurSel, 0);
- return 0;
- case VK_F3:
- nCurSel = ListView_GetSelectionMark(hwnd);
- if (nCurSel == -1) break;
- ProfileList_BeginLabelEdit(hwnd, nCurSel, 1);
- return 0;
- case VK_UP:
- case VK_DOWN:
- lvi.iItem = nCurSel = ListView_GetSelectionMark(hwnd);
- lvi.iSubItem = 0;
-
- // find next valid item to select
- lvi.mask = LVIF_PARAM;
- do {
- if (wParam == VK_UP) lvi.iItem--;
- else lvi.iItem++;
- if (lvi.iItem == -1 || !ListView_GetItem(hwnd, &lvi)) {
- return 0;
- }
- } while (!lvi.lParam);
-
- ListView_EnsureVisible(hwnd, lvi.iItem, FALSE);
- newSel = lvi.iItem;
- lvi.iItem = nCurSel;
- lvi.mask = LVIF_STATE;
- lvi.stateMask = LVIS_FOCUSED|LVIS_SELECTED;
- lvi.state = 0;
- ListView_SetItem(hwnd, &lvi);
- lvi.iItem = newSel;
- lvi.state = LVIS_FOCUSED|LVIS_SELECTED;
- ListView_SetItem(hwnd, &lvi);
- ListView_SetSelectionMark(hwnd, lvi.iItem);
- return 0;
+ case VK_F2:
+ nCurSel = ListView_GetSelectionMark(hwnd);
+ if (nCurSel == -1) break;
+ ProfileList_BeginLabelEdit(hwnd, nCurSel, 0);
+ return 0;
+ case VK_F3:
+ nCurSel = ListView_GetSelectionMark(hwnd);
+ if (nCurSel == -1) break;
+ ProfileList_BeginLabelEdit(hwnd, nCurSel, 1);
+ return 0;
+ case VK_UP:
+ case VK_DOWN:
+ lvi.iItem = nCurSel = ListView_GetSelectionMark(hwnd);
+ lvi.iSubItem = 0;
+
+ // find next valid item to select
+ lvi.mask = LVIF_PARAM;
+ do {
+ if (wParam == VK_UP) lvi.iItem--;
+ else lvi.iItem++;
+ if (lvi.iItem == -1 || !ListView_GetItem(hwnd, &lvi)) {
+ return 0;
+ }
+ } while (!lvi.lParam);
+
+ ListView_EnsureVisible(hwnd, lvi.iItem, FALSE);
+ newSel = lvi.iItem;
+ lvi.iItem = nCurSel;
+ lvi.mask = LVIF_STATE;
+ lvi.stateMask = LVIS_FOCUSED|LVIS_SELECTED;
+ lvi.state = 0;
+ ListView_SetItem(hwnd, &lvi);
+ lvi.iItem = newSel;
+ lvi.state = LVIS_FOCUSED|LVIS_SELECTED;
+ ListView_SetItem(hwnd, &lvi);
+ ListView_SetSelectionMark(hwnd, lvi.iItem);
+ return 0;
}
break;
}
- case WM_MOUSEMOVE:
- if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) {
- HDC hDC;
- RECT rchWnd, rcItem;
- SIZE textSize;
- LVHITTESTINFO hi;
- TOOLINFO ti;
- BOOLEAN bReposition;
- LPLCITEM pItem;
-
- hi.pt.x = GET_X_LPARAM(lParam);
- hi.pt.y = GET_Y_LPARAM(lParam);
- ListView_SubItemHitTest(hwnd, &hi);
-
- // show tip only if pointer is over an item
- if (pList->iHotItem != hi.iItem || pList->iHotSubItem != hi.iSubItem) {
- bReposition = pList->iHotItem != -1 || pList->iHotSubItem != -1;
- pList->iHotItem = hi.iItem;
- pList->iHotSubItem = hi.iSubItem;
-
- if ((hi.flags & LVHT_ONITEMLABEL) && PtrIsValid(pItem = ProfileList_GetItemData(hwnd, hi.iItem))) {
- GetWindowRect(hwnd, &rchWnd);
- ListView_GetSubItemRect(hwnd, hi.iItem, hi.iSubItem, LVIR_BOUNDS, &rcItem);
- // calculate size of text on the screen
- if ((hDC = GetDC(GetParent(hwnd)))) {
- SelectObject(hDC, (HFONT)SendMessage(GetParent(hwnd), WM_GETFONT, NULL, NULL));
- GetTextExtentPoint32(hDC, pItem->pszText[hi.iSubItem], lstrlen(pItem->pszText[hi.iSubItem]), &textSize);
- ReleaseDC(GetParent(hwnd), hDC);
+ case WM_MOUSEMOVE:
+ if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) {
+ HDC hDC;
+ RECT rchWnd, rcItem;
+ SIZE textSize;
+ LVHITTESTINFO hi;
+ TOOLINFO ti;
+ BOOLEAN bReposition;
+ LPLCITEM pItem;
+
+ hi.pt.x = GET_X_LPARAM(lParam);
+ hi.pt.y = GET_Y_LPARAM(lParam);
+ ListView_SubItemHitTest(hwnd, &hi);
+
+ // show tip only if pointer is over an item
+ if (pList->iHotItem != hi.iItem || pList->iHotSubItem != hi.iSubItem) {
+ bReposition = pList->iHotItem != -1 || pList->iHotSubItem != -1;
+ pList->iHotItem = hi.iItem;
+ pList->iHotSubItem = hi.iSubItem;
+
+ if ((hi.flags & LVHT_ONITEMLABEL) && PtrIsValid(pItem = ProfileList_GetItemData(hwnd, hi.iItem))) {
+ GetWindowRect(hwnd, &rchWnd);
+ ListView_GetSubItemRect(hwnd, hi.iItem, hi.iSubItem, LVIR_BOUNDS, &rcItem);
+ // calculate size of text on the screen
+ if ((hDC = GetDC(GetParent(hwnd)))) {
+ SelectObject(hDC, (HFONT)SendMessage(GetParent(hwnd), WM_GETFONT, NULL, NULL));
+ GetTextExtentPoint32(hDC, pItem->pszText[hi.iSubItem], lstrlen(pItem->pszText[hi.iSubItem]), &textSize);
+ ReleaseDC(GetParent(hwnd), hDC);
+ }
+ // show tip only for text that is larger than te listview can display
+ if (textSize.cx > rchWnd.right - rchWnd.left || textSize.cx > rcItem.right - rcItem.left) {
+ ZeroMemory(&ti, sizeof(TOOLINFO));
+ ti.cbSize = sizeof(TOOLINFO);
+ ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS|TTF_TRANSPARENT;
+ ti.hinst = ghInst;
+ ti.hwnd = hwnd;
+ ti.uId = (UINT_PTR)hwnd;
+ ti.lpszText = pItem->pszText[hi.iSubItem];
+ ti.rect = rcItem;
+ SendMessage(pList->hTip, TTM_SETMAXTIPWIDTH, 0, 300);
+ SendMessage(pList->hTip, TTM_SETTOOLINFO, NULL, (LPARAM)&ti);
+ if (pList->iHotSubItem > 0) {
+ SendMessage(pList->hTip, TTM_SETTITLE, 1, (LPARAM)
+ ((pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount)
+ ? pItem->idstrList[pItem->iListItem].ptszTranslated
+ : (pItem->pszText[0] && *pItem->pszText[0])
+ ? pItem->pszText[0]
+ : TranslateT("<empty>"))
+ );
+ InvalidateRect(pList->hTip, NULL, TRUE);
}
- // show tip only for text that is larger than te listview can display
- if (textSize.cx > rchWnd.right - rchWnd.left || textSize.cx > rcItem.right - rcItem.left) {
- ZeroMemory(&ti, sizeof(TOOLINFO));
- ti.cbSize = sizeof(TOOLINFO);
- ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS|TTF_TRANSPARENT;
- ti.hinst = ghInst;
- ti.hwnd = hwnd;
- ti.uId = (UINT_PTR)hwnd;
- ti.lpszText = pItem->pszText[hi.iSubItem];
- ti.rect = rcItem;
- SendMessage(pList->hTip, TTM_SETMAXTIPWIDTH, 0, 300);
- SendMessage(pList->hTip, TTM_SETTOOLINFO, NULL, (LPARAM)&ti);
- if (pList->iHotSubItem > 0) {
- SendMessage(pList->hTip, TTM_SETTITLE, 1, (LPARAM)
- ((pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount)
- ? pItem->idstrList[pItem->iListItem].ptszTranslated
- : (pItem->pszText[0] && *pItem->pszText[0])
- ? pItem->pszText[0]
- : TranslateT("<empty>"))
- );
- InvalidateRect(pList->hTip, NULL, TRUE);
- }
- else
- SendMessage(pList->hTip, TTM_SETTITLE, 0, (LPARAM)"");
- SendMessage(pList->hTip, TTM_ACTIVATE, TRUE, (LPARAM)&ti);
- pList->ptTip.x = rchWnd.left + GET_X_LPARAM(lParam) - 16;
- pList->ptTip.y = rchWnd.top + rcItem.top;
- // no TTN_SHOW is called if bReposition is TRUE, so repose here!
- if (bReposition) {
- RECT rcTip;
- GetClientRect(pList->hTip, &rcTip);
- SetWindowPos(pList->hTip, hwnd, pList->ptTip.x, pList->ptTip.y - rcTip.bottom, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
- }
- pList->wFlags |= LIF_TIPVISIBLE;
- return 0;
+ else
+ SendMessage(pList->hTip, TTM_SETTITLE, 0, (LPARAM)"");
+ SendMessage(pList->hTip, TTM_ACTIVATE, TRUE, (LPARAM)&ti);
+ pList->ptTip.x = rchWnd.left + GET_X_LPARAM(lParam) - 16;
+ pList->ptTip.y = rchWnd.top + rcItem.top;
+ // no TTN_SHOW is called if bReposition is TRUE, so repose here!
+ if (bReposition) {
+ RECT rcTip;
+ GetClientRect(pList->hTip, &rcTip);
+ SetWindowPos(pList->hTip, hwnd, pList->ptTip.x, pList->ptTip.y - rcTip.bottom, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
}
+ pList->wFlags |= LIF_TIPVISIBLE;
+ return 0;
}
- if (pList->wFlags & LIF_TIPVISIBLE) {
- SendMessage(pList->hTip, TTM_ACTIVATE, FALSE, (LPARAM)&ti);
- pList->wFlags &= ~LIF_TIPVISIBLE;
- }
+ }
+ if (pList->wFlags & LIF_TIPVISIBLE) {
+ SendMessage(pList->hTip, TTM_ACTIVATE, FALSE, (LPARAM)&ti);
+ pList->wFlags &= ~LIF_TIPVISIBLE;
}
}
- return 0;
+ }
+ return 0;
- // begin label edit
- case WM_LBUTTONDBLCLK:
- {
- LVHITTESTINFO hi;
+ // begin label edit
+ case WM_LBUTTONDBLCLK:
+ {
+ LVHITTESTINFO hi;
- hi.pt.x = GET_X_LPARAM(lParam);
- hi.pt.y = GET_Y_LPARAM(lParam);
- if (ListView_SubItemHitTest(hwnd, &hi)) {
- ProfileList_BeginLabelEdit(hwnd, hi.iItem, hi.iSubItem);
- }
- return TRUE;
- }
-
- case WM_NOTIFY:
- if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)))
- break;
-
- // ensure position of tooltip is on the topline of the item
- if (((LPNMHDR)lParam)->hwndFrom == pList->hTip) {
- RECT rcTip;
- GetClientRect(pList->hTip, &rcTip);
-
- switch (((LPNMHDR)lParam)->code) {
- case TTN_SHOW:
- SetWindowPos(pList->hTip, hwnd, pList->ptTip.x, pList->ptTip.y - rcTip.bottom, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
- return TRUE;
- }
+ hi.pt.x = GET_X_LPARAM(lParam);
+ hi.pt.y = GET_Y_LPARAM(lParam);
+ if (ListView_SubItemHitTest(hwnd, &hi)) {
+ ProfileList_BeginLabelEdit(hwnd, hi.iItem, hi.iSubItem);
}
+ return TRUE;
+ }
+
+ case WM_NOTIFY:
+ if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)))
break;
- case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- // show dropdown menu for category list
- case BTN_EDIT:
- {
- INT i;
- TCHAR szEdit[MAX_PATH];
-
- if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) break;
- GetWindowText(pList->labelEdit.hEdit, szEdit, MAX_PATH);
-
- // need to create the dropdown list?
- if (pList->labelEdit.dropDown.hDrop == NULL) {
- const INT listHeight = 120;
- RECT rc, rcList;
- INT add;
-
- // dropdown rect
- GetClientRect(pList->hList, &rcList);
- rc.left = pList->labelEdit.rcCombo.left;
- rc.right = pList->labelEdit.rcCombo.right + pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top;
-
- if (rcList.bottom < pList->labelEdit.rcCombo.bottom + listHeight) {
- rc.bottom = pList->labelEdit.rcCombo.bottom - 7; // don't ask me why!
- rc.top = rc.bottom - listHeight;
- }
- else {
- rc.top = pList->labelEdit.rcCombo.bottom;
- rc.bottom = rc.top + listHeight;
- }
+ // ensure position of tooltip is on the topline of the item
+ if (((LPNMHDR)lParam)->hwndFrom == pList->hTip) {
+ RECT rcTip;
+ GetClientRect(pList->hTip, &rcTip);
- pList->labelEdit.dropDown.hDrop = CreateWindowEx(0,
- _T("LISTBOX"), NULL, WS_CHILD|WS_BORDER|WS_VSCROLL|LBS_COMBOBOX|LBS_HASSTRINGS,
- rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
- hwnd, NULL, ghInst, NULL);
- if (!pList->labelEdit.dropDown.hDrop) return FALSE;
- SetUserData(pList->labelEdit.dropDown.hDrop, pList);
- OldDropdownProc = (WNDPROC)SetWindowLongPtr(pList->labelEdit.dropDown.hDrop, GWLP_WNDPROC, (LONG_PTR)ProfileList_DropdownProc);
- SetWindowLongPtr(pList->labelEdit.dropDown.hDrop, GWLP_ID, LIST_DROPDOWN);
- SendMessage(pList->labelEdit.dropDown.hDrop, WM_SETFONT, (WPARAM)SendMessage(GetParent(pList->hList), WM_GETFONT, 0, 0), 0);
-
- // add items
- for (i = 0; i < pList->labelEdit.pItem->idstrListCount; i++) {
- add = ListBox_AddString(pList->labelEdit.dropDown.hDrop, pList->labelEdit.pItem->idstrList[i].ptszTranslated);
- ListBox_SetItemData(pList->labelEdit.dropDown.hDrop, add, pList->labelEdit.pItem->idstrList + i);
- if (!_tcscmp(szEdit, pList->labelEdit.pItem->idstrList[i].ptszTranslated))
- ListBox_SetCurSel(pList->labelEdit.dropDown.hDrop, add);
- }
+ switch (((LPNMHDR)lParam)->code) {
+ case TTN_SHOW:
+ SetWindowPos(pList->hTip, hwnd, pList->ptTip.x, pList->ptTip.y - rcTip.bottom, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
+ return TRUE;
+ }
+ }
+ break;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+
+ // show dropdown menu for category list
+ case BTN_EDIT:
+ {
+ INT i;
+ TCHAR szEdit[MAX_PATH];
+
+ if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) break;
+ GetWindowText(pList->labelEdit.hEdit, szEdit, MAX_PATH);
+
+ // need to create the dropdown list?
+ if (pList->labelEdit.dropDown.hDrop == NULL) {
+ const INT listHeight = 120;
+ RECT rc, rcList;
+ INT add;
+
+ // dropdown rect
+ GetClientRect(pList->hList, &rcList);
+ rc.left = pList->labelEdit.rcCombo.left;
+ rc.right = pList->labelEdit.rcCombo.right + pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top;
+
+ if (rcList.bottom < pList->labelEdit.rcCombo.bottom + listHeight) {
+ rc.bottom = pList->labelEdit.rcCombo.bottom - 7; // don't ask me why!
+ rc.top = rc.bottom - listHeight;
}
else {
- LPIDSTRLIST lpidList;
-
- i = 0;
- while (PtrIsValid(lpidList = (LPIDSTRLIST)ListBox_GetItemData(pList->labelEdit.dropDown.hDrop, i))) {
- if (!_tcscmp(szEdit, lpidList->ptszTranslated)) {
- ListBox_SetCurSel(pList->labelEdit.dropDown.hDrop, i);
- break;
- }
- i++;
- }
- if (i == pList->labelEdit.pItem->idstrListCount)
- ListBox_SetCurSel(pList->labelEdit.dropDown.hDrop, -1);
+ rc.top = pList->labelEdit.rcCombo.bottom;
+ rc.bottom = rc.top + listHeight;
}
- if (IsWindowVisible(pList->labelEdit.dropDown.hDrop)) {
- SetFocus(pList->labelEdit.hEdit);
+
+ pList->labelEdit.dropDown.hDrop = CreateWindowEx(0,
+ _T("LISTBOX"), NULL, WS_CHILD|WS_BORDER|WS_VSCROLL|LBS_COMBOBOX|LBS_HASSTRINGS,
+ rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
+ hwnd, NULL, ghInst, NULL);
+ if (!pList->labelEdit.dropDown.hDrop) return FALSE;
+ SetUserData(pList->labelEdit.dropDown.hDrop, pList);
+ mir_subclassWindow(pList->labelEdit.dropDown.hDrop, ProfileList_DropdownProc);
+ SetWindowLongPtr(pList->labelEdit.dropDown.hDrop, GWLP_ID, LIST_DROPDOWN);
+ SendMessage(pList->labelEdit.dropDown.hDrop, WM_SETFONT, (WPARAM)SendMessage(GetParent(pList->hList), WM_GETFONT, 0, 0), 0);
+
+ // add items
+ for (i = 0; i < pList->labelEdit.pItem->idstrListCount; i++) {
+ add = ListBox_AddString(pList->labelEdit.dropDown.hDrop, pList->labelEdit.pItem->idstrList[i].ptszTranslated);
+ ListBox_SetItemData(pList->labelEdit.dropDown.hDrop, add, pList->labelEdit.pItem->idstrList + i);
+ if (!_tcscmp(szEdit, pList->labelEdit.pItem->idstrList[i].ptszTranslated))
+ ListBox_SetCurSel(pList->labelEdit.dropDown.hDrop, add);
}
- else {
- ShowWindow(pList->labelEdit.dropDown.hDrop, SW_SHOW);
- //SetFocus(pList->labelEdit.dropDown.hDrop);
+ }
+ else {
+ LPIDSTRLIST lpidList;
+
+ i = 0;
+ while (PtrIsValid(lpidList = (LPIDSTRLIST)ListBox_GetItemData(pList->labelEdit.dropDown.hDrop, i))) {
+ if (!_tcscmp(szEdit, lpidList->ptszTranslated)) {
+ ListBox_SetCurSel(pList->labelEdit.dropDown.hDrop, i);
+ break;
+ }
+ i++;
}
- break;
+ if (i == pList->labelEdit.pItem->idstrListCount)
+ ListBox_SetCurSel(pList->labelEdit.dropDown.hDrop, -1);
+ }
+ if (IsWindowVisible(pList->labelEdit.dropDown.hDrop)) {
+ SetFocus(pList->labelEdit.hEdit);
+ }
+ else {
+ ShowWindow(pList->labelEdit.dropDown.hDrop, SW_SHOW);
+ //SetFocus(pList->labelEdit.dropDown.hDrop);
}
+ break;
}
- break;
- }
- case WM_MOUSEWHEEL:
- case WM_VSCROLL:
- case WM_HSCROLL:
- {
- if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)))
- ProfileList_EndLabelEdit(pList, FALSE);
- break;
}
+ break;
- case WM_KILLFOCUS:
+ case WM_MOUSEWHEEL:
+ case WM_VSCROLL:
+ case WM_HSCROLL:
+ if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)))
+ ProfileList_EndLabelEdit(pList, FALSE);
+ break;
+
+ case WM_KILLFOCUS:
{
HWND hwndFocus = GetFocus();
@@ -1005,20 +1000,20 @@ static INT_PTR CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa break;
}
- case WM_DESTROY:
- if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) {
- HFONT hFont;
+ case WM_DESTROY:
+ if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) {
+ HFONT hFont;
- ProfileList_EndLabelEdit(pList, FALSE);
- ProfileList_Clear(hwnd);
- if (PtrIsValid(hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0)) && hFont != pList->hFont)
- DeleteObject(hFont);
- DestroyWindow(pList->hTip);
- mir_free(pList);
- }
- break;
+ ProfileList_EndLabelEdit(pList, FALSE);
+ ProfileList_Clear(hwnd);
+ if (PtrIsValid(hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0)) && hFont != pList->hFont)
+ DeleteObject(hFont);
+ DestroyWindow(pList->hTip);
+ mir_free(pList);
+ }
+ break;
}
- return CallWindowProc(OldListViewProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ProfileList_SubclassProc, msg, wParam, lParam);
}
/**
@@ -1033,7 +1028,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR LPLISTCTRL pList;
switch (uMsg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
LVCOLUMN lvc;
RECT rc;
@@ -1055,8 +1050,8 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR SetUserData(hList, pList);
// set new window procedure
- OldListViewProc = (WNDPROC)SetWindowLongPtr(hList, GWLP_WNDPROC, (LONG_PTR)&ProfileList_SubclassProc);
-
+ mir_subclassWindow(hList, ProfileList_SubclassProc);
+
// remove static edge in aero mode
if (IsAeroMode())
SetWindowLongPtr(hList, GWL_EXSTYLE, GetWindowLongPtr(hList, GWL_EXSTYLE)&~WS_EX_STATICEDGE);
@@ -1108,348 +1103,342 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR return TRUE;
}
- case WM_CTLCOLORSTATIC:
- case WM_CTLCOLORDLG:
- if (IsAeroMode())
- return (INT_PTR)GetStockBrush(WHITE_BRUSH);
- break;
+ case WM_CTLCOLORSTATIC:
+ case WM_CTLCOLORDLG:
+ if (IsAeroMode())
+ return (INT_PTR)GetStockBrush(WHITE_BRUSH);
+ break;
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- {
- HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam;
- LPCSTR pszProto;
-
- if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hList))) break;
-
- switch (((LPNMHDR)lParam)->code) {
- // some account data may have changed so reread database
- case PSN_INFOCHANGED:
- {
- BYTE msgResult = 0;
- LPIDSTRLIST idList;
- UINT nList;
- BYTE i;
- INT iItem = 0,
- iGrp = 0,
- numProtoItems,
- numUserItems;
-
- if (!(pList->wFlags & CTRLF_CHANGED) && PSGetBaseProto(hDlg, pszProto) && *pszProto != 0) {
- ProfileList_Clear(hList);
-
- // insert the past information
- for (i = 0; i < 3; i++) {
- pFmt[i].GetList((WPARAM)&nList, (LPARAM)&idList);
- if ((numProtoItems = ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hContact, pszProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASPROTO)) < 0)
- return FALSE;
-
- // scan all basic protocols for the subcontacts
- if (DB::Module::IsMetaAndScan(pszProto)) {
- INT iDefault = CallService(MS_MC_GETDEFAULTCONTACTNUM, (WPARAM)hContact, NULL);
- HANDLE hSubContact, hDefContact;
- LPCSTR pszSubBaseProto;
- INT j, numSubs;
-
- if ((hDefContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, iDefault)) &&
- (pszSubBaseProto = DB::Contact::Proto(hDefContact)))
- {
- if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hDefContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0)
- return FALSE;
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ {
+ HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam;
+ LPCSTR pszProto;
- // copy the missing settings from the other subcontacts
- numSubs = CallService(MS_MC_GETNUMCONTACTS, (WPARAM)hContact, NULL);
- for (j = 0; j < numSubs; j++) {
- if (j == iDefault) continue;
- if (!(hSubContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, j))) continue;
- if (!(pszSubBaseProto = DB::Contact::Proto(hSubContact))) continue;
- if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hSubContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0)
- return FALSE;
- //if ((numUserItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hSubContact, USERINFO, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0)
- // return FALSE;
- }
+ if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hList)))
+ break;
+
+ // some account data may have changed so reread database
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_INFOCHANGED:
+ {
+ BYTE msgResult = 0;
+ LPIDSTRLIST idList;
+ UINT nList;
+ BYTE i;
+ INT iItem = 0,
+ iGrp = 0,
+ numProtoItems,
+ numUserItems;
+
+ if (!(pList->wFlags & CTRLF_CHANGED) && PSGetBaseProto(hDlg, pszProto) && *pszProto != 0) {
+ ProfileList_Clear(hList);
+
+ // insert the past information
+ for (i = 0; i < 3; i++) {
+ pFmt[i].GetList((WPARAM)&nList, (LPARAM)&idList);
+ if ((numProtoItems = ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hContact, pszProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASPROTO)) < 0)
+ return FALSE;
+
+ // scan all basic protocols for the subcontacts
+ if (DB::Module::IsMetaAndScan(pszProto)) {
+ INT iDefault = CallService(MS_MC_GETDEFAULTCONTACTNUM, (WPARAM)hContact, NULL);
+ HANDLE hSubContact, hDefContact;
+ LPCSTR pszSubBaseProto;
+ INT j, numSubs;
+
+ if ((hDefContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, iDefault)) &&
+ (pszSubBaseProto = DB::Contact::Proto(hDefContact)))
+ {
+ if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hDefContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0)
+ return FALSE;
+
+ // copy the missing settings from the other subcontacts
+ numSubs = CallService(MS_MC_GETNUMCONTACTS, (WPARAM)hContact, NULL);
+ for (j = 0; j < numSubs; j++) {
+ if (j == iDefault) continue;
+ if (!(hSubContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, j))) continue;
+ if (!(pszSubBaseProto = DB::Contact::Proto(hSubContact))) continue;
+ if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hSubContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0)
+ return FALSE;
+ //if ((numUserItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hSubContact, USERINFO, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0)
+ // return FALSE;
}
}
- if ((numUserItems = ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hContact, USERINFO, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASCUSTOM)) < 0)
- return FALSE;
- if (numUserItems || numProtoItems) {
- msgResult = PSP_CHANGED;
- ProfileList_AddGroup(hList, pFmt[i].szGroup, iGrp);
- iGrp = ++iItem;
- }
+ }
+ if ((numUserItems = ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hContact, USERINFO, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASCUSTOM)) < 0)
+ return FALSE;
+ if (numUserItems || numProtoItems) {
+ msgResult = PSP_CHANGED;
+ ProfileList_AddGroup(hList, pFmt[i].szGroup, iGrp);
+ iGrp = ++iItem;
}
}
- SetWindowLongPtr(hDlg, DWLP_MSGRESULT, msgResult);
- break;
}
- // user swiches to another propertysheetpage
- case PSN_KILLACTIVE:
- ProfileList_EndLabelEdit(hList, TRUE);
- break;
- // user selected to apply settings to the database
- case PSN_APPLY:
- if (pList->wFlags & CTRLF_CHANGED) {
- BYTE iFmt = -1;
- INT iItem;
- LVITEM lvi;
- TCHAR szGroup[MAX_PATH];
- CHAR pszSetting[MAXSETTING];
- LPLCITEM pItem;
- LPSTR pszModule = USERINFO;
-
- if (!hContact) PSGetBaseProto(hDlg, pszModule);
-
- *szGroup = 0;
- lvi.mask = LVIF_TEXT|LVIF_PARAM;
- lvi.pszText = szGroup;
- lvi.cchTextMax = MAX_PATH;
-
- for (iItem = lvi.iItem = lvi.iSubItem = 0; ListView_GetItem(hList, &lvi); lvi.iItem++) {
- if (!PtrIsValid(pItem = (LPLCITEM)lvi.lParam)) {
- // delete reluctant items
- if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) {
- DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szCatFmt, iItem);
- DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szValFmt, iItem);
- }
- // find information about the group
- for (iFmt = 0; iFmt < SIZEOF(pFmt); iFmt++) {
- if (!_tcscmp(szGroup, pFmt[iFmt].szGroup)) {
- break;
- }
- }
- // indicate, no group was found. should not happen!!
- if (iFmt == SIZEOF(pFmt)) {
- *szGroup = 0;
- iFmt = -1;
- }
- iItem = 0;
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, msgResult);
+ break;
+ }
+ // user swiches to another propertysheetpage
+ case PSN_KILLACTIVE:
+ ProfileList_EndLabelEdit(hList, TRUE);
+ break;
+ // user selected to apply settings to the database
+ case PSN_APPLY:
+ if (pList->wFlags & CTRLF_CHANGED) {
+ BYTE iFmt = -1;
+ INT iItem;
+ LVITEM lvi;
+ TCHAR szGroup[MAX_PATH];
+ CHAR pszSetting[MAXSETTING];
+ LPLCITEM pItem;
+ LPSTR pszModule = USERINFO;
+
+ if (!hContact) PSGetBaseProto(hDlg, pszModule);
+
+ *szGroup = 0;
+ lvi.mask = LVIF_TEXT|LVIF_PARAM;
+ lvi.pszText = szGroup;
+ lvi.cchTextMax = MAX_PATH;
+
+ for (iItem = lvi.iItem = lvi.iSubItem = 0; ListView_GetItem(hList, &lvi); lvi.iItem++) {
+ if (!PtrIsValid(pItem = (LPLCITEM)lvi.lParam)) {
+ // delete reluctant items
+ if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) {
+ DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szCatFmt, iItem);
+ DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szValFmt, iItem);
+ }
+ // find information about the group
+ for (iFmt = 0; iFmt < SIZEOF(pFmt); iFmt++) {
+ if (!_tcscmp(szGroup, pFmt[iFmt].szGroup)) {
+ break;
}
- else
- if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) {
- // save value
- if (!pItem->pszText[1] || !*pItem->pszText[1])
- continue;
- if (!(pItem->wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA))) {
- mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szValFmt, iItem);
- DB::Setting::WriteTString(hContact, pszModule, pszSetting, pItem->pszText[1]);
- // save category
- mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szCatFmt, iItem);
- if (pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount)
- DB::Setting::WriteAString(hContact, pszModule, pszSetting, (LPSTR)pItem->idstrList[pItem->iListItem].pszText);
- else
+ }
+ // indicate, no group was found. should not happen!!
+ if (iFmt == SIZEOF(pFmt)) {
+ *szGroup = 0;
+ iFmt = -1;
+ }
+ iItem = 0;
+ }
+ else
+ if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) {
+ // save value
+ if (!pItem->pszText[1] || !*pItem->pszText[1])
+ continue;
+ if (!(pItem->wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA))) {
+ mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szValFmt, iItem);
+ DB::Setting::WriteTString(hContact, pszModule, pszSetting, pItem->pszText[1]);
+ // save category
+ mir_snprintf(pszSetting, MAXSETTING, pFmt[iFmt].szCatFmt, iItem);
+ if (pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount)
+ DB::Setting::WriteAString(hContact, pszModule, pszSetting, (LPSTR)pItem->idstrList[pItem->iListItem].pszText);
+ else
if (pItem->pszText[0] && *pItem->pszText[0])
DB::Setting::WriteTString(hContact, pszModule, pszSetting, (LPTSTR)pItem->pszText[0]);
else
DB::Setting::Delete(hContact, pszModule, pszSetting);
- // redraw the item if required
- if (pItem->wFlags & CTRLF_CHANGED) {
- pItem->wFlags &= ~CTRLF_CHANGED;
- ListView_RedrawItems(hList, lvi.iItem, lvi.iItem);
- }
- iItem++;
+ // redraw the item if required
+ if (pItem->wFlags & CTRLF_CHANGED) {
+ pItem->wFlags &= ~CTRLF_CHANGED;
+ ListView_RedrawItems(hList, lvi.iItem, lvi.iItem);
}
+ iItem++;
}
}
- // delete reluctant items
- if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) {
- DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szCatFmt, iItem);
- DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szValFmt, iItem);
- }
+ }
+ // delete reluctant items
+ if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) {
+ DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szCatFmt, iItem);
+ DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szValFmt, iItem);
+ }
- pList->wFlags &= ~CTRLF_CHANGED;
- }
- break;
+ pList->wFlags &= ~CTRLF_CHANGED;
}
- break;
}
+ }
+ break;
- //
- // handle notification messages from the list control
- //
- case LIST_PROFILE:
+ //
+ // handle notification messages from the list control
+ //
+ case LIST_PROFILE:
+ pList = (LPLISTCTRL)GetUserData(((LPNMHDR)lParam)->hwndFrom);
+
+ switch (((LPNMHDR)lParam)->code) {
+ case NM_RCLICK:
{
- LPLISTCTRL pList = (LPLISTCTRL)GetUserData(((LPNMHDR)lParam)->hwndFrom);
+ HMENU hMenu = CreatePopupMenu();
+ MENUITEMINFO mii;
+ HANDLE hContact;
+ LVHITTESTINFO hi;
+ LPLCITEM pItem;
+ POINT pt;
+
+ if (!hMenu) return 1;
+ PSGetContact(hDlg, hContact);
+ GetCursorPos(&pt);
+ hi.pt = pt;
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hi.pt);
+ ListView_SubItemHitTest(((LPNMHDR)lParam)->hwndFrom, &hi);
+ pItem = ProfileList_GetItemData(((LPNMHDR)lParam)->hwndFrom, hi.iItem);
+
+ // insert menuitems
+ ZeroMemory(&mii, sizeof(MENUITEMINFO));
+ mii.cbSize = sizeof(MENUITEMINFO);
+ mii.fMask = MIIM_ID|MIIM_STRING;
+ // insert "Add" Menuitem
+ mii.wID = BTN_ADD_intEREST;
+ mii.dwTypeData = TranslateT("Add Interest");
+ InsertMenuItem(hMenu, 0, TRUE, &mii);
+ mii.wID = BTN_ADD_AFFLIATION;
+ mii.dwTypeData = TranslateT("Add Affliation");
+ InsertMenuItem(hMenu, 1, TRUE, &mii);
+ mii.wID = BTN_ADD_PAST;
+ mii.dwTypeData = TranslateT("Add Past");
+ InsertMenuItem(hMenu, 2, TRUE, &mii);
+
+ if (hi.iItem != -1 && PtrIsValid(pItem) && !(hContact && (pItem->wFlags & CTRLF_HASPROTO))) {
+ // insert separator
+ mii.fMask = MIIM_FTYPE;
+ mii.fType = MFT_SEPARATOR;
+ InsertMenuItem(hMenu, 3, TRUE, &mii);
+ // insert "Delete" Menuitem
+ mii.fMask = MIIM_ID|MIIM_STRING;
+ mii.wID = BTN_EDIT_CAT;
+ mii.dwTypeData = TranslateT("Edit Category");
+ InsertMenuItem(hMenu, 4, TRUE, &mii);
+ mii.wID = BTN_EDIT_VAL;
+ mii.dwTypeData = TranslateT("Edit Value");
+ InsertMenuItem(hMenu, 5, TRUE, &mii);
+ mii.fMask = MIIM_FTYPE;
+ mii.fType = MFT_SEPARATOR;
+ InsertMenuItem(hMenu, 6, TRUE, &mii);
+ // insert "Delete" Menuitem
+ mii.fMask = MIIM_ID|MIIM_STRING;
+ mii.wID = BTN_DEL;
+ mii.dwTypeData = TranslateT("Delete");
+ InsertMenuItem(hMenu, 7, TRUE, &mii);
+ }
+ TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hDlg, 0);
+ DestroyMenu(hMenu);
+ }
+ return 0;
- switch (((LPNMHDR)lParam)->code) {
- case NM_RCLICK:
- {
- HMENU hMenu = CreatePopupMenu();
- MENUITEMINFO mii;
- HANDLE hContact;
- LVHITTESTINFO hi;
- LPLCITEM pItem;
- POINT pt;
-
- if (!hMenu) return 1;
- PSGetContact(hDlg, hContact);
- GetCursorPos(&pt);
- hi.pt = pt;
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hi.pt);
- ListView_SubItemHitTest(((LPNMHDR)lParam)->hwndFrom, &hi);
- pItem = ProfileList_GetItemData(((LPNMHDR)lParam)->hwndFrom, hi.iItem);
-
- // insert menuitems
- ZeroMemory(&mii, sizeof(MENUITEMINFO));
- mii.cbSize = sizeof(MENUITEMINFO);
- mii.fMask = MIIM_ID|MIIM_STRING;
- // insert "Add" Menuitem
- mii.wID = BTN_ADD_intEREST;
- mii.dwTypeData = TranslateT("Add Interest");
- InsertMenuItem(hMenu, 0, TRUE, &mii);
- mii.wID = BTN_ADD_AFFLIATION;
- mii.dwTypeData = TranslateT("Add Affliation");
- InsertMenuItem(hMenu, 1, TRUE, &mii);
- mii.wID = BTN_ADD_PAST;
- mii.dwTypeData = TranslateT("Add Past");
- InsertMenuItem(hMenu, 2, TRUE, &mii);
-
- if (hi.iItem != -1 && PtrIsValid(pItem) && !(hContact && (pItem->wFlags & CTRLF_HASPROTO))) {
- // insert separator
- mii.fMask = MIIM_FTYPE;
- mii.fType = MFT_SEPARATOR;
- InsertMenuItem(hMenu, 3, TRUE, &mii);
- // insert "Delete" Menuitem
- mii.fMask = MIIM_ID|MIIM_STRING;
- mii.wID = BTN_EDIT_CAT;
- mii.dwTypeData = TranslateT("Edit Category");
- InsertMenuItem(hMenu, 4, TRUE, &mii);
- mii.wID = BTN_EDIT_VAL;
- mii.dwTypeData = TranslateT("Edit Value");
- InsertMenuItem(hMenu, 5, TRUE, &mii);
- mii.fMask = MIIM_FTYPE;
- mii.fType = MFT_SEPARATOR;
- InsertMenuItem(hMenu, 6, TRUE, &mii);
- // insert "Delete" Menuitem
- mii.fMask = MIIM_ID|MIIM_STRING;
- mii.wID = BTN_DEL;
- mii.dwTypeData = TranslateT("Delete");
- InsertMenuItem(hMenu, 7, TRUE, &mii);
- }
- TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hDlg, 0);
- DestroyMenu(hMenu);
- return 0;
+ case LVN_GETDISPINFO:
+ if (pList->labelEdit.iTopIndex != ListView_GetTopIndex(hList))
+ ProfileList_EndLabelEdit(((LPNMHDR)lParam)->hwndFrom, FALSE);
+ break;
+
+ case NM_CUSTOMDRAW:
+ {
+ LPNMLVCUSTOMDRAW cd = (LPNMLVCUSTOMDRAW)lParam;
+ LPLCITEM pItem = (LPLCITEM)cd->nmcd.lItemlParam;
+ RECT rc;
+
+ switch (cd->nmcd.dwDrawStage) {
+ case CDDS_PREPAINT:
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_NOTIFYITEMDRAW);
+ return TRUE;
+
+ case CDDS_ITEMPREPAINT:
+ ListView_GetItemRect(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec, &rc, LVIR_BOUNDS);
+ if (!PtrIsValid(pItem)) {
+ HFONT hBold, hFont;
+ TCHAR szText[MAX_PATH];
+
+ PSGetBoldFont(hDlg, hBold);
+ hFont = (HFONT)SelectObject(cd->nmcd.hdc, hBold);
+ SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_3DSHADOW));
+ ProfileList_GetItemText(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec, 0, szText, MAX_PATH);
+ rc.left += 6;
+ DrawText(cd->nmcd.hdc, TranslateTS(szText), -1, &rc, DT_NOCLIP|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
+
+ rc.bottom -= 2;
+ rc.top = rc.bottom - 1;
+ rc.left -= 6;
+ DrawEdge(cd->nmcd.hdc, &rc, BDR_SUNKENOUTER, BF_RECT);
+
+ SelectObject(cd->nmcd.hdc, hFont);
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
+ return TRUE;
}
- /*case LVN_BEGINSCROLL:
- SetFocus(((LPNMHDR)lParam)->hwndFrom);
- break;
- */
- case LVN_GETDISPINFO:
- if (pList->labelEdit.iTopIndex != ListView_GetTopIndex(hList))
- ProfileList_EndLabelEdit(((LPNMHDR)lParam)->hwndFrom, FALSE);
- break;
- case NM_CUSTOMDRAW:
+ // draw selected item
+ if ((cd->nmcd.uItemState & CDIS_SELECTED) || (pList->labelEdit.iItem == cd->nmcd.dwItemSpec)) {
+ SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
+ FillRect(cd->nmcd.hdc, &rc, GetSysColorBrush(COLOR_HIGHLIGHT));
+ }
+ // draw background of unselected item
+ else {
+ SetTextColor(cd->nmcd.hdc,
+ (pItem->wFlags & CTRLF_CHANGED)
+ ? clrChanged : (pItem->wFlags & CTRLF_HASMETA)
+ ? clrMeta : ((pItem->wFlags & (CTRLF_HASCUSTOM)) && (pItem->wFlags & CTRLF_HASPROTO))
+ ? clrBoth : (pItem->wFlags & CTRLF_HASCUSTOM)
+ ? clrCustom : clrNormal);
+ FillRect(cd->nmcd.hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
+ }
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_NEWFONT|CDRF_NOTIFYSUBITEMDRAW);
+ return TRUE;
+
+ case CDDS_SUBITEM|CDDS_ITEMPREPAINT:
{
- LPNMLVCUSTOMDRAW cd = (LPNMLVCUSTOMDRAW)lParam;
- LPLCITEM pItem = (LPLCITEM)cd->nmcd.lItemlParam;
- RECT rc;
-
- switch (cd->nmcd.dwDrawStage) {
- case CDDS_PREPAINT:
- SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_NOTIFYITEMDRAW);
- return TRUE;
-
- case CDDS_ITEMPREPAINT:
- ListView_GetItemRect(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec, &rc, LVIR_BOUNDS);
- if (!PtrIsValid(pItem)) {
- HFONT hBold, hFont;
- TCHAR szText[MAX_PATH];
-
- PSGetBoldFont(hDlg, hBold);
- hFont = (HFONT)SelectObject(cd->nmcd.hdc, hBold);
- SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_3DSHADOW));
- ProfileList_GetItemText(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec, 0, szText, MAX_PATH);
- rc.left += 6;
- DrawText(cd->nmcd.hdc, TranslateTS(szText), -1, &rc, DT_NOCLIP|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
-
- rc.bottom -= 2;
- rc.top = rc.bottom - 1;
- rc.left -= 6;
- DrawEdge(cd->nmcd.hdc, &rc, BDR_SUNKENOUTER, BF_RECT);
-
- SelectObject(cd->nmcd.hdc, hFont);
- SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
- return TRUE;
- }
- // draw selected item
- if ((cd->nmcd.uItemState & CDIS_SELECTED) || (pList->labelEdit.iItem == cd->nmcd.dwItemSpec)) {
- SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
- FillRect(cd->nmcd.hdc, &rc, GetSysColorBrush(COLOR_HIGHLIGHT));
- }
- // draw background of unselected item
- else {
- SetTextColor(cd->nmcd.hdc,
- (pItem->wFlags & CTRLF_CHANGED)
- ? clrChanged : (pItem->wFlags & CTRLF_HASMETA)
- ? clrMeta : ((pItem->wFlags & (CTRLF_HASCUSTOM)) && (pItem->wFlags & CTRLF_HASPROTO))
- ? clrBoth : (pItem->wFlags & CTRLF_HASCUSTOM)
- ? clrCustom : clrNormal);
- FillRect(cd->nmcd.hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
- }
- SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_NEWFONT|CDRF_NOTIFYSUBITEMDRAW);
- return TRUE;
-
- case CDDS_SUBITEM|CDDS_ITEMPREPAINT:
- {
- HFONT hoFont = (HFONT)SelectObject(cd->nmcd.hdc, pList->hFont);
-
- ListView_GetSubItemRect(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec, cd->iSubItem, LVIR_BOUNDS, &rc);
- if (cd->iSubItem == 0) {
- RECT rc2;
- ListView_GetSubItemRect(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec, 1, LVIR_BOUNDS, &rc2);
- rc.right = rc2.left;
- }
- rc.left += 3;
- DrawText(cd->nmcd.hdc,
- pItem->pszText[cd->iSubItem]
- ? pItem->pszText[cd->iSubItem]
- : (cd->iSubItem == 0 && pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount)
- ? pItem->idstrList[pItem->iListItem].ptszTranslated
- : TranslateT("<empty>"),
- -1, &rc, DT_END_ELLIPSIS|DT_NOCLIP|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
- SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
- return TRUE;
- }
- } /* switch (cd->nmcd.dwDrawStage) */
- break;
- } /* case NM_CUSTOMDRAW: */
- } /* (((LPNMHDR)lParam)->code) */
- break;
- }
- }
- break; /* case WM_NOTIFY: */
+ HFONT hoFont = (HFONT)SelectObject(cd->nmcd.hdc, pList->hFont);
- case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- case BTN_ADD_intEREST:
- return ProfileList_AddNewItem(hDlg, (LPLISTCTRL)GetUserData(hList), &pFmt[2]);
- case BTN_ADD_AFFLIATION:
- return ProfileList_AddNewItem(hDlg, (LPLISTCTRL)GetUserData(hList), &pFmt[1]);
- case BTN_ADD_PAST:
- return ProfileList_AddNewItem(hDlg, (LPLISTCTRL)GetUserData(hList), &pFmt[0]);
- case BTN_EDIT_CAT:
- ProfileList_BeginLabelEdit(hList, ListView_GetSelectionMark(hList), 0);
- break;
- case BTN_EDIT_VAL:
- ProfileList_BeginLabelEdit(hList, ListView_GetSelectionMark(hList), 1);
- break;
- case BTN_DEL:
- if (IDYES == MsgBox(hDlg, MB_YESNO|MB_ICON_QUESTION, LPGENT("Question"), LPGENT("Delete an entry"), LPGENT("Do you really want to delete this entry?"))) {
- INT iItem = ListView_GetSelectionMark(hList);
- LPLISTCTRL pList = (LPLISTCTRL)GetUserData(hList);
-
- ProfileList_DeleteItem(hList, iItem);
- if (PtrIsValid(pList)) pList->wFlags |= CTRLF_CHANGED;
- SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL);
- // check if to delete any devider
- if (!ProfileList_GetItemData(hList, iItem--) && !ProfileList_GetItemData(hList, iItem))
- ListView_DeleteItem(hList, iItem);
- }
+ ListView_GetSubItemRect(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec, cd->iSubItem, LVIR_BOUNDS, &rc);
+ if (cd->iSubItem == 0) {
+ RECT rc2;
+ ListView_GetSubItemRect(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec, 1, LVIR_BOUNDS, &rc2);
+ rc.right = rc2.left;
+ }
+ rc.left += 3;
+ DrawText(cd->nmcd.hdc,
+ pItem->pszText[cd->iSubItem]
+ ? pItem->pszText[cd->iSubItem]
+ : (cd->iSubItem == 0 && pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount)
+ ? pItem->idstrList[pItem->iListItem].ptszTranslated
+ : TranslateT("<empty>"),
+ -1, &rc, DT_END_ELLIPSIS|DT_NOCLIP|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
+ return TRUE;
+ }
+ } /* switch (cd->nmcd.dwDrawStage) */
break;
+ } /* case NM_CUSTOMDRAW: */
+ } /* (((LPNMHDR)lParam)->code) */
+ break;
+ }
+ break; /* case WM_NOTIFY: */
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case BTN_ADD_intEREST:
+ return ProfileList_AddNewItem(hDlg, (LPLISTCTRL)GetUserData(hList), &pFmt[2]);
+ case BTN_ADD_AFFLIATION:
+ return ProfileList_AddNewItem(hDlg, (LPLISTCTRL)GetUserData(hList), &pFmt[1]);
+ case BTN_ADD_PAST:
+ return ProfileList_AddNewItem(hDlg, (LPLISTCTRL)GetUserData(hList), &pFmt[0]);
+ case BTN_EDIT_CAT:
+ ProfileList_BeginLabelEdit(hList, ListView_GetSelectionMark(hList), 0);
+ break;
+ case BTN_EDIT_VAL:
+ ProfileList_BeginLabelEdit(hList, ListView_GetSelectionMark(hList), 1);
+ break;
+ case BTN_DEL:
+ if (IDYES == MsgBox(hDlg, MB_YESNO|MB_ICON_QUESTION, LPGENT("Question"), LPGENT("Delete an entry"), LPGENT("Do you really want to delete this entry?"))) {
+ INT iItem = ListView_GetSelectionMark(hList);
+ pList = (LPLISTCTRL)GetUserData(hList);
+
+ ProfileList_DeleteItem(hList, iItem);
+ if (PtrIsValid(pList)) pList->wFlags |= CTRLF_CHANGED;
+ SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL);
+ // check if to delete any devider
+ if (!ProfileList_GetItemData(hList, iItem--) && !ProfileList_GetItemData(hList, iItem))
+ ListView_DeleteItem(hList, iItem);
}
break;
}
+ break;
}
return FALSE;
}
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index cff8e60871..ac4ecaf702 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -37,7 +37,6 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM extern HINSTANCE hInst;
extern HCURSOR hCurSplitNS;
-static WNDPROC OldSplitterProc;
static HWND hwndHelpDialog = NULL;
@@ -618,7 +617,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, ReleaseCapture();
return 0;
}
- return CallWindowProc(OldSplitterProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
struct INPUTDLGDATA
@@ -683,7 +682,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM dat->splitterPos = dat->originalSplitterPos;
GetWindowRect(GetDlgItem(hwndDlg, IDC_SHOWHELP), &rc);
- OldSplitterProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_SPLITTER), SplitterSubclassProc);
GetWindowRect(GetDlgItem(hwndDlg, IDC_TESTSTRING), &rc);
dat->minInputSize.x = rc.right - rc.left;
@@ -809,7 +808,6 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM case WM_DESTROY:
KillTimer(hwndDlg, IDT_PARSE);
db_set_dw(NULL, MODULENAME, SETTING_SPLITTERPOS, dat->splitterPos);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) OldSplitterProc);
if (dat != NULL) {
mir_free(dat);
dat = NULL;
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index e5ae0fba46..b464e320f7 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -29,8 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define UPCOMING_TIMER_ID 1002
-static WNDPROC OldBirthdaysListProc = NULL;
-
const TCHAR *szShowAgeMode[] = { LPGENT("Upcoming age"), LPGENT("Current age")};
const int cShowAgeMode = sizeof(szShowAgeMode) / sizeof(szShowAgeMode[0]);
@@ -647,7 +645,7 @@ int UpdateBirthdayEntry(HWND hList, HANDLE hContact, int entry, int bShowAll, in return res;
}
-INT_PTR CALLBACK BirthdaysListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK BirthdaysListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_KEYUP:
@@ -677,7 +675,7 @@ INT_PTR CALLBACK BirthdaysListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, L break;
}
}
- return CallWindowProc(OldBirthdaysListProc, hWnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hWnd, BirthdaysListSubclassProc, msg, wParam, lParam);
}
void SetBirthdaysCount(HWND hWnd)
@@ -714,7 +712,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
- OldBirthdaysListProc = (WNDPROC) SetWindowLongPtr(hList, GWLP_WNDPROC, (LONG_PTR) BirthdaysListSubclassProc);
+ mir_subclassWindow(hList, BirthdaysListSubclassProc);
LVCOLUMN col;
col.mask = LVCF_TEXT | LVCF_WIDTH;
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index 270fe2e31f..cdbb4e2d3c 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -33,8 +33,6 @@ int HeadSplitPos=250; // per-mils of the size static int FromWidth=250,SubjectWidth=280,SizeWidth=50,SizeDate=205;
unsigned char optDateTime = (SHOWDATELONG | SHOWDATENOTODAY);
-static WNDPROC OldListViewSubclassProc;
-
struct CMailNumbersSub
{
int Total; //any mail
@@ -819,13 +817,10 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR sprintf(tmp,Translate("%d new mail message(s), %d total"),MN->Real.PopUpNC+MN->Virtual.PopUpNC,MN->Real.PopUpTC+MN->Virtual.PopUpTC);
DBWriteContactSettingString(ActualAccount->hContact, "CList", "StatusMsg", tmp);
}
- else
- DBWriteContactSettingString(ActualAccount->hContact, "CList", "StatusMsg", Translate("No new mail message"));
+ else DBWriteContactSettingString(ActualAccount->hContact, "CList", "StatusMsg", Translate("No new mail message"));
if (nflags & YAMN_ACC_CONTNICK)
- {
DBWriteContactSettingString(ActualAccount->hContact, YAMN_DBMODULE, "Nick", ActualAccount->Name);
- }
}
}
return;
@@ -1278,51 +1273,51 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2,LPARAM lParamSor }
HCURSOR hCurSplitNS, hCurSplitWE;
-static WNDPROC OldSplitterProc;
#define DM_SPLITTERMOVED (WM_USER+15)
+
static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_NCHITTEST:
- return HTCLIENT;
- case WM_SETCURSOR:
- {
- SetCursor(hCurSplitNS);
- return TRUE;
+ case WM_NCHITTEST:
+ return HTCLIENT;
+
+ case WM_SETCURSOR:
+ SetCursor(hCurSplitNS);
+ return TRUE;
+
+ case WM_LBUTTONDOWN:
+ SetCapture(hwnd);
+ return 0;
+
+ case WM_MOUSEMOVE:
+ if (GetCapture() == hwnd) {
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+ SendMessage(GetParent(hwnd), DM_SPLITTERMOVED, (short) HIWORD(GetMessagePos()) + rc.bottom / 2, (LPARAM) hwnd);
}
- case WM_LBUTTONDOWN:
- SetCapture(hwnd);
- return 0;
- case WM_MOUSEMOVE:
- if (GetCapture() == hwnd) {
- RECT rc;
- GetClientRect(hwnd, &rc);
- SendMessage(GetParent(hwnd), DM_SPLITTERMOVED, (short) HIWORD(GetMessagePos()) + rc.bottom / 2, (LPARAM) hwnd);
- }
- return 0;
- case WM_LBUTTONUP:
- ReleaseCapture();
- return 0;
+ return 0;
+
+ case WM_LBUTTONUP:
+ ReleaseCapture();
+ return 0;
}
- return CallWindowProc(OldSplitterProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
-
void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode);
int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out);
+
INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
- {
- case WM_INITDIALOG:
+ switch(msg) {
+ case WM_INITDIALOG:
{
-// HIMAGELIST hIcons;
PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM)lParam;
WCHAR *iHeaderW=NULL;
WCHAR *iValueW=NULL;
int StrLen;
HWND hListView = GetDlgItem(hDlg,IDC_LISTHEADERS);
- OldSplitterProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
+ mir_subclassWindow(GetDlgItem(hDlg, IDC_SPLITTER), SplitterSubclassProc);
SetWindowLongPtr(hDlg,DWLP_USER,(LONG_PTR)MailParam);
SendMessageW(hDlg,WM_SETICON,(WPARAM)ICON_BIG,(LPARAM)g_LoadIconEx(2, true));
SendMessageW(hDlg,WM_SETICON,(WPARAM)ICON_SMALL,(LPARAM)g_LoadIconEx(2));
@@ -1352,10 +1347,11 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM SendMessage(hDlg,WM_YAMN_CHANGECONTENT,0,(LPARAM)MailParam);
MoveWindow(hDlg,HeadPosX,HeadPosY,HeadSizeX,HeadSizeY,0);
ShowWindow(hDlg,SW_SHOWNORMAL);
- break;
}
- case WM_YAMN_CHANGECONTENT:
- {
+ break;
+
+ case WM_YAMN_CHANGECONTENT:
+ {
PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM)
(lParam?lParam:GetWindowLongPtr(hDlg,DWLP_USER));
HWND hListView = GetDlgItem(hDlg,IDC_LISTHEADERS);
@@ -1406,11 +1402,11 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM while (str2[ofs]) {
if ((str2[ofs]==0x266A)||(str2[ofs]==0x25D9)||(str2[ofs]==0x25CB)||
(str2[ofs]==0x09)||(str2[ofs]==0x0A)||(str2[ofs]==0x0D)) {
- if (str2[ofs-1]) {
- count++;
- }
- split[count]=(WCHAR *)(str2+ofs+1);
- str2[ofs]=0;
+ if (str2[ofs-1]) {
+ count++;
+ }
+ split[count]=(WCHAR *)(str2+ofs+1);
+ str2[ofs]=0;
}
ofs++;
};
@@ -1498,8 +1494,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM // turn on redrawing
SendMessage(hListView, WM_SETREDRAW, 1, 0);
SendMessage(hDlg, WM_SIZE, 0, HeadSizeY<<16|HeadSizeX);
- } break;
- case WM_YAMN_STOPACCOUNT:
+ } break;
+
+ case WM_YAMN_STOPACCOUNT:
{
PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM)
(lParam?lParam:GetWindowLongPtr(hDlg,DWLP_USER));
@@ -1508,23 +1505,24 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM break;
if ((HACCOUNT)wParam != MailParam->account)
break;
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ShowMessage:STOPACCOUNT:sending destroy msg\n");
- #endif
+#endif
DestroyWindow(hDlg);
}
- return 1;
- case WM_CTLCOLORSTATIC:
- //here should be check if this is our edittext control.
- //but we have only one static control (for now);
- SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
- SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
- return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);;
- case WM_DESTROY:
+ return 1;
+
+ case WM_CTLCOLORSTATIC:
+ //here should be check if this is our edittext control.
+ //but we have only one static control (for now);
+ SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+ SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
+ return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);;
+
+ case WM_DESTROY:
{
RECT coord;
- if (GetWindowRect(hDlg,&coord))
- {
+ if (GetWindowRect(hDlg,&coord)) {
HeadPosX=coord.left;
HeadSizeX=coord.right-coord.left;
HeadPosY=coord.top;
@@ -1534,112 +1532,109 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM PostQuitMessage(1);
}
break;
- case WM_SYSCOMMAND:
- {
- switch(wParam)
- {
- case SC_CLOSE:
- DestroyWindow(hDlg);
- break;
- }
+
+ case WM_SYSCOMMAND:
+ switch(wParam) {
+ case SC_CLOSE:
+ DestroyWindow(hDlg);
+ break;
}
break;
- case WM_MOVE:
- HeadPosX=LOWORD(lParam); //((LPRECT)lParam)->right-((LPRECT)lParam)->left;
- HeadPosY=HIWORD(lParam); //((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
- return 0;
- case DM_SPLITTERMOVED:
- {
- if ((HWND) lParam == GetDlgItem(hDlg, IDC_SPLITTER)) {
- POINT pt;
- pt.x = 0;
- pt.y = wParam;
- ScreenToClient(hDlg, &pt);
- HeadSplitPos = (pt.y*1000)/HeadSizeY;//+rc.bottom-rc.top;
- if (HeadSplitPos>=1000) HeadSplitPos = 999;
- else if (HeadSplitPos<=0) HeadSplitPos = 1;
- else SendMessage(hDlg, WM_SIZE, 0, HeadSizeY<<16|HeadSizeX);
- }
- return 0;
- }
- case WM_SIZE:
- if (wParam==SIZE_RESTORED)
- {
- HWND hList = GetDlgItem(hDlg,IDC_LISTHEADERS);
- HWND hEdit = GetDlgItem(hDlg,IDC_EDITBODY);
- BOOL changeX = LOWORD(lParam) != HeadSizeX;
- BOOL isBodyShown = ((PYAMN_MAILSHOWPARAM)(GetWindowLongPtr(hDlg,DWLP_USER)))->mail->Flags & YAMN_MSG_BODYRECEIVED;
- HeadSizeX=LOWORD(lParam); //((LPRECT)lParam)->right-((LPRECT)lParam)->left;
- HeadSizeY=HIWORD(lParam); //((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
- int localSplitPos = (HeadSplitPos*HeadSizeY)/1000;
- int localSizeX;
- RECT coord;
- MoveWindow(GetDlgItem(hDlg,IDC_SPLITTER),5,localSplitPos,HeadSizeX-10,2,TRUE);
- MoveWindow(hEdit,5,localSplitPos+6,HeadSizeX-10,HeadSizeY-localSplitPos-11,TRUE); //where to put text window while resizing
- MoveWindow(hList, 5 ,5 ,HeadSizeX-10 ,(isBodyShown?localSplitPos:HeadSizeY)-10,TRUE); //where to put headers list window while resizing
- //if (changeX) {
- if (GetClientRect(hList,&coord)) {
- localSizeX=coord.right-coord.left;
- } else localSizeX=HeadSizeX;
- LONG iNameWidth = ListView_GetColumnWidth(hList,0);
- ListView_SetColumnWidth(hList,1,(localSizeX<=iNameWidth)?0:(localSizeX-iNameWidth));
- //}
- }
-// break;
- return 0;
- case WM_CONTEXTMENU:
- {
- if ( GetWindowLongPtr(( HWND )wParam, GWLP_ID ) == IDC_LISTHEADERS) {
- //MessageBox(0,"LISTHEADERS","Debug",0);
- HWND hList = GetDlgItem( hDlg, IDC_LISTHEADERS );
- POINT pt = { (signed short)LOWORD( lParam ), (signed short)HIWORD( lParam ) };
- HTREEITEM hItem = 0;
- if (pt.x==-1) pt.x = 0;
- if (pt.y==-1) pt.y = 0;
- if (int numRows = ListView_GetItemCount(hList)) {
- HMENU hMenu = CreatePopupMenu();
- AppendMenu(hMenu, MF_STRING, (UINT_PTR)1, TranslateT("Copy Selected"));
- AppendMenu(hMenu, MF_STRING, (UINT_PTR)2, TranslateT("Copy All"));
- AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
- AppendMenu(hMenu, MF_STRING, (UINT_PTR)0, TranslateT("Cancel"));
- int nReturnCmd = TrackPopupMenu( hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL );
- DestroyMenu( hMenu );
- if (nReturnCmd>0) {
- int courRow=0;
- size_t sizeNeeded = 0;
- TCHAR headname[64]={0}, headvalue[256]={0};
- for (courRow=0; courRow < numRows; courRow++) {
- if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
- ListView_GetItemText(hList, courRow, 0, headname, SIZEOF(headname));
- ListView_GetItemText(hList, courRow, 1, headvalue, SIZEOF(headvalue));
- size_t headnamelen = _tcslen(headname);
- if (headnamelen) sizeNeeded += 1 + headnamelen;
- sizeNeeded += 3 + _tcslen(headvalue);
- }
- if (sizeNeeded && OpenClipboard(hDlg)) {
- EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE,(sizeNeeded+1)*sizeof(TCHAR));
- TCHAR *buff = ( TCHAR* )GlobalLock(hData);
- int courPos = 0;
- for (courRow=0;courRow<numRows;courRow++) {
- if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
- ListView_GetItemText(hList, courRow, 0, headname, SIZEOF(headname));
- ListView_GetItemText(hList, courRow, 1, headvalue, SIZEOF(headvalue));
- if ( _tcslen(headname)) courPos += _stprintf(&buff[courPos], _T("%s:\t%s\r\n"), headname, headvalue);
- else courPos += _stprintf( &buff[courPos], _T("\t%s\r\n"), headvalue);
- }
- GlobalUnlock(hData);
- #if defined( _UNICODE )
- SetClipboardData(CF_UNICODETEXT,hData);
- #else
- SetClipboardData(CF_TEXT,hData);
- #endif
- CloseClipboard();
- }
+
+ case WM_MOVE:
+ HeadPosX=LOWORD(lParam); //((LPRECT)lParam)->right-((LPRECT)lParam)->left;
+ HeadPosY=HIWORD(lParam); //((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
+ return 0;
+
+ case DM_SPLITTERMOVED:
+ if ((HWND) lParam == GetDlgItem(hDlg, IDC_SPLITTER)) {
+ POINT pt;
+ pt.x = 0;
+ pt.y = wParam;
+ ScreenToClient(hDlg, &pt);
+ HeadSplitPos = (pt.y*1000)/HeadSizeY;//+rc.bottom-rc.top;
+ if (HeadSplitPos>=1000) HeadSplitPos = 999;
+ else if (HeadSplitPos<=0) HeadSplitPos = 1;
+ else SendMessage(hDlg, WM_SIZE, 0, HeadSizeY<<16|HeadSizeX);
+ }
+ return 0;
+
+ case WM_SIZE:
+ if (wParam == SIZE_RESTORED) {
+ HWND hList = GetDlgItem(hDlg,IDC_LISTHEADERS);
+ HWND hEdit = GetDlgItem(hDlg,IDC_EDITBODY);
+ BOOL changeX = LOWORD(lParam) != HeadSizeX;
+ BOOL isBodyShown = ((PYAMN_MAILSHOWPARAM)(GetWindowLongPtr(hDlg,DWLP_USER)))->mail->Flags & YAMN_MSG_BODYRECEIVED;
+ HeadSizeX=LOWORD(lParam); //((LPRECT)lParam)->right-((LPRECT)lParam)->left;
+ HeadSizeY=HIWORD(lParam); //((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
+ int localSplitPos = (HeadSplitPos*HeadSizeY)/1000;
+ int localSizeX;
+ RECT coord;
+ MoveWindow(GetDlgItem(hDlg,IDC_SPLITTER),5,localSplitPos,HeadSizeX-10,2,TRUE);
+ MoveWindow(hEdit,5,localSplitPos+6,HeadSizeX-10,HeadSizeY-localSplitPos-11,TRUE); //where to put text window while resizing
+ MoveWindow(hList, 5 ,5 ,HeadSizeX-10 ,(isBodyShown?localSplitPos:HeadSizeY)-10,TRUE); //where to put headers list window while resizing
+ //if (changeX) {
+ if (GetClientRect(hList,&coord)) {
+ localSizeX=coord.right-coord.left;
+ } else localSizeX=HeadSizeX;
+ LONG iNameWidth = ListView_GetColumnWidth(hList,0);
+ ListView_SetColumnWidth(hList,1,(localSizeX<=iNameWidth)?0:(localSizeX-iNameWidth));
+ //}
+ }
+ return 0;
+
+ case WM_CONTEXTMENU:
+ if ( GetWindowLongPtr(( HWND )wParam, GWLP_ID ) == IDC_LISTHEADERS) {
+ //MessageBox(0,"LISTHEADERS","Debug",0);
+ HWND hList = GetDlgItem( hDlg, IDC_LISTHEADERS );
+ POINT pt = { (signed short)LOWORD( lParam ), (signed short)HIWORD( lParam ) };
+ HTREEITEM hItem = 0;
+ if (pt.x==-1) pt.x = 0;
+ if (pt.y==-1) pt.y = 0;
+ if (int numRows = ListView_GetItemCount(hList)) {
+ HMENU hMenu = CreatePopupMenu();
+ AppendMenu(hMenu, MF_STRING, (UINT_PTR)1, TranslateT("Copy Selected"));
+ AppendMenu(hMenu, MF_STRING, (UINT_PTR)2, TranslateT("Copy All"));
+ AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hMenu, MF_STRING, (UINT_PTR)0, TranslateT("Cancel"));
+ int nReturnCmd = TrackPopupMenu( hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL );
+ DestroyMenu( hMenu );
+ if (nReturnCmd>0) {
+ int courRow=0;
+ size_t sizeNeeded = 0;
+ TCHAR headname[64]={0}, headvalue[256]={0};
+ for (courRow=0; courRow < numRows; courRow++) {
+ if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
+ ListView_GetItemText(hList, courRow, 0, headname, SIZEOF(headname));
+ ListView_GetItemText(hList, courRow, 1, headvalue, SIZEOF(headvalue));
+ size_t headnamelen = _tcslen(headname);
+ if (headnamelen) sizeNeeded += 1 + headnamelen;
+ sizeNeeded += 3 + _tcslen(headvalue);
+ }
+ if (sizeNeeded && OpenClipboard(hDlg)) {
+ EmptyClipboard();
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE,(sizeNeeded+1)*sizeof(TCHAR));
+ TCHAR *buff = ( TCHAR* )GlobalLock(hData);
+ int courPos = 0;
+ for (courRow=0;courRow<numRows;courRow++) {
+ if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
+ ListView_GetItemText(hList, courRow, 0, headname, SIZEOF(headname));
+ ListView_GetItemText(hList, courRow, 1, headvalue, SIZEOF(headvalue));
+ if ( _tcslen(headname)) courPos += _stprintf(&buff[courPos], _T("%s:\t%s\r\n"), headname, headvalue);
+ else courPos += _stprintf( &buff[courPos], _T("\t%s\r\n"), headvalue);
}
+ GlobalUnlock(hData);
+#if defined( _UNICODE )
+ SetClipboardData(CF_UNICODETEXT,hData);
+#else
+ SetClipboardData(CF_TEXT,hData);
+#endif
+ CloseClipboard();
}
- } }
- break; // just in case
+ }
+ }
+ }
+ break; // just in case
}
return 0;
}
@@ -1687,9 +1682,8 @@ CREADTEVIEWMESSAGEWINDOW: INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
- {
- case WM_INITDIALOG:
+ switch(msg) {
+ case WM_INITDIALOG:
{
HACCOUNT ActualAccount;
struct MailBrowserWinParam *MyParam=(struct MailBrowserWinParam *)lParam;
@@ -1707,20 +1701,20 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM mwui->RunFirstTime=TRUE;
SetWindowLongPtr(hDlg,DWLP_USER,(LONG_PTR)mwui);
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:INIT:ActualAccountSO-read wait\n");
- #endif
+#endif
if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO))
{
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:INIT:ActualAccountSO-read enter failed\n");
- #endif
+#endif
DestroyWindow(hDlg);
return FALSE;
}
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:INIT:ActualAccountSO-read enter\n");
- #endif
+#endif
SendMessageW(GetDlgItem(hDlg,IDC_BTNAPP),WM_SETTEXT,0,(LPARAM)TranslateW(L"Run application"));
SendMessageW(GetDlgItem(hDlg,IDC_BTNDEL),WM_SETTEXT,0,(LPARAM)TranslateW(L"Delete selected"));
@@ -1740,9 +1734,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM EnableWindow(GetDlgItem(hDlg,IDC_BTNAPP),(WPARAM)TRUE);
else
EnableWindow(GetDlgItem(hDlg,IDC_BTNAPP),(WPARAM)FALSE);
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:INIT:ActualAccountSO-read done\n");
- #endif
+#endif
ReadDoneFcn(ActualAccount->AccountAccessSO);
WindowList_Add(YAMNVar.MessageWnds,hDlg,NULL);
@@ -1756,15 +1750,13 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM SetTimer(hDlg,TIMER_FLASHING,500,NULL);
if (ActualAccount->hContact != NULL)
- {
CallService(MS_CLIST_REMOVEEVENT,(WPARAM)ActualAccount->hContact,(LPARAM)"yamn new mail message");
- }
- OldListViewSubclassProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hDlg, IDC_LISTMAILS), GWLP_WNDPROC, (LONG_PTR) ListViewSubclassProc);
-
- break;
+ mir_subclassWindow( GetDlgItem(hDlg, IDC_LISTMAILS), ListViewSubclassProc);
}
- case WM_DESTROY:
+ break;
+
+ case WM_DESTROY:
{
HACCOUNT ActualAccount;
RECT coord;
@@ -1786,9 +1778,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM if (ListView_GetColumn(GetDlgItem(hDlg,IDC_LISTMAILS),3,&ColInfo))
SizeDate=ColInfo.cx;
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:DESTROY:save window position\n");
- #endif
+#ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"MailBrowser:DESTROY:save window position\n");
+#endif
if (!YAMNVar.Shutdown && GetWindowRect(hDlg,&coord)) //the YAMNVar.Shutdown testing is because M<iranda strange functionality at shutdown phase, when call to DBWriteContactSetting freezes calling thread
{
PosX=coord.left;
@@ -1802,25 +1794,25 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM }
KillTimer(hDlg,TIMER_FLASHING);
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DESTROY:remove window from list\n");
- #endif
+#endif
WindowList_Remove(YAMNVar.NewMailAccountWnd,hDlg);
WindowList_Remove(YAMNVar.MessageWnds,hDlg);
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DESTROY:ActualAccountMsgsSO-write wait\n");
- #endif
+#endif
if (WAIT_OBJECT_0 != WaitToWriteFcn(ActualAccount->MessagesAccessSO))
{
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DESTROY:ActualAccountMsgsSO-write wait failed\n");
- #endif
+#endif
break;
}
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DESTROY:ActualAccountMsgsSO-write enter\n");
- #endif
+#endif
//delete mails from queue, which are deleted from server (spam level 3 mails e.g.)
for (Parser=(HYAMNMAIL)ActualAccount->Mails;Parser != NULL;Parser=Parser->Next)
{
@@ -1834,9 +1826,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM //mark mails as read (remove "new" and "unseen" flags)
if (mwui->Seen)
SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails,YAMN_MSG_DISPLAY,0,YAMN_MSG_NEW | YAMN_MSG_UNSEEN,0);
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DESTROY:ActualAccountMsgsSO-write done\n");
- #endif
+#endif
WriteDoneFcn(ActualAccount->MessagesAccessSO);
ZeroMemory(&nid,sizeof(NOTIFYICONDATA));
@@ -1850,8 +1842,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM Shell_NotifyIcon(NIM_DELETE,&nid);
PostQuitMessage(0);
}
- break;
- case WM_SHOWWINDOW:
+ break;
+ case WM_SHOWWINDOW:
{
struct CMailWinUserInfo *mwui;
@@ -1859,7 +1851,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM return 0;
mwui->Seen=TRUE;
}
- case WM_YAMN_CHANGESTATUS:
+ case WM_YAMN_CHANGESTATUS:
{
HACCOUNT ActualAccount;
if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
@@ -1872,8 +1864,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM GetStatusFcn(ActualAccount,accstatus);
SetDlgItemText(hDlg,IDC_STSTATUS,accstatus);
}
- return 1;
- case WM_YAMN_CHANGECONTENT:
+ return 1;
+ case WM_YAMN_CHANGECONTENT:
{
struct CUpdateMails UpdateParams;
BOOL ThisThreadWindow=(GetCurrentThreadId()==GetWindowThreadProcessId(hDlg,NULL));
@@ -1886,9 +1878,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM UpdateParams.Flags=(struct CChangeContent *)lParam;
UpdateParams.Waiting=!ThisThreadWindow;
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:CHANGECONTENT:posting UPDATEMAILS\n");
- #endif
+#endif
if (ThisThreadWindow)
{
if (!UpdateMails(hDlg,(HACCOUNT)wParam,UpdateParams.Flags->nflags,UpdateParams.Flags->nnflags))
@@ -1898,29 +1890,29 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM {
if (!ThisThreadWindow)
{
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:CHANGECONTENT:waiting for event\n");
- #endif
+#endif
WaitForSingleObject(UpdateParams.Copied,INFINITE);
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:CHANGECONTENT:event signaled\n");
- #endif
+#endif
}
}
CloseHandle(UpdateParams.Copied);
}
- return 1;
- case WM_YAMN_UPDATEMAILS:
+ return 1;
+ case WM_YAMN_UPDATEMAILS:
{
HACCOUNT ActualAccount;
struct CUpdateMails *um=(struct CUpdateMails *)lParam;
DWORD nflags,nnflags;
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:UPDATEMAILS\n");
- #endif
+#endif
if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
return 0;
@@ -1936,8 +1928,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM if (!UpdateMails(hDlg,ActualAccount,nflags,nnflags))
DestroyWindow(hDlg);
}
- return 1;
- case WM_YAMN_STOPACCOUNT:
+ return 1;
+ case WM_YAMN_STOPACCOUNT:
{
HACCOUNT ActualAccount;
@@ -1945,13 +1937,13 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM break;
if ((HACCOUNT)wParam != ActualAccount)
break;
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:STOPACCOUNT:sending destroy msg\n");
- #endif
+#endif
PostQuitMessage(0);
}
- return 1;
- case WM_YAMN_NOTIFYICON:
+ return 1;
+ case WM_YAMN_NOTIFYICON:
{
HACCOUNT ActualAccount;
if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
@@ -1959,36 +1951,36 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM switch(lParam)
{
- case WM_LBUTTONDBLCLK:
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:DBLCLICKICON:ActualAccountSO-read wait\n");
- #endif
- if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO))
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:DBLCLICKICON:ActualAccountSO-read wait failed\n");
- #endif
- return 0;
- }
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:DBLCLICKICON:ActualAccountSO-read enter\n");
- #endif
- if (ActualAccount->AbilityFlags & YAMN_ACC_BROWSE)
- {
- ShowWindow(hDlg,SW_SHOWNORMAL);
- SetForegroundWindow(hDlg);
- }
- else
- DestroyWindow(hDlg);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:DBLCLICKICON:ActualAccountSO-read done\n");
- #endif
- ReadDoneFcn(ActualAccount->AccountAccessSO);
- break;
+ case WM_LBUTTONDBLCLK:
+#ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"MailBrowser:DBLCLICKICON:ActualAccountSO-read wait\n");
+#endif
+ if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO))
+ {
+#ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"MailBrowser:DBLCLICKICON:ActualAccountSO-read wait failed\n");
+#endif
+ return 0;
+ }
+#ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"MailBrowser:DBLCLICKICON:ActualAccountSO-read enter\n");
+#endif
+ if (ActualAccount->AbilityFlags & YAMN_ACC_BROWSE)
+ {
+ ShowWindow(hDlg,SW_SHOWNORMAL);
+ SetForegroundWindow(hDlg);
+ }
+ else
+ DestroyWindow(hDlg);
+#ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"MailBrowser:DBLCLICKICON:ActualAccountSO-read done\n");
+#endif
+ ReadDoneFcn(ActualAccount->AccountAccessSO);
+ break;
}
break;
}
- case WM_YAMN_SHOWSELECTED:
+ case WM_YAMN_SHOWSELECTED:
{
int iSelect;
iSelect=SendMessage(GetDlgItem(hDlg,IDC_LISTMAILS),LVM_GETNEXTITEM,-1,MAKELPARAM((UINT)LVNI_FOCUSED,0)); // return item selected
@@ -2023,7 +2015,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM }
}
} break;
- case WM_SYSCOMMAND:
+ case WM_SYSCOMMAND:
{
HACCOUNT ActualAccount;
@@ -2031,14 +2023,14 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM break;
switch(wParam)
{
- case SC_CLOSE:
- DestroyWindow(hDlg);
- break;
+ case SC_CLOSE:
+ DestroyWindow(hDlg);
+ break;
}
}
- break;
+ break;
- case WM_COMMAND:
+ case WM_COMMAND:
{
HACCOUNT ActualAccount;
int Items;
@@ -2048,20 +2040,20 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM switch(LOWORD(wParam))
{
- case IDC_BTNCHECKALL:
- ListView_SetItemState(GetDlgItem(hDlg,IDC_LISTMAILS), -1, 0, LVIS_SELECTED); // deselect all items
- ListView_SetItemState(GetDlgItem(hDlg,IDC_LISTMAILS),-1, LVIS_SELECTED ,LVIS_SELECTED);
- Items = ListView_GetItemCount(GetDlgItem(hDlg,IDC_LISTMAILS));
- ListView_RedrawItems(GetDlgItem(hDlg,IDC_LISTMAILS), 0, Items);
- UpdateWindow(GetDlgItem(hDlg,IDC_LISTMAILS));
- SetFocus(GetDlgItem(hDlg,IDC_LISTMAILS));
- break;
+ case IDC_BTNCHECKALL:
+ ListView_SetItemState(GetDlgItem(hDlg,IDC_LISTMAILS), -1, 0, LVIS_SELECTED); // deselect all items
+ ListView_SetItemState(GetDlgItem(hDlg,IDC_LISTMAILS),-1, LVIS_SELECTED ,LVIS_SELECTED);
+ Items = ListView_GetItemCount(GetDlgItem(hDlg,IDC_LISTMAILS));
+ ListView_RedrawItems(GetDlgItem(hDlg,IDC_LISTMAILS), 0, Items);
+ UpdateWindow(GetDlgItem(hDlg,IDC_LISTMAILS));
+ SetFocus(GetDlgItem(hDlg,IDC_LISTMAILS));
+ break;
- case IDC_BTNOK:
- DestroyWindow(hDlg);
- break;
+ case IDC_BTNOK:
+ DestroyWindow(hDlg);
+ break;
- case IDC_BTNAPP:
+ case IDC_BTNAPP:
{
PROCESS_INFORMATION pi;
STARTUPINFOW si;
@@ -2069,14 +2061,14 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM ZeroMemory(&si,sizeof(si));
si.cb=sizeof(si);
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNAPP:ActualAccountSO-read wait\n");
- #endif
+#endif
if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
{
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNAPP:ActualAccountSO-read enter\n");
- #endif
+#endif
if (ActualAccount->NewMailN.App != NULL)
{
WCHAR *Command;
@@ -2084,7 +2076,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM Command=new WCHAR[wcslen(ActualAccount->NewMailN.App)+wcslen(ActualAccount->NewMailN.AppParam)+6];
else
Command=new WCHAR[wcslen(ActualAccount->NewMailN.App)+6];
-
+
if (Command != NULL)
{
lstrcpyW(Command,L"\"");
@@ -2097,21 +2089,21 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM }
}
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNAPP:ActualAccountSO-read done\n");
- #endif
+#endif
ReadDoneFcn(ActualAccount->AccountAccessSO);
}
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
else
DebugLog(SynchroFile,"MailBrowser:BTNAPP:ActualAccountSO-read enter failed\n");
- #endif
+#endif
if (!(GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000))
DestroyWindow(hDlg);
}
- break;
- case IDC_BTNDEL:
+ break;
+ case IDC_BTNDEL:
{
LVITEMW item;
HYAMNMAIL FirstMail=NULL,ActualMail;
@@ -2124,14 +2116,14 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM int Items=ListView_GetItemCount(GetDlgItem(hDlg,IDC_LISTMAILS));
item.stateMask=0xFFFFFFFF;
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write wait\n");
- #endif
+#endif
if (WAIT_OBJECT_0==WaitToWriteFcn(ActualAccount->MessagesAccessSO))
{
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write enter\n");
- #endif
+#endif
for (int i=0;i<Items;i++)
{
item.iItem=i;
@@ -2150,9 +2142,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM }
// Enable write-access to mails
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write done\n");
- #endif
+#endif
WriteDoneFcn(ActualAccount->MessagesAccessSO);
if (Total)
@@ -2165,14 +2157,14 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM struct DeleteParam ParamToDeleteMails={YAMN_DELETEVERSION,ThreadRunningEV,ActualAccount,NULL};
// Find if there's mail marked to delete, which was deleted before
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write wait\n");
- #endif
+#endif
if (WAIT_OBJECT_0==WaitToWriteFcn(ActualAccount->MessagesAccessSO))
{
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write enter\n");
- #endif
+#endif
for (ActualMail=(HYAMNMAIL)ActualAccount->Mails;ActualMail != NULL;ActualMail=ActualMail->Next)
{
if ((ActualMail->Flags & YAMN_MSG_DELETED) && ((ActualMail->Flags & YAMN_MSG_USERDELETE))) //if selected mail was already deleted
@@ -2193,9 +2185,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM CloseHandle(NewThread);
}
// Enable write-access to mails
- #ifdef DEBUG_SYNCHRO
+#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write done\n");
- #endif
+#endif
WriteDoneFcn(ActualAccount->MessagesAccessSO);
}
}
@@ -2212,26 +2204,26 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM break;
}
}
- break;
- case WM_SIZE:
- if (wParam==SIZE_RESTORED)
- {
- LONG x=LOWORD(lParam); //((LPRECT)lParam)->right-((LPRECT)lParam)->left;
- LONG y=HIWORD(lParam); //((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
- MoveWindow(GetDlgItem(hDlg,IDC_BTNDEL), 5 ,y-5-25,(x-20)/3,25,TRUE); //where to put DELETE button while resizing
- MoveWindow(GetDlgItem(hDlg,IDC_BTNCHECKALL),10+ (x-20)/3,y-5-25,(x-20)/6,25,TRUE); //where to put CHECK ALL button while resizing
- MoveWindow(GetDlgItem(hDlg,IDC_BTNAPP), 15+ (x-20)/3 + (x-20)/6,y-5-25,(x-20)/3,25,TRUE); //where to put RUN APP button while resizing
- MoveWindow(GetDlgItem(hDlg,IDC_BTNOK), 20+2*(x-20)/3 + (x-20)/6 ,y-5-25,(x-20)/6,25,TRUE); //where to put OK button while resizing
- MoveWindow(GetDlgItem(hDlg,IDC_LISTMAILS), 5 ,5 ,x-10 ,y-55,TRUE); //where to put list mail window while resizing
- MoveWindow(GetDlgItem(hDlg,IDC_STSTATUS), 5 ,y-5-45 ,x-10 ,15,TRUE); //where to put account status text while resizing
- }
-// break;
- return 0;
- case WM_GETMINMAXINFO:
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.x=MAILBROWSER_MINXSIZE;
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.y=MAILBROWSER_MINYSIZE;
- return 0;
- case WM_TIMER:
+ break;
+ case WM_SIZE:
+ if (wParam==SIZE_RESTORED)
+ {
+ LONG x=LOWORD(lParam); //((LPRECT)lParam)->right-((LPRECT)lParam)->left;
+ LONG y=HIWORD(lParam); //((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
+ MoveWindow(GetDlgItem(hDlg,IDC_BTNDEL), 5 ,y-5-25,(x-20)/3,25,TRUE); //where to put DELETE button while resizing
+ MoveWindow(GetDlgItem(hDlg,IDC_BTNCHECKALL),10+ (x-20)/3,y-5-25,(x-20)/6,25,TRUE); //where to put CHECK ALL button while resizing
+ MoveWindow(GetDlgItem(hDlg,IDC_BTNAPP), 15+ (x-20)/3 + (x-20)/6,y-5-25,(x-20)/3,25,TRUE); //where to put RUN APP button while resizing
+ MoveWindow(GetDlgItem(hDlg,IDC_BTNOK), 20+2*(x-20)/3 + (x-20)/6 ,y-5-25,(x-20)/6,25,TRUE); //where to put OK button while resizing
+ MoveWindow(GetDlgItem(hDlg,IDC_LISTMAILS), 5 ,5 ,x-10 ,y-55,TRUE); //where to put list mail window while resizing
+ MoveWindow(GetDlgItem(hDlg,IDC_STSTATUS), 5 ,y-5-45 ,x-10 ,15,TRUE); //where to put account status text while resizing
+ }
+ // break;
+ return 0;
+ case WM_GETMINMAXINFO:
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.x=MAILBROWSER_MINXSIZE;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.y=MAILBROWSER_MINYSIZE;
+ return 0;
+ case WM_TIMER:
{
NOTIFYICONDATA nid;
struct CMailWinUserInfo *mwui=(struct CMailWinUserInfo *)GetWindowLongPtr(hDlg,DWLP_USER);
@@ -2247,198 +2239,190 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM nid.hIcon=g_LoadIconEx(2);
Shell_NotifyIcon(NIM_MODIFY,&nid);
mwui->TrayIconState=!mwui->TrayIconState;
-// UpdateWindow(hDlg);
+ // UpdateWindow(hDlg);
}
- break;
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom)
- {
-
- case IDC_LISTMAILS:
- {
+ break;
- switch(((LPNMHDR)lParam)->code)
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case IDC_LISTMAILS:
+ switch(((LPNMHDR)lParam)->code) {
+ case NM_DBLCLK:
+ SendMessage(hDlg,WM_YAMN_SHOWSELECTED,0,0);
+ break;
+ case LVN_COLUMNCLICK:
+ HACCOUNT ActualAccount;
+ if (NULL != (ActualAccount=GetWindowAccount(hDlg))) {
+ NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam;
+ if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
{
- case NM_DBLCLK:
- SendMessage(hDlg,WM_YAMN_SHOWSELECTED,0,0);
+#ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"MailBrowser:COLUMNCLICK:ActualAccountSO-read enter\n");
+#endif
+ switch((int)pNMListView->iSubItem)
+ {
+ case 0:
+ bFrom = !bFrom;
break;
- case LVN_COLUMNCLICK:
- HACCOUNT ActualAccount;
- if (NULL != (ActualAccount=GetWindowAccount(hDlg))) {
- NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam;
- if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:COLUMNCLICK:ActualAccountSO-read enter\n");
- #endif
- switch((int)pNMListView->iSubItem)
- {
- case 0:
- bFrom = !bFrom;
- break;
- case 1:
- bSub = !bSub;
- break;
- case 2:
- bSize = !bSize;
- break;
- case 3:
- bDate = !bDate;
- break;
- default:
- break;
- }
- ListView_SortItems(pNMListView->hdr.hwndFrom,ListViewCompareProc,pNMListView->iSubItem);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:BTNAPP:ActualAccountSO-read done\n");
- #endif
- ReadDoneFcn(ActualAccount->AccountAccessSO);
- } }
+ case 1:
+ bSub = !bSub;
+ break;
+ case 2:
+ bSize = !bSize;
+ break;
+ case 3:
+ bDate = !bDate;
break;
+ default:
+ break;
+ }
+ ListView_SortItems(pNMListView->hdr.hwndFrom,ListViewCompareProc,pNMListView->iSubItem);
+#ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"MailBrowser:BTNAPP:ActualAccountSO-read done\n");
+#endif
+ ReadDoneFcn(ActualAccount->AccountAccessSO);
+ }
+ }
+ break;
- case NM_CUSTOMDRAW:
- {
- HACCOUNT ActualAccount;
- LPNMLVCUSTOMDRAW cd=(LPNMLVCUSTOMDRAW)lParam;
- LONG_PTR PaintCode;
+ case NM_CUSTOMDRAW:
+ {
+ HACCOUNT ActualAccount;
+ LPNMLVCUSTOMDRAW cd=(LPNMLVCUSTOMDRAW)lParam;
+ LONG_PTR PaintCode;
- if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
- break;
+ if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
+ break;
+
+ switch(cd->nmcd.dwDrawStage) {
+ case CDDS_PREPAINT:
+ PaintCode=CDRF_NOTIFYITEMDRAW;
+ break;
+ case CDDS_ITEMPREPAINT:
+ PaintCode=CDRF_NOTIFYSUBITEMDRAW;
+ break;
+ case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
+ {
+ // COLORREF crText, crBkgnd;
+ // crText= RGB(128,128,255);
+ HYAMNMAIL ActualMail;
+ BOOL umma;
- switch(cd->nmcd.dwDrawStage)
{
- case CDDS_PREPAINT:
- PaintCode=CDRF_NOTIFYITEMDRAW;
+ struct CMailWinUserInfo *mwui;
+ mwui=(struct CMailWinUserInfo *)GetWindowLongPtr(hDlg,DWLP_USER);
+ umma= mwui->UpdateMailsMessagesAccess;
+ }
+ ActualMail=(HYAMNMAIL)cd->nmcd.lItemlParam;
+ if (!ActualMail)
+ ActualMail=(HYAMNMAIL)readItemLParam(cd->nmcd.hdr.hwndFrom,cd->nmcd.dwItemSpec);
+#ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"MailBrowser:DRAWITEM:ActualAccountMsgsSO-read wait\n");
+#endif
+ if (!umma)
+ if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->MessagesAccessSO))
+ {
+#ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"MailBrowser:DRAWITEM:ActualAccountMsgsSO-read wait failed\n");
+#endif
+ return 0;
+ }
+#ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"MailBrowser:DRAWITEM:ActualAccountMsgsSO-read enter\n");
+#endif
+ switch(ActualMail->Flags & YAMN_MSG_SPAMMASK)
+ {
+ case YAMN_MSG_SPAML1:
+ case YAMN_MSG_SPAML2:
+ cd->clrText=RGB(150,150,150);
break;
- case CDDS_ITEMPREPAINT:
- PaintCode=CDRF_NOTIFYSUBITEMDRAW;
+ case YAMN_MSG_SPAML3:
+ cd->clrText=RGB(200,200,200);
+ cd->clrTextBk=RGB(160,160,160);
break;
- case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
- {
-// COLORREF crText, crBkgnd;
-// crText= RGB(128,128,255);
- HYAMNMAIL ActualMail;
- BOOL umma;
-
- {
- struct CMailWinUserInfo *mwui;
- mwui=(struct CMailWinUserInfo *)GetWindowLongPtr(hDlg,DWLP_USER);
- umma= mwui->UpdateMailsMessagesAccess;
- }
- ActualMail=(HYAMNMAIL)cd->nmcd.lItemlParam;
- if (!ActualMail)
- ActualMail=(HYAMNMAIL)readItemLParam(cd->nmcd.hdr.hwndFrom,cd->nmcd.dwItemSpec);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:DRAWITEM:ActualAccountMsgsSO-read wait\n");
- #endif
- if (!umma)
- if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->MessagesAccessSO))
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:DRAWITEM:ActualAccountMsgsSO-read wait failed\n");
- #endif
- return 0;
- }
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:DRAWITEM:ActualAccountMsgsSO-read enter\n");
- #endif
- switch(ActualMail->Flags & YAMN_MSG_SPAMMASK)
- {
- case YAMN_MSG_SPAML1:
- case YAMN_MSG_SPAML2:
- cd->clrText=RGB(150,150,150);
- break;
- case YAMN_MSG_SPAML3:
- cd->clrText=RGB(200,200,200);
- cd->clrTextBk=RGB(160,160,160);
- break;
- case 0:
- if (cd->nmcd.dwItemSpec & 1)
- cd->clrTextBk=RGB(230,230,230);
- break;
- default:
- break;
- }
- if (ActualMail->Flags & YAMN_MSG_UNSEEN)
- cd->clrTextBk=RGB(220,235,250);
- PaintCode=CDRF_DODEFAULT;
-
- if (!umma)
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:DRAWITEM:ActualAccountMsgsSO-read done\n");
- #endif
- ReadDoneFcn(ActualAccount->MessagesAccessSO);
- }
-
+ case 0:
+ if (cd->nmcd.dwItemSpec & 1)
+ cd->clrTextBk=RGB(230,230,230);
+ break;
+ default:
break;
}
- }
- SetWindowLongPtr(hDlg,DWLP_MSGRESULT,PaintCode);
- return 1;
+ if (ActualMail->Flags & YAMN_MSG_UNSEEN)
+ cd->clrTextBk=RGB(220,235,250);
+ PaintCode=CDRF_DODEFAULT;
+
+ if (!umma)
+ {
+#ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"MailBrowser:DRAWITEM:ActualAccountMsgsSO-read done\n");
+#endif
+ ReadDoneFcn(ActualAccount->MessagesAccessSO);
+ }
+
+ break;
}
}
+ SetWindowLongPtr(hDlg,DWLP_MSGRESULT,PaintCode);
+ return 1;
}
}
- break;
- case WM_CONTEXTMENU:
- {
- if ( GetWindowLongPtr(( HWND )wParam, GWLP_ID ) == IDC_LISTMAILS) {
- //MessageBox(0,"LISTHEADERS","Debug",0);
- HWND hList = GetDlgItem( hDlg, IDC_LISTMAILS );
- POINT pt = { (signed short)LOWORD( lParam ), (signed short)HIWORD( lParam ) };
- HTREEITEM hItem = 0;
- if (pt.x==-1) pt.x = 0;
- if (pt.y==-1) pt.y = 0;
- if (int numRows = ListView_GetItemCount(hList)) {
- HMENU hMenu = CreatePopupMenu();
- AppendMenu(hMenu, MF_STRING, (UINT_PTR)1, TranslateT("Copy Selected"));
- AppendMenu(hMenu, MF_STRING, (UINT_PTR)2, TranslateT("Copy All"));
- AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
- AppendMenu(hMenu, MF_STRING, (UINT_PTR)0, TranslateT("Cancel"));
- int nReturnCmd = TrackPopupMenu( hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL );
- DestroyMenu( hMenu );
- if (nReturnCmd>0) {
- int courRow=0;
- size_t sizeNeeded = 0;
- TCHAR from[128]={0}, subject[256]={0}, size[16]={0}, date[64]={0};
- for (courRow=0;courRow<numRows;courRow++) {
- if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
- ListView_GetItemText(hList, courRow, 0, from, SIZEOF(from));
- ListView_GetItemText(hList, courRow, 1, subject, SIZEOF(subject));
- ListView_GetItemText(hList, courRow, 2, size, SIZEOF(size));
- ListView_GetItemText(hList, courRow, 3, date, SIZEOF(date));
- sizeNeeded += 5+_tcslen(from)+_tcslen(subject)+_tcslen(size)+_tcslen(date);
- }
- if (sizeNeeded && OpenClipboard(hDlg)) {
- EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE,(sizeNeeded+1)*sizeof(TCHAR));
- TCHAR *buff = (TCHAR *)GlobalLock(hData);
- int courPos = 0;
- for (courRow=0; courRow < numRows; courRow++) {
- if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
- ListView_GetItemText(hList, courRow, 0, from, SIZEOF(from));
- ListView_GetItemText(hList, courRow, 1, subject, SIZEOF(subject));
- ListView_GetItemText(hList, courRow, 2, size, SIZEOF(size));
- ListView_GetItemText(hList, courRow, 3, date, SIZEOF(date));
- courPos += _stprintf(&buff[courPos], _T("%s\t%s\t%s\t%s\r\n"), from, subject, size, date);
- }
- GlobalUnlock(hData);
- #if defined( _UNICODE )
- SetClipboardData(CF_UNICODETEXT,hData);
- #else
- SetClipboardData(CF_TEXT,hData);
- #endif
- CloseClipboard();
- }
+ }
+ break;
+
+ case WM_CONTEXTMENU:
+ if ( GetWindowLongPtr(( HWND )wParam, GWLP_ID ) == IDC_LISTMAILS) {
+ //MessageBox(0,"LISTHEADERS","Debug",0);
+ HWND hList = GetDlgItem( hDlg, IDC_LISTMAILS );
+ POINT pt = { (signed short)LOWORD( lParam ), (signed short)HIWORD( lParam ) };
+ HTREEITEM hItem = 0;
+ if (pt.x==-1) pt.x = 0;
+ if (pt.y==-1) pt.y = 0;
+ if (int numRows = ListView_GetItemCount(hList)) {
+ HMENU hMenu = CreatePopupMenu();
+ AppendMenu(hMenu, MF_STRING, (UINT_PTR)1, TranslateT("Copy Selected"));
+ AppendMenu(hMenu, MF_STRING, (UINT_PTR)2, TranslateT("Copy All"));
+ AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hMenu, MF_STRING, (UINT_PTR)0, TranslateT("Cancel"));
+ int nReturnCmd = TrackPopupMenu( hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL );
+ DestroyMenu( hMenu );
+ if (nReturnCmd>0) {
+ int courRow=0;
+ size_t sizeNeeded = 0;
+ TCHAR from[128]={0}, subject[256]={0}, size[16]={0}, date[64]={0};
+ for (courRow=0;courRow<numRows;courRow++) {
+ if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
+ ListView_GetItemText(hList, courRow, 0, from, SIZEOF(from));
+ ListView_GetItemText(hList, courRow, 1, subject, SIZEOF(subject));
+ ListView_GetItemText(hList, courRow, 2, size, SIZEOF(size));
+ ListView_GetItemText(hList, courRow, 3, date, SIZEOF(date));
+ sizeNeeded += 5+_tcslen(from)+_tcslen(subject)+_tcslen(size)+_tcslen(date);
+ }
+ if (sizeNeeded && OpenClipboard(hDlg)) {
+ EmptyClipboard();
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE,(sizeNeeded+1)*sizeof(TCHAR));
+ TCHAR *buff = (TCHAR *)GlobalLock(hData);
+ int courPos = 0;
+ for (courRow=0; courRow < numRows; courRow++) {
+ if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
+ ListView_GetItemText(hList, courRow, 0, from, SIZEOF(from));
+ ListView_GetItemText(hList, courRow, 1, subject, SIZEOF(subject));
+ ListView_GetItemText(hList, courRow, 2, size, SIZEOF(size));
+ ListView_GetItemText(hList, courRow, 3, date, SIZEOF(date));
+ courPos += _stprintf(&buff[courPos], _T("%s\t%s\t%s\t%s\r\n"), from, subject, size, date);
}
+ GlobalUnlock(hData);
+#if defined( _UNICODE )
+ SetClipboardData(CF_UNICODETEXT,hData);
+#else
+ SetClipboardData(CF_TEXT,hData);
+#endif
+ CloseClipboard();
}
- } }
- break; // just in case
- default:
- return 0;
+ }
+ }
+ }
+ break; // just in case
}
-// return DefWindowProc(hDlg,msg,wParam,lParam);
return 0;
}
@@ -2482,7 +2466,7 @@ LRESULT CALLBACK ListViewSubclassProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM }
}
- return CallWindowProc(OldListViewSubclassProc, hDlg, msg, wParam, lParam);
+ return mir_callNextSubclass(hDlg, ListViewSubclassProc, msg, wParam, lParam);
}
DWORD WINAPI MailBrowser(LPVOID Param)
diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp index 57fa749be3..3c0c4cd10d 100644 --- a/plugins/YAPP/src/popwin.cpp +++ b/plugins/YAPP/src/popwin.cpp @@ -715,14 +715,14 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pd && pd->windowProc)
return CallWindowProc(pd->windowProc, hwnd, uMsg, wParam, lParam);
- else {
- // provide a way to close popups, if no PluginWindowProc is provided
- if (uMsg == WM_CONTEXTMENU) {
- SendMessage(hwnd, PM_DESTROY, 0, 0);
- return TRUE;
- } else
- return DefWindowProc(hwnd, uMsg, wParam, lParam);
+
+ // provide a way to close popups, if no PluginWindowProc is provided
+ if (uMsg == WM_CONTEXTMENU) {
+ SendMessage(hwnd, PM_DESTROY, 0, 0);
+ return TRUE;
}
+
+ return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
void InitWindowStack()
diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp index 89bf9604a6..1904243df7 100644 --- a/plugins/YAPP/src/yapp_history_dlg.cpp +++ b/plugins/YAPP/src/yapp_history_dlg.cpp @@ -15,8 +15,6 @@ #define ANCHOR_BOTTOM 0x000008
#define ANCHOR_ALL ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_TOP | ANCHOR_BOTTOM
-WNDPROC oldPopupsListProc = NULL;
-
HWND hHistoryWindow = 0; //the history window
HICON hiPopupHistory; //popup history icon
PopupHistoryList lstPopupHistory; //defined in main.cpp
@@ -516,16 +514,15 @@ void CopyPopupDataToClipboard(HWND hList, int selection) }
//subclass proc for the list view
-BOOL CALLBACK PopupsListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK PopupsListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_CONTEXTMENU:
+ switch (msg) {
+ case WM_CONTEXTMENU:
{
int x = LOWORD(lParam);
int y = HIWORD(lParam);
int selection;
-
+
HMENU hMenu = CreatePopupMenu();
AppendMenu(hMenu, MF_STRING, POPUPMENU_TITLE, TranslateT("Copy title to clipboard"));
AppendMenu(hMenu, MF_STRING, POPUPMENU_MESSAGE, TranslateT("Copy message to clipboard"));
@@ -536,48 +533,30 @@ BOOL CALLBACK PopupsListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM {
CopyPopupDataToClipboard(hWnd, selection);
}
-
+
break;
}
-
- case WM_KEYUP:
- {
- switch (wParam)
- {
- case 'C':
- {
- if (GetKeyState(VK_CONTROL))
- {
- CopyPopupDataToClipboard(hWnd, POPUPMENU_MESSAGE);
- }
-
- break;
- }
-
- case VK_ESCAPE:
- {
- SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
-
- break;
- }
-
- }
-
+
+ case WM_KEYUP:
+ switch (wParam) {
+ case 'C':
+ if (GetKeyState(VK_CONTROL))
+ CopyPopupDataToClipboard(hWnd, POPUPMENU_MESSAGE);
break;
- }
-
- case WM_SYSKEYDOWN:
- {
- if (wParam == 'X')
- {
- SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
- }
-
+
+ case VK_ESCAPE:
+ SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
break;
}
+ break;
+
+ case WM_SYSKEYDOWN:
+ if (wParam == 'X')
+ SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
+ break;
}
-
- return CallWindowProc(oldPopupsListProc, hWnd, msg, wParam, lParam);
+
+ return mir_callNextSubclass(hWnd, PopupsListSubclassProc, msg, wParam, lParam);
}
//load the columns
@@ -599,62 +578,48 @@ void LoadHistoryColumns(HWND hHistoryList) INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int bInitializing;
-
- switch (msg)
- {
- case WM_INITDIALOG:
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ bInitializing = 1;
{
- bInitializing = 1;
int renderer = lstPopupHistory.GetRenderer();
-
+
SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiPopupHistory);
-
+
LoadRenderer(hWnd, renderer);
-
+
TranslateDialogDefault(hWnd);
HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY);
ListView_SetExtendedListViewStyleEx(hHistoryList, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
- oldPopupsListProc = (WNDPROC) SetWindowLongPtr(hHistoryList, GWLP_WNDPROC, (LONG_PTR) PopupsListSubclassProc);
-
+ mir_subclassWindow(hHistoryList, PopupsListSubclassProc);
+
LoadHistoryColumns(hHistoryList);
-
+
RefreshPopupHistory(hWnd, renderer);
-
- bInitializing = 0;
+ }
+ bInitializing = 0;
+ return TRUE;
- return TRUE;
- }
+ case WM_DESTROY:
+ UnloadRenderer(hWnd, lstPopupHistory.GetRenderer());
+ hHistoryWindow = NULL;
+ break;
- case WM_DESTROY:
- {
- UnloadRenderer(hWnd, lstPopupHistory.GetRenderer());
- hHistoryWindow = NULL;
-
- break;
- }
-
- case WM_CLOSE:
- {
- //Utils_SaveWindowPosition(hWnd, 0, MODULE, "history_dlg");
- DestroyWindow(hWnd);
-
- break;
- }
+ case WM_CLOSE:
+ DestroyWindow(hWnd);
+ break;
- case WM_WINDOWPOSCHANGING:
+ case WM_WINDOWPOSCHANGING:
{
WINDOWPOS *wndPos = (WINDOWPOS *) lParam;
-
+
if (wndPos->cx < MIN_HISTORY_WIDTH)
- {
wndPos->cx = MIN_HISTORY_WIDTH;
- }
if (wndPos->cy < MIN_HISTORY_HEIGHT)
- {
wndPos->cy = MIN_HISTORY_HEIGHT;
- }
RECT rParent;
GetWindowRect(hWnd, &rParent);
@@ -667,77 +632,48 @@ INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara EndDeferWindowPos(hdWnds);
MoveCustomControl(hWnd, lstPopupHistory.GetRenderer()); //move the custom control too, if any
- break;
}
+ break;
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_CLOSE:
- {
- SendMessage(hWnd, WM_CLOSE, 0, 0);
-
- break;
- }
-
- case IDC_HISTORY_FILTER_CASESENSITIVE:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- RefreshPopupHistory(hWnd, lstPopupHistory.GetRenderer());
- }
- }
-
- case IDC_HISTORY_FILTER:
- {
- if (HIWORD(wParam) == EN_CHANGE)
- {
- if (!bInitializing)
- {
- RefreshPopupHistory(hWnd, lstPopupHistory.GetRenderer());
- }
- }
-
- break;
- }
-
- }
-
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_CLOSE:
+ SendMessage(hWnd, WM_CLOSE, 0, 0);
+ break;
+
+ case IDC_HISTORY_FILTER_CASESENSITIVE:
+ if (HIWORD(wParam) == BN_CLICKED)
+ RefreshPopupHistory(hWnd, lstPopupHistory.GetRenderer());
+
+ case IDC_HISTORY_FILTER:
+ if (HIWORD(wParam) == EN_CHANGE)
+ if (!bInitializing)
+ RefreshPopupHistory(hWnd, lstPopupHistory.GetRenderer());
break;
}
-
- case WM_NOTIFY:
- {
- switch(((LPNMHDR)lParam)->idFrom)
- {
- case IDC_LST_HISTORY:
+ break;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case IDC_LST_HISTORY:
+ switch (((LPNMHDR)lParam)->code) {
+ case LVN_COLUMNCLICK:
{
- switch (((LPNMHDR)lParam)->code)
- {
- case LVN_COLUMNCLICK:
- {
- LPNMLISTVIEW lv = (LPNMLISTVIEW) lParam;
- int column = lv->iSubItem;
- SortParams params = {0};
- params.hList = GetDlgItem(hWnd, IDC_LST_HISTORY);
- params.column = column;
-
- ListView_SortItemsEx(params.hList, PopupsCompare, (LPARAM) ¶ms);
- lastColumn = (params.column == lastColumn) ? -1 : params.column;
-
- break;
- }
- }
-
+ LPNMLISTVIEW lv = (LPNMLISTVIEW) lParam;
+ int column = lv->iSubItem;
+ SortParams params = {0};
+ params.hList = GetDlgItem(hWnd, IDC_LST_HISTORY);
+ params.column = column;
+
+ ListView_SortItemsEx(params.hList, PopupsCompare, (LPARAM) ¶ms);
+ lastColumn = (params.column == lastColumn) ? -1 : params.column;
+
break;
}
}
-
- break;
}
+ break;
}
-
+
return 0;
}
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index db56f9aded..36f211655f 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -24,9 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "ui_utils.h"
-static WNDPROC OldProc;
-static WNDPROC OldListViewProc;
-
static const CIrcProto* pZero = NULL;
void CIrcProto::ReadSettings( TDbSetting* sets, int count )
@@ -1018,7 +1015,7 @@ static LRESULT CALLBACK EditSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam, break;
}
- return CallWindowProc(OldProc, hwndDlg, msg, wParam, lParam);
+ return mir_callNextSubclass(hwndDlg, EditSubclassProc, msg, wParam, lParam);
}
COtherPrefsDlg::COtherPrefsDlg( CIrcProto* _pro ) :
@@ -1047,9 +1044,9 @@ COtherPrefsDlg::COtherPrefsDlg( CIrcProto* _pro ) : void COtherPrefsDlg::OnInitDialog()
{
- OldProc = (WNDPROC)SetWindowLongPtr( m_alias.GetHwnd(), GWLP_WNDPROC,(LONG_PTR)EditSubclassProc);
- SetWindowLongPtr( m_quitMessage.GetHwnd(), GWLP_WNDPROC,(LONG_PTR)EditSubclassProc);
- SetWindowLongPtr( m_pertormEdit.GetHwnd(), GWLP_WNDPROC,(LONG_PTR)EditSubclassProc);
+ mir_subclassWindow( m_alias.GetHwnd(), EditSubclassProc);
+ mir_subclassWindow( m_quitMessage.GetHwnd(), EditSubclassProc);
+ mir_subclassWindow( m_pertormEdit.GetHwnd(), EditSubclassProc);
m_alias.SetText( m_proto->m_alias );
m_quitMessage.SetText( m_proto->m_quitMessage );
@@ -1354,7 +1351,7 @@ static LRESULT CALLBACK ListviewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break;
}
- return CallWindowProc(OldListViewProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ListviewSubclassProc, msg, wParam, lParam);
}
// Callback for the 'Add ignore' dialog
@@ -1454,7 +1451,7 @@ CIgnorePrefsDlg::CIgnorePrefsDlg( CIrcProto* _pro ) : void CIgnorePrefsDlg::OnInitDialog()
{
m_proto->m_ignoreDlg = this;
- OldListViewProc = (WNDPROC)SetWindowLongPtr( m_list.GetHwnd(),GWLP_WNDPROC, (LONG_PTR)ListviewSubclassProc );
+ mir_subclassWindow(m_list.GetHwnd(), ListviewSubclassProc);
m_enable.SetState( m_proto->m_ignore );
m_ignoreFile.SetState( !m_proto->m_DCCFileEnabled );
@@ -1609,7 +1606,6 @@ void CIgnorePrefsDlg::OnDestroy() }
m_proto->RewriteIgnoreSettings();
- SetWindowLongPtr( m_list.GetHwnd(), GWLP_WNDPROC, (LONG_PTR)OldListViewProc );
}
void CIgnorePrefsDlg::FixButtons()
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index 313e99353c..ad8a16fec7 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "irc.h"
-static WNDPROC OldMgrEditProc;
-
/////////////////////////////////////////////////////////////////////////////////////////
// Message Box
@@ -866,7 +864,7 @@ LRESULT CALLBACK MgrEditSubclassProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARA break;
}
- return CallWindowProc(OldMgrEditProc, m_hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(m_hwnd, MgrEditSubclassProc, msg, wParam, lParam);
}
void CManagerDlg::OnInitDialog()
@@ -877,7 +875,7 @@ void CManagerDlg::OnInitDialog() pt.x = 3;
pt.y = 3;
HWND hwndEdit = ChildWindowFromPoint( m_topic.GetHwnd(), pt);
- OldMgrEditProc = (WNDPROC)SetWindowLongPtr(hwndEdit, GWLP_WNDPROC,(LONG_PTR)MgrEditSubclassProc);
+ mir_subclassWindow(hwndEdit, MgrEditSubclassProc);
WindowSetIcon( m_hwnd, IDI_MANAGER );
diff --git a/protocols/IcqOscarJ/src/changeinfo/editlist.cpp b/protocols/IcqOscarJ/src/changeinfo/editlist.cpp index f2a1470fd3..acaa15d861 100644 --- a/protocols/IcqOscarJ/src/changeinfo/editlist.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/editlist.cpp @@ -31,171 +31,167 @@ static ChangeInfoData *dataListEdit = NULL;
static HWND hwndListEdit = NULL;
static BOOL (WINAPI *MyAnimateWindow)(HWND,DWORD,DWORD);
-static WNDPROC OldListEditProc;
static LRESULT CALLBACK ListEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
- {
- case WM_LBUTTONUP:
- CallWindowProc(OldListEditProc, hwnd, msg, wParam, lParam);
- {
- POINT pt;
-
- pt.x = (short)LOWORD(lParam);
- pt.y = (short)HIWORD(lParam);
- ClientToScreen(hwnd, &pt);
- if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y)) == HTVSCROLL) break;
- }
- {
- int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
-
- if (dataListEdit)
- dataListEdit->EndListEdit(i != LB_ERR);
- }
- return 0;
-
- case WM_CHAR:
- if (wParam != '\r') break;
- {
- int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
-
- if (dataListEdit)
- dataListEdit->EndListEdit(i != LB_ERR);
- }
- return 0;
- case WM_KILLFOCUS:
- if (dataListEdit)
- dataListEdit->EndListEdit(1);
- return 0;
- }
- return CallWindowProc(OldListEditProc, hwnd, msg, wParam, lParam);
+ switch(msg) {
+ case WM_LBUTTONUP:
+ mir_callNextSubclass(hwnd, ListEditSubclassProc, msg, wParam, lParam);
+ {
+ POINT pt;
+
+ pt.x = (short)LOWORD(lParam);
+ pt.y = (short)HIWORD(lParam);
+ ClientToScreen(hwnd, &pt);
+ if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y)) == HTVSCROLL) break;
+ }
+ {
+ int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
+
+ if (dataListEdit)
+ dataListEdit->EndListEdit(i != LB_ERR);
+ }
+ return 0;
+
+ case WM_CHAR:
+ if (wParam != '\r') break;
+ {
+ int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
+
+ if (dataListEdit)
+ dataListEdit->EndListEdit(i != LB_ERR);
+ }
+ return 0;
+ case WM_KILLFOCUS:
+ if (dataListEdit)
+ dataListEdit->EndListEdit(1);
+ return 0;
+ }
+ return mir_callNextSubclass(hwnd, ListEditSubclassProc, msg, wParam, lParam);
}
-
void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey)
{
- int j,n;
- POINT pt;
- int itemHeight;
- char str[MAX_PATH];
-
- if (dataListEdit)
- dataListEdit->EndListEdit(0);
-
- pt.x=pt.y=0;
- ClientToScreen(hwndList,&pt);
- OffsetRect(rc,pt.x,pt.y);
- InflateRect(rc,-2,-2);
- rc->left-=2;
- iEditItem = iItem;
- ListView_RedrawItems(hwndList, iEditItem, iEditItem);
- UpdateWindow(hwndList);
-
- dataListEdit = this;
- hwndListEdit = CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, _T("LISTBOX"), _T(""), WS_POPUP|WS_BORDER|WS_VSCROLL, rc->left, rc->bottom, rc->right - rc->left, 150, NULL, NULL, hInst, NULL);
- SendMessage(hwndListEdit, WM_SETFONT, (WPARAM)hListFont, 0);
- itemHeight = SendMessage(hwndListEdit, LB_GETITEMHEIGHT, 0, 0);
-
- FieldNamesItem *list = (FieldNamesItem*)setting[iSetting].pList;
-
- if (list == countryField)
- { // some country codes were changed leaving old details uknown, convert it for the user
- if (settingData[iSetting].value == 420) settingData[iSetting].value = 42; // conversion of obsolete codes (OMG!)
- else if (settingData[iSetting].value == 421) settingData[iSetting].value = 4201;
- else if (settingData[iSetting].value == 102) settingData[iSetting].value = 1201;
- }
-
- n = ListBoxAddStringUtf(hwndListEdit, "Unspecified");
- for (j=0; ; j++)
- if (!list[j].text)
- {
- SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);
- if ((settingData[iSetting].value == 0 && list[j].code == 0)
- || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code))
- SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);
- break;
- }
-
- for (j=0; list[j].text; j++)
- {
- n = ListBoxAddStringUtf(hwndListEdit, list[j].text);
- SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);
- if ((setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, list[j].text))
- || (setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, ICQTranslateUtfStatic(list[j].text, str, MAX_PATH))))
- || ((char*)settingData[iSetting].value == NULL && list[j].code == 0))
- || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code))
- SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);
- }
- SendMessage(hwndListEdit, LB_SETTOPINDEX, SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0) - 3, 0);
- int listCount = SendMessage(hwndListEdit, LB_GETCOUNT, 0, 0);
- if (itemHeight * listCount < 150)
- SetWindowPos(hwndListEdit, 0, 0, 0, rc->right - rc->left, itemHeight * listCount + GetSystemMetrics(SM_CYBORDER) * 2, SWP_NOZORDER|SWP_NOMOVE);
- OldListEditProc = (WNDPROC)SetWindowLongPtr(hwndListEdit, GWLP_WNDPROC, (LONG_PTR)ListEditSubclassProc);
- if (MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(GetModuleHandleA("user32"), "AnimateWindow"))
- {
- BOOL enabled;
-
- SystemParametersInfo(SPI_GETCOMBOBOXANIMATION, 0, &enabled, FALSE);
- if (enabled) MyAnimateWindow(hwndListEdit, 200, AW_SLIDE|AW_ACTIVATE|AW_VER_POSITIVE);
- }
- ShowWindow(hwndListEdit, SW_SHOW);
- SetFocus(hwndListEdit);
- if (wVKey)
- PostMessage(hwndListEdit, WM_KEYDOWN, wVKey, 0);
+ int j,n;
+ POINT pt;
+ int itemHeight;
+ char str[MAX_PATH];
+
+ if (dataListEdit)
+ dataListEdit->EndListEdit(0);
+
+ pt.x=pt.y=0;
+ ClientToScreen(hwndList,&pt);
+ OffsetRect(rc,pt.x,pt.y);
+ InflateRect(rc,-2,-2);
+ rc->left-=2;
+ iEditItem = iItem;
+ ListView_RedrawItems(hwndList, iEditItem, iEditItem);
+ UpdateWindow(hwndList);
+
+ dataListEdit = this;
+ hwndListEdit = CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, _T("LISTBOX"), _T(""), WS_POPUP|WS_BORDER|WS_VSCROLL, rc->left, rc->bottom, rc->right - rc->left, 150, NULL, NULL, hInst, NULL);
+ SendMessage(hwndListEdit, WM_SETFONT, (WPARAM)hListFont, 0);
+ itemHeight = SendMessage(hwndListEdit, LB_GETITEMHEIGHT, 0, 0);
+
+ FieldNamesItem *list = (FieldNamesItem*)setting[iSetting].pList;
+
+ if (list == countryField)
+ { // some country codes were changed leaving old details uknown, convert it for the user
+ if (settingData[iSetting].value == 420) settingData[iSetting].value = 42; // conversion of obsolete codes (OMG!)
+ else if (settingData[iSetting].value == 421) settingData[iSetting].value = 4201;
+ else if (settingData[iSetting].value == 102) settingData[iSetting].value = 1201;
+ }
+
+ n = ListBoxAddStringUtf(hwndListEdit, "Unspecified");
+ for (j=0; ; j++)
+ if (!list[j].text)
+ {
+ SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);
+ if ((settingData[iSetting].value == 0 && list[j].code == 0)
+ || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code))
+ SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);
+ break;
+ }
+
+ for (j=0; list[j].text; j++)
+ {
+ n = ListBoxAddStringUtf(hwndListEdit, list[j].text);
+ SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);
+ if ((setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, list[j].text))
+ || (setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, ICQTranslateUtfStatic(list[j].text, str, MAX_PATH))))
+ || ((char*)settingData[iSetting].value == NULL && list[j].code == 0))
+ || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code))
+ SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);
+ }
+ SendMessage(hwndListEdit, LB_SETTOPINDEX, SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0) - 3, 0);
+ int listCount = SendMessage(hwndListEdit, LB_GETCOUNT, 0, 0);
+ if (itemHeight * listCount < 150)
+ SetWindowPos(hwndListEdit, 0, 0, 0, rc->right - rc->left, itemHeight * listCount + GetSystemMetrics(SM_CYBORDER) * 2, SWP_NOZORDER|SWP_NOMOVE);
+ mir_subclassWindow(hwndListEdit, ListEditSubclassProc);
+ if (MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(GetModuleHandleA("user32"), "AnimateWindow"))
+ {
+ BOOL enabled;
+
+ SystemParametersInfo(SPI_GETCOMBOBOXANIMATION, 0, &enabled, FALSE);
+ if (enabled) MyAnimateWindow(hwndListEdit, 200, AW_SLIDE|AW_ACTIVATE|AW_VER_POSITIVE);
+ }
+ ShowWindow(hwndListEdit, SW_SHOW);
+ SetFocus(hwndListEdit);
+ if (wVKey)
+ PostMessage(hwndListEdit, WM_KEYDOWN, wVKey, 0);
}
-
void ChangeInfoData::EndListEdit(int save)
{
- if (hwndListEdit == NULL || iEditItem == -1 || this != dataListEdit) return;
- if (save)
- {
- int iItem = SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0);
- int i = SendMessage(hwndListEdit, LB_GETITEMDATA, iItem, 0);
-
- if (setting[iEditItem].dbType == DBVT_ASCIIZ)
- {
- char *szNewValue = (((FieldNamesItem*)setting[iEditItem].pList)[i].text);
- if (((FieldNamesItem*)setting[iEditItem].pList)[i].code || setting[iEditItem].displayType & LIF_ZEROISVALID)
- {
- settingData[iEditItem].changed = strcmpnull(szNewValue, (char*)settingData[iEditItem].value);
- SAFE_FREE((void**)&settingData[iEditItem].value);
- settingData[iEditItem].value = (LPARAM)null_strdup(szNewValue);
- }
- else
- {
- settingData[iEditItem].changed = (char*)settingData[iEditItem].value!=NULL;
- SAFE_FREE((void**)&settingData[iEditItem].value);
- }
- }
- else
- {
- settingData[iEditItem].changed = ((FieldNamesItem*)setting[iEditItem].pList)[i].code != settingData[iEditItem].value;
- settingData[iEditItem].value = ((FieldNamesItem*)setting[iEditItem].pList)[i].code;
- }
- if (settingData[iEditItem].changed)
- {
- char buf[MAX_PATH];
- TCHAR tbuf[MAX_PATH];
-
- if (utf8_to_tchar_static(ICQTranslateUtfStatic(((FieldNamesItem*)setting[iEditItem].pList)[i].text, buf, SIZEOF(buf)), tbuf, SIZEOF(buf)))
- ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
-
- EnableDlgItem(GetParent(hwndList), IDC_SAVE, TRUE);
-
- }
- }
- ListView_RedrawItems(hwndList, iEditItem, iEditItem);
- iEditItem = -1;
- dataListEdit = NULL;
- DestroyWindow(hwndListEdit);
- hwndListEdit = NULL;
+ if (hwndListEdit == NULL || iEditItem == -1 || this != dataListEdit) return;
+ if (save)
+ {
+ int iItem = SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0);
+ int i = SendMessage(hwndListEdit, LB_GETITEMDATA, iItem, 0);
+
+ if (setting[iEditItem].dbType == DBVT_ASCIIZ)
+ {
+ char *szNewValue = (((FieldNamesItem*)setting[iEditItem].pList)[i].text);
+ if (((FieldNamesItem*)setting[iEditItem].pList)[i].code || setting[iEditItem].displayType & LIF_ZEROISVALID)
+ {
+ settingData[iEditItem].changed = strcmpnull(szNewValue, (char*)settingData[iEditItem].value);
+ SAFE_FREE((void**)&settingData[iEditItem].value);
+ settingData[iEditItem].value = (LPARAM)null_strdup(szNewValue);
+ }
+ else
+ {
+ settingData[iEditItem].changed = (char*)settingData[iEditItem].value!=NULL;
+ SAFE_FREE((void**)&settingData[iEditItem].value);
+ }
+ }
+ else
+ {
+ settingData[iEditItem].changed = ((FieldNamesItem*)setting[iEditItem].pList)[i].code != settingData[iEditItem].value;
+ settingData[iEditItem].value = ((FieldNamesItem*)setting[iEditItem].pList)[i].code;
+ }
+ if (settingData[iEditItem].changed)
+ {
+ char buf[MAX_PATH];
+ TCHAR tbuf[MAX_PATH];
+
+ if (utf8_to_tchar_static(ICQTranslateUtfStatic(((FieldNamesItem*)setting[iEditItem].pList)[i].text, buf, SIZEOF(buf)), tbuf, SIZEOF(buf)))
+ ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
+
+ EnableDlgItem(GetParent(hwndList), IDC_SAVE, TRUE);
+
+ }
+ }
+ ListView_RedrawItems(hwndList, iEditItem, iEditItem);
+ iEditItem = -1;
+ dataListEdit = NULL;
+ DestroyWindow(hwndListEdit);
+ hwndListEdit = NULL;
}
int IsListEditWindow(HWND hwnd)
{
- if (hwnd == hwndListEdit) return 1;
- return 0;
+ if (hwnd == hwndListEdit) return 1;
+ return 0;
}
diff --git a/protocols/IcqOscarJ/src/changeinfo/editstring.cpp b/protocols/IcqOscarJ/src/changeinfo/editstring.cpp index 288351e8d3..9987ce5223 100644 --- a/protocols/IcqOscarJ/src/changeinfo/editstring.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/editstring.cpp @@ -29,7 +29,6 @@ static ChangeInfoData *dataStringEdit = NULL;
-static WNDPROC OldStringEditProc, OldExpandButtonProc;
static HWND hwndEdit = NULL, hwndExpandButton = NULL, hwndUpDown = NULL;
static const char escapes[]={'a','\a',
@@ -143,42 +142,38 @@ char *BinaryToEscapes(char *str) static LRESULT CALLBACK StringEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
- {
+ switch(msg) {
case WM_KEYDOWN:
if (wParam==VK_ESCAPE)
{
- if (dataStringEdit)
- dataStringEdit->EndStringEdit(0);
+ if (dataStringEdit)
+ dataStringEdit->EndStringEdit(0);
return 0;
}
if (wParam==VK_RETURN)
{
if (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_MULTILINE && !(GetKeyState(VK_CONTROL) & 0x8000)) break;
- if (dataStringEdit)
- dataStringEdit->EndStringEdit(1);
+ if (dataStringEdit)
+ dataStringEdit->EndStringEdit(1);
return 0;
}
break;
case WM_GETDLGCODE:
- return DLGC_WANTALLKEYS|CallWindowProc(OldStringEditProc, hwnd, msg, wParam, lParam);
+ return DLGC_WANTALLKEYS | mir_callNextSubclass(hwnd, StringEditSubclassProc, msg, wParam, lParam);
case WM_KILLFOCUS:
if ((HWND)wParam == hwndExpandButton) break;
- if (dataStringEdit)
- dataStringEdit->EndStringEdit(1);
+ if (dataStringEdit)
+ dataStringEdit->EndStringEdit(1);
return 0;
}
- return CallWindowProc(OldStringEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, StringEditSubclassProc, msg, wParam, lParam);
}
-
-
static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
- {
+ switch(msg) {
case WM_LBUTTONUP:
if(GetCapture()==hwnd)
{
@@ -197,7 +192,7 @@ static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd,UINT msg,WPARAM wPara EscapesToMultiline(text,&selStart,&selEnd);
hwndEdit=CreateWindowExA(WS_EX_TOOLWINDOW,"EDIT","",WS_POPUP|WS_BORDER|WS_VISIBLE|ES_WANTRETURN|ES_AUTOVSCROLL|WS_VSCROLL|ES_MULTILINE,rcStart.left,rcStart.top,rcStart.right-rcStart.left,rcStart.bottom-rcStart.top,NULL,NULL,hInst,NULL);
SetWindowTextUcs(hwndEdit, text);
- OldStringEditProc=(WNDPROC)SetWindowLongPtr(hwndEdit,GWLP_WNDPROC,(LONG_PTR)StringEditSubclassProc);
+ mir_subclassWindow(hwndEdit, StringEditSubclassProc);
SendMessage(hwndEdit,WM_SETFONT,(WPARAM)dataStringEdit->hListFont,0);
SendMessage(hwndEdit,EM_SETSEL,selStart,selEnd);
SetFocus(hwndEdit);
@@ -228,10 +223,9 @@ static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd,UINT msg,WPARAM wPara }
break;
}
- return CallWindowProc(OldExpandButtonProc,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, ExpandButtonSubclassProc, msg, wParam, lParam);
}
-
void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey)
{
char *szValue;
@@ -255,21 +249,21 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) }
else szValue = "";
- iEditItem = iItem;
+ iEditItem = iItem;
if ((setting[i].displayType & LIM_TYPE)==LI_LONGSTRING)
{
rc->right-=rc->bottom-rc->top;
hwndExpandButton=CreateWindowA("BUTTON","",WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_ICON,rc->right,rc->top,rc->bottom-rc->top,rc->bottom-rc->top,hwndList,NULL,hInst,NULL);
SendMessage(hwndExpandButton,BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadImage(hInst,MAKEINTRESOURCE(IDI_EXPANDSTRINGEDIT),IMAGE_ICON,0,0,LR_SHARED));
- OldExpandButtonProc=(WNDPROC)SetWindowLongPtr(hwndExpandButton,GWLP_WNDPROC,(LONG_PTR)ExpandButtonSubclassProc);
+ mir_subclassWindow(hwndExpandButton, ExpandButtonSubclassProc);
}
- dataStringEdit = this;
+ dataStringEdit = this;
hwndEdit = CreateWindow(_T("EDIT"),_T(""),WS_VISIBLE|WS_CHILD|ES_AUTOHSCROLL|((setting[i].displayType&LIM_TYPE)==LI_NUMBER?ES_NUMBER:0)|(setting[i].displayType&LIF_PASSWORD?ES_PASSWORD:0),rc->left,rc->top,rc->right-rc->left,rc->bottom-rc->top,hwndList,NULL,hInst,NULL);
SetWindowTextUtf(hwndEdit, szValue);
if (alloced) SAFE_FREE(&szValue);
- OldStringEditProc=(WNDPROC)SetWindowLongPtr(hwndEdit,GWLP_WNDPROC,(LONG_PTR)StringEditSubclassProc);
+ mir_subclassWindow(hwndEdit, StringEditSubclassProc);
SendMessage(hwndEdit,WM_SETFONT,(WPARAM)hListFont,0);
if ((setting[i].displayType & LIM_TYPE) == LI_NUMBER)
{
@@ -289,12 +283,12 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) PostMessage(hwndEdit,WM_KEYDOWN,wVKey,0);
}
-
void ChangeInfoData::EndStringEdit(int save)
{
- if (hwndEdit == NULL || iEditItem == -1 || this != dataStringEdit) return;
- if (save)
- {
+ if (hwndEdit == NULL || iEditItem == -1 || this != dataStringEdit)
+ return;
+
+ if (save) {
char *text = (char*)SAFE_MALLOC(GetWindowTextLength(hwndEdit)+1);
GetWindowTextA(hwndEdit,(char*)text,GetWindowTextLength(hwndEdit)+1);
@@ -313,10 +307,8 @@ void ChangeInfoData::EndStringEdit(int save) settingData[iEditItem].value = newValue;
SAFE_FREE(&text);
}
- else
- {
- if (!(setting[iEditItem].displayType & LIF_PASSWORD))
- {
+ else {
+ if (!(setting[iEditItem].displayType & LIF_PASSWORD)) {
SAFE_FREE(&text);
text = GetWindowTextUtf(hwndEdit);
EscapesToBinary(text);
@@ -327,27 +319,27 @@ void ChangeInfoData::EndStringEdit(int save) SAFE_FREE((void**)&settingData[iEditItem].value);
if (strlennull(text))
settingData[iEditItem].value = (LPARAM)text;
- else
- {
+ else {
settingData[iEditItem].value = 0;
SAFE_FREE(&text);
}
settingData[iEditItem].changed = 1;
}
}
- if (settingData[iEditItem].changed)
- {
- TCHAR tbuf[MAX_PATH];
- GetWindowText(hwndEdit, tbuf, SIZEOF(tbuf));
- ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
+ if (settingData[iEditItem].changed) {
+ TCHAR tbuf[MAX_PATH];
+
+ GetWindowText(hwndEdit, tbuf, SIZEOF(tbuf));
+ ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
- EnableDlgItem(hwndDlg, IDC_SAVE, TRUE);
- }
+ EnableDlgItem(hwndDlg, IDC_SAVE, TRUE);
+ }
}
+
ListView_RedrawItems(hwndList, iEditItem, iEditItem);
iEditItem = -1;
- dataStringEdit = NULL;
+ dataStringEdit = NULL;
DestroyWindow(hwndEdit);
hwndEdit = NULL;
if (hwndExpandButton) DestroyWindow(hwndExpandButton);
@@ -356,8 +348,6 @@ void ChangeInfoData::EndStringEdit(int save) hwndUpDown = NULL;
}
-
-
int IsStringEditWindow(HWND hwnd)
{
if (hwnd == hwndEdit) return 1;
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index c434321763..5dc8cbcda1 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -542,8 +542,6 @@ void CIcqProto::updateServerCustomStatus(int fullUpdate) SAFE_FREE(&szStatusNote);
}
-static WNDPROC OldMessageEditProc;
-
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg) {
@@ -575,7 +573,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam }
break;
}
- return CallWindowProc(OldMessageEditProc,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
struct SetXStatusData
@@ -641,12 +639,12 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara if (!init->bAction) { // set our xStatus
dat->bXStatus = init->bXStatus;
SendDlgItemMessage(hwndDlg, IDC_XMSG, EM_LIMITTEXT, 1024, 0);
- OldMessageEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_XMSG),GWLP_WNDPROC,(LONG_PTR)MessageEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_XMSG), MessageEditSubclassProc);
SetDlgItemTextUtf(hwndDlg, IDC_XMSG, init->szXStatusMsg);
if (dat->ppro->m_bXStatusEnabled) { // custom status enabled, prepare title edit
SendDlgItemMessage(hwndDlg, IDC_XTITLE, EM_LIMITTEXT, 256, 0);
- OldMessageEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_XTITLE),GWLP_WNDPROC,(LONG_PTR)MessageEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_XTITLE), MessageEditSubclassProc);
SetDlgItemTextUtf(hwndDlg, IDC_XTITLE, init->szXStatusName);
}
else { // only moods enabled, hide title, resize message edit control
@@ -763,10 +761,6 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara }
}
dat->ppro->updateServerCustomStatus(TRUE);
-
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_XMSG),GWLP_WNDPROC,(LONG_PTR)OldMessageEditProc);
- if (dat->ppro->m_bXStatusEnabled)
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_XTITLE),GWLP_WNDPROC,(LONG_PTR)OldMessageEditProc);
}
if (dat->hEvent) UnhookEvent(dat->hEvent);
SAFE_FREE(&dat->okButtonFormat);
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index 41f3eb8de4..b7b60a7c0e 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -24,8 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber.h"
#include "jabber_caps.h"
-
-static BOOL CALLBACK JabberFormMultiLineWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK JabberFormMultiLineWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
//case WM_GETDLGCODE:
@@ -37,7 +36,7 @@ static BOOL CALLBACK JabberFormMultiLineWndProc(HWND hwnd, UINT msg, WPARAM wPar };
break;
}
- return CallWindowProc((WNDPROC) GetWindowLongPtr(hwnd, GWLP_USERDATA), hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, JabberFormMultiLineWndProc, msg, wParam, lParam);
}
struct TJabberFormControlInfo
@@ -331,8 +330,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|ES_LEFT|ES_MULTILINE|ES_AUTOVSCROLL|ES_WANTRETURN,
0, 0, 0, 0,
hwndStatic, (HMENU) layout_info->id, hInst, NULL);
- WNDPROC oldWndProc = (WNDPROC) SetWindowLongPtr(item->hCtrl, GWLP_WNDPROC, (LONG_PTR)JabberFormMultiLineWndProc);
- SetWindowLongPtr(item->hCtrl, GWLP_USERDATA, (LONG_PTR) oldWndProc);
+ mir_subclassWindow(item->hCtrl, JabberFormMultiLineWndProc);
++layout_info->id;
break;
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index ad47e46892..3c6683eb26 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -581,8 +581,7 @@ private: return;
m_txtPassword.GetText(pass, SIZEOF(pass));
- if (lstrcmp(buf, pass))
- {
+ if (lstrcmp(buf, pass)) {
MessageBox(m_hwnd, TranslateT("Passwords do not match."), _T("Miranda NG"), MB_ICONSTOP|MB_OK);
return;
}
@@ -591,21 +590,18 @@ private: m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
- if (m_chkManualHost.GetState() == BST_CHECKED)
- {
+ if (m_chkManualHost.GetState() == BST_CHECKED) {
regInfo.port = (WORD)m_txtManualPort.GetInt();
m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
- } else
- {
+ }
+ else {
regInfo.port = (WORD)m_txtPort.GetInt();
regInfo.manualHost[0] = '\0';
}
- if (regInfo.username[0] && regInfo.password[0] && regInfo.server[0] && regInfo.port>0 && ((m_chkManualHost.GetState() != BST_CHECKED) || regInfo.manualHost[0]))
- {
+ if (regInfo.username[0] && regInfo.password[0] && regInfo.server[0] && regInfo.port>0 && ((m_chkManualHost.GetState() != BST_CHECKED) || regInfo.manualHost[0])) {
CJabberDlgRegister dlg(m_proto, m_hwnd, ®Info);
dlg.DoModal();
-// DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_OPT_REGISTER), m_hwnd, JabberRegisterDlgProc, (LPARAM)®Info);
}
}
@@ -643,13 +639,12 @@ private: {
CCtrlCheck *chk = (CCtrlCheck *)sender;
- if (chk->GetState() == BST_CHECKED)
- {
+ if (chk->GetState() == BST_CHECKED) {
m_txtManualHost.Enable();
m_txtManualPort.Enable();
m_txtPort.Disable();
- } else
- {
+ }
+ else {
m_txtManualHost.Disable();
m_txtManualPort.Disable();
m_txtPort.Enable();
@@ -969,14 +964,12 @@ enum { RRA_SYNCDONE
};
-typedef struct _tag_RosterhEditDat{
- WNDPROC OldEditProc;
+struct ROSTEREDITDAT
+{
HWND hList;
int index;
int subindex;
-} ROSTEREDITDAT;
-
-static WNDPROC _RosterOldListProc=NULL;
+};
static int _RosterInsertListItem(HWND hList, const TCHAR * jid, const TCHAR * nick, const TCHAR * group, const TCHAR * subscr, BOOL bChecked)
{
@@ -1223,16 +1216,13 @@ static void _RosterItemEditEnd(HWND hEditor, ROSTEREDITDAT * edat, BOOL bCancel) DestroyWindow(hEditor);
}
-static BOOL CALLBACK _RosterItemNewEditProc(HWND hEditor, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK _RosterItemNewEditProc(HWND hEditor, UINT msg, WPARAM wParam, LPARAM lParam)
{
ROSTEREDITDAT * edat = (ROSTEREDITDAT *) GetWindowLongPtr(hEditor,GWLP_USERDATA);
if ( !edat) return 0;
- switch(msg)
- {
-
+ switch(msg) {
case WM_KEYDOWN:
- switch(wParam)
- {
+ switch(wParam) {
case VK_RETURN:
_RosterItemEditEnd(hEditor, edat, FALSE);
return 0;
@@ -1241,6 +1231,7 @@ static BOOL CALLBACK _RosterItemNewEditProc(HWND hEditor, UINT msg, WPARAM wPara return 0;
}
break;
+
case WM_GETDLGCODE:
if (lParam) {
MSG *msg2 = (MSG*)lParam;
@@ -1248,23 +1239,20 @@ static BOOL CALLBACK _RosterItemNewEditProc(HWND hEditor, UINT msg, WPARAM wPara if (msg2->message==WM_CHAR && msg2->wParam=='\t') return 0;
}
return DLGC_WANTMESSAGE;
+
case WM_KILLFOCUS:
_RosterItemEditEnd(hEditor, edat, FALSE);
return 0;
- }
- if (msg==WM_DESTROY)
- {
- SetWindowLongPtr(hEditor, GWLP_WNDPROC, (LONG_PTR) edat->OldEditProc);
+ case WM_DESTROY:
SetWindowLongPtr(hEditor, GWLP_USERDATA, (LONG_PTR) 0);
free(edat);
return 0;
}
- else return CallWindowProc(edat->OldEditProc, hEditor, msg, wParam, lParam);
+
+ return mir_callNextSubclass(hEditor, _RosterItemNewEditProc, msg, wParam, lParam);
}
-
-
void CJabberProto::_RosterExportToFile(HWND hwndDlg)
{
TCHAR filename[MAX_PATH]={0};
@@ -1426,12 +1414,10 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) SendMessage(hwndDlg, JM_STATUSCHANGED, 0, 0);
}
-static BOOL CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg==WM_MOUSEWHEEL || msg==WM_NCLBUTTONDOWN || msg==WM_NCRBUTTONDOWN)
- {
SetFocus(hList);
- }
if (msg==WM_LBUTTONDOWN)
{
@@ -1458,15 +1444,14 @@ static BOOL CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam, LPA mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
ROSTEREDITDAT * edat=(ROSTEREDITDAT *)malloc(sizeof(ROSTEREDITDAT));
- edat->OldEditProc=(WNDPROC)GetWindowLongPtr(hEditor, GWLP_WNDPROC);
- SetWindowLongPtr(hEditor,GWLP_WNDPROC,(LONG_PTR)_RosterItemNewEditProc);
+ mir_subclassWindow(hEditor, _RosterItemNewEditProc);
edat->hList=hList;
edat->index=lvhti.iItem;
edat->subindex=lvhti.iSubItem;
SetWindowLongPtr(hEditor,GWLP_USERDATA,(LONG_PTR)edat);
}
}
- return CallWindowProc(_RosterOldListProc, hList, msg, wParam, lParam);
+ return mir_callNextSubclass(hList, _RosterNewListProc, msg, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1486,8 +1471,6 @@ static int sttRosterEditorResizer(HWND /*hwndDlg*/, LPARAM, UTILRESIZECONTROL *u case IDC_EXPORT:
case IDC_IMPORT:
return RD_ANCHORX_RIGHT|RD_ANCHORY_BOTTOM;
-// case IDC_STATUSBAR:
-// return RD_ANCHORX_LEFT|RD_ANCHORX_WIDTH|RD_ANCHORY_BOTTOM;
}
return RD_ANCHORX_LEFT|RD_ANCHORY_TOP;
}
@@ -1528,16 +1511,15 @@ static INT_PTR CALLBACK JabberRosterOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wP Utils_RestoreWindowPosition(hwndDlg, NULL, ppro->m_szModuleName, "rosterCtrlWnd_");
ListView_SetExtendedListViewStyle(GetDlgItem(hwndDlg,IDC_ROSTER), LVS_EX_CHECKBOXES | LVS_EX_BORDERSELECT /*| LVS_EX_FULLROWSELECT*/ | LVS_EX_GRIDLINES /*| LVS_EX_HEADERDRAGDROP*/);
- _RosterOldListProc=(WNDPROC) GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_ROSTER), GWLP_WNDPROC);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_ROSTER), GWLP_WNDPROC, (LONG_PTR) _RosterNewListProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_ROSTER), _RosterNewListProc);
_RosterListClear(hwndDlg);
ppro->rrud.hwndDlg = hwndDlg;
ppro->rrud.bReadyToDownload = TRUE;
ppro->rrud.bReadyToUpload = FALSE;
SendMessage(hwndDlg, JM_STATUSCHANGED, 0, 0);
-
- return TRUE;
}
+ return TRUE;
+
case WM_GETMINMAXINFO:
{
LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
@@ -1545,17 +1527,19 @@ static INT_PTR CALLBACK JabberRosterOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wP lpmmi->ptMinTrackSize.y = 390;
return 0;
}
+
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = {0};
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER3);
- urd.pfnResizer = sttRosterEditorResizer;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ {
+ UTILRESIZEDIALOG urd = {0};
+ urd.cbSize = sizeof(urd);
+ urd.hInstance = hInst;
+ urd.hwndDlg = hwndDlg;
+ urd.lpTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER3);
+ urd.pfnResizer = sttRosterEditorResizer;
+ CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ }
break;
- }
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_DOWNLOAD:
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index bb287e35c9..4581325496 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -861,22 +861,19 @@ void CJabberDlgPrivacyLists::OnInitDialog() CListFilter(GetDlgItem(m_hwnd, IDC_CLIST));
CListApplyList(GetDlgItem(m_hwnd, IDC_CLIST));
- if (db_get_b(NULL, m_proto->m_szModuleName, "plistsWnd_simpleMode", 1))
- {
+ if ( db_get_b(NULL, m_proto->m_szModuleName, "plistsWnd_simpleMode", 1)) {
UIShowControls(m_hwnd, idSimpleControls, SW_SHOW);
UIShowControls(m_hwnd, idAdvancedControls, SW_HIDE);
CheckDlgButton(m_hwnd, IDC_BTN_SIMPLE, TRUE);
- } else
- {
+ }
+ else {
UIShowControls(m_hwnd, idSimpleControls, SW_HIDE);
UIShowControls(m_hwnd, idAdvancedControls, SW_SHOW);
CheckDlgButton(m_hwnd, IDC_BTN_ADVANCED, TRUE);
}
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LB_LISTS), GWLP_USERDATA,
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LB_LISTS), GWLP_WNDPROC, (LONG_PTR)LstListsSubclassProc));
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_PL_RULES_LIST), GWLP_USERDATA,
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_PL_RULES_LIST), GWLP_WNDPROC, (LONG_PTR)LstRulesSubclassProc));
+ mir_subclassWindow( GetDlgItem(m_hwnd, IDC_LB_LISTS), LstListsSubclassProc);
+ mir_subclassWindow( GetDlgItem(m_hwnd, IDC_PL_RULES_LIST), LstRulesSubclassProc);
SetStatusText(TranslateT("Loading..."));
@@ -889,8 +886,7 @@ void CJabberDlgPrivacyLists::OnClose() DestroyWindow(m_hwnd);
CSuper::OnClose();
}
- else
- m_lresult = TRUE;
+ else m_lresult = TRUE;
}
void CJabberDlgPrivacyLists::OnDestroy()
@@ -1696,52 +1692,43 @@ void CJabberDlgPrivacyLists::EnableEditorControls() LRESULT CALLBACK CJabberDlgPrivacyLists::LstListsSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WNDPROC sttOldWndProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch (msg)
- {
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- {
- if (wParam == VK_INSERT)
- return UIEmulateBtnClick(GetParent(hwnd), IDC_ADD_LIST);
- if (wParam == VK_DELETE)
- return UIEmulateBtnClick(GetParent(hwnd), IDC_REMOVE_LIST);
- if (wParam == VK_SPACE)
- {
- if (GetAsyncKeyState(VK_CONTROL))
- return UIEmulateBtnClick(GetParent(hwnd), IDC_SET_DEFAULT);
- return UIEmulateBtnClick(GetParent(hwnd), IDC_ACTIVATE);
- }
-
- break;
+ switch (msg) {
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ if (wParam == VK_INSERT)
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_ADD_LIST);
+ if (wParam == VK_DELETE)
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_REMOVE_LIST);
+ if (wParam == VK_SPACE) {
+ if (GetAsyncKeyState(VK_CONTROL))
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_SET_DEFAULT);
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_ACTIVATE);
}
+
+ break;
}
- return CallWindowProc(sttOldWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CJabberDlgPrivacyLists::LstListsSubclassProc, msg, wParam, lParam);
}
LRESULT CALLBACK CJabberDlgPrivacyLists::LstRulesSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WNDPROC sttOldWndProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch (msg)
- {
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- {
- if (wParam == VK_INSERT)
- return UIEmulateBtnClick(GetParent(hwnd), IDC_ADD_RULE);
- if (wParam == VK_DELETE)
- return UIEmulateBtnClick(GetParent(hwnd), IDC_REMOVE_RULE);
- if ((wParam == VK_UP) && (lParam & (1UL << 29)))
- return UIEmulateBtnClick(GetParent(hwnd), IDC_UP_RULE);
- if ((wParam == VK_DOWN) && (lParam & (1UL << 29)))
- return UIEmulateBtnClick(GetParent(hwnd), IDC_DOWN_RULE);
- if (wParam == VK_F2)
- return UIEmulateBtnClick(GetParent(hwnd), IDC_EDIT_RULE);
-
- break;
- }
+ switch (msg) {
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ if (wParam == VK_INSERT)
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_ADD_RULE);
+ if (wParam == VK_DELETE)
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_REMOVE_RULE);
+ if ((wParam == VK_UP) && (lParam & (1UL << 29)))
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_UP_RULE);
+ if ((wParam == VK_DOWN) && (lParam & (1UL << 29)))
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_DOWN_RULE);
+ if (wParam == VK_F2)
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_EDIT_RULE);
+
+ break;
}
- return CallWindowProc(sttOldWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CJabberDlgPrivacyLists::LstRulesSubclassProc, msg, wParam, lParam);
}
BOOL CJabberDlgPrivacyLists::CanExit()
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index f9a569b3d6..7d645b10c8 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -1176,9 +1176,6 @@ void EnableControlsArray(HWND hWndDlg, WORD *pwControlsList, size_t dwControlsLi LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- LRESULT lrRet = 0;
- WNDPROC OldMessageEditProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-
if (msg == WM_CHAR)
if (GetKeyState(VK_CONTROL) & 0x8000) {
if (wParam == '\n') {
@@ -1195,10 +1192,7 @@ LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA }
}
- if (OldMessageEditProc)
- lrRet = CallWindowProc(OldMessageEditProc, hwnd, msg, wParam, lParam);
-
- return lrRet;
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1215,20 +1209,13 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP dat = (SetXStatusData*)lParam;
if (dat) {
char szValueName[MAX_PATH];
- HWND hWndEdit;
WCHAR szBuff[STATUS_TITLE_MAX+STATUS_DESC_MAX];
- WNDPROC OldMessageEditProc;
dat->hDlgIcon = IconLibGetIcon(hXStatusAdvancedStatusIcons[dat->dwXStatus]);
dat->dwCountdown = 5;
- hWndEdit = GetDlgItem(hWndDlg, IDC_XTITLE);
- OldMessageEditProc = (WNDPROC)SetWindowLongPtr(hWndEdit, GWLP_WNDPROC, (LONG_PTR)MessageEditSubclassProc);
- SetWindowLongPtr(hWndEdit, GWLP_USERDATA, (LONG_PTR)OldMessageEditProc);
-
- hWndEdit = GetDlgItem(hWndDlg, IDC_XMSG);
- OldMessageEditProc = (WNDPROC)SetWindowLongPtr(hWndEdit, GWLP_WNDPROC, (LONG_PTR)MessageEditSubclassProc);
- SetWindowLongPtr(hWndEdit, GWLP_USERDATA, (LONG_PTR)OldMessageEditProc);
+ mir_subclassWindow( GetDlgItem(hWndDlg, IDC_XTITLE), MessageEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hWndDlg, IDC_XMSG), MessageEditSubclassProc);
SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (LONG_PTR)dat);
SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_XTITLE, EM_LIMITTEXT, STATUS_TITLE_MAX, 0);
diff --git a/protocols/Tlen/src/jabber_opt.cpp b/protocols/Tlen/src/jabber_opt.cpp index 6f71238db9..ff6ea7620f 100644 --- a/protocols/Tlen/src/jabber_opt.cpp +++ b/protocols/Tlen/src/jabber_opt.cpp @@ -120,21 +120,18 @@ int TlenOptionsInit(void *ptr, WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK JabberValidateUsernameWndProc(HWND hwndEdit, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WNDPROC oldProc = (WNDPROC) GetWindowLongPtr(hwndEdit, GWLP_USERDATA);
-
switch (msg) {
case WM_CHAR:
if (strchr("\"&'/:<>@", wParam&0xff) != NULL)
return 0;
break;
}
- return CallWindowProc(oldProc, hwndEdit, msg, wParam, lParam);
+ return mir_callNextSubclass(hwndEdit, JabberValidateUsernameWndProc, msg, wParam, lParam);
}
INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
char text[256];
- WNDPROC oldProc;
TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
@@ -155,11 +152,10 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE));
- oldProc = (WNDPROC) GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_WNDPROC);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_USERDATA, (LONG_PTR) oldProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_WNDPROC, (LONG_PTR) JabberValidateUsernameWndProc);
- return TRUE;
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), JabberValidateUsernameWndProc);
}
+ return TRUE;
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_EDIT_USERNAME:
diff --git a/src/core/stdaway/sendmsg.cpp b/src/core/stdaway/sendmsg.cpp index e422707372..ac9c01d74d 100644 --- a/src/core/stdaway/sendmsg.cpp +++ b/src/core/stdaway/sendmsg.cpp @@ -140,12 +140,9 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) return dbv.ptszVal;
}
-static WNDPROC OldMessageEditProc;
-
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
- {
+ switch(msg) {
case WM_CHAR:
if (wParam == '\n' && GetKeyState(VK_CONTROL) & 0x8000)
{
@@ -181,7 +178,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar }
break;
}
- return CallWindowProc(OldMessageEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
void ChangeAllProtoMessages(char *szProto, int statusMode, TCHAR *msg)
@@ -235,7 +232,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa dat->szProto = newdat->szProto;
mir_free(newdat);
SendDlgItemMessage(hwndDlg, IDC_MSG, EM_LIMITTEXT, 1024, 0);
- OldMessageEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSG), GWLP_WNDPROC, (LONG_PTR)MessageEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MSG), MessageEditSubclassProc);
{
TCHAR str[256], format[128];
GetWindowText(hwndDlg, format, SIZEOF(format));
@@ -310,7 +307,6 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa KillTimer(hwndDlg, 1);
UnhookEvent(dat->hPreshutdown);
Window_FreeIcon_IcoLib(hwndDlg);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSG), GWLP_WNDPROC, (LONG_PTR)OldMessageEditProc);
mir_free(dat);
hwndStatusMsg = NULL;
break;
diff --git a/src/core/stdchat/src/richutil.cpp b/src/core/stdchat/src/richutil.cpp index a6b3d5971a..46c9e5c28e 100644 --- a/src/core/stdchat/src/richutil.cpp +++ b/src/core/stdchat/src/richutil.cpp @@ -22,6 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <windows.h>
#include <stdio.h>
#include <richedit.h>
+
+#include <m_core.h>
#include "richutil.h"
/*
@@ -176,29 +178,29 @@ int RichUtil_SubClass(HWND hwndEdit) { slist = rlist_append(slist, ru);
LeaveCriticalSection(&csRich);
SetWindowLongPtr(ru->hwnd, GWLP_USERDATA, (LONG_PTR)ru); // Ugly hack
- ru->origProc = (WNDPROC)SetWindowLongPtr(ru->hwnd, GWLP_WNDPROC, (LONG_PTR)&RichUtil_Proc);
+ mir_subclassWindow(ru->hwnd, RichUtil_Proc);
RichUtil_ClearUglyBorder(ru);
return 1;
}
return 0;
}
-static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
+static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
TRichUtil *ru;
-
+
EnterCriticalSection(&csRich);
ru = rlist_find(slist, hwnd);
LeaveCriticalSection(&csRich);
switch(msg) {
- case WM_THEMECHANGED:
- case WM_STYLECHANGED:
- {
- RichUtil_ClearUglyBorder(ru);
- break;
- }
- case WM_NCPAINT:
+ case WM_THEMECHANGED:
+ case WM_STYLECHANGED:
+ RichUtil_ClearUglyBorder(ru);
+ break;
+
+ case WM_NCPAINT:
{
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
if (ru->hasUglyBorder&&MyIsThemeActive()) {
HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT");
@@ -232,11 +234,11 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
return ret;
}
- case WM_NCCALCSIZE:
+ case WM_NCCALCSIZE:
{
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS*)lParam;
-
+
if (ru->hasUglyBorder&&MyIsThemeActive()) {
HANDLE hTheme = MyOpenThemeData(hwnd, L"EDIT");
@@ -261,17 +263,14 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
return ret;
}
- case WM_ENABLE:
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME);
- break;
- case WM_DESTROY:
- {
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
- if(IsWindow(hwnd)) {
- if ((WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC) == &RichUtil_Proc)
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)ru->origProc);
- }
+ case WM_ENABLE:
+ RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME);
+ break;
+
+ case WM_DESTROY:
+ {
+ LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
EnterCriticalSection(&csRich);
slist = rlist_remove(slist, ru);
LeaveCriticalSection(&csRich);
@@ -279,7 +278,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return ret;
}
}
- return CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
}
static VOID RichUtil_ClearUglyBorder(TRichUtil *ru) {
diff --git a/src/core/stdchat/src/richutil.h b/src/core/stdchat/src/richutil.h index 9a69f8f809..97d85aeddf 100644 --- a/src/core/stdchat/src/richutil.h +++ b/src/core/stdchat/src/richutil.h @@ -45,7 +45,6 @@ typedef struct { HWND hwnd;
RECT rect;
int hasUglyBorder;
- WNDPROC origProc;
} TRichUtil;
void RichUtil_Load();
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 59fc8e830d..0627dfbea1 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -34,12 +34,6 @@ extern BOOL SmileyAddInstalled; extern TABLIST * g_TabList;
extern HIMAGELIST hIconsList;
-static WNDPROC OldSplitterProc;
-static WNDPROC OldMessageProc;
-static WNDPROC OldNicklistProc;
-static WNDPROC OldTabProc;
-static WNDPROC OldFilterButtonProc;
-static WNDPROC OldLogProc;
static HKL hkl = NULL;
typedef struct
@@ -48,7 +42,6 @@ typedef struct TCHAR szTabSave[20];
} MESSAGESUBDATA;
-
static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg) {
@@ -78,7 +71,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LP PostMessage(GetParent(hwnd),WM_SIZE, 0, 0);
return 0;
}
- return CallWindowProc(OldSplitterProc,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
static void InitButtons(HWND hwndDlg, SESSION_INFO* si)
@@ -737,7 +730,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return 0;
}
- return CallWindowProc(OldMessageProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageSubclassProc, msg, wParam, lParam);
}
static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
@@ -830,7 +823,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L break;
}
- return CallWindowProc(OldFilterButtonProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ButtonSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -873,7 +866,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
}
- return CallWindowProc(OldLogProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, LogSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -987,7 +980,7 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
}
- return CallWindowProc(OldTabProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, TabSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -1103,13 +1096,11 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, POINT p;
GetCursorPos(&p);
SendMessage( parentdat->hwndTooltip,TTM_TRACKPOSITION,0,(LPARAM)MAKELPARAM(p.x + 15,p.y + 15));
-// SendMessage( parentdat->hwndTooltip, TTM_ACTIVATE, TRUE, 0 );
} }
break;
-
}
- return CallWindowProc(OldNicklistProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, NicklistSubclassProc, msg, wParam, lParam);
}
static int RestoreWindowPosition(HWND hwnd, HANDLE hContact, char * szModule, char * szNamePrefix, UINT showCmd)
@@ -1182,15 +1173,15 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, IID_IAccPropServices, (LPVOID *)si->pAccPropServicesForNickList);
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)si);
- OldSplitterProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_SPLITTERX),GWLP_WNDPROC,(LONG_PTR)SplitterSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_SPLITTERY),GWLP_WNDPROC,(LONG_PTR)SplitterSubclassProc);
- OldNicklistProc=(WNDPROC)SetWindowLongPtr(hNickList,GWLP_WNDPROC,(LONG_PTR)NicklistSubclassProc);
- OldTabProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_TAB),GWLP_WNDPROC,(LONG_PTR)TabSubclassProc);
- OldLogProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_LOG),GWLP_WNDPROC,(LONG_PTR)LogSubclassProc);
- OldFilterButtonProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_FILTER),GWLP_WNDPROC,(LONG_PTR)ButtonSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_COLOR),GWLP_WNDPROC,(LONG_PTR)ButtonSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_BKGCOLOR),GWLP_WNDPROC,(LONG_PTR)ButtonSubclassProc);
- OldMessageProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE), GWLP_WNDPROC,(LONG_PTR)MessageSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_SPLITTERX), SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_SPLITTERY), SplitterSubclassProc);
+ mir_subclassWindow( hNickList, NicklistSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_TAB), TabSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_LOG), LogSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_FILTER), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_COLOR), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_BKGCOLOR), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MESSAGE), MessageSubclassProc);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SUBCLASSED, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, 1, 0);
mask = (int)SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETEVENTMASK, 0, 0);
@@ -2709,17 +2700,8 @@ LABEL_SHOWWINDOW: si->hwndTooltip = NULL;
if (si->pAccPropServicesForNickList) si->pAccPropServicesForNickList->Release();
SetWindowLongPtr(hwndDlg,GWLP_USERDATA,0);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_SPLITTERX),GWLP_WNDPROC,(LONG_PTR)OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_SPLITTERY),GWLP_WNDPROC,(LONG_PTR)OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_LIST),GWLP_WNDPROC,(LONG_PTR)OldNicklistProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_TAB),GWLP_WNDPROC,(LONG_PTR)OldTabProc);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MESSAGE),GWLP_WNDPROC,(LONG_PTR)OldMessageProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_LOG),GWLP_WNDPROC,(LONG_PTR)OldLogProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_FILTER),GWLP_WNDPROC,(LONG_PTR)OldFilterButtonProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_COLOR),GWLP_WNDPROC,(LONG_PTR)OldFilterButtonProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_BKGCOLOR),GWLP_WNDPROC,(LONG_PTR)OldFilterButtonProc);
break;
}
- return(FALSE);
+ return FALSE;
}
diff --git a/src/core/stdfile/fileexistsdlg.cpp b/src/core/stdfile/fileexistsdlg.cpp index 4efb73ebfb..8729229462 100644 --- a/src/core/stdfile/fileexistsdlg.cpp +++ b/src/core/stdfile/fileexistsdlg.cpp @@ -112,24 +112,23 @@ static void DoAnnoyingShellCommand(HWND hwnd, const TCHAR *szFilename, int cmd, }
}
-static WNDPROC pfnIconWindowProc;
static LRESULT CALLBACK IconCtrlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
PROTOFILETRANSFERSTATUS* pft = (PROTOFILETRANSFERSTATUS*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
switch(msg) {
- case WM_LBUTTONDBLCLK:
- ShellExecute(hwnd, NULL, pft->tszCurrentFile, NULL, NULL, SW_SHOW);
- break;
- case WM_RBUTTONUP:
+ case WM_LBUTTONDBLCLK:
+ ShellExecute(hwnd, NULL, pft->tszCurrentFile, NULL, NULL, SW_SHOW);
+ break;
+ case WM_RBUTTONUP:
{ POINT pt;
- pt.x = (short)LOWORD(lParam); pt.y = (short)HIWORD(lParam);
- ClientToScreen(hwnd, &pt);
- DoAnnoyingShellCommand(hwnd, pft->tszCurrentFile, C_CONTEXTMENU, &pt);
- return 0;
+ pt.x = (short)LOWORD(lParam); pt.y = (short)HIWORD(lParam);
+ ClientToScreen(hwnd, &pt);
+ DoAnnoyingShellCommand(hwnd, pft->tszCurrentFile, C_CONTEXTMENU, &pt);
+ return 0;
}
}
- return CallWindowProc(pfnIconWindowProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, IconCtrlSubclassProc, msg, wParam, lParam);
}
struct loadiconsstartinfo {
@@ -215,7 +214,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM GetSensiblyFormattedSize(fts->currentFileSize, szSize, SIZEOF(szSize), 0, 1, NULL);
SetDlgItemText(hwndDlg, IDC_NEWSIZE, szSize);
- pfnIconWindowProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EXISTINGICON), GWLP_WNDPROC, (LONG_PTR)IconCtrlSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_EXISTINGICON), IconCtrlSubclassProc);
hwndFocus = GetDlgItem(hwndDlg, IDC_RESUME);
if (_tstati64(fts->tszCurrentFile, &statbuf) == 0) {
diff --git a/src/core/stdfile/filesenddlg.cpp b/src/core/stdfile/filesenddlg.cpp index 4523c63b36..e41670889b 100644 --- a/src/core/stdfile/filesenddlg.cpp +++ b/src/core/stdfile/filesenddlg.cpp @@ -170,24 +170,23 @@ static BOOL CALLBACK ClipSiblingsChildEnumProc(HWND hwnd, LPARAM) return TRUE;
}
-static WNDPROC OldSendEditProc;
static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_CHAR:
- if (wParam == '\n' && GetKeyState(VK_CONTROL)&0x8000) {
- PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
- return 0;
- }
- break;
- case WM_SYSCHAR:
- if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU)&0x8000) {
- PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
- return 0;
- }
- break;
+ case WM_CHAR:
+ if (wParam == '\n' && GetKeyState(VK_CONTROL)&0x8000) {
+ PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ break;
+ case WM_SYSCHAR:
+ if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU)&0x8000) {
+ PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ break;
}
- return CallWindowProc(OldSendEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, SendEditSubclassProc, msg, wParam, lParam);
}
INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -210,7 +209,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l TranslateDialogDefault(hwndDlg);
EnumChildWindows(hwndDlg, ClipSiblingsChildEnumProc, 0);
- OldSendEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSG), GWLP_WNDPROC, (LONG_PTR)SendEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MSG), SendEditSubclassProc);
Window_SetIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE);
Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View User's Details"));
@@ -349,7 +348,6 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (dat)
FreeFileDlgData(dat);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSG), GWLP_WNDPROC, (LONG_PTR)OldSendEditProc);
return TRUE;
}
return FALSE;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index dcb83e9f35..f0d40a305b 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -504,7 +504,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar mir_free(dat);
return 0;
}
- return CallWindowProc(pdat->OldMessageEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -539,7 +539,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, ReleaseCapture();
return 0;
}
- return CallWindowProc(pdat->OldSplitterProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc)
@@ -779,9 +779,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, (WPARAM) sizeof(TCHAR) * 0x7FFFFFFF, 0);
}
- dat->OldMessageEditProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE), GWLP_WNDPROC, (LONG_PTR) MessageEditSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), MessageEditSubclassProc);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SUBCLASSED, 0, 0);
- dat->OldSplitterProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SplitterSubclassProc);
if (dat->hContact) {
int historyMode = db_get_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY);
@@ -1850,9 +1850,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP tcmdlist_free(dat->cmdList);
WindowList_Remove(g_dat->hMessageWindowList, hwndDlg);
DBWriteContactSettingDword(db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT)?dat->hContact:NULL, SRMMMOD, "splitterPos", dat->splitterPos);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) dat->OldSplitterProc);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE), GWLP_WNDPROC, (LONG_PTR) dat->OldMessageEditProc);
{
HFONT hFont = (HFONT) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
if (hFont != NULL && hFont != (HFONT) SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0))
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 1403172b2a..3414ee5e98 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -38,7 +38,6 @@ struct SrmmWindowData HANDLE hContact;
HANDLE hDbEventFirst, hDbEventLast;
HBRUSH hBkgBrush;
- WNDPROC OldMessageEditProc, OldSplitterProc;
int splitterPos, originalSplitterPos;
SIZE minEditBoxSize;
RECT minEditInit;
diff --git a/src/core/stdmsg/src/richutil.cpp b/src/core/stdmsg/src/richutil.cpp index c863395cd0..42e3f890f3 100644 --- a/src/core/stdmsg/src/richutil.cpp +++ b/src/core/stdmsg/src/richutil.cpp @@ -118,7 +118,7 @@ int RichUtil_SubClass(HWND hwndEdit) List_Insert(&sListInt, ru, idx);
LeaveCriticalSection(&csRich);
- ru->origProc = (WNDPROC)SetWindowLongPtr(ru->hwnd, GWLP_WNDPROC, (LONG_PTR)&RichUtil_Proc);
+ mir_subclassWindow(ru->hwnd, RichUtil_Proc);
RichUtil_ClearUglyBorder(ru);
return 1;
}
@@ -135,9 +135,8 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (ru == NULL) return 0;
- switch(msg)
- {
- case WM_CHAR:
+ switch(msg) {
+ case WM_CHAR:
{
HWND hwndMsg = GetDlgItem(GetParent(hwnd), IDC_MESSAGE);
if (hwndMsg != hwnd)
@@ -148,16 +147,16 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
}
- case WM_THEMECHANGED:
- case WM_STYLECHANGED:
+ case WM_THEMECHANGED:
+ case WM_STYLECHANGED:
{
RichUtil_ClearUglyBorder(ru);
break;
}
- case WM_NCPAINT:
+ case WM_NCPAINT:
{
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
if (ru->hasUglyBorder && MyIsThemeActive())
{
HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT");
@@ -197,22 +196,18 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
return ret;
}
- case WM_NCCALCSIZE:
+ case WM_NCCALCSIZE:
{
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS*)lParam;
- if (ru->hasUglyBorder && MyIsThemeActive())
- {
+ if (ru->hasUglyBorder && MyIsThemeActive()) {
HANDLE hTheme = MyOpenThemeData(hwnd, L"EDIT");
-
- if (hTheme)
- {
+ if (hTheme) {
RECT rcClient ={0};
HDC hdc = GetDC(GetParent(hwnd));
- if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK)
- {
+ if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) {
ru->rect.left = rcClient.left-ncsParam->rgrc[0].left;
ru->rect.top = rcClient.top-ncsParam->rgrc[0].top;
ru->rect.right = ncsParam->rgrc[0].right-rcClient.right;
@@ -230,32 +225,24 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return ret;
}
- case WM_ENABLE:
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
- break;
+ case WM_ENABLE:
+ RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
+ break;
- case WM_GETDLGCODE:
- return CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam) & ~DLGC_HASSETSEL;
+ case WM_GETDLGCODE:
+ return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam) & ~DLGC_HASSETSEL;
- case WM_NCDESTROY:
- {
- LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ case WM_NCDESTROY:
+ LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
- if (IsWindow(hwnd))
- {
- if ((WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC) == &RichUtil_Proc)
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)ru->origProc);
- }
-
- EnterCriticalSection(&csRich);
- List_RemovePtr(&sListInt, ru);
- LeaveCriticalSection(&csRich);
+ EnterCriticalSection(&csRich);
+ List_RemovePtr(&sListInt, ru);
+ LeaveCriticalSection(&csRich);
- mir_free(ru);
- return ret;
- }
+ mir_free(ru);
+ return ret;
}
- return CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
}
static void RichUtil_ClearUglyBorder(TRichUtil *ru)
diff --git a/src/core/stdmsg/src/richutil.h b/src/core/stdmsg/src/richutil.h index ff90e14691..1408c85ead 100644 --- a/src/core/stdmsg/src/richutil.h +++ b/src/core/stdmsg/src/richutil.h @@ -26,7 +26,6 @@ typedef struct { HWND hwnd;
RECT rect;
int hasUglyBorder;
- WNDPROC origProc;
} TRichUtil;
void RichUtil_Load();
diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp index 863d58be63..dc0ef67bf4 100644 --- a/src/core/stdurl/urldialogs.cpp +++ b/src/core/stdurl/urldialogs.cpp @@ -438,7 +438,6 @@ static void GetOpenBrowserUrls(HWND hwndDlg, HWND hwndCombo) GetOpenBrowserUrlsForBrowser("iexplore", hwndDlg, hwndCombo);
}
-static WNDPROC OldSendEditProc;
static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
@@ -455,7 +454,7 @@ static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
break;
}
- return CallWindowProc(OldSendEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, SendEditSubclassProc, msg, wParam, lParam);
}
INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -489,8 +488,8 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCOUNT, 0, 0))SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_URLS, CBN_SELCHANGE), 0);
EnableWindow(GetDlgItem(hwndDlg, IDOK), (SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCURSEL, 0, 0) == CB_ERR)?FALSE:TRUE);
Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, "SRUrl", "send");
- OldSendEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE), GWLP_WNDPROC, (LONG_PTR)SendEditSubclassProc);
- OldSendEditProc = (WNDPROC)SetWindowLongPtr(GetWindow(GetDlgItem(hwndDlg, IDC_URLS), GW_CHILD), GWLP_WNDPROC, (LONG_PTR)SendEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MESSAGE), SendEditSubclassProc);
+ mir_subclassWindow( GetWindow(GetDlgItem(hwndDlg, IDC_URLS), GW_CHILD), SendEditSubclassProc);
// From message dlg
if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
@@ -647,8 +646,6 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP Button_FreeIcon_IcoLib(hwndDlg, IDC_USERMENU);
WindowList_Remove(hUrlWindowList, hwndDlg);
- SetWindowLongPtr(GetWindow(GetDlgItem(hwndDlg, IDC_URLS), GW_CHILD), GWLP_WNDPROC, (LONG_PTR)OldSendEditProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE), GWLP_WNDPROC, (LONG_PTR)OldSendEditProc);
if (dat->hAckEvent) UnhookEvent(dat->hAckEvent);
if (dat->sendBuffer != NULL) mir_free(dat->sendBuffer);
mir_free(dat);
diff --git a/src/mir_core/subclass.cpp b/src/mir_core/subclass.cpp index a526aeb9bf..6bb1eeb962 100644 --- a/src/mir_core/subclass.cpp +++ b/src/mir_core/subclass.cpp @@ -37,17 +37,10 @@ static LRESULT CALLBACK MSubclassWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP {
MSubclassData *p = arSubclass.find((MSubclassData*)&hwnd);
if (p != NULL) {
- for (int i=0; i < p->m_iHooks; i++) {
- LRESULT res = p->m_hooks[i](hwnd, uMsg, wParam, lParam);
- if (res != 0)
- return res;
- }
+ if (p->m_iHooks)
+ return p->m_hooks[0](hwnd, uMsg, wParam, lParam);
- if (uMsg == WM_DESTROY) {
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)p->m_origWndProc);
- arSubclass.remove(p);
- delete p;
- }
+ return p->m_origWndProc(hwnd, uMsg, wParam, lParam);
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
@@ -64,7 +57,37 @@ MIR_CORE_DLL(void) mir_subclassWindow(HWND hWnd, WNDPROC wndProc) p->m_hooks = (WNDPROC*)malloc( sizeof(WNDPROC));
arSubclass.insert(p);
}
- else p->m_hooks = (WNDPROC*)realloc(p->m_hooks, (p->m_iHooks+1)*sizeof(WNDPROC));
+ else {
+ for (int i=0; i < p->m_iHooks; i++)
+ if (p->m_hooks[i] == wndProc)
+ return;
+
+ p->m_hooks = (WNDPROC*)realloc(p->m_hooks, (p->m_iHooks+1)*sizeof(WNDPROC));
+ }
+
+ p->m_hooks[p->m_iHooks++] = wndProc;
+}
+
+MIR_CORE_DLL(void) mir_subclassWindowFull(HWND hWnd, WNDPROC wndProc, WNDPROC oldWndProc)
+{
+ MSubclassData *p = arSubclass.find((MSubclassData*)&hWnd);
+ if (p == NULL) {
+ p = new MSubclassData;
+ p->m_hWnd = hWnd;
+ p->m_origWndProc = oldWndProc;
+ p->m_iHooks = 0;
+ p->m_hooks = (WNDPROC*)malloc( sizeof(WNDPROC));
+ arSubclass.insert(p);
+
+ SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)MSubclassWndProc);
+ }
+ else {
+ for (int i=0; i < p->m_iHooks; i++)
+ if (p->m_hooks[i] == wndProc)
+ return;
+
+ p->m_hooks = (WNDPROC*)realloc(p->m_hooks, (p->m_iHooks+1)*sizeof(WNDPROC));
+ }
p->m_hooks[p->m_iHooks++] = wndProc;
}
@@ -72,11 +95,32 @@ MIR_CORE_DLL(void) mir_subclassWindow(HWND hWnd, WNDPROC wndProc) MIR_CORE_DLL(LRESULT) mir_callNextSubclass(HWND hWnd, WNDPROC wndProc, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
MSubclassData *p = arSubclass.find((MSubclassData*)&hWnd);
- if (p)
- for (int i=0; i < p->m_iHooks-1; i++)
+ if (p) {
+ int i;
+ for (i=0; i < p->m_iHooks; i++)
if (p->m_hooks[i] == wndProc)
- return p->m_hooks[i+1](hWnd, uMsg, wParam, lParam);
+ break;
+
+ // invalid / closed hook
+ if (i == p->m_iHooks)
+ return 0;
+
+ // next hook exitst, call it
+ if (i != p->m_iHooks-1)
+ return p->m_hooks[i+1](hWnd, uMsg, wParam, lParam);
+
+ // last hook called, ping the default window procedure
+ if (uMsg == WM_DESTROY) {
+ WNDPROC saveProc = p->m_origWndProc;
+ arSubclass.remove(p);
+ delete p;
+
+ SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)saveProc);
+ return CallWindowProc(saveProc, hWnd, uMsg, wParam, lParam);
+ }
+ return CallWindowProc(p->m_origWndProc, hWnd, uMsg, wParam, lParam);
+ }
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
@@ -86,9 +130,16 @@ MIR_CORE_DLL(void) KillModuleSubclassing(HMODULE hInst) MSubclassData *p = arSubclass[i];
for (int j=0; j < p->m_iHooks; ) {
if ( GetInstByAddress(p->m_hooks[j]) == hInst) {
+ WNDPROC saveProc = p->m_hooks[j];
+
+ // untie hook from a window to prevent calling mir_callNextSubclass from saveProc
for (int k=j+1; k < p->m_iHooks; k++)
p->m_hooks[k-1] = p->m_hooks[k];
p->m_iHooks--;
+
+ // emulate window destruction
+ saveProc(p->m_hWnd, WM_DESTROY, 0, 0);
+ saveProc(p->m_hWnd, WM_NCDESTROY, 0, 0);
}
else j++;
}
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index fb5053bd00..b4873b9d03 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -457,7 +457,6 @@ void fnDeleteFromContactList(HWND hwnd, struct ClcData *dat) }
}
-static WNDPROC OldRenameEditWndProc;
static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -484,7 +483,7 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara cli.pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 1);
return 0;
}
- return CallWindowProc(OldRenameEditWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, RenameEditSubclassProc, msg, wParam, lParam);
}
void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat)
@@ -507,7 +506,7 @@ void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat) cli.pfnCalcEipPosition(dat, contact, group, &pt);
int h = cli.pfnGetRowHeight(dat, dat->selection);
dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, NULL, cli.hInst, NULL);
- OldRenameEditWndProc = (WNDPROC) SetWindowLongPtr(dat->hwndRenameEdit, GWLP_WNDPROC, (LONG_PTR) RenameEditSubclassProc);
+ mir_subclassWindow(dat->hwndRenameEdit, RenameEditSubclassProc);
SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
SendMessage(dat->hwndRenameEdit, EM_SETSEL, 0, (LPARAM) (-1));
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 6dd96a921b..3922e42533 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -382,8 +382,6 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert return NULL;
}
-WNDPROC MyOldWindowProc = NULL;
-
LRESULT CALLBACK LBTNDOWNProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_LBUTTONDOWN && !(GetKeyState(VK_CONTROL)&0x8000)) {
@@ -424,7 +422,7 @@ LRESULT CALLBACK LBTNDOWNProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam }
}
- return CallWindowProc(MyOldWindowProc, hwnd, uMsg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, LBTNDOWNProc, uMsg, wParam, lParam);
}
static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -439,8 +437,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetWindowLongPtr( GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_USERDATA, (LONG_PTR)dat);
dat->dragging = 0;
dat->iInitMenuValue = db_get_b(NULL, "CList", "MoveProtoMenus", TRUE);
- MyOldWindowProc = (WNDPROC)GetWindowLongPtr( GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC);
- SetWindowLongPtr( GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC, (LONG_PTR)&LBTNDOWNProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MENUITEMS), LBTNDOWNProc);
{
HIMAGELIST himlCheckBoxes;
himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index d597d50a3f..67589a9d25 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -155,7 +155,7 @@ static LRESULT CALLBACK ProfileNameValidate(HWND edit, UINT msg, WPARAM wParam, return 0;
PostMessage(GetParent(edit), WM_INPUTCHANGED, 0, 0);
}
- return CallWindowProc((WNDPROC)GetWindowLongPtr(edit, GWLP_USERDATA), edit, msg, wParam, lParam);
+ return mir_callNextSubclass(edit, ProfileNameValidate, msg, wParam, lParam);
}
static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -187,10 +187,7 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA SendMessage(hwndCombo, CB_SETCURSEL, 0, 0);
// subclass the profile name box
- HWND hwndProfile = GetDlgItem(hwndDlg, IDC_PROFILENAME);
- WNDPROC proc = (WNDPROC)GetWindowLongPtr(hwndProfile, GWLP_WNDPROC);
- SetWindowLongPtr(hwndProfile, GWLP_USERDATA, (LONG_PTR)proc);
- SetWindowLongPtr(hwndProfile, GWLP_WNDPROC, (LONG_PTR)ProfileNameValidate);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PROFILENAME), ProfileNameValidate);
}
// decide if there is a default profile name given in the INI and if it should be used
diff --git a/src/modules/extraicons/options_ei.cpp b/src/modules/extraicons/options_ei.cpp index fc76ce5835..65866ae24b 100644 --- a/src/modules/extraicons/options_ei.cpp +++ b/src/modules/extraicons/options_ei.cpp @@ -67,8 +67,6 @@ static void RemoveExtraIcons(int slot) #define TVIS_FOCUSED 1
#endif
-WNDPROC origTreeProc;
-
static bool IsSelected(HWND tree, HTREEITEM hItem)
{
return (TVIS_SELECTED & TreeView_GetItemState(tree, hItem, TVIS_SELECTED)) == TVIS_SELECTED;
@@ -234,7 +232,7 @@ LRESULT CALLBACK TreeProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) }
}
- return CallWindowProc(origTreeProc, hwndDlg, msg, wParam, lParam);
+ return mir_callNextSubclass(hwndDlg, TreeProc, msg, wParam, lParam);
}
static vector<int> * Tree_GetIDs(HWND tree, HTREEITEM hItem)
@@ -468,7 +466,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP sort.lpfnCompare = CompareFunc;
TreeView_SortChildrenCB(tree, &sort, 0);
- origTreeProc = (WNDPROC) SetWindowLongPtr(tree, GWLP_WNDPROC, (INT_PTR)TreeProc);
+ mir_subclassWindow(tree, TreeProc);
}
return TRUE;
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index 952e30361a..e7fd848af1 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -252,15 +252,13 @@ static int MatchesFilter(const OptionsPageData *page, TCHAR *szFilterString) return ContainsFilterString(key, szFilterString);
}
-static WNDPROC OptionsFilterDefaultProc = NULL;
-
static LRESULT CALLBACK OptionsFilterSubclassProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message != WM_PAINT && message != WM_PRINT)
- return CallWindowProc(OptionsFilterDefaultProc, hWnd, message, wParam, lParam);
+ return mir_callNextSubclass(hWnd, OptionsFilterSubclassProc, message, wParam, lParam);
if (GetFocus() == hWnd || GetWindowTextLength(hWnd))
- return CallWindowProc(OptionsFilterDefaultProc, hWnd, message, wParam, lParam);
+ return mir_callNextSubclass(hWnd, OptionsFilterSubclassProc, message, wParam, lParam);
RECT rc;
GetClientRect(hWnd, &rc);
@@ -386,7 +384,7 @@ static void AeroPaintControl(HWND hwnd, HDC hdc, WNDPROC OldWndProc, UINT msg = //paint
SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)TRUE);
- CallWindowProc(OldWndProc, hwnd, msg, (WPARAM)tempDC, lpFlags);
+ mir_callNextSubclass(hwnd, OldWndProc, msg, (WPARAM)tempDC, lpFlags);
SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)FALSE);
// Fix alpha channel
@@ -403,7 +401,6 @@ static void AeroPaintControl(HWND hwnd, HDC hdc, WNDPROC OldWndProc, UINT msg = static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WNDPROC OldWndProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch (msg) {
case WM_CTLCOLOREDIT:
if ( !GetPropA((HWND)lParam, "Miranda.AeroRender.Active"))
@@ -415,14 +412,14 @@ static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam case WM_PRINT:
case WM_PRINTCLIENT:
- AeroPaintControl(hwnd, (HDC)wParam, OldWndProc, msg, lParam);
+ AeroPaintControl(hwnd, (HDC)wParam, AeroPaintSubclassProc, msg, lParam);
return TRUE;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
- AeroPaintControl(hwnd, hdc, OldWndProc);
+ AeroPaintControl(hwnd, hdc, AeroPaintSubclassProc);
EndPaint(hwnd, &ps);
}
return TRUE;
@@ -431,7 +428,7 @@ static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam RemovePropA(hwnd, "Miranda.AeroRender.Active");
break;
}
- return CallWindowProc(OldWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, AeroPaintSubclassProc, msg, wParam, lParam);
}
static void CALLBACK FilterSearchTimerFunc(HWND hwnd, UINT, UINT_PTR, DWORD)
@@ -662,13 +659,11 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L COMBOBOXINFO cbi;
cbi.cbSize = sizeof(COMBOBOXINFO);
getComboBoxInfo( GetDlgItem(hdlg, IDC_KEYWORD_FILTER), &cbi);
- OptionsFilterDefaultProc = (WNDPROC)SetWindowLongPtr(cbi.hwndItem, GWLP_WNDPROC, (LONG_PTR) OptionsFilterSubclassProc);
+ mir_subclassWindow(cbi.hwndItem, OptionsFilterSubclassProc);
if (IsAeroMode()) {
- SetWindowLongPtr(cbi.hwndCombo, GWLP_USERDATA, GetWindowLongPtr(cbi.hwndCombo, GWLP_WNDPROC));
- SetWindowLongPtr(cbi.hwndCombo, GWLP_WNDPROC, (LONG_PTR)AeroPaintSubclassProc);
- SetWindowLongPtr(cbi.hwndItem, GWLP_USERDATA, GetWindowLongPtr(cbi.hwndItem, GWLP_WNDPROC));
- SetWindowLongPtr(cbi.hwndItem, GWLP_WNDPROC, (LONG_PTR)AeroPaintSubclassProc);
+ mir_subclassWindow(cbi.hwndCombo, AeroPaintSubclassProc);
+ mir_subclassWindow(cbi.hwndItem, AeroPaintSubclassProc);
}
}
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index b3c46d4482..90ea348e59 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -347,6 +347,8 @@ int Plugin_UnloadDyn(pluginEntry *p) if ( CallPluginEventHook(p->bpi.hInst, hOkToExitEvent, 0, 0) != 0)
return FALSE;
+ KillModuleSubclassing(p->bpi.hInst);
+
CallPluginEventHook(p->bpi.hInst, hPreShutdownEvent, 0, 0);
CallPluginEventHook(p->bpi.hInst, hShutdownEvent, 0, 0);
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index 8448b255bb..12aa248e31 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -229,8 +229,7 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP ListView_SetItem(hwnd, &lvi);
} } } } }
- WNDPROC wnProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- return CallWindowProc(wnProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, PluginListWndProc, msg, wParam, lParam);
}
static int CALLBACK SortPlugins(WPARAM i1, LPARAM i2, LPARAM lParamSort)
@@ -254,8 +253,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar TranslateDialogDefault(hwndDlg);
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
- SetWindowLongPtr(hwndList, GWLP_USERDATA, (LONG_PTR)GetWindowLongPtr(hwndList, GWLP_WNDPROC));
- SetWindowLongPtr(hwndList, GWLP_WNDPROC, (LONG_PTR)PluginListWndProc);
+ mir_subclassWindow(hwndList, PluginListWndProc);
HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus()? ILC_COLOR32 : ILC_COLOR16), 4, 0);
ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_UNICODE);
diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index 7b128dcea7..4eec5c28b1 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -227,12 +227,9 @@ struct TAccMgrData struct TAccListData
{
- WNDPROC oldWndProc;
- int iItem;
+ int iItem;
RECT rcCheck;
-
HWND hwndEdit;
- WNDPROC oldEditProc;
};
static void sttClickButton(HWND hwndDlg, int idcButton)
@@ -272,7 +269,7 @@ static LRESULT CALLBACK sttEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, DestroyWindow(hwnd);
return 0;
}
- return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA), hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, sttEditSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -338,7 +335,7 @@ static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA ++rc.top; --rc.right;
dat->hwndEdit = CreateWindow(_T("EDIT"), pa->tszAccountName, WS_CHILD|WS_BORDER|ES_AUTOHSCROLL, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, hwnd, NULL, hInst, NULL);
- SetWindowLongPtr(dat->hwndEdit, GWLP_USERDATA, SetWindowLongPtr(dat->hwndEdit, GWLP_WNDPROC, (LONG_PTR)sttEditSubclassProc));
+ mir_subclassWindow(dat->hwndEdit, sttEditSubclassProc);
SendMessage(dat->hwndEdit, WM_SETFONT, (WPARAM)parentDat->hfntTitle, 0);
SendMessage(dat->hwndEdit, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN|EC_USEFONTINFO, 0);
SendMessage(dat->hwndEdit, EM_SETSEL, 0, (LPARAM) (-1));
@@ -371,7 +368,7 @@ static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA break;
}
- return CallWindowProc(dat->oldWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, AccListWndProc, msg, wParam, lParam);
}
static void sttSubclassAccList(HWND hwnd, BOOL subclass)
@@ -379,13 +376,11 @@ static void sttSubclassAccList(HWND hwnd, BOOL subclass) if (subclass) {
struct TAccListData *dat = (struct TAccListData *)mir_alloc(sizeof(struct TAccListData));
dat->iItem = -1;
- dat->oldWndProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)dat);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)AccListWndProc);
+ mir_subclassWindow(hwnd, AccListWndProc);
}
else {
struct TAccListData *dat = (struct TAccListData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)dat->oldWndProc);
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
mir_free(dat);
}
diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index b2159e5032..ed6a4bd40b 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -142,29 +142,23 @@ static LRESULT CALLBACK sttHotkeyEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP return TRUE;
case WM_DESTROY:
- {
- WNDPROC saveOldWndProc = data->oldWndProc;
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)data->oldWndProc);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- mir_free(data);
- return CallWindowProc(saveOldWndProc, hwnd, msg, wParam, lParam);
- }
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ mir_free(data);
}
- return CallWindowProc(data->oldWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, sttHotkeyEditProc, msg, wParam, lParam);
}
void HotkeyEditCreate(HWND hwnd)
{
THotkeyBoxData *data = (THotkeyBoxData *)mir_alloc(sizeof(THotkeyBoxData));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (ULONG_PTR)data);
- data->oldWndProc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (ULONG_PTR)sttHotkeyEditProc);
+ mir_subclassWindow(hwnd, sttHotkeyEditProc);
}
void HotkeyEditDestroy(HWND hwnd)
{
THotkeyBoxData *data = (THotkeyBoxData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (ULONG_PTR)data->oldWndProc);
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
mir_free(data);
}
diff --git a/src/modules/skin/skin.h b/src/modules/skin/skin.h index 3dbbb3a7c5..b36472a0dd 100644 --- a/src/modules/skin/skin.h +++ b/src/modules/skin/skin.h @@ -29,7 +29,6 @@ typedef enum { HKT_GLOBAL, HKT_LOCAL, HKT_MANUAL, HKT_COUNT } THotkeyType; struct THotkeyBoxData
{
- WNDPROC oldWndProc;
BYTE shift;
BYTE key;
};
|