Show GUI friendly diffstat after pull
[TortoiseGit.git] / src / TortoiseUDiff / TortoiseUDiff.cpp
blob8c8ddb04411c9967aa96eab094269f87315d78cc
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 MSG msg;
40 HACCEL hAccelTable;
42 CCmdLineParser parser(lpCmdLine);
44 if (parser.HasKey(_T("?")) || parser.HasKey(_T("help")) || !parser.HasKey(_T("patchfile")))
46 TCHAR buf[1024];
47 LoadString(hInstance, IDS_COMMANDLINEHELP, buf, sizeof(buf)/sizeof(TCHAR));
48 MessageBox(NULL, buf, _T("TortoiseUDiff"), MB_ICONINFORMATION);
49 return 0;
52 INITCOMMONCONTROLSEX used = {
53 sizeof(INITCOMMONCONTROLSEX),
54 ICC_STANDARD_CLASSES | ICC_BAR_CLASSES
56 InitCommonControlsEx(&used);
59 if (::LoadLibrary(_T("SciLexer.DLL")) == NULL)
60 return FALSE;
62 CMainWindow mainWindow(hInstance);
63 if (parser.HasVal(_T("title")))
64 mainWindow.SetTitle(parser.GetVal(_T("title")));
65 else
66 mainWindow.SetTitle(parser.GetVal(_T("patchfile")));
67 if (mainWindow.RegisterAndCreateWindow())
69 if (mainWindow.LoadFile(parser.GetVal(_T("patchfile"))))
71 ::ShowWindow(mainWindow.GetHWNDEdit(), SW_SHOW);
72 ::SetFocus(mainWindow.GetHWNDEdit());
74 hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_TORTOISEUDIFF));
76 // Main message loop:
77 while (GetMessage(&msg, NULL, 0, 0))
79 if (!TranslateAccelerator(mainWindow, hAccelTable, &msg))
81 TranslateMessage(&msg);
82 DispatchMessage(&msg);
85 return (int) msg.wParam;
88 return 0;