NeroDlg.cpp 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478
  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();
  413. coo.end() != it;
  414. it ++)
  415. {
  416. str=(*it).c_str();
  417. if(FindArray(&dirarray, str)==-1)
  418. {
  419. dirarray.Add (str);
  420. }
  421. }
  422. for(int i=0; i<dirarray.GetSize (); i++)
  423. {
  424. using namespace helper_coffs;
  425. ffsco o;
  426. o.dirs(0);
  427. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  428. ffsco::typeT coo;
  429. ffsco::typeT::iterator it;
  430. coo = o.co_file();
  431. for (it = coo.begin();
  432. coo.end() != it;
  433. it ++)
  434. {
  435. str=(*it).c_str();
  436. m_photoarray7.Add (str);
  437. }
  438. }
  439. if(m_photoarray7.GetSize ()==0)
  440. {
  441. AfxMessageBox("警告:目录中无照片!", MB_ICONSTOP);
  442. }
  443. m_nphotos=m_photoarray7.GetSize ();
  444. m_nspase=0;
  445. for( i=0; i<m_photoarray7.GetSize (); i++)
  446. {
  447. CFile fp;
  448. if(fp.Open (m_photoarray7.ElementAt (i), CFile::modeRead))
  449. {
  450. m_nspase+=fp.GetLength ();
  451. fp.Close ();
  452. }
  453. }
  454. m_nspase/=(1024*1024);
  455. str.Format ("照片:%d 占用空间:%dM", m_nphotos, m_nspase);
  456. GetDlgItem(IDC_STATIC7)->SetWindowText(str);
  457. }
  458. void CNeroDlg::OnCheck1()
  459. {
  460. // TODO: Add your control notification handler code here
  461. UpdateData();
  462. if(m_checkphoto1)
  463. {
  464. if(m_photoarray1.GetSize ()==0)
  465. {
  466. CString path;
  467. path=g_path4+"\\";
  468. path+=m_id;
  469. path +="\\";
  470. m_realpath=g_path4;
  471. CStringArray dirarray;
  472. CString str;
  473. using namespace helper_coffs;
  474. ffsco o;
  475. o.dirs(1);
  476. o.find(LPCSTR(path), LPCSTR("*.*"));
  477. ffsco::typeT coo;
  478. ffsco::typeT::iterator it;
  479. coo = o.co_dir();
  480. for (it = coo.begin();
  481. coo.end() != it;
  482. it ++)
  483. {
  484. str=(*it).c_str();
  485. if(FindArray(&dirarray, str)==-1)
  486. {
  487. dirarray.Add (str);
  488. }
  489. }
  490. for(int i=0; i<dirarray.GetSize (); i++)
  491. {
  492. using namespace helper_coffs;
  493. ffsco o;
  494. o.dirs(0);
  495. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  496. ffsco::typeT coo;
  497. ffsco::typeT::iterator it;
  498. coo = o.co_file();
  499. for (it = coo.begin();
  500. coo.end() != it;
  501. it ++)
  502. {
  503. str=(*it).c_str();
  504. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  505. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  506. m_photoarray1.Add (str);
  507. }
  508. }
  509. if(m_photoarray1.GetSize ()==0)
  510. {
  511. AfxMessageBox("没有找到精修片,将用初修片替代!");
  512. path=g_path2+"\\";
  513. path+=m_id;
  514. path +="\\";
  515. m_realpath=g_path2;
  516. CStringArray dirarray;
  517. CString str,temp;
  518. using namespace helper_coffs;
  519. ffsco o;
  520. o.dirs(1);
  521. o.find(LPCSTR(path), LPCSTR("*.*"));
  522. ffsco::typeT coo;
  523. ffsco::typeT::iterator it;
  524. coo = o.co_dir();
  525. for (it = coo.begin();
  526. coo.end() != it;
  527. it ++)
  528. {
  529. str=(*it).c_str();
  530. if(FindArray(&dirarray, str)==-1)
  531. {
  532. dirarray.Add (str);
  533. }
  534. }
  535. for(int i=0; i<dirarray.GetSize (); i++)
  536. {
  537. using namespace helper_coffs;
  538. ffsco o;
  539. o.dirs(0);
  540. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  541. ffsco::typeT coo;
  542. ffsco::typeT::iterator it;
  543. coo = o.co_file();
  544. for (it = coo.begin();
  545. coo.end() != it;
  546. it ++)
  547. {
  548. str=(*it).c_str();
  549. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  550. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  551. /* temp=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  552. temp=temp.Left (3);
  553. if(FindArray(&m_noarray, temp)==-1)
  554. continue;*/
  555. if(::FindArray (&m_noarray, GetFileNameFromPath(str))==-1)
  556. continue;
  557. m_photoarray1.Add (str);
  558. }
  559. }
  560. }
  561. if(m_photoarray1.GetSize ()==0)
  562. {
  563. AfxMessageBox("没有找到初修片,将用原片替代!");
  564. path=g_path1+"\\";
  565. path+=m_id;
  566. path +="\\";
  567. m_realpath=g_path1;
  568. CStringArray dirarray;
  569. CString str,temp;
  570. using namespace helper_coffs;
  571. ffsco o;
  572. o.dirs(1);
  573. o.find(LPCSTR(path), LPCSTR("*.*"));
  574. ffsco::typeT coo;
  575. ffsco::typeT::iterator it;
  576. coo = o.co_dir();
  577. for (it = coo.begin();
  578. coo.end() != it;
  579. it ++)
  580. {
  581. str=(*it).c_str();
  582. if(FindArray(&dirarray, str)==-1)
  583. {
  584. dirarray.Add (str);
  585. }
  586. }
  587. for(int i=0; i<dirarray.GetSize (); i++)
  588. {
  589. using namespace helper_coffs;
  590. ffsco o;
  591. o.dirs(0);
  592. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  593. ffsco::typeT coo;
  594. ffsco::typeT::iterator it;
  595. coo = o.co_file();
  596. for (it = coo.begin();
  597. coo.end() != it;
  598. it ++)
  599. {
  600. str=(*it).c_str();
  601. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  602. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  603. /* temp=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
  604. temp=temp.Left (3);
  605. if(FindArray(&m_noarray, temp)==-1)
  606. continue;*/
  607. if(::FindArray (&m_noarray, GetFileNameFromPath(str))==-1)
  608. continue;
  609. m_photoarray1.Add (str);
  610. }
  611. }
  612. }
  613. m_nphotos1=m_photoarray1.GetSize ();
  614. m_nspase1=0;
  615. for( i=0; i<m_photoarray1.GetSize (); i++)
  616. {
  617. CFile fp;
  618. if(fp.Open (m_photoarray1.ElementAt (i), CFile::modeRead))
  619. {
  620. m_nspase1+=fp.GetLength ();
  621. fp.Close ();
  622. }
  623. }
  624. m_nspase1temp=m_nspase1;
  625. }
  626. else
  627. {
  628. m_nphotos1=m_photoarray1.GetSize ();
  629. m_nspase1=m_nspase1temp;
  630. }
  631. }
  632. else
  633. {
  634. m_nphotos1=0;
  635. m_nspase1=0;
  636. }
  637. CString str;
  638. str.Format ("照片:%d 占用空间:%dM", m_nphotos1, m_nspase1/(1024*1024));
  639. GetDlgItem(IDC_STATIC1)->SetWindowText(str);
  640. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  641. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  642. }
  643. void CNeroDlg::OnCheck2()
  644. {
  645. // TODO: Add your control notification handler code here
  646. UpdateData();
  647. if(m_checkphoto2)
  648. {
  649. if(m_checkphoto5)
  650. m_checkphoto5=0;
  651. UpdateData(false);
  652. OnCheck5();
  653. if(m_photoarray2.GetSize ()==0)
  654. {
  655. CString path;
  656. path=g_path2+"\\";
  657. path+=m_id;
  658. path +="\\";
  659. CString str;
  660. if(m_noarray.GetSize ()==0)
  661. {
  662. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  663. return;
  664. }
  665. for(int i=0; i<m_noarray.GetSize (); i++)
  666. {
  667. str.Format ("%s%s.jpg", path, m_noarray.ElementAt (i));
  668. if(::CheckFileExist (str))
  669. {
  670. m_photoarray2.Add (str);
  671. }
  672. }
  673. if(m_photoarray2.GetSize ()==0)
  674. {
  675. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  676. }
  677. m_nphotos2=m_photoarray2.GetSize ();
  678. m_nspase2=0;
  679. for( i=0; i<m_photoarray2.GetSize (); i++)
  680. {
  681. CFile fp;
  682. if(fp.Open (m_photoarray2.ElementAt (i), CFile::modeRead))
  683. {
  684. m_nspase2+=fp.GetLength ();
  685. fp.Close ();
  686. }
  687. }
  688. m_nspase2temp=m_nspase2;
  689. }
  690. else
  691. {
  692. m_nphotos2=m_photoarray2.GetSize ();
  693. m_nspase2=m_nspase2temp;
  694. }
  695. }
  696. else
  697. {
  698. m_nphotos2=0;
  699. m_nspase2=0;
  700. }
  701. CString str;
  702. str.Format ("照片:%d 占用空间:%dM", m_nphotos2, m_nspase2/(1024*1024));
  703. GetDlgItem(IDC_STATIC2)->SetWindowText(str);
  704. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  705. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  706. }
  707. void CNeroDlg::OnCheck3()
  708. {
  709. // TODO: Add your control notification handler code here
  710. /* UpdateData();
  711. if(m_checkphoto3)
  712. {
  713. if(m_checkphoto4)
  714. m_checkphoto4=0;
  715. UpdateData(false);
  716. OnCheck4();
  717. if(m_photoarray3.GetSize ()==0)
  718. {
  719. CString path;
  720. path=g_path1+"\\";
  721. path+=m_id;
  722. path +="\\";
  723. if(m_noarray.GetSize ()==0)
  724. {
  725. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  726. return;
  727. }
  728. CString str;
  729. for(int i=0; i<m_noarray.GetSize (); i++)
  730. {
  731. str.Format ("%s%s.jpg", path, m_noarray.ElementAt (i));
  732. if(::CheckFolderFileExist (str))
  733. {
  734. m_photoarray3.Add (str);
  735. }
  736. }
  737. if(m_photoarray3.GetSize ()==0)
  738. {
  739. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  740. }
  741. m_nphotos3=m_photoarray3.GetSize ();
  742. m_nspase3=0;
  743. for( i=0; i<m_photoarray3.GetSize (); i++)
  744. {
  745. CFile fp;
  746. if(fp.Open (m_photoarray3.ElementAt (i), CFile::modeRead))
  747. {
  748. m_nspase3+=fp.GetLength ();
  749. fp.Close ();
  750. }
  751. }
  752. m_nspase3temp=m_nspase3;
  753. }
  754. else
  755. {
  756. m_nphotos3=m_photoarray3.GetSize ();
  757. m_nspase3=m_nspase3temp;
  758. }
  759. }
  760. else
  761. {
  762. m_nphotos3=0;
  763. m_nspase3=0;
  764. }
  765. CString str;
  766. str.Format ("照片:%d 占用空间:%dM", m_nphotos3, m_nspase3/(1024*1024));
  767. GetDlgItem(IDC_STATIC3)->SetWindowText(str);
  768. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  769. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  770. */
  771. }
  772. void CNeroDlg::OnCheck4()
  773. {
  774. // TODO: Add your control notification handler code here
  775. UpdateData();
  776. if(m_checkphoto4)
  777. {
  778. /* if(m_checkphoto3)
  779. m_checkphoto3=0;
  780. UpdateData(false);
  781. OnCheck3();*/
  782. if(m_photoarray4.GetSize ()==0)
  783. {
  784. CString path;
  785. path=g_path1+"\\";
  786. path+=m_id;
  787. path +="\\";
  788. CStringArray dirarray;
  789. CString str;
  790. using namespace helper_coffs;
  791. ffsco o;
  792. o.dirs(1);
  793. o.find(LPCSTR(path), LPCSTR("*.*"));
  794. ffsco::typeT coo;
  795. ffsco::typeT::iterator it;
  796. coo = o.co_dir();
  797. for (it = coo.begin();
  798. coo.end() != it;
  799. it ++)
  800. {
  801. str=(*it).c_str();
  802. if(FindArray(&dirarray, str)==-1)
  803. {
  804. dirarray.Add (str);
  805. }
  806. }
  807. for(int i=0; i<dirarray.GetSize (); i++)
  808. {
  809. using namespace helper_coffs;
  810. ffsco o;
  811. o.dirs(0);
  812. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  813. ffsco::typeT coo;
  814. ffsco::typeT::iterator it;
  815. coo = o.co_file();
  816. for (it = coo.begin();
  817. coo.end() != it;
  818. it ++)
  819. {
  820. str=(*it).c_str();
  821. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  822. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  823. m_photoarray4.Add (str);
  824. }
  825. }
  826. if(m_photoarray4.GetSize ()==0)
  827. {
  828. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  829. }
  830. m_nphotos4=m_photoarray4.GetSize ();
  831. m_nspase4=0;
  832. for( i=0; i<m_photoarray4.GetSize (); i++)
  833. {
  834. CFile fp;
  835. if(fp.Open (m_photoarray4.ElementAt (i), CFile::modeRead))
  836. {
  837. m_nspase4+=fp.GetLength ();
  838. fp.Close ();
  839. }
  840. }
  841. m_nspase4temp=m_nspase4;
  842. }
  843. else
  844. {
  845. m_nphotos4=m_photoarray4.GetSize ();
  846. m_nspase4=m_nspase4temp;
  847. }
  848. }
  849. else
  850. {
  851. m_nphotos4=0;
  852. m_nspase4=0;
  853. }
  854. CString str;
  855. str.Format ("照片:%d 占用空间:%dM", m_nphotos4, m_nspase4/(1024*1024));
  856. GetDlgItem(IDC_STATIC4)->SetWindowText(str);
  857. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  858. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  859. }
  860. void CNeroDlg::OnCheck5()
  861. {
  862. // TODO: Add your control notification handler code here
  863. UpdateData();
  864. if(m_checkphoto5)
  865. {
  866. if(m_checkphoto2)
  867. m_checkphoto2=0;
  868. UpdateData(false);
  869. OnCheck2();
  870. if(m_photoarray5.GetSize ()==0)
  871. {
  872. CString path;
  873. path=g_path2+"\\";
  874. path+=m_id;
  875. path +="\\";
  876. CStringArray dirarray;
  877. CString str;
  878. using namespace helper_coffs;
  879. ffsco o;
  880. o.dirs(1);
  881. o.find(LPCSTR(path), LPCSTR("*.*"));
  882. ffsco::typeT coo;
  883. ffsco::typeT::iterator it;
  884. coo = o.co_dir();
  885. for (it = coo.begin();
  886. coo.end() != it;
  887. it ++)
  888. {
  889. str=(*it).c_str();
  890. if(FindArray(&dirarray, str)==-1)
  891. {
  892. dirarray.Add (str);
  893. }
  894. }
  895. for(int i=0; i<dirarray.GetSize (); i++)
  896. {
  897. using namespace helper_coffs;
  898. ffsco o;
  899. o.dirs(0);
  900. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  901. ffsco::typeT coo;
  902. ffsco::typeT::iterator it;
  903. coo = o.co_file();
  904. for (it = coo.begin();
  905. coo.end() != it;
  906. it ++)
  907. {
  908. str=(*it).c_str();
  909. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  910. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  911. m_photoarray5.Add (str);
  912. }
  913. }
  914. if(m_photoarray5.GetSize ()==0)
  915. {
  916. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  917. }
  918. m_nphotos5=m_photoarray5.GetSize ();
  919. m_nspase5=0;
  920. for( i=0; i<m_photoarray5.GetSize (); i++)
  921. {
  922. CFile fp;
  923. if(fp.Open (m_photoarray5.ElementAt (i), CFile::modeRead))
  924. {
  925. m_nspase5+=fp.GetLength ();
  926. fp.Close ();
  927. }
  928. }
  929. m_nspase5temp=m_nspase5;
  930. }
  931. else
  932. {
  933. m_nphotos5=m_photoarray5.GetSize ();
  934. m_nspase5=m_nspase5temp;
  935. }
  936. }
  937. else
  938. {
  939. m_nphotos5=0;
  940. m_nspase5=0;
  941. }
  942. CString str;
  943. str.Format ("照片:%d 占用空间:%dM", m_nphotos5, m_nspase5/(1024*1024));
  944. GetDlgItem(IDC_STATIC5)->SetWindowText(str);
  945. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  946. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  947. }
  948. void CNeroDlg::OnCheck6()
  949. {
  950. // TODO: Add your control notification handler code here
  951. UpdateData();
  952. if(m_checkphoto6)
  953. {
  954. if(m_photoarray6.GetSize ()==0)
  955. {
  956. CString path;
  957. path=g_path3+"\\";
  958. path+=m_id;
  959. path +="\\";
  960. CStringArray dirarray;
  961. CString str;
  962. using namespace helper_coffs;
  963. ffsco o;
  964. o.dirs(1);
  965. o.find(LPCSTR(path), LPCSTR("*.*"));
  966. ffsco::typeT coo;
  967. ffsco::typeT::iterator it;
  968. coo = o.co_dir();
  969. for (it = coo.begin();
  970. coo.end() != it;
  971. it ++)
  972. {
  973. str=(*it).c_str();
  974. if(FindArray(&dirarray, str)==-1)
  975. {
  976. dirarray.Add (str);
  977. }
  978. }
  979. for(int i=0; i<dirarray.GetSize (); i++)
  980. {
  981. using namespace helper_coffs;
  982. ffsco o;
  983. o.dirs(0);
  984. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  985. ffsco::typeT coo;
  986. ffsco::typeT::iterator it;
  987. coo = o.co_file();
  988. for (it = coo.begin();
  989. coo.end() != it;
  990. it ++)
  991. {
  992. str=(*it).c_str();
  993. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  994. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  995. m_photoarray6.Add (str);
  996. }
  997. }
  998. if(m_photoarray6.GetSize ()==0)
  999. {
  1000. AfxMessageBox("警告:此单未导片!", MB_ICONSTOP);
  1001. }
  1002. m_nphotos6=m_photoarray6.GetSize ();
  1003. m_nspase6=0;
  1004. for( i=0; i<m_photoarray6.GetSize (); i++)
  1005. {
  1006. CFile fp;
  1007. if(fp.Open (m_photoarray6.ElementAt (i), CFile::modeRead))
  1008. {
  1009. m_nspase6+=fp.GetLength ();
  1010. fp.Close ();
  1011. }
  1012. }
  1013. m_nspase6temp=m_nspase6;
  1014. }
  1015. else
  1016. {
  1017. m_nphotos6=m_photoarray6.GetSize ();
  1018. m_nspase6=m_nspase6temp;
  1019. }
  1020. }
  1021. else
  1022. {
  1023. m_nphotos6=0;
  1024. m_nspase6=0;
  1025. }
  1026. CString str;
  1027. str.Format ("照片:%d 占用空间:%dM", m_nphotos6, m_nspase6/(1024*1024));
  1028. GetDlgItem(IDC_STATIC6)->SetWindowText(str);
  1029. m_nphotos=m_nphotos1+m_nphotos2+m_nphotos3+m_nphotos4+m_nphotos5+m_nphotos6;
  1030. m_nspase=(m_nspase1+m_nspase2+m_nspase3+m_nspase4+m_nspase5+m_nspase6)/(1024*1024);
  1031. }
  1032. void CNeroDlg::GetNo(CString str, CStringArray &array)
  1033. {
  1034. if(!str.IsEmpty ())
  1035. {
  1036. int pos=str.Find (",");
  1037. while(pos!=-1)
  1038. {
  1039. if(FindArray(&array, str.Left (pos))==-1)
  1040. array.Add (str.Left (pos));
  1041. str=str.Right (str.GetLength ()-pos-1);
  1042. pos=str.Find (",");
  1043. }
  1044. if(FindArray(&array, str)==-1)
  1045. array.Add(str);
  1046. }
  1047. }
  1048. extern bool SleepEx( DWORD dwMilliseconds );
  1049. void CNeroDlg::OnOK()
  1050. {
  1051. ::DeleteDirectory (g_mainpath+"\\temp");
  1052. ::CreateDirectory (g_mainpath+"\\temp", NULL);
  1053. UpdateData();
  1054. if(m_bScale)
  1055. {
  1056. if(!CheckDiskSpase())return;
  1057. }
  1058. if(m_nphotos==0)
  1059. {
  1060. AfxMessageBox("未选中照片!", MB_ICONSTOP);
  1061. return;
  1062. }
  1063. if(m_nspase>650 && m_bDvd==0 && m_bScale==0)
  1064. {
  1065. AfxMessageBox("光盘空间不足!", MB_ICONSTOP);
  1066. return;
  1067. }
  1068. m_Burn.m_DirArray.RemoveAll ();
  1069. m_Burn.m_DirRealNameArray.RemoveAll ();
  1070. CArray<BOOL,BOOL>bIsSelectDirArray;
  1071. GetDlgItem(IDOK)->SetWindowText("刻录中, 请稍候...");
  1072. GetDlgItem(IDOK)->EnableWindow(0);
  1073. if(NowDoingBurn)
  1074. return;
  1075. CStringArray dirarray;
  1076. using namespace helper_coffs;
  1077. CStringArray srcarray;
  1078. if(m_bFromDir)
  1079. {
  1080. CString str;
  1081. GetDlgItemText(IDC_EDIT1, str);
  1082. str.TrimRight ('\\');
  1083. m_Burn.m_DirArray.Add (str);
  1084. m_Burn.m_DirRealNameArray.Add (str);
  1085. bIsSelectDirArray.Add (0);
  1086. }
  1087. else
  1088. {
  1089. if(m_checkphoto1)
  1090. {
  1091. if( m_realpath==g_path1 && m_checkphoto4)//没有精修片用原片代替,同时又要刻原片时, 把原片备份出来
  1092. {
  1093. SetDlgItemText(IDC_STATICTip, "照片复制中...");
  1094. m_Progress.SetRange (0, m_photoarray1.GetSize ());
  1095. CString path=g_mainpath+"\\temp\\"+m_id+"(精修)";
  1096. ::CreateDirectory (path, NULL);
  1097. CString str;
  1098. for(int i=0; i<m_photoarray1.GetSize (); i++)
  1099. {
  1100. str=m_photoarray1.ElementAt (i);
  1101. ::CopyFile (str, path+str.Right (str.GetLength ()-str.ReverseFind ('\\')), 0);
  1102. m_Progress.SetPos (i);
  1103. }
  1104. m_Burn.m_DirArray.Add (path);
  1105. m_Burn.m_DirRealNameArray.Add (path);
  1106. bIsSelectDirArray.Add (0);
  1107. }
  1108. else
  1109. {
  1110. m_Burn.m_DirArray.Add (m_realpath+"\\"+m_id);
  1111. m_Burn.m_DirRealNameArray.Add (m_realpath+"\\"+m_id+"(精修)");
  1112. if(m_realpath==g_path4)
  1113. bIsSelectDirArray.Add (0);
  1114. else
  1115. bIsSelectDirArray.Add (1);
  1116. }
  1117. }
  1118. if(m_checkphoto5)
  1119. {
  1120. m_Burn.m_DirArray.Add (g_path2+"\\"+m_id);
  1121. m_Burn.m_DirRealNameArray.Add (g_path2+"\\"+m_id+"(初修)");
  1122. bIsSelectDirArray.Add (0);
  1123. }
  1124. if(m_checkphoto4)
  1125. {
  1126. m_Burn.m_DirArray.Add (g_path1+"\\"+m_id);
  1127. m_Burn.m_DirRealNameArray.Add (g_path1+"\\"+m_id+"(原片)");
  1128. bIsSelectDirArray.Add (0);
  1129. }
  1130. if(m_checkphoto6)
  1131. {
  1132. m_Burn.m_DirArray.Add (g_path3+"\\"+m_id);
  1133. m_Burn.m_DirRealNameArray.Add (g_path3+"\\"+m_id+"(设计片)");
  1134. bIsSelectDirArray.Add (0);
  1135. }
  1136. }
  1137. DWORD nNeedSpase=0;
  1138. if(m_bScale)
  1139. {
  1140. SetDlgItemText(IDC_STATICTip, "照片裁切中...");
  1141. int pos=m_combo1.GetCurSel ();
  1142. CStringArray needsaclearray;
  1143. CStringArray dirarray;
  1144. for(int i=0; i<m_Burn.m_DirArray.GetSize (); i++)
  1145. {
  1146. GenSPhoto(m_Burn.m_DirArray.ElementAt (i), m_Burn.m_DirRealNameArray.ElementAt (i).Right (6), needsaclearray, dirarray);
  1147. }
  1148. m_Progress.SetRange (0, needsaclearray.GetSize ());
  1149. for( i=0; i<needsaclearray.GetSize (); i++)
  1150. {
  1151. CString str=needsaclearray.ElementAt (i);
  1152. CString dir;
  1153. dir=dirarray.ElementAt (i);
  1154. Image *img=NULL;
  1155. ::LoadImageFromBuf (&img, str);
  1156. if(img->GetWidth())
  1157. {
  1158. CRect rc(0,0,800,800);
  1159. if(pos==0)
  1160. {
  1161. rc.right =1600;
  1162. rc.bottom =1600;
  1163. }
  1164. else if(pos==1)
  1165. {
  1166. rc.right =1024;
  1167. rc.bottom =1024;
  1168. }
  1169. else if(pos==2)
  1170. {
  1171. rc.right =800;
  1172. rc.bottom =800;
  1173. }
  1174. else
  1175. {
  1176. rc.right =640;
  1177. rc.bottom =640;
  1178. }
  1179. RectFitDes(img->GetWidth(), img->GetHeight(), rc);
  1180. Image *simg= img->GetThumbnailImage(rc.Width (), rc.Height (), NULL, NULL);
  1181. Graphics graphic(simg);//防止GetThumbnailImage影响质量
  1182. graphic.DrawImage(img, 0,0,simg->GetWidth(), simg->GetHeight() );
  1183. delete img;
  1184. CString savepath=dir+"\\"+::GetFileNameFromPath (str)+".jpg";
  1185. ::SaveImageToFile(simg, savepath);
  1186. delete simg;
  1187. CFile fp;
  1188. if(fp.Open (savepath, CFile::modeRead))
  1189. {
  1190. nNeedSpase+=fp.GetLength ();
  1191. fp.Close ();
  1192. }
  1193. else
  1194. {
  1195. /* ::CopyFile (str, savepath, 0);
  1196. if(fp.Open (savepath, CFile::modeRead))
  1197. {
  1198. nNeedSpase+=fp.GetLength ();
  1199. fp.Close ();
  1200. }*/
  1201. str.Format ("原片%s裁剪失败, 请查看此照片是否损坏。", savepath.Right (savepath.GetLength ()-savepath.ReverseFind ('\\')-1));
  1202. AfxMessageBox(str);
  1203. }
  1204. }
  1205. m_Progress.SetPos (i+1);
  1206. ::SleepEx(10);
  1207. }
  1208. if(::CheckFolderFileExist (g_mainpath+"\\temp\\"+m_id+"(未选的照片)"))
  1209. {
  1210. m_Burn.m_DirArray.Add (g_mainpath+"\\temp\\"+m_id+"(未选的照片)");
  1211. m_Burn.m_DirRealNameArray.Add (g_mainpath+"\\temp\\"+m_id+"(未选的照片)");
  1212. bIsSelectDirArray.Add (0);
  1213. }
  1214. }
  1215. SetDlgItemText(IDC_STATICTip, "光盘刻录中...");
  1216. CString str;
  1217. CArray<BOOL,BOOL>bIsSelectDirArray2;
  1218. for(int i=0; i<m_Burn.m_DirArray.GetSize (); i++)
  1219. {
  1220. ffsco o;
  1221. o.dirs(1);
  1222. o.find(LPCSTR(m_Burn.m_DirArray.ElementAt (i)), LPCSTR("*.*"));
  1223. ffsco::typeT coo;
  1224. ffsco::typeT::iterator it;
  1225. coo = o.co_dir();
  1226. for (it = coo.begin();
  1227. coo.end() != it;
  1228. it ++)
  1229. {
  1230. str=(*it).c_str();
  1231. str.TrimRight("\\");
  1232. if(FindArray(&dirarray, str)==-1)
  1233. {
  1234. dirarray.Add (str);
  1235. bIsSelectDirArray2.Add (bIsSelectDirArray.ElementAt (i));
  1236. }
  1237. }
  1238. }
  1239. int addcount=0;
  1240. if(m_bFromDir==0)
  1241. {
  1242. if(m_checkphoto2)addcount++;
  1243. if(m_checkphoto3)addcount++;
  1244. }
  1245. if((dirarray.GetSize ()+addcount)==0)return;
  1246. CStringArray *photosarray=new CStringArray[dirarray.GetSize()+addcount];
  1247. for( i=0; i<dirarray.GetSize (); i++)
  1248. {
  1249. GenSPhoto(dirarray.ElementAt (i), photosarray[i], nNeedSpase,bIsSelectDirArray2.ElementAt (i));
  1250. }
  1251. if(m_bFromDir==0)
  1252. {
  1253. int pos=dirarray.GetSize ();
  1254. if(m_checkphoto2)
  1255. {
  1256. m_Burn.m_DirArray.Add (g_path2+"\\"+m_id);
  1257. m_Burn.m_DirRealNameArray.Add (g_path2+"\\"+m_id+"(初修)");
  1258. dirarray.Add(g_path2+"\\"+m_id);
  1259. photosarray[pos].Copy (m_photoarray2);
  1260. pos++;
  1261. nNeedSpase+=m_nspase1;
  1262. }
  1263. if(m_checkphoto3)
  1264. {
  1265. m_Burn.m_DirArray.Add (g_path1+"\\"+m_id);
  1266. m_Burn.m_DirRealNameArray.Add (g_path1+"\\"+m_id+"(原片)");
  1267. dirarray.Add(g_path1+"\\"+m_id);
  1268. photosarray[pos].Copy (m_photoarray3);
  1269. nNeedSpase+=m_nspase2;
  1270. }
  1271. }
  1272. if(m_bScale)
  1273. {
  1274. nNeedSpase/=1024*1024;
  1275. if(nNeedSpase>650 && m_bDvd==0)
  1276. {
  1277. AfxMessageBox("光盘空间不足!", MB_ICONSTOP);delete []photosarray;
  1278. return;
  1279. }
  1280. }
  1281. m_Burn.m_pDir=&dirarray;
  1282. m_Burn.m_pPhotoArray=photosarray;
  1283. if(m_Burn.NeroAPIInit()==0)
  1284. {
  1285. m_Burn.NeroWorkError=1;
  1286. delete []photosarray;
  1287. return;
  1288. }
  1289. m_Burn.m_name=m_name;
  1290. m_Burn.m_bDvd=m_bDvd;
  1291. m_Burn.NeroAPIBurn();
  1292. NowDoingBurn=true; delete []photosarray;
  1293. ::DeleteDirectory (g_mainpath+"\\temp");
  1294. if(m_Burn.NeroWorkError==0)
  1295. {
  1296. CDialog::OnOK ();
  1297. }
  1298. else
  1299. CDialog::OnCancel ();
  1300. }
  1301. void CNeroDlg::OnCheck7()
  1302. {
  1303. // TODO: Add your control notification handler code here
  1304. UpdateData();
  1305. CString version = _T ("Version 1.0");
  1306. AfxGetApp()->WriteProfileInt (version, "cutphoto", m_bScale);
  1307. }
  1308. BOOL CNeroDlg::CheckDiskSpase()
  1309. {
  1310. CString sDrive = g_mainpath.Left(2);
  1311. DWORD dwTotalDiskSpace,dwFreeDiskSpace,dwUsedDiskSpace;
  1312. ULARGE_INTEGER uiFreeBytesAvailableToCaller;
  1313. ULARGE_INTEGER uiTotalNumberOfBytes;
  1314. ULARGE_INTEGER uiTotalNumberOfFreeBytes;
  1315. if(GetDiskFreeSpaceEx(sDrive, &uiFreeBytesAvailableToCaller,
  1316. &uiTotalNumberOfBytes,
  1317. &uiTotalNumberOfFreeBytes))
  1318. {
  1319. dwTotalDiskSpace = (DWORD)(uiTotalNumberOfBytes.QuadPart / 1024 / 1024);
  1320. dwFreeDiskSpace = (DWORD)(uiFreeBytesAvailableToCaller.QuadPart >> 20);
  1321. dwUsedDiskSpace = dwTotalDiskSpace - dwFreeDiskSpace;
  1322. }
  1323. if(dwFreeDiskSpace>600)return 1;
  1324. AfxMessageBox("磁盘空间不足!", MB_ICONSTOP);
  1325. return 0;
  1326. }
  1327. void CNeroDlg::OnCloseupCombo1()
  1328. {
  1329. // TODO: Add your control notification handler code here
  1330. int pos=m_combo1.GetCurSel ();
  1331. if(pos!=-1)
  1332. {
  1333. CString version = _T ("Version 1.0");
  1334. AfxGetApp()->WriteProfileInt (version, "cutphotosize", pos);
  1335. }
  1336. }
  1337. void CNeroDlg::OnRadio1()
  1338. {
  1339. // TODO: Add your control notification handler code here
  1340. OnRadio2();
  1341. }
  1342. void CNeroDlg::OnRadio2()
  1343. {
  1344. // TODO: Add your control notification handler code here
  1345. UpdateData();
  1346. CString version = _T ("Version 1.0");
  1347. AfxGetApp()->WriteProfileInt (version, "bDvd", m_bDvd);
  1348. }
  1349. void CNeroDlg::OnDestroy()
  1350. {
  1351. UpdateData();
  1352. CString version = _T ("Version 1.0");
  1353. AfxGetApp()->WriteProfileInt (version, "m_checkphoto1", m_checkphoto1);
  1354. AfxGetApp()->WriteProfileInt (version, "m_checkphoto2", m_checkphoto2);
  1355. AfxGetApp()->WriteProfileInt (version, "m_checkphoto3", m_checkphoto3);
  1356. AfxGetApp()->WriteProfileInt (version, "m_checkphoto4", m_checkphoto4);
  1357. AfxGetApp()->WriteProfileInt (version, "m_checkphoto5", m_checkphoto5);
  1358. AfxGetApp()->WriteProfileInt (version, "m_checkphoto6", m_checkphoto6);
  1359. // TODO: Add your message handler code here
  1360. CDialog::OnDestroy();
  1361. }