NeroDlg.cpp 34 KB

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