2 // TortoiseGitBlame.cpp : Defines the class behaviors for the application.
\r
6 #include "afxwinappex.h"
\r
7 #include "TortoiseGitBlame.h"
\r
10 #include "TortoiseGitBlameDoc.h"
\r
11 #include "TortoiseGitBlameView.h"
\r
12 #include "CmdLineParser.h"
\r
15 #define new DEBUG_NEW
\r
19 // CTortoiseGitBlameApp
\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
31 // CTortoiseGitBlameApp construction
\r
33 CTortoiseGitBlameApp::CTortoiseGitBlameApp()
\r
38 m_bHiColorIcons = TRUE;
\r
40 // TODO: add construction code here,
\r
41 // Place all significant initialization in InitInstance
\r
44 // The one and only CTortoiseGitBlameApp object
\r
46 CTortoiseGitBlameApp theApp;
\r
49 // CTortoiseGitBlameApp initialization
\r
51 BOOL CTortoiseGitBlameApp::InitInstance()
\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
63 CWinAppEx::InitInstance();
\r
65 // Initialize OLE libraries
\r
68 AfxMessageBox(IDP_OLE_INIT_FAILED);
\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
82 InitContextMenuManager();
\r
84 InitKeyboardManager();
\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
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
102 AddDocTemplate(pDocTemplate);
\r
106 // Parse command line for standard shell commands, DDE, file open
\r
107 CCommandLineInfo cmdInfo;
\r
108 ParseCommandLine(cmdInfo);
\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
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
125 // CAboutDlg dialog used for App About
\r
127 class CAboutDlg : public CDialog
\r
133 enum { IDD = IDD_ABOUTBOX };
\r
136 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
\r
140 DECLARE_MESSAGE_MAP()
\r
143 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
\r
147 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
\r
149 CDialog::DoDataExchange(pDX);
\r
152 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
\r
155 // App command to run the dialog
\r
156 void CTortoiseGitBlameApp::OnAppAbout()
\r
158 CAboutDlg aboutDlg;
\r
159 aboutDlg.DoModal();
\r
162 // CTortoiseGitBlameApp customization load/save methods
\r
164 void CTortoiseGitBlameApp::PreLoadState()
\r
168 bNameValid = strName.LoadString(IDS_EDIT_MENU);
\r
169 ASSERT(bNameValid);
\r
170 GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EDIT);
\r
173 void CTortoiseGitBlameApp::LoadCustomState()
\r
177 void CTortoiseGitBlameApp::SaveCustomState()
\r
181 // CTortoiseGitBlameApp message handlers
\r