-
Notifications
You must be signed in to change notification settings - Fork 5
/
aboutdlg.cpp
195 lines (157 loc) · 6.65 KB
/
aboutdlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/*===========================================================================
*
* File: Aboutdlg.CPP
* Author: Dave Humphrey ([email protected])
* Created On: 26 November 2011
*
* Description
*
*=========================================================================*/
/* Include Files */
#include "stdafx.h"
#include "sredit.h"
#include "aboutdlg.h"
/*===========================================================================
*
* Begin Class CAboutDlg Message Map
*
*=========================================================================*/
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
ON_NOTIFY(EN_LINK, IDC_CREDITS, OnLink)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*===========================================================================
* End of Class CAboutDlg Message Map
*=========================================================================*/
/*===========================================================================
*
* Class CAboutDlg Constructor
*
*=========================================================================*/
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) {
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
/*===========================================================================
* End of Class CAboutDlg Constructor
*=========================================================================*/
/*===========================================================================
*
* Class CAboutDlg Method - void DoDataExchange (pDX);
*
*=========================================================================*/
void CAboutDlg::DoDataExchange(CDataExchange* pDX) {
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
DDX_Control(pDX, IDC_CREDITS, m_Credits);
//}}AFX_DATA_MAP
}
/*===========================================================================
* End of Class Method CAboutDlg::DoDataExchange()
*=========================================================================*/
/*===========================================================================
*
* Class CAboutDlg Method - void AddBullet (pString, ...);
*
*=========================================================================*/
void CAboutDlg::AddBullet (const TCHAR* pString, ...) {
PARAFORMAT ParaFormat;
PARAFORMAT OldFormat;
CString Buffer;
va_list Args;
int Length;
ParaFormat.cbSize = sizeof(ParaFormat);
ParaFormat.dwMask = PFM_NUMBERING | PFM_STARTINDENT | PFM_OFFSET;
ParaFormat.wNumbering = PFN_BULLET;
ParaFormat.dxStartIndent = 150;
ParaFormat.dxOffset = 150;
m_Credits.GetParaFormat(OldFormat);
va_start(Args, pString);
Buffer.FormatV(pString, Args);
va_end(Args);
Length = m_Credits.GetWindowTextLength();
m_Credits.SetSel(Length, Length);
m_Credits.SetParaFormat(ParaFormat);
m_Credits.ReplaceSel(Buffer, FALSE);
Length = m_Credits.GetWindowTextLength();
m_Credits.SetSel(Length, Length);
AddText("");
m_Credits.SetParaFormat(OldFormat);
}
/*===========================================================================
* End of Class Method CAboutDlg::AddBullet()
*=========================================================================*/
/*===========================================================================
*
* Class CAboutDlg Method - void AddText (pString, ...);
*
*=========================================================================*/
void CAboutDlg::AddText (const TCHAR* pString, ...) {
CString Buffer;
va_list Args;
int Length;
va_start(Args, pString);
Buffer.FormatV(pString, Args);
va_end(Args);
Buffer += "\r\n";
Length = m_Credits.GetWindowTextLength();
m_Credits.SetSel(Length, Length);
m_Credits.ReplaceSel(Buffer, FALSE);
Length = m_Credits.GetWindowTextLength();
m_Credits.SetSel(Length, Length);
}
/*===========================================================================
* End of Class Method CAboutDlg::AddText()
*=========================================================================*/
/*===========================================================================
*
* Class CAboutDlg Event - BOOL OnInitDialog ();
*
*=========================================================================*/
BOOL CAboutDlg::OnInitDialog() {
CDialog::OnInitDialog();
m_Credits.SetBackgroundColor(FALSE, SREDIT_COLOR_GRAY);
m_Credits.SetTargetDevice(NULL, 0);
m_Credits.SendMessage(EM_AUTOURLDETECT, 1, 0);
m_Credits.SetEventMask(m_Credits.GetEventMask() | ENM_LINK);
AddText("Note: SkyEdit is a work in progress and likely contains bugs. Not all features are complete or implemented yet. Please use caution and keep backups of all plugins and save games.");
AddText("");
AddText("The latest version along with documentation and help can be found at:");
AddText(" http://www.uesp.net/wiki/Tes5Mod:SkyEdit");
AddText(" http://github.com/uesp/skyedit");
AddText("");
AddText("Credits:");
AddBullet("Devil (http://openil.sourceforge.net/) for loading images.");
AddBullet("zLib (http://www.zlib.net/) for loading/saving compressed data.");
AddBullet("Resizable Control Bars (http://www.datamekanix.com/) for the nice dockable error/undo control bars in the main view.");
AddBullet("Tes5Lib (http://github.com/uesp/tes5lib) for loading and manipulating Skyrim data files. ");
AddText("");
AddText("Note: This notice can be turned off in SkyEdit.ini by changing 'DisplayAboutOnLoad' to false.");
return TRUE;
}
/*===========================================================================
* End of Class Event CAboutDlg::OnInitDialog()
*=========================================================================*/
/*===========================================================================
*
* Class CAboutDlg Event - void OnLink (pNotify, pResult);
*
*=========================================================================*/
void CAboutDlg::OnLink (NMHDR *pNotify, LRESULT *pResult) {
ENLINK* pEnlink = (ENLINK *) pNotify;
CString Buffer;
CHARRANGE OldSel;
*pResult = 0;
if (pEnlink->msg != WM_LBUTTONDOWN) return;
m_Credits.GetSel(OldSel);
m_Credits.HideSelection(TRUE, FALSE);
m_Credits.SetSel(pEnlink->chrg);
Buffer = m_Credits.GetSelText();
OpenWebPage(Buffer);
m_Credits.SetSel(OldSel);
m_Credits.HideSelection(FALSE, FALSE);
}
/*===========================================================================
* End of Class Event CAboutDlg::OnLink()
*=========================================================================*/