NeroDlg.cpp 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462
  1. // NeroDlg1.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.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 IDC_CHECK5
  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. CString version = _T ("Version 1.0");
  45. m_bScale=AfxGetApp()->GetProfileInt (version, "cutphoto", 1);
  46. m_bDvd=AfxGetApp()->GetProfileInt (version, "bDvd", 0);
  47. m_checkphoto1=AfxGetApp()->GetProfileInt (version, "m_checkphoto1", 1);
  48. m_checkphoto2=0;//AfxGetApp()->GetProfileInt (version, "m_checkphoto2", 0);
  49. m_checkphoto3=0;//AfxGetApp()->GetProfileInt (version, "m_checkphoto3", 0);
  50. m_checkphoto4=AfxGetApp()->GetProfileInt (version, "m_checkphoto4", 0);
  51. m_checkphoto5=AfxGetApp()->GetProfileInt (version, "m_checkphoto5", 0);
  52. m_checkphoto6=AfxGetApp()->GetProfileInt (version, "m_checkphoto6", 0);
  53. }
  54. void CNeroDlg::DoDataExchange(CDataExchange* pDX)
  55. {
  56. CDialog::DoDataExchange(pDX);
  57. //{{AFX_DATA_MAP(CNeroDlg)
  58. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  59. DDX_Control(pDX, IDC_PROGRESS1, m_Progress);
  60. DDX_Radio(pDX, IDC_RADIO3, m_bFromDir);
  61. DDX_Radio(pDX, IDC_RADIO1, m_bDvd);
  62. DDX_Check(pDX, IDC_CHECK1, m_checkphoto1);
  63. DDX_Check(pDX, IDC_CHECK2, m_checkphoto2);
  64. DDX_Check(pDX, IDC_CHECK3, m_checkphoto3);
  65. DDX_Check(pDX, IDC_CHECK4, m_checkphoto4);
  66. DDX_Check(pDX, IDC_CHECK5, m_checkphoto5);
  67. DDX_Check(pDX, IDC_CHECK6, m_checkphoto6);
  68. DDX_Check(pDX, IDC_CHECK7, m_bScale);
  69. //}}AFX_DATA_MAP
  70. }
  71. BEGIN_MESSAGE_MAP(CNeroDlg, CDialog)
  72. //{{AFX_MSG_MAP(CNeroDlg)
  73. ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
  74. ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
  75. ON_BN_CLICKED(IDC_BUTchoosedir, OnBUTchoosedir)
  76. ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
  77. ON_BN_CLICKED(IDC_CHECK2, OnCheck2)
  78. ON_BN_CLICKED(IDC_CHECK3, OnCheck3)
  79. ON_BN_CLICKED(IDC_CHECK4, OnCheck4)
  80. ON_BN_CLICKED(IDC_CHECK5, OnCheck5)
  81. ON_BN_CLICKED(IDC_CHECK6, OnCheck6)
  82. ON_BN_CLICKED(IDC_CHECK7, OnCheck7)
  83. ON_CBN_CLOSEUP(IDC_COMBO1, OnCloseupCombo1)
  84. ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
  85. ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
  86. ON_WM_DESTROY()
  87. //}}AFX_MSG_MAP
  88. END_MESSAGE_MAP()
  89. /////////////////////////////////////////////////////////////////////////////
  90. // CNeroDlg message handlers
  91. BOOL CNeroDlg::OnInitDialog()
  92. {
  93. CDialog::OnInitDialog();
  94. m_Progress.SetRange(0,100);
  95. EnableCtrls();
  96. CString filter="id='"+m_id+"'";
  97. g_sendhead.bsql=0;
  98. g_sendhead.code[0]=50;
  99. g_sendhead.tabcount=1;
  100. g_pMainWnd->ProcessChatMessageRequest2(filter);
  101. if(g_bSendOK==0)
  102. {
  103. return 1;
  104. }
  105. CArray<CStringArray, CStringArray>sparray;
  106. DataToArray( &sparray);
  107. CString str,spname;
  108. CStringArray spnamearray;
  109. for(int i=0; i<sparray.GetSize (); i++)
  110. {
  111. str=sparray.ElementAt (i).ElementAt (6);
  112. spname=sparray.ElementAt (i).ElementAt (5);
  113. GetNo(str, m_noarray);
  114. }
  115. m_combo1.AddString ("1200x1600");
  116. m_combo1.AddString ("768x1024");
  117. m_combo1.AddString ("600x800");
  118. m_combo1.AddString ("480x640");
  119. CString version = _T ("Version 1.0");
  120. int pos=AfxGetApp()->GetProfileInt (version, "cutphotosize", 2);
  121. m_combo1.SetCurSel (pos);
  122. if(m_checkphoto1)OnCheck1();
  123. if(m_checkphoto2)OnCheck2();
  124. if(m_checkphoto3)OnCheck3();
  125. if(m_checkphoto4)OnCheck4();
  126. if(m_checkphoto5)OnCheck5();
  127. if(m_checkphoto6)OnCheck6();
  128. CenterWindow ();
  129. return TRUE; // return TRUE unless you set the focus to a control
  130. // EXCEPTION: OCX Property Pages should return FALSE
  131. }
  132. bool NERO_CALLBACK_ATTR CNeroDlg::IdleCallback(void *pUserData)
  133. {
  134. static MSG msg;
  135. while (! ::PeekMessage(&msg,NULL,NULL,NULL,PM_NOREMOVE))
  136. {
  137. if (!AfxGetThread()->PumpMessage())
  138. {
  139. break;
  140. }
  141. }
  142. return false;
  143. }
  144. NeroUserDlgInOut NERO_CALLBACK_ATTR CNeroDlg::UserDialog(void *pUserData, NeroUserDlgInOut type, void *data)
  145. {
  146. switch (type)
  147. {
  148. case DLG_AUTO_INSERT:
  149. return DLG_RETURN_CONTINUE;
  150. break;
  151. case DLG_DISCONNECT_RESTART:
  152. return DLG_RETURN_ON_RESTART;
  153. break;
  154. case DLG_DISCONNECT:
  155. return DLG_RETURN_CONTINUE;
  156. break;
  157. case DLG_AUTO_INSERT_RESTART:
  158. return DLG_RETURN_EXIT;
  159. break;
  160. case DLG_RESTART:
  161. return DLG_RETURN_EXIT;
  162. break;
  163. case DLG_SETTINGS_RESTART:
  164. return DLG_RETURN_CONTINUE;
  165. break;
  166. case DLG_OVERBURN:
  167. return DLG_RETURN_TRUE;
  168. break;
  169. case DLG_AUDIO_PROBLEMS:
  170. return DLG_RETURN_EXIT;
  171. break;
  172. case DLG_FILESEL_IMAGE:
  173. {
  174. // create filter for image files
  175. // create a CFileDialog object.
  176. // usage : CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL,
  177. // DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL,
  178. // CWnd* pParentWnd = NULL );
  179. //
  180. // bOpenFileDialog = TRUE, create a File Open dialog
  181. // lpszDefExt = NULL, do not automatically append a file extension
  182. // dwFlags = OFN_OVERWRITEPROMPT, makes no sense during file open,
  183. // just in case we decide to use File Save later
  184. // szFilter = "Image Files (*.nrg)|*.nrg|All Files (*.*)|*.*||"
  185. // pParentWnd = ((CNeroFiddlesDlg*)pUserData), our current Dialog window is the parent
  186. // user canceled, do not proceed with the burn process
  187. return DLG_BURNIMAGE_CANCEL;
  188. }
  189. break;
  190. case DLG_WAITCD:
  191. {
  192. AfxMessageBox("光盘不为空或类型错误");
  193. return DLG_RETURN_EXIT;
  194. break;
  195. }
  196. default:
  197. break;
  198. }
  199. //
  200. return DLG_RETURN_EXIT;
  201. }
  202. BOOL NERO_CALLBACK_ATTR CNeroDlg::ProgressCallback(void *pUserData, DWORD dwProgressInPercent)
  203. {
  204. ((CNeroDlg*)pUserData)->m_Progress.SetPos(dwProgressInPercent);
  205. return true;
  206. }
  207. BOOL NERO_CALLBACK_ATTR CNeroDlg::AbortedCallback(void *pUserData)
  208. {
  209. return false;
  210. return true;
  211. }
  212. void NERO_CALLBACK_ATTR CNeroDlg::AddLogLine(void *pUserData, NERO_TEXT_TYPE type, const char *text)
  213. {
  214. //((CNeroMFCappDlg*)pUserData)->AppendString("Log line:" +(CString)*text);
  215. return;
  216. }
  217. void NERO_CALLBACK_ATTR CNeroDlg::SetPhaseCallback(void *pUserData, const char *text)
  218. {
  219. return;
  220. }
  221. CString GetFileNameFromPath(CString path)
  222. {
  223. path=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
  224. path=path.Left (path.Find ('.'));
  225. return path;
  226. }
  227. void CNeroDlg::GenSPhoto(CString dir, CStringArray &array, DWORD &nNeedSpase, BOOL bCheckNo)
  228. {
  229. using namespace helper_coffs;
  230. ffsco o;
  231. o.dirs(0);
  232. o.find(LPCSTR(dir), LPCSTR("*.*"));
  233. ffsco::typeT coo;
  234. ffsco::typeT::iterator it;
  235. coo = o.co_file();
  236. CString str;
  237. for (it = coo.begin();
  238. coo.end() != it;
  239. it ++)
  240. {
  241. str=(*it).c_str();
  242. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  243. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  244. if(str.Right (2)=="ok")continue;
  245. if(bCheckNo)
  246. {
  247. if(::FindArray (&m_noarray, GetFileNameFromPath(str))==-1)
  248. continue;
  249. }
  250. if(m_bScale )
  251. {
  252. if(str.Find ("客户原片")!=-1 || str.Find ("\\修好的片")!=-1)
  253. {
  254. if(::FindArray (&m_noarray, GetFileNameFromPath(str))!=-1)
  255. {
  256. array.Add (str);
  257. CFile fp;
  258. fp.Open (str, CFile::modeRead);
  259. nNeedSpase+=fp.GetLength ();
  260. fp.Close ();
  261. }
  262. }
  263. else
  264. {
  265. array.Add (str);
  266. CFile fp;
  267. fp.Open (str, CFile::modeRead);
  268. nNeedSpase+=fp.GetLength ();
  269. fp.Close ();
  270. }
  271. }
  272. else
  273. array.Add (str);
  274. }
  275. }
  276. void CNeroDlg::GenSPhoto(CString dir, CString sType, CStringArray &array, CStringArray &dirarray)
  277. {
  278. using namespace helper_coffs;
  279. ffsco o;
  280. o.dirs(1);
  281. o.find(LPCSTR(dir), LPCSTR("*.*"));
  282. ffsco::typeT coo;
  283. ffsco::typeT::iterator it;
  284. coo = o.co_file();
  285. CString str;
  286. for (it = coo.begin();
  287. coo.end() != it;
  288. it ++)
  289. {
  290. str=(*it).c_str();
  291. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  292. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  293. if(str.Right (2)=="ok")continue;
  294. if(m_bScale && (sType=="(初修)"||sType=="(原片)") )
  295. {
  296. if(::FindArray (&m_noarray, GetFileNameFromPath(str))==-1)
  297. {
  298. ::CreateDirectory (g_mainpath+"\\temp", NULL);
  299. ::CreateDirectory (g_mainpath+"\\temp\\"+m_id+"(未选的照片)", NULL);
  300. CString dir;
  301. dir=g_mainpath+"\\temp\\"+m_id+"(未选的照片)\\"+sType;
  302. ::CreateDirectory(dir, NULL);
  303. array.Add (str);
  304. dirarray.Add (dir);
  305. /* Image *img=NULL; 没有找到
  306. ::LoadImageFromBuf (&img, str);
  307. if(img->GetWidth())
  308. {
  309. CRect rc(0,0,800,800);
  310. RectFitDes(img->GetWidth(), img->GetHeight(), rc);
  311. Image *simg= img->GetThumbnailImage(rc.Width (), rc.Height (), NULL, NULL);
  312. Graphics graphic(simg);//防止GetThumbnailImage影响质量
  313. graphic.DrawImage(img, 0,0,simg->GetWidth(), simg->GetHeight() );
  314. delete img;
  315. ::SaveImageToFile(simg, dir+"\\"+::GetFileNameFromPath (str)+".jpg");
  316. delete simg;
  317. }*/
  318. }
  319. }
  320. }
  321. }
  322. int GetChildCount(CString str, CStringArray &array)
  323. {
  324. CString dirname=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  325. int count=array.GetSize ();
  326. CString temp;
  327. for(int i=0; i<array.GetSize (); i++)
  328. {
  329. if(array.ElementAt (i)==str)
  330. count--;
  331. else if(array.ElementAt (i).Find (str)==-1)
  332. count--;
  333. else
  334. {
  335. temp=array.ElementAt (i);
  336. temp=temp.Left (temp.ReverseFind ('\\'));
  337. if(temp!=str)
  338. count--;
  339. }
  340. }
  341. return count;
  342. }
  343. void CNeroDlg::OnCancel()
  344. {
  345. // TODO: Add extra cleanup here
  346. if(NowDoingBurn) //如果正在工作 则不能取消
  347. {
  348. if(m_Burn.NeroBurnOK)
  349. {
  350. CDialog::OnOK();
  351. return;
  352. }
  353. if(m_Burn.NeroWorkError)
  354. {
  355. CDialog::OnCancel();
  356. return;
  357. }
  358. AfxMessageBox("已经开始刻录了,不能中断");
  359. return;
  360. }
  361. CDialog::OnCancel(); //否则取消
  362. }
  363. void CNeroDlg::DoBurnOrNot()
  364. {
  365. m_Burn.NeroAPIInit();
  366. m_Burn.NeroAPIBurn();
  367. }
  368. BOOL CNeroDlg::PreTranslateMessage(MSG* pMsg)
  369. {
  370. return CDialog::PreTranslateMessage(pMsg);
  371. }
  372. void CNeroDlg::EnableCtrls()
  373. {
  374. GetDlgItem(IDC_CHECK1)->EnableWindow(!m_bFromDir);
  375. GetDlgItem(IDC_CHECK2)->EnableWindow(!m_bFromDir);
  376. GetDlgItem(IDC_CHECK3)->EnableWindow(!m_bFromDir);
  377. GetDlgItem(IDC_CHECK4)->EnableWindow(!m_bFromDir);
  378. GetDlgItem(IDC_CHECK5)->EnableWindow(!m_bFromDir);
  379. GetDlgItem(IDC_CHECK6)->EnableWindow(!m_bFromDir);
  380. GetDlgItem(IDC_BUTchoosedir)->EnableWindow(m_bFromDir);
  381. }
  382. void CNeroDlg::OnRadio3()
  383. {
  384. // TODO: Add your control notification handler code here
  385. UpdateData();
  386. EnableCtrls();
  387. }
  388. void CNeroDlg::OnRadio4()
  389. {
  390. // TODO: Add your control notification handler code here
  391. OnRadio3();
  392. }
  393. void CNeroDlg::OnBUTchoosedir()
  394. {
  395. // TODO: Add your control notification handler code here
  396. CString dir;
  397. GetSavePath(dir);
  398. dir.IsEmpty();
  399. GetDlgItem(IDC_EDIT1)->SetWindowText(dir);
  400. m_photoarray7.RemoveAll ();
  401. CString path;
  402. path =dir;
  403. CStringArray dirarray;
  404. CString str;
  405. using namespace helper_coffs;
  406. ffsco o;
  407. o.dirs(1);
  408. o.find(LPCSTR(path), LPCSTR("*.*"));
  409. ffsco::typeT coo;
  410. ffsco::typeT::iterator it;
  411. coo = o.co_dir();
  412. for (it = coo.begin();coo.end() != it;it ++)
  413. {
  414. str=(*it).c_str();
  415. if(FindArray(&dirarray, str)==-1)
  416. {
  417. dirarray.Add (str);
  418. }
  419. }
  420. int i = 0;
  421. for( i=0; i<dirarray.GetSize (); i++)
  422. {
  423. using namespace helper_coffs;
  424. ffsco o;
  425. o.dirs(0);
  426. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  427. ffsco::typeT coo;
  428. ffsco::typeT::iterator it;
  429. coo = o.co_file();
  430. for (it = coo.begin();coo.end() != it;it ++)
  431. {
  432. str=(*it).c_str();
  433. m_photoarray7.Add (str);
  434. }
  435. }
  436. if(m_photoarray7.GetSize ()==0)
  437. {
  438. AfxMessageBox("警告:目录中无照片!", MB_ICONSTOP);
  439. }
  440. m_nphotos=m_photoarray7.GetSize ();
  441. m_nspase=0;
  442. for( i=0; i<m_photoarray7.GetSize (); i++)
  443. {
  444. CFile fp;
  445. if(fp.Open (m_photoarray7.ElementAt (i), CFile::modeRead))
  446. {
  447. m_nspase+=fp.GetLength ();
  448. fp.Close ();
  449. }
  450. }
  451. m_nspase/=(1024*1024);
  452. str.Format ("照片:%d 占用空间:%dM", m_nphotos, m_nspase);
  453. GetDlgItem(IDC_STATIC7)->SetWindowText(str);
  454. }
  455. void CNeroDlg::OnCheck1()
  456. {
  457. // TODO: Add your control notification handler code here
  458. UpdateData();
  459. if(m_checkphoto1)
  460. {
  461. int i = 0;
  462. if(m_photoarray1.GetSize ()==0)
  463. {
  464. CString path;
  465. path=g_path4+"\\";
  466. path+=m_id;
  467. path +="\\";
  468. m_realpath=g_path4;
  469. CStringArray dirarray;
  470. CString str;
  471. using namespace helper_coffs;
  472. ffsco o;
  473. o.dirs(1);
  474. o.find(LPCSTR(path), LPCSTR("*.*"));
  475. ffsco::typeT coo;
  476. ffsco::typeT::iterator it;
  477. coo = o.co_dir();
  478. for (it = coo.begin();coo.end() != it;it ++)
  479. {
  480. str=(*it).c_str();
  481. if(FindArray(&dirarray, str)==-1)
  482. {
  483. dirarray.Add (str);
  484. }
  485. }
  486. for( i=0; i<dirarray.GetSize (); i++)
  487. {
  488. using namespace helper_coffs;
  489. ffsco o;
  490. o.dirs(0);
  491. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  492. ffsco::typeT coo;
  493. ffsco::typeT::iterator it;
  494. coo = o.co_file();
  495. for (it = coo.begin();coo.end() != it;it ++)
  496. {
  497. str=(*it).c_str();
  498. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  499. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  500. m_photoarray1.Add (str);
  501. }
  502. }
  503. if(m_photoarray1.GetSize ()==0)
  504. {
  505. AfxMessageBox("没有找到精修片,将用初修片替代!");
  506. path=g_path2+"\\";
  507. path+=m_id;
  508. path +="\\";
  509. m_realpath=g_path2;
  510. CStringArray dirarray;
  511. CString str,temp;
  512. using namespace helper_coffs;
  513. ffsco o;
  514. o.dirs(1);
  515. o.find(LPCSTR(path), LPCSTR("*.*"));
  516. ffsco::typeT coo;
  517. ffsco::typeT::iterator it;
  518. coo = o.co_dir();
  519. for (it = coo.begin();coo.end() != it;it ++)
  520. {
  521. str=(*it).c_str();
  522. if(FindArray(&dirarray, str)==-1)
  523. {
  524. dirarray.Add (str);
  525. }
  526. }
  527. for( i=0; i<dirarray.GetSize (); i++)
  528. {
  529. using namespace helper_coffs;
  530. ffsco o;
  531. o.dirs(0);
  532. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  533. ffsco::typeT coo;
  534. ffsco::typeT::iterator it;
  535. coo = o.co_file();
  536. for (it = coo.begin();coo.end() != it;it ++)
  537. {
  538. str=(*it).c_str();
  539. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  540. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  541. /* temp=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  542. temp=temp.Left (3);
  543. if(FindArray(&m_noarray, temp)==-1)
  544. continue;*/
  545. if(::FindArray (&m_noarray, GetFileNameFromPath(str))==-1)
  546. continue;
  547. m_photoarray1.Add (str);
  548. }
  549. }
  550. }
  551. if(m_photoarray1.GetSize ()==0)
  552. {
  553. AfxMessageBox("没有找到初修片,将用原片替代!");
  554. path=g_path1+"\\";
  555. path+=m_id;
  556. path +="\\";
  557. m_realpath=g_path1;
  558. CStringArray dirarray;
  559. CString str,temp;
  560. using namespace helper_coffs;
  561. ffsco o;
  562. o.dirs(1);
  563. o.find(LPCSTR(path), LPCSTR("*.*"));
  564. ffsco::typeT coo;
  565. ffsco::typeT::iterator it;
  566. coo = o.co_dir();
  567. for (it = coo.begin();coo.end() != it;it ++)
  568. {
  569. str=(*it).c_str();
  570. if(FindArray(&dirarray, str)==-1)
  571. {
  572. dirarray.Add (str);
  573. }
  574. }
  575. for( i=0; i<dirarray.GetSize (); i++)
  576. {
  577. using namespace helper_coffs;
  578. ffsco o;
  579. o.dirs(0);
  580. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  581. ffsco::typeT coo;
  582. ffsco::typeT::iterator it;
  583. coo = o.co_file();
  584. for (it = coo.begin();coo.end() != it;it ++)
  585. {
  586. str=(*it).c_str();
  587. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  588. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  589. /* temp=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  590. temp=temp.Left (3);
  591. if(FindArray(&m_noarray, temp)==-1)
  592. continue;*/
  593. if(::FindArray (&m_noarray, GetFileNameFromPath(str))==-1)
  594. continue;
  595. m_photoarray1.Add (str);
  596. }
  597. }
  598. }
  599. m_nphotos1=m_photoarray1.GetSize ();
  600. m_nspase1=0;
  601. for( i=0; i<m_photoarray1.GetSize (); i++)
  602. {
  603. CFile fp;
  604. if(fp.Open (m_photoarray1.ElementAt (i), CFile::modeRead))
  605. {
  606. m_nspase1+=fp.GetLength ();
  607. fp.Close ();
  608. }
  609. }
  610. m_nspase1temp=m_nspase1;
  611. }
  612. else
  613. {
  614. m_nphotos1=m_photoarray1.GetSize ();
  615. m_nspase1=m_nspase1temp;
  616. }
  617. }
  618. else
  619. {
  620. m_nphotos1=0;
  621. m_nspase1=0;
  622. }
  623. CString str;
  624. str.Format ("照片:%d 占用空间:%dM", m_nphotos1, m_nspase1/(1024*1024));
  625. GetDlgItem(IDC_STATIC1)->SetWindowText(str);
  626. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  627. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  628. }
  629. void CNeroDlg::OnCheck2()
  630. {
  631. // TODO: Add your control notification handler code here
  632. UpdateData();
  633. if(m_checkphoto2)
  634. {
  635. if(m_checkphoto5)
  636. m_checkphoto5=0;
  637. UpdateData(false);
  638. OnCheck5();
  639. if(m_photoarray2.GetSize ()==0)
  640. {
  641. CString path;
  642. path=g_path2+"\\";
  643. path+=m_id;
  644. path +="\\";
  645. CString str;
  646. if(m_noarray.GetSize ()==0)
  647. {
  648. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  649. return;
  650. }
  651. int i = 0;
  652. for( i=0; i<m_noarray.GetSize (); i++)
  653. {
  654. str.Format ("%s%s.jpg", path, m_noarray.ElementAt (i));
  655. if(::CheckFileExist (str))
  656. {
  657. m_photoarray2.Add (str);
  658. }
  659. }
  660. if(m_photoarray2.GetSize ()==0)
  661. {
  662. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  663. }
  664. m_nphotos2=m_photoarray2.GetSize ();
  665. m_nspase2=0;
  666. for( i=0; i<m_photoarray2.GetSize (); i++)
  667. {
  668. CFile fp;
  669. if(fp.Open (m_photoarray2.ElementAt (i), CFile::modeRead))
  670. {
  671. m_nspase2+=fp.GetLength ();
  672. fp.Close ();
  673. }
  674. }
  675. m_nspase2temp=m_nspase2;
  676. }
  677. else
  678. {
  679. m_nphotos2=m_photoarray2.GetSize ();
  680. m_nspase2=m_nspase2temp;
  681. }
  682. }
  683. else
  684. {
  685. m_nphotos2=0;
  686. m_nspase2=0;
  687. }
  688. CString str;
  689. str.Format ("照片:%d 占用空间:%dM", m_nphotos2, m_nspase2/(1024*1024));
  690. GetDlgItem(IDC_STATIC2)->SetWindowText(str);
  691. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  692. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  693. }
  694. void CNeroDlg::OnCheck3()
  695. {
  696. // TODO: Add your control notification handler code here
  697. /* UpdateData();
  698. if(m_checkphoto3)
  699. {
  700. if(m_checkphoto4)
  701. m_checkphoto4=0;
  702. UpdateData(false);
  703. OnCheck4();
  704. if(m_photoarray3.GetSize ()==0)
  705. {
  706. CString path;
  707. path=g_path1+"\\";
  708. path+=m_id;
  709. path +="\\";
  710. if(m_noarray.GetSize ()==0)
  711. {
  712. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  713. return;
  714. }
  715. CString str;
  716. for(int i=0; i<m_noarray.GetSize (); i++)
  717. {
  718. str.Format ("%s%s.jpg", path, m_noarray.ElementAt (i));
  719. if(::CheckFolderFileExist (str))
  720. {
  721. m_photoarray3.Add (str);
  722. }
  723. }
  724. if(m_photoarray3.GetSize ()==0)
  725. {
  726. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  727. }
  728. m_nphotos3=m_photoarray3.GetSize ();
  729. m_nspase3=0;
  730. for( i=0; i<m_photoarray3.GetSize (); i++)
  731. {
  732. CFile fp;
  733. if(fp.Open (m_photoarray3.ElementAt (i), CFile::modeRead))
  734. {
  735. m_nspase3+=fp.GetLength ();
  736. fp.Close ();
  737. }
  738. }
  739. m_nspase3temp=m_nspase3;
  740. }
  741. else
  742. {
  743. m_nphotos3=m_photoarray3.GetSize ();
  744. m_nspase3=m_nspase3temp;
  745. }
  746. }
  747. else
  748. {
  749. m_nphotos3=0;
  750. m_nspase3=0;
  751. }
  752. CString str;
  753. str.Format ("照片:%d 占用空间:%dM", m_nphotos3, m_nspase3/(1024*1024));
  754. GetDlgItem(IDC_STATIC3)->SetWindowText(str);
  755. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  756. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  757. */
  758. }
  759. void CNeroDlg::OnCheck4()
  760. {
  761. // TODO: Add your control notification handler code here
  762. UpdateData();
  763. if(m_checkphoto4)
  764. {
  765. /* if(m_checkphoto3)
  766. m_checkphoto3=0;
  767. UpdateData(false);
  768. OnCheck3();*/
  769. if(m_photoarray4.GetSize ()==0)
  770. {
  771. CString path;
  772. path=g_path1+"\\";
  773. path+=m_id;
  774. path +="\\";
  775. CStringArray dirarray;
  776. CString str;
  777. using namespace helper_coffs;
  778. ffsco o;
  779. o.dirs(1);
  780. o.find(LPCSTR(path), LPCSTR("*.*"));
  781. ffsco::typeT coo;
  782. ffsco::typeT::iterator it;
  783. coo = o.co_dir();
  784. for (it = coo.begin();coo.end() != it;it ++)
  785. {
  786. str=(*it).c_str();
  787. if(FindArray(&dirarray, str)==-1)
  788. {
  789. dirarray.Add (str);
  790. }
  791. }
  792. int i = 0;
  793. for( 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();coo.end() != it;it ++)
  803. {
  804. str=(*it).c_str();
  805. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  806. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  807. m_photoarray4.Add (str);
  808. }
  809. }
  810. if(m_photoarray4.GetSize ()==0)
  811. {
  812. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  813. }
  814. m_nphotos4=m_photoarray4.GetSize ();
  815. m_nspase4=0;
  816. for( i=0; i<m_photoarray4.GetSize (); i++)
  817. {
  818. CFile fp;
  819. if(fp.Open (m_photoarray4.ElementAt (i), CFile::modeRead))
  820. {
  821. m_nspase4+=fp.GetLength ();
  822. fp.Close ();
  823. }
  824. }
  825. m_nspase4temp=m_nspase4;
  826. }
  827. else
  828. {
  829. m_nphotos4=m_photoarray4.GetSize ();
  830. m_nspase4=m_nspase4temp;
  831. }
  832. }
  833. else
  834. {
  835. m_nphotos4=0;
  836. m_nspase4=0;
  837. }
  838. CString str;
  839. str.Format ("照片:%d 占用空间:%dM", m_nphotos4, m_nspase4/(1024*1024));
  840. GetDlgItem(IDC_STATIC4)->SetWindowText(str);
  841. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  842. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  843. }
  844. void CNeroDlg::OnCheck5()
  845. {
  846. // TODO: Add your control notification handler code here
  847. UpdateData();
  848. if(m_checkphoto5)
  849. {
  850. if(m_checkphoto2)
  851. m_checkphoto2=0;
  852. UpdateData(false);
  853. OnCheck2();
  854. if(m_photoarray5.GetSize ()==0)
  855. {
  856. CString path;
  857. path=g_path2+"\\";
  858. path+=m_id;
  859. path +="\\";
  860. CStringArray dirarray;
  861. CString str;
  862. using namespace helper_coffs;
  863. ffsco o;
  864. o.dirs(1);
  865. o.find(LPCSTR(path), LPCSTR("*.*"));
  866. ffsco::typeT coo;
  867. ffsco::typeT::iterator it;
  868. coo = o.co_dir();
  869. for (it = coo.begin();
  870. coo.end() != it;
  871. it ++)
  872. {
  873. str=(*it).c_str();
  874. if(FindArray(&dirarray, str)==-1)
  875. {
  876. dirarray.Add (str);
  877. }
  878. }
  879. int i = 0;
  880. for( i=0; i<dirarray.GetSize (); i++)
  881. {
  882. using namespace helper_coffs;
  883. ffsco o;
  884. o.dirs(0);
  885. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  886. ffsco::typeT coo;
  887. ffsco::typeT::iterator it;
  888. coo = o.co_file();
  889. for (it = coo.begin();
  890. coo.end() != it;
  891. it ++)
  892. {
  893. str=(*it).c_str();
  894. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  895. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  896. m_photoarray5.Add (str);
  897. }
  898. }
  899. if(m_photoarray5.GetSize ()==0)
  900. {
  901. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  902. }
  903. m_nphotos5=m_photoarray5.GetSize ();
  904. m_nspase5=0;
  905. for( i=0; i<m_photoarray5.GetSize (); i++)
  906. {
  907. CFile fp;
  908. if(fp.Open (m_photoarray5.ElementAt (i), CFile::modeRead))
  909. {
  910. m_nspase5+=fp.GetLength ();
  911. fp.Close ();
  912. }
  913. }
  914. m_nspase5temp=m_nspase5;
  915. }
  916. else
  917. {
  918. m_nphotos5=m_photoarray5.GetSize ();
  919. m_nspase5=m_nspase5temp;
  920. }
  921. }
  922. else
  923. {
  924. m_nphotos5=0;
  925. m_nspase5=0;
  926. }
  927. CString str;
  928. str.Format ("照片:%d 占用空间:%dM", m_nphotos5, m_nspase5/(1024*1024));
  929. GetDlgItem(IDC_STATIC5)->SetWindowText(str);
  930. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  931. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  932. }
  933. void CNeroDlg::OnCheck6()
  934. {
  935. // TODO: Add your control notification handler code here
  936. UpdateData();
  937. if(m_checkphoto6)
  938. {
  939. if(m_photoarray6.GetSize ()==0)
  940. {
  941. CString path;
  942. path=g_path3+"\\";
  943. path+=m_id;
  944. path +="\\";
  945. CStringArray dirarray;
  946. CString str;
  947. using namespace helper_coffs;
  948. ffsco o;
  949. o.dirs(1);
  950. o.find(LPCSTR(path), LPCSTR("*.*"));
  951. ffsco::typeT coo;
  952. ffsco::typeT::iterator it;
  953. coo = o.co_dir();
  954. for (it = coo.begin();coo.end() != it;it ++)
  955. {
  956. str=(*it).c_str();
  957. if(FindArray(&dirarray, str)==-1)
  958. {
  959. dirarray.Add (str);
  960. }
  961. }
  962. int i = 0;
  963. for( i=0; i<dirarray.GetSize (); i++)
  964. {
  965. using namespace helper_coffs;
  966. ffsco o;
  967. o.dirs(0);
  968. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  969. ffsco::typeT coo;
  970. ffsco::typeT::iterator it;
  971. coo = o.co_file();
  972. for (it = coo.begin();coo.end() != it;it ++)
  973. {
  974. str=(*it).c_str();
  975. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  976. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  977. m_photoarray6.Add (str);
  978. }
  979. }
  980. if(m_photoarray6.GetSize ()==0)
  981. {
  982. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  983. }
  984. m_nphotos6=m_photoarray6.GetSize ();
  985. m_nspase6=0;
  986. for( i=0; i<m_photoarray6.GetSize (); i++)
  987. {
  988. CFile fp;
  989. if(fp.Open (m_photoarray6.ElementAt (i), CFile::modeRead))
  990. {
  991. m_nspase6+=fp.GetLength ();
  992. fp.Close ();
  993. }
  994. }
  995. m_nspase6temp=m_nspase6;
  996. }
  997. else
  998. {
  999. m_nphotos6=m_photoarray6.GetSize ();
  1000. m_nspase6=m_nspase6temp;
  1001. }
  1002. }
  1003. else
  1004. {
  1005. m_nphotos6=0;
  1006. m_nspase6=0;
  1007. }
  1008. CString str;
  1009. str.Format ("照片:%d 占用空间:%dM", m_nphotos6, m_nspase6/(1024*1024));
  1010. GetDlgItem(IDC_STATIC6)->SetWindowText(str);
  1011. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  1012. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  1013. }
  1014. void CNeroDlg::GetNo(CString str, CStringArray &array)
  1015. {
  1016. if(!str.IsEmpty ())
  1017. {
  1018. int pos=str.Find (",");
  1019. while(pos!=-1)
  1020. {
  1021. if(FindArray(&array, str.Left (pos))==-1)
  1022. array.Add (str.Left (pos));
  1023. str=str.Right (str.GetLength ()-pos-1);
  1024. pos=str.Find (",");
  1025. }
  1026. if(FindArray(&array, str)==-1)
  1027. array.Add(str);
  1028. }
  1029. }
  1030. extern bool SleepEx( DWORD dwMilliseconds );
  1031. void CNeroDlg::OnOK()
  1032. {
  1033. ::DeleteDirectory (g_mainpath+"\\temp");
  1034. ::CreateDirectory (g_mainpath+"\\temp", NULL);
  1035. UpdateData();
  1036. if(m_bScale)
  1037. {
  1038. if(!CheckDiskSpase())return;
  1039. }
  1040. if(m_nphotos==0)
  1041. {
  1042. AfxMessageBox("未选中照片!", MB_ICONSTOP);
  1043. return;
  1044. }
  1045. if(m_nspase>650 && m_bDvd==0 && m_bScale==0)
  1046. {
  1047. AfxMessageBox("光盘空间不足!", MB_ICONSTOP);
  1048. return;
  1049. }
  1050. m_Burn.m_DirArray.RemoveAll ();
  1051. m_Burn.m_DirRealNameArray.RemoveAll ();
  1052. CArray<BOOL,BOOL>bIsSelectDirArray;
  1053. GetDlgItem(IDOK)->SetWindowText("刻录中, 请稍候...");
  1054. GetDlgItem(IDOK)->EnableWindow(0);
  1055. if(NowDoingBurn)
  1056. return;
  1057. CStringArray dirarray;
  1058. using namespace helper_coffs;
  1059. CStringArray srcarray;
  1060. if(m_bFromDir)
  1061. {
  1062. CString str;
  1063. GetDlgItemText(IDC_EDIT1, str);
  1064. str.TrimRight ('\\');
  1065. m_Burn.m_DirArray.Add (str);
  1066. m_Burn.m_DirRealNameArray.Add (str);
  1067. bIsSelectDirArray.Add (0);
  1068. }
  1069. else
  1070. {
  1071. if(m_checkphoto1)
  1072. {
  1073. if( m_realpath==g_path1 && m_checkphoto4)//没有精修片用原片代替,同时又要刻原片时, 把原片备份出来
  1074. {
  1075. SetDlgItemText(IDC_STATICTip, "照片复制中...");
  1076. m_Progress.SetRange (0, m_photoarray1.GetSize ());
  1077. CString path=g_mainpath+"\\temp\\"+m_id+"(精修)";
  1078. ::CreateDirectory (path, NULL);
  1079. CString str;
  1080. for(int i=0; i<m_photoarray1.GetSize (); i++)
  1081. {
  1082. str=m_photoarray1.ElementAt (i);
  1083. ::CopyFile (str, path+str.Right (str.GetLength ()-str.ReverseFind ('\\')), 0);
  1084. m_Progress.SetPos (i);
  1085. }
  1086. m_Burn.m_DirArray.Add (path);
  1087. m_Burn.m_DirRealNameArray.Add (path);
  1088. bIsSelectDirArray.Add (0);
  1089. }
  1090. else
  1091. {
  1092. m_Burn.m_DirArray.Add (m_realpath+"\\"+m_id);
  1093. m_Burn.m_DirRealNameArray.Add (m_realpath+"\\"+m_id+"(精修)");
  1094. if(m_realpath==g_path4)
  1095. bIsSelectDirArray.Add (0);
  1096. else
  1097. bIsSelectDirArray.Add (1);
  1098. }
  1099. }
  1100. if(m_checkphoto5)
  1101. {
  1102. m_Burn.m_DirArray.Add (g_path2+"\\"+m_id);
  1103. m_Burn.m_DirRealNameArray.Add (g_path2+"\\"+m_id+"(初修)");
  1104. bIsSelectDirArray.Add (0);
  1105. }
  1106. if(m_checkphoto4)
  1107. {
  1108. m_Burn.m_DirArray.Add (g_path1+"\\"+m_id);
  1109. m_Burn.m_DirRealNameArray.Add (g_path1+"\\"+m_id+"(原片)");
  1110. bIsSelectDirArray.Add (0);
  1111. }
  1112. if(m_checkphoto6)
  1113. {
  1114. m_Burn.m_DirArray.Add (g_path3+"\\"+m_id);
  1115. m_Burn.m_DirRealNameArray.Add (g_path3+"\\"+m_id+"(设计片)");
  1116. bIsSelectDirArray.Add (0);
  1117. }
  1118. }
  1119. DWORD nNeedSpase=0;
  1120. if(m_bScale)
  1121. {
  1122. SetDlgItemText(IDC_STATICTip, "照片裁切中...");
  1123. int pos=m_combo1.GetCurSel ();
  1124. CStringArray needsaclearray;
  1125. CStringArray dirarray;
  1126. int i = 0;
  1127. for( i=0; i<m_Burn.m_DirArray.GetSize (); i++)
  1128. {
  1129. GenSPhoto(m_Burn.m_DirArray.ElementAt (i), m_Burn.m_DirRealNameArray.ElementAt (i).Right (6), needsaclearray, dirarray);
  1130. }
  1131. m_Progress.SetRange (0, needsaclearray.GetSize ());
  1132. for( i=0; i<needsaclearray.GetSize (); i++)
  1133. {
  1134. CString str=needsaclearray.ElementAt (i);
  1135. CString dir;
  1136. dir=dirarray.ElementAt (i);
  1137. Image *img=NULL;
  1138. ::LoadImageFromBuf (&img, str);
  1139. if(img->GetWidth())
  1140. {
  1141. CRect rc(0,0,800,800);
  1142. if(pos==0)
  1143. {
  1144. rc.right =1600;
  1145. rc.bottom =1600;
  1146. }
  1147. else if(pos==1)
  1148. {
  1149. rc.right =1024;
  1150. rc.bottom =1024;
  1151. }
  1152. else if(pos==2)
  1153. {
  1154. rc.right =800;
  1155. rc.bottom =800;
  1156. }
  1157. else
  1158. {
  1159. rc.right =640;
  1160. rc.bottom =640;
  1161. }
  1162. RectFitDes(img->GetWidth(), img->GetHeight(), rc);
  1163. Image *simg= img->GetThumbnailImage(rc.Width (), rc.Height (), NULL, NULL);
  1164. Graphics graphic(simg);//防止GetThumbnailImage影响质量
  1165. graphic.DrawImage(img, 0,0,simg->GetWidth(), simg->GetHeight() );
  1166. delete img;
  1167. CString savepath=dir+"\\"+::GetFileNameFromPath (str)+".jpg";
  1168. ::SaveImageToFile(simg, savepath);
  1169. delete simg;
  1170. CFile fp;
  1171. if(fp.Open (savepath, CFile::modeRead))
  1172. {
  1173. nNeedSpase+=fp.GetLength ();
  1174. fp.Close ();
  1175. }
  1176. else
  1177. {
  1178. /* ::CopyFile (str, savepath, 0);
  1179. if(fp.Open (savepath, CFile::modeRead))
  1180. {
  1181. nNeedSpase+=fp.GetLength ();
  1182. fp.Close ();
  1183. }*/
  1184. str.Format ("原片%s裁剪失败, 请查看此照片是否损坏。", savepath.Right (savepath.GetLength ()-savepath.ReverseFind ('\\')-1));
  1185. AfxMessageBox(str);
  1186. }
  1187. }
  1188. m_Progress.SetPos (i+1);
  1189. ::SleepEx(10);
  1190. }
  1191. if(::CheckFolderFileExist (g_mainpath+"\\temp\\"+m_id+"(未选的照片)"))
  1192. {
  1193. m_Burn.m_DirArray.Add (g_mainpath+"\\temp\\"+m_id+"(未选的照片)");
  1194. m_Burn.m_DirRealNameArray.Add (g_mainpath+"\\temp\\"+m_id+"(未选的照片)");
  1195. bIsSelectDirArray.Add (0);
  1196. }
  1197. }
  1198. SetDlgItemText(IDC_STATICTip, "光盘刻录中...");
  1199. CString str;
  1200. CArray<BOOL,BOOL>bIsSelectDirArray2;
  1201. int i = 0;
  1202. for( i=0; i<m_Burn.m_DirArray.GetSize (); i++)
  1203. {
  1204. ffsco o;
  1205. o.dirs(1);
  1206. o.find(LPCSTR(m_Burn.m_DirArray.ElementAt (i)), LPCSTR("*.*"));
  1207. ffsco::typeT coo;
  1208. ffsco::typeT::iterator it;
  1209. coo = o.co_dir();
  1210. for (it = coo.begin();
  1211. coo.end() != it;
  1212. it ++)
  1213. {
  1214. str=(*it).c_str();
  1215. str.TrimRight("\\");
  1216. if(FindArray(&dirarray, str)==-1)
  1217. {
  1218. dirarray.Add (str);
  1219. bIsSelectDirArray2.Add (bIsSelectDirArray.ElementAt (i));
  1220. }
  1221. }
  1222. }
  1223. int addcount=0;
  1224. if(m_bFromDir==0)
  1225. {
  1226. if(m_checkphoto2)addcount++;
  1227. if(m_checkphoto3)addcount++;
  1228. }
  1229. if((dirarray.GetSize ()+addcount)==0)return;
  1230. CStringArray *photosarray=new CStringArray[dirarray.GetSize()+addcount];
  1231. for( i=0; i<dirarray.GetSize (); i++)
  1232. {
  1233. GenSPhoto(dirarray.ElementAt (i), photosarray[i], nNeedSpase,bIsSelectDirArray2.ElementAt (i));
  1234. }
  1235. if(m_bFromDir==0)
  1236. {
  1237. int pos=dirarray.GetSize ();
  1238. if(m_checkphoto2)
  1239. {
  1240. m_Burn.m_DirArray.Add (g_path2+"\\"+m_id);
  1241. m_Burn.m_DirRealNameArray.Add (g_path2+"\\"+m_id+"(初修)");
  1242. dirarray.Add(g_path2+"\\"+m_id);
  1243. photosarray[pos].Copy (m_photoarray2);
  1244. pos++;
  1245. nNeedSpase+=m_nspase1;
  1246. }
  1247. if(m_checkphoto3)
  1248. {
  1249. m_Burn.m_DirArray.Add (g_path1+"\\"+m_id);
  1250. m_Burn.m_DirRealNameArray.Add (g_path1+"\\"+m_id+"(原片)");
  1251. dirarray.Add(g_path1+"\\"+m_id);
  1252. photosarray[pos].Copy (m_photoarray3);
  1253. nNeedSpase+=m_nspase2;
  1254. }
  1255. }
  1256. if(m_bScale)
  1257. {
  1258. nNeedSpase/=1024*1024;
  1259. if(nNeedSpase>650 && m_bDvd==0)
  1260. {
  1261. AfxMessageBox("光盘空间不足!", MB_ICONSTOP);delete []photosarray;
  1262. return;
  1263. }
  1264. }
  1265. m_Burn.m_pDir=&dirarray;
  1266. m_Burn.m_pPhotoArray=photosarray;
  1267. if(m_Burn.NeroAPIInit()==0)
  1268. {
  1269. m_Burn.NeroWorkError=1;
  1270. delete []photosarray;
  1271. return;
  1272. }
  1273. m_Burn.m_name=m_name;
  1274. m_Burn.m_bDvd=m_bDvd;
  1275. m_Burn.NeroAPIBurn();
  1276. NowDoingBurn=true; delete []photosarray;
  1277. ::DeleteDirectory (g_mainpath+"\\temp");
  1278. if(m_Burn.NeroWorkError==0)
  1279. {
  1280. CDialog::OnOK ();
  1281. }
  1282. else
  1283. CDialog::OnCancel ();
  1284. }
  1285. void CNeroDlg::OnCheck7()
  1286. {
  1287. // TODO: Add your control notification handler code here
  1288. UpdateData();
  1289. CString version = _T ("Version 1.0");
  1290. AfxGetApp()->WriteProfileInt (version, "cutphoto", m_bScale);
  1291. }
  1292. BOOL CNeroDlg::CheckDiskSpase()
  1293. {
  1294. CString sDrive = g_mainpath.Left(2);
  1295. DWORD dwTotalDiskSpace,dwFreeDiskSpace,dwUsedDiskSpace;
  1296. ULARGE_INTEGER uiFreeBytesAvailableToCaller;
  1297. ULARGE_INTEGER uiTotalNumberOfBytes;
  1298. ULARGE_INTEGER uiTotalNumberOfFreeBytes;
  1299. if(GetDiskFreeSpaceEx(sDrive, &uiFreeBytesAvailableToCaller,
  1300. &uiTotalNumberOfBytes,
  1301. &uiTotalNumberOfFreeBytes))
  1302. {
  1303. dwTotalDiskSpace = (DWORD)(uiTotalNumberOfBytes.QuadPart / 1024 / 1024);
  1304. dwFreeDiskSpace = (DWORD)(uiFreeBytesAvailableToCaller.QuadPart >> 20);
  1305. dwUsedDiskSpace = dwTotalDiskSpace - dwFreeDiskSpace;
  1306. }
  1307. if(dwFreeDiskSpace>600)return 1;
  1308. AfxMessageBox("磁盘空间不足!", MB_ICONSTOP);
  1309. return 0;
  1310. }
  1311. void CNeroDlg::OnCloseupCombo1()
  1312. {
  1313. // TODO: Add your control notification handler code here
  1314. int pos=m_combo1.GetCurSel ();
  1315. if(pos!=-1)
  1316. {
  1317. CString version = _T ("Version 1.0");
  1318. AfxGetApp()->WriteProfileInt (version, "cutphotosize", pos);
  1319. }
  1320. }
  1321. void CNeroDlg::OnRadio1()
  1322. {
  1323. // TODO: Add your control notification handler code here
  1324. OnRadio2();
  1325. }
  1326. void CNeroDlg::OnRadio2()
  1327. {
  1328. // TODO: Add your control notification handler code here
  1329. UpdateData();
  1330. CString version = _T ("Version 1.0");
  1331. AfxGetApp()->WriteProfileInt (version, "bDvd", m_bDvd);
  1332. }
  1333. void CNeroDlg::OnDestroy()
  1334. {
  1335. UpdateData();
  1336. CString version = _T ("Version 1.0");
  1337. AfxGetApp()->WriteProfileInt (version, "m_checkphoto1", m_checkphoto1);
  1338. AfxGetApp()->WriteProfileInt (version, "m_checkphoto2", m_checkphoto2);
  1339. AfxGetApp()->WriteProfileInt (version, "m_checkphoto3", m_checkphoto3);
  1340. AfxGetApp()->WriteProfileInt (version, "m_checkphoto4", m_checkphoto4);
  1341. AfxGetApp()->WriteProfileInt (version, "m_checkphoto5", m_checkphoto5);
  1342. AfxGetApp()->WriteProfileInt (version, "m_checkphoto6", m_checkphoto6);
  1343. // TODO: Add your message handler code here
  1344. CDialog::OnDestroy();
  1345. }