OSDN Git Service

Create TortoiseGitBlame
[tortoisegit/TortoiseGitJp.git] / src / TortoiseGitBlame / TortoiseGitBlame.cpp
1 \r
2 // TortoiseGitBlame.cpp : Defines the class behaviors for the application.\r
3 //\r
4 \r
5 #include "stdafx.h"\r
6 #include "afxwinappex.h"\r
7 #include "TortoiseGitBlame.h"\r
8 #include "MainFrm.h"\r
9 \r
10 #include "TortoiseGitBlameDoc.h"\r
11 #include "TortoiseGitBlameView.h"\r
12 \r
13 #ifdef _DEBUG\r
14 #define new DEBUG_NEW\r
15 #endif\r
16 \r
17 \r
18 // CTortoiseGitBlameApp\r
19 \r
20 BEGIN_MESSAGE_MAP(CTortoiseGitBlameApp, CWinAppEx)\r
21         ON_COMMAND(ID_APP_ABOUT, &CTortoiseGitBlameApp::OnAppAbout)\r
22         // Standard file based document commands\r
23         ON_COMMAND(ID_FILE_NEW, &CWinAppEx::OnFileNew)\r
24         ON_COMMAND(ID_FILE_OPEN, &CWinAppEx::OnFileOpen)\r
25         // Standard print setup command\r
26         ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinAppEx::OnFilePrintSetup)\r
27 END_MESSAGE_MAP()\r
28 \r
29 \r
30 // CTortoiseGitBlameApp construction\r
31 \r
32 CTortoiseGitBlameApp::CTortoiseGitBlameApp()\r
33 {\r
34         EnableHtmlHelp();\r
35 \r
36 \r
37         m_bHiColorIcons = TRUE;\r
38 \r
39         // TODO: add construction code here,\r
40         // Place all significant initialization in InitInstance\r
41 }\r
42 \r
43 // The one and only CTortoiseGitBlameApp object\r
44 \r
45 CTortoiseGitBlameApp theApp;\r
46 \r
47 \r
48 // CTortoiseGitBlameApp initialization\r
49 \r
50 BOOL CTortoiseGitBlameApp::InitInstance()\r
51 {\r
52         // InitCommonControlsEx() is required on Windows XP if an application\r
53         // manifest specifies use of ComCtl32.dll version 6 or later to enable\r
54         // visual styles.  Otherwise, any window creation will fail.\r
55         INITCOMMONCONTROLSEX InitCtrls;\r
56         InitCtrls.dwSize = sizeof(InitCtrls);\r
57         // Set this to include all the common control classes you want to use\r
58         // in your application.\r
59         InitCtrls.dwICC = ICC_WIN95_CLASSES;\r
60         InitCommonControlsEx(&InitCtrls);\r
61 \r
62         CWinAppEx::InitInstance();\r
63 \r
64         // Initialize OLE libraries\r
65         if (!AfxOleInit())\r
66         {\r
67                 AfxMessageBox(IDP_OLE_INIT_FAILED);\r
68                 return FALSE;\r
69         }\r
70         AfxEnableControlContainer();\r
71         // Standard initialization\r
72         // If you are not using these features and wish to reduce the size\r
73         // of your final executable, you should remove from the following\r
74         // the specific initialization routines you do not need\r
75         // Change the registry key under which our settings are stored\r
76         // TODO: You should modify this string to be something appropriate\r
77         // such as the name of your company or organization\r
78         SetRegistryKey(_T("Local AppWizard-Generated Applications"));\r
79         LoadStdProfileSettings(4);  // Load standard INI file options (including MRU)\r
80 \r
81         InitContextMenuManager();\r
82 \r
83         InitKeyboardManager();\r
84 \r
85         InitTooltipManager();\r
86         CMFCToolTipInfo ttParams;\r
87         ttParams.m_bVislManagerTheme = TRUE;\r
88         theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,\r
89                 RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);\r
90 \r
91         // Register the application's document templates.  Document templates\r
92         //  serve as the connection between documents, frame windows and views\r
93         CSingleDocTemplate* pDocTemplate;\r
94         pDocTemplate = new CSingleDocTemplate(\r
95                 IDR_MAINFRAME,\r
96                 RUNTIME_CLASS(CTortoiseGitBlameDoc),\r
97                 RUNTIME_CLASS(CMainFrame),       // main SDI frame window\r
98                 RUNTIME_CLASS(CTortoiseGitBlameView));\r
99         if (!pDocTemplate)\r
100                 return FALSE;\r
101         AddDocTemplate(pDocTemplate);\r
102 \r
103 \r
104 \r
105         // Parse command line for standard shell commands, DDE, file open\r
106         CCommandLineInfo cmdInfo;\r
107         ParseCommandLine(cmdInfo);\r
108 \r
109 \r
110         // Dispatch commands specified on the command line.  Will return FALSE if\r
111         // app was launched with /RegServer, /Register, /Unregserver or /Unregister.\r
112         if (!ProcessShellCommand(cmdInfo))\r
113                 return FALSE;\r
114 \r
115         // The one and only window has been initialized, so show and update it\r
116         m_pMainWnd->ShowWindow(SW_SHOW);\r
117         m_pMainWnd->UpdateWindow();\r
118         // call DragAcceptFiles only if there's a suffix\r
119         //  In an SDI app, this should occur after ProcessShellCommand\r
120         return TRUE;\r
121 }\r
122 \r
123 \r
124 \r
125 // CAboutDlg dialog used for App About\r
126 \r
127 class CAboutDlg : public CDialog\r
128 {\r
129 public:\r
130         CAboutDlg();\r
131 \r
132 // Dialog Data\r
133         enum { IDD = IDD_ABOUTBOX };\r
134 \r
135 protected:\r
136         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
137 \r
138 // Implementation\r
139 protected:\r
140         DECLARE_MESSAGE_MAP()\r
141 };\r
142 \r
143 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)\r
144 {\r
145 }\r
146 \r
147 void CAboutDlg::DoDataExchange(CDataExchange* pDX)\r
148 {\r
149         CDialog::DoDataExchange(pDX);\r
150 }\r
151 \r
152 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)\r
153 END_MESSAGE_MAP()\r
154 \r
155 // App command to run the dialog\r
156 void CTortoiseGitBlameApp::OnAppAbout()\r
157 {\r
158         CAboutDlg aboutDlg;\r
159         aboutDlg.DoModal();\r
160 }\r
161 \r
162 // CTortoiseGitBlameApp customization load/save methods\r
163 \r
164 void CTortoiseGitBlameApp::PreLoadState()\r
165 {\r
166         BOOL bNameValid;\r
167         CString strName;\r
168         bNameValid = strName.LoadString(IDS_EDIT_MENU);\r
169         ASSERT(bNameValid);\r
170         GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EDIT);\r
171 }\r
172 \r
173 void CTortoiseGitBlameApp::LoadCustomState()\r
174 {\r
175 }\r
176 \r
177 void CTortoiseGitBlameApp::SaveCustomState()\r
178 {\r
179 }\r
180 \r
181 // CTortoiseGitBlameApp message handlers\r
182 \r
183 \r
184 \r