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