-
Notifications
You must be signed in to change notification settings - Fork 59
/
DebugDlg.cpp
105 lines (79 loc) · 2.27 KB
/
DebugDlg.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
// DebugDlg.cpp : fichier d'implémentation
//
#include "StdAfx.h"
#include "XMLTools.h"
#include "DebugDlg.h"
#include "afxdialogex.h"
// Boîte de dialogue CDebugDlg
IMPLEMENT_DYNAMIC(CDebugDlg, CDialog)
CDebugDlg::CDebugDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDebugDlg::IDD, pParent)
{
}
CDebugDlg::~CDebugDlg()
{
}
void CDebugDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
void CDebugDlg::Add(CStringW line) {
TRACE(line);
this->s_valDebug += line;
UpdateWindowText();
}
void CDebugDlg::AddLine(CStringW line) {
TRACE(line);
this->s_valDebug += line;
this->s_valDebug += L"\r\n";
UpdateWindowText();
}
void CDebugDlg::UpdateWindowText() {
if (this->m_hWnd) {
CEdit* edit = (CEdit*) GetDlgItem(IDC_EDITDEBUG);
if (edit) {
edit->SetWindowText(this->s_valDebug);
edit->SetSel(0, -1); // select all text and move cursor at the end
edit->SetSel(-1);
}
}
}
BEGIN_MESSAGE_MAP(CDebugDlg, CDialog)
ON_WM_SIZE()
ON_BN_CLICKED(IDC_BTNCLOSE, &CDebugDlg::OnBnClickedBtnclose)
ON_BN_CLICKED(IDC_BTNCLEAR, &CDebugDlg::OnBnClickedBtnclear)
END_MESSAGE_MAP()
// Gestionnaires de messages de CDebugDlg
void CDebugDlg::OnSize(UINT nType, int cx, int cy) {
CDialog::OnSize(nType, cx, cy);
CWnd *txt_wnd = GetDlgItem(IDC_EDITDEBUG);
CWnd* btn_clear = GetDlgItem(IDC_BTNCLEAR);
CWnd* btn_close = GetDlgItem(IDC_BTNCLOSE);
if (txt_wnd) {
int border = 8;
int btnHeight = 26;
int btnWidth = 86;
txt_wnd->MoveWindow(border, border, cx-2*border, cy-3*border-btnHeight);
btn_clear->MoveWindow(((cx - border) / 2) - btnWidth, cy - border - btnHeight, btnWidth, btnHeight);
btn_close->MoveWindow(((cx + border) / 2), cy - border - btnHeight, btnWidth, btnHeight);
}
}
BOOL CDebugDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CRect myRect;
GetClientRect(&myRect);
ClientToScreen(myRect);
MoveWindow(myRect.left, myRect.top, myRect.Width(), myRect.Height());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION : les pages de propriétés OCX devraient retourner FALSE
}
void CDebugDlg::OnBnClickedBtnclose()
{
this->OnOK();
}
void CDebugDlg::OnBnClickedBtnclear()
{
this->s_valDebug = L"";
UpdateWindowText();
}