// ConfCut.cpp : implementation file
//
#include "stdafx.h"
#include "scmtool.h"
#include "ConfCut.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ConfCut dialog
ConfCut::ConfCut(CWnd* pParent /*=NULL*/)
: CDialog(ConfCut::IDD, pParent)
{
//{{AFX_DATA_INIT(ConfCut)
//}}AFX_DATA_INIT
}
void ConfCut::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ConfCut)
DDX_Control(pDX, IDC_PROJECT, m_proj);
DDX_Control(pDX, IDC_CONFIGURATION, m_conf);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(ConfCut, CDialog)
//{{AFX_MSG_MAP(ConfCut)
ON_CBN_SELCHANGE(IDC_PROJECT, OnSelchangeProject)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// ConfCut message handlers
int ConfCut::OnInitDialog()
{
CDialog::OnInitDialog();
CString Buf = _T("");
CString project=_T("");
CString dir = "\\TempTxt\\mm.txt";
TCHAR* pFileName = dir.GetBuffer(0);
CAllPages::ConvertFileIntoString(pFileName,&Buf);
m_proj.ResetContent();
CAllPages::AddStringToCombo(&m_proj,Buf);
m_proj.SetCurSel(0);
OnSelchangeProject() ;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void ConfCut::OnSelchangeProject()
{
CString project=_T(""),Buf=_T(""),dir=_T(""),Command=_T("");
int place = m_proj.GetCurSel();
m_proj.GetLBText(place,project);
project.TrimRight();
dir = "\\TempTxt\\spc.txt";// project configuration
Command = CAllPages::rep("-pc") + project + " > " + CAllPages::GetCurDir() + dir;
CSCMToolApp::Waiting(Command,1,NULL,NULL);
TCHAR *pFileName = dir.GetBuffer(0);
Buf.Empty();
CAllPages::ConvertFileIntoString(pFileName,&Buf);
m_conf.ResetContent();
CAllPages::AddStringToCombo(&m_conf,Buf);
m_conf.AddString(_T("All"));
m_conf.SetCurSel(0);
}
void ConfCut::OnOK()
{
CString project=_T(""),configuration=_T(""),Buf=_T(""),dir=_T(""),Command=_T("");
int place = m_proj.GetCurSel();
m_proj.GetLBText(place,project);
project.TrimRight();
place = m_conf.GetCurSel();
m_conf.GetLBText(place,configuration);
configuration.TrimRight();
dir = CAllPages::GetCurDir()+ "\\TempTxt\\command.txt";
TCHAR* pFileName = dir.GetBuffer(0);
CStdioFile file;
CFileException e;
Command= _T(" -pp ") + project + _T(" ") + configuration ;
if (file.Open( pFileName, CFile::modeCreate | CFile::modeWrite , &e ))
{
file.WriteString(Command);
file.Close();
}
CDialog::OnOK();
}