Index: ictranslate.vc90.sln =================================================================== diff -u --- ictranslate.vc90.sln (revision 0) +++ ictranslate.vc90.sln (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,66 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rc2lng", "src\rc2lng\rc2lng.vc90.vcproj", "{10FB6B7E-81A1-47F9-BC6F-7017E5695D3A}" + ProjectSection(ProjectDependencies) = postProject + {5510B933-046F-4F75-8B46-5E8279C8CCDE} = {5510B933-046F-4F75-8B46-5E8279C8CCDE} + {DD1F3242-7EE4-4F41-8B8D-D833300C445F} = {DD1F3242-7EE4-4F41-8B8D-D833300C445F} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ictranslate", "src\ictranslate\ictranslate.vc90.vcproj", "{B0292250-B70C-4395-9859-F181FB113DA8}" + ProjectSection(ProjectDependencies) = postProject + {5510B933-046F-4F75-8B46-5E8279C8CCDE} = {5510B933-046F-4F75-8B46-5E8279C8CCDE} + {DD1F3242-7EE4-4F41-8B8D-D833300C445F} = {DD1F3242-7EE4-4F41-8B8D-D833300C445F} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libictranslate", "src\libictranslate\libictranslate.vc90.vcproj", "{DD1F3242-7EE4-4F41-8B8D-D833300C445F}" + ProjectSection(ProjectDependencies) = postProject + {5510B933-046F-4F75-8B46-5E8279C8CCDE} = {5510B933-046F-4F75-8B46-5E8279C8CCDE} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libicpf", "src\libicpf\libicpf.vc90.vcproj", "{5510B933-046F-4F75-8B46-5E8279C8CCDE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug-Unicode|Win32 = Debug-Unicode|Win32 + Debug-Unicode|x64 = Debug-Unicode|x64 + Release-Unicode|Win32 = Release-Unicode|Win32 + Release-Unicode|x64 = Release-Unicode|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {10FB6B7E-81A1-47F9-BC6F-7017E5695D3A}.Debug-Unicode|Win32.ActiveCfg = Debug-Unicode|Win32 + {10FB6B7E-81A1-47F9-BC6F-7017E5695D3A}.Debug-Unicode|Win32.Build.0 = Debug-Unicode|Win32 + {10FB6B7E-81A1-47F9-BC6F-7017E5695D3A}.Debug-Unicode|x64.ActiveCfg = Debug-Unicode|x64 + {10FB6B7E-81A1-47F9-BC6F-7017E5695D3A}.Debug-Unicode|x64.Build.0 = Debug-Unicode|x64 + {10FB6B7E-81A1-47F9-BC6F-7017E5695D3A}.Release-Unicode|Win32.ActiveCfg = Release-Unicode|Win32 + {10FB6B7E-81A1-47F9-BC6F-7017E5695D3A}.Release-Unicode|Win32.Build.0 = Release-Unicode|Win32 + {10FB6B7E-81A1-47F9-BC6F-7017E5695D3A}.Release-Unicode|x64.ActiveCfg = Release-Unicode|x64 + {10FB6B7E-81A1-47F9-BC6F-7017E5695D3A}.Release-Unicode|x64.Build.0 = Release-Unicode|x64 + {B0292250-B70C-4395-9859-F181FB113DA8}.Debug-Unicode|Win32.ActiveCfg = Debug-Unicode|Win32 + {B0292250-B70C-4395-9859-F181FB113DA8}.Debug-Unicode|Win32.Build.0 = Debug-Unicode|Win32 + {B0292250-B70C-4395-9859-F181FB113DA8}.Debug-Unicode|x64.ActiveCfg = Debug-Unicode|x64 + {B0292250-B70C-4395-9859-F181FB113DA8}.Debug-Unicode|x64.Build.0 = Debug-Unicode|x64 + {B0292250-B70C-4395-9859-F181FB113DA8}.Release-Unicode|Win32.ActiveCfg = Release-Unicode|Win32 + {B0292250-B70C-4395-9859-F181FB113DA8}.Release-Unicode|Win32.Build.0 = Release-Unicode|Win32 + {B0292250-B70C-4395-9859-F181FB113DA8}.Release-Unicode|x64.ActiveCfg = Release-Unicode|x64 + {B0292250-B70C-4395-9859-F181FB113DA8}.Release-Unicode|x64.Build.0 = Release-Unicode|x64 + {DD1F3242-7EE4-4F41-8B8D-D833300C445F}.Debug-Unicode|Win32.ActiveCfg = Debug-Unicode|Win32 + {DD1F3242-7EE4-4F41-8B8D-D833300C445F}.Debug-Unicode|Win32.Build.0 = Debug-Unicode|Win32 + {DD1F3242-7EE4-4F41-8B8D-D833300C445F}.Debug-Unicode|x64.ActiveCfg = Debug-Unicode|x64 + {DD1F3242-7EE4-4F41-8B8D-D833300C445F}.Debug-Unicode|x64.Build.0 = Debug-Unicode|x64 + {DD1F3242-7EE4-4F41-8B8D-D833300C445F}.Release-Unicode|Win32.ActiveCfg = Release-Unicode|Win32 + {DD1F3242-7EE4-4F41-8B8D-D833300C445F}.Release-Unicode|Win32.Build.0 = Release-Unicode|Win32 + {DD1F3242-7EE4-4F41-8B8D-D833300C445F}.Release-Unicode|x64.ActiveCfg = Release-Unicode|x64 + {DD1F3242-7EE4-4F41-8B8D-D833300C445F}.Release-Unicode|x64.Build.0 = Release-Unicode|x64 + {5510B933-046F-4F75-8B46-5E8279C8CCDE}.Debug-Unicode|Win32.ActiveCfg = Debug-Unicode|Win32 + {5510B933-046F-4F75-8B46-5E8279C8CCDE}.Debug-Unicode|Win32.Build.0 = Debug-Unicode|Win32 + {5510B933-046F-4F75-8B46-5E8279C8CCDE}.Debug-Unicode|x64.ActiveCfg = Debug-Unicode|x64 + {5510B933-046F-4F75-8B46-5E8279C8CCDE}.Debug-Unicode|x64.Build.0 = Debug-Unicode|x64 + {5510B933-046F-4F75-8B46-5E8279C8CCDE}.Release-Unicode|Win32.ActiveCfg = Release-Unicode|Win32 + {5510B933-046F-4F75-8B46-5E8279C8CCDE}.Release-Unicode|Win32.Build.0 = Release-Unicode|Win32 + {5510B933-046F-4F75-8B46-5E8279C8CCDE}.Release-Unicode|x64.ActiveCfg = Release-Unicode|x64 + {5510B933-046F-4F75-8B46-5E8279C8CCDE}.Release-Unicode|x64.Build.0 = Release-Unicode|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Index: src/ictranslate/ICTranslateDlg.cpp =================================================================== diff -u --- src/ictranslate/ICTranslateDlg.cpp (revision 0) +++ src/ictranslate/ICTranslateDlg.cpp (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,150 @@ +// ICTranslateDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "ictranslate.h" +#include "ICTranslateDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog +{ +public: + CAboutDlg(); + +// Dialog Data + enum { IDD = IDD_ABOUTBOX }; + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + +// Implementation +protected: + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) +END_MESSAGE_MAP() + + +// CICTranslateDlg dialog + + + + +CICTranslateDlg::CICTranslateDlg(CWnd* pParent /*=NULL*/) + : CDialog(CICTranslateDlg::IDD, pParent) +{ + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); +} + +void CICTranslateDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + +BEGIN_MESSAGE_MAP(CICTranslateDlg, CDialog) + ON_WM_SYSCOMMAND() + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + + +// CICTranslateDlg message handlers + +BOOL CICTranslateDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Add "About..." menu item to system menu. + + // IDM_ABOUTBOX must be in the system command range. + ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); + ASSERT(IDM_ABOUTBOX < 0xF000); + + CMenu* pSysMenu = GetSystemMenu(FALSE); + if (pSysMenu != NULL) + { + CString strAboutMenu; + strAboutMenu.LoadString(IDS_ABOUTBOX); + if (!strAboutMenu.IsEmpty()) + { + pSysMenu->AppendMenu(MF_SEPARATOR); + pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); + } + } + + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + // TODO: Add extra initialization here + + return TRUE; // return TRUE unless you set the focus to a control +} + +void CICTranslateDlg::OnSysCommand(UINT nID, LPARAM lParam) +{ + if ((nID & 0xFFF0) == IDM_ABOUTBOX) + { + CAboutDlg dlgAbout; + dlgAbout.DoModal(); + } + else + { + CDialog::OnSysCommand(nID, lParam); + } +} + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CICTranslateDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialog::OnPaint(); + } +} + +// The system calls this function to obtain the cursor to display while the user drags +// the minimized window. +HCURSOR CICTranslateDlg::OnQueryDragIcon() +{ + return static_cast(m_hIcon); +} + Index: src/ictranslate/ICTranslateDlg.h =================================================================== diff -u --- src/ictranslate/ICTranslateDlg.h (revision 0) +++ src/ictranslate/ICTranslateDlg.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,31 @@ +// ICTranslateDlg.h : header file +// + +#pragma once + + +// CICTranslateDlg dialog +class CICTranslateDlg : public CDialog +{ +// Construction +public: + CICTranslateDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + enum { IDD = IDD_ICTRANSLATE_DIALOG }; + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + +// Implementation +protected: + HICON m_hIcon; + + // Generated message map functions + virtual BOOL OnInitDialog(); + afx_msg void OnSysCommand(UINT nID, LPARAM lParam); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + DECLARE_MESSAGE_MAP() +}; Index: src/ictranslate/ictranslate.cpp =================================================================== diff -u --- src/ictranslate/ictranslate.cpp (revision 0) +++ src/ictranslate/ictranslate.cpp (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,78 @@ +// ictranslate.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "ictranslate.h" +#include "ICTranslateDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CICTranslateApp + +BEGIN_MESSAGE_MAP(CICTranslateApp, CWinApp) + ON_COMMAND(ID_HELP, &CWinApp::OnHelp) +END_MESSAGE_MAP() + + +// CICTranslateApp construction + +CICTranslateApp::CICTranslateApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + + +// The one and only CICTranslateApp object + +CICTranslateApp theApp; + + +// CICTranslateApp initialization + +BOOL CICTranslateApp::InitInstance() +{ + // InitCommonControlsEx() is required on Windows XP if an application + // manifest specifies use of ComCtl32.dll version 6 or later to enable + // visual styles. Otherwise, any window creation will fail. + INITCOMMONCONTROLSEX InitCtrls; + InitCtrls.dwSize = sizeof(InitCtrls); + // Set this to include all the common control classes you want to use + // in your application. + InitCtrls.dwICC = ICC_WIN95_CLASSES; + InitCommonControlsEx(&InitCtrls); + + CWinApp::InitInstance(); + + AfxEnableControlContainer(); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need + // Change the registry key under which our settings are stored + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + CICTranslateDlg dlg; + m_pMainWnd = &dlg; + INT_PTR nResponse = dlg.DoModal(); + if (nResponse == IDOK) + { + // TODO: Place code here to handle when the dialog is + // dismissed with OK + } + else if (nResponse == IDCANCEL) + { + // TODO: Place code here to handle when the dialog is + // dismissed with Cancel + } + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} Index: src/ictranslate/ictranslate.h =================================================================== diff -u --- src/ictranslate/ictranslate.h (revision 0) +++ src/ictranslate/ictranslate.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,31 @@ +// ictranslate.h : main header file for the PROJECT_NAME application +// + +#pragma once + +#ifndef __AFXWIN_H__ + #error "include 'stdafx.h' before including this file for PCH" +#endif + +#include "resource.h" // main symbols + + +// CICTranslateApp: +// See ictranslate.cpp for the implementation of this class +// + +class CICTranslateApp : public CWinApp +{ +public: + CICTranslateApp(); + +// Overrides + public: + virtual BOOL InitInstance(); + +// Implementation + + DECLARE_MESSAGE_MAP() +}; + +extern CICTranslateApp theApp; \ No newline at end of file Index: src/ictranslate/ictranslate.rc =================================================================== diff -u --- src/ictranslate/ictranslate.rc (revision 0) +++ src/ictranslate/ictranslate.rc (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,212 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#ifndef APSTUDIO_INVOKED +#include "targetver.h" +#endif +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Polish resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PLK) +#ifdef _WIN32 +LANGUAGE LANG_POLISH, SUBLANG_DEFAULT +#pragma code_page(1250) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#ifndef APSTUDIO_INVOKED\r\n" + "#include ""targetver.h""\r\n" + "#endif\r\n" + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""res\\ictranslate.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON "res\\ictranslate.ico" +#endif // Polish resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About ictranslate" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20 + LTEXT "ictranslate, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX + LTEXT "Copyright (C) 2008",IDC_STATIC,42,26,114,8 + DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP +END + +IDD_ICTRANSLATE_DIALOG DIALOGEX 0, 0, 320, 200 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "ICTranslate" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "TODO: " + VALUE "FileDescription", "TODO: " + VALUE "FileVersion", "1.0.0.1" + VALUE "InternalName", "ictranslate.exe" + VALUE "LegalCopyright", "TODO: (c) . All rights reserved." + VALUE "OriginalFilename", "ictranslate.exe" + VALUE "ProductName", "TODO: " + VALUE "ProductVersion", "1.0.0.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 163 + TOPMARGIN, 7 + BOTTOMMARGIN, 55 + END + + IDD_ICTRANSLATE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 313 + TOPMARGIN, 7 + BOTTOMMARGIN, 193 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_ABOUTBOX "&About ictranslate..." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +#include "res\ictranslate.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + Index: src/ictranslate/ictranslate.vc90.vcproj =================================================================== diff -u --- src/ictranslate/ictranslate.vc90.vcproj (revision 0) +++ src/ictranslate/ictranslate.vc90.vcproj (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,449 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: src/ictranslate/res/ictranslate.ico =================================================================== diff -u Binary files differ Index: src/ictranslate/res/ictranslate.rc2 =================================================================== diff -u --- src/ictranslate/res/ictranslate.rc2 (revision 0) +++ src/ictranslate/res/ictranslate.rc2 (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,13 @@ +// +// ictranslate.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// Index: src/ictranslate/resource.h =================================================================== diff -u --- src/ictranslate/resource.h (revision 0) +++ src/ictranslate/resource.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,21 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by ictranslate.rc +// +#define IDR_MAINFRAME 128 +#define IDM_ABOUTBOX 0x0010 +#define IDD_ABOUTBOX 100 +#define IDS_ABOUTBOX 101 +#define IDD_ICTRANSLATE_DIALOG 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 32771 +#endif +#endif Index: src/ictranslate/stdafx.cpp =================================================================== diff -u --- src/ictranslate/stdafx.cpp (revision 0) +++ src/ictranslate/stdafx.cpp (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,7 @@ +// stdafx.cpp : source file that includes just the standard includes +// ictranslate.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + Index: src/ictranslate/stdafx.h =================================================================== diff -u --- src/ictranslate/stdafx.h (revision 0) +++ src/ictranslate/stdafx.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,57 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + +#ifndef _SECURE_ATL +#define _SECURE_ATL 1 +#endif + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +#include "targetver.h" + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS + +#include // MFC core and standard components +#include // MFC extensions + + +#include // MFC Automation classes + + + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC support for Internet Explorer 4 Common Controls +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + + + + + + + + + +#ifdef _UNICODE +#if defined _M_IX86 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") +#elif defined _M_IA64 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") +#elif defined _M_X64 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") +#else +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") +#endif +#endif + + Index: src/ictranslate/targetver.h =================================================================== diff -u --- src/ictranslate/targetver.h (revision 0) +++ src/ictranslate/targetver.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,26 @@ + +#pragma once + +// The following macros define the minimum required platform. The minimum required platform +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and +// including the version specified. + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. +#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. +#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. +#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. +#endif + Index: src/libictranslate/HelpLngDialog.cpp =================================================================== diff -u --- src/libictranslate/HelpLngDialog.cpp (revision 0) +++ src/libictranslate/HelpLngDialog.cpp (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,69 @@ +/************************************************************************ + Copy Handler 1.x - program for copying data in Microsoft Windows + systems. + Copyright (C) 2001-2004 Ixen Gerthannes (copyhandler@o2.pl) + + This program is free software; you can redistribute it and/or 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, + 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*************************************************************************/ + +#include "stdafx.h" +#include "HelpLngDialog.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +BEGIN_ICTRANSLATE_NAMESPACE + +///////////////////////////////////////////////////////////////////////////// +// CHLanguageDialog dialog + +BEGIN_MESSAGE_MAP(CHLanguageDialog, CLanguageDialog) + ON_WM_HELPINFO() + ON_WM_CONTEXTMENU() + ON_BN_CLICKED(IDHELP, OnHelpButton) +END_MESSAGE_MAP() + +BOOL CHLanguageDialog::OnHelpInfo(HELPINFO* pHelpInfo) +{ + if (pHelpInfo->iContextType == HELPINFO_WINDOW) + { + pHelpInfo->dwContextId=(m_uiResID << 16) | pHelpInfo->iCtrlId; + AfxGetApp()->HtmlHelp((DWORD_PTR)pHelpInfo, HH_DISPLAY_TEXT_POPUP); + return true; + } + else + return false; +} + +void CHLanguageDialog::OnContextMenu(CWnd* pWnd, CPoint point) +{ + HELPINFO hi; + hi.cbSize=sizeof(HELPINFO); + hi.iCtrlId=pWnd->GetDlgCtrlID(); + hi.dwContextId=(m_uiResID << 16) | hi.iCtrlId; + hi.hItemHandle=pWnd->m_hWnd; + hi.iContextType=HELPINFO_WINDOW; + hi.MousePos=point; + + HtmlHelp((DWORD_PTR)&hi, HH_DISPLAY_TEXT_POPUP); +} + +void CHLanguageDialog::OnHelpButton() +{ + HtmlHelp(m_uiResID+0x20000, HH_HELP_CONTEXT); +} + +END_ICTRANSLATE_NAMESPACE Index: src/libictranslate/HelpLngDialog.h =================================================================== diff -u --- src/libictranslate/HelpLngDialog.h (revision 0) +++ src/libictranslate/HelpLngDialog.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,44 @@ +/************************************************************************ + Copy Handler 1.x - program for copying data in Microsoft Windows + systems. + Copyright (C) 2001-2004 Ixen Gerthannes (copyhandler@o2.pl) + + This program is free software; you can redistribute it and/or 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, + 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*************************************************************************/ +#pragma once + +#include "LanguageDialog.h" + +BEGIN_ICTRANSLATE_NAMESPACE + +///////////////////////////////////////////////////////////////////////////// +// CHLanguageDialog dialog + +class LIBICTRANSLATE_API CHLanguageDialog : public CLanguageDialog +{ +// Construction +public: + CHLanguageDialog(bool* pLock=NULL) : CLanguageDialog(pLock) { }; + CHLanguageDialog(PCTSTR lpszTemplateName, CWnd* pParent = NULL, bool* pLock=NULL) : CLanguageDialog(lpszTemplateName, pParent, pLock) { }; // standard constructor + CHLanguageDialog(UINT uiIDTemplate, CWnd* pParent = NULL, bool* pLock=NULL) : CLanguageDialog(uiIDTemplate, pParent, pLock) { }; // standard constructor + + BOOL OnHelpInfo(HELPINFO* pHelpInfo); + void OnContextMenu(CWnd* pWnd, CPoint point); + void OnHelpButton(); + + DECLARE_MESSAGE_MAP() +}; + +END_ICTRANSLATE_NAMESPACE Index: src/libictranslate/LanguageDialog.cpp =================================================================== diff -u --- src/libictranslate/LanguageDialog.cpp (revision 0) +++ src/libictranslate/LanguageDialog.cpp (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,680 @@ +/************************************************************************ + Copy Handler 1.x - program for copying data in Microsoft Windows + systems. + Copyright (C) 2001-2004 Ixen Gerthannes (copyhandler@o2.pl) + + This program is free software; you can redistribute it and/or 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, + 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*************************************************************************/ + +#include "stdafx.h" +#include "LanguageDialog.h" +#include "messages.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +BEGIN_ICTRANSLATE_NAMESPACE + +///////////////////////////////////////////////////////////////////////////// +// CDlgTemplate +CDlgTemplate::CDlgTemplate(const DLGTEMPLATE* pDlgTemplate) +{ + Open(pDlgTemplate); +} + +CDlgTemplate::CDlgTemplate(const DLGTEMPLATEEX* pDlgTemplate) +{ + Open((DLGTEMPLATE*)pDlgTemplate); +} + +CDlgTemplate::~CDlgTemplate() +{ + delete [] m_pszMenu; + delete [] m_pszClass; + delete [] m_pszTitle; + delete [] m_pszFace; + + // items + vector<_ITEM>::iterator it; + for (it=m_vItems.begin();it != m_vItems.end();it++) + { + delete [] (*it).m_pbyCreationData; + delete [] (*it).m_pszClass; + delete [] (*it).m_pszTitle; + } +} + +bool CDlgTemplate::Open(const DLGTEMPLATE* pDlgTemplate) +{ + if (pDlgTemplate == NULL) + return false; + bool bExt=((DLGTEMPLATEEX*)pDlgTemplate)->signature == 0xffff; + const BYTE* pData=((BYTE*)pDlgTemplate); + if (bExt) + { + m_dlgTemplate=*((DLGTEMPLATEEX*)pDlgTemplate); + pData+=sizeof(DLGTEMPLATEEX); + } + else + { + ConvertDlgToEx(pDlgTemplate, &m_dlgTemplate); + pData+=sizeof(DLGTEMPLATE); + } + + // here is the menu, class and title + pData=ReadCompoundData(pData, &m_wMenu, &m_pszMenu); + pData=ReadCompoundData(pData, &m_wClass, &m_pszClass); + pData=ReadCompoundData(pData, &m_wTitle, &m_pszTitle); + + // font + if (m_dlgTemplate.style & DS_SETFONT || m_dlgTemplate.style & DS_SHELLFONT) + { + m_wFontSize=*((WORD*)pData); + pData+=sizeof(WORD); + if (bExt) + { + m_wWeight=*((WORD*)pData); + pData+=sizeof(WORD); + m_byItalic=*((BYTE*)pData); + pData+=sizeof(BYTE); + m_byCharset=*((BYTE*)pData); + pData+=sizeof(BYTE); + } + else + { + m_wWeight=FW_NORMAL; + m_byItalic=FALSE; + m_byCharset=DEFAULT_CHARSET; + } + DWORD dwLen=(DWORD)wcslen((wchar_t*)pData); + m_pszFace=new TCHAR[dwLen+1]; +#ifdef _UNICODE + _tcscpy(m_pszFace, (wchar_t*)pData); +#else + WideCharToMultiByte(CP_ACP, 0, (wchar_t*)pData, dwLen+1, m_pszFace, dwLen+1, NULL, NULL); +#endif + pData+=(dwLen+1)*sizeof(wchar_t); + } + else + { + m_wFontSize=0xffff; + m_pszFace=NULL; + } + + // items + _ITEM item; + for (int i=0;i 0) + { + item.m_wCreationDataSize-=sizeof(WORD); + item.m_pbyCreationData=new BYTE[item.m_wCreationDataSize]; + memcpy(item.m_pbyCreationData, pData, item.m_wCreationDataSize); + } + else + item.m_pbyCreationData=NULL; + + m_vItems.push_back(item); + } + + return true; +} + +void CDlgTemplate::ConvertItemToEx(const DLGITEMTEMPLATE* pSrc, DLGITEMTEMPLATEEX* pDst) +{ + pDst->helpID=0; + pDst->exStyle=pSrc->dwExtendedStyle; + pDst->style=pSrc->style; + pDst->x=pSrc->x; + pDst->y=pSrc->y; + pDst->cx=pSrc->cx; + pDst->cy=pSrc->cy; + pDst->id=pSrc->id; +} + +void CDlgTemplate::ConvertDlgToEx(const DLGTEMPLATE* pSrc, DLGTEMPLATEEX* pDst) +{ + pDst->dlgVer=1; + pDst->signature=0x0000; + pDst->helpID=(ULONG)0; + pDst->exStyle=pSrc->dwExtendedStyle; + pDst->style=pSrc->style; + pDst->cDlgItems=pSrc->cdit; + pDst->x=pSrc->x; + pDst->y=pSrc->y; + pDst->cx=pSrc->cx; + pDst->cy=pSrc->cy; +} + +const BYTE* CDlgTemplate::ReadCompoundData(const BYTE* pBuffer, WORD* pwData, PTSTR* ppszStr) +{ + if (*((WORD*)pBuffer) == 0xffff) + { + *pwData=*((WORD*)(pBuffer+2)); + *ppszStr=NULL; + + return pBuffer+4; + } + else + { + *pwData=0xffff; + DWORD dwLen=(DWORD)wcslen((wchar_t*)pBuffer); + *ppszStr=new TCHAR[dwLen+1]; +#ifdef _UNICODE + _tcscpy(*ppszStr, (wchar_t*)pBuffer); +#else + WideCharToMultiByte(CP_ACP, 0, (wchar_t*)pBuffer, dwLen+1, *ppszStr, dwLen+1, NULL, NULL); +#endif + return pBuffer+(dwLen+1)*sizeof(wchar_t); + } + +} + +///////////////////////////////////////////////////////////////////////////// +// CLanguageDialog dialog + +CResourceManager *CLanguageDialog::m_prm=NULL; + +/////////////////////////////////////////////////////////////// +// Standard constructor +// pLock [in] - specifies address of a bool value that'll be +// used to check if another instance of this window has +// already been shown. Should be declared in derived class +// as 'static bool m_xxx;' and initialized to 0. +/////////////////////////////////////////////////////////////// +CLanguageDialog::CLanguageDialog(bool* pLock) : CDialog() +{ + m_pszResName=NULL; + m_uiResID=0; + m_pParent=NULL; + m_cType=-1; + m_bAutoDelete=false; + m_pFont=NULL; + m_pbLock=pLock; + m_bLockChanged=false; + m_bLockInstance=false; + m_iBaseX=m_iBaseY=0; + _ASSERT(m_prm); // make sure the CLanguageDialog::SetResManager() has been called aready + m_prm->m_lhDialogs.push_back(this); +} + +/////////////////////////////////////////////////////////////// +// Constructor that takes string based template name +// lpszTemplateName [in] - specifies the template name to load +// and show as this dialog. +// pParent [in] - logical (everyone knows) +// pLock [in] - address of a bool for dialog instance checks +/////////////////////////////////////////////////////////////// +CLanguageDialog::CLanguageDialog(PCTSTR lpszTemplateName, CWnd* pParent, bool* pLock) : CDialog() +{ + m_pszResName=lpszTemplateName; + if (IS_INTRESOURCE(lpszTemplateName)) + m_uiResID=(WORD)lpszTemplateName; + else + m_uiResID=0; + m_pParent=pParent; + m_cType=-1; + m_bAutoDelete=false; + m_pFont=NULL; + m_pbLock=pLock; + m_bLockChanged=false; + m_bLockInstance=false; + m_iBaseX=m_iBaseY=0; + _ASSERT(m_prm); // make sure the CLanguageDialog::SetResManager() has been called aready + m_prm->m_lhDialogs.push_back(this); +} + +/////////////////////////////////////////////////////////////// +// Constructor that takes UINT based template name +// uiIDTemplate [in] - specifies the template ID to load +// and show as this dialog. +// pParent [in] - logical (everyone knows) +// pLock [in] - address of a bool for dialog instance checks +/////////////////////////////////////////////////////////////// +CLanguageDialog::CLanguageDialog(UINT uiIDTemplate, CWnd* pParent, bool* pLock) : CDialog() +{ + m_pszResName=MAKEINTRESOURCE(uiIDTemplate); + m_uiResID=uiIDTemplate; + m_pParent=pParent; + m_cType=-1; + m_bAutoDelete=false; + m_pFont=NULL; + m_pbLock=pLock; + m_bLockChanged=false; + m_bLockInstance=false; + m_iBaseX=m_iBaseY=0; + _ASSERT(m_prm); // make sure the CLanguageDialog::SetResManager() has been called aready + m_prm->m_lhDialogs.push_back(this); +} + +/////////////////////////////////////////////////////////////// +// Standard destructor +// Removes itself from a list in CWinApp (not to get any window +// messages anymore). +/////////////////////////////////////////////////////////////// +CLanguageDialog::~CLanguageDialog() +{ + list::iterator it=m_prm->m_lhDialogs.begin(); + while (it != m_prm->m_lhDialogs.end()) + { + if (*it == this) + { + m_prm->m_lhDialogs.erase(it); + break; + } + + it++; + } +} + +///////////////////////////////////////////////////////////////////////////// +// CLanguageDialog message handlers + +/////////////////////////////////////////////////////////////// +// Makes properly constructed dialog modal. +// RetVal [out] - value returned by dialog proc +/////////////////////////////////////////////////////////////// +INT_PTR CLanguageDialog::DoModal() +{ + if (m_pszResName) + { + HGLOBAL hDialog=m_prm->LoadResource(RT_DIALOG, m_pszResName); + if (!InitModalIndirect(hDialog)) + return -1; + } + m_cType=0; + return CDialog::DoModal(); +} + +/////////////////////////////////////////////////////////////// +// Creates (and shows probably) this constructed dialog. +// RetVal [out] - if creation succeeded +/////////////////////////////////////////////////////////////// +BOOL CLanguageDialog::Create() +{ + _ASSERT(m_pszResName); // nothing was set as a dialog template + + if (!m_bLockInstance || m_pbLock == NULL || !(*m_pbLock)) + { + HGLOBAL hDialog=m_prm->LoadResource(RT_DIALOG, m_pszResName); + + // modeless dialog + if (!CreateIndirect(hDialog, m_pParent)) + return FALSE; + + m_cType=1; + if (m_pbLock) + { + *m_pbLock=true; + m_bLockChanged=true; + } + + return TRUE; + } + else + { + m_bLockChanged=false; + Cleanup(); + return FALSE; + } +} + +/////////////////////////////////////////////////////////////// +// Changes values based on dialog units into the values in +// pixels. Change is based on std MapDialogRect if the language +// hasn't been changed otf or takes current font into +// consideration. +// pRect [in/out] - on [in] - dialog units, on [out] - pixels +/////////////////////////////////////////////////////////////// +void CLanguageDialog::MapRect(RECT* pRect) +{ + if (m_pFont) + { + pRect->left=MulDiv(pRect->left, m_iBaseX, 4); + pRect->right=MulDiv(pRect->right, m_iBaseX, 4); + pRect->top=MulDiv(pRect->top, m_iBaseY, 8); + pRect->bottom=MulDiv(pRect->bottom, m_iBaseY, 8); + } + else + MapDialogRect(pRect); +} + +/////////////////////////////////////////////////////////////// +// Helper function - called when this dialog receives message +// WM_RMNOTIFY (with WPARAM == RMNT_LANGCHANGE). Updates the +// dialog with data from a new template. Passes params to +// virtual function OnLanguageChanged. +// wOldLang [in] - specifies the old language code +// wNewLang [in] - specifies the new language code. +/////////////////////////////////////////////////////////////// +void CLanguageDialog::UpdateLanguage(WORD /*wOldLang*/, WORD /*wNewLang*/) +{ + // cannot update for string based template + if (m_uiResID == 0) + return; + + // set the title + SetWindowText(m_prm->LoadString((WORD)m_uiResID, 0)); + + // load the dialog template + CDlgTemplate dt; + if (!dt.Open(m_prm->LoadDialog(MAKEINTRESOURCE(m_uiResID)))) + { + TRACE("Cannot open dialog template in UpdateLanguage\n"); + return; + } + + // update the menu + if (GetMenu()) + m_prm->UpdateMenu(GetMenu()->m_hMenu, dt.m_wMenu); + + // font + if (!(GetLanguageUpdateOptions() & LDF_NODIALOGFONT)) + { + // dialog font + LOGFONT lf; + memset(&lf, 0, sizeof(LOGFONT)); + HDC hdc=::GetDC(NULL); + lf.lfHeight = -MulDiv(m_prm->m_ld.GetPointSize(), GetDeviceCaps(hdc, LOGPIXELSY), 72); + ::ReleaseDC(NULL, hdc); + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = m_prm->m_ld.GetCharset(); + _tcscpy(lf.lfFaceName, m_prm->m_ld.GetFontFace()); + + delete m_pFont; + m_pFont=new CFont(); + m_pFont->CreateFontIndirect(&lf); + + // change base dlg units + CalcBaseUnits(dt.m_pszFace, dt.m_wFontSize); + } + + if (!(GetLanguageUpdateOptions() & LDF_NODIALOGSIZE)) + { + // dialog size + CRect rcWin; + GetWindowRect(&rcWin); + + CRect rcDialog(0, 0, dt.m_dlgTemplate.cx, dt.m_dlgTemplate.cy); + MapRect(&rcDialog); + rcDialog.bottom+=2*GetSystemMetrics(SM_CYDLGFRAME)+GetSystemMetrics(SM_CYCAPTION); + + // correct the height by a menu height + if ((dt.m_wMenu != 0xffff) || ((dt.m_pszMenu != NULL) && _tcslen(dt.m_pszMenu) != 0)) + rcDialog.bottom+=GetSystemMetrics(SM_CYMENU); + + rcDialog.right+=2*GetSystemMetrics(SM_CXDLGFRAME); + rcDialog.OffsetRect(rcWin.CenterPoint().x-rcDialog.Width()/2, rcWin.CenterPoint().y-rcDialog.Height()/2); + + //TEMP + TRACE("Old dlg pos/size: x=%lu, y=%lu, cx=%lu, cy=%lu; \n\tNew dlg pos/size: x=%lu, y=%lu, cx=%lu, cy=%lu\n", rcWin.left, rcWin.top, rcWin.Width(), rcWin.Height(), rcDialog.left, rcDialog.top, rcDialog.Width(), rcDialog.Height()); + SetWindowPos(NULL, rcDialog.left, rcDialog.top, rcDialog.Width(), rcDialog.Height(), SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE); + } + + // the controls + CWnd* pWnd; + vector::iterator it; + for (it=dt.m_vItems.begin();it != dt.m_vItems.end();it++) + { + // skip controls that cannot be modified + if ( (*it).m_itemTemplate.id == 0xffff || (pWnd=GetDlgItem((*it).m_itemTemplate.id)) == NULL) + continue; + + // the font + if (!(GetLanguageUpdateOptions() & LDF_NODIALOGFONT)) + pWnd->SetFont(m_pFont, FALSE); + + // style&ex style + // modify only the rtl/ltr reading order + LONG lStyleEx=::GetWindowLong(pWnd->m_hWnd, GWL_EXSTYLE); + if (lStyleEx & WS_EX_RTLREADING) + { + if (!m_prm->m_ld.GetDirection()) + lStyleEx &= ~WS_EX_RTLREADING; + } + else + { + if (m_prm->m_ld.GetDirection()) + lStyleEx |= WS_EX_RTLREADING; + } + + ::SetWindowLong(pWnd->m_hWnd, GWL_EXSTYLE, lStyleEx); + + // size + CRect rc((*it).m_itemTemplate.x, (*it).m_itemTemplate.y, (*it).m_itemTemplate.x+(*it).m_itemTemplate.cx, (*it).m_itemTemplate.y+(*it).m_itemTemplate.cy); + MapRect(&rc); + pWnd->SetWindowPos(NULL, rc.left, rc.top, rc.Width(), rc.Height(), SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE); + + // text/caption + if ( (*it).m_wClass == 0x0080 || (*it).m_wClass == 0x0082 || (*it).m_wClass == 0x0086 || ((*it).m_pszClass != NULL && _tcscmp((*it).m_pszClass, _T("STATICEX")) == 0) ) + pWnd->SetWindowText(m_prm->LoadString((WORD)m_uiResID, (*it).m_itemTemplate.id)); + } +} + +/////////////////////////////////////////////////////////////// +// Helper function - does the cleanup after destroying the +// dialog (that means releasing the instance lock, deleting +// unused fonts and in some cases deleting itself). +/////////////////////////////////////////////////////////////// +void CLanguageDialog::Cleanup() +{ + TRACE("CLanguageDialog::Cleanup()\n"); + + if (m_bLockChanged && m_pbLock) + *m_pbLock=false; + + delete m_pFont; + + if (m_bAutoDelete) + delete this; +} + +/////////////////////////////////////////////////////////////// +// Standard msg - initializes tool tip handling +/////////////////////////////////////////////////////////////// +BOOL CLanguageDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + + UpdateLanguage(0,0); // because initially all the texts are empty + + EnableToolTips(TRUE); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +/////////////////////////////////////////////////////////////// +// Standard handler for pressing cancel button in a dialog. +// For modeless dialog causes dialog to be destroyed. +/////////////////////////////////////////////////////////////// +void CLanguageDialog::OnCancel() +{ + switch (m_cType) + { + case 0: + CDialog::OnCancel(); + break; + case 1: + DestroyWindow(); + break; + } +} + +/////////////////////////////////////////////////////////////// +// Standard handler for pressing OK button in a dialog. +// For modeless dialog causes destruction of a dialog. +/////////////////////////////////////////////////////////////// +void CLanguageDialog::OnOK() +{ + switch(m_cType) + { + case 0: + CDialog::OnOK(); + break; + case 1: + DestroyWindow(); + break; + } +} + +/////////////////////////////////////////////////////////////// +// Standard override - calls cleanup. +/////////////////////////////////////////////////////////////// +void CLanguageDialog::PostNcDestroy() +{ + CDialog::PostNcDestroy(); + Cleanup(); +} + +/////////////////////////////////////////////////////////////// +// This dialog's window procedure handler - look at ms docs. +/////////////////////////////////////////////////////////////// +LRESULT CLanguageDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) +{ + switch(message) + { + case WM_RMNOTIFY: + if ((UINT)wParam == RMNT_LANGCHANGE) + { + UpdateLanguage(HIWORD(lParam), LOWORD(lParam)); + + // now update user controls (everybody has to do it him(her)self) + OnLanguageChanged(HIWORD(lParam), LOWORD(lParam)); + break; + } + case WM_NOTIFY: + { + NMHDR* pnmh=(NMHDR*)lParam; + if (pnmh->code == TTN_NEEDTEXT) + { + // establish the ID of a control + TOOLTIPTEXT *ppt=(TOOLTIPTEXT*)pnmh; + UINT nID; + if (ppt->uFlags & TTF_IDISHWND) + nID=(UINT)::GetDlgCtrlID((HWND)pnmh->idFrom); + else + nID=(UINT)pnmh->idFrom; + + return OnTooltipText(nID, ppt); + } + break; + } + } + + return CDialog::WindowProc(message, wParam, lParam); +} + +/////////////////////////////////////////////////////////////// +// Helper function. Recalculates current sizes of a dialog base +// units (font dependent) and stores in the internal members. +// pszFacename [in] - font's face name. +// wPointSize [in] - size of the font in points. +/////////////////////////////////////////////////////////////// +void CLanguageDialog::CalcBaseUnits(PCTSTR pszFacename, WORD wPointSize) +{ + LOGFONT lf; + HDC hDC = ::GetDC(NULL); + memset(&lf, 0, sizeof(LOGFONT)); + lf.lfHeight = -MulDiv(wPointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72); + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = DEFAULT_CHARSET; + lstrcpy(lf.lfFaceName, pszFacename); + + HFONT hNewFont = CreateFontIndirect(&lf); + if (hNewFont != NULL) + { + HFONT hFontOld = (HFONT)SelectObject(hDC, hNewFont); + TEXTMETRIC tm; + GetTextMetrics(hDC, &tm); + m_iBaseY = tm.tmHeight + tm.tmExternalLeading; + SIZE size; + ::GetTextExtentPoint32(hDC, _T("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"), 52, &size); + m_iBaseX = (size.cx + 26) / 52; + SelectObject(hDC, hFontOld); + DeleteObject(hNewFont); + } + else + { + // Could not create the font so just use the system's values + m_iBaseX = LOWORD(GetDialogBaseUnits()); + m_iBaseY = HIWORD(GetDialogBaseUnits()); + } + ::ReleaseDC(NULL, hDC); +} + +END_ICTRANSLATE_NAMESPACE Index: src/libictranslate/LanguageDialog.h =================================================================== diff -u --- src/libictranslate/LanguageDialog.h (revision 0) +++ src/libictranslate/LanguageDialog.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,207 @@ +/************************************************************************ + Copy Handler 1.x - program for copying data in Microsoft Windows + systems. + Copyright (C) 2001-2004 Ixen Gerthannes (copyhandler@o2.pl) + + This program is free software; you can redistribute it and/or 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, + 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*************************************************************************/ +/************************************************************************* + CLanguageDialog template + + Files: LanguageDialog.h, LanguageDialog.cpp + Author: Ixen Gerthannes + Usage: + Derive your class from CLanguageDialog instead of CDialog, change all + calls from CDialog to CLanguageDialog, change call to base constructor + so it can take language as parameter. + Creating dialog class: + - derive class from CLanguageDialog + - change all occurences of CDialog to CLanguageDialog + - change parameters list of your default constructor so it can take + language as parameter (WORD wLang) + - modify call to base class constructor by putting into it declared + wLang from your constructor + Displaying dialog box: + - declare object as your dialog class + - eventually set public member m_bAutoDelete to true if you're + creating dialog with operator new, and it should be + automatically deleted when closed + - call DoModal/Create/CreateModeless member function for + modal/modeless/mixed mode dialog + Members: + Constructors - as described in CDialog constructors - language + specifies resource language to load + CLanguageDialog(); + CLanguageDialog(PCTSTR lpszTemplateName, CWnd* pParent = NULL); + CLanguageDialog(UINT uiIDTemplate, CWnd* pParent = NULL); + Functions: + int DoModal(); - like in CDialog + BOOL Create(); - creates modeless dialog box; this class + automatically handles DestroyWindow, and like + void Cleanup(); - function cleans unused data - use only when + window object wasn't created yet (in Create() and earlier) + WORD GetCurrentLanguage() const; - retrieves current language + setting for this dialog + Attributes: + bool m_bAutoDelete; - specifies whether this dialog should be + deleted (by 'delete this') when closed. +*************************************************************************/ +#pragma once + +#include "libictranslate.h" +#include "ResourceManager.h" + +BEGIN_ICTRANSLATE_NAMESPACE + +#pragma pack(push, 1) +struct DLGTEMPLATEEX +{ + WORD dlgVer; + WORD signature; + DWORD helpID; + DWORD exStyle; + DWORD style; + WORD cDlgItems; + short x; + short y; + short cx; + short cy; +}; + +struct DLGITEMTEMPLATEEX +{ + DWORD helpID; + DWORD exStyle; + DWORD style; + short x; + short y; + short cx; + short cy; + WORD id; + WORD __DUMMY__; +}; +#pragma pack(pop) + +class CDlgTemplate +{ +public: + CDlgTemplate() { m_wMenu=(WORD)-1; m_pszMenu=NULL; m_wClass=(WORD)-1; m_pszClass=NULL, m_wTitle=(WORD)-1; m_pszTitle=NULL; m_wFontSize=0; m_wWeight=0; m_byItalic=0; m_byCharset=0; m_pszFace=NULL; }; + CDlgTemplate(const DLGTEMPLATE* pDlgTemplate); + CDlgTemplate(const DLGTEMPLATEEX* pDlgTemplate); + ~CDlgTemplate(); + + bool Open(const DLGTEMPLATE* pDlgTemplate); + +protected: + void ConvertItemToEx(const DLGITEMTEMPLATE* pSrc, DLGITEMTEMPLATEEX* pDst); // converts DLGITEMTEMPLATE to DLGITEMTEMPLATEEX + void ConvertDlgToEx(const DLGTEMPLATE* pSrc, DLGTEMPLATEEX* pDst); + + const BYTE* ReadCompoundData(const BYTE* pBuffer, WORD* pwData, PTSTR* ppszStr); + +public: + struct _ITEM + { + DLGITEMTEMPLATEEX m_itemTemplate; + + WORD m_wClass; + TCHAR *m_pszClass; + + WORD m_wTitle; + TCHAR *m_pszTitle; + + WORD m_wCreationDataSize; + BYTE *m_pbyCreationData; + }; + vector<_ITEM> m_vItems; + + DLGTEMPLATEEX m_dlgTemplate; + + WORD m_wMenu; + TCHAR *m_pszMenu; + + WORD m_wClass; + TCHAR *m_pszClass; + + WORD m_wTitle; // always -1 + TCHAR *m_pszTitle; + + // font + WORD m_wFontSize; + WORD m_wWeight; + BYTE m_byItalic; + BYTE m_byCharset; + TCHAR *m_pszFace; +}; + +///////////////////////////////////////////////////////////////////////////// +// CLanguageDialog dialog +#define LDF_NODIALOGSIZE 0x01 +#define LDF_NODIALOGFONT 0x02 + +class LIBICTRANSLATE_API CLanguageDialog : public CDialog +{ +public: +// Construction/destruction + CLanguageDialog(bool* pLock=NULL); + CLanguageDialog(PCTSTR lpszTemplateName, CWnd* pParent = NULL, bool* pLock=NULL); // standard constructor + CLanguageDialog(UINT uiIDTemplate, CWnd* pParent = NULL, bool* pLock=NULL); // standard constructor + + ~CLanguageDialog(); + + // static members - initialize global pointer to a resource manager + static void SetResManager(CResourceManager* prm) { m_prm=prm; }; + + // creation + virtual INT_PTR DoModal(); + virtual BOOL Create(); + + void MapRect(RECT* pRect); + CFont* GetFont() { return m_pFont ? m_pFont : ((CDialog*)this)->GetFont(); }; + +protected: + void UpdateLanguage(WORD wOldLang, WORD wNewLang); + virtual UINT GetLanguageUpdateOptions() { return 0; }; + virtual void OnLanguageChanged(WORD /*wOld*/, WORD /*wNew*/) { }; + void Cleanup(); + + virtual BOOL OnTooltipText(UINT /*uiID*/, TOOLTIPTEXT* /*pTip*/) { return FALSE; }; + virtual BOOL OnInitDialog(); + virtual void OnCancel(); + virtual void OnOK(); + virtual void PostNcDestroy(); + virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); + +private: + void CalcBaseUnits(PCTSTR pszFacename, WORD wPointSize); + +// Attributes +public: + bool m_bAutoDelete; // deletes this dialog when exiting + bool m_bLockInstance; // allows only one instance of this dialog if set + +protected: + static CResourceManager* m_prm; // points to the resource manager instance + + bool *m_pbLock; // dialog box instance lock system + bool m_bLockChanged; // if this dialog changed the lock + PCTSTR m_pszResName; // resource (string) name of the dialog template + UINT m_uiResID; // resource ID if any of the dialog template + CWnd* m_pParent; // parent window ptr + char m_cType; // type of this dialog box + CFont* m_pFont; // currently used font + int m_iBaseX, m_iBaseY; +}; + +END_ICTRANSLATE_NAMESPACE Index: src/libictranslate/ResourceManager.cpp =================================================================== diff -u --- src/libictranslate/ResourceManager.cpp (revision 0) +++ src/libictranslate/ResourceManager.cpp (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,602 @@ +/************************************************************************ + Copy Handler 1.x - program for copying data in Microsoft Windows + systems. + Copyright (C) 2001-2003 Ixen Gerthannes (ixen@interia.pl) + + This program is free software; you can redistribute it and/or 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, + 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*************************************************************************/ +#include "stdafx.h" +#include "ResourceManager.h" +#include "../libicpf/cfg.h" +#include +#include "messages.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +BEGIN_ICTRANSLATE_NAMESPACE + +#define EMPTY_STRING _t("") + +CLangData::CLangData() : + m_pszFilename(NULL), + m_pszLngName(NULL), + m_pszBaseFile(NULL), + m_pszFontFace(NULL), + m_pszHelpName(NULL), + m_pszAuthor(NULL), + m_pszVersion(NULL), + m_uiSectionID(0) +{ +} + +CLangData::~CLangData() +{ + delete [] m_pszFilename; + delete [] m_pszLngName; + delete [] m_pszBaseFile; + delete [] m_pszFontFace; + delete [] m_pszHelpName; + delete [] m_pszAuthor; + delete [] m_pszVersion; + + for(strings_map::iterator it = m_mStrings.begin(); it != m_mStrings.end(); it++) + { + delete [] (*it).second; + } +} + +void CLangData::Clear() +{ + delete [] m_pszFilename; + m_pszFilename = NULL; + delete [] m_pszLngName; + m_pszLngName = NULL; + delete [] m_pszBaseFile; + m_pszBaseFile = NULL; + delete [] m_pszFontFace; + m_pszFontFace = NULL; + delete [] m_pszHelpName; + m_pszHelpName = NULL; + delete [] m_pszAuthor; + m_pszAuthor = NULL; + delete [] m_pszVersion; + m_pszVersion = NULL; + + for(strings_map::iterator it = m_mStrings.begin(); it != m_mStrings.end(); it++) + { + delete [] (*it).second; + } + m_mStrings.clear(); +} + +CLangData::CLangData(const CLangData& ld) : + m_pszFilename(NULL), + m_pszLngName(NULL), + m_pszBaseFile(NULL), + m_pszFontFace(NULL), + m_pszHelpName(NULL), + m_pszAuthor(NULL), + m_pszVersion(NULL) +{ + SetFilename(ld.GetFilename(true)); + SetLangName(ld.GetLangName()); + SetLangCode(ld.GetLangCode()); + SetFontFace(ld.GetFontFace()); + SetCharset(ld.GetCharset()); + SetPointSize(ld.GetPointSize()); + SetDirection(ld.GetDirection()); + SetHelpName(ld.GetHelpName()); + SetAuthor(ld.GetAuthor()); + SetVersion(ld.GetVersion()); +} + +bool CLangData::ReadInfo(PCTSTR pszFile) +{ + try + { + icpf::config cfg(icpf::config::eIni); + const uint_t uiLangName = cfg.register_string(_T("Info/Lang Name"), _t("")); + const uint_t uiLangCode = cfg.register_signed_num(_T("Info/Lang Code"), 0, 0, 0xffff); + const uint_t uiBaseLanguage = cfg.register_string(_T("Info/Base Language"), _T("")); + const uint_t uiFontFace = cfg.register_string(_T("Info/Font Face"), _T("")); + const uint_t uiCharset = cfg.register_signed_num(_T("Info/Charset"), 0, 0, 0xffff); + const uint_t uiSize = cfg.register_signed_num(_T("Info/Size"), 0, 0, 0xffff); + const uint_t uiRTL = cfg.register_bool(_T("Info/RTL reading order"), false); + const uint_t uiHelpName = cfg.register_string(_T("Info/Help name"), _T("")); + const uint_t uiAuthor = cfg.register_string(_T("Info/Author"), _T("")); + const uint_t uiVersion = cfg.register_string(_T("Info/Version"), _T("")); + cfg.read(pszFile); + + const tchar_t* psz = cfg.get_string(uiLangName); + if(!psz || psz[0] == _t('\0')) + return false; + SetLangName(psz); + + ll_t ll = cfg.get_signed_num(uiLangCode); + if(ll == 0) + return false; + SetLangCode((WORD)ll); + + psz = cfg.get_string(uiBaseLanguage); + SetBaseFile(psz); + + psz = cfg.get_string(uiFontFace); + if(!psz || psz[0] == _t('\0')) + return false; + SetFontFace(psz); + + ll = cfg.get_signed_num(uiCharset); + if(ll == 0) + return false; + SetCharset((BYTE)ll); + + ll = cfg.get_signed_num(uiSize); + if(ll == 0) + return false; + SetPointSize((WORD)ll); + + SetDirection(cfg.get_bool(uiRTL)); + + psz = cfg.get_string(uiHelpName); + if(!psz || psz[0] == _t('\0')) + return false; + SetHelpName(psz); + + psz = cfg.get_string(uiAuthor); + if(!psz || psz[0] == _t('\0')) + return false; + SetAuthor(psz); + + psz = cfg.get_string(uiVersion); + if(!psz || psz[0] == _t('\0')) + return false; + SetVersion(psz); + + SetFilename(pszFile); + + return true; + } + catch(...) + { + return false; + } +} + +void CLangData::EnumAttributesCallback(bool bGroup, const tchar_t* pszName, const tchar_t* pszValue, ptr_t pData) +{ + CLangData* pLangData = (CLangData*)pData; + assert(pLangData); + assert(pszName); + if(!pLangData || !pszName) + return; + + if(bGroup && _tcsicmp(pszName, _t("Info")) == 0) + return; + if(bGroup) + { + // new section - remember in member + pLangData->m_uiSectionID = _ttoi(pszName); + } + else + { + uint_t uiVal = _ttoi(pszName); + if(pLangData->m_bUpdating) + { + // check if the entry already exists + strings_map::iterator it = pLangData->m_mStrings.find(pLangData->m_uiSectionID << 16 | uiVal); + if(it != pLangData->m_mStrings.end()) + return; + } + size_t stLen = _tcslen(pszValue); + tchar_t* pszStr = new tchar_t[stLen + 1]; + _tcscpy(pszStr, pszValue); + + // convert escape strings into escape sequences + CLangData::UnescapeString(pszStr); + + pLangData->m_mStrings.insert(strings_map::value_type(pLangData->m_uiSectionID << 16 | uiVal, pszStr)); + } +} + +void CLangData::UnescapeString(tchar_t* pszData) +{ + tchar_t* pszOut = pszData; + while (*pszData != 0) + { + if (*pszData == _T('\\')) + { + pszData++; + switch(*pszData++) + { + case _T('t'): + *pszOut++ = _T('\t'); + break; + case _T('r'): + *pszOut++ = _T('\r'); + break; + case _T('n'): + *pszOut++ = _T('\n'); + break; + default: + *pszOut++ = _T('\\'); + } + } + else + *pszOut++ = *pszData++; + } + *pszOut = _T('\0'); + +} + +bool CLangData::ReadTranslation(PCTSTR pszFile, bool bUpdate) +{ + try + { + if(!bUpdate) + Clear(); + + // load data from file + icpf::config cfg(icpf::config::eIni); + const uint_t uiLangName = cfg.register_string(_T("Info/Lang Name"), _t("")); + const uint_t uiLangCode = cfg.register_signed_num(_T("Info/Lang Code"), 0, 0, 0xffff); + const uint_t uiBaseLanguage = cfg.register_string(_T("Info/Base Language"), _T("")); + const uint_t uiFontFace = cfg.register_string(_T("Info/Font Face"), _T("")); + const uint_t uiCharset = cfg.register_signed_num(_T("Info/Charset"), 0, 0, 0xffff); + const uint_t uiSize = cfg.register_signed_num(_T("Info/Size"), 0, 0, 0xffff); + const uint_t uiRTL = cfg.register_bool(_T("Info/RTL reading order"), false); + const uint_t uiHelpName = cfg.register_string(_T("Info/Help name"), _T("")); + const uint_t uiAuthor = cfg.register_string(_T("Info/Author"), _T("")); + const uint_t uiVersion = cfg.register_string(_T("Info/Version"), _T("")); + cfg.read(pszFile); + + TCHAR szData[512]; + if(!bUpdate) + { + const tchar_t* psz = cfg.get_string(uiLangName); + if(!psz || psz[0] == _t('\0')) + return false; + SetLangName(psz); + + ll_t ll = cfg.get_signed_num(uiLangCode); + if(ll == 0) + return false; + SetLangCode((WORD)ll); + + psz = cfg.get_string(uiBaseLanguage); + SetBaseFile(psz); + + psz = cfg.get_string(uiFontFace); + if(!psz || psz[0] == _t('\0')) + return false; + SetFontFace(psz); + + ll = cfg.get_signed_num(uiCharset); + if(ll == 0) + return false; + SetCharset((BYTE)ll); + + ll = cfg.get_signed_num(uiSize); + if(ll == 0) + return false; + SetPointSize((WORD)ll); + + SetDirection(cfg.get_bool(uiRTL)); + + psz = cfg.get_string(uiHelpName); + if(!psz || psz[0] == _t('\0')) + return false; + SetHelpName(psz); + + psz = cfg.get_string(uiAuthor); + if(!psz || psz[0] == _t('\0')) + return false; + SetAuthor(psz); + + psz = cfg.get_string(uiVersion); + if(!psz || psz[0] == _t('\0')) + return false; + SetVersion(psz); + } + + m_bUpdating = bUpdate; + m_uiSectionID = 0; + if(!cfg.enum_properties(_t("*"), EnumAttributesCallback, this)) + { + m_bUpdating = false; + return false; + } + m_bUpdating = false; + + if(!bUpdate) + { + // remember the filename + SetFilename(pszFile); + + // establish path to the base file + if (_tcslen(GetBaseFile()) != 0) + { + const TCHAR* pszName=_tcsrchr(pszFile, _T('\\')); + if (pszName) + { + _tcsncpy(szData, pszFile, pszName-pszFile+1); + _tcscpy(szData+(pszName-pszFile+1), GetBaseFile()); + TRACE(_t("Base (update) path=%s\n"), szData); + ReadTranslation(szData, true); + } + } + } + + return true; + } + catch(...) + { + return false; + } +} + +PCTSTR CLangData::GetString(WORD wHiID, WORD wLoID) +{ + strings_map::iterator it=m_mStrings.find((wHiID << 16) | wLoID); + if (it != m_mStrings.end()) + return (*it).second; + else + return EMPTY_STRING; +} + +void CLangData::SetFilename(PCTSTR psz) +{ + if (m_pszFilename) + delete [] m_pszFilename; + + // copy + m_pszFilename=new TCHAR[_tcslen(psz)+1]; + _tcscpy(m_pszFilename, psz); +} + +PCTSTR CLangData::GetFilename(bool bFullPath) const +{ + if (bFullPath) + return m_pszFilename; + else + { + TCHAR *pszFnd=_tcsrchr(m_pszFilename, _T('\\')); + if (pszFnd) + return pszFnd+1; + else + return m_pszFilename; + } +} + +void CLangData::SetFnameData(PTSTR *ppszDst, PCTSTR pszSrc) +{ + if (*ppszDst) + delete [] (*ppszDst); + const TCHAR* pszLast=NULL; + if ( (pszLast=_tcsrchr(pszSrc, _T('\\'))) != NULL) + pszLast++; + else + pszLast=pszSrc; + + // copy + *ppszDst=new TCHAR[_tcslen(pszLast)+1]; + _tcscpy(*ppszDst, pszLast); +} + +// requires the param with ending '\\' +void CResourceManager::Scan(LPCTSTR pszFolder, vector* pvData) +{ + assert(pszFolder); + assert(pvData); + if(!pszFolder || !pvData) + return; + + TCHAR szPath[_MAX_PATH]; + _tcscpy(szPath, pszFolder); + _tcscat(szPath, _T("*.lng")); + + WIN32_FIND_DATA wfd; + HANDLE hFind=::FindFirstFile(szPath, &wfd); + BOOL bFound=TRUE; + CLangData ld; + while (bFound && hFind != INVALID_HANDLE_VALUE) + { + if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + _tcscpy(szPath, pszFolder); + _tcscat(szPath, wfd.cFileName); + if (ld.ReadInfo(szPath)) + pvData->push_back(ld); + } + + bFound=::FindNextFile(hFind, &wfd); + } + + if (hFind != INVALID_HANDLE_VALUE) + ::FindClose(hFind); +} + +bool CResourceManager::SetLanguage(PCTSTR pszPath) +{ + EnterCriticalSection(&m_cs); + WORD wOldLang=m_ld.GetLangCode(); + bool bRet=m_ld.ReadTranslation(pszPath); + WORD wNewLang=m_ld.GetLangCode(); + LeaveCriticalSection(&m_cs); + if (!bRet) + return false; + + // update registered dialog boxes + list::iterator it=m_lhDialogs.begin(); + while (it != m_lhDialogs.end()) + { + if (::IsWindow((*it)->m_hWnd)) + (*it)->PostMessage(WM_RMNOTIFY, RMNT_LANGCHANGE, (LPARAM)(wOldLang << 16 | wNewLang)); + it++; + } + + // send the notification stuff to the others + if (m_pfnCallback) + (*m_pfnCallback)(ROT_EVERYWHERE, WM_RMNOTIFY, RMNT_LANGCHANGE, (LPARAM)(wOldLang << 16 | wNewLang)); + + return bRet; +} + +HGLOBAL CResourceManager::LoadResource(LPCTSTR pszType, LPCTSTR pszName) +{ + EnterCriticalSection(&m_cs); + + // find resource + HGLOBAL hRet=NULL; + HRSRC hr=FindResource(m_hRes, pszName, pszType); + if (hr) + hRet=::LoadResource(m_hRes, hr); + + LeaveCriticalSection(&m_cs); + return hRet; +} + +HACCEL CResourceManager::LoadAccelerators(LPCTSTR pszName) +{ + return ::LoadAccelerators(m_hRes, pszName); +} + +HBITMAP CResourceManager::LoadBitmap(LPCTSTR pszName) +{ + return ::LoadBitmap(m_hRes, pszName); +} + +HCURSOR CResourceManager::LoadCursor(LPCTSTR pszName) +{ + return ::LoadCursor(m_hRes, pszName); +} + +HICON CResourceManager::LoadIcon(LPCTSTR pszName) +{ + return ::LoadIcon(m_hRes, pszName); +} + +void CResourceManager::UpdateMenu(HMENU hMenu, WORD wMenuID) +{ + // change the strings inside the menu to the one from txt res file + int iCount=::GetMenuItemCount(hMenu); + MENUITEMINFO mif; + WORD wLoID; + TCHAR szItem[1024]; + memset(szItem, 0, 1024); + for (int i=0;i +#include +#include +#include "../libicpf/gen_types.h" + +using namespace std; + +BEGIN_ICTRANSLATE_NAMESPACE + +///////////////////////////////////////////////////////////////////////// +// types of notifications +// RMNT_LANGCHANGE, LPARAM - HIWORD - old language, LOWORD - new language +#define RMNT_LANGCHANGE 0x0001 + +typedef void(*PFNNOTIFYCALLBACK)(ull_t, uint_t, WPARAM, LPARAM); + +/////////////////////////////////////////////////////////// +// language description structure +typedef map strings_map; + +class LIBICTRANSLATE_API CLangData +{ +public: +// construction/destruction + CLangData(); + ~CLangData(); + CLangData(const CLangData& ld); + + void Clear(); +// operations + bool ReadInfo(PCTSTR pszFile); + bool ReadTranslation(PCTSTR pszFile, bool bUpdate=false); + + PCTSTR GetString(WORD wHiID, WORD wLoID); + +// attributes + void SetFilename(PCTSTR psz); + PCTSTR GetFilename(bool bFullPath) const; + + void SetLangName(PCTSTR psz) { if (m_pszLngName) delete [] m_pszLngName; m_pszLngName=new TCHAR[_tcslen(psz)+1]; _tcscpy(m_pszLngName, psz); }; + PCTSTR GetLangName() const { return m_pszLngName; }; + + void SetBaseFile(PCTSTR psz) { SetFnameData(&m_pszBaseFile, psz); }; + PCTSTR GetBaseFile() const { return m_pszBaseFile; }; + + void SetLangCode(WORD wLang) { m_wLangCode=wLang; }; + WORD GetLangCode() const { return m_wLangCode; }; + + void SetFontFace(PCTSTR psz) { if (m_pszFontFace) delete [] m_pszFontFace; m_pszFontFace=new TCHAR[_tcslen(psz)+1]; _tcscpy(m_pszFontFace, psz); }; + PCTSTR GetFontFace() const { return m_pszFontFace; }; + + void SetCharset(BYTE byChar) { m_byCharset=byChar; }; + BYTE GetCharset() const { return m_byCharset; }; + + void SetPointSize(WORD wSize) { m_wPointSize=wSize; }; + WORD GetPointSize() const { return m_wPointSize; }; + + void SetDirection(bool brtl) { m_bRTL=brtl; }; + bool GetDirection() const { return m_bRTL; }; + + void SetHelpName(PCTSTR psz) { SetFnameData(&m_pszHelpName, psz); }; + PCTSTR GetHelpName() const { return m_pszHelpName; }; + + void SetAuthor(PCTSTR psz) { if (m_pszAuthor) delete [] m_pszAuthor; m_pszAuthor=new TCHAR[_tcslen(psz)+1]; _tcscpy(m_pszAuthor, psz); }; + PCTSTR GetAuthor() const { return m_pszAuthor; }; + + void SetVersion(PCTSTR psz) { if (m_pszVersion) delete [] m_pszVersion; m_pszVersion=new TCHAR[_tcslen(psz)+1]; _tcscpy(m_pszVersion, psz); }; + PCTSTR GetVersion() const { return m_pszVersion; }; + +// void SetStringData(PCTSTR psz, size_t tCnt) { tCount=tCnt; if (pszStrings) delete [] pszStrings; if (tCount > 0) { pszStrings=new TCHAR[tCnt]; memcpy(pszStrings, psz, tCnt*sizeof(TCHAR)); } }; + +protected: + void SetFnameData(PTSTR *ppszDst, PCTSTR pszSrc); + static void EnumAttributesCallback(bool bGroup, const tchar_t* pszName, const tchar_t* pszValue, ptr_t pData); + static void UnescapeString(tchar_t* pszData); + +public: + TCHAR *m_pszFilename; // file name of the language data (with path) + TCHAR *m_pszLngName; // name of the language (ie. Chinese (PRC)) + TCHAR *m_pszBaseFile; // file with base language data (wo path) + TCHAR *m_pszFontFace; // face name of the font that will be used in dialogs + WORD m_wLangCode; // language code + WORD m_wPointSize; // font point size + TCHAR *m_pszHelpName; // help name (wo the directory) for this language + TCHAR *m_pszAuthor; // author name + TCHAR *m_pszVersion; // version of this file + BYTE m_byCharset; // charset for use with the font + bool m_bRTL; // does the language require right-to-left reading order ? + + // strings (for controls in dialog boxes the ID contains hi:dlg ID, lo:ctrl ID, for strings hi part is 0) + strings_map m_mStrings; // maps string ID to the offset in pszStrings + +private: + uint_t m_uiSectionID; ///< ID of the currently processed section + bool m_bUpdating; ///< Are we updating the language with base language ? +}; + +///////////////////////////////////////////////////////////////////////////////////// + +class LIBICTRANSLATE_API CResourceManager +{ +public: + CResourceManager() { m_pfnCallback=NULL; m_hRes=NULL; InitializeCriticalSection(&m_cs); }; + ~CResourceManager() { DeleteCriticalSection(&m_cs); }; + + void Init(HMODULE hrc) { m_hRes=hrc; }; + + void SetCallback(PFNNOTIFYCALLBACK pfn) { m_pfnCallback=pfn; }; + + void Scan(LPCTSTR pszFolder, vector* pvData); + bool SetLanguage(PCTSTR pszPath); + + // loading functions + HGLOBAL LoadResource(LPCTSTR pszType, LPCTSTR pszName); + HACCEL LoadAccelerators(LPCTSTR pszName); + HBITMAP LoadBitmap(LPCTSTR pszName); + HCURSOR LoadCursor(LPCTSTR pszName); + HICON LoadIcon(LPCTSTR pszName); + HANDLE LoadImage(LPCTSTR lpszName, UINT uType, int cxDesired, int cyDesired, UINT fuLoad); + HMENU LoadMenu(LPCTSTR pszName); + LPDLGTEMPLATE LoadDialog(LPCTSTR pszName); + + PCTSTR LoadString(UINT uiID); + PCTSTR LoadString(WORD wGroup, WORD wID); + PTSTR LoadStringCopy(UINT uiID, PTSTR pszStr, UINT uiMax); + + // res updating functions + void UpdateMenu(HMENU hMenu, WORD wMenuID); + +public: + CLangData m_ld; // current language data + list m_lhDialogs; // currently displayed dialog boxes (even hidden) + + HMODULE m_hRes; + PFNNOTIFYCALLBACK m_pfnCallback; +// UINT m_uiMsg; + CRITICAL_SECTION m_cs; +}; + +END_ICTRANSLATE_NAMESPACE + +#endif \ No newline at end of file Index: src/libictranslate/dllmain.cpp =================================================================== diff -u --- src/libictranslate/dllmain.cpp (revision 0) +++ src/libictranslate/dllmain.cpp (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,51 @@ +// dllmain.cpp : Defines the initialization routines for the DLL. +// + +#include "stdafx.h" +#include +#include + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +static AFX_EXTENSION_MODULE libictranslateDLL = { NULL, NULL }; + +extern "C" int APIENTRY +DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) +{ + // Remove this if you use lpReserved + UNREFERENCED_PARAMETER(lpReserved); + + if (dwReason == DLL_PROCESS_ATTACH) + { + TRACE0("libictranslate.DLL Initializing!\n"); + + // Extension DLL one-time initialization + if (!AfxInitExtensionModule(libictranslateDLL, hInstance)) + return 0; + + // Insert this DLL into the resource chain + // NOTE: If this Extension DLL is being implicitly linked to by + // an MFC Regular DLL (such as an ActiveX Control) + // instead of an MFC application, then you will want to + // remove this line from DllMain and put it in a separate + // function exported from this Extension DLL. The Regular DLL + // that uses this Extension DLL should then explicitly call that + // function to initialize this Extension DLL. Otherwise, + // the CDynLinkLibrary object will not be attached to the + // Regular DLL's resource chain, and serious problems will + // result. + + new CDynLinkLibrary(libictranslateDLL); + + } + else if (dwReason == DLL_PROCESS_DETACH) + { + TRACE0("libictranslate.DLL Terminating!\n"); + + // Terminate the library before destructors are called + AfxTermExtensionModule(libictranslateDLL); + } + return 1; // ok +} Index: src/libictranslate/libictranslate.cpp =================================================================== diff -u --- src/libictranslate/libictranslate.cpp (revision 0) +++ src/libictranslate/libictranslate.cpp (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,10 @@ +// libictranslate.cpp : Defines the initialization routines for the DLL. +// + +#include "stdafx.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + Index: src/libictranslate/libictranslate.def =================================================================== diff -u --- src/libictranslate/libictranslate.def (revision 0) +++ src/libictranslate/libictranslate.def (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,6 @@ +; libictranslate.def : Declares the module parameters for the DLL. + +LIBRARY "libictranslate" + +EXPORTS + ; Explicit exports can go here Index: src/libictranslate/libictranslate.h =================================================================== diff -u --- src/libictranslate/libictranslate.h (revision 0) +++ src/libictranslate/libictranslate.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,38 @@ +#ifndef __LIBICTRANSLATE_H__ +#define __LIBICTRANSLATE_H__ + +// import/export macros +#if defined(_WIN32) || defined(_WIN64) + #ifdef LIBICTRANSLATE_EXPORTS + /** \brief Import/export macros + * + * These macros are being used throughout the whole code. They are meant to + * export symbols (if the LIBICTRANSLATE_EXPORTS is defined) from this library + * (also for importing (when LIBICTRANSLATE_EXPORTS macro is undefined) in other apps). + */ + #define LIBICTRANSLATE_API __declspec(dllexport) + #else + /** \brief Import/export macros + * + * These macros are being used throughout the whole code. They are meant to + * export symbols (if the LIBICTRANSLATE_EXPORTS is defined) from this library + * (also for importing (when LIBICTRANSLATE_EXPORTS macro is undefined) in other apps). + */ + #define LIBICTRANSLATE_API __declspec(dllimport) + #endif +#else + /** \brief Import/export macros + * + * These macros are being used throughout the whole code. They are meant to + * export symbols (if the LIBICTRANSLATE_EXPORTS is defined) from this library + * (also for importing (when LIBICTRANSLATE_EXPORTS macro is undefined) in other apps). + */ + #define LIBICTRANSLATE_API +#endif + +/// Begins ch namespace +#define BEGIN_ICTRANSLATE_NAMESPACE namespace ictranslate { +/// Ends ch namespace +#define END_ICTRANSLATE_NAMESPACE } + +#endif Index: src/libictranslate/libictranslate.rc =================================================================== diff -u --- src/libictranslate/libictranslate.rc (revision 0) +++ src/libictranslate/libictranslate.rc (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,84 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#ifndef APSTUDIO_INVOKED +#include "targetver.h" +#endif +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#ifndef APSTUDIO_INVOKED\r\n" + "#include ""targetver.h""\r\n" + "#endif\r\n" + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1250)\r\n" + "#include ""res\\libictranslate.rc2"" // non-Microsoft Visual C++ edited resources\r\n" +#ifndef _AFXDLL + "#include ""afxres.rc"" // Standard components\r\n" +#endif + "#endif\r\n" + "\0" +END + +///////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1250) + +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1250) +#include "res\\libictranslate.rc2" // non-Microsoft Visual C++ edited resources +#ifndef _AFXDLL +#include "afxres.rc" // Standard components +#endif +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + Index: src/libictranslate/libictranslate.vc90.vcproj =================================================================== diff -u --- src/libictranslate/libictranslate.vc90.vcproj (revision 0) +++ src/libictranslate/libictranslate.vc90.vcproj (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,521 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: src/libictranslate/messages.h =================================================================== diff -u --- src/libictranslate/messages.h (revision 0) +++ src/libictranslate/messages.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,20 @@ +#ifndef __MESSAGES_H__ +#define __MESSAGES_H__ + +// messages used by the app framework's modules +#define WM_TRAYNOTIFY (WM_USER+0) +#define WM_CFGNOTIFY (WM_USER+1) +#define WM_RMNOTIFY (WM_USER+2) + +// message routing +// types of routing +// sends a message everywhere it could be sent (hwnds, registered modules, ...) +#define ROT_EVERYWHERE 0x0000000000000000 +// sends a message to all hwnds in an app +#define ROT_HWNDS 0x0100000000000000 +// sends a message to all registered modules +#define ROT_REGISTERED 0x0200000000000000 +// sends a message to one exact module +#define ROT_EXACT 0x0300000000000000 + +#endif Index: src/libictranslate/res/libictranslate.rc2 =================================================================== diff -u --- src/libictranslate/res/libictranslate.rc2 (revision 0) +++ src/libictranslate/res/libictranslate.rc2 (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,50 @@ +// +// libictranslate.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "TODO: " + VALUE "FileDescription", "TODO: " + VALUE "FileVersion", "1.0.0.1" + VALUE "InternalName", "libictranslate.dll" + VALUE "LegalCopyright", "TODO: (c) . All rights reserved." + VALUE "OriginalFilename","libictranslate.dll" + VALUE "ProductName", "TODO: " + VALUE "ProductVersion", "1.0.0.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END + +///////////////////////////////////////////////////////////////////////////// Index: src/libictranslate/resource.h =================================================================== diff -u --- src/libictranslate/resource.h (revision 0) +++ src/libictranslate/resource.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by libictranslate.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NEXT_RESOURCE_VALUE 3000 +#define _APS_NEXT_CONTROL_VALUE 3000 +#define _APS_NEXT_SYMED_VALUE 3000 +#define _APS_NEXT_COMMAND_VALUE 32771 +#endif +#endif Index: src/libictranslate/stdafx.cpp =================================================================== diff -u --- src/libictranslate/stdafx.cpp (revision 0) +++ src/libictranslate/stdafx.cpp (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,7 @@ +// stdafx.cpp : source file that includes just the standard includes +// libictranslate.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + Index: src/libictranslate/stdafx.h =================================================================== diff -u --- src/libictranslate/stdafx.h (revision 0) +++ src/libictranslate/stdafx.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,39 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently + +#pragma once + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +#include "targetver.h" + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +#include // MFC core and standard components +#include // MFC extensions + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC OLE classes +#include // MFC OLE dialog classes +#include // MFC Automation classes +#endif // _AFX_NO_OLE_SUPPORT + +#ifndef _AFX_NO_DB_SUPPORT +#include // MFC ODBC database classes +#endif // _AFX_NO_DB_SUPPORT + +#ifndef _AFX_NO_DAO_SUPPORT +#include // MFC DAO database classes +#endif // _AFX_NO_DAO_SUPPORT + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC support for Internet Explorer 4 Common Controls +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + + Index: src/libictranslate/targetver.h =================================================================== diff -u --- src/libictranslate/targetver.h (revision 0) +++ src/libictranslate/targetver.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,26 @@ + +#pragma once + +// The following macros define the minimum required platform. The minimum required platform +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and +// including the version specified. + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. +#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. +#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. +#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. +#endif + Index: src/rc2lng/rc2lng.cpp =================================================================== diff -u --- src/rc2lng/rc2lng.cpp (revision 0) +++ src/rc2lng/rc2lng.cpp (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,662 @@ +// CHExe2Lng.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" +#include "rc2lng.h" +#include "conio.h" + +#pragma warning(disable : 4786) + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +CWinApp theApp; + +int GetCommasCount(const CString& str) +{ + int cnt=0; + bool bInside=false; + for (int i=0;i* pIDs) +{ + try + { + CFile file(pszFile, CFile::modeRead); + CArchive ar(&file, CArchive::load); + CString str, str2; + while(ar.ReadString(str)) + { + if (str.Left(7) == _T("#define")) + { + str=str.Mid(8); + int iPos=str.FindOneOf(" \t"); + str2=str.Left(iPos); + str=str.Mid(iPos); + str.TrimLeft(_T(" \t")); + str.TrimRight(_T(" \t\r\n")); + + int iID; + if (str.Find("x") != -1) + { + // hex2dec + _stscanf(str, "%lx", &iID); + } + else + iID=_ttoi(str); + + pIDs->insert(map::value_type(str2, iID)); + } + } + + ar.Close(); + file.Close(); + + pIDs->insert(map::value_type(CString("IDOK"), 1)); + pIDs->insert(map::value_type(CString("IDCANCEL"), 2)); + } + catch(...) + { + return false; + } + +/* map::iterator it=pIDs->begin(); + while (it != pIDs->end()) + { + cout<<(PCTSTR)(CString)(it->first)<<" = "<<(UINT)(it->second)<* pvData) +{ + try + { + CFile file(pszFile, CFile::modeRead); + CArchive ar(&file, CArchive::load); + + CString str; + while (ar.ReadString(str)) + pvData->push_back(str); + + ar.Close(); + file.Close(); + } + catch(...) + { + return false; + } + return true; +} + +bool ReadRCFile(PCTSTR pszFile, vector *pv) +{ + try + { + CFile file(pszFile, CFile::modeRead); + CArchive ar(&file, CArchive::load); + + CString str; + while (ar.ReadString(str)) + pv->push_back(str); + + ar.Close(); + file.Close(); + } + catch(...) + { + return false; + } + return true; +} + +void ProcessMenu(vector* pinrc, vector::iterator *init, map* pids, vector* poutrc, vector* pol) +{ + CString str; + map::iterator mit; + for (;(*init) != pinrc->end();(*init)++) + { + str=**init; + str.TrimLeft(" "); + str.TrimRight(" "); + + // check for exit + if ( str == "END" ) + { + // add the line to the outrc wo changes + poutrc->push_back(**init); + return; + } + else if (str.Left(5) == "POPUP") // if that is the popup string - call the function once more + { + // add the line to the outrc with changes - replace string inside "" with P + str=**init; + + // processing menuitem - find the text + int iPos=str.Find("\"", 0); + CString strText; + if (iPos != -1) + { + strText=str.Mid(iPos+1); + int iPos2=strText.Find("\""); + if (iPos2 != -1) + strText=strText.Left(iPos2); + } + + // now find the | that separates the text from the pseudo-ID + int iBar=strText.ReverseFind(_T('|')); + if (iBar != -1) + { + // there is a text with an ID + CString strID=strText.Mid(iBar+1); + strText=strText.Left(iBar); + + // put the id and text in the translation file + // find the equiv for the id + mit=pids->find(strID); + CString out; + if (mit != pids->end()) + { + out.Format("%lu=%s", mit->second, strText); + pol->push_back(out); + + // put the found ID as output text + out.Format("\"%lu\"", mit->second); + str=str.Left(iPos)+out; + } + else + { + out.Format("%s=%s", strID, strText); + pol->push_back(out); + + // put the ID as output text + str=str.Left(iPos)+"\""+strID+"\""; + } + } + else + { + // no ID + str=str.Left(iPos)+"\"P\""; + } + + poutrc->push_back(str); + + (*init)++; + ProcessMenu(pinrc, init, pids, poutrc, pol); + } + else + { + // if the line has MENUITEM + if (str.Left(8) == "MENUITEM" && str.Right(9) != "SEPARATOR") + { + // restore original + str=**init; + + // check if there is any text after the comma + int iPos=str.Find(",", 0); + CString strTest=str.Mid(iPos); + strTest.TrimLeft(" ,\t\r\n"); + if (strTest.IsEmpty()) + { + (*init)++; + + CString tmp=**init; + tmp.Trim(" ,\t\r\n"); + str+=tmp; + } + + // processing menuitem - find the text + iPos=str.Find("\"", 0); + CString strText; + if (iPos != -1) + { + strText=str.Mid(iPos+1); + int iPos2=strText.Find("\""); + if (iPos2 != -1) + strText=strText.Left(iPos2); + } + + // find the ID + iPos=str.Find(",", 0); + CString strID; + if (iPos != -1) + { + strID=str.Mid(iPos+1); + int iPos2=strID.Find(",", 0); + if (iPos2 != -1) + strID=strID.Left(iPos2); + } + strID.TrimLeft(" \t"); + strID.TrimRight(" \t"); + + // find the equiv for the id + mit=pids->find(strID); + CString out; + if (mit != pids->end()) + { + out.Format("%lu=%s", mit->second, strText); + pol->push_back(out); + } + else + { + out.Format("%s=%s", strID, strText); + pol->push_back(out); + } +// AfxMessageBox(str); + out=str; +// out=**init; + out.Replace("\""+strText+"\"", "\"i\""); + poutrc->push_back(out); + } + else + poutrc->push_back(**init); + } + } +} + +void ProcessDialog(vector* pinrc, vector::iterator *init, map* pids, vector* poutrc, vector* pol) +{ + CString str; + map::iterator mit; + for (;(*init) != pinrc->end();(*init)++) + { + str=**init; + str.TrimLeft(" "); + str.TrimRight(" "); + + // check for exit + if ( str == "END" ) + { + // add the line to the outrc wo changes + poutrc->push_back(**init); + return; + } + else if ( str.Left(7) == "CAPTION" ) + { + // read the caption + CString strText=str.Mid(7); + strText.TrimLeft(" \t\""); + strText.TrimRight(" \t\""); + + pol->push_back("0="+strText); + + // save to rc wo title + str=**init; + str.Replace("\""+strText+"\"", "\"\""); + poutrc->push_back(str); + } + else if ( str.Left(5) == "LTEXT" || str.Left(5) == "CTEXT" || str.Left(5) == "RTEXT" || str.Left(13) == "DEFPUSHBUTTON" || str.Left(10) == "PUSHBUTTON" || str.Left(7) == "CONTROL" || str.Left(8) == "GROUPBOX" ) + { + // needed only 2 commas (outside the '\"') + if ( GetCommasCount(str) < 2 ) + str+=*((*init)+1); + + // the first thing after LTEXT(and other) is the caption + CString strText; + + if (str.Left(5) == "LTEXT" || str.Left(5) == "CTEXT" || str.Left(5) == "RTEXT") + strText=str.Mid(5); + else if (str.Left(13) == "DEFPUSHBUTTON") + strText=str.Mid(13); + else if (str.Left(10) == "PUSHBUTTON") + strText=str.Mid(10); + else if (str.Left(7) == "CONTROL") + strText=str.Mid(7); + else if (str.Left(8) == "GROUPBOX") + strText=str.Mid(8); + + strText=strText.Mid(strText.Find("\"")+1); + int iPos=strText.Find("\"", 0); + if (iPos != -1) + strText=strText.Left(iPos); + + // after the first comma there is an ID + iPos=str.Find(",", 0); + CString strID; + if (iPos != -1) + { + strID=str.Mid(iPos+1); + iPos=strID.Find(",", 0); + if (iPos != -1) + strID=strID.Left(iPos); + strID.TrimLeft(" \t"); + strID.TrimRight(" \t"); + } + + // find id + mit=pids->find( strID ); + CString out; + if (mit != pids->end()) + { + // id found + if (mit->second != 0) + { + out.Format("%lu=%s", mit->second, strText); + pol->push_back(out); + } + } + else + { + out.Format("%s=%s", strID, strText); + pol->push_back(out); + } + + // now add the data to rc + str=**init; + str.Replace("\""+strText+"\"", "\"\""); + + poutrc->push_back(str); + } + else + { + poutrc->push_back(**init); + } + } +} + +void ProcessStringTable(vector* pinrc, vector::iterator *init, map* pids, vector* poutrc, vector* ptab) +{ + map::iterator mit; + CString str; + for (;(*init) != pinrc->end();(*init)++) + { + str=**init; + str.TrimLeft(" "); + str.TrimRight(" "); + + if ( str == "END" ) + return; + else if ( str != "BEGIN" ) + { + // the first stuff is ID, the second is text + int iPos=str.Find("\"", 0); + if (iPos == -1) + { + (*init)++; + str+=**init; + iPos=str.Find("\"", 0); + } + + if (iPos != -1) + { + CString strID=str.Left(iPos); + strID.TrimRight(" \"\t\n\r"); + + CString strText=str.Mid(iPos+1); + strText.Replace("\"\"", "\""); + + strText=strText.Left(strText.ReverseFind('\"')); + + mit=pids->find(strID); + CString out; + if (mit!= pids->end()) + out.Format("%lu=%s", mit->second, strText); + else + out.Format("%lu=%s", strID, strText); + ptab->push_back(out); + str=**init; + str.Replace("\""+strText+"\"", "\"\""); + } + } + } +} +CString ProcessLine(PCTSTR psz) +{ + CString str=psz; + str.Replace("\r", "\\r"); + str.Replace("\n", "\\n"); + str.Replace("\t", "\\t"); + + return str; +} + +bool ProcessRCFile(PCTSTR pszRCPath, vector* pinrc, map* pids, vector* poutrc, vector* pol) +{ + int iPos; + map::iterator mit; + CString strData; + vector vStrTable; + for (vector::iterator it=pinrc->begin();it != pinrc->end();it++) + { + if ( (iPos=it->Find(" MENU ")) != -1 ) + { + // retrieve the identifier and add it to the outlng + mit=pids->find( it->Left(iPos) ); + if (mit != pids->end()) + strData.Format("\r\n# Menu - %s\r\n[%lu]", it->Left(iPos), mit->second); + else + strData.Format("\r\n# Menu - %s\r\n[%s]", it->Left(iPos), it->Left(iPos)); + + pol->push_back(strData); + + // add the line to the output rc with no change + poutrc->push_back(*it); + + // begin enumerating items + it++; + ProcessMenu(pinrc, &it, pids, poutrc, pol); + } + else if ( (iPos=it->Find(" DIALOGEX ")) != -1) + { + // find the ID of a dialog box + mit=pids->find( it->Left(iPos) ); + if (mit != pids->end()) + strData.Format("\r\n# Dialog box - %s\r\n[%lu]", it->Left(iPos), mit->second); + else + strData.Format("\r\n# Dialog box - %s\r\n[%s]", it->Left(iPos), it->Left(iPos)); + + pol->push_back(strData); + + // add the line to the output rc with no change + poutrc->push_back(*it); + + // begin processing dialog template + it++; + ProcessDialog(pinrc, &it, pids, poutrc, pol); + } + else if ( (iPos=it->Find("STRINGTABLE ")) != -1) + { + // begin of the string table + it++; + ProcessStringTable(pinrc, &it, pids, poutrc, &vStrTable); + } + else if ( (iPos=it->Find(" 25 ")) != -1) + { //pszRCPath + CString strID=it->Left(iPos); + strID.TrimLeft(" \t\n\r\""); + strID.TrimRight(" \t\n\r\""); + + // file name + iPos=it->Find("\""); + CString strName=it->Mid(iPos+1); + strName.TrimRight(" \t\n\r\""); + strName.Replace("\\\\", "\\"); + + // concat the path + CString strPath=pszRCPath; + strPath=strPath.Left(strPath.ReverseFind('\\')+1); + + // read the file + TCHAR szData[16384]; + CFile file(strPath+strName, CFile::modeRead); + file.Read(szData, 16384); + file.Close(); + CString out=ProcessLine(szData); + + // add to lang + mit=pids->find(strID); + CString strLng; + if (mit!=pids->end()) + strLng.Format("%lu=%s", mit->second, out); + else + strLng.Format("%s=%s", strID, out); + vStrTable.push_back(strLng); + } + else + { + poutrc->push_back(*it); + } + } + + if (vStrTable.size() > 0) + { + // write header + pol->push_back(CString("\r\n# String table\r\n[0]")); + + // copy data to the out lng + for (vector::iterator it=vStrTable.begin();it!=vStrTable.end();it++) + pol->push_back(*it); + } + + return true; +} + +bool WriteFiles(vector* prc, PCTSTR pszRCFile, vector* plng, PCTSTR pszLngFile) +{ + vector::iterator it; + try + { + CFile file1(pszRCFile, CFile::modeWrite | CFile::modeCreate); + CArchive ar1(&file1, CArchive::store); + + for (it=prc->begin();it != prc->end();it++) + ar1.WriteString((*it)+_T("\r\n")); + + ar1.Close(); + file1.Close(); + + CFile file2(pszLngFile, CFile::modeWrite | CFile::modeCreate); + CArchive ar2(&file2, CArchive::store); + + for (it=plng->begin();it != plng->end();it++) + ar2.WriteString((*it)+_T("\r\n")); + + ar2.Close(); + file2.Close(); + } + catch(...) + { + return false; + } + return true; +} + +struct CmpStr : public binary_function +{ + bool operator() (const CString& _Left, const CString& _Right) const + { + CString l=_Left.Left(_Left.Find("=")); + CString r=_Right.Left(_Right.Find("=")); + + return (_ttoi(l) <= _ttoi(r)); + } +}; + +void SortItems(vector* pv, int iHdrCnt) +{ + // find the begin and the end of section + vector::iterator st=pv->begin()+iHdrCnt, en; + while (st != pv->end()) + { + for (;st != pv->end();st++) + { + // find section beginning + if (st->Left(3) == "\r\n#" && st->Find("\r\n[") != -1) + { + st++; + break; + } + } + if (st != pv->end()) + { + en=st+1; + for (;en != pv->end();en++) + { + if (en->Left(3) == "\r\n#" && en->Find("\r\n[") != -1) + break; + } + + sort(st, en, CmpStr()); + st=en; + } + } +} + +int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) +{ + // initialize MFC and print and error on failure + if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) + { + cerr << _T("Fatal Error: MFC initialization failed") << endl; + return 1; + } + + // usage - chexe2lng infile.rc resource.h inheader.lng outfile.rc outfile.lng + if (argc < 6) + { + cerr<<_T("Fatal Error: Incorrect numer of params") << endl; + cerr << _T("Usage: infile.rc inheader.lng outfile.rc outfile.lng resource.h resource2.h") << endl; + return 2; + } + + // open the resource.h file and interprete it + map mID; + for (int i=5;i vOutLang; + if (!UpdateLngHeader(argv[2], &vOutLang)) + { + cerr<<"Fatal Error: Cannot read lang header file"< vRCIn, vRCOut; + if (!ReadRCFile(argv[1], &vRCIn)) + { + cerr<<"Fatal Error: Cannot read source RC file"< 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "resource.h" +#include +#include +#include +using namespace std; + +#pragma warning(disable : 4786) + +#endif // !defined(AFX_CHEXE2LNG_H__71D002AA_5384_43E2_BEA2_CF86F1DB9C20__INCLUDED_) Index: src/rc2lng/rc2lng.rc =================================================================== diff -u --- src/rc2lng/rc2lng.rc (revision 0) +++ src/rc2lng/rc2lng.rc (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,132 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Polish resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PLK) +#ifdef _WIN32 +LANGUAGE LANG_POLISH, SUBLANG_DEFAULT +#pragma code_page(1250) +#endif //_WIN32 + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "041504b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Kamufleon\0" + VALUE "FileDescription", "CHExe2Lng\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "CHExe2Lng\0" + VALUE "LegalCopyright", "Copyright � 2003\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "CHExe2Lng.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Kamufleon CHExe2Lng\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x415, 1200 + END +END + +#endif // !_MAC + +#endif // Polish resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_HELLO "Hello from MFC!" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + Index: src/rc2lng/rc2lng.vc90.vcproj =================================================================== diff -u --- src/rc2lng/rc2lng.vc90.vcproj (revision 0) +++ src/rc2lng/rc2lng.vc90.vcproj (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,506 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: src/rc2lng/resource.h =================================================================== diff -u --- src/rc2lng/resource.h (revision 0) +++ src/rc2lng/resource.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by CHExe2Lng.rc +// +#define IDS_HELLO 1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif Index: src/rc2lng/stdafx.cpp =================================================================== diff -u --- src/rc2lng/stdafx.cpp (revision 0) +++ src/rc2lng/stdafx.cpp (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// CHExe2Lng.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file Index: src/rc2lng/stdafx.h =================================================================== diff -u --- src/rc2lng/stdafx.h (revision 0) +++ src/rc2lng/stdafx.h (revision bee51aca3d5d9b67ecac4f528a3203738cc63455) @@ -0,0 +1,32 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__C4BBF6E4_ACB3_44C7_97B7_293263788195__INCLUDED_) +#define AFX_STDAFX_H__C4BBF6E4_ACB3_44C7_97B7_293263788195__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#pragma warning(disable : 4786) + +#include +#include // MFC core and standard components +#include // MFC extensions +#include // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__C4BBF6E4_ACB3_44C7_97B7_293263788195__INCLUDED_)