summaryrefslogtreecommitdiffabout
path: root/KLogDlg.cpp
authorMichael Krelin <hacker@klever.net>2005-07-06 21:49:03 (UTC)
committer Michael Krelin <hacker@klever.net>2005-07-06 21:49:03 (UTC)
commitbdbe0e4fff764357d0bb6236f22d6f1dcc0548ba (patch) (unidiff)
tree346c632a5308885dc657de9b724256c62c80f3b8 /KLogDlg.cpp
parentc8fe0207895827e5533f4100d203a187f021ebe8 (diff)
downloadklog-bdbe0e4fff764357d0bb6236f22d6f1dcc0548ba.zip
klog-bdbe0e4fff764357d0bb6236f22d6f1dcc0548ba.tar.gz
klog-bdbe0e4fff764357d0bb6236f22d6f1dcc0548ba.tar.bz2
added vertical resizability and changed version to trunk
git-svn-id: http://svn.klever.net/kin/klog/trunk@115 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (limited to 'KLogDlg.cpp') (more/less context) (ignore 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
@@ -41,216 +41,219 @@ public:
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);
@@ -1304,64 +1307,91 @@ CWinApp *app = AfxGetApp();
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}