// NeroDlg1.cpp : implementation file // #include "stdafx.h" #include "LYFZIPManage.h" #include "NeroDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif //#pragma comment(lib, "NeroAPIGlue.lib") ///////////////////////////////////////////////////////////////////////////// // CNeroDlg dialog CNeroDlg* pDlg; CNeroDlg::CNeroDlg(CWnd* pParent /*=NULL*/) : CDialog(CNeroDlg::IDD, pParent) { //{{AFX_DATA_INIT(CNeroDlg) m_bFromDir = 0; m_bDvd = 0; m_checkphoto1 = 1; m_checkphoto2 = FALSE; m_checkphoto3 = FALSE; m_checkphoto4 = FALSE; m_checkphoto5 = FALSE; m_checkphoto6 = FALSE; //}}AFX_DATA_INIT pDlg=this; NowDoingBurn=false; m_nphotos=0; m_nspase=0; m_nphotos1=0; m_nspase1=0; m_nphotos2=0; m_nspase2=0; m_nphotos3=0; m_nspase3=0; m_nphotos4=0; m_nspase4=0; m_nphotos5=0; m_nspase5=0; m_nphotos6=0; m_nspase6=0; } void CNeroDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CNeroDlg) DDX_Control(pDX, IDC_PROGRESS1, m_Progress); DDX_Radio(pDX, IDC_RADIO3, m_bFromDir); DDX_Radio(pDX, IDC_RADIO1, m_bDvd); DDX_Check(pDX, IDC_CHECK1, m_checkphoto1); DDX_Check(pDX, IDC_CHECK2, m_checkphoto2); DDX_Check(pDX, IDC_CHECK3, m_checkphoto3); DDX_Check(pDX, IDC_CHECK4, m_checkphoto4); DDX_Check(pDX, IDC_CHECK5, m_checkphoto5); DDX_Check(pDX, IDC_CHECK6, m_checkphoto6); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CNeroDlg, CDialog) //{{AFX_MSG_MAP(CNeroDlg) ON_BN_CLICKED(IDC_RADIO3, OnRadio3) ON_BN_CLICKED(IDC_RADIO4, OnRadio4) ON_BN_CLICKED(IDC_BUTchoosedir, OnBUTchoosedir) ON_BN_CLICKED(IDC_CHECK1, OnCheck1) ON_BN_CLICKED(IDC_CHECK2, OnCheck2) ON_BN_CLICKED(IDC_CHECK3, OnCheck3) ON_BN_CLICKED(IDC_CHECK4, OnCheck4) ON_BN_CLICKED(IDC_CHECK5, OnCheck5) ON_BN_CLICKED(IDC_CHECK6, OnCheck6) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CNeroDlg message handlers BOOL CNeroDlg::OnInitDialog() { CDialog::OnInitDialog(); m_Progress.SetRange(0,100); EnableCtrls(); OnCheck1(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } bool NERO_CALLBACK_ATTR CNeroDlg::IdleCallback(void *pUserData) { /* static MSG msg; while (!(((CNeroMFCappDlg*)pUserData)->mbAborted) &&::PeekMessage(&msg,NULL,NULL,NULL,PM_NOREMOVE)) { if (!AfxGetThread()->PumpMessage()) { break; } } return ((CNeroMFCappDlg*)pUserData)->mbAborted; */ // AfxMessageBox("dsfsf",1,1); return true; } NeroUserDlgInOut NERO_CALLBACK_ATTR CNeroDlg::UserDialog(void *pUserData, NeroUserDlgInOut type, void *data) { AfxMessageBox("Dlg_USERDIALOG",1,1); switch (type) { case DLG_AUTO_INSERT: AfxMessageBox("Dlg_AUTO_INSET",1,1); return DLG_RETURN_CONTINUE; break; AfxMessageBox("Dlg_RETURN_CONTINUE",1,1); case DLG_DISCONNECT_RESTART: AfxMessageBox("Dlg_DISCONNECT_RESTART",1,1); return DLG_RETURN_ON_RESTART; break; case DLG_DISCONNECT: AfxMessageBox("Dlg_DISCONNECT",1,1); return DLG_RETURN_CONTINUE; break; case DLG_AUTO_INSERT_RESTART: AfxMessageBox("Dlg_AUTO_INSERT_RESTART",1,1); return DLG_RETURN_EXIT; break; case DLG_RESTART: AfxMessageBox("Dlg_RESTART",1,1); return DLG_RETURN_EXIT; break; case DLG_SETTINGS_RESTART: AfxMessageBox("DLG_SETTINGS_RESTART:",1,1); return DLG_RETURN_CONTINUE; break; case DLG_OVERBURN: AfxMessageBox("DLG_OVERBURN::",1,1); return DLG_RETURN_TRUE; break; case DLG_AUDIO_PROBLEMS: AfxMessageBox("DLG_AUDIO_PROBLEMS:",1,1); return DLG_RETURN_EXIT; break; case DLG_WAITCD: AfxMessageBox("Please insert a CDR or just click OK if you are using the Image Recorder."); return DLG_RETURN_EXIT; break; case DLG_WAITCD_REMINDER: break; case DLG_WAITCD_DONE: return DLG_RETURN_EXIT; break; case DLG_FILESEL_IMAGE: { static char BASED_CODE szFilter[] = "Image Files(*.nrg)|*.nrg|All Files (*.*)|*.*||"; CFileDialog dlgOpen(TRUE, NULL, "test.nrg", OFN_OVERWRITEPROMPT, szFilter, ((CNeroDlg*)pUserData)); if (dlgOpen.DoModal() == IDOK) { strcpy((char*)data,dlgOpen.GetPathName()); return DLG_RETURN_TRUE; } else { return DLG_BURNIMAGE_CANCEL; } } break; default: break; } return DLG_RETURN_EXIT; } BOOL NERO_CALLBACK_ATTR CNeroDlg::ProgressCallback(void *pUserData, DWORD dwProgressInPercent) { ((CNeroDlg*)pUserData)->m_Progress.SetPos(dwProgressInPercent); //return ((CNeroMFCappDlg*)pUserData)->mbAborted; //AfxMessageBox("dsfsdf"); return true; } BOOL NERO_CALLBACK_ATTR CNeroDlg::AbortedCallback(void *pUserData) { //return ((CNeroMFCappDlg*)pUserData)->mbAborted; return true; } void NERO_CALLBACK_ATTR CNeroDlg::AddLogLine(void *pUserData, NERO_TEXT_TYPE type, const char *text) { //((CNeroMFCappDlg*)pUserData)->AppendString("Log line:" +(CString)*text); return; } void NERO_CALLBACK_ATTR CNeroDlg::SetPhaseCallback(void *pUserData, const char *text) { //((CNeroMFCappDlg*)pUserData)->AppendString("Phase: " +(CString)*text); return; } void GenSPhoto(CString dir, CStringArray &array) { //AfxMessageBox(dir); using namespace helper_coffs; ffsco o; o.dirs(0); o.find(LPCSTR(dir), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); CString str; for (it = coo.begin(); coo.end() != it; it ++) { str=(*it).c_str(); if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue; if(str.Right (2)=="ok")continue; array.Add (str); } } int GetChildCount(CString str, CStringArray &array) { CString dirname=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1); int count=array.GetSize (); CString temp; for(int i=0; iEnableWindow(!m_bFromDir); GetDlgItem(IDC_CHECK2)->EnableWindow(!m_bFromDir); GetDlgItem(IDC_CHECK3)->EnableWindow(!m_bFromDir); GetDlgItem(IDC_CHECK4)->EnableWindow(!m_bFromDir); GetDlgItem(IDC_CHECK5)->EnableWindow(!m_bFromDir); GetDlgItem(IDC_CHECK6)->EnableWindow(!m_bFromDir); GetDlgItem(IDC_BUTchoosedir)->EnableWindow(m_bFromDir); } void CNeroDlg::OnRadio3() { // TODO: Add your control notification handler code here UpdateData(); EnableCtrls(); } void CNeroDlg::OnRadio4() { // TODO: Add your control notification handler code here OnRadio3(); } void CNeroDlg::OnBUTchoosedir() { // TODO: Add your control notification handler code here CString dir; GetSavePath(dir); dir.IsEmpty(); GetDlgItem(IDC_EDIT1)->SetWindowText(dir); m_photoarray7.RemoveAll (); CString path; path =dir; CStringArray dirarray; CString str; using namespace helper_coffs; ffsco o; o.dirs(1); o.find(LPCSTR(path), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_dir(); for (it = coo.begin(); coo.end() != it; it ++) { str=(*it).c_str(); if(FindArray(&dirarray, str)==-1) { dirarray.Add (str); } } for(int i=0; iSetWindowText(str); } void CNeroDlg::OnCheck1() { // TODO: Add your control notification handler code here UpdateData(); if(m_checkphoto1) { if(m_photoarray1.GetSize ()==0) { CString path; path=g_path4+"\\"; path+=m_id; path +="\\"; CStringArray dirarray; CString str; using namespace helper_coffs; ffsco o; o.dirs(1); o.find(LPCSTR(path), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_dir(); for (it = coo.begin(); coo.end() != it; it ++) { str=(*it).c_str(); if(FindArray(&dirarray, str)==-1) { dirarray.Add (str); } } for(int i=0; iSetWindowText(str); m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6; m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024); } void CNeroDlg::OnCheck2() { // TODO: Add your control notification handler code here UpdateData(); if(m_checkphoto2) { if(m_checkphoto5) m_checkphoto5=0; UpdateData(false); OnCheck5(); if(m_photoarray2.GetSize ()==0) { CString path; path=g_path2+"\\"; path+=m_id; path +="\\"; CString filter="id='"+m_id+"'"; g_sendhead.bsql=0; g_sendhead.code[0]=50; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; CArraysparray; DataToArray( &sparray); CString str,spname; CStringArray noarray; CStringArray spnamearray; for(int i=0; iSetWindowText(str); m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6; m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024); } void CNeroDlg::OnCheck3() { // TODO: Add your control notification handler code here UpdateData(); if(m_checkphoto3) { if(m_checkphoto4) m_checkphoto4=0; UpdateData(false); OnCheck4(); if(m_photoarray3.GetSize ()==0) { CString path; path=g_path1+"\\"; path+=m_id; path +="\\"; CString filter="id='"+m_id+"'"; g_sendhead.bsql=0; g_sendhead.code[0]=50; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; CArraysparray; DataToArray( &sparray); CString str,spname; CStringArray noarray; CStringArray spnamearray; for(int i=0; iSetWindowText(str); m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6; m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024); } void CNeroDlg::OnCheck4() { // TODO: Add your control notification handler code here UpdateData(); if(m_checkphoto4) { if(m_checkphoto3) m_checkphoto3=0; UpdateData(false); OnCheck3(); if(m_photoarray4.GetSize ()==0) { CString path; path=g_path1+"\\"; path+=m_id; path +="\\"; CStringArray dirarray; CString str; using namespace helper_coffs; ffsco o; o.dirs(1); o.find(LPCSTR(path), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_dir(); for (it = coo.begin(); coo.end() != it; it ++) { str=(*it).c_str(); if(FindArray(&dirarray, str)==-1) { dirarray.Add (str); } } for(int i=0; iSetWindowText(str); m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6; m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024); } void CNeroDlg::OnCheck5() { // TODO: Add your control notification handler code here UpdateData(); if(m_checkphoto5) { if(m_checkphoto2) m_checkphoto2=0; UpdateData(false); OnCheck2(); if(m_photoarray5.GetSize ()==0) { CString path; path=g_path2+"\\"; path+=m_id; path +="\\"; CStringArray dirarray; CString str; using namespace helper_coffs; ffsco o; o.dirs(1); o.find(LPCSTR(path), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_dir(); for (it = coo.begin(); coo.end() != it; it ++) { str=(*it).c_str(); if(FindArray(&dirarray, str)==-1) { dirarray.Add (str); } } for(int i=0; iSetWindowText(str); m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6; m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024); } void CNeroDlg::OnCheck6() { // TODO: Add your control notification handler code here UpdateData(); if(m_checkphoto6) { if(m_photoarray6.GetSize ()==0) { CString path; path=g_path3+"\\"; path+=m_id; path +="\\"; CStringArray dirarray; CString str; using namespace helper_coffs; ffsco o; o.dirs(1); o.find(LPCSTR(path), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_dir(); for (it = coo.begin(); coo.end() != it; it ++) { str=(*it).c_str(); if(FindArray(&dirarray, str)==-1) { dirarray.Add (str); } } for(int i=0; iSetWindowText(str); m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6; m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024); } void CNeroDlg::GetNo(CString str, CStringArray &array) { if(!str.IsEmpty ()) { int pos=str.Find (","); while(pos!=-1) { if(FindArray(&array, str.Left (pos))==-1) array.Add (str.Left (pos)); str=str.Right (str.GetLength ()-pos-1); pos=str.Find (","); } if(FindArray(&array, str)==-1) array.Add(str); } } void CNeroDlg::OnOK() { UpdateData(); if(m_nphotos==0) { AfxMessageBox("未选中照片!", MB_ICONSTOP); return; } if(m_nspase>650 && m_bDvd==0) { AfxMessageBox("光盘空间不足!", MB_ICONSTOP); return; } m_Burn.m_DirArray.RemoveAll (); m_Burn.m_DirRealNameArray.RemoveAll (); GetDlgItem(IDOK)->SetWindowText("刻录中, 请稍候..."); GetDlgItem(IDOK)->EnableWindow(0); if(NowDoingBurn) return; CStringArray dirarray; using namespace helper_coffs; CStringArray srcarray; if(m_bFromDir) { CString str; GetDlgItemText(IDC_EDIT1, str); str.TrimRight ('\\'); m_Burn.m_DirArray.Add (str); m_Burn.m_DirRealNameArray.Add (str); } else { if(m_checkphoto1) { m_Burn.m_DirArray.Add (g_path4+"\\"+m_id); m_Burn.m_DirRealNameArray.Add (g_path4+"\\"+m_id+"(精修)"); } if(m_checkphoto5) { m_Burn.m_DirArray.Add (g_path2+"\\"+m_id); m_Burn.m_DirRealNameArray.Add (g_path2+"\\"+m_id+"(初修)"); } if(m_checkphoto4) { m_Burn.m_DirArray.Add (g_path1+"\\"+m_id); m_Burn.m_DirRealNameArray.Add (g_path1+"\\"+m_id+"(原片)"); } if(m_checkphoto6) { m_Burn.m_DirArray.Add (g_path3+"\\"+m_id); m_Burn.m_DirRealNameArray.Add (g_path3+"\\"+m_id+"(设计片)"); } } CString str; for(int i=0; i