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 /plugins/UserInfoEx/src/ex_import | |
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
Diffstat (limited to 'plugins/UserInfoEx/src/ex_import')
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp | 149 |
1 files changed, 68 insertions, 81 deletions
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;
}
|