NeroDlg.cpp 22 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. // NeroDlg1.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "NeroDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. //#pragma comment(lib, "NeroAPIGlue.lib")
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CNeroDlg dialog
  14. CNeroDlg* pDlg;
  15. CNeroDlg::CNeroDlg(CWnd* pParent /*=NULL*/)
  16. : CDialog(CNeroDlg::IDD, pParent)
  17. {
  18. //{{AFX_DATA_INIT(CNeroDlg)
  19. m_bFromDir = 0;
  20. m_bDvd = 0;
  21. m_checkphoto1 = 1;
  22. m_checkphoto2 = FALSE;
  23. m_checkphoto3 = FALSE;
  24. m_checkphoto4 = FALSE;
  25. m_checkphoto5 = FALSE;
  26. m_checkphoto6 = FALSE;
  27. //}}AFX_DATA_INIT
  28. pDlg=this;
  29. NowDoingBurn=false;
  30. m_nphotos=0;
  31. m_nspase=0;
  32. m_nphotos1=0;
  33. m_nspase1=0;
  34. m_nphotos2=0;
  35. m_nspase2=0;
  36. m_nphotos3=0;
  37. m_nspase3=0;
  38. m_nphotos4=0;
  39. m_nspase4=0;
  40. m_nphotos5=0;
  41. m_nspase5=0;
  42. m_nphotos6=0;
  43. m_nspase6=0;
  44. }
  45. void CNeroDlg::DoDataExchange(CDataExchange* pDX)
  46. {
  47. CDialog::DoDataExchange(pDX);
  48. //{{AFX_DATA_MAP(CNeroDlg)
  49. DDX_Control(pDX, IDC_PROGRESS1, m_Progress);
  50. DDX_Radio(pDX, IDC_RADIO3, m_bFromDir);
  51. DDX_Radio(pDX, IDC_RADIO1, m_bDvd);
  52. DDX_Check(pDX, IDC_CHECK1, m_checkphoto1);
  53. DDX_Check(pDX, IDC_CHECK2, m_checkphoto2);
  54. DDX_Check(pDX, IDC_CHECK3, m_checkphoto3);
  55. DDX_Check(pDX, IDC_CHECK4, m_checkphoto4);
  56. DDX_Check(pDX, IDC_CHECK5, m_checkphoto5);
  57. DDX_Check(pDX, IDC_CHECK6, m_checkphoto6);
  58. //}}AFX_DATA_MAP
  59. }
  60. BEGIN_MESSAGE_MAP(CNeroDlg, CDialog)
  61. //{{AFX_MSG_MAP(CNeroDlg)
  62. ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
  63. ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
  64. ON_BN_CLICKED(IDC_BUTchoosedir, OnBUTchoosedir)
  65. ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
  66. ON_BN_CLICKED(IDC_CHECK2, OnCheck2)
  67. ON_BN_CLICKED(IDC_CHECK3, OnCheck3)
  68. ON_BN_CLICKED(IDC_CHECK4, OnCheck4)
  69. ON_BN_CLICKED(IDC_CHECK5, OnCheck5)
  70. ON_BN_CLICKED(IDC_CHECK6, OnCheck6)
  71. //}}AFX_MSG_MAP
  72. END_MESSAGE_MAP()
  73. /////////////////////////////////////////////////////////////////////////////
  74. // CNeroDlg message handlers
  75. BOOL CNeroDlg::OnInitDialog()
  76. {
  77. CDialog::OnInitDialog();
  78. m_Progress.SetRange(0,100);
  79. EnableCtrls();
  80. OnCheck1();
  81. return TRUE; // return TRUE unless you set the focus to a control
  82. // EXCEPTION: OCX Property Pages should return FALSE
  83. }
  84. bool NERO_CALLBACK_ATTR CNeroDlg::IdleCallback(void *pUserData)
  85. {
  86. /*
  87. static MSG msg;
  88. while (!(((CNeroMFCappDlg*)pUserData)->mbAborted) &&::PeekMessage(&msg,NULL,NULL,NULL,PM_NOREMOVE))
  89. {
  90. if (!AfxGetThread()->PumpMessage())
  91. {
  92. break;
  93. }
  94. }
  95. return ((CNeroMFCappDlg*)pUserData)->mbAborted;
  96. */
  97. // AfxMessageBox("dsfsf",1,1);
  98. return true;
  99. }
  100. NeroUserDlgInOut NERO_CALLBACK_ATTR CNeroDlg::UserDialog(void *pUserData, NeroUserDlgInOut type, void *data)
  101. {
  102. AfxMessageBox("Dlg_USERDIALOG",1,1);
  103. switch (type)
  104. {
  105. case DLG_AUTO_INSERT:
  106. AfxMessageBox("Dlg_AUTO_INSET",1,1);
  107. return DLG_RETURN_CONTINUE;
  108. break;
  109. AfxMessageBox("Dlg_RETURN_CONTINUE",1,1);
  110. case DLG_DISCONNECT_RESTART:
  111. AfxMessageBox("Dlg_DISCONNECT_RESTART",1,1);
  112. return DLG_RETURN_ON_RESTART;
  113. break;
  114. case DLG_DISCONNECT:
  115. AfxMessageBox("Dlg_DISCONNECT",1,1);
  116. return DLG_RETURN_CONTINUE;
  117. break;
  118. case DLG_AUTO_INSERT_RESTART:
  119. AfxMessageBox("Dlg_AUTO_INSERT_RESTART",1,1);
  120. return DLG_RETURN_EXIT;
  121. break;
  122. case DLG_RESTART:
  123. AfxMessageBox("Dlg_RESTART",1,1);
  124. return DLG_RETURN_EXIT;
  125. break;
  126. case DLG_SETTINGS_RESTART:
  127. AfxMessageBox("DLG_SETTINGS_RESTART:",1,1);
  128. return DLG_RETURN_CONTINUE;
  129. break;
  130. case DLG_OVERBURN:
  131. AfxMessageBox("DLG_OVERBURN::",1,1);
  132. return DLG_RETURN_TRUE;
  133. break;
  134. case DLG_AUDIO_PROBLEMS:
  135. AfxMessageBox("DLG_AUDIO_PROBLEMS:",1,1);
  136. return DLG_RETURN_EXIT;
  137. break;
  138. case DLG_WAITCD:
  139. AfxMessageBox("Please insert a CDR or just click OK if you are using the Image Recorder.");
  140. return DLG_RETURN_EXIT;
  141. break;
  142. case DLG_WAITCD_REMINDER:
  143. break;
  144. case DLG_WAITCD_DONE:
  145. return DLG_RETURN_EXIT;
  146. break;
  147. case DLG_FILESEL_IMAGE:
  148. {
  149. static char BASED_CODE szFilter[] = "Image Files(*.nrg)|*.nrg|All Files (*.*)|*.*||";
  150. CFileDialog dlgOpen(TRUE, NULL, "test.nrg", OFN_OVERWRITEPROMPT,
  151. szFilter, ((CNeroDlg*)pUserData));
  152. if (dlgOpen.DoModal() == IDOK)
  153. {
  154. strcpy((char*)data,dlgOpen.GetPathName());
  155. return DLG_RETURN_TRUE;
  156. }
  157. else
  158. {
  159. return DLG_BURNIMAGE_CANCEL;
  160. }
  161. }
  162. break;
  163. default:
  164. break;
  165. }
  166. return DLG_RETURN_EXIT;
  167. }
  168. BOOL NERO_CALLBACK_ATTR CNeroDlg::ProgressCallback(void *pUserData, DWORD dwProgressInPercent)
  169. {
  170. ((CNeroDlg*)pUserData)->m_Progress.SetPos(dwProgressInPercent);
  171. //return ((CNeroMFCappDlg*)pUserData)->mbAborted;
  172. //AfxMessageBox("dsfsdf");
  173. return true;
  174. }
  175. BOOL NERO_CALLBACK_ATTR CNeroDlg::AbortedCallback(void *pUserData)
  176. {
  177. //return ((CNeroMFCappDlg*)pUserData)->mbAborted;
  178. return true;
  179. }
  180. void NERO_CALLBACK_ATTR CNeroDlg::AddLogLine(void *pUserData, NERO_TEXT_TYPE type, const char *text)
  181. {
  182. //((CNeroMFCappDlg*)pUserData)->AppendString("Log line:" +(CString)*text);
  183. return;
  184. }
  185. void NERO_CALLBACK_ATTR CNeroDlg::SetPhaseCallback(void *pUserData, const char *text)
  186. {
  187. //((CNeroMFCappDlg*)pUserData)->AppendString("Phase: " +(CString)*text);
  188. return;
  189. }
  190. void GenSPhoto(CString dir, CStringArray &array)
  191. { //AfxMessageBox(dir);
  192. using namespace helper_coffs;
  193. ffsco o;
  194. o.dirs(0);
  195. o.find(LPCSTR(dir), LPCSTR("*.*"));
  196. ffsco::typeT coo;
  197. ffsco::typeT::iterator it;
  198. coo = o.co_file();
  199. CString str;
  200. for (it = coo.begin();
  201. coo.end() != it;
  202. it ++)
  203. {
  204. str=(*it).c_str();
  205. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  206. if(str.Right (2)=="ok")continue;
  207. array.Add (str);
  208. }
  209. }
  210. int GetChildCount(CString str, CStringArray &array)
  211. {
  212. CString dirname=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  213. int count=array.GetSize ();
  214. CString temp;
  215. for(int i=0; i<array.GetSize (); i++)
  216. {
  217. if(array.ElementAt (i)==str)
  218. count--;
  219. else if(array.ElementAt (i).Find (str)==-1)
  220. count--;
  221. else
  222. {
  223. temp=array.ElementAt (i);
  224. temp=temp.Left (temp.ReverseFind ('\\'));
  225. if(temp!=str)
  226. count--;
  227. }
  228. }
  229. return count;
  230. }
  231. void CNeroDlg::OnCancel()
  232. {
  233. // TODO: Add extra cleanup here
  234. if(NowDoingBurn) //如果正在工作 则不能取消
  235. {
  236. if(m_Burn.NeroBurnOK)
  237. {
  238. CDialog::OnOK();
  239. return;
  240. }
  241. if(m_Burn.NeroWorkError)
  242. {
  243. CDialog::OnCancel();
  244. return;
  245. }
  246. AfxMessageBox("已经开始刻录了,不能中断");
  247. return;
  248. }
  249. CDialog::OnCancel(); //否则取消
  250. }
  251. void CNeroDlg::DoBurnOrNot()
  252. {
  253. m_Burn.NeroAPIInit();
  254. m_Burn.NeroAPIBurn();
  255. }
  256. BOOL CNeroDlg::PreTranslateMessage(MSG* pMsg)
  257. {
  258. return CDialog::PreTranslateMessage(pMsg);
  259. }
  260. void CNeroDlg::EnableCtrls()
  261. {
  262. GetDlgItem(IDC_CHECK1)->EnableWindow(!m_bFromDir);
  263. GetDlgItem(IDC_CHECK2)->EnableWindow(!m_bFromDir);
  264. GetDlgItem(IDC_CHECK3)->EnableWindow(!m_bFromDir);
  265. GetDlgItem(IDC_CHECK4)->EnableWindow(!m_bFromDir);
  266. GetDlgItem(IDC_CHECK5)->EnableWindow(!m_bFromDir);
  267. GetDlgItem(IDC_CHECK6)->EnableWindow(!m_bFromDir);
  268. GetDlgItem(IDC_BUTchoosedir)->EnableWindow(m_bFromDir);
  269. }
  270. void CNeroDlg::OnRadio3()
  271. {
  272. // TODO: Add your control notification handler code here
  273. UpdateData();
  274. EnableCtrls();
  275. }
  276. void CNeroDlg::OnRadio4()
  277. {
  278. // TODO: Add your control notification handler code here
  279. OnRadio3();
  280. }
  281. void CNeroDlg::OnBUTchoosedir()
  282. {
  283. // TODO: Add your control notification handler code here
  284. CString dir;
  285. GetSavePath(dir);
  286. dir.IsEmpty();
  287. GetDlgItem(IDC_EDIT1)->SetWindowText(dir);
  288. m_photoarray7.RemoveAll ();
  289. CString path;
  290. path =dir;
  291. CStringArray dirarray;
  292. CString str;
  293. using namespace helper_coffs;
  294. ffsco o;
  295. o.dirs(1);
  296. o.find(LPCSTR(path), LPCSTR("*.*"));
  297. ffsco::typeT coo;
  298. ffsco::typeT::iterator it;
  299. coo = o.co_dir();
  300. for (it = coo.begin();
  301. coo.end() != it;
  302. it ++)
  303. {
  304. str=(*it).c_str();
  305. if(FindArray(&dirarray, str)==-1)
  306. {
  307. dirarray.Add (str);
  308. }
  309. }
  310. for(int i=0; i<dirarray.GetSize (); i++)
  311. {
  312. using namespace helper_coffs;
  313. ffsco o;
  314. o.dirs(0);
  315. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  316. ffsco::typeT coo;
  317. ffsco::typeT::iterator it;
  318. coo = o.co_file();
  319. for (it = coo.begin();
  320. coo.end() != it;
  321. it ++)
  322. {
  323. str=(*it).c_str();
  324. // if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  325. m_photoarray7.Add (str);
  326. }
  327. }
  328. if(m_photoarray7.GetSize ()==0)
  329. {
  330. AfxMessageBox("警告:目录中无照片!", MB_ICONSTOP);
  331. }
  332. m_nphotos=m_photoarray7.GetSize ();
  333. m_nspase=0;
  334. for( i=0; i<m_photoarray7.GetSize (); i++)
  335. {
  336. CFile fp;
  337. if(fp.Open (m_photoarray7.ElementAt (i), CFile::modeRead))
  338. {
  339. m_nspase+=fp.GetLength ();
  340. fp.Close ();
  341. }
  342. }
  343. m_nspase/=(1024*1024);
  344. str.Format ("照片:%d 占用空间:%dM", m_nphotos, m_nspase);
  345. GetDlgItem(IDC_STATIC7)->SetWindowText(str);
  346. }
  347. void CNeroDlg::OnCheck1()
  348. {
  349. // TODO: Add your control notification handler code here
  350. UpdateData();
  351. if(m_checkphoto1)
  352. {
  353. if(m_photoarray1.GetSize ()==0)
  354. {
  355. CString path;
  356. path=g_path4+"\\";
  357. path+=m_id;
  358. path +="\\";
  359. CStringArray dirarray;
  360. CString str;
  361. using namespace helper_coffs;
  362. ffsco o;
  363. o.dirs(1);
  364. o.find(LPCSTR(path), LPCSTR("*.*"));
  365. ffsco::typeT coo;
  366. ffsco::typeT::iterator it;
  367. coo = o.co_dir();
  368. for (it = coo.begin();
  369. coo.end() != it;
  370. it ++)
  371. {
  372. str=(*it).c_str();
  373. if(FindArray(&dirarray, str)==-1)
  374. {
  375. dirarray.Add (str);
  376. }
  377. }
  378. for(int i=0; i<dirarray.GetSize (); i++)
  379. {
  380. using namespace helper_coffs;
  381. ffsco o;
  382. o.dirs(0);
  383. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  384. ffsco::typeT coo;
  385. ffsco::typeT::iterator it;
  386. coo = o.co_file();
  387. for (it = coo.begin();
  388. coo.end() != it;
  389. it ++)
  390. {
  391. str=(*it).c_str();
  392. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  393. m_photoarray1.Add (str);
  394. }
  395. }
  396. if(m_photoarray1.GetSize ()==0)
  397. {
  398. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  399. }
  400. m_nphotos1=m_photoarray1.GetSize ();
  401. m_nspase1=0;
  402. for( i=0; i<m_photoarray1.GetSize (); i++)
  403. {
  404. CFile fp;
  405. if(fp.Open (m_photoarray1.ElementAt (i), CFile::modeRead))
  406. {
  407. m_nspase1+=fp.GetLength ();
  408. fp.Close ();
  409. }
  410. }
  411. m_nspase1temp=m_nspase1;
  412. }
  413. else
  414. {
  415. m_nphotos1=m_photoarray1.GetSize ();
  416. m_nspase1=m_nspase1temp;
  417. }
  418. }
  419. else
  420. {
  421. m_nphotos1=0;
  422. m_nspase1=0;
  423. }
  424. CString str;
  425. str.Format ("照片:%d 占用空间:%dM", m_nphotos1, m_nspase1/(1024*1024));
  426. GetDlgItem(IDC_STATIC1)->SetWindowText(str);
  427. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  428. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  429. }
  430. void CNeroDlg::OnCheck2()
  431. {
  432. // TODO: Add your control notification handler code here
  433. UpdateData();
  434. if(m_checkphoto2)
  435. {
  436. if(m_checkphoto5)
  437. m_checkphoto5=0;
  438. UpdateData(false);
  439. OnCheck5();
  440. if(m_photoarray2.GetSize ()==0)
  441. {
  442. CString path;
  443. path=g_path2+"\\";
  444. path+=m_id;
  445. path +="\\";
  446. CString filter="id='"+m_id+"'";
  447. g_sendhead.bsql=0;
  448. g_sendhead.code[0]=50;
  449. g_sendhead.tabcount=1;
  450. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  451. CArray<CStringArray, CStringArray>sparray;
  452. DataToArray( &sparray);
  453. CString str,spname;
  454. CStringArray noarray;
  455. CStringArray spnamearray;
  456. for(int i=0; i<sparray.GetSize (); i++)
  457. {
  458. str=sparray.ElementAt (i).ElementAt (6);
  459. spname=sparray.ElementAt (i).ElementAt (5);
  460. GetNo(str, noarray);
  461. }
  462. if(noarray.GetSize ()==0)
  463. {
  464. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  465. return;
  466. }
  467. for(i=0; i<noarray.GetSize (); i++)
  468. {
  469. str.Format ("%s%s.jpg", path, noarray.ElementAt (i));
  470. if(::PathFileExists (str))
  471. {
  472. m_photoarray2.Add (str);
  473. }
  474. }
  475. if(m_photoarray2.GetSize ()==0)
  476. {
  477. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  478. }
  479. m_nphotos2=m_photoarray2.GetSize ();
  480. m_nspase2=0;
  481. for( i=0; i<m_photoarray2.GetSize (); i++)
  482. {
  483. CFile fp;
  484. if(fp.Open (m_photoarray2.ElementAt (i), CFile::modeRead))
  485. {
  486. m_nspase2+=fp.GetLength ();
  487. fp.Close ();
  488. }
  489. }
  490. m_nspase2temp=m_nspase2;
  491. }
  492. else
  493. {
  494. m_nphotos2=m_photoarray2.GetSize ();
  495. m_nspase2=m_nspase2temp;
  496. }
  497. }
  498. else
  499. {
  500. m_nphotos2=0;
  501. m_nspase2=0;
  502. }
  503. CString str;
  504. str.Format ("照片:%d 占用空间:%dM", m_nphotos2, m_nspase2/(1024*1024));
  505. GetDlgItem(IDC_STATIC2)->SetWindowText(str);
  506. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  507. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  508. }
  509. void CNeroDlg::OnCheck3()
  510. {
  511. // TODO: Add your control notification handler code here
  512. UpdateData();
  513. if(m_checkphoto3)
  514. {
  515. if(m_checkphoto4)
  516. m_checkphoto4=0;
  517. UpdateData(false);
  518. OnCheck4();
  519. if(m_photoarray3.GetSize ()==0)
  520. {
  521. CString path;
  522. path=g_path1+"\\";
  523. path+=m_id;
  524. path +="\\";
  525. CString filter="id='"+m_id+"'";
  526. g_sendhead.bsql=0;
  527. g_sendhead.code[0]=50;
  528. g_sendhead.tabcount=1;
  529. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  530. CArray<CStringArray, CStringArray>sparray;
  531. DataToArray( &sparray);
  532. CString str,spname;
  533. CStringArray noarray;
  534. CStringArray spnamearray;
  535. for(int i=0; i<sparray.GetSize (); i++)
  536. {
  537. str=sparray.ElementAt (i).ElementAt (6);
  538. spname=sparray.ElementAt (i).ElementAt (5);
  539. GetNo(str, noarray);
  540. }
  541. if(noarray.GetSize ()==0)
  542. {
  543. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  544. return;
  545. }
  546. for(i=0; i<noarray.GetSize (); i++)
  547. {
  548. str.Format ("%s%s.jpg", path, noarray.ElementAt (i));
  549. if(::PathFileExists (str))
  550. {
  551. m_photoarray3.Add (str);
  552. }
  553. }
  554. if(m_photoarray3.GetSize ()==0)
  555. {
  556. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  557. }
  558. m_nphotos3=m_photoarray3.GetSize ();
  559. m_nspase3=0;
  560. for( i=0; i<m_photoarray3.GetSize (); i++)
  561. {
  562. CFile fp;
  563. if(fp.Open (m_photoarray3.ElementAt (i), CFile::modeRead))
  564. {
  565. m_nspase3+=fp.GetLength ();
  566. fp.Close ();
  567. }
  568. }
  569. m_nspase3temp=m_nspase3;
  570. }
  571. else
  572. {
  573. m_nphotos3=m_photoarray3.GetSize ();
  574. m_nspase3=m_nspase3temp;
  575. }
  576. }
  577. else
  578. {
  579. m_nphotos3=0;
  580. m_nspase3=0;
  581. }
  582. CString str;
  583. str.Format ("照片:%d 占用空间:%dM", m_nphotos3, m_nspase3/(1024*1024));
  584. GetDlgItem(IDC_STATIC3)->SetWindowText(str);
  585. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  586. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  587. }
  588. void CNeroDlg::OnCheck4()
  589. {
  590. // TODO: Add your control notification handler code here
  591. UpdateData();
  592. if(m_checkphoto4)
  593. {
  594. if(m_checkphoto3)
  595. m_checkphoto3=0;
  596. UpdateData(false);
  597. OnCheck3();
  598. if(m_photoarray4.GetSize ()==0)
  599. {
  600. CString path;
  601. path=g_path1+"\\";
  602. path+=m_id;
  603. path +="\\";
  604. CStringArray dirarray;
  605. CString str;
  606. using namespace helper_coffs;
  607. ffsco o;
  608. o.dirs(1);
  609. o.find(LPCSTR(path), LPCSTR("*.*"));
  610. ffsco::typeT coo;
  611. ffsco::typeT::iterator it;
  612. coo = o.co_dir();
  613. for (it = coo.begin();
  614. coo.end() != it;
  615. it ++)
  616. {
  617. str=(*it).c_str();
  618. if(FindArray(&dirarray, str)==-1)
  619. {
  620. dirarray.Add (str);
  621. }
  622. }
  623. for(int i=0; i<dirarray.GetSize (); i++)
  624. {
  625. using namespace helper_coffs;
  626. ffsco o;
  627. o.dirs(0);
  628. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  629. ffsco::typeT coo;
  630. ffsco::typeT::iterator it;
  631. coo = o.co_file();
  632. for (it = coo.begin();
  633. coo.end() != it;
  634. it ++)
  635. {
  636. str=(*it).c_str();
  637. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  638. m_photoarray4.Add (str);
  639. }
  640. }
  641. if(m_photoarray4.GetSize ()==0)
  642. {
  643. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  644. }
  645. m_nphotos4=m_photoarray4.GetSize ();
  646. m_nspase4=0;
  647. for( i=0; i<m_photoarray4.GetSize (); i++)
  648. {
  649. CFile fp;
  650. if(fp.Open (m_photoarray4.ElementAt (i), CFile::modeRead))
  651. {
  652. m_nspase4+=fp.GetLength ();
  653. fp.Close ();
  654. }
  655. }
  656. m_nspase4temp=m_nspase4;
  657. }
  658. else
  659. {
  660. m_nphotos4=m_photoarray4.GetSize ();
  661. m_nspase4=m_nspase4temp;
  662. }
  663. }
  664. else
  665. {
  666. m_nphotos4=0;
  667. m_nspase4=0;
  668. }
  669. CString str;
  670. str.Format ("照片:%d 占用空间:%dM", m_nphotos4, m_nspase4/(1024*1024));
  671. GetDlgItem(IDC_STATIC4)->SetWindowText(str);
  672. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  673. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  674. }
  675. void CNeroDlg::OnCheck5()
  676. {
  677. // TODO: Add your control notification handler code here
  678. UpdateData();
  679. if(m_checkphoto5)
  680. {
  681. if(m_checkphoto2)
  682. m_checkphoto2=0;
  683. UpdateData(false);
  684. OnCheck2();
  685. if(m_photoarray5.GetSize ()==0)
  686. {
  687. CString path;
  688. path=g_path2+"\\";
  689. path+=m_id;
  690. path +="\\";
  691. CStringArray dirarray;
  692. CString str;
  693. using namespace helper_coffs;
  694. ffsco o;
  695. o.dirs(1);
  696. o.find(LPCSTR(path), LPCSTR("*.*"));
  697. ffsco::typeT coo;
  698. ffsco::typeT::iterator it;
  699. coo = o.co_dir();
  700. for (it = coo.begin();
  701. coo.end() != it;
  702. it ++)
  703. {
  704. str=(*it).c_str();
  705. if(FindArray(&dirarray, str)==-1)
  706. {
  707. dirarray.Add (str);
  708. }
  709. }
  710. for(int i=0; i<dirarray.GetSize (); i++)
  711. {
  712. using namespace helper_coffs;
  713. ffsco o;
  714. o.dirs(0);
  715. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  716. ffsco::typeT coo;
  717. ffsco::typeT::iterator it;
  718. coo = o.co_file();
  719. for (it = coo.begin();
  720. coo.end() != it;
  721. it ++)
  722. {
  723. str=(*it).c_str();
  724. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  725. m_photoarray5.Add (str);
  726. }
  727. }
  728. if(m_photoarray5.GetSize ()==0)
  729. {
  730. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  731. }
  732. m_nphotos5=m_photoarray5.GetSize ();
  733. m_nspase5=0;
  734. for( i=0; i<m_photoarray5.GetSize (); i++)
  735. {
  736. CFile fp;
  737. if(fp.Open (m_photoarray5.ElementAt (i), CFile::modeRead))
  738. {
  739. m_nspase5+=fp.GetLength ();
  740. fp.Close ();
  741. }
  742. }
  743. m_nspase5temp=m_nspase5;
  744. }
  745. else
  746. {
  747. m_nphotos5=m_photoarray5.GetSize ();
  748. m_nspase5=m_nspase5temp;
  749. }
  750. }
  751. else
  752. {
  753. m_nphotos5=0;
  754. m_nspase5=0;
  755. }
  756. CString str;
  757. str.Format ("照片:%d 占用空间:%dM", m_nphotos5, m_nspase5/(1024*1024));
  758. GetDlgItem(IDC_STATIC5)->SetWindowText(str);
  759. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  760. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  761. }
  762. void CNeroDlg::OnCheck6()
  763. {
  764. // TODO: Add your control notification handler code here
  765. UpdateData();
  766. if(m_checkphoto6)
  767. {
  768. if(m_photoarray6.GetSize ()==0)
  769. {
  770. CString path;
  771. path=g_path3+"\\";
  772. path+=m_id;
  773. path +="\\";
  774. CStringArray dirarray;
  775. CString str;
  776. using namespace helper_coffs;
  777. ffsco o;
  778. o.dirs(1);
  779. o.find(LPCSTR(path), LPCSTR("*.*"));
  780. ffsco::typeT coo;
  781. ffsco::typeT::iterator it;
  782. coo = o.co_dir();
  783. for (it = coo.begin();
  784. coo.end() != it;
  785. it ++)
  786. {
  787. str=(*it).c_str();
  788. if(FindArray(&dirarray, str)==-1)
  789. {
  790. dirarray.Add (str);
  791. }
  792. }
  793. for(int i=0; i<dirarray.GetSize (); i++)
  794. {
  795. using namespace helper_coffs;
  796. ffsco o;
  797. o.dirs(0);
  798. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  799. ffsco::typeT coo;
  800. ffsco::typeT::iterator it;
  801. coo = o.co_file();
  802. for (it = coo.begin();
  803. coo.end() != it;
  804. it ++)
  805. {
  806. str=(*it).c_str();
  807. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  808. m_photoarray6.Add (str);
  809. }
  810. }
  811. if(m_photoarray6.GetSize ()==0)
  812. {
  813. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  814. }
  815. m_nphotos6=m_photoarray6.GetSize ();
  816. m_nspase6=0;
  817. for( i=0; i<m_photoarray6.GetSize (); i++)
  818. {
  819. CFile fp;
  820. if(fp.Open (m_photoarray6.ElementAt (i), CFile::modeRead))
  821. {
  822. m_nspase6+=fp.GetLength ();
  823. fp.Close ();
  824. }
  825. }
  826. m_nspase6temp=m_nspase6;
  827. }
  828. else
  829. {
  830. m_nphotos6=m_photoarray6.GetSize ();
  831. m_nspase6=m_nspase6temp;
  832. }
  833. }
  834. else
  835. {
  836. m_nphotos6=0;
  837. m_nspase6=0;
  838. }
  839. CString str;
  840. str.Format ("照片:%d 占用空间:%dM", m_nphotos6, m_nspase6/(1024*1024));
  841. GetDlgItem(IDC_STATIC6)->SetWindowText(str);
  842. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  843. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  844. }
  845. void CNeroDlg::GetNo(CString str, CStringArray &array)
  846. {
  847. if(!str.IsEmpty ())
  848. {
  849. int pos=str.Find (",");
  850. while(pos!=-1)
  851. {
  852. if(FindArray(&array, str.Left (pos))==-1)
  853. array.Add (str.Left (pos));
  854. str=str.Right (str.GetLength ()-pos-1);
  855. pos=str.Find (",");
  856. }
  857. if(FindArray(&array, str)==-1)
  858. array.Add(str);
  859. }
  860. }
  861. void CNeroDlg::OnOK()
  862. {
  863. UpdateData();
  864. if(m_nphotos==0)
  865. {
  866. AfxMessageBox("未选中照片!", MB_ICONSTOP);
  867. return;
  868. }
  869. if(m_nspase>650 && m_bDvd==0)
  870. {
  871. AfxMessageBox("光盘空间不足!", MB_ICONSTOP);
  872. return;
  873. }
  874. m_Burn.m_DirArray.RemoveAll ();
  875. m_Burn.m_DirRealNameArray.RemoveAll ();
  876. GetDlgItem(IDOK)->SetWindowText("刻录中, 请稍候...");
  877. GetDlgItem(IDOK)->EnableWindow(0);
  878. if(NowDoingBurn)
  879. return;
  880. CStringArray dirarray;
  881. using namespace helper_coffs;
  882. CStringArray srcarray;
  883. if(m_bFromDir)
  884. {
  885. CString str;
  886. GetDlgItemText(IDC_EDIT1, str);
  887. str.TrimRight ('\\');
  888. m_Burn.m_DirArray.Add (str);
  889. m_Burn.m_DirRealNameArray.Add (str);
  890. }
  891. else
  892. {
  893. if(m_checkphoto1)
  894. {
  895. m_Burn.m_DirArray.Add (g_path4+"\\"+m_id);
  896. m_Burn.m_DirRealNameArray.Add (g_path4+"\\"+m_id+"(精修)");
  897. }
  898. if(m_checkphoto5)
  899. {
  900. m_Burn.m_DirArray.Add (g_path2+"\\"+m_id);
  901. m_Burn.m_DirRealNameArray.Add (g_path2+"\\"+m_id+"(初修)");
  902. }
  903. if(m_checkphoto4)
  904. {
  905. m_Burn.m_DirArray.Add (g_path1+"\\"+m_id);
  906. m_Burn.m_DirRealNameArray.Add (g_path1+"\\"+m_id+"(原片)");
  907. }
  908. if(m_checkphoto6)
  909. {
  910. m_Burn.m_DirArray.Add (g_path3+"\\"+m_id);
  911. m_Burn.m_DirRealNameArray.Add (g_path3+"\\"+m_id+"(设计片)");
  912. }
  913. }
  914. CString str;
  915. for(int i=0; i<m_Burn.m_DirArray.GetSize (); i++)
  916. {
  917. ffsco o;
  918. o.dirs(1);
  919. o.find(LPCSTR(m_Burn.m_DirArray.ElementAt (i)), LPCSTR("*.*"));
  920. ffsco::typeT coo;
  921. ffsco::typeT::iterator it;
  922. coo = o.co_dir();
  923. for (it = coo.begin();
  924. coo.end() != it;
  925. it ++)
  926. {
  927. str=(*it).c_str();
  928. str.TrimRight("\\");
  929. if(FindArray(&dirarray, str)==-1)
  930. {
  931. dirarray.Add (str);
  932. }
  933. }
  934. }
  935. int addcount=0;
  936. if(m_bFromDir==0)
  937. {
  938. if(m_checkphoto2)addcount++;
  939. if(m_checkphoto3)addcount++;
  940. }
  941. if((dirarray.GetSize ()+addcount)==0)return;
  942. CStringArray *photosarray=new CStringArray[dirarray.GetSize()+addcount];
  943. for( i=0; i<dirarray.GetSize (); i++)
  944. {
  945. GenSPhoto(dirarray.ElementAt (i), photosarray[i]);
  946. }
  947. if(m_bFromDir==0)
  948. {
  949. int pos=dirarray.GetSize ();
  950. if(m_checkphoto2)
  951. {
  952. m_Burn.m_DirArray.Add (g_path2+"\\"+m_id);
  953. m_Burn.m_DirRealNameArray.Add (g_path2+"\\"+m_id+"(初修)");
  954. dirarray.Add(g_path2+"\\"+m_id);
  955. photosarray[pos].Copy (m_photoarray2);
  956. pos++;
  957. }
  958. if(m_checkphoto3)
  959. {
  960. m_Burn.m_DirArray.Add (g_path1+"\\"+m_id);
  961. m_Burn.m_DirRealNameArray.Add (g_path1+"\\"+m_id+"(原片)");
  962. dirarray.Add(g_path1+"\\"+m_id);
  963. photosarray[pos].Copy (m_photoarray3);
  964. }
  965. }
  966. m_Burn.m_pDir=&dirarray;
  967. m_Burn.m_pPhotoArray=photosarray;
  968. if(m_Burn.NeroAPIInit()==0)
  969. {
  970. m_Burn.NeroWorkError=1;
  971. delete []photosarray;
  972. return;
  973. }
  974. m_Burn.m_name=m_name;
  975. m_Burn.m_bDvd=m_bDvd;
  976. m_Burn.NeroAPIBurn();
  977. NowDoingBurn=true; delete []photosarray;
  978. }