OSDN Git Service

Add color setting
[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 #include "CmdLineParser.h"\r
13 \r
14 #ifdef _DEBUG\r
15 #define new DEBUG_NEW\r
16 #endif\r
17 \r
18 \r
19 // CTortoiseGitBlameApp\r
20 \r
21 BEGIN_MESSAGE_MAP(CTortoiseGitBlameApp, CWinAppEx)\r
22         ON_COMMAND(ID_APP_ABOUT, &CTortoiseGitBlameApp::OnAppAbout)\r
23         // Standard file based document commands\r
24         ON_COMMAND(ID_FILE_NEW, &CWinAppEx::OnFileNew)\r
25         ON_COMMAND(ID_FILE_OPEN, &CWinAppEx::OnFileOpen)\r
26         // Standard print setup command\r
27         ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinAppEx::OnFilePrintSetup)\r
28 END_MESSAGE_MAP()\r
29 \r
30 \r
31 // CTortoiseGitBlameApp construction\r
32 \r
33 CTortoiseGitBlameApp::CTortoiseGitBlameApp()\r
34 {\r
35         EnableHtmlHelp();\r
36 \r
37 \r
38         m_bHiColorIcons = TRUE;\r
39 \r
40         // TODO: add construction code here,\r
41         // Place all significant initialization in InitInstance\r
42 }\r
43 \r
44 // The one and only CTortoiseGitBlameApp object\r
45 \r
46 CTortoiseGitBlameApp theApp;\r
47 \r
48 \r
49 // CTortoiseGitBlameApp initialization\r
50 \r
51 BOOL CTortoiseGitBlameApp::InitInstance()\r
52 {\r
53         // InitCommonControlsEx() is required on Windows XP if an application\r
54         // manifest specifies use of ComCtl32.dll version 6 or later to enable\r
55         // visual styles.  Otherwise, any window creation will fail.\r
56         INITCOMMONCONTROLSEX InitCtrls;\r
57         InitCtrls.dwSize = sizeof(InitCtrls);\r
58         // Set this to include all the common control classes you want to use\r
59         // in your application.\r
60         InitCtrls.dwICC = ICC_WIN95_CLASSES;\r
61         InitCommonControlsEx(&InitCtrls);\r
62 \r
63         CWinAppEx::InitInstance();\r
64 \r
65         // Initialize OLE libraries\r
66         if (!AfxOleInit())\r
67         {\r
68                 AfxMessageBox(IDP_OLE_INIT_FAILED);\r
69                 return FALSE;\r
70         }\r
71         AfxEnableControlContainer();\r
72         // Standard initialization\r
73         // If you are not using these features and wish to reduce the size\r
74         // of your final executable, you should remove from the following\r
75         // the specific initialization routines you do not need\r
76         // Change the registry key under which our settings are stored\r
77         // TODO: You should modify this string to be something appropriate\r
78         // such as the name of your company or organization\r
79         SetRegistryKey(_T("Local AppWizard-Generated Applications"));\r
80         LoadStdProfileSettings(4);  // Load standard INI file options (including MRU)\r
81 \r
82         InitContextMenuManager();\r
83 \r
84         InitKeyboardManager();\r
85 \r
86         InitTooltipManager();\r
87         CMFCToolTipInfo ttParams;\r
88         ttParams.m_bVislManagerTheme = TRUE;\r
89         theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,\r
90                 RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);\r
91 \r
92         // Register the application's document templates.  Document templates\r
93         //  serve as the connection between documents, frame windows and views\r
94         CSingleDocTemplate* pDocTemplate;\r
95         pDocTemplate = new CSingleDocTemplate(\r
96                 IDR_TORTOISE_GIT_BLAME_MAINFRAME,\r
97                 RUNTIME_CLASS(CTortoiseGitBlameDoc),\r
98                 RUNTIME_CLASS(CMainFrame),       // main SDI frame window\r
99                 RUNTIME_CLASS(CTortoiseGitBlameView));\r
100         if (!pDocTemplate)\r
101                 return FALSE;\r
102         AddDocTemplate(pDocTemplate);\r
103 \r
104 \r
105 \r
106         // Parse command line for standard shell commands, DDE, file open\r
107         CCommandLineInfo cmdInfo;\r
108         ParseCommandLine(cmdInfo);\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