From 1dec2e0a9041b2347be5a1cdcb5b6b4eee20032e Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 30 Jul 2012 02:35:59 +0300 Subject: 64bit fixes, langpack fixes --- src/FileViewer.cpp | 23 +++++++++++------------ src/main.cpp | 10 +++++----- src/options.cpp | 42 +++++++++++++++++++++--------------------- src/utils.cpp | 29 ++++++++++++++--------------- 4 files changed, 51 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/FileViewer.cpp b/src/FileViewer.cpp index 191f744..1ca4192 100755 --- a/src/FileViewer.cpp +++ b/src/FileViewer.cpp @@ -880,8 +880,7 @@ bool bAdvancedCopy(HWND hwnd) LRESULT CALLBACK EditSubclassProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - CLHistoryDlg * pclDlg = (CLHistoryDlg *)GetWindowLong(hwnd,GWL_USERDATA); - + CLHistoryDlg * pclDlg = (CLHistoryDlg *)GetWindowLongPtr(hwnd, -21); switch( msg ) { case WM_CONTEXTMENU: @@ -961,7 +960,7 @@ LRESULT CALLBACK EditSubclassProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP res = SendMessage(hwnd, EM_FINDTEXT, (WPARAM)fr->Flags,(LPARAM)&ft); if(res == -1) { - MessageBox( hwnd , TranslateTS(_T("Search string was not found !")),MSG_BOX_TITEL,MB_OK ); + MessageBox( hwnd , LPGENT("Search string was not found !"),MSG_BOX_TITEL,MB_OK ); return 0; } } @@ -1080,13 +1079,13 @@ void SetRichEditFont(HWND hRichEdit, bool bUseSyntaxHL ) static BOOL CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - CLHistoryDlg * pclDlg = (CLHistoryDlg *)GetWindowLong(hwndDlg,GWL_USERDATA); + CLHistoryDlg * pclDlg = (CLHistoryDlg *)GetWindowLongPtr(hwndDlg,-21); switch (msg) { case WM_INITDIALOG: { - SetWindowLong(hwndDlg,GWL_USERDATA,lParam); + SetWindowLongPtr(hwndDlg,-21,lParam); CLHistoryDlg * pclDlg = (CLHistoryDlg *)lParam; #ifdef _UNICODE EnableWindow( GetDlgItem( hwndDlg , IDC_FV_FIND ) , FALSE ); @@ -1095,7 +1094,7 @@ static BOOL CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, LP (LPARAM)LoadIcon( hInstance, MAKEINTRESOURCE(IDI_EXPORT_MESSAGE))); HWND hRichEdit = GetDlgItem( hwndDlg , IDC_RICHEDIT ); - pclDlg->wpOrigEditProc = (WNDPROC) SetWindowLongPtr( hRichEdit, GWL_WNDPROC, (LONG) EditSubclassProc); + pclDlg->wpOrigEditProc = (WNDPROC) SetWindowLongPtr( hRichEdit, -4, (LONG) EditSubclassProc); SetWindowLongPtr( hRichEdit, GWLP_USERDATA, (LONG) pclDlg ); @@ -1105,12 +1104,12 @@ static BOOL CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, LP HMENU hSysMenu = GetSystemMenu( hwndDlg , FALSE ); InsertMenu( hSysMenu , 0 , MF_SEPARATOR | MF_BYPOSITION , 0 , 0 ); - InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION , ID_FV_SAVE_AS_RTF, TranslateTS(_T("Save as RTF")) ); + InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION , ID_FV_SAVE_AS_RTF, LPGENT("Save as RTF") ); InsertMenu( hSysMenu , 0 , MF_SEPARATOR | MF_BYPOSITION , 0 , 0 ); BYTE bUseCC = (BYTE)DBGetContactSettingByte( NULL , MODULE , szFileViewDB "UseCC" , 0 ); - InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION | ( bUseCC ? MF_CHECKED : 0 ) , ID_FV_COLOR, TranslateTS(_T("Color...")) ); + InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION | ( bUseCC ? MF_CHECKED : 0 ) , ID_FV_COLOR, LPGENT("Color...") ); if( bUseCC ) { @@ -1119,11 +1118,11 @@ static BOOL CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, LP ); } - InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION , ID_FV_FONT, TranslateTS(_T("Font...")) ); + InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION , ID_FV_FONT, LPGENT("Font...") ); bool bUseSyntaxHL = DBGetContactSettingByte( NULL , MODULE , szFileViewDB "UseSyntaxHL" , 1 )!=0; - InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION | ( bUseSyntaxHL ? MF_CHECKED : 0 ) , ID_FV_SYNTAX_HL, TranslateTS(_T("Syntax highlight")) ); + InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION | ( bUseSyntaxHL ? MF_CHECKED : 0 ) , ID_FV_SYNTAX_HL, LPGENT("Syntax highlight") ); SetRichEditFont( hRichEdit , bUseSyntaxHL ); @@ -1185,7 +1184,7 @@ static BOOL CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, LP LeaveCriticalSection( &csHistoryList ); delete pclDlg; - SetWindowLong(hwndDlg,GWL_USERDATA,NULL); + SetWindowLongPtr(hwndDlg,-21,NULL); return 0; } case WM_DESTROY: @@ -1408,7 +1407,7 @@ static BOOL CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, LP bool bShowFileViewer( HANDLE hContact ) { CLHistoryDlg * pcl = new CLHistoryDlg( hContact ); - pcl->hWnd = CreateDialogParam( hInstance,MAKEINTRESOURCE(IDD_FILE_VIEWER),NULL,DlgProcFileViewer,(LPARAM)pcl); + pcl->hWnd = CreateDialogParam( hInstance,MAKEINTRESOURCE(IDD_FILE_VIEWER),NULL,(DLGPROC)DlgProcFileViewer,(LPARAM)pcl); if( pcl->hWnd ) { EnterCriticalSection( &csHistoryList ); diff --git a/src/main.cpp b/src/main.cpp index 5d9ce23..79e4b0b 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -194,13 +194,13 @@ int MainInit(WPARAM /*wparam*/,LPARAM /*lparam*/) if( bReplaceHistory ) { mi.position= 1000090000; - mi.pszName=Translate("View &History"); + mi.pszName=LPGEN("View &History"); mi.pszService=MS_HISTORY_SHOWCONTACTHISTORY; } else { mi.position = 1000090100; - mi.pszName=Translate("Open E&xported History"); + mi.pszName=LPGEN("Open E&xported History"); mi.pszService=MS_SHOW_EXPORT_HISTORY; } hOpenHistoryMenuItem = Menu_AddContactMenuItem(&mi); @@ -343,7 +343,7 @@ int __declspec(dllexport)Load() if( bReplaceHistory ) { - hServiceFunc = CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY,ShowExportHistory); //this need new code + hServiceFunc = CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY,(MIRANDASERVICE)ShowExportHistory); //this need new code /* if( hServiceFunc ) { int *disableDefaultModule=(int*)CallService(MS_PLUGINS_GETDISABLEDEFAULTARRAY,0,0); @@ -359,12 +359,12 @@ int __declspec(dllexport)Load() }*/ if( ! hServiceFunc ) - MessageBox( NULL , TranslateTS(_T("Failed to replace Miranda History.\r\nThis is most likely due to changes in Miranda.")) , MSG_BOX_TITEL , MB_OK ); + MessageBox( NULL , LPGENT("Failed to replace Miranda History.\r\nThis is most likely due to changes in Miranda.") , MSG_BOX_TITEL , MB_OK ); } if( ! hServiceFunc ) { - hServiceFunc = CreateServiceFunction(MS_SHOW_EXPORT_HISTORY,ShowExportHistory); + hServiceFunc = CreateServiceFunction(MS_SHOW_EXPORT_HISTORY,(MIRANDASERVICE)ShowExportHistory); } if( ! hServiceFunc ) diff --git a/src/options.cpp b/src/options.cpp index 17bc917..ec34cfb 100755 --- a/src/options.cpp +++ b/src/options.cpp @@ -225,7 +225,7 @@ int nExportCompleatList(HWND hParent , bool bOnlySelected ) if( !hMapUser || nContacts <= 0 ) { - MessageBox( hParent , TranslateTS(_T("No contacts found to export")),MSG_BOX_TITEL,MB_OK ); + MessageBox( hParent , LPGENT("No contacts found to export"),MSG_BOX_TITEL,MB_OK ); return 0; } @@ -235,7 +235,7 @@ int nExportCompleatList(HWND hParent , bool bOnlySelected ) SendMessage( hProg , PBM_SETRANGE , 0 , MAKELPARAM( 0 , nContacts ) ); - SetWindowText( hStatus , TranslateTS(_T("Reading database information ( Phase 1 of 2 )")) ); + SetWindowText( hStatus , LPGENT("Reading database information ( Phase 1 of 2 )") ); { // position and show proigrassbar dialog @@ -269,7 +269,7 @@ int nExportCompleatList(HWND hParent , bool bOnlySelected ) sItem.iItem = nCur; if( ! ListView_GetItem( hMapUser, &sItem ) ) { - MessageBox( hParent , TranslateTS(_T("Failed to export at least one contact")),MSG_BOX_TITEL,MB_OK ); + MessageBox( hParent , LPGENT("Failed to export at least one contact"),MSG_BOX_TITEL,MB_OK ); continue; } @@ -292,14 +292,14 @@ int nExportCompleatList(HWND hParent , bool bOnlySelected ) /* if( hContact ) - MessageBox( hParent , TranslateTS(_T("Failed to export at least one contact")),MSG_BOX_TITEL,MB_OK ); + MessageBox( hParent , LPGENT("Failed to export at least one contact"),MSG_BOX_TITEL,MB_OK ); */ } { // window text update - SetWindowText( hStatus , TranslateTS(_T("Sorting and writing database information ( Phase 2 of 2 )")) ); + SetWindowText( hStatus , LPGENT("Sorting and writing database information ( Phase 2 of 2 )") ); SendMessage( hProg , PBM_SETRANGE , 0 , MAKELPARAM( 0 , AllEvents.size() ) ); SendMessage( hProg , PBM_SETPOS , 0 , 0); } @@ -434,7 +434,7 @@ BOOL bApplyChanges( HWND hwndDlg ) if( bReplaceHistory != bNewRp ) { bReplaceHistory = bNewRp; - MessageBox( hwndDlg , TranslateTS(_T("You need to restart miranda to change the history function")) ,MSG_BOX_TITEL,MB_OK ); + MessageBox( hwndDlg , LPGENT("You need to restart miranda to change the history function") ,MSG_BOX_TITEL,MB_OK ); } bAppendNewLine = IsDlgButtonChecked( hwndDlg , IDC_APPEND_NEWLINE ) == BST_CHECKED; @@ -649,7 +649,7 @@ void OpenHelp(HWND hwndDlg) } } - MessageBox( hwndDlg , TranslateTS(_T("Failed to get the path to Msg_Export.dll\nPlease locate Msg_Export.txt your self")),MSG_BOX_TITEL,MB_OK ); + MessageBox( hwndDlg , LPGENT("Failed to get the path to Msg_Export.dll\nPlease locate Msg_Export.txt your self"),MSG_BOX_TITEL,MB_OK ); } ///////////////////////////////////////////////////////////////////// @@ -703,17 +703,17 @@ static BOOL CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LVCOLUMN cCol = { 0 }; cCol.mask = LVCF_TEXT | LVCF_WIDTH; cCol.cx = nColumnWidth; - cCol.pszText = TranslateTS(_T("File")); + cCol.pszText = LPGENT("File"); ListView_InsertColumn( hMapUser , 0 , &cCol ); - cCol.pszText = TranslateTS(_T("Nick")); + cCol.pszText = LPGENT("Nick"); ListView_InsertColumn( hMapUser , 1 , &cCol ); cCol.cx = nProtoColWitdh; - cCol.pszText = TranslateTS(_T("Proto")); + cCol.pszText = LPGENT("Proto"); ListView_InsertColumn( hMapUser , 2 , &cCol ); cCol.cx = nUINColWitdh; cCol.mask |= LVCF_FMT; cCol.fmt = LVCFMT_RIGHT; - cCol.pszText = TranslateTS(_T("UIN")); + cCol.pszText = LPGENT("UIN"); ListView_InsertColumn( hMapUser , 3 , &cCol ); @@ -850,7 +850,7 @@ static BOOL CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { if( bUnaplyedChanges ) { - DWORD res = MessageBox( hwndDlg , TranslateTS(_T("You have unapplyed changes do you wish to apply these first ?")),MSG_BOX_TITEL,MB_YESNOCANCEL ); + DWORD res = MessageBox( hwndDlg , LPGENT("You have unapplyed changes do you wish to apply these first ?"),MSG_BOX_TITEL,MB_YESNOCANCEL ); if( res == IDCANCEL ) return TRUE; if( res == IDYES ) @@ -999,7 +999,7 @@ static BOOL CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, sBrowseInfo.hwndOwner = hwndDlg; sBrowseInfo.pidlRoot = NULL; sBrowseInfo.pszDisplayName = lpDestDir; - sBrowseInfo.lpszTitle = TranslateTS(_T("Select Destination Directory")); + sBrowseInfo.lpszTitle = LPGENT("Select Destination Directory"); sBrowseInfo.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX;; sBrowseInfo.lpfn = NULL; sBrowseInfo.lParam = 0; @@ -1158,7 +1158,7 @@ static BOOL CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { case CDDS_PREPAINT: { - SetWindowLong(hwndDlg, DWL_MSGRESULT, CDRF_NOTIFYITEMDRAW); + SetWindowLongPtr(hwndDlg, 0, CDRF_NOTIFYITEMDRAW); return true; } case CDDS_ITEMPREPAINT: @@ -1167,7 +1167,7 @@ static BOOL CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { lplvcd->clrText = RGB( 0 , 0 , 255 ); } - SetWindowLong(hwndDlg, DWL_MSGRESULT, CDRF_NEWFONT); + SetWindowLongPtr(hwndDlg, 0, CDRF_NEWFONT); return true; } } @@ -1326,7 +1326,7 @@ static BOOL CALLBACK DlgProcMsgExportOpts2(HWND hwndDlg, UINT msg, WPARAM wParam LVCOLUMN cCol = { 0 }; cCol.mask = LVCF_TEXT | LVCF_WIDTH; cCol.cx = nColumnWidth; - cCol.pszText = TranslateTS(_T("Export Protocols")); + cCol.pszText = LPGENT("Export Protocols"); ListView_InsertColumn( hMapUser , 0 , &cCol ); } @@ -1467,17 +1467,17 @@ int OptionsInitialize(WPARAM wParam,LPARAM /*lParam*/) odp.hInstance = hInstance; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGEXPORT); odp.flags = ODPF_BOLDGROUPS; - odp.pszTitle = Translate("Message export"); - odp.pszGroup = Translate("Plugins"); + odp.pszTitle = LPGEN("Message export"); + odp.pszGroup = LPGEN("Plugins"); odp.groupPosition = 100000000; - odp.pfnDlgProc = DlgProcMsgExportOpts; + odp.pfnDlgProc = (DLGPROC)DlgProcMsgExportOpts; Options_AddPage(wParam,&odp); odp.position = 100000001; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGEXPORT2); - odp.pszTitle = Translate("Message export2"); - odp.pfnDlgProc = DlgProcMsgExportOpts2; + odp.pszTitle = LPGEN("Message export2"); + odp.pfnDlgProc = (DLGPROC)DlgProcMsgExportOpts2; Options_AddPage(wParam,&odp); return 0; } diff --git a/src/utils.cpp b/src/utils.cpp index 15ed559..255167e 100755 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -655,7 +655,7 @@ tstring GetFilePathFromUser( HANDLE hContact ) // Here we will try to avoide the (Unknown Contact) in cases where the protocol for // this user has been removed. - if( bNickUsed && ( _tcsstr( NickFromHandle( hContact ),TranslateTS(_T("(Unknown Contact)"))) != 0) ) + if( bNickUsed && ( _tcsstr( NickFromHandle( hContact ),LPGENT("(Unknown Contact)")) != 0) ) { // Then the filename must have changed from a correct path to one including the (Unknown Contact) return sPrevFileName; @@ -974,8 +974,8 @@ void DisplayErrorDialog( const _TCHAR * pszError , tstring& sFilePath , DBEVENTI sError += _T("\nError :"); sError += sGetErrorString(); sError += _T("\n"); - sError += TranslateTS(_T("Message has not been saved !\n")); - sError += TranslateTS(_T("Do you wish to save debug information ?")); + sError += LPGENT("Message has not been saved !\n"); + sError += LPGENT("Do you wish to save debug information ?"); if( MessageBox( NULL , sError.c_str() ,MSG_BOX_TITEL,MB_YESNO ) == IDYES ) { OPENFILENAME ofn; // common dialog box structure @@ -1246,12 +1246,12 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) if( dbei.eventType == EVENTTYPE_URL ) { - pszType = TranslateTS(_T("URL: ")); + pszType = LPGENT("URL: "); pszData = (char *)dbei.pBlob; } else { - pszType = TranslateTS(_T("File: ")); + pszType = LPGENT("File: "); pszData = (char *)(dbei.pBlob + sizeof( DWORD )); } @@ -1274,7 +1274,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) if( (pszData - (char *)dbei.pBlob) + nLen < (int)dbei.cbBlob ) { if( bWriteNewLine( hFile , nIndent ) && - bWriteTextToFile( hFile , TranslateTS(_T("Description: ")) , bWriteUTF8Format) && + bWriteTextToFile( hFile , LPGENT("Description: ") , bWriteUTF8Format) && bWriteIndentedToFile( hFile , nIndent , pszData , bWriteUTF8Format ) ) { bWriteOk = true; @@ -1319,18 +1319,18 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) { // request //blob is: uin(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) nStringCount = 5; - pszTitle = TranslateTS(_T("The following user made an authorization request:")); + pszTitle = LPGENT("The following user made an authorization request:"); } else { // Added //blob is: uin(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ) nStringCount = 4; - pszTitle = TranslateTS(_T("The following user added you to their contact list:")); + pszTitle = LPGENT("The following user added you to their contact list:"); } if( bWriteTextToFile( hFile , pszTitle , bWriteUTF8Format ) && bWriteNewLine( hFile , nIndent ) && - bWriteTextToFile( hFile , TranslateTS(_T("UIN :")) , bWriteUTF8Format ) ) + bWriteTextToFile( hFile , LPGENT("UIN :") , bWriteUTF8Format ) ) { DWORD uin = *((PDWORD)(dbei.pBlob)); int n = _sntprintf( szTemp , sizeof( szTemp ) ,_T("%d"), uin ); @@ -1380,9 +1380,9 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) const char* pszStr = (const char*)dbei.pBlob; if( dbei.eventType == ICQEVENTTYPE_EMAILEXPRESS ) - bWriteTextToFile( hFile , TranslateTS(_T("EmailExpress from:")) , bWriteUTF8Format); + bWriteTextToFile( hFile , LPGENT("EmailExpress from:") , bWriteUTF8Format); else - bWriteTextToFile( hFile , TranslateTS(_T("WebPager from:")) , bWriteUTF8Format ); + bWriteTextToFile( hFile , LPGENT("WebPager from:") , bWriteUTF8Format ); bWriteNewLine( hFile , nIndent ); @@ -1402,7 +1402,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) } else { - bWriteTextToFile( hFile , TranslateTS(_T("No from address")) , bWriteUTF8Format ); + bWriteTextToFile( hFile , LPGENT("No from address") , bWriteUTF8Format ); } if( ! bWriteNewLine( hFile , nIndent ) || @@ -1685,8 +1685,7 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/) _TCHAR szTemp[500]; _sntprintf( szTemp , sizeof( szTemp ) , _T("%s\r\n%s") , - TranslateTS(_T("User has been deleted do you want to delete the file ?")) , - sFilePath.c_str() ); + LPGENT("User has been deleted do you want to delete the file ?"), sFilePath.c_str() ); if( enDeleteAction == eDAAutomatic || MessageBox( NULL , szTemp ,MSG_BOX_TITEL,MB_YESNO ) == IDYES ) @@ -1695,7 +1694,7 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/) { _sntprintf( szTemp , sizeof( szTemp ) , _T("%s\r\n%s"), - TranslateTS(_T("Failed to delete the file")), + LPGENT("Failed to delete the file"), sFilePath.c_str() ); DisplayLastError( szTemp ); -- cgit v1.2.3