1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2016 - TortoiseGit
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.
20 #include "TortoiseProc.h"
21 #include "FirstStartWizard.h"
22 #include "FirstStartWizardStart.h"
24 #define WM_SETPAGEFOCUS WM_APP+2
26 IMPLEMENT_DYNAMIC(CFirstStartWizardStart
, CFirstStartWizardBasePage
)
28 CFirstStartWizardStart::CFirstStartWizardStart() : CFirstStartWizardBasePage(CFirstStartWizardStart::IDD
)
30 m_psp
.dwFlags
|= PSP_DEFAULT
| PSP_USEHEADERTITLE
;
31 m_psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDS_FIRSTSTART_STARTTITLE
);
34 CFirstStartWizardStart::~CFirstStartWizardStart()
38 void CFirstStartWizardStart::DoDataExchange(CDataExchange
* pDX
)
40 CFirstStartWizardBasePage::DoDataExchange(pDX
);
43 BEGIN_MESSAGE_MAP(CFirstStartWizardStart
, CFirstStartWizardBasePage
)
44 ON_MESSAGE(WM_SETPAGEFOCUS
, OnDialogDisplayed
)
45 ON_NOTIFY(NM_CLICK
, IDC_FIRSTSTART_HINT
, OnClickedLink
)
48 static void AppendStringResource(CString
& text
, UINT resouceID
)
51 temp
.LoadString(resouceID
);
52 text
.AppendChar(L
'\n');
53 text
.AppendChar(L
'\n');
57 BOOL
CFirstStartWizardStart::OnInitDialog()
59 CFirstStartWizardBasePage::OnInitDialog();
62 hinttext
.LoadString(IDS_FIRSTSTART_HINT1
);
63 AppendStringResource(hinttext
, IDS_FIRSTSTART_HINT2
);
64 AppendStringResource(hinttext
, IDS_FIRSTSTART_HINT3
);
65 AppendStringResource(hinttext
, IDS_FIRSTSTART_HINT4
);
66 GetDlgItem(IDC_FIRSTSTART_HINT
)->SetWindowText(hinttext
);
71 BOOL
CFirstStartWizardStart::OnSetActive()
73 CFirstStartWizard
* wiz
= (CFirstStartWizard
*)GetParent();
75 wiz
->SetWizardButtons(PSWIZB_BACK
| PSWIZB_NEXT
);
77 PostMessage(WM_SETPAGEFOCUS
, 0, 0);
79 return CFirstStartWizardBasePage::OnSetActive();
82 LRESULT
CFirstStartWizardStart::OnDialogDisplayed(WPARAM
/*wParam*/, LPARAM
/*lParam*/)
84 CFirstStartWizard
* wiz
= (CFirstStartWizard
*)GetParent();
86 wiz
->GetDlgItem(ID_WIZNEXT
)->SetFocus();
91 void CFirstStartWizardStart::OnClickedLink(NMHDR
* pNMHDR
, LRESULT
* pResult
)
93 ATLASSERT(pNMHDR
&& pResult
);
94 auto pNMLink
= reinterpret_cast<PNMLINK
>(pNMHDR
);
95 if (wcscmp(pNMLink
->item
.szID
, L
"manual") == 0)
97 CString
helppath(theApp
.m_pszHelpFilePath
);
98 helppath
+= L
"::/tgit-dug.html#tgit-dug-general";
99 ::HtmlHelp(GetSafeHwnd(), helppath
, HH_DISPLAY_TOPIC
, 0);
101 else if (wcscmp(pNMLink
->item
.szID
, L
"support") == 0)
102 ShellExecute(GetSafeHwnd(), L
"open", L
"https://tortoisegit.org/support/", nullptr, nullptr, SW_SHOWNORMAL
);