00001
00007 #pragma once
00008 #include "../rpcdispatch/trassist.h"
00009
00011 class CTraceParamsDlg : public CDialogImpl<CTraceParamsDlg>
00012 {
00013 private:
00014 TraceAssistParams m_Params;
00015
00016 public:
00017 enum { IDD = IDD_TRACEPARAMS};
00018
00019 CTraceParamsDlg()
00020 {
00021 }
00022
00023 #pragma region Message maps
00024
00025 BEGIN_MSG_MAP(CTraceParamsDlg)
00026 MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
00027 COMMAND_ID_HANDLER(IDC_ENABLETRACE, OnParamsChanged);
00028 COMMAND_HANDLER(IDOK, BN_CLICKED, OnOK);
00029 COMMAND_HANDLER(IDCANCEL, BN_CLICKED, OnCancel);
00030 END_MSG_MAP()
00031
00032
00033 #pragma endregion
00034 #pragma region Message handlers
00035
00036
00037
00038
00039
00040
00041 LRESULT OnInitDialog(UINT , WPARAM , LPARAM , BOOL& bHandled)
00042 {
00043 BazisLib::RegistryKey key(HKEY_LOCAL_MACHINE, tszTraceAssistRegPath);
00044 key.DeserializeObject(m_Params);
00045 SendDlgItemMessage(IDC_ENABLETRACE, BM_SETCHECK, m_Params.TraceAssistEnabled ? BST_CHECKED : 0);
00046 SetDlgItemText(IDC_LOGDIR, m_Params.LogFileDirectory.c_str());
00047 SetDlgItemText(IDC_TRACEPREFIX, m_Params.MessagePrefix.c_str());
00048 SendDlgItemMessage(IDC_REPLACELOG, BM_SETCHECK, m_Params.OverwriteFileOnStart ? BST_CHECKED : 0);
00049 return OnParamsChanged(0, 0, 0, bHandled);
00050 }
00051
00052 LRESULT OnOK(WORD , WORD wID, HWND , BOOL& )
00053 {
00054 TCHAR tsz[MAX_PATH];
00055 m_Params.TraceAssistEnabled = ((SendDlgItemMessage(IDC_ENABLETRACE, BM_GETCHECK) & BST_CHECKED) != 0);
00056 GetDlgItemText(IDC_LOGDIR, tsz, __countof(tsz));
00057 m_Params.LogFileDirectory = tsz;
00058 GetDlgItemText(IDC_TRACEPREFIX, tsz, __countof(tsz));
00059 m_Params.MessagePrefix = tsz;
00060 m_Params.OverwriteFileOnStart = ((SendDlgItemMessage(IDC_REPLACELOG, BM_GETCHECK) & BST_CHECKED) != 0);
00061 BazisLib::RegistryKey key(HKEY_LOCAL_MACHINE, tszTraceAssistRegPath);
00062 key.SerializeObject(m_Params);
00063 EndDialog(IDOK);
00064 return 0;
00065 }
00066
00067 LRESULT OnCancel(WORD , WORD wID, HWND , BOOL& )
00068 {
00069 EndDialog(IDCANCEL);
00070 return 0;
00071 }
00072
00073 LRESULT OnParamsChanged(WORD , WORD wID, HWND , BOOL& )
00074 {
00075 m_Params.TraceAssistEnabled = ((SendDlgItemMessage(IDC_ENABLETRACE, BM_GETCHECK) & BST_CHECKED) != 0);
00076 GetDlgItem(IDC_LOGDIR).EnableWindow(m_Params.TraceAssistEnabled);
00077 GetDlgItem(IDC_TRACEPREFIX).EnableWindow(m_Params.TraceAssistEnabled);
00078 GetDlgItem(IDC_REPLACELOG).EnableWindow(m_Params.TraceAssistEnabled);
00079 GetDlgItem(IDC_LOGHINT).EnableWindow(m_Params.TraceAssistEnabled);
00080 return 0;
00081 }
00082 #pragma endregion
00083
00084 };