// PathSettingDlg.cpp : ±¸Çö ÆÄÀÏÀÔ´Ï´Ù.
|
//
|
|
#include "stdafx.h"
|
#include "LogView.h"
|
#include "PathSettingDlg.h"
|
#include "PathData.h"
|
#include "InsertPathDlg.h"
|
|
|
// CPathSettingDlg ´ëÈ »óÀÚÀÔ´Ï´Ù.
|
|
IMPLEMENT_DYNAMIC(CPathSettingDlg, CDialog)
|
|
void CPathSettingDlg::Init(CPathData* pPathData)
|
{
|
m_pPathData = pPathData;
|
|
//int a =pView->m_nLogID[0];
|
}
|
|
CPathSettingDlg::CPathSettingDlg(CWnd* pParent /*=NULL*/)
|
: CDialog(CPathSettingDlg::IDD, pParent)
|
{
|
|
}
|
|
CPathSettingDlg::~CPathSettingDlg()
|
{
|
}
|
|
void CPathSettingDlg::DoDataExchange(CDataExchange* pDX)
|
{
|
CDialog::DoDataExchange(pDX);
|
DDX_Control(pDX, IDC_PathList, m_LogPathList);
|
}
|
|
|
BEGIN_MESSAGE_MAP(CPathSettingDlg, CDialog)
|
ON_BN_CLICKED(IDC_InsertPathData, &CPathSettingDlg::OnBnClickedInsertpathdata)
|
ON_BN_CLICKED(IDOK, &CPathSettingDlg::OnBnClickedOk)
|
ON_BN_CLICKED(IDC_DeletePath, &CPathSettingDlg::OnBnClickedDeletepath)
|
END_MESSAGE_MAP()
|
|
|
// CPathSettingDlg ¸Þ½ÃÁö 󸮱âÀÔ´Ï´Ù.
|
|
void CPathSettingDlg::OnBnClickedInsertpathdata()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
TCHAR strName[128] = {0};
|
TCHAR strPath[128] = {0};
|
int LogID = -1;
|
CString strLogID = _T("");
|
|
int PathCount = 0;
|
|
CInsertPathDlg InsertDlg;
|
|
InsertDlg.SetRetValue(&LogID,strName,strPath);
|
if(InsertDlg.DoModal() == IDOK)
|
{
|
PathCount = m_LogPathList.GetItemCount();
|
strLogID.Format(_T("%d"),LogID);
|
m_LogPathList.InsertItem(PathCount, strLogID);
|
|
m_LogPathList.SetItemText(PathCount, 1, strName);
|
m_LogPathList.SetItemText(PathCount, 2, strPath);
|
}
|
}
|
|
void CPathSettingDlg::InitList(void)
|
{
|
m_LogPathList.InsertColumn(0, _T("·Î±×ID"), 0, 70);
|
m_LogPathList.InsertColumn(1, _T("·Î±× À̸§"), 0, 90);
|
m_LogPathList.InsertColumn(2, _T("ÁöÁ¤ Æú´õ"), 0, 280);
|
m_LogPathList.SetExtendedStyle(LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT);
|
|
int PathCount = 0;
|
int LogID = -1;
|
CString strLogID = _T("");
|
CString strLogName = _T("");
|
CString strLogPath = _T("");
|
|
for( int i = 0; i< LV_FCOUNT; i++)
|
{
|
LogID = m_pPathData->GetIDFromIndex(i);
|
if(LogID == -1)
|
continue;
|
|
strLogID = _T("");
|
strLogID.Format(_T("%d"),LogID);
|
|
m_LogPathList.InsertItem(PathCount, strLogID);
|
|
m_LogPathList.SetItemText(PathCount, 1, m_pPathData->GetNameFromIndex(i));
|
m_LogPathList.SetItemText(PathCount, 2, m_pPathData->GetPathFromIndex(i));
|
|
PathCount++;
|
}
|
}
|
|
BOOL CPathSettingDlg::OnInitDialog()
|
{
|
CDialog::OnInitDialog();
|
|
// TODO: ¿©±â¿¡ Ãß°¡ ÃʱâÈ ÀÛ¾÷À» Ãß°¡ÇÕ´Ï´Ù.
|
InitList();
|
return TRUE; // return TRUE unless you set the focus to a control
|
// ¿¹¿Ü: OCX ¼Ó¼º ÆäÀÌÁö´Â FALSE¸¦ ¹ÝÈ¯ÇØ¾ß ÇÕ´Ï´Ù.
|
}
|
|
void CPathSettingDlg::OnBnClickedOk()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
|
bool result = false;
|
CString strLogID = _T("");
|
CString strLogName = _T("");
|
CString strLogPath = _T("");
|
int LogID = -1;
|
|
m_pPathData->InitPathData();
|
|
int Count = m_LogPathList.GetItemCount();
|
for( int i = 0; i< Count; i++)
|
{
|
strLogID = m_LogPathList.GetItemText(i, 0);
|
LogID = _ttoi(strLogID);
|
strLogName = m_LogPathList.GetItemText(i, 1);
|
strLogPath = m_LogPathList.GetItemText(i, 2);
|
|
|
result = m_pPathData->ModifyPathData(LogID,strLogName, strLogPath);
|
if( result == false)
|
m_pPathData->InsertPathData(LogID, strLogName, strLogPath);
|
}
|
|
AfxMessageBox(_T("ÇÁ·Î±×·¥À» Àç°¡µ¿ÇÏ¸é º¯°æµÈ ·Î±× ¼³Á¤ÀÌ Àû¿ëµË´Ï´Ù."));
|
|
OnOK();
|
}
|
|
void CPathSettingDlg::OnBnClickedDeletepath()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
int nSelRow = m_LogPathList.GetSelectionMark();
|
if( nSelRow == -1)
|
{
|
AfxMessageBox(_T("»èÁ¦ÇÒ Ç׸ñÀ» ¼±ÅÃÇϼ¼¿ä."));
|
return ;
|
}
|
|
m_LogPathList.DeleteItem(nSelRow);
|
}
|