diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-14 15:51:34 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-14 15:51:34 +0000 |
commit | e58823d961a630eb62e60d2ccb443761ba5f1704 (patch) | |
tree | 62d071be480d57af2a53f154a1468abe0b9449ff /src/modules/srfile/filesenddlg.cpp | |
parent | 721aea0764451e985d575236205808bbef298244 (diff) |
- all MS_CLIST_ADD*ITEM services replaced with Menu_Add*Item stubs.
- massive cleanup of the menu-related code
git-svn-id: http://svn.miranda-ng.org/main/trunk@410 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/srfile/filesenddlg.cpp')
-rw-r--r-- | src/modules/srfile/filesenddlg.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/src/modules/srfile/filesenddlg.cpp b/src/modules/srfile/filesenddlg.cpp index 8567003f91..228fc18059 100644 --- a/src/modules/srfile/filesenddlg.cpp +++ b/src/modules/srfile/filesenddlg.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -25,9 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <sys/stat.h>
#include "file.h"
-static void SetFileListAndSizeControls(HWND hwndDlg,struct FileDlgData *dat)
+static void SetFileListAndSizeControls(HWND hwndDlg, struct FileDlgData *dat)
{
- int fileCount=0,dirCount=0,totalSize=0,i;
+ int fileCount=0, dirCount=0, totalSize=0, i;
struct _stat statbuf;
TCHAR str[64];
@@ -40,25 +40,25 @@ static void SetFileListAndSizeControls(HWND hwndDlg,struct FileDlgData *dat) totalSize += statbuf.st_size;
} }
- GetSensiblyFormattedSize(totalSize,str,SIZEOF(str),0,1,NULL);
- SetDlgItemText(hwndDlg,IDC_TOTALSIZE,str);
+ GetSensiblyFormattedSize(totalSize, str, SIZEOF(str), 0, 1, NULL);
+ SetDlgItemText(hwndDlg, IDC_TOTALSIZE, str);
if (i>1) {
TCHAR szFormat[32];
if (fileCount && dirCount) {
- mir_sntprintf(szFormat,SIZEOF(szFormat),_T("%s, %s"),TranslateTS(fileCount == 1?_T("%d file"):_T("%d files")),TranslateTS(dirCount == 1?_T("%d directory"):_T("%d directories")));
- mir_sntprintf(str,SIZEOF(str),szFormat,fileCount,dirCount);
+ mir_sntprintf(szFormat, SIZEOF(szFormat), _T("%s, %s"), TranslateTS(fileCount == 1?_T("%d file"):_T("%d files")), TranslateTS(dirCount == 1?_T("%d directory"):_T("%d directories")));
+ mir_sntprintf(str, SIZEOF(str), szFormat, fileCount, dirCount);
}
else if (fileCount) {
- lstrcpy(szFormat,TranslateT("%d files"));
- mir_sntprintf(str,SIZEOF(str),szFormat,fileCount);
+ lstrcpy(szFormat, TranslateT("%d files"));
+ mir_sntprintf(str, SIZEOF(str), szFormat, fileCount);
}
else {
- lstrcpy(szFormat,TranslateT("%d directories"));
- mir_sntprintf(str,SIZEOF(str),szFormat,dirCount);
+ lstrcpy(szFormat, TranslateT("%d directories"));
+ mir_sntprintf(str, SIZEOF(str), szFormat, dirCount);
}
- SetDlgItemText(hwndDlg,IDC_FILE,str);
+ SetDlgItemText(hwndDlg, IDC_FILE, str);
}
- else SetDlgItemText(hwndDlg,IDC_FILE,dat->files[0]);
+ else SetDlgItemText(hwndDlg, IDC_FILE, dat->files[0]);
EnableWindow(GetDlgItem(hwndDlg, IDOK), fileCount || dirCount);
}
@@ -168,53 +168,53 @@ void __cdecl ChooseFilesThread(void* param) PostMessage( hwndDlg, M_FILECHOOSEDONE, 0, ( LPARAM )( TCHAR* )NULL );
} } }
-static BOOL CALLBACK ClipSiblingsChildEnumProc(HWND hwnd,LPARAM)
+static BOOL CALLBACK ClipSiblingsChildEnumProc(HWND hwnd, LPARAM)
{
- SetWindowLongPtr(hwnd,GWL_STYLE,GetWindowLongPtr(hwnd,GWL_STYLE)|WS_CLIPSIBLINGS);
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE)|WS_CLIPSIBLINGS);
return TRUE;
}
static WNDPROC OldSendEditProc;
-static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+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);
+ 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);
+ PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
}
break;
}
- return CallWindowProc(OldSendEditProc,hwnd,msg,wParam,lParam);
+ return CallWindowProc(OldSendEditProc, hwnd, msg, wParam, lParam);
}
INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
struct FileDlgData *dat;
- dat=(struct FileDlgData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ dat=(struct FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
{
struct FileSendData *fsd=(struct FileSendData*)lParam;
dat=(struct FileDlgData*)mir_calloc(sizeof(struct FileDlgData));
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)dat);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
dat->hContact=fsd->hContact;
dat->send=1;
- dat->hPreshutdownEvent=HookEventMessage(ME_SYSTEM_PRESHUTDOWN,hwndDlg,M_PRESHUTDOWN);
+ dat->hPreshutdownEvent=HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, M_PRESHUTDOWN);
dat->fs=NULL;
dat->dwTicks=GetTickCount();
TranslateDialogDefault(hwndDlg);
- EnumChildWindows(hwndDlg,ClipSiblingsChildEnumProc,0);
- OldSendEditProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MSG),GWLP_WNDPROC,(LONG_PTR)SendEditSubclassProc);
+ EnumChildWindows(hwndDlg, ClipSiblingsChildEnumProc, 0);
+ OldSendEditProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSG), GWLP_WNDPROC, (LONG_PTR)SendEditSubclassProc);
Window_SetIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE);
Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View User's Details"));
@@ -224,31 +224,31 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
if (fsd->ppFiles != NULL && fsd->ppFiles[0] != NULL) {
- int totalCount,i;
+ int totalCount, i;
for (totalCount=0;fsd->ppFiles[totalCount];totalCount++);
dat->files = ( TCHAR** )mir_alloc( sizeof(TCHAR*)*(totalCount+1)); // Leaks
for (i=0;i<totalCount;i++)
dat->files[i] = mir_tstrdup( fsd->ppFiles[i] );
dat->files[totalCount]=NULL;
- SetFileListAndSizeControls(hwndDlg,dat);
+ SetFileListAndSizeControls(hwndDlg, dat);
}
{
char *szProto;
TCHAR* contactName = cli.pfnGetContactDisplayName( dat->hContact, 0 );
- SetDlgItemText(hwndDlg,IDC_TO,contactName);
+ SetDlgItemText(hwndDlg, IDC_TO, contactName);
- szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0);
+ szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
if (szProto) {
CONTACTINFO ci;
int hasName = 0;
char buf[128];
- ZeroMemory(&ci,sizeof(ci));
+ ZeroMemory(&ci, sizeof(ci));
ci.cbSize = sizeof(ci);
ci.hContact = dat->hContact;
ci.szProto = szProto;
ci.dwFlag = CNF_UNIQUEID;
- if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) {
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch(ci.type) {
case CNFT_ASCIIZ:
hasName = 1;
@@ -257,26 +257,26 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break;
case CNFT_DWORD:
hasName = 1;
- mir_snprintf(buf, SIZEOF(buf),"%u",ci.dVal);
+ mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal);
break;
} }
if ( hasName )
- SetDlgItemTextA(hwndDlg,IDC_NAME,buf);
+ SetDlgItemTextA(hwndDlg, IDC_NAME, buf);
else
- SetDlgItemText(hwndDlg,IDC_NAME,contactName);
+ SetDlgItemText(hwndDlg, IDC_NAME, contactName);
} }
if ( fsd->ppFiles == NULL ) {
EnableWindow(hwndDlg, FALSE);
dat->closeIfFileChooseCancelled=1;
- PostMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_CHOOSE,BN_CLICKED),(LPARAM)GetDlgItem(hwndDlg,IDC_CHOOSE));
+ PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHOOSE, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDC_CHOOSE));
}
return TRUE;
}
case WM_MEASUREITEM:
- return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam);
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
case WM_DRAWITEM:
{
@@ -284,14 +284,14 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
char *szProto;
- szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0);
+ szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
if (szProto) {
- HICON hIcon = (HICON)CallProtoService(szProto,PS_LOADICON,PLI_PROTOCOL|PLIF_SMALL,0);
+ HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
if (hIcon) {
- DrawIconEx(dis->hDC,dis->rcItem.left,dis->rcItem.top,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL);
+ DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
} } } }
- return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam);
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case M_FILECHOOSEDONE:
if ( lParam != 0 ) {
@@ -300,27 +300,27 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l dat->closeIfFileChooseCancelled = 0;
}
else if (dat->closeIfFileChooseCancelled) DestroyWindow(hwndDlg);
- EnableWindow(hwndDlg,TRUE);
+ EnableWindow(hwndDlg, TRUE);
break;
case WM_COMMAND:
- if (CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wParam),MPCF_CONTACTMENU),(LPARAM)dat->hContact))
+ if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
break;
switch (LOWORD(wParam))
{
case IDC_CHOOSE:
- EnableWindow(hwndDlg,FALSE);
+ EnableWindow(hwndDlg, FALSE);
//GetOpenFileName() creates its own message queue which prevents any incoming events being processed
- forkthread(ChooseFilesThread,0,hwndDlg);
+ forkthread(ChooseFilesThread, 0, hwndDlg);
break;
case IDOK:
- EnableWindow(GetDlgItem(hwndDlg,IDC_FILENAME),FALSE);
- EnableWindow(GetDlgItem(hwndDlg,IDC_MSG),FALSE);
- EnableWindow(GetDlgItem(hwndDlg,IDC_CHOOSE),FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAME), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MSG), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSE), FALSE);
- GetDlgItemText(hwndDlg,IDC_FILEDIR,dat->szSavePath,SIZEOF(dat->szSavePath));
- GetDlgItemText(hwndDlg,IDC_FILE,dat->szFilenames,SIZEOF(dat->szFilenames));
- GetDlgItemText(hwndDlg,IDC_MSG,dat->szMsg,SIZEOF(dat->szMsg));
+ GetDlgItemText(hwndDlg, IDC_FILEDIR, dat->szSavePath, SIZEOF(dat->szSavePath));
+ GetDlgItemText(hwndDlg, IDC_FILE, dat->szFilenames, SIZEOF(dat->szFilenames));
+ GetDlgItemText(hwndDlg, IDC_MSG, dat->szMsg, SIZEOF(dat->szMsg));
dat->hwndTransfer = FtMgr_AddTransfer(dat);
SetWindowLongPtr( hwndDlg, GWLP_USERDATA, 0);
DestroyWindow(hwndDlg);
@@ -332,31 +332,31 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_USERMENU:
{ RECT rc;
- HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,(WPARAM)dat->hContact,0);
- GetWindowRect((HWND)lParam,&rc);
- TrackPopupMenu(hMenu,0,rc.left,rc.bottom,0,hwndDlg,NULL);
+ HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
+ GetWindowRect((HWND)lParam, &rc);
+ TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
break;
}
case IDC_DETAILS:
- CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)dat->hContact,0);
+ CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)dat->hContact, 0);
return TRUE;
case IDC_HISTORY:
- CallService(MS_HISTORY_SHOWCONTACTHISTORY,(WPARAM)dat->hContact,0);
+ CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)dat->hContact, 0);
return TRUE;
}
break;
case WM_DESTROY:
Window_FreeIcon_IcoLib(hwndDlg);
- Button_FreeIcon_IcoLib(hwndDlg,IDC_DETAILS);
- Button_FreeIcon_IcoLib(hwndDlg,IDC_HISTORY);
- Button_FreeIcon_IcoLib(hwndDlg,IDC_USERMENU);
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_DETAILS);
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_HISTORY);
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_USERMENU);
if ( dat )
FreeFileDlgData( dat );
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MSG),GWLP_WNDPROC,(LONG_PTR)OldSendEditProc);
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSG), GWLP_WNDPROC, (LONG_PTR)OldSendEditProc);
return TRUE;
}
return FALSE;
|