summaryrefslogtreecommitdiffabout
path: root/KLogDlg.cpp
Unidiff
Diffstat (limited to 'KLogDlg.cpp') (more/less context) (show whitespace changes)
-rw-r--r--KLogDlg.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/KLogDlg.cpp b/KLogDlg.cpp
index 5f1c6c0..bdcb881 100644
--- a/KLogDlg.cpp
+++ b/KLogDlg.cpp
@@ -1,384 +1,387 @@
1// KLogDlg.cpp : implementation file 1// KLogDlg.cpp : implementation file
2// 2//
3 3
4#include "stdafx.h" 4#include "stdafx.h"
5#include "KLog.h" 5#include "KLog.h"
6#include "SyslogSocket.h" 6#include "SyslogSocket.h"
7#include "KLogDlg.h" 7#include "KLogDlg.h"
8 8
9#include "Trayer.h" 9#include "Trayer.h"
10#include "LogPattern.h" 10#include "LogPattern.h"
11#include "WarnBlocking.h" 11#include "WarnBlocking.h"
12 12
13#ifdef _DEBUG 13#ifdef _DEBUG
14#define new DEBUG_NEW 14#define new DEBUG_NEW
15#undef THIS_FILE 15#undef THIS_FILE
16static char THIS_FILE[] = __FILE__; 16static char THIS_FILE[] = __FILE__;
17#endif 17#endif
18 18
19IMPLEMENT_SERIAL( CKLogDlg, CDialog, VERSIONABLE_SCHEMA|1 ); 19IMPLEMENT_SERIAL( CKLogDlg, CDialog, VERSIONABLE_SCHEMA|1 );
20IMPLEMENT_SERIAL( CLogger, CObject, VERSIONABLE_SCHEMA|1 ); 20IMPLEMENT_SERIAL( CLogger, CObject, VERSIONABLE_SCHEMA|1 );
21IMPLEMENT_SERIAL( CLogEntry, CObject, VERSIONABLE_SCHEMA|1 ); 21IMPLEMENT_SERIAL( CLogEntry, CObject, VERSIONABLE_SCHEMA|1 );
22IMPLEMENT_SERIAL( CHostMask, CObject, VERSIONABLE_SCHEMA|1 ); 22IMPLEMENT_SERIAL( CHostMask, CObject, VERSIONABLE_SCHEMA|1 );
23 23
24///////////////////////////////////////////////////////////////////////////// 24/////////////////////////////////////////////////////////////////////////////
25// CAboutDlg dialog used for App About 25// CAboutDlg dialog used for App About
26 26
27class CAboutDlg : public CDialog 27class CAboutDlg : public CDialog
28{ 28{
29public: 29public:
30 CAboutDlg(); 30 CAboutDlg();
31 31
32// Dialog Data 32// Dialog Data
33 //{{AFX_DATA(CAboutDlg) 33 //{{AFX_DATA(CAboutDlg)
34 enum { IDD = IDD_ABOUTBOX }; 34 enum { IDD = IDD_ABOUTBOX };
35 //}}AFX_DATA 35 //}}AFX_DATA
36 36
37 // ClassWizard generated virtual function overrides 37 // ClassWizard generated virtual function overrides
38 //{{AFX_VIRTUAL(CAboutDlg) 38 //{{AFX_VIRTUAL(CAboutDlg)
39 protected: 39 protected:
40 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 40 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
41 //}}AFX_VIRTUAL 41 //}}AFX_VIRTUAL
42 42
43// Implementation 43// Implementation
44protected: 44protected:
45 //{{AFX_MSG(CAboutDlg) 45 //{{AFX_MSG(CAboutDlg)
46 afx_msg void OnKlevernet(); 46 afx_msg void OnKlevernet();
47 //}}AFX_MSG 47 //}}AFX_MSG
48 DECLARE_MESSAGE_MAP() 48 DECLARE_MESSAGE_MAP()
49}; 49};
50 50
51CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) 51CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
52{ 52{
53 //{{AFX_DATA_INIT(CAboutDlg) 53 //{{AFX_DATA_INIT(CAboutDlg)
54 //}}AFX_DATA_INIT 54 //}}AFX_DATA_INIT
55} 55}
56 56
57void CAboutDlg::DoDataExchange(CDataExchange* pDX) 57void CAboutDlg::DoDataExchange(CDataExchange* pDX)
58{ 58{
59 CDialog::DoDataExchange(pDX); 59 CDialog::DoDataExchange(pDX);
60 //{{AFX_DATA_MAP(CAboutDlg) 60 //{{AFX_DATA_MAP(CAboutDlg)
61 //}}AFX_DATA_MAP 61 //}}AFX_DATA_MAP
62} 62}
63 63
64BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) 64BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
65 //{{AFX_MSG_MAP(CAboutDlg) 65 //{{AFX_MSG_MAP(CAboutDlg)
66 ON_BN_CLICKED(IDC_KLEVERNET, OnKlevernet) 66 ON_BN_CLICKED(IDC_KLEVERNET, OnKlevernet)
67 //}}AFX_MSG_MAP 67 //}}AFX_MSG_MAP
68END_MESSAGE_MAP() 68END_MESSAGE_MAP()
69 69
70///////////////////////////////////////////////////////////////////////////// 70/////////////////////////////////////////////////////////////////////////////
71// CKLogDlg dialog 71// CKLogDlg dialog
72 72
73CKLogDlg::CKLogDlg(CWnd* pParent /*=NULL*/) 73CKLogDlg::CKLogDlg(CWnd* pParent /*=NULL*/)
74 : CDialog(CKLogDlg::IDD, pParent) 74 : CDialog(CKLogDlg::IDD, pParent)
75{ 75{
76 m_Logger=NULL; 76 m_Logger=NULL;
77 m_LogItems=15; 77 m_LogItems=15;
78 m_bShown=TRUE; 78 m_bShown=TRUE;
79 m_bExiting=FALSE; 79 m_bExiting=FALSE;
80 m_bWarnBlocking=TRUE; 80 m_bWarnBlocking=TRUE;
81 m_bDontWarn=TRUE; 81 m_bDontWarn=TRUE;
82 //{{AFX_DATA_INIT(CKLogDlg) 82 //{{AFX_DATA_INIT(CKLogDlg)
83 m_Logto = -1; 83 m_Logto = -1;
84 m_Desc = _T(""); 84 m_Desc = _T("");
85 m_Facility = _T(""); 85 m_Facility = _T("");
86 m_HFName = _T(""); 86 m_HFName = _T("");
87 m_HFNameCaption = _T(""); 87 m_HFNameCaption = _T("");
88 m_hlIP = _T(""); 88 m_hlIP = _T("");
89 m_hlMask = _T(""); 89 m_hlMask = _T("");
90 m_Sound = _T(""); 90 m_Sound = _T("");
91 //}}AFX_DATA_INIT 91 //}}AFX_DATA_INIT
92 // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 92 // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
93 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); 93 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
94 m_bmpBack.LoadBitmap(IDB_BACKGROUND); 94 m_bmpBack.LoadBitmap(IDB_BACKGROUND);
95 m_bmpBack.GetBitmap(&m_bitmapBack); 95 m_bmpBack.GetBitmap(&m_bitmapBack);
96 m_Trayer = new CTrayer(this); 96 m_Trayer = new CTrayer(this);
97 ASSERT(m_Trayer); 97 ASSERT(m_Trayer);
98 LoadSettings(); 98 LoadSettings();
99} 99}
100 100
101void CKLogDlg::DoDataExchange(CDataExchange* pDX) 101void CKLogDlg::DoDataExchange(CDataExchange* pDX)
102{ 102{
103 CDialog::DoDataExchange(pDX); 103 CDialog::DoDataExchange(pDX);
104 //{{AFX_DATA_MAP(CKLogDlg) 104 //{{AFX_DATA_MAP(CKLogDlg)
105 DDX_Control(pDX, IDCANCEL, m_CancelCtl);
105 DDX_Control(pDX, IDC_LOGPATTERN, m_LogPatternCtl); 106 DDX_Control(pDX, IDC_LOGPATTERN, m_LogPatternCtl);
106 DDX_Control(pDX, IDC_FILES, m_FilesCtl); 107 DDX_Control(pDX, IDC_FILES, m_FilesCtl);
107 DDX_Control(pDX, IDC_LOGLENSPIN, m_LogLenSpinCtl); 108 DDX_Control(pDX, IDC_LOGLENSPIN, m_LogLenSpinCtl);
108 DDX_Control(pDX, IDC_LOGLENGTH, m_LogLengthCtl); 109 DDX_Control(pDX, IDC_LOGLENGTH, m_LogLengthCtl);
109 DDX_Control(pDX, IDC_INVERT, m_PriInvertCtl); 110 DDX_Control(pDX, IDC_INVERT, m_PriInvertCtl);
110 DDX_Control(pDX, IDC_TYPE_FILE, m_LogtoFileCtl); 111 DDX_Control(pDX, IDC_TYPE_FILE, m_LogtoFileCtl);
111 DDX_Control(pDX, IDC_TYPE_HOST, m_LogtoHostCtl); 112 DDX_Control(pDX, IDC_TYPE_HOST, m_LogtoHostCtl);
112 DDX_Control(pDX, IDC_TYPE_NONE, m_LogtoNoneCtl); 113 DDX_Control(pDX, IDC_TYPE_NONE, m_LogtoNoneCtl);
113 DDX_Control(pDX, IDC_HOSTORFILE, m_HFNameCaptionCtl); 114 DDX_Control(pDX, IDC_HOSTORFILE, m_HFNameCaptionCtl);
114 DDX_Control(pDX, IDC_HOSTS, m_hlCtl); 115 DDX_Control(pDX, IDC_HOSTS, m_hlCtl);
115 DDX_Control(pDX, IDC_BROWSESOUND, m_BrowseSoundCtl); 116 DDX_Control(pDX, IDC_BROWSESOUND, m_BrowseSoundCtl);
116 DDX_Control(pDX, IDC_NONE, m_PriNoneCtl); 117 DDX_Control(pDX, IDC_NONE, m_PriNoneCtl);
117 DDX_Control(pDX, IDC_HL_REMOVE, m_hlRemoveCtl); 118 DDX_Control(pDX, IDC_HL_REMOVE, m_hlRemoveCtl);
118 DDX_Control(pDX, IDC_HL_MASK, m_hlMaskCtl); 119 DDX_Control(pDX, IDC_HL_MASK, m_hlMaskCtl);
119 DDX_Control(pDX, IDC_HL_IP, m_hlIPCtl); 120 DDX_Control(pDX, IDC_HL_IP, m_hlIPCtl);
120 DDX_Control(pDX, IDC_HL_ADD, m_hlAddCtl); 121 DDX_Control(pDX, IDC_HL_ADD, m_hlAddCtl);
121 DDX_Control(pDX, IDC_ALL, m_PriAllCtl); 122 DDX_Control(pDX, IDC_ALL, m_PriAllCtl);
122 DDX_Control(pDX, IDC_SOUND, m_SoundCtl); 123 DDX_Control(pDX, IDC_SOUND, m_SoundCtl);
123 DDX_Control(pDX, IDC_REMOVE, m_RemoveCtl); 124 DDX_Control(pDX, IDC_REMOVE, m_RemoveCtl);
124 DDX_Control(pDX, IDC_PLAYSOUND, m_PlaySoundCtl); 125 DDX_Control(pDX, IDC_PLAYSOUND, m_PlaySoundCtl);
125 DDX_Control(pDX, IDC_LOG, m_Log); 126 DDX_Control(pDX, IDC_LOG, m_Log);
126 DDX_Control(pDX, IDC_HOSTFILE, m_HFNameCtl); 127 DDX_Control(pDX, IDC_HOSTFILE, m_HFNameCtl);
127 DDX_Control(pDX, IDC_FACILITY, m_FacilityCtl); 128 DDX_Control(pDX, IDC_FACILITY, m_FacilityCtl);
128 DDX_Control(pDX, IDC_BROWSE, m_BrowseCtl); 129 DDX_Control(pDX, IDC_BROWSE, m_BrowseCtl);
129 DDX_Control(pDX, IDC_DESC, m_DescCtl); 130 DDX_Control(pDX, IDC_DESC, m_DescCtl);
130 DDX_Control(pDX, IDC_TABS, m_Tabs); 131 DDX_Control(pDX, IDC_TABS, m_Tabs);
131 DDX_Radio(pDX, IDC_TYPE_FILE, m_Logto); 132 DDX_Radio(pDX, IDC_TYPE_FILE, m_Logto);
132 DDX_Text(pDX, IDC_DESC, m_Desc); 133 DDX_Text(pDX, IDC_DESC, m_Desc);
133 DDV_MaxChars(pDX, m_Desc, 50); 134 DDV_MaxChars(pDX, m_Desc, 50);
134 DDX_CBString(pDX, IDC_FACILITY, m_Facility); 135 DDX_CBString(pDX, IDC_FACILITY, m_Facility);
135 DDX_Text(pDX, IDC_HOSTFILE, m_HFName); 136 DDX_Text(pDX, IDC_HOSTFILE, m_HFName);
136 DDX_Text(pDX, IDC_HOSTORFILE, m_HFNameCaption); 137 DDX_Text(pDX, IDC_HOSTORFILE, m_HFNameCaption);
137 DDX_Text(pDX, IDC_HL_IP, m_hlIP); 138 DDX_Text(pDX, IDC_HL_IP, m_hlIP);
138 DDV_MaxChars(pDX, m_hlIP, 15); 139 DDV_MaxChars(pDX, m_hlIP, 15);
139 DDX_Text(pDX, IDC_HL_MASK, m_hlMask); 140 DDX_Text(pDX, IDC_HL_MASK, m_hlMask);
140 DDV_MaxChars(pDX, m_hlMask, 15); 141 DDV_MaxChars(pDX, m_hlMask, 15);
141 DDX_CBString(pDX, IDC_SOUND, m_Sound); 142 DDX_CBString(pDX, IDC_SOUND, m_Sound);
142 //}}AFX_DATA_MAP 143 //}}AFX_DATA_MAP
143} 144}
144 145
145BEGIN_MESSAGE_MAP(CKLogDlg, CDialog) 146BEGIN_MESSAGE_MAP(CKLogDlg, CDialog)
146 //{{AFX_MSG_MAP(CKLogDlg) 147 //{{AFX_MSG_MAP(CKLogDlg)
147 ON_WM_SYSCOMMAND() 148 ON_WM_SYSCOMMAND()
148 ON_WM_DESTROY() 149 ON_WM_DESTROY()
149 ON_WM_PAINT() 150 ON_WM_PAINT()
150 ON_WM_QUERYDRAGICON() 151 ON_WM_QUERYDRAGICON()
151 ON_BN_CLICKED(IDC_ADD, OnAdd) 152 ON_BN_CLICKED(IDC_ADD, OnAdd)
152 ON_NOTIFY(TCN_SELCHANGE, IDC_TABS, OnSelchangeTabs) 153 ON_NOTIFY(TCN_SELCHANGE, IDC_TABS, OnSelchangeTabs)
153 ON_CBN_SELCHANGE(IDC_FACILITY, OnSelchangeFacility) 154 ON_CBN_SELCHANGE(IDC_FACILITY, OnSelchangeFacility)
154 ON_BN_CLICKED(IDC_ALERT, OnPriority) 155 ON_BN_CLICKED(IDC_ALERT, OnPriority)
155 ON_BN_CLICKED(IDC_TYPE_FILE, OnLogto) 156 ON_BN_CLICKED(IDC_TYPE_FILE, OnLogto)
156 ON_BN_CLICKED(IDC_ALL, OnPriAll) 157 ON_BN_CLICKED(IDC_ALL, OnPriAll)
157 ON_BN_CLICKED(IDC_NONE, OnPriNone) 158 ON_BN_CLICKED(IDC_NONE, OnPriNone)
158 ON_EN_CHANGE(IDC_DESC, OnChangeDesc) 159 ON_EN_CHANGE(IDC_DESC, OnChangeDesc)
159 ON_BN_CLICKED(IDC_INVERT, OnPriInvert) 160 ON_BN_CLICKED(IDC_INVERT, OnPriInvert)
160 ON_BN_CLICKED(IDC_HL_ADD, OnHlAdd) 161 ON_BN_CLICKED(IDC_HL_ADD, OnHlAdd)
161 ON_LBN_SELCHANGE(IDC_HOSTS, OnSelchangeHosts) 162 ON_LBN_SELCHANGE(IDC_HOSTS, OnSelchangeHosts)
162 ON_BN_CLICKED(IDC_HL_REMOVE, OnHlRemove) 163 ON_BN_CLICKED(IDC_HL_REMOVE, OnHlRemove)
163 ON_BN_CLICKED(IDC_REMOVE, OnRemove) 164 ON_BN_CLICKED(IDC_REMOVE, OnRemove)
164 ON_BN_CLICKED(IDC_PLAYSOUND, OnPlaysound) 165 ON_BN_CLICKED(IDC_PLAYSOUND, OnPlaysound)
165 ON_CBN_EDITCHANGE(IDC_SOUND, OnEditchangeSound) 166 ON_CBN_EDITCHANGE(IDC_SOUND, OnEditchangeSound)
166 ON_CBN_KILLFOCUS(IDC_SOUND, OnKillfocusSound) 167 ON_CBN_KILLFOCUS(IDC_SOUND, OnKillfocusSound)
167 ON_NOTIFY(UDN_DELTAPOS, IDC_LOGLENSPIN, OnDeltaposLoglenspin) 168 ON_NOTIFY(UDN_DELTAPOS, IDC_LOGLENSPIN, OnDeltaposLoglenspin)
168 ON_BN_CLICKED(IDC_EXIT, OnExit) 169 ON_BN_CLICKED(IDC_EXIT, OnExit)
169 ON_BN_CLICKED(IDC_FILES, OnFiles) 170 ON_BN_CLICKED(IDC_FILES, OnFiles)
170 ON_COMMAND(ID_FILES_EXPORT, OnFilesExport) 171 ON_COMMAND(ID_FILES_EXPORT, OnFilesExport)
171 ON_COMMAND(ID_FILES_IMPORT, OnFilesImport) 172 ON_COMMAND(ID_FILES_IMPORT, OnFilesImport)
172 ON_BN_CLICKED(IDC_BROWSESOUND, OnBrowsesound) 173 ON_BN_CLICKED(IDC_BROWSESOUND, OnBrowsesound)
173 ON_EN_KILLFOCUS(IDC_HOSTFILE, OnKillfocusHostfile) 174 ON_EN_KILLFOCUS(IDC_HOSTFILE, OnKillfocusHostfile)
174 ON_BN_CLICKED(IDC_BROWSE, OnBrowse) 175 ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
175 ON_COMMAND(ID_FILES_RESET, OnFilesReset) 176 ON_COMMAND(ID_FILES_RESET, OnFilesReset)
176 ON_LBN_SELCHANGE(IDC_LOG, OnSelchangeLog) 177 ON_LBN_SELCHANGE(IDC_LOG, OnSelchangeLog)
177 ON_WM_CREATE() 178 ON_WM_CREATE()
178 ON_WM_CLOSE() 179 ON_WM_CLOSE()
179 ON_COMMAND(ID_TRAY_ABOUTKLOG, OnTrayAboutklog) 180 ON_COMMAND(ID_TRAY_ABOUTKLOG, OnTrayAboutklog)
180 ON_COMMAND(ID_TRAY_EXIT, OnTrayExit) 181 ON_COMMAND(ID_TRAY_EXIT, OnTrayExit)
181 ON_COMMAND(ID_TRAY_SHOWKLOGWINDOW, OnTrayShowklogwindow) 182 ON_COMMAND(ID_TRAY_SHOWKLOGWINDOW, OnTrayShowklogwindow)
182 ON_WM_WINDOWPOSCHANGING() 183 ON_WM_WINDOWPOSCHANGING()
183 ON_BN_CLICKED(IDC_LOGPATTERN, OnLogpattern) 184 ON_BN_CLICKED(IDC_LOGPATTERN, OnLogpattern)
185 ON_WM_GETMINMAXINFO()
184 ON_BN_CLICKED(IDC_CRIT, OnPriority) 186 ON_BN_CLICKED(IDC_CRIT, OnPriority)
185 ON_BN_CLICKED(IDC_DEBUG, OnPriority) 187 ON_BN_CLICKED(IDC_DEBUG, OnPriority)
186 ON_BN_CLICKED(IDC_EMERG, OnPriority) 188 ON_BN_CLICKED(IDC_EMERG, OnPriority)
187 ON_BN_CLICKED(IDC_ERR, OnPriority) 189 ON_BN_CLICKED(IDC_ERR, OnPriority)
188 ON_BN_CLICKED(IDC_INFO, OnPriority) 190 ON_BN_CLICKED(IDC_INFO, OnPriority)
189 ON_BN_CLICKED(IDC_NOTICE, OnPriority) 191 ON_BN_CLICKED(IDC_NOTICE, OnPriority)
190 ON_BN_CLICKED(IDC_WARNING, OnPriority) 192 ON_BN_CLICKED(IDC_WARNING, OnPriority)
191 ON_BN_CLICKED(IDC_TYPE_HOST, OnLogto) 193 ON_BN_CLICKED(IDC_TYPE_HOST, OnLogto)
192 ON_BN_CLICKED(IDC_TYPE_NONE, OnLogto) 194 ON_BN_CLICKED(IDC_TYPE_NONE, OnLogto)
195 ON_WM_SIZE()
193 //}}AFX_MSG_MAP 196 //}}AFX_MSG_MAP
194END_MESSAGE_MAP() 197END_MESSAGE_MAP()
195 198
196///////////////////////////////////////////////////////////////////////////// 199/////////////////////////////////////////////////////////////////////////////
197// CKLogDlg message handlers 200// CKLogDlg message handlers
198 201
199BOOL CKLogDlg::OnInitDialog() 202BOOL CKLogDlg::OnInitDialog()
200{ 203{
201 CDialog::OnInitDialog(); 204 CDialog::OnInitDialog();
202 205
203 // Add "About..." menu item to system menu. 206 // Add "About..." menu item to system menu.
204 207
205 // IDM_ABOUTBOX must be in the system command range. 208 // IDM_ABOUTBOX must be in the system command range.
206 ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); 209 ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
207 ASSERT(IDM_ABOUTBOX < 0xF000); 210 ASSERT(IDM_ABOUTBOX < 0xF000);
208 211
209 CMenu* pSysMenu = GetSystemMenu(FALSE); 212 CMenu* pSysMenu = GetSystemMenu(FALSE);
210 CString strAboutMenu; 213 CString strAboutMenu;
211 strAboutMenu.LoadString(IDS_ABOUTBOX); 214 strAboutMenu.LoadString(IDS_ABOUTBOX);
212 if (!strAboutMenu.IsEmpty()) 215 if (!strAboutMenu.IsEmpty())
213 { 216 {
214 pSysMenu->AppendMenu(MF_SEPARATOR); 217 pSysMenu->AppendMenu(MF_SEPARATOR);
215 pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); 218 pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
216 } 219 }
217 220
218 // Set the icon for this dialog. The framework does this automatically 221 // Set the icon for this dialog. The framework does this automatically
219 // when the application's main window is not a dialog 222 // when the application's main window is not a dialog
220 SetIcon(m_hIcon, TRUE); // Set big icon 223 SetIcon(m_hIcon, TRUE); // Set big icon
221 SetIcon(m_hIcon, FALSE); // Set small icon 224 SetIcon(m_hIcon, FALSE); // Set small icon
222 225
223 m_KLS.m_Daddy=this; 226 m_KLS.m_Daddy=this;
224 VERIFY(m_KLS.CreateListen()); 227 VERIFY(m_KLS.CreateListen());
225 m_SLS.Create(0,SOCK_DGRAM); 228 m_SLS.Create(0,SOCK_DGRAM);
226 229
227 m_LogLenSpinCtl.SetRange(5,50); 230 m_LogLenSpinCtl.SetRange(5,50);
228 UpdateLogLength(FALSE,FALSE); 231 UpdateLogLength(FALSE,FALSE);
229 232
230 // Adjust Tab control rectangle size and padding 233 // Adjust Tab control rectangle size and padding
231CRect rbrc,tcrc; 234CRect rbrc,tcrc;
232 m_DescCtl.GetWindowRect(&rbrc); 235 m_DescCtl.GetWindowRect(&rbrc);
233 m_Tabs.GetClientRect(&tcrc); 236 m_Tabs.GetClientRect(&tcrc);
234 m_Tabs.ClientToScreen(&tcrc); 237 m_Tabs.ClientToScreen(&tcrc);
235 m_Tabs.SetItemSize(CSize(0,rbrc.top-tcrc.top-4)); 238 m_Tabs.SetItemSize(CSize(0,rbrc.top-tcrc.top-4));
236 m_Tabs.SetPadding(CSize(5,5)); 239 m_Tabs.SetPadding(CSize(5,5));
237 240
238 // Load Image List 241 // Load Image List
239 m_Images.Create(16,16,TRUE,2,1); 242 m_Images.Create(16,16,TRUE,2,1);
240 m_iNormal=m_Images.Add(AfxGetApp()->LoadIcon(IDI_KLOG)); 243 m_iNormal=m_Images.Add(AfxGetApp()->LoadIcon(IDI_KLOG));
241 m_iTriggered=m_Images.Add(AfxGetApp()->LoadIcon(IDI_KLOG_TRIGGERED)); 244 m_iTriggered=m_Images.Add(AfxGetApp()->LoadIcon(IDI_KLOG_TRIGGERED));
242 m_Tabs.SetImageList(&m_Images); 245 m_Tabs.SetImageList(&m_Images);
243 246
244 // Set Icons 247 // Set Icons
245 m_BrowseSoundCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_BROWSE)); 248 m_BrowseSoundCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_BROWSE));
246 m_PlaySoundCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PREPLAY)); 249 m_PlaySoundCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PREPLAY));
247 m_LogPatternCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_LOGPATTERN)); 250 m_LogPatternCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_LOGPATTERN));
248 251
249 // Create ToolTip Control 252 // Create ToolTip Control
250 m_tooltip.Create(this); 253 m_tooltip.Create(this);
251 m_tooltip.Activate(TRUE); 254 m_tooltip.Activate(TRUE);
252 255
253 // Restore Layout 256 // Restore Layout
254 OnFilesReset(); 257 OnFilesReset();
255 258
256 SetWindowPos(NULL,6,6,0,0,SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE); 259 SetWindowPos(NULL,6,6,0,0,SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE);
257 260
258 if(m_bShown) 261 if(m_bShown)
259 ShowWindow(SW_SHOW); 262 ShowWindow(SW_SHOW);
260 else 263 else
261 ShowWindow(SW_HIDE); 264 ShowWindow(SW_HIDE);
262 265
263 // Add Tips captions 266 // Add Tips captions
264 m_tooltip.AddTool(GetDlgItem(IDC_ADD),IDC_ADD); 267 m_tooltip.AddTool(GetDlgItem(IDC_ADD),IDC_ADD);
265 m_tooltip.AddTool(&m_RemoveCtl,IDC_REMOVE); 268 m_tooltip.AddTool(&m_RemoveCtl,IDC_REMOVE);
266 m_tooltip.AddTool(&m_LogLengthCtl,IDC_LOGLENGTH); 269 m_tooltip.AddTool(&m_LogLengthCtl,IDC_LOGLENGTH);
267 m_tooltip.AddTool(&m_LogLenSpinCtl,IDC_LOGLENGTH); 270 m_tooltip.AddTool(&m_LogLenSpinCtl,IDC_LOGLENGTH);
268 m_tooltip.AddTool(GetDlgItem(IDC_STATIC_LOGLENGTH),IDC_LOGLENGTH); 271 m_tooltip.AddTool(GetDlgItem(IDC_STATIC_LOGLENGTH),IDC_LOGLENGTH);
269 m_tooltip.AddTool(GetDlgItem(IDC_FILES),IDC_FILES); 272 m_tooltip.AddTool(GetDlgItem(IDC_FILES),IDC_FILES);
270 m_tooltip.AddTool(GetDlgItem(IDC_EXIT),IDC_EXIT); 273 m_tooltip.AddTool(GetDlgItem(IDC_EXIT),IDC_EXIT);
271 m_tooltip.AddTool(&m_LogtoFileCtl,IDC_TYPE_FILE); 274 m_tooltip.AddTool(&m_LogtoFileCtl,IDC_TYPE_FILE);
272 m_tooltip.AddTool(&m_LogtoHostCtl,IDC_TYPE_HOST); 275 m_tooltip.AddTool(&m_LogtoHostCtl,IDC_TYPE_HOST);
273 m_tooltip.AddTool(&m_LogtoNoneCtl,IDC_TYPE_NONE); 276 m_tooltip.AddTool(&m_LogtoNoneCtl,IDC_TYPE_NONE);
274 m_tooltip.AddTool(&m_hlCtl,IDC_HOSTS); 277 m_tooltip.AddTool(&m_hlCtl,IDC_HOSTS);
275 m_tooltip.AddTool(&m_Log,IDC_LOG); 278 m_tooltip.AddTool(&m_Log,IDC_LOG);
276 m_tooltip.AddTool(&m_LogPatternCtl,IDC_LOGPATTERN); 279 m_tooltip.AddTool(&m_LogPatternCtl,IDC_LOGPATTERN);
277 280
278 return TRUE; // return TRUE unless you set the focus to a control 281 return TRUE; // return TRUE unless you set the focus to a control
279} 282}
280 283
281void CKLogDlg::OnSysCommand(UINT nID, LPARAM lParam) 284void CKLogDlg::OnSysCommand(UINT nID, LPARAM lParam)
282{ 285{
283 switch(nID&0xFFF0){ 286 switch(nID&0xFFF0){
284 case IDM_ABOUTBOX: 287 case IDM_ABOUTBOX:
285 { 288 {
286 OnTrayAboutklog(); 289 OnTrayAboutklog();
287 } 290 }
288 break; 291 break;
289 case SC_CONTEXTHELP: 292 case SC_CONTEXTHELP:
290 AfxGetApp()->WinHelp(0,HELP_FINDER); 293 AfxGetApp()->WinHelp(0,HELP_FINDER);
291 break; 294 break;
292 default: 295 default:
293 CDialog::OnSysCommand(nID, lParam); 296 CDialog::OnSysCommand(nID, lParam);
294 break; 297 break;
295 } 298 }
296} 299}
297 300
298void CKLogDlg::OnDestroy() 301void CKLogDlg::OnDestroy()
299{ 302{
300NOTIFYICONDATA nid; 303NOTIFYICONDATA nid;
301 memset(&nid,0,sizeof(nid)); 304 memset(&nid,0,sizeof(nid));
302 nid.cbSize=sizeof(nid); 305 nid.cbSize=sizeof(nid);
303 nid.hWnd=m_Trayer->m_hWnd; 306 nid.hWnd=m_Trayer->m_hWnd;
304 nid.uID=IDC_TRAYICON; 307 nid.uID=IDC_TRAYICON;
305 nid.uFlags=0; 308 nid.uFlags=0;
306 VERIFY(Shell_NotifyIcon(NIM_DELETE,&nid)); 309 VERIFY(Shell_NotifyIcon(NIM_DELETE,&nid));
307 310
308 WinHelp(0L, HELP_QUIT); 311 WinHelp(0L, HELP_QUIT);
309 CDialog::OnDestroy(); 312 CDialog::OnDestroy();
310} 313}
311 314
312// If you add a minimize button to your dialog, you will need the code below 315// If you add a minimize button to your dialog, you will need the code below
313// to draw the icon. For MFC applications using the document/view model, 316// to draw the icon. For MFC applications using the document/view model,
314// this is automatically done for you by the framework. 317// this is automatically done for you by the framework.
315 318
316void CKLogDlg::OnPaint() 319void CKLogDlg::OnPaint()
317{ 320{
318 if (IsIconic()) 321 if (IsIconic())
319 { 322 {
320 CPaintDC dc(this); // device context for painting 323 CPaintDC dc(this); // device context for painting
321 324
322 SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); 325 SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
323 326
324 // Center icon in client rectangle 327 // Center icon in client rectangle
325 int cxIcon = GetSystemMetrics(SM_CXICON); 328 int cxIcon = GetSystemMetrics(SM_CXICON);
326 int cyIcon = GetSystemMetrics(SM_CYICON); 329 int cyIcon = GetSystemMetrics(SM_CYICON);
327 CRect rect; 330 CRect rect;
328 GetClientRect(&rect); 331 GetClientRect(&rect);
329 int x = (rect.Width() - cxIcon + 1) / 2; 332 int x = (rect.Width() - cxIcon + 1) / 2;
330 int y = (rect.Height() - cyIcon + 1) / 2; 333 int y = (rect.Height() - cyIcon + 1) / 2;
331 334
332 // Draw the icon 335 // Draw the icon
333 dc.DrawIcon(x, y, m_hIcon); 336 dc.DrawIcon(x, y, m_hIcon);
334 } 337 }
335 else 338 else
336 { 339 {
337 CPaintDC pDC(this); 340 CPaintDC pDC(this);
338 CDC bmpDC; 341 CDC bmpDC;
339 bmpDC.CreateCompatibleDC(&pDC); 342 bmpDC.CreateCompatibleDC(&pDC);
340 bmpDC.SelectObject(&m_bmpBack); 343 bmpDC.SelectObject(&m_bmpBack);
341 CRect rc; 344 CRect rc;
342 GetClientRect(&rc); 345 GetClientRect(&rc);
343 for(int x=-m_bitmapBack.bmWidth*2/4;x<rc.Width();x+=m_bitmapBack.bmWidth) 346 for(int x=-m_bitmapBack.bmWidth*2/4;x<rc.Width();x+=m_bitmapBack.bmWidth)
344 for(int y=-m_bitmapBack.bmHeight*2/4;y<rc.Height();y+=m_bitmapBack.bmHeight) 347 for(int y=-m_bitmapBack.bmHeight*2/4;y<rc.Height();y+=m_bitmapBack.bmHeight)
345 pDC.BitBlt(x,y,m_bitmapBack.bmWidth,m_bitmapBack.bmHeight,&bmpDC,0,0,SRCCOPY); 348 pDC.BitBlt(x,y,m_bitmapBack.bmWidth,m_bitmapBack.bmHeight,&bmpDC,0,0,SRCCOPY);
346 bmpDC.DeleteDC(); 349 bmpDC.DeleteDC();
347 CDialog::OnPaint(); 350 CDialog::OnPaint();
348 } 351 }
349} 352}
350 353
351// The system calls this to obtain the cursor to display while the user drags 354// The system calls this to obtain the cursor to display while the user drags
352// the minimized window. 355// the minimized window.
353HCURSOR CKLogDlg::OnQueryDragIcon() 356HCURSOR CKLogDlg::OnQueryDragIcon()
354{ 357{
355 return (HCURSOR) m_hIcon; 358 return (HCURSOR) m_hIcon;
356} 359}
357 360
358void CKLogDlg::OnAdd() 361void CKLogDlg::OnAdd()
359{ 362{
360CLogger *l = new CLogger(m_Tabs.GetItemCount()?FALSE:TRUE); 363CLogger *l = new CLogger(m_Tabs.GetItemCount()?FALSE:TRUE);
361 ASSERT(l); 364 ASSERT(l);
362 m_Logs[l]=l; 365 m_Logs[l]=l;
363TC_ITEM ptc; 366TC_ITEM ptc;
364 memset(&ptc,0,sizeof(ptc)); 367 memset(&ptc,0,sizeof(ptc));
365 ptc.mask=TCIF_TEXT|TCIF_IMAGE|TCIF_PARAM; 368 ptc.mask=TCIF_TEXT|TCIF_IMAGE|TCIF_PARAM;
366 ptc.pszText=(LPTSTR)(LPCTSTR)l->m_Desc; 369 ptc.pszText=(LPTSTR)(LPCTSTR)l->m_Desc;
367 ptc.iImage=m_iNormal; 370 ptc.iImage=m_iNormal;
368 ptc.lParam=(LPARAM)l; 371 ptc.lParam=(LPARAM)l;
369int tmp=m_Tabs.InsertItem(m_Tabs.GetItemCount(),&ptc); 372int tmp=m_Tabs.InsertItem(m_Tabs.GetItemCount(),&ptc);
370 m_Tabs.SetCurSel(tmp); 373 m_Tabs.SetCurSel(tmp);
371 SetTab(l); 374 SetTab(l);
372 m_RemoveCtl.EnableWindow(m_Tabs.GetItemCount()>1); 375 m_RemoveCtl.EnableWindow(m_Tabs.GetItemCount()>1);
373} 376}
374 377
375void CKLogDlg::OnSelchangeTabs(NMHDR* pNMHDR, LRESULT* pResult) 378void CKLogDlg::OnSelchangeTabs(NMHDR* pNMHDR, LRESULT* pResult)
376{ 379{
377int cs = m_Tabs.GetCurSel(); 380int cs = m_Tabs.GetCurSel();
378 ASSERT(cs>=0); 381 ASSERT(cs>=0);
379TC_ITEM ptci; 382TC_ITEM ptci;
380 memset(&ptci,0,sizeof(ptci)); 383 memset(&ptci,0,sizeof(ptci));
381 ptci.mask=TCIF_PARAM; 384 ptci.mask=TCIF_PARAM;
382 VERIFY(m_Tabs.GetItem(cs,&ptci)); 385 VERIFY(m_Tabs.GetItem(cs,&ptci));
383CLogger *l = (CLogger*)ptci.lParam; 386CLogger *l = (CLogger*)ptci.lParam;
384 memset(&ptci,0,sizeof(ptci)); 387 memset(&ptci,0,sizeof(ptci));
@@ -1176,192 +1179,219 @@ CLogEntry& CLogEntry::operator=(CLogEntry& src)
1176} 1179}
1177 1180
1178CLogEntry::CLogEntry(CLogEntry& src) 1181CLogEntry::CLogEntry(CLogEntry& src)
1179{ 1182{
1180 (*this)=src; 1183 (*this)=src;
1181} 1184}
1182 1185
1183void CKLogDlg::AddLogLine(CLogEntry *le) 1186void CKLogDlg::AddLogLine(CLogEntry *le)
1184{ 1187{
1185 ASSERT(le); 1188 ASSERT(le);
1186int i = m_Log.AddString(le->m_Data); 1189int i = m_Log.AddString(le->m_Data);
1187 m_Log.SetItemData(i,(DWORD)le); 1190 m_Log.SetItemData(i,(DWORD)le);
1188 m_Log.SetCurSel(i); 1191 m_Log.SetCurSel(i);
1189} 1192}
1190 1193
1191BOOL CKLogDlg::PreTranslateMessage(MSG* pMsg) 1194BOOL CKLogDlg::PreTranslateMessage(MSG* pMsg)
1192{ 1195{
1193 // CG: The following block was added by the ToolTips component. 1196 // CG: The following block was added by the ToolTips component.
1194 { 1197 {
1195 // Let the ToolTip process this message. 1198 // Let the ToolTip process this message.
1196 m_tooltip.RelayEvent(pMsg); 1199 m_tooltip.RelayEvent(pMsg);
1197 1200
1198 return CDialog::PreTranslateMessage(pMsg); 1201 return CDialog::PreTranslateMessage(pMsg);
1199 } 1202 }
1200} 1203}
1201 1204
1202void CKLogDlg::OnSelchangeLog() 1205void CKLogDlg::OnSelchangeLog()
1203{ 1206{
1204int i = m_Log.GetCurSel(); 1207int i = m_Log.GetCurSel();
1205 if(i==LB_ERR) 1208 if(i==LB_ERR)
1206 return; 1209 return;
1207CLogEntry *le = (CLogEntry*)m_Log.GetItemData(i); 1210CLogEntry *le = (CLogEntry*)m_Log.GetItemData(i);
1208 ASSERT(le); 1211 ASSERT(le);
1209CString tmp; 1212CString tmp;
1210 tmp.Format(IDS_TIP_LOG, 1213 tmp.Format(IDS_TIP_LOG,
1211 (LPCTSTR)le->m_Time.Format(IDS_LOGTIMEFORMAT), 1214 (LPCTSTR)le->m_Time.Format(IDS_LOGTIMEFORMAT),
1212 (LPCTSTR)le->m_Source, 1215 (LPCTSTR)le->m_Source,
1213 CSyslogSocket::m_Facilities[le->m_Facility], 1216 CSyslogSocket::m_Facilities[le->m_Facility],
1214 CSyslogSocket::m_Priorities[le->m_Priority] 1217 CSyslogSocket::m_Priorities[le->m_Priority]
1215 ); 1218 );
1216 m_tooltip.UpdateTipText(tmp,&m_Log); 1219 m_tooltip.UpdateTipText(tmp,&m_Log);
1217} 1220}
1218 1221
1219int CKLogDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) 1222int CKLogDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
1220{ 1223{
1221 if (CDialog::OnCreate(lpCreateStruct) == -1) 1224 if (CDialog::OnCreate(lpCreateStruct) == -1)
1222 return -1; 1225 return -1;
1223 1226
1224 if(!m_Trayer->Create(NULL,"PumpKIN TrayIcon",WS_CHILD,CRect(0,0,0,0),this,0)){ 1227 if(!m_Trayer->Create(NULL,"PumpKIN TrayIcon",WS_CHILD,CRect(0,0,0,0),this,0)){
1225 TRACE0("Failed to create trayer\n"); 1228 TRACE0("Failed to create trayer\n");
1226 return -1; 1229 return -1;
1227 } 1230 }
1228 1231
1229NOTIFYICONDATA nid; 1232NOTIFYICONDATA nid;
1230 memset(&nid,0,sizeof(nid)); 1233 memset(&nid,0,sizeof(nid));
1231 nid.cbSize=sizeof(nid); 1234 nid.cbSize=sizeof(nid);
1232 nid.hWnd=m_Trayer->m_hWnd; 1235 nid.hWnd=m_Trayer->m_hWnd;
1233 nid.uID=IDC_TRAYICON; 1236 nid.uID=IDC_TRAYICON;
1234 nid.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP; 1237 nid.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP;
1235 nid.uCallbackMessage=WM_TRAYICON; 1238 nid.uCallbackMessage=WM_TRAYICON;
1236 nid.hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME); 1239 nid.hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
1237 // *** Load from resource 1240 // *** Load from resource
1238 strcpy(nid.szTip,"KLog"); 1241 strcpy(nid.szTip,"KLog");
1239 VERIFY(Shell_NotifyIcon(NIM_ADD,&nid)); 1242 VERIFY(Shell_NotifyIcon(NIM_ADD,&nid));
1240 1243
1241 return 0; 1244 return 0;
1242} 1245}
1243 1246
1244void CKLogDlg::OnClose() 1247void CKLogDlg::OnClose()
1245{ 1248{
1246 OnTrayShowklogwindow(); 1249 OnTrayShowklogwindow();
1247} 1250}
1248 1251
1249void CKLogDlg::OnTrayAboutklog() 1252void CKLogDlg::OnTrayAboutklog()
1250{ 1253{
1251CAboutDlg dlgAbout; 1254CAboutDlg dlgAbout;
1252 dlgAbout.DoModal(); 1255 dlgAbout.DoModal();
1253} 1256}
1254 1257
1255void CKLogDlg::OnTrayExit() 1258void CKLogDlg::OnTrayExit()
1256{ 1259{
1257 OnExit(); 1260 OnExit();
1258} 1261}
1259 1262
1260void CKLogDlg::OnTrayShowklogwindow() 1263void CKLogDlg::OnTrayShowklogwindow()
1261{ 1264{
1262 if(IsWindowVisible()){ 1265 if(IsWindowVisible()){
1263 m_bShown=FALSE; 1266 m_bShown=FALSE;
1264 ShowWindow(SW_HIDE); 1267 ShowWindow(SW_HIDE);
1265 }else{ 1268 }else{
1266 m_bShown=TRUE; 1269 m_bShown=TRUE;
1267 ShowWindow(SW_SHOW); 1270 ShowWindow(SW_SHOW);
1268 SetForegroundWindow(); 1271 SetForegroundWindow();
1269 SetFocus(); 1272 SetFocus();
1270 } 1273 }
1271} 1274}
1272 1275
1273void CKLogDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) 1276void CKLogDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
1274{ 1277{
1275 CDialog::OnWindowPosChanging(lpwndpos); 1278 CDialog::OnWindowPosChanging(lpwndpos);
1276 1279
1277 if(!m_bExiting){ 1280 if(!m_bExiting){
1278 if(m_bShown){ 1281 if(m_bShown){
1279 lpwndpos->flags&=~SWP_HIDEWINDOW; 1282 lpwndpos->flags&=~SWP_HIDEWINDOW;
1280 lpwndpos->flags|=SWP_SHOWWINDOW; 1283 lpwndpos->flags|=SWP_SHOWWINDOW;
1281 }else{ 1284 }else{
1282 lpwndpos->flags&=~SWP_SHOWWINDOW; 1285 lpwndpos->flags&=~SWP_SHOWWINDOW;
1283 lpwndpos->flags|=SWP_HIDEWINDOW; 1286 lpwndpos->flags|=SWP_HIDEWINDOW;
1284 if(::GetForegroundWindow()==m_hWnd && (m_Trayer && !m_Trayer->m_inMenu)) 1287 if(::GetForegroundWindow()==m_hWnd && (m_Trayer && !m_Trayer->m_inMenu))
1285 GetDesktopWindow()->SetForegroundWindow(); 1288 GetDesktopWindow()->SetForegroundWindow();
1286 } 1289 }
1287 } 1290 }
1288} 1291}
1289 1292
1290void CKLogDlg::LoadSettings() 1293void CKLogDlg::LoadSettings()
1291{ 1294{
1292CWinApp *app = AfxGetApp(); 1295CWinApp *app = AfxGetApp();
1293 ASSERT(app); 1296 ASSERT(app);
1294 m_LogItems=app->GetProfileInt("UISettings","LogLength",m_LogItems); 1297 m_LogItems=app->GetProfileInt("UISettings","LogLength",m_LogItems);
1295 m_bShown=app->GetProfileInt("UISettings","Visible",m_bShown); 1298 m_bShown=app->GetProfileInt("UISettings","Visible",m_bShown);
1296 m_bWarnBlocking=app->GetProfileInt("Resolve","WarnBlocking",m_bWarnBlocking); 1299 m_bWarnBlocking=app->GetProfileInt("Resolve","WarnBlocking",m_bWarnBlocking);
1297 m_bDontWarn=app->GetProfileInt("Resolve","DontWarn",m_bDontWarn); 1300 m_bDontWarn=app->GetProfileInt("Resolve","DontWarn",m_bDontWarn);
1298} 1301}
1299 1302
1300void CKLogDlg::SaveSettings() 1303void CKLogDlg::SaveSettings()
1301{ 1304{
1302CWinApp *app = AfxGetApp(); 1305CWinApp *app = AfxGetApp();
1303 ASSERT(app); 1306 ASSERT(app);
1304 app->WriteProfileInt("UISettings","LogLength",m_LogItems); 1307 app->WriteProfileInt("UISettings","LogLength",m_LogItems);
1305 app->WriteProfileInt("UISettings","Visible",m_bShown); 1308 app->WriteProfileInt("UISettings","Visible",m_bShown);
1306 app->WriteProfileInt("Resolve","WarnBlocking",m_bWarnBlocking); 1309 app->WriteProfileInt("Resolve","WarnBlocking",m_bWarnBlocking);
1307 app->WriteProfileInt("Resolve","DontWarn",m_bDontWarn); 1310 app->WriteProfileInt("Resolve","DontWarn",m_bDontWarn);
1308CMemFile mf(4096); 1311CMemFile mf(4096);
1309CArchive ar(&mf,CArchive::store); 1312CArchive ar(&mf,CArchive::store);
1310 Serialize(ar); 1313 Serialize(ar);
1311 ar.Close(); 1314 ar.Close();
1312DWORD dataLength = mf.GetLength(); 1315DWORD dataLength = mf.GetLength();
1313 if(dataLength&0xFFFF0000l){ 1316 if(dataLength&0xFFFF0000l){
1314 CString tmp; 1317 CString tmp;
1315 tmp.LoadString(IDS_MSG_FAILEDTOSTORE); 1318 tmp.LoadString(IDS_MSG_FAILEDTOSTORE);
1316 MessageBox(tmp,NULL,MB_ICONHAND|MB_OK); 1319 MessageBox(tmp,NULL,MB_ICONHAND|MB_OK);
1317 }else{ 1320 }else{
1318 UINT dl = (UINT)dataLength; 1321 UINT dl = (UINT)dataLength;
1319 BYTE *data = mf.Detach(); 1322 BYTE *data = mf.Detach();
1320 app->WriteProfileBinary("Layout","Destinations",data,dl); 1323 app->WriteProfileBinary("Layout","Destinations",data,dl);
1321 delete data; 1324 delete data;
1322 } 1325 }
1323} 1326}
1324 1327
1325CKLogDlg::~CKLogDlg() 1328CKLogDlg::~CKLogDlg()
1326{ 1329{
1327 delete m_Trayer; 1330 delete m_Trayer;
1328} 1331}
1329 1332
1330void CKLogDlg::OnLogpattern() 1333void CKLogDlg::OnLogpattern()
1331{ 1334{
1332CLogPattern lp(IDS_LOGPATTERN_TITLE,this); 1335CLogPattern lp(IDS_LOGPATTERN_TITLE,this);
1333 memmove(lp.m_Pattern,m_Logger->m_LogPattern,sizeof(lp.m_Pattern)); 1336 memmove(lp.m_Pattern,m_Logger->m_LogPattern,sizeof(lp.m_Pattern));
1334 if(lp.DoModal()==IDOK){ 1337 if(lp.DoModal()==IDOK){
1335 memmove(m_Logger->m_LogPattern,lp.m_Pattern,sizeof(m_Logger->m_LogPattern)); 1338 memmove(m_Logger->m_LogPattern,lp.m_Pattern,sizeof(m_Logger->m_LogPattern));
1336 UpdatePriface(FALSE,TRUE); 1339 UpdatePriface(FALSE,TRUE);
1337 } 1340 }
1338} 1341}
1339 1342
1340void CLogger::LookupHost(CKLogDlg *daddy) 1343void CLogger::LookupHost(CKLogDlg *daddy)
1341{ 1344{
1342 m_LogToHost.sin_addr.s_addr=inet_addr((LPCTSTR)m_LogToName); 1345 m_LogToHost.sin_addr.s_addr=inet_addr((LPCTSTR)m_LogToName);
1343 if(m_LogToHost.sin_addr.s_addr==INADDR_NONE){ 1346 if(m_LogToHost.sin_addr.s_addr==INADDR_NONE){
1344 if(daddy->m_bWarnBlocking){ 1347 if(daddy->m_bWarnBlocking){
1345 CWarnBlocking wb(::IsWindow(daddy->m_hWnd)?daddy:NULL); 1348 CWarnBlocking wb(::IsWindow(daddy->m_hWnd)?daddy:NULL);
1346 wb.m_bDontWarn = daddy->m_bDontWarn; 1349 wb.m_bDontWarn = daddy->m_bDontWarn;
1347 if(wb.DoModal()!=IDOK) 1350 if(wb.DoModal()!=IDOK)
1348 return; 1351 return;
1349 daddy->m_bDontWarn=wb.m_bDontWarn; 1352 daddy->m_bDontWarn=wb.m_bDontWarn;
1350 daddy->m_bWarnBlocking=!wb.m_bDontWarn; 1353 daddy->m_bWarnBlocking=!wb.m_bDontWarn;
1351 } 1354 }
1352 daddy->BeginWaitCursor(); 1355 daddy->BeginWaitCursor();
1353 hostent *he = gethostbyname(m_LogToName); 1356 hostent *he = gethostbyname(m_LogToName);
1354 daddy->EndWaitCursor(); 1357 daddy->EndWaitCursor();
1355 if(he){ 1358 if(he){
1356 m_LogToHost.sin_addr.s_addr = *(DWORD*)he->h_addr; 1359 m_LogToHost.sin_addr.s_addr = *(DWORD*)he->h_addr;
1357 }else{ 1360 }else{
1358 m_LogToHost.sin_addr.s_addr = INADDR_NONE; 1361 m_LogToHost.sin_addr.s_addr = INADDR_NONE;
1359 if(daddy->m_bWarnBlocking){ 1362 if(daddy->m_bWarnBlocking){
1360 CString sux; 1363 CString sux;
1361 sux.Format(IDS_MSG_LOOKUPFAILED,(LPCTSTR)m_LogToName); 1364 sux.Format(IDS_MSG_LOOKUPFAILED,(LPCTSTR)m_LogToName);
1362 daddy->MessageBox(sux,NULL,MB_ICONSTOP|MB_OK); 1365 daddy->MessageBox(sux,NULL,MB_ICONSTOP|MB_OK);
1363 }else 1366 }else
1364 MessageBeep(MB_ICONHAND); 1367 MessageBeep(MB_ICONHAND);
1365 } 1368 }
1366 } 1369 }
1367} 1370}
1371
1372void CKLogDlg::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
1373{
1374 CDialog::OnGetMinMaxInfo(lpMMI);
1375 WINDOWPLACEMENT wp;
1376 if(IsWindow(m_CancelCtl.m_hWnd) && m_CancelCtl.GetWindowPlacement(&wp)) {
1377 CRect wr; GetWindowRect(wr);
1378 CRect cr; GetClientRect(cr);
1379 CSize ncs = (wr-cr).Size();
1380 CRect ctlr = wp.rcNormalPosition;
1381 CSize corner = ctlr.BottomRight()+ncs;
1382 lpMMI->ptMaxTrackSize.x = lpMMI->ptMinTrackSize.x = corner.cx;
1383 lpMMI->ptMinTrackSize.y = corner.cy;
1384 }
1385}
1386
1387void CKLogDlg::OnSize(UINT nType, int cx, int cy)
1388{
1389 CDialog::OnSize(nType, cx, cy);
1390 if(!IsWindow(m_Log.m_hWnd))
1391 return;
1392 WINDOWPLACEMENT lp; m_Log.GetWindowPlacement(&lp);
1393 CRect lr = lp.rcNormalPosition;
1394 lr.bottom = cy-2;
1395 CSize ls = lr.Size();
1396 m_Log.SetWindowPos(0,0,0,ls.cx,ls.cy,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER);
1397}