1 // Copyright 2014 Idol Software, Inc.
3 // This file is part of Doctor Dump SDK.
5 // Doctor Dump SDK is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (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 Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "SendReportDlg.h"
21 LRESULT
CStaticEx::OnPaint(UINT uMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
24 CDCHandle
dc(BeginPaint(&ps
));
26 dc
.SetTextColor(m_TextColor
);
28 CFontHandle
font(GetFont());
36 dc
.DrawText(text
, -1, &rect
, DT_END_ELLIPSIS
| DT_WORDBREAK
);
45 LRESULT
CSolutionDlg::OnInitDialog(UINT uMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
47 LRESULT res
= Base::OnInitDialog(uMsg
, wParam
, lParam
, bHandled
);
48 GetDlgItem(IDC_QUESTION
).SetWindowText(m_question
);
50 m_Quest
.m_TextColor
= CDC(GetDlgItem(IDC_QUESTION
).GetDC()).GetTextColor();
51 m_Quest
.SubclassWindow(GetDlgItem(IDC_QUESTION
));
56 LRESULT
CSendFullDumpDlg::OnSetProgress(UINT uMsg
, WPARAM wTotal
, LPARAM lSent
, BOOL
& bHandled
)
58 if (m_Progress
.IsWindow())
62 m_Text
.LockWindowUpdate(); // without that CStaticEx::OnPaint doesn't called ???
63 m_Text
.SetWindowText(m_translator
.GetString(L
"SendingData"));
64 m_Text
.LockWindowUpdate(FALSE
);
65 m_Progress
.ModifyStyle(PBS_MARQUEE
, 0);
66 m_Progress
.SetRange(0, 1000); // 1000 to make moving smooth (not less than pixels in progress bar)
67 m_progressBegan
= true;
69 m_Progress
.SetPos(int((1000.0 * lSent
) / wTotal
));
74 LRESULT
CAskSendFullDumpDlg::OnInitDialog(UINT uMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
76 Base::OnInitDialog(uMsg
, wParam
, lParam
, bHandled
);
77 RECT rect_client
, rect_main
, rect_details
;
78 GetClientRect(&rect_client
);
79 ClientToScreen(&rect_client
);
80 GetWindowRect(&rect_main
);
81 GetDlgItem(IDC_DETAILS
).GetWindowRect(&rect_details
);
82 m_nWidth
= rect_client
.right
- rect_client
.left
;
83 m_nFullHeight
= rect_client
.bottom
- rect_client
.top
;
84 int nNewHeight
= rect_details
.bottom
- rect_client
.top
+ 8;
86 ResizeClient(m_nWidth
, nNewHeight
);
88 m_Details
= GetDlgItem(IDC_DETAILS_TEXT
);
89 m_Details
.SetEventMask(ENM_LINK
);
91 SetDetailsText(m_translator
.GetString(L
"PrivateInfoText"));
96 void CAskSendFullDumpDlg::SetDetailsText(const CString
&text
)
98 CString clearText
= text
;
99 std::vector
<std::pair
<DWORD
, DWORD
>> links
;
101 while ((pos
= clearText
.Find(_T("<a>"))) != -1)
104 clearText
.Delete(pos
, 3);
105 pos
= clearText
.Find(_T("</a>"));
108 links
.push_back(std::make_pair(beg
, DWORD(pos
)));
109 clearText
.Delete(pos
, 4);
113 m_Details
.SetWindowTextW(clearText
);
116 m_Details
.GetSel(sel
);
119 cf
.cbSize
= sizeof(cf
);
120 cf
.dwMask
= CFM_LINK
| CFM_WEIGHT
;
121 cf
.dwEffects
= CFE_LINK
;
122 cf
.wWeight
= FW_BOLD
;
124 for (size_t i
= 0; i
< links
.size(); ++i
)
126 m_Details
.SetSel(links
[i
].first
, links
[i
].second
);
127 m_Details
.SetWordCharFormat(cf
);
130 m_Details
.SetSel(sel
);
133 LRESULT
CAskSendFullDumpDlg::OnClickedDetails(WORD wNotifyCode
, WORD wID
, HWND hWndCtl
, BOOL
& bHandled
)
135 ResizeClient(m_nWidth
, m_nFullHeight
);
136 GetDlgItem(IDC_DETAILS
).EnableWindow(FALSE
);
140 LRESULT
CAskSendFullDumpDlg::OnLinkClicked(int windowId
, LPNMHDR wParam
, BOOL
& bHandled
)
142 ENLINK
* enLink
= (ENLINK
*) wParam
;
143 if (enLink
->msg
!= WM_LBUTTONUP
)
146 if (!m_url
.IsEmpty())
147 ShellExecute(NULL
, _T("open"), CW2CT(m_url
), NULL
, NULL
, SW_SHOWNORMAL
);
154 LRESULT
CAskSendFullDumpDlg::OnClickedOKCancel(WORD wNotifyCode
, WORD wID
, HWND hWndCtl
, BOOL
& bHandled
)
158 if (IDNO
== MessageBox(m_translator
.GetString(L
"MotivateToSendFull"), m_translator
.GetAppName(), MB_ICONWARNING
| MB_YESNO
| MB_DEFBUTTON2
))