summaryrefslogtreecommitdiffabout
path: root/KLogDlg.cpp
Side-by-side diff
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
@@ -81,48 +81,49 @@ CKLogDlg::CKLogDlg(CWnd* pParent /*=NULL*/)
m_bDontWarn=TRUE;
//{{AFX_DATA_INIT(CKLogDlg)
m_Logto = -1;
m_Desc = _T("");
m_Facility = _T("");
m_HFName = _T("");
m_HFNameCaption = _T("");
m_hlIP = _T("");
m_hlMask = _T("");
m_Sound = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_bmpBack.LoadBitmap(IDB_BACKGROUND);
m_bmpBack.GetBitmap(&m_bitmapBack);
m_Trayer = new CTrayer(this);
ASSERT(m_Trayer);
LoadSettings();
}
void CKLogDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CKLogDlg)
+ DDX_Control(pDX, IDCANCEL, m_CancelCtl);
DDX_Control(pDX, IDC_LOGPATTERN, m_LogPatternCtl);
DDX_Control(pDX, IDC_FILES, m_FilesCtl);
DDX_Control(pDX, IDC_LOGLENSPIN, m_LogLenSpinCtl);
DDX_Control(pDX, IDC_LOGLENGTH, m_LogLengthCtl);
DDX_Control(pDX, IDC_INVERT, m_PriInvertCtl);
DDX_Control(pDX, IDC_TYPE_FILE, m_LogtoFileCtl);
DDX_Control(pDX, IDC_TYPE_HOST, m_LogtoHostCtl);
DDX_Control(pDX, IDC_TYPE_NONE, m_LogtoNoneCtl);
DDX_Control(pDX, IDC_HOSTORFILE, m_HFNameCaptionCtl);
DDX_Control(pDX, IDC_HOSTS, m_hlCtl);
DDX_Control(pDX, IDC_BROWSESOUND, m_BrowseSoundCtl);
DDX_Control(pDX, IDC_NONE, m_PriNoneCtl);
DDX_Control(pDX, IDC_HL_REMOVE, m_hlRemoveCtl);
DDX_Control(pDX, IDC_HL_MASK, m_hlMaskCtl);
DDX_Control(pDX, IDC_HL_IP, m_hlIPCtl);
DDX_Control(pDX, IDC_HL_ADD, m_hlAddCtl);
DDX_Control(pDX, IDC_ALL, m_PriAllCtl);
DDX_Control(pDX, IDC_SOUND, m_SoundCtl);
DDX_Control(pDX, IDC_REMOVE, m_RemoveCtl);
DDX_Control(pDX, IDC_PLAYSOUND, m_PlaySoundCtl);
DDX_Control(pDX, IDC_LOG, m_Log);
DDX_Control(pDX, IDC_HOSTFILE, m_HFNameCtl);
DDX_Control(pDX, IDC_FACILITY, m_FacilityCtl);
DDX_Control(pDX, IDC_BROWSE, m_BrowseCtl);
@@ -160,57 +161,59 @@ BEGIN_MESSAGE_MAP(CKLogDlg, CDialog)
ON_BN_CLICKED(IDC_HL_ADD, OnHlAdd)
ON_LBN_SELCHANGE(IDC_HOSTS, OnSelchangeHosts)
ON_BN_CLICKED(IDC_HL_REMOVE, OnHlRemove)
ON_BN_CLICKED(IDC_REMOVE, OnRemove)
ON_BN_CLICKED(IDC_PLAYSOUND, OnPlaysound)
ON_CBN_EDITCHANGE(IDC_SOUND, OnEditchangeSound)
ON_CBN_KILLFOCUS(IDC_SOUND, OnKillfocusSound)
ON_NOTIFY(UDN_DELTAPOS, IDC_LOGLENSPIN, OnDeltaposLoglenspin)
ON_BN_CLICKED(IDC_EXIT, OnExit)
ON_BN_CLICKED(IDC_FILES, OnFiles)
ON_COMMAND(ID_FILES_EXPORT, OnFilesExport)
ON_COMMAND(ID_FILES_IMPORT, OnFilesImport)
ON_BN_CLICKED(IDC_BROWSESOUND, OnBrowsesound)
ON_EN_KILLFOCUS(IDC_HOSTFILE, OnKillfocusHostfile)
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
ON_COMMAND(ID_FILES_RESET, OnFilesReset)
ON_LBN_SELCHANGE(IDC_LOG, OnSelchangeLog)
ON_WM_CREATE()
ON_WM_CLOSE()
ON_COMMAND(ID_TRAY_ABOUTKLOG, OnTrayAboutklog)
ON_COMMAND(ID_TRAY_EXIT, OnTrayExit)
ON_COMMAND(ID_TRAY_SHOWKLOGWINDOW, OnTrayShowklogwindow)
ON_WM_WINDOWPOSCHANGING()
ON_BN_CLICKED(IDC_LOGPATTERN, OnLogpattern)
+ ON_WM_GETMINMAXINFO()
ON_BN_CLICKED(IDC_CRIT, OnPriority)
ON_BN_CLICKED(IDC_DEBUG, OnPriority)
ON_BN_CLICKED(IDC_EMERG, OnPriority)
ON_BN_CLICKED(IDC_ERR, OnPriority)
ON_BN_CLICKED(IDC_INFO, OnPriority)
ON_BN_CLICKED(IDC_NOTICE, OnPriority)
ON_BN_CLICKED(IDC_WARNING, OnPriority)
ON_BN_CLICKED(IDC_TYPE_HOST, OnLogto)
ON_BN_CLICKED(IDC_TYPE_NONE, OnLogto)
+ ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CKLogDlg message handlers
BOOL CKLogDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
@@ -1344,24 +1347,51 @@ void CLogger::LookupHost(CKLogDlg *daddy)
if(daddy->m_bWarnBlocking){
CWarnBlocking wb(::IsWindow(daddy->m_hWnd)?daddy:NULL);
wb.m_bDontWarn = daddy->m_bDontWarn;
if(wb.DoModal()!=IDOK)
return;
daddy->m_bDontWarn=wb.m_bDontWarn;
daddy->m_bWarnBlocking=!wb.m_bDontWarn;
}
daddy->BeginWaitCursor();
hostent *he = gethostbyname(m_LogToName);
daddy->EndWaitCursor();
if(he){
m_LogToHost.sin_addr.s_addr = *(DWORD*)he->h_addr;
}else{
m_LogToHost.sin_addr.s_addr = INADDR_NONE;
if(daddy->m_bWarnBlocking){
CString sux;
sux.Format(IDS_MSG_LOOKUPFAILED,(LPCTSTR)m_LogToName);
daddy->MessageBox(sux,NULL,MB_ICONSTOP|MB_OK);
}else
MessageBeep(MB_ICONHAND);
}
}
}
+
+void CKLogDlg::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
+{
+ CDialog::OnGetMinMaxInfo(lpMMI);
+ WINDOWPLACEMENT wp;
+ if(IsWindow(m_CancelCtl.m_hWnd) && m_CancelCtl.GetWindowPlacement(&wp)) {
+ CRect wr; GetWindowRect(wr);
+ CRect cr; GetClientRect(cr);
+ CSize ncs = (wr-cr).Size();
+ CRect ctlr = wp.rcNormalPosition;
+ CSize corner = ctlr.BottomRight()+ncs;
+ lpMMI->ptMaxTrackSize.x = lpMMI->ptMinTrackSize.x = corner.cx;
+ lpMMI->ptMinTrackSize.y = corner.cy;
+ }
+}
+
+void CKLogDlg::OnSize(UINT nType, int cx, int cy)
+{
+ CDialog::OnSize(nType, cx, cy);
+ if(!IsWindow(m_Log.m_hWnd))
+ return;
+ WINDOWPLACEMENT lp; m_Log.GetWindowPlacement(&lp);
+ CRect lr = lp.rcNormalPosition;
+ lr.bottom = cy-2;
+ CSize ls = lr.Size();
+ m_Log.SetWindowPos(0,0,0,ls.cx,ls.cy,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER);
+}