OSDN Git Service

Merge from feature_merge branch. Build TortoiseMerge successfully.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseUDiff / TortoiseUDiff.cpp
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2003-2008 - Stefan Kueng\r
4 \r
5 // This program is free software; you can redistribute it and/or\r
6 // modify it under the terms of the GNU General Public License\r
7 // as published by the Free Software Foundation; either version 2\r
8 // of the License, or (at your option) any later version.\r
9 \r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 \r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, write to the Free Software Foundation,\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
18 //\r
19 #include "stdafx.h"\r
20 #include "TortoiseUDiff.h"\r
21 #include "MainWindow.h"\r
22 #include "CmdLineParser.h"\r
23 \r
24 #include <commctrl.h>\r
25 #pragma comment(lib, "comctl32.lib")\r
26 \r
27 \r
28 #pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")\r
29 \r
30 \r
31 int APIENTRY _tWinMain(HINSTANCE hInstance,\r
32                      HINSTANCE hPrevInstance,\r
33                      LPTSTR    lpCmdLine,\r
34                      int       nCmdShow)\r
35 {\r
36         UNREFERENCED_PARAMETER(hPrevInstance);\r
37         UNREFERENCED_PARAMETER(nCmdShow);\r
38 \r
39         MSG msg;\r
40         HACCEL hAccelTable;\r
41 \r
42         CCmdLineParser parser(lpCmdLine);\r
43 \r
44         if (parser.HasKey(_T("?")) || parser.HasKey(_T("help")) || !parser.HasKey(_T("patchfile")))\r
45         {\r
46                 TCHAR buf[1024];\r
47                 LoadString(hInstance, IDS_COMMANDLINEHELP, buf, sizeof(buf)/sizeof(TCHAR));\r
48                 MessageBox(NULL, buf, _T("TortoiseUDiff"), MB_ICONINFORMATION);\r
49                 return 0;\r
50         }\r
51 \r
52         INITCOMMONCONTROLSEX used = {\r
53                 sizeof(INITCOMMONCONTROLSEX),\r
54                 ICC_STANDARD_CLASSES | ICC_BAR_CLASSES\r
55         };\r
56         InitCommonControlsEx(&used);\r
57 \r
58 \r
59         if (::LoadLibrary(_T("SciLexer.DLL")) == NULL)\r
60                 return FALSE;\r
61         \r
62         CMainWindow mainWindow(hInstance);\r
63         if (parser.HasVal(_T("title")))\r
64                 mainWindow.SetTitle(parser.GetVal(_T("title")));\r
65         else\r
66                 mainWindow.SetTitle(parser.GetVal(_T("patchfile")));\r
67         if (mainWindow.RegisterAndCreateWindow())\r
68         {\r
69                 if (mainWindow.LoadFile(parser.GetVal(_T("patchfile"))))\r
70                 {\r
71                         ::ShowWindow(mainWindow.GetHWNDEdit(), SW_SHOW);\r
72                         ::SetFocus(mainWindow.GetHWNDEdit());\r
73 \r
74                         hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_TORTOISEUDIFF));\r
75 \r
76                         // Main message loop:\r
77                         while (GetMessage(&msg, NULL, 0, 0))\r
78                         {\r
79                                 if (!TranslateAccelerator(mainWindow, hAccelTable, &msg))\r
80                                 {\r
81                                         TranslateMessage(&msg);\r
82                                         DispatchMessage(&msg);\r
83                                 }\r
84                         }\r
85                         return (int) msg.wParam;\r
86                 }\r
87         }\r
88         return 0;\r
89 }\r
90 \r
91 \r
92 \r