2 // TortoiseGitBlame.cpp : Defines the class behaviors for the application.
6 #include "afxwinappex.h"
7 #include "TortoiseGitBlame.h"
10 #include "TortoiseGitBlameDoc.h"
11 #include "TortoiseGitBlameView.h"
12 #include "CmdLineParser.h"
19 // CTortoiseGitBlameApp
21 BEGIN_MESSAGE_MAP(CTortoiseGitBlameApp
, CWinAppEx
)
22 ON_COMMAND(ID_APP_ABOUT
, &CTortoiseGitBlameApp::OnAppAbout
)
23 // Standard file based document commands
24 ON_COMMAND(ID_FILE_NEW
, &CWinAppEx::OnFileNew
)
25 ON_COMMAND(ID_FILE_OPEN
, &CWinAppEx::OnFileOpen
)
26 // Standard print setup command
27 ON_COMMAND(ID_FILE_PRINT_SETUP
, &CWinAppEx::OnFilePrintSetup
)
31 // CTortoiseGitBlameApp construction
33 CTortoiseGitBlameApp::CTortoiseGitBlameApp()
38 m_bHiColorIcons
= TRUE
;
40 // TODO: add construction code here,
41 // Place all significant initialization in InitInstance
44 // The one and only CTortoiseGitBlameApp object
46 CTortoiseGitBlameApp theApp
;
49 // CTortoiseGitBlameApp initialization
51 BOOL
CTortoiseGitBlameApp::InitInstance()
53 // InitCommonControlsEx() is required on Windows XP if an application
54 // manifest specifies use of ComCtl32.dll version 6 or later to enable
55 // visual styles. Otherwise, any window creation will fail.
56 INITCOMMONCONTROLSEX InitCtrls
;
57 InitCtrls
.dwSize
= sizeof(InitCtrls
);
58 // Set this to include all the common control classes you want to use
59 // in your application.
60 InitCtrls
.dwICC
= ICC_WIN95_CLASSES
;
61 InitCommonControlsEx(&InitCtrls
);
63 CWinAppEx::InitInstance();
65 Gdiplus::GdiplusStartupInput gdiplusStartupInput
;
66 Gdiplus::GdiplusStartup(&m_gdiplusToken
,&gdiplusStartupInput
,NULL
);
68 // Initialize OLE libraries
71 AfxMessageBox(IDP_OLE_INIT_FAILED
);
74 AfxEnableControlContainer();
75 // Standard initialization
76 // If you are not using these features and wish to reduce the size
77 // of your final executable, you should remove from the following
78 // the specific initialization routines you do not need
79 // Change the registry key under which our settings are stored
80 // TODO: You should modify this string to be something appropriate
81 // such as the name of your company or organization
82 SetRegistryKey(_T("Local AppWizard-Generated Applications"));
83 LoadStdProfileSettings(4); // Load standard INI file options (including MRU)
85 InitContextMenuManager();
87 InitKeyboardManager();
90 CMFCToolTipInfo ttParams
;
91 ttParams
.m_bVislManagerTheme
= TRUE
;
92 theApp
.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL
,
93 RUNTIME_CLASS(CMFCToolTipCtrl
), &ttParams
);
95 // Register the application's document templates. Document templates
96 // serve as the connection between documents, frame windows and views
97 CSingleDocTemplate
* pDocTemplate
;
98 pDocTemplate
= new CSingleDocTemplate(
99 IDR_TORTOISE_GIT_BLAME_MAINFRAME
,
100 RUNTIME_CLASS(CTortoiseGitBlameDoc
),
101 RUNTIME_CLASS(CMainFrame
), // main SDI frame window
102 RUNTIME_CLASS(CTortoiseGitBlameView
));
105 AddDocTemplate(pDocTemplate
);
109 // Parse command line for standard shell commands, DDE, file open
110 CCommandLineInfo cmdInfo
;
111 ParseCommandLine(cmdInfo
);
113 // Dispatch commands specified on the command line. Will return FALSE if
114 // app was launched with /RegServer, /Register, /Unregserver or /Unregister.
115 if (!ProcessShellCommand(cmdInfo
))
118 // The one and only window has been initialized, so show and update it
119 m_pMainWnd
->ShowWindow(SW_SHOW
);
120 m_pMainWnd
->UpdateWindow();
121 // call DragAcceptFiles only if there's a suffix
122 // In an SDI app, this should occur after ProcessShellCommand
128 // CAboutDlg dialog used for App About
130 class CAboutDlg
: public CDialog
136 enum { IDD
= IDD_ABOUTBOX
};
139 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
143 DECLARE_MESSAGE_MAP()
146 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD
)
150 void CAboutDlg::DoDataExchange(CDataExchange
* pDX
)
152 CDialog::DoDataExchange(pDX
);
155 BEGIN_MESSAGE_MAP(CAboutDlg
, CDialog
)
158 // App command to run the dialog
159 void CTortoiseGitBlameApp::OnAppAbout()
165 // CTortoiseGitBlameApp customization load/save methods
167 void CTortoiseGitBlameApp::PreLoadState()
171 bNameValid
= strName
.LoadString(IDS_EDIT_MENU
);
173 GetContextMenuManager()->AddMenu(strName
, IDR_POPUP_EDIT
);
176 void CTortoiseGitBlameApp::LoadCustomState()
180 void CTortoiseGitBlameApp::SaveCustomState()
184 // CTortoiseGitBlameApp message handlers
189 int CTortoiseGitBlameApp::ExitInstance()
191 // TODO: Add your specialized code here and/or call the base class
192 Gdiplus::GdiplusShutdown(m_gdiplusToken
);
193 return CWinAppEx::ExitInstance();