diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2013-01-04 20:43:21 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2013-01-04 20:43:21 +0000 |
commit | 3afd2d1c465a6ffcbf0f80e0cb50880b9ff174f0 (patch) | |
tree | 9abee8ca8391fa3579246e79ef84049d6421b5a0 /plugins/Msg_Export | |
parent | 84cb58607f11d437b875e0db3857a94920c3a6b6 (diff) |
-support for WindowList
-simplified storing position
-removed duplicated menu item
git-svn-id: http://svn.miranda-ng.org/main/trunk@2968 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Msg_Export')
-rwxr-xr-x | plugins/Msg_Export/res/resource.rc | 74 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/FileViewer.cpp | 77 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/Glob.h | 2 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/main.cpp | 57 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/options.cpp | 18 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/resource.h | 2 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/utils.cpp | 73 |
7 files changed, 146 insertions, 157 deletions
diff --git a/plugins/Msg_Export/res/resource.rc b/plugins/Msg_Export/res/resource.rc index 12fd11f8e6..76839c4ff5 100755 --- a/plugins/Msg_Export/res/resource.rc +++ b/plugins/Msg_Export/res/resource.rc @@ -1,6 +1,6 @@ // Microsoft Visual C++ generated resource script.
//
-#include "src/resource.h"
+#include "..\src\resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
@@ -16,10 +16,8 @@ // Neutral (Default) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
-#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
#pragma code_page(1252)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@@ -65,25 +63,23 @@ END /////////////////////////////////////////////////////////////////////////////
-// Danish resources
+// Danish (Denmark) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DAN)
-#ifdef _WIN32
LANGUAGE LANG_DANISH, SUBLANG_DEFAULT
#pragma code_page(1252)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
-STRINGTABLE
+STRINGTABLE
BEGIN
ID_EDIT_COPY "Copies the selection and puts it on the Clipboard\nCopy"
END
-#endif // Danish resources
+#endif // Danish (Denmark) resources
/////////////////////////////////////////////////////////////////////////////
@@ -91,10 +87,8 @@ END // German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
-#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
-#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -126,13 +120,11 @@ END /////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@@ -140,7 +132,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US //
IDD_OPT_MSGEXPORT DIALOGEX 0, 0, 314, 240
-STYLE DS_SETFONT | DS_3DLOOK | DS_CENTER | WS_CHILD | WS_VISIBLE
+STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
@@ -154,10 +146,10 @@ BEGIN PUSHBUTTON "Browse",IDC_FILE_VIEWER_BROWSE,141,74,43,14
EDITTEXT IDC_MAX_CLOUMN_WIDTH,264,11,39,14,ES_AUTOHSCROLL | ES_NUMBER
COMBOBOX IDC_EXPORT_TIMEFORMAT,246,29,57,122,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- CONTROL "Use UTF8 in new files",IDC_USE_UTF8_IN_NEW_FILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,46,85,10
- CONTROL "Append extra new line",IDC_APPEND_NEWLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,59,86,10
+ CONTROL "Use UTF8 in new files",IDC_USE_UTF8_IN_NEW_FILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,46,102,10
+ CONTROL "Append extra new line",IDC_APPEND_NEWLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,59,102,10
CONTROL "Use << and >>",IDC_USE_LESS_AND_GREATER_IN_EXPORT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,72,63,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,72,102,10
CONTROL "List1",IDC_MAP_USER_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_EDITLABELS | WS_BORDER | WS_TABSTOP,5,100,304,120
PUSHBUTTON "Auto filename",IDC_AUTO_FILENAME,5,226,63,14
PUSHBUTTON "Clear all",IDC_CLEAR_ALL,86,226,63,14
@@ -181,7 +173,7 @@ BEGIN LTEXT "",IDC_EXP_ALL_STATUS,7,31,238,8
END
-IDD_FILE_VIEWER DIALOG 0, 0, 346, 259
+IDD_FILE_VIEWER DIALOG 0, 0, 346, 259
STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "History file for %s (%s format %s)"
FONT 8, "MS Sans Serif"
@@ -197,16 +189,16 @@ STYLE DS_SETFONT | DS_3DLOOK | DS_CENTER | WS_CHILD | WS_VISIBLE EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
- CONTROL "Prompt for action",IDC_FC_PROMPT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,51,53,69,10
- GROUPBOX "When filename changes",IDC_STATIC,43,38,100,56
- CONTROL "Rename file",IDC_FC_RENAME,"Button",BS_AUTORADIOBUTTON,51,66,53,10
- CONTROL "Do nothing",IDC_FC_NOTHING,"Button",BS_AUTORADIOBUTTON,51,79,51,10
- GROUPBOX "When user is deleted",IDC_STATIC,171,39,100,56
- CONTROL "Prompt for action",IDC_FD_PROMPT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,180,53,69,10
- CONTROL "Delete file",IDC_FD_DELETE,"Button",BS_AUTORADIOBUTTON,180,66,47,10
- CONTROL "Do nothing",IDC_FD_NOTHING,"Button",BS_AUTORADIOBUTTON,180,79,51,10
- CONTROL "List1",IDC_EXPORT_PROTOS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_EDITLABELS | WS_BORDER | WS_TABSTOP,44,101,227,106
- PUSHBUTTON "Debug",IDC_DEBUG_INFO,237,214,32,10
+ GROUPBOX "When filename changes",IDC_STATIC,13,9,131,56
+ CONTROL "Prompt for action",IDC_FC_PROMPT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,24,24,114,10
+ CONTROL "Rename file",IDC_FC_RENAME,"Button",BS_AUTORADIOBUTTON,24,37,80,10
+ CONTROL "Do nothing",IDC_FC_NOTHING,"Button",BS_AUTORADIOBUTTON,24,50,78,10
+ GROUPBOX "When user is deleted",IDC_STATIC,153,10,147,56
+ CONTROL "Prompt for action",IDC_FD_PROMPT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,161,24,131,10
+ CONTROL "Delete file",IDC_FD_DELETE,"Button",BS_AUTORADIOBUTTON,161,37,131,10
+ CONTROL "Do nothing",IDC_FD_NOTHING,"Button",BS_AUTORADIOBUTTON,161,50,131,10
+ CONTROL "List1",IDC_EXPORT_PROTOS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_EDITLABELS | WS_BORDER | WS_TABSTOP,13,72,287,144
+ PUSHBUTTON "Debug",IDC_DEBUG_INFO,263,222,37,13
END
@@ -216,7 +208,7 @@ END //
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
+GUIDELINES DESIGNINFO
BEGIN
IDD_OPT_MSGEXPORT, DIALOG
BEGIN
@@ -249,6 +241,18 @@ BEGIN TOPMARGIN, 7
BOTTOMMARGIN, 252
END
+
+ IDD_OPT_MSGEXPORT2, DIALOG
+ BEGIN
+ VERTGUIDE, 13
+ VERTGUIDE, 24
+ VERTGUIDE, 138
+ VERTGUIDE, 144
+ VERTGUIDE, 153
+ VERTGUIDE, 161
+ VERTGUIDE, 292
+ VERTGUIDE, 300
+ END
END
#endif // APSTUDIO_INVOKED
@@ -267,7 +271,7 @@ IDI_EXPORT_MESSAGE ICON "export_m.ico" // Menu
//
-IDR_MSG_EXPORT MENU
+IDR_MSG_EXPORT MENU
BEGIN
POPUP "UserList"
BEGIN
@@ -280,7 +284,7 @@ BEGIN END
END
-IDR_FV_EDIT MENU
+IDR_FV_EDIT MENU
BEGIN
POPUP "1"
BEGIN
@@ -288,18 +292,16 @@ BEGIN END
END
-#endif // English (U.S.) resources
+#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// English (U.K.) resources
+// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@@ -310,7 +312,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK // remains consistent on all systems.
IDI_TICK ICON "tick.ico"
IDI_NOTICK ICON "notick.ico"
-#endif // English (U.K.) resources
+#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index d4e76339d4..39ee4305c0 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -215,8 +215,8 @@ int CLStreamRTFInfo::nOptimalReadLen = 3300; int CLStreamRTFInfo::nWriteHeader( char * pszTarget , int nLen )
{
- COLORREF cMyText = DBGetContactSettingDword(NULL,"SRMsg","Font3Col",RGB(64,0,128));
- COLORREF cYourText = DBGetContactSettingDword(NULL,"SRMsg","Font0Col",RGB(240,0,0));
+ COLORREF cMyText = db_get_dw(NULL,"SRMsg","Font3Col",RGB(64,0,128));
+ COLORREF cYourText = db_get_dw(NULL,"SRMsg","Font0Col",RGB(240,0,0));
/* original header !!
"{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\r\n"
@@ -1032,14 +1032,14 @@ void SetRichEditFont(HWND hRichEdit, bool bUseSyntaxHL ) CHARFORMAT ncf = { 0 };
ncf.cbSize = sizeof( CHARFORMAT );
ncf.dwMask = CFM_BOLD | CFM_FACE | CFM_ITALIC | CFM_SIZE | CFM_UNDERLINE;
- ncf.dwEffects = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "TEffects" , 0 );
- ncf.yHeight = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "THeight" , 165 );
+ ncf.dwEffects = db_get_dw( NULL , MODULE , szFileViewDB "TEffects" , 0 );
+ ncf.yHeight = db_get_dw( NULL , MODULE , szFileViewDB "THeight" , 165 );
_tcscpy( ncf.szFaceName , _DBGetString( NULL , MODULE , szFileViewDB "TFace" , _T("Courier New")).c_str() );
if( ! bUseSyntaxHL )
{
ncf.dwMask |= CFM_COLOR;
- ncf.crTextColor = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "TColor" , 0 );
+ ncf.crTextColor = db_get_dw( NULL , MODULE , szFileViewDB "TColor" , 0 );
}
SendMessage(hRichEdit, EM_SETCHARFORMAT, (WPARAM)SCF_ALL, (LPARAM)&ncf);
@@ -1089,36 +1089,27 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, InsertMenu( hSysMenu , 0 , MF_SEPARATOR | MF_BYPOSITION , 0 , 0 );
- BYTE bUseCC = (BYTE)DBGetContactSettingByte( NULL , MODULE , szFileViewDB "UseCC" , 0 );
+ BYTE bUseCC = (BYTE)db_get_b( NULL , MODULE , szFileViewDB "UseCC" , 0 );
InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION | ( bUseCC ? MF_CHECKED : 0 ) , ID_FV_COLOR, LPGENT("Color...") );
if( bUseCC )
{
SendMessage( hRichEdit , EM_SETBKGNDCOLOR, 0 ,
- DBGetContactSettingDword( NULL , MODULE , szFileViewDB "CustomC" , RGB(255,255,255) )
+ 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 = DBGetContactSettingByte( NULL , MODULE , szFileViewDB "UseSyntaxHL" , 1 )!=0;
+ 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);
-
- int cx= DBGetContactSettingDword( NULL , MODULE , szFileViewDB "cx" , 0 );
- int cy= DBGetContactSettingDword( NULL , MODULE , szFileViewDB "cy" , 0 );
-
- if( cx > 0 && cy > 0)
- {
- int x = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "x" , 0 );
- int y = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "y" , 0 );
-
- SetWindowPos( hwndDlg , NULL , x , y , cx , cy , SWP_NOZORDER );
- }
+
+ Utils_RestoreWindowPosition(hwndDlg,pclDlg->hContact,MODULE,szFileViewDB);
pclDlg->sPath = GetFilePathFromUser( pclDlg->hContact );
@@ -1145,6 +1136,8 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, }
}
+
+ WindowList_Add(hInternalWindowList,hwndDlg,pclDlg->hContact);
return TRUE;
}
case WM_RELOAD_FILE:
@@ -1170,20 +1163,8 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, }
case WM_DESTROY:
{
- RECT rSize;
- if( GetWindowRect( hwndDlg , &rSize ) )
- {
- // first we make sure the window has resonable dimentions.
- // if it is minimized it will not have that.
- if( rSize.left <= -32000 || rSize.top <= -32000 )
- return 0;
- if( rSize.right <= -32000 || rSize.bottom <= -32000 )
- return 0;
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "x" , rSize.left );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "y" , rSize.top );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "cx" , rSize.right - rSize.left );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "cy" , rSize.bottom - rSize.top );
- }
+ Utils_SaveWindowPosition(hwndDlg,pclDlg->hContact,MODULE,szFileViewDB);
+ WindowList_Remove(hInternalWindowList,hwndDlg);
return 0;
}
case WM_SYSCOMMAND:
@@ -1197,7 +1178,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, LOGFONT lf = { 0 };
lf.lfHeight = 14L;
- { DWORD dwEffects = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "TEffects" , 0 );
+ { 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;
@@ -1208,7 +1189,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, cf.lStructSize = sizeof( cf );
cf.hwndOwner = hwndDlg;
cf.lpLogFont = &lf;
- cf.rgbColors = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "TColor" , 0 );
+ cf.rgbColors = db_get_dw( NULL , MODULE , szFileViewDB "TColor" , 0 );
cf.Flags = CF_EFFECTS | CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;
if( ChooseFont( &cf ) )
@@ -1218,30 +1199,30 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, (lf.lfStrikeOut ? CFE_STRIKEOUT : 0) |
(lf.lfUnderline ? CFE_UNDERLINE : 0);
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "TEffects" , dwEffects );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "THeight" , cf.iPointSize * 2 );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "TColor" , cf.rgbColors );
- DBWriteContactSettingTString( NULL , MODULE , szFileViewDB "TFace" , lf.lfFaceName );
+ db_set_dw( NULL , MODULE , szFileViewDB "TEffects" , dwEffects );
+ db_set_dw( NULL , MODULE , szFileViewDB "THeight" , cf.iPointSize * 2 );
+ db_set_dw( NULL , MODULE , szFileViewDB "TColor" , cf.rgbColors );
+ db_set_ts( NULL , MODULE , szFileViewDB "TFace" , lf.lfFaceName );
SetRichEditFont( hRichEdit , bUseSyntaxHL );
}
return TRUE;
}
else if ((wParam & 0xFFF0) == ID_FV_COLOR)
{
- BYTE bUseCC = ! DBGetContactSettingByte( NULL , MODULE , szFileViewDB "UseCC" , 0 );
+ BYTE bUseCC = ! db_get_b( NULL , MODULE , szFileViewDB "UseCC" , 0 );
if( bUseCC )
{
CHOOSECOLOR cc = {0};
cc.lStructSize = sizeof( cc );
cc.hwndOwner = hwndDlg;
- cc.rgbResult = DBGetContactSettingDword( NULL , MODULE , szFileViewDB "CustomC" , RGB(255,255,255) );
+ cc.rgbResult = db_get_dw( NULL , MODULE , szFileViewDB "CustomC" , RGB(255,255,255) );
cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
static COLORREF MyCustColors[16] = { 0xFFFFFFFF };
cc.lpCustColors = MyCustColors;
if( ChooseColor( &cc ) )
{
SendMessage( hRichEdit , EM_SETBKGNDCOLOR, 0 , cc.rgbResult );
- DBWriteContactSettingDword( NULL , MODULE , szFileViewDB "CustomC" , cc.rgbResult );
+ db_set_dw( NULL , MODULE , szFileViewDB "CustomC" , cc.rgbResult );
}
else
{
@@ -1254,7 +1235,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage( hRichEdit , EM_SETBKGNDCOLOR, TRUE , 0 );
}
CheckMenuItem( hSysMenu , ID_FV_COLOR , MF_BYCOMMAND | (bUseCC ? MF_CHECKED : 0) );
- DBWriteContactSettingByte( NULL , MODULE , szFileViewDB "UseCC" , bUseCC );
+ db_set_b( NULL , MODULE , szFileViewDB "UseCC" , bUseCC );
return TRUE;
}
else if ((wParam & 0xFFF0) == ID_FV_SYNTAX_HL)
@@ -1266,7 +1247,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, bUseSyntaxHL = !bUseSyntaxHL;
CheckMenuItem( hSysMenu , ID_FV_SYNTAX_HL , MF_BYCOMMAND | (bUseSyntaxHL ? MF_CHECKED : 0) );
- DBWriteContactSettingByte( NULL , MODULE , szFileViewDB "UseSyntaxHL" , bUseSyntaxHL );
+ db_set_b( NULL , MODULE , szFileViewDB "UseSyntaxHL" , bUseSyntaxHL );
if( bUseSyntaxHL )
bLoadFile(hwndDlg , pclDlg );
@@ -1387,6 +1368,14 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, bool bShowFileViewer( HANDLE hContact )
{
+ HWND hInternalWindow = WindowList_Find(hInternalWindowList,hContact);
+ if(hInternalWindow)
+ {
+ SetForegroundWindow(hInternalWindow);
+ SetFocus(hInternalWindow);
+ return true;
+ }
+
CLHistoryDlg * pcl = new CLHistoryDlg( hContact );
pcl->hWnd = CreateDialogParam( hInstance,MAKEINTRESOURCE(IDD_FILE_VIEWER),NULL,DlgProcFileViewer,(LPARAM)pcl);
if( pcl->hWnd )
diff --git a/plugins/Msg_Export/src/Glob.h b/plugins/Msg_Export/src/Glob.h index 8de2c0843e..ec898ac3f1 100755 --- a/plugins/Msg_Export/src/Glob.h +++ b/plugins/Msg_Export/src/Glob.h @@ -26,4 +26,6 @@ extern HINSTANCE hInstance;
+extern HANDLE hInternalWindowList;
+
#endif
\ No newline at end of file diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp index 0ab02fa6f2..a2a5c63789 100755 --- a/plugins/Msg_Export/src/main.cpp +++ b/plugins/Msg_Export/src/main.cpp @@ -45,6 +45,8 @@ static HANDLE hServiceFunc = 0; static HANDLE hOpenHistoryMenuItem = 0;
+HANDLE hInternalWindowList = NULL;
+
/////////////////////////////////////////////////////
// Remember to update the Version in the resource !!!
/////////////////////////////////////////////////////
@@ -105,6 +107,8 @@ static INT_PTR ShowExportHistory(WPARAM wParam,LPARAM /*lParam*/) int nSystemShutdown(WPARAM /*wparam*/,LPARAM /*lparam*/)
{
+ WindowList_Broadcast(hInternalWindowList,WM_CLOSE,0,0);
+
if( hEventOptionsInitialize )
{
UnhookEvent(hEventOptionsInitialize);
@@ -180,34 +184,29 @@ int MainInit(WPARAM /*wparam*/,LPARAM /*lparam*/) MessageBox( NULL , LPGENT("Failed to HookEvent ME_OPT_INITIALISE") , MSG_BOX_TITEL , MB_OK );
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags=0;
- mi.pszContactOwner=NULL; //all contacts
- mi.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_EXPORT_MESSAGE));
- if( bReplaceHistory )
- {
- mi.position= 1000090000;
- mi.pszName=LPGEN("View &History");
- mi.pszService=MS_HISTORY_SHOWCONTACTHISTORY;
- }
- else
+ if( !bReplaceHistory )
{
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags=0;
+ mi.pszContactOwner=NULL; //all contacts
+ mi.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_EXPORT_MESSAGE));
mi.position = 1000090100;
mi.pszName=LPGEN("Open E&xported History");
mi.pszService=MS_SHOW_EXPORT_HISTORY;
+ hOpenHistoryMenuItem = Menu_AddContactMenuItem(&mi);
+
+ if( !hOpenHistoryMenuItem )
+ MessageBox( NULL , LPGENT("Failed to add menu item Open Exported History\nCallService(MS_CLIST_ADDCONTACTMENUITEM,...)") , MSG_BOX_TITEL , MB_OK );
}
- hOpenHistoryMenuItem = Menu_AddContactMenuItem(&mi);
- if( !hOpenHistoryMenuItem )
- MessageBox( NULL , LPGENT("Failed to add menu item Open Exported History\nCallService(MS_CLIST_ADDCONTACTMENUITEM,...)") , MSG_BOX_TITEL , MB_OK );
-/*
+
hEventSystemShutdown = HookEvent( ME_SYSTEM_SHUTDOWN , nSystemShutdown );
if( !hEventSystemShutdown )
- MessageBox( NULL , "Failed to HookEvent ME_SYSTEM_SHUTDOWN" , MSG_BOX_TITEL , MB_OK );
-*/
+ MessageBox( NULL , _T("Failed to HookEvent ME_SYSTEM_SHUTDOWN") , MSG_BOX_TITEL , MB_OK );
+
/*
_TCHAR szBuf[ 10000 ];
@@ -312,7 +311,7 @@ int __declspec(dllexport)Load() return 0;
}
- nMaxLineWidth = DBGetContactSettingWord( NULL , MODULE , "MaxLineWidth" , nMaxLineWidth );
+ nMaxLineWidth = db_get_w( NULL , MODULE , "MaxLineWidth" , nMaxLineWidth );
if( nMaxLineWidth < 5 )
nMaxLineWidth = 5;
@@ -322,18 +321,18 @@ int __declspec(dllexport)Load() sTimeFormat = _DBGetString( NULL , MODULE , "TimeFormat" , _T("d s") );
sFileViewerPrg = _DBGetString( NULL , MODULE , "FileViewerPrg" , _T("") );
- bUseInternalViewer( DBGetContactSettingByte( NULL , MODULE , "UseInternalViewer" , bUseInternalViewer() ) != 0 );
+ bUseInternalViewer( db_get_b( NULL , MODULE , "UseInternalViewer" , bUseInternalViewer() ) != 0 );
- bReplaceHistory = DBGetContactSettingByte( NULL , MODULE , "ReplaceHistory" , bReplaceHistory ) != 0;
- bAppendNewLine = DBGetContactSettingByte( NULL , MODULE , "AppendNewLine" , bAppendNewLine ) != 0;
- bUseUtf8InNewFiles = DBGetContactSettingByte( NULL , MODULE , "UseUtf8InNewFiles" , bUseUtf8InNewFiles ) != 0;
- bUseLessAndGreaterInExport = DBGetContactSettingByte( NULL , MODULE , "UseLessAndGreaterInExport" , bUseLessAndGreaterInExport ) != 0;
+ bReplaceHistory = db_get_b( NULL , MODULE , "ReplaceHistory" , bReplaceHistory ) != 0;
+ bAppendNewLine = db_get_b( NULL , MODULE , "AppendNewLine" , bAppendNewLine ) != 0;
+ bUseUtf8InNewFiles = db_get_b( NULL , MODULE , "UseUtf8InNewFiles" , bUseUtf8InNewFiles ) != 0;
+ bUseLessAndGreaterInExport = db_get_b( NULL , MODULE , "UseLessAndGreaterInExport" , bUseLessAndGreaterInExport ) != 0;
- enRenameAction = (ENDialogAction)DBGetContactSettingByte( NULL , MODULE , "RenameAction" , enRenameAction );
- enDeleteAction = (ENDialogAction)DBGetContactSettingByte( NULL , MODULE , "DeleteAction" , enDeleteAction );;
+ enRenameAction = (ENDialogAction)db_get_b( NULL , MODULE , "RenameAction" , enRenameAction );
+ enDeleteAction = (ENDialogAction)db_get_b( NULL , MODULE , "DeleteAction" , enDeleteAction );;
// Plugin sweeper support
- DBWriteContactSettingTString(NULL,"Uninstall","Message Export",_T(MODULE));
+ db_set_ts(NULL,"Uninstall","Message Export",_T(MODULE));
if( bReplaceHistory )
{
@@ -365,6 +364,8 @@ int __declspec(dllexport)Load() {
MessageBox( NULL , LPGENT("Failed to CreateServiceFunction MS_SHOW_EXPORT_HISTORY") , MSG_BOX_TITEL , MB_OK );
}
+
+ hInternalWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
return 0;
}
@@ -384,10 +385,6 @@ int __declspec(dllexport)Load() __declspec(dllexport)int Unload(void)
{
- //if( !hEventSystemShutdown ) // we will try to unload anyway
- {
- nSystemShutdown(0,0);
- }
Uninitilize();
bUseInternalViewer( false );
return 0;
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 122c3e3521..b2ba1478eb 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -142,12 +142,12 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) }
if( lParamSort == 3 )
{
- DWORD dwUin1 = DBGetContactSettingDword(
+ DWORD dwUin1 = db_get_dw(
(HANDLE)lParam1,
_DBGetStringA( (HANDLE)lParam1 , "Protocol" , "p" , "" ).c_str(),
"UIN",
0);
- DWORD dwUin2 = DBGetContactSettingDword(
+ DWORD dwUin2 = db_get_dw(
(HANDLE)lParam2,
_DBGetStringA( (HANDLE)lParam2 , "Protocol" , "p" , "" ).c_str(),
"UIN",
@@ -457,14 +457,14 @@ BOOL bApplyChanges( HWND hwndDlg ) {
HANDLE hUser = (HANDLE)sItem.lParam;
if( _tcslen( szTemp ) > 0 )
- DBWriteContactSettingTString( hUser , MODULE , "FileName" , szTemp );
+ db_set_ts( hUser , MODULE , "FileName" , szTemp );
else
DBDeleteContactSetting( hUser , MODULE , "FileName" );
if( sItem.iImage )
DBDeleteContactSetting( hUser , MODULE , "EnableLog" ); // default is Enabled !!
else
- DBWriteContactSettingByte( hUser , MODULE , "EnableLog",0);
+ db_set_b( hUser , MODULE , "EnableLog",0);
}
}
UpdateFileToColWidth();
@@ -739,7 +739,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar sItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
sItem.iItem = nUser;
sItem.iSubItem = 0;
- sItem.iImage = DBGetContactSettingByte(hContact,MODULE,"EnableLog",1);
+ sItem.iImage = db_get_b(hContact,MODULE,"EnableLog",1);
sItem.lParam = (LPARAM) hContact;
@@ -761,7 +761,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar ListView_SetItem( hMapUser , &sItem );
- DWORD dwUIN = DBGetContactSettingDword(hContact, sTmpA.c_str(), "UIN", 0);
+ DWORD dwUIN = db_get_dw(hContact, sTmpA.c_str(), "UIN", 0);
_TCHAR szTmp[50];
_sntprintf( szTmp , sizeof(szTmp) ,_T("%d") , dwUIN );
sItem.iSubItem = 3;
@@ -1247,9 +1247,9 @@ BOOL bApplyChanges2( HWND hwndDlg ) if( ::SendMessage(hMapUser, LVM_GETITEMA, 0, (LPARAM)&sItem ) )
{
if( sItem.iImage )
- DBDeleteContactSetting( NULL , MODULE , szTemp ); // default is Enabled !!
+ db_unset( NULL , MODULE , szTemp ); // default is Enabled !!
else
- DBWriteContactSettingByte( NULL , MODULE , szTemp,0);
+ db_set_b( NULL , MODULE , szTemp,0);
}
}
SaveSettings();
@@ -1351,7 +1351,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts2(HWND hwndDlg, UINT msg, WPARAM wPa {
_snprintf(szTemp , sizeof( szTemp ) , "DisableProt_%s" , proto[i]->szModuleName);
sItem.pszText = proto[i]->szModuleName;
- sItem.iImage = DBGetContactSettingByte(NULL,MODULE,szTemp,1);
+ sItem.iImage = db_get_b(NULL,MODULE,szTemp,1);
::SendMessage( hMapUser , LVM_INSERTITEMA , 0 ,(LPARAM)&sItem );
sItem.iItem++;
}
diff --git a/plugins/Msg_Export/src/resource.h b/plugins/Msg_Export/src/resource.h index cd12714f9a..adf81b6ae2 100755 --- a/plugins/Msg_Export/src/resource.h +++ b/plugins/Msg_Export/src/resource.h @@ -1,5 +1,5 @@ //{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
+// Microsoft Visual C++ generated include file.
// Used by resource.rc
//
#define IDI_EXPORT_MESSAGE 108
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 08d7323b36..134f53ae3d 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -293,7 +293,7 @@ tstring _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting tstring ret;
DBVARIANT dbv = {0};
//DBGetContactSetting
- if( ! DBGetContactSettingWString( hContact , szModule , szSetting , &dbv ) )
+ if( ! db_get_ws( hContact , szModule , szSetting , &dbv ) )
{
if( dbv.type != DBVT_WCHAR)
{
@@ -307,7 +307,7 @@ tstring _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting }
else
ret = pszError;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return ret;
}
@@ -315,7 +315,7 @@ string _DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting {
string ret;
DBVARIANT dbv = {0};
- if( ! DBGetContactSetting( hContact , szModule , szSetting , &dbv ) )
+ if( ! db_get( hContact , szModule , szSetting , &dbv ) )
{
if( dbv.type != DBVT_ASCIIZ)
{
@@ -329,7 +329,7 @@ string _DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting }
else
ret = pszError;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return ret;
}
@@ -699,7 +699,7 @@ tstring GetFilePathFromUser( HANDLE hContact ) }
// Store the Filename used so that we can check if it changes.
- DBWriteContactSettingTString( hContact , MODULE , "PrevFileName" , sNoDBPath.c_str() );
+ db_set_ts( hContact , MODULE , "PrevFileName" , sNoDBPath.c_str() );
}
return sFilePath;
@@ -782,7 +782,7 @@ void ReplaceDefines( HANDLE hContact , tstring & sTarget ) string sProto = _DBGetStringA( hContact , "Protocol" , "p" , "" );
if( bUINUsed || ( bIdentifierUsed && sProto == "ICQ" ) )
{
- DWORD dwUIN = DBGetContactSettingDword(hContact, sProto.c_str(), "UIN", 0);
+ DWORD dwUIN = db_get_dw(hContact, sProto.c_str(), "UIN", 0);
tstring sReplaceUin;
if( dwUIN )
{
@@ -975,11 +975,10 @@ void DisplayErrorDialog( const _TCHAR * pszError , tstring& sFilePath , DBEVENTI if( GetSaveFileName(&ofn) )
{
- HANDLE hf; // file handle
- hf = CreateFile(ofn.lpstrFile, GENERIC_WRITE,
+ HANDLE hf = CreateFile(ofn.lpstrFile, GENERIC_WRITE,
0, (LPSECURITY_ATTRIBUTES) NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
- (HANDLE) NULL);
+ (HANDLE) NULL); // file handle
bWriteTextToFile( hf , sError.c_str() , false );
if( dbei )
@@ -1128,13 +1127,13 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) ReplaceAll( output , pszReplaceList[nCur] , _DBGetString( hContact , sProto.c_str() , pszReplaceListA[nCur] , _T("") ) );
}
- _sntprintf( szTemp , sizeof( szTemp ) , _T("%d") , DBGetContactSettingDword(hContact, sProto.c_str(), "UIN", 0) );
+ _sntprintf( szTemp , sizeof( szTemp ) , _T("%d") , db_get_dw(hContact, sProto.c_str(), "UIN", 0) );
ReplaceAll( output , _T("%UIN%") , szTemp );
- _sntprintf( szTemp , sizeof( szTemp ) , _T("%d") , DBGetContactSettingWord(hContact, sProto.c_str(), "Age", 0));
+ _sntprintf( szTemp , sizeof( szTemp ) , _T("%d") , db_get_w(hContact, sProto.c_str(), "Age", 0));
ReplaceAll( output , _T("%Age%") , szTemp );
- szTemp[0] = (_TCHAR)DBGetContactSettingByte(hContact, sProto.c_str(), "Gender", 0);
+ szTemp[0] = (_TCHAR)db_get_b(hContact, sProto.c_str(), "Gender", 0);
szTemp[1] = 0;
ReplaceAll( output , _T("%Gender%") , szTemp );
@@ -1432,7 +1431,7 @@ int nExportEvent(WPARAM wparam,LPARAM lparam) {
HANDLE hContact = (HANDLE)wparam;
- if( ! DBGetContactSettingByte(hContact,MODULE,"EnableLog",1) )
+ if( ! db_get_b(hContact,MODULE,"EnableLog",1) )
return 0;
DBEVENTINFO dbei={0};
@@ -1459,7 +1458,7 @@ int nExportEvent(WPARAM wparam,LPARAM lparam) if( dbei.eventType != EVENTTYPE_STATUSCHANGE )
{
_snprintf( szTemp , sizeof( szTemp ) , "DisableProt_%s" , dbei.szModule );
- if( DBGetContactSettingByte(NULL,MODULE,szTemp,1) )
+ if( db_get_b(NULL,MODULE,szTemp,1) )
{
ExportDBEventInfo( hContact , dbei );
}
@@ -1616,28 +1615,28 @@ SuperBreak: int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/)
{
+ HANDLE hContact = (HANDLE)wparam;
+
+ HWND hInternalWindow = WindowList_Find(hInternalWindowList,hContact);
+ if(hInternalWindow)
+ CloseWindow(hInternalWindow);
+
if( enDeleteAction == eDANothing )
return 0;
- HANDLE hContact = (HANDLE)wparam;
-
tstring sFilePath = GetFilePathFromUser( hContact );
- { // Test if there is another user using this file
- HANDLE hOtherContact = db_find_first();
- for(;;)
+ { // Test if there is another user using this file
+ for(HANDLE hOtherContact = db_find_first();hOtherContact;hOtherContact = db_find_next(hOtherContact))
{
if( hContact != hOtherContact && sFilePath == GetFilePathFromUser( hOtherContact ) )
{
return 0; // we found another contact abort mission :-)
}
-
- if( ! hOtherContact )
- break;
- hOtherContact = db_find_next(hOtherContact);
}
}
+
// Test to see if there is a file to delete
HANDLE hPrevFile = CreateFile( sFilePath.c_str() ,
GENERIC_READ ,
@@ -1687,19 +1686,19 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/) void SaveSettings()
{
- DBWriteContactSettingWord( NULL , MODULE , "MaxLineWidth" , (WORD) nMaxLineWidth );
- DBWriteContactSettingTString( NULL , MODULE , "ExportDir" , sExportDir.c_str() );
- DBWriteContactSettingTString( NULL , MODULE , "DefaultFile" , sDefaultFile.c_str() );
- DBWriteContactSettingTString( NULL , MODULE , "TimeFormat" , sTimeFormat.c_str() );
-
- DBWriteContactSettingTString( NULL , MODULE , "FileViewerPrg" , sFileViewerPrg.c_str() );
- DBWriteContactSettingByte( NULL , MODULE , "UseInternalViewer" , bUseInternalViewer() );
- DBWriteContactSettingByte( NULL , MODULE , "ReplaceHistory" , bReplaceHistory );
- DBWriteContactSettingByte( NULL , MODULE , "AppendNewLine" , bAppendNewLine );
- DBWriteContactSettingByte( NULL , MODULE , "UseUtf8InNewFiles" , bUseUtf8InNewFiles );
- DBWriteContactSettingByte( NULL , MODULE , "UseLessAndGreaterInExport" , bUseLessAndGreaterInExport );
-
- DBWriteContactSettingByte( NULL , MODULE , "RenameAction" , (BYTE)enRenameAction );
- DBWriteContactSettingByte( NULL , MODULE , "DeleteAction" , (BYTE)enDeleteAction );
+ db_set_w( NULL , MODULE , "MaxLineWidth" , (WORD) nMaxLineWidth );
+ db_set_ts( NULL , MODULE , "ExportDir" , sExportDir.c_str() );
+ db_set_ts( NULL , MODULE , "DefaultFile" , sDefaultFile.c_str() );
+ db_set_ts( NULL , MODULE , "TimeFormat" , sTimeFormat.c_str() );
+
+ db_set_ts( NULL , MODULE , "FileViewerPrg" , sFileViewerPrg.c_str() );
+ db_set_b( NULL , MODULE , "UseInternalViewer" , bUseInternalViewer() );
+ db_set_b( NULL , MODULE , "ReplaceHistory" , bReplaceHistory );
+ db_set_b( NULL , MODULE , "AppendNewLine" , bAppendNewLine );
+ db_set_b( NULL , MODULE , "UseUtf8InNewFiles" , bUseUtf8InNewFiles );
+ db_set_b( NULL , MODULE , "UseLessAndGreaterInExport" , bUseLessAndGreaterInExport );
+
+ db_set_b( NULL , MODULE , "RenameAction" , (BYTE)enRenameAction );
+ db_set_b( NULL , MODULE , "DeleteAction" , (BYTE)enDeleteAction );
}
|