ChooseDesignSkin.cpp 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723
  1. // ChooseDesignSkin.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ChooseDesignSkin.h"
  5. #include "YLGL.h"
  6. #include "./helper/ffsco.h"
  7. #include ".\MenuBarXP\MenuXP.h"
  8. #include "ChoosePhotoSkin3.h"
  9. #include "ShowPic22.h"
  10. #include "ClientRequirement.h"
  11. #include "MyLock.h"
  12. #include "ComparePhoto.h"
  13. #include "ReplaceDesignNo.h"
  14. #include "Login2.h"
  15. #include "TimeOutDlg.h"
  16. #include "ShowEffect.h"
  17. #include "SelBrunDevice.h"
  18. #include "ProductChooseFilter.h"
  19. #include "NewFolderDlg.h"
  20. #include "NetShareInfo.h"
  21. #include "ShowMsg3.h"
  22. using namespace helper_coffs;
  23. #ifdef _DEBUG
  24. //#define new DEBUG_NEW (如果出现new时传多个参数会出错)
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. using namespace helper_coffs;
  29. extern int GetOrientation(Image *image);
  30. extern HCURSOR g_cursorhand;
  31. /////////////////////////////////////////////////////////////////////////////
  32. // ChooseDesignSkin message handlers
  33. extern void SizeToContent(HWND hwnd, Image *img);
  34. //mode
  35. //0 全部
  36. //1 选中
  37. //2 未选
  38. //3 删除
  39. //4 入册
  40. //5 入底
  41. /////////////////////////////////////////////////////////////////////////////
  42. // ChooseDesignSkin dialog IDC_EDITzs
  43. ChooseDesignSkin::ChooseDesignSkin(CWnd* pParent /*=NULL*/) : ChoosePhotoBase(ChooseDesignSkin::IDD, pParent)
  44. {
  45. m_time4 = g_date;
  46. g_pMainWnd->GetSkin();
  47. m_bChooseBig = 0;
  48. m_Runingmode = 1;
  49. }
  50. ChooseDesignSkin::ChooseDesignSkin(DWORD id, CWnd* pParent) : ChoosePhotoBase(id, pParent)
  51. {
  52. m_time4 = g_date;
  53. g_pMainWnd->GetSkin();
  54. m_bChooseBig = 0;
  55. m_Runingmode = 1;
  56. }
  57. void ChooseDesignSkin::DoDataExchange(CDataExchange* pDX)
  58. {
  59. CDialog::DoDataExchange(pDX);
  60. //{{AFX_DATA_MAP(ChooseDesignSkin)
  61. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  62. DDX_Control(pDX, IDC_LIST3, m_List3);
  63. DDX_Control(pDX, IDC_LIST2, m_List2);
  64. DDX_Control(pDX, IDC_LIST1, m_List1);
  65. DDX_Text(pDX, IDC_EDITname1, m_name1);
  66. DDX_Text(pDX, IDC_EDITname2, m_name2);
  67. DDX_Text(pDX, IDC_EDITtime4, m_time4);
  68. DDX_Text(pDX, IDC_EDITwaiter3, m_waiter3);
  69. DDX_Text(pDX, IDC_EDITzs, m_takezs);
  70. DDX_Text(pDX, IDC_EDITzs2, m_taoxizs);
  71. DDX_Text(pDX, IDC_EDITzs3, m_choosezs);
  72. DDX_Text(pDX, IDC_EDITmoney3, m_money3);
  73. DDX_Text(pDX, IDC_EDITid, m_strOrderNumber);
  74. DDX_Text(pDX, IDC_EDITbz3, m_bz3);
  75. //}}AFX_DATA_MAP}
  76. }
  77. BEGIN_MESSAGE_MAP(ChooseDesignSkin, CDialog)
  78. //{{AFX_MSG_MAP(ChooseDesignSkin)
  79. ON_WM_PAINT()
  80. ON_WM_DESTROY()
  81. ON_WM_ERASEBKGND()
  82. ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
  83. ON_WM_CLOSE()
  84. ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnRclickList1)
  85. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  86. ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
  87. ON_WM_TIMER()
  88. //}}AFX_MSG_MAP
  89. ON_MESSAGE(WM_USER + 1101, OnBtnClick)
  90. ON_COMMAND_RANGE(IDM_MENUsp1 - 1, IDM_MENUsp1 + 200, OnCommandMenu)
  91. ON_MESSAGE(WM_USER + 200, UpdateTakeZS)
  92. END_MESSAGE_MAP()
  93. /////////////////////////////////////////////////////////////////////////////
  94. // ChooseDesignSkin message handlers
  95. BOOL ChooseDesignSkin::OnInitDialog() //初始化选片*看设计
  96. {
  97. ChoosePhotoBase::OnInitDialog();
  98. //加载相片和文件夹icon
  99. LoadImageFromRes(&m_pHideImg, MAKEINTRESOURCE(IDR_JPG5), _T("JPG"));
  100. if(m_pHideImg == NULL)
  101. {
  102. MessageBox(_T("加载图标失败"));
  103. return FALSE;
  104. }
  105. // 1.加载lia皮肤信息;
  106. g_bInSkin = 1;
  107. m_ticks = ::GetTickCount();
  108. if (g_cursorhand == NULL)
  109. g_cursorhand = AfxGetApp()->LoadCursor(IDC_CURSORHAND);
  110. BYTE *pData = NULL;
  111. BYTE *pDataBegin;
  112. //printf("Jeff:loadLia路径:%s\n\n",g_mainpath+"\\skin\\"+m_liapath);//Jeff Printf;
  113. if (!LoadLia(g_mainpath + _T("\\skin\\") + m_liapath, &pData, &pDataBegin, &m_pBk, m_hWnd))
  114. {
  115. EndDialog(0);
  116. return false;
  117. }
  118. //初始化按钮和位置
  119. //printf("Jeff:g_resdata2.nPicCount=%d\n\n",g_resdata2.nPicCount); // Jeff Printf,这个nPicCount好像一直是15;
  120. for (int i = 0; i < g_resdata2.nPicCount; i++)
  121. {
  122. g_resdata2.rect[i].left *= g_fscalex;
  123. g_resdata2.rect[i].right *= g_fscalex;
  124. g_resdata2.rect[i].top *= g_fscaley;
  125. g_resdata2.rect[i].bottom *= g_fscaley;
  126. if (i == 8)
  127. g_resdata2.rect[i] = g_resdata2.rect[2];
  128. else if (i == 9)
  129. g_resdata2.rect[i] = g_resdata2.rect[3];
  130. else if (i == 10)
  131. g_resdata2.rect[i] = g_resdata2.rect[1];
  132. if (g_resdata2.nPicBmpCount[i])
  133. {
  134. MyBmpButton2 *pic = new MyBmpButton2;
  135. m_picarray.Add((DWORD)pic);
  136. CRect rc = g_resdata2.rect[i];
  137. CString str;
  138. str.Format(_T("%d"), i + 1);
  139. pic->Create(str, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, rc, this, i + 100);
  140. pic->m_bmpcount = g_resdata2.nPicBmpCount[i];
  141. pic->ReadBmp(&pData, NULL, this);
  142. #ifdef SZWNS_VERSION//深圳维纳斯
  143. if(i==3 && m_mode2==0)
  144. {
  145. Image *img=NULL;
  146. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG6), _T("JPG"));
  147. delete pic->m_bmp;
  148. pic->m_bmp=img->Clone();
  149. delete img;
  150. img=NULL;
  151. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG7), _T("JPG"));
  152. delete pic->m_bmpfocus;
  153. pic->m_bmpfocus=img->Clone();
  154. delete img;
  155. img=NULL;
  156. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG8), _T("JPG"));
  157. delete pic->m_bmpfocused;
  158. pic->m_bmpfocused=img->Clone();
  159. delete img;
  160. }
  161. #endif//SZWNS_VERSION
  162. }
  163. else
  164. m_picarray.Add(NULL);
  165. m_rcarray.Add(g_resdata2.rect[i]);
  166. }
  167. delete[]pDataBegin;
  168. //初始化按钮位置
  169. {
  170. //看设计
  171. m_bHide = 0;
  172. // printf("Jeff:g_cominfoarray.ElementAt(0).ElementAt(86)=%s\n\n",g_cominfoarray.ElementAt(0).ElementAt(86)); // Jeff Printf;
  173. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
  174. {
  175. ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
  176. CRect rc, rc2;
  177. ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
  178. ((MyBmpButton2*)m_picarray.ElementAt(1))->GetWindowRect(rc2);
  179. int dtx = rc.right - rc2.right;
  180. ScreenToClient(rc2);
  181. rc2.left += dtx;
  182. rc2.right += dtx;
  183. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  184. ((MyBmpButton2*)m_picarray.ElementAt(0))->GetWindowRect(rc2);
  185. ScreenToClient(rc2);
  186. rc2.left += dtx;
  187. rc2.right += dtx;
  188. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  189. }
  190. CRect rc, rc2;
  191. ((MyBmpButton2*)m_picarray.ElementAt(5))->GetWindowRect(rc);
  192. ((MyBmpButton2*)m_picarray.ElementAt(4))->GetWindowRect(rc2);
  193. int dtx = rc.right - rc2.right;
  194. rc2 = rc;
  195. // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
  196. {
  197. float scale = 0.9;
  198. dtx *= scale;
  199. int wid = rc2.Width()*scale;
  200. int hei = rc2.Height()*scale;
  201. int dty = rc2.Height() - hei;
  202. dty /= 2;
  203. rc2.left = rc2.right - wid;
  204. rc2.top += dty;
  205. rc2.bottom = rc2.top + hei;
  206. }
  207. ScreenToClient(rc2);
  208. ((MyBmpButton2*)m_picarray.ElementAt(5))->MoveWindow(rc2);
  209. rc2.left -= dtx;
  210. rc2.right -= dtx;
  211. ((MyBmpButton2*)m_picarray.ElementAt(4))->MoveWindow(rc2);
  212. rc2.left -= dtx;
  213. rc2.right -= dtx;
  214. ((MyBmpButton2*)m_picarray.ElementAt(14))->MoveWindow(rc2);
  215. rc2.left -= dtx;
  216. rc2.right -= dtx;
  217. ((MyBmpButton2*)m_picarray.ElementAt(2))->MoveWindow(rc2);
  218. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)) == 0)
  219. {
  220. rc2.left -= dtx;
  221. rc2.right -= dtx;
  222. ((MyBmpButton2*)m_picarray.ElementAt(3))->MoveWindow(rc2);
  223. }
  224. rc2.left -= dtx;
  225. rc2.right -= dtx;
  226. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  227. rc2.left -= dtx;
  228. rc2.right -= dtx;
  229. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  230. rc2.left -= dtx;
  231. rc2.right -= dtx;
  232. ((MyBmpButton2*)m_picarray.ElementAt(8))->MoveWindow(rc2);
  233. ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
  234. }
  235. if (1)//m_mode2==0)
  236. {
  237. ((MyBmpButton2*)m_picarray.ElementAt(7))->ShowWindow(SW_HIDE);
  238. ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_HIDE);
  239. ((MyBmpButton2*)m_picarray.ElementAt(9))->ShowWindow(SW_HIDE);
  240. ((MyBmpButton2*)m_picarray.ElementAt(10))->ShowWindow(SW_HIDE);
  241. ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
  242. }
  243. else
  244. {
  245. ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
  246. ((MyBmpButton2*)m_picarray.ElementAt(0))->ShowWindow(SW_HIDE);
  247. ((MyBmpButton2*)m_picarray.ElementAt(1))->ShowWindow(SW_HIDE);
  248. ((MyBmpButton2*)m_picarray.ElementAt(2))->ShowWindow(SW_HIDE);
  249. ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
  250. ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
  251. if (IsHasRights2new(37) == 0)
  252. {
  253. ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_HIDE);
  254. ((MyBmpButton2*)m_picarray.ElementAt(9))->ShowWindow(SW_HIDE);
  255. }
  256. }
  257. ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_SHOW);
  258. // ((MyBmpButton2*)m_picarray.ElementAt (8))->SetPushDown (1);
  259. ((MyBmpButton2*)m_picarray.ElementAt(12))->ShowWindow(SW_HIDE);
  260. ((MyBmpButton2*)m_picarray.ElementAt(13))->ShowWindow(SW_HIDE);
  261. #ifndef MNLS_VERSION//mnls
  262. ((MyBmpButton2*)m_picarray.ElementAt(7))->ShowWindow(SW_HIDE);
  263. ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
  264. Graphics graph(m_pBk);
  265. Image *img = NULL;
  266. ::LoadImageFromBuf(&img, g_mainpath + _T("\\图片\\标题-看设计.jpg"));
  267. if (img)
  268. {
  269. if (img->GetWidth() == 2000)
  270. {
  271. graph.SetSmoothingMode(SmoothingModeHighQuality);
  272. graph.DrawImage(img, 0, 0);
  273. }
  274. delete img;
  275. }
  276. #endif//MNLS_VERSION
  277. //初始化列表位置
  278. CRect listrc = m_rcarray.ElementAt(6);
  279. CRect rc;
  280. GetClientRect(rc);
  281. rc.top = listrc.top;
  282. m_List1.MoveWindow(rc);
  283. //创建图标列表控件
  284. m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
  285. m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
  286. m_List2.InitStyle();
  287. m_List2.InsertColumn(0, _T("编号"), LVCFMT_LEFT, 45);
  288. m_List2.InsertColumn(1, _T("商品名称"), LVCFMT_LEFT, 150);
  289. m_List2.InsertColumn(2, _T("数量"), LVCFMT_LEFT, 45);
  290. m_List3.InitStyle();
  291. m_List3.InsertColumn(0, _T("autoid"), LVCFMT_LEFT, 0);
  292. m_List3.InsertColumn(1, _T("编号"), LVCFMT_LEFT, 45);
  293. m_List3.InsertColumn(2, _T("商品名称"), LVCFMT_LEFT, 150);
  294. m_List3.InsertColumn(3, _T("价格"), LVCFMT_LEFT, 45);
  295. m_List3.InsertColumn(4, _T("数量"), LVCFMT_LEFT, 45);
  296. #ifdef LKAY_VERSION
  297. m_List3.InsertColumn(5,_T("P数"),LVCFMT_LEFT,55);
  298. m_List3.InsertColumn(6,_T("张数"),LVCFMT_LEFT,55);
  299. m_List3.InsertColumn(7,_T("照片编号"),LVCFMT_LEFT,365);
  300. #else
  301. m_List3.InsertColumn(5, _T("照片编号"), LVCFMT_LEFT, 365);
  302. // 2015.11.13 保存列表添加多一列商品备注选项;
  303. m_List3.InsertColumn(6, _T("备注"), LVCFMT_LEFT, 300);
  304. #endif//LKAY_VERSION
  305. CString path, str;
  306. m_path = g_path3 + _T("\\");
  307. m_path += m_strOrderNumber;
  308. m_path += _T("\\");
  309. GetPhotos();
  310. {
  311. //选设计模式
  312. GetData();
  313. if (m_checkstatus != _T("未看"))
  314. {
  315. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(85)) && IsHasRights2new(20) == 0)
  316. {
  317. Login2 dlg;
  318. if (dlg.DoModal() != IDOK)
  319. {
  320. MyBmpButton2 *btn = ((MyBmpButton2*)m_picarray.ElementAt(4));
  321. btn->m_bmpdisable = btn->m_bmp->Clone();
  322. Graphics graph(btn->m_bmpdisable);
  323. CPoint pt1, pt2, pt3;
  324. pt1.x = 0;
  325. pt1.y = 0;
  326. pt2.x = btn->m_bmp->GetWidth();
  327. pt2.y = 0;
  328. pt3.x = 0;
  329. pt3.y = btn->m_bmp->GetHeight();
  330. Point destinationPoints[] = {
  331. Point(pt1.x, pt1.y), // destination for upper-left point of original
  332. Point(pt2.x, pt2.y), // destination for upper-right point of original
  333. Point(pt3.x, pt3.y) }; // destination for lower-left point of original
  334. ColorMatrix colorMatrix = \
  335. {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  336. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  337. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  338. 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
  339. 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
  340. ImageAttributes imageAtt;
  341. imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
  342. graph.DrawImage(btn->m_bmp,
  343. destinationPoints,
  344. 3,
  345. 0,
  346. 0,
  347. btn->m_bmp->GetWidth(),
  348. btn->m_bmp->GetHeight(),
  349. UnitPixel,
  350. &imageAtt);
  351. btn->EnableWindow(0);
  352. m_bCanSave = 0;
  353. // CDialog::OnCancel ();
  354. // return 1;
  355. }
  356. else if (IsHasRightsnew2(20, dlg.m_rights) == 0)
  357. {
  358. MyBmpButton2 *btn = ((MyBmpButton2*)m_picarray.ElementAt(4));
  359. btn->m_bmpdisable = btn->m_bmp->Clone();
  360. Graphics graph(btn->m_bmpdisable);
  361. CPoint pt1, pt2, pt3;
  362. pt1.x = 0;
  363. pt1.y = 0;
  364. pt2.x = btn->m_bmp->GetWidth();
  365. pt2.y = 0;
  366. pt3.x = 0;
  367. pt3.y = btn->m_bmp->GetHeight();
  368. Point destinationPoints[] = {
  369. Point(pt1.x, pt1.y), // destination for upper-left point of original
  370. Point(pt2.x, pt2.y), // destination for upper-right point of original
  371. Point(pt3.x, pt3.y) }; // destination for lower-left point of original
  372. ColorMatrix colorMatrix = \
  373. {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  374. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  375. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  376. 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
  377. 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
  378. ImageAttributes imageAtt;
  379. imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
  380. graph.DrawImage(btn->m_bmp,
  381. destinationPoints,
  382. 3,
  383. 0,
  384. 0,
  385. btn->m_bmp->GetWidth(),
  386. btn->m_bmp->GetHeight(),
  387. UnitPixel,
  388. &imageAtt);
  389. btn->EnableWindow(0); m_bCanSave = 0;
  390. // CDialog::OnCancel ();
  391. // return 1;
  392. }
  393. }
  394. }
  395. //记录已删除的相片
  396. RecordDeletedPhotos(&m_delphotos, m_DelPhotoPath);
  397. }
  398. //在界面上显示图片;
  399. LoadPhotos();
  400. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(95)) || g_cominfoarray.ElementAt(0).ElementAt(95) == _T(""))
  401. {
  402. int timer1 = atoi(g_cominfoarray.ElementAt(0).ElementAt(96));
  403. m_timer = atoi(g_cominfoarray.ElementAt(0).ElementAt(97));
  404. if (timer1 == 0)
  405. timer1 = 60;
  406. if (m_timer == 0)
  407. m_timer = 20;
  408. SetTimer(1, timer1 * 60000, NULL);
  409. }
  410. return false;
  411. }
  412. void ChooseDesignSkin::OnPaint()
  413. {
  414. try
  415. {
  416. CPaintDC dc(this); // device context for painting
  417. // TODO: Add your message handler code here
  418. if (m_pBk == NULL)
  419. {
  420. return;
  421. }
  422. CRect rc;
  423. GetClientRect(rc);
  424. Graphics graph(dc.GetSafeHdc());
  425. Rect destinationRect(0, 0, rc.Width(), rc.Height());
  426. int width = m_pBk->GetWidth();
  427. int height = m_pBk->GetHeight();
  428. graph.SetSmoothingMode(SmoothingModeHighQuality);
  429. graph.DrawImage(m_pBk, destinationRect, 0, 0, width, height, UnitPixel);
  430. // Do not call CDialog::OnPaint() for painting messages
  431. }
  432. catch (...)
  433. {
  434. }
  435. }
  436. void ChooseDesignSkin::OnDestroy()
  437. {
  438. try
  439. {
  440. TerminateThread();
  441. if (m_pBk)delete m_pBk;
  442. MyBmpButton2 *pic = NULL;
  443. for (int i = 0; i < m_picarray.GetSize(); i++)
  444. {
  445. pic = (MyBmpButton2*)m_picarray.ElementAt(i);
  446. if (pic)
  447. {
  448. pic->DestroyWindow();
  449. delete pic;
  450. }
  451. }
  452. m_picarray.RemoveAll();
  453. if (m_selphotownd.GetSafeHwnd())
  454. {
  455. m_selphotownd.DestroyWindow();
  456. }
  457. if (m_selphotownd2.GetSafeHwnd())
  458. {
  459. m_selphotownd2.DestroyWindow();
  460. }
  461. //清除资源的路径
  462. ClearResData();
  463. if(m_pHideImg)
  464. delete m_pHideImg;
  465. CDialog::OnDestroy();
  466. }
  467. catch (...)
  468. {
  469. }
  470. }
  471. #ifdef VC60
  472. void ChooseDesignSkin::OnBtnClick(WPARAM wParam, LPARAM lParam)
  473. {
  474. // WM_USER + 1101
  475. // F5按键,显示删除相片
  476. int id = lParam;
  477. id -= 99;
  478. switch (id)
  479. {
  480. case 1: // 查看全部相片按钮事件;
  481. case 2: // 查看选中的相片按钮事件;
  482. case 4: // F5查看删除的相片;
  483. {
  484. if (m_SelectCategory == id - 1 && m_SelectCategory != 1)
  485. return;
  486. m_SelectCategory = id - 1;
  487. if(INDX_SEL == m_SelectCategory)
  488. OnSelPhoto();
  489. LoadPhotos();
  490. }
  491. break;
  492. case 3://查看未选按钮事件;
  493. {
  494. m_SelectCategory = INDX_NOSEL;
  495. m_sChooseFilter = _T("");
  496. UpdateChooseZS();
  497. GetNoSelPhoto();
  498. LoadPhotos();
  499. }
  500. break;
  501. case 13: // 查看入册相片按钮事件;
  502. GetAlbumPhoto();
  503. LoadPhotos();
  504. break;
  505. case 14: // 查看入底相片按钮事件;
  506. GetDiskPhoto();
  507. LoadPhotos();
  508. break;
  509. case 15: // 效果图按钮事件;
  510. {
  511. ShowEffectDlg dlg;
  512. dlg.m_pPhotopatharray = this->GetCurArray(m_SelectCategory);
  513. dlg.DoModal();
  514. }
  515. break;
  516. case 5: // 保存按钮事件;
  517. OnButton4();
  518. break;
  519. case 9: //看设计->放大按钮
  520. {
  521. if (((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
  522. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(0);
  523. else
  524. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(1);
  525. ReLoadPhoto();
  526. }
  527. break;
  528. case 6: // 关闭按钮事件 ;
  529. if (m_bModify && m_bCanSave)
  530. {
  531. ShowMsg3 dlg;
  532. dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
  533. // if (AfxMessageBox(_T("提醒, 选片修改未保存, 是否保存后再退出?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
  534. if(dlg.DoModal() == IDOK)
  535. {
  536. OnButton4();
  537. if (m_bSaveFail)
  538. {
  539. AfxMessageBox(_T("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!"));
  540. CDialog::OnCancel();
  541. return;
  542. }
  543. return;
  544. }
  545. else
  546. {
  547. CString savepath = _T("");
  548. savepath.Format(_T("%s\\%s-2.dat"), g_mainpath, m_strOrderNumber);
  549. ::DeleteFile(savepath); // 删除*.dat文件;
  550. }
  551. }
  552. CDialog::OnCancel();
  553. break;
  554. case 11:
  555. if (m_selphotownd.GetSafeHwnd() == NULL)
  556. {
  557. m_selphotownd.m_id = m_strOrderNumber;
  558. m_selphotownd.m_rc = m_rcarray.ElementAt(6);
  559. m_selphotownd.Create(IDD_DLGShowSelPhoto, this);
  560. }
  561. m_selphotownd.ShowWindow(1);
  562. break;
  563. case 12:
  564. ReplaceDesignNo dlg;
  565. dlg.m_id = this->m_strOrderNumber;
  566. dlg.DoModal();
  567. break;
  568. }
  569. }
  570. #else
  571. LRESULT ChooseDesignSkin::OnBtnClick(WPARAM wParam, LPARAM lParam)
  572. {
  573. // WM_USER + 1101
  574. // F5按键,显示删除相片
  575. int id = lParam;
  576. id -= 99;
  577. switch (id)
  578. {
  579. case 1: // 查看全部相片按钮事件;
  580. case 2: // 查看选中的相片按钮事件;
  581. case 4: // F5查看删除的相片;
  582. {
  583. if (m_SelectCategory == id - 1 && m_SelectCategory != 1)
  584. return 0;
  585. m_SelectCategory = id - 1;
  586. if(INDX_SEL == m_SelectCategory)
  587. OnSelPhoto();
  588. LoadPhotos();
  589. }
  590. break;
  591. case 3://查看未选按钮事件;
  592. {
  593. m_SelectCategory = INDX_NOSEL;
  594. m_sChooseFilter = _T("");
  595. UpdateChooseZS();
  596. GetNoSelPhoto();
  597. LoadPhotos();
  598. }
  599. break;
  600. case 13: // 查看入册相片按钮事件;
  601. GetAlbumPhoto();
  602. LoadPhotos();
  603. break;
  604. case 14: // 查看入底相片按钮事件;
  605. GetDiskPhoto();
  606. LoadPhotos();
  607. break;
  608. case 15: // 效果图按钮事件;
  609. {
  610. ShowEffectDlg dlg;
  611. dlg.m_pPhotopatharray = this->GetCurArray(m_SelectCategory);
  612. dlg.DoModal();
  613. }
  614. break;
  615. case 5: // 保存按钮事件;
  616. OnButton4();
  617. break;
  618. case 9: //看设计->放大按钮
  619. {
  620. if (((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
  621. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(0);
  622. else
  623. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(1);
  624. ReLoadPhoto();
  625. }
  626. break;
  627. case 6: // 关闭按钮事件 ;
  628. if (m_bModify && m_bCanSave)
  629. {
  630. ShowMsg3 dlg;
  631. dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
  632. // if (AfxMessageBox(_T("提醒, 选片修改未保存, 是否保存后再退出?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
  633. if(dlg.DoModal() == IDOK)
  634. {
  635. OnButton4();
  636. if (m_bSaveFail)
  637. {
  638. AfxMessageBox(_T("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!"));
  639. CDialog::OnCancel();
  640. return 0;
  641. }
  642. return 0;
  643. }
  644. else
  645. {
  646. CString savepath = _T("");
  647. savepath.Format(_T("%s\\%s-2.dat"), g_mainpath, m_strOrderNumber);
  648. ::DeleteFile(savepath); // 删除*.dat文件;
  649. }
  650. }
  651. CDialog::OnCancel();
  652. break;
  653. case 11:
  654. if (m_selphotownd.GetSafeHwnd() == NULL)
  655. {
  656. m_selphotownd.m_id = m_strOrderNumber;
  657. m_selphotownd.m_rc = m_rcarray.ElementAt(6);
  658. m_selphotownd.Create(IDD_DLGShowSelPhoto, this);
  659. }
  660. m_selphotownd.ShowWindow(1);
  661. break;
  662. case 12:
  663. ReplaceDesignNo dlg;
  664. dlg.m_id = this->m_strOrderNumber;
  665. dlg.DoModal();
  666. break;
  667. }
  668. return 0;
  669. }
  670. #endif
  671. BOOL ChooseDesignSkin::OnEraseBkgnd(CDC* pDC)
  672. {
  673. return 1;
  674. }
  675. BEGIN_EVENTSINK_MAP(ChooseDesignSkin, CDialog)
  676. ON_EVENT(ChooseDesignSkin, 100, 150 /* FSCommand */, OnFSCommandShockwaveflash1, VTS_BSTR VTS_BSTR)
  677. END_EVENTSINK_MAP()
  678. void ChooseDesignSkin::OnFSCommandShockwaveflash1(LPCTSTR command, LPCTSTR args)
  679. {
  680. }
  681. //------------------------------------------------------------------
  682. // 函数:OnDblclkList1
  683. // 描述:处理双击和回车时的图片显示效果;与函数名本身的表达意义不一致,导致歧义!
  684. // 参数:
  685. // 返回:
  686. //------------------------------------------------------------------
  687. void ChooseDesignSkin::OnDblclkList1()
  688. {
  689. // 1.从双击中的列表项中获取相片名;
  690. POSITION pos;
  691. pos = m_List1.GetFirstSelectedItemPosition();
  692. if (pos == NULL)
  693. return;
  694. int iItem = m_List1.GetNextSelectedItem(pos);
  695. #if JEFF_TEST_OFF
  696. // 双击列表根本就不做不到多选多击,双击只会选中一个,故GetNextSelectedItem(pos)后,pos=NULL
  697. // 但是这个函数的作用并不是跟函数名一致,有其他地方用到。
  698. #else // 这一块代码是用于处理回车键;
  699. CArray<int, int>posarray;
  700. posarray.Add(iItem);
  701. // 获取剩下的图片位置;
  702. while (pos)
  703. {
  704. int iItem = m_List1.GetNextSelectedItem(pos);
  705. posarray.Add(iItem);
  706. if (posarray.GetSize() > 3)
  707. break;
  708. }
  709. if (posarray.GetSize() >= 2)
  710. {
  711. CStringArray* pPtahArray = NULL;
  712. pPtahArray = GetCurArray(m_SelectCategory);
  713. CComparePhoto dlg;
  714. dlg.m_path1 = pPtahArray->ElementAt(posarray.ElementAt(0));
  715. dlg.m_path2 = pPtahArray->ElementAt(posarray.ElementAt(1));
  716. if (posarray.GetSize() > 2)
  717. dlg.m_path3 = pPtahArray->ElementAt(posarray.ElementAt(2));
  718. if (posarray.GetSize() > 3)
  719. dlg.m_path4 = pPtahArray->ElementAt(posarray.ElementAt(3));
  720. dlg.DoModal();
  721. return;
  722. }
  723. #endif //JEFF_TEST_OFF
  724. CString title = m_List1.GetItemText(iItem, 0);
  725. if (title.Find("Flash") != -1)
  726. {
  727. title.Replace("Flash", "delgabook");
  728. CString str = m_path + title + "\\delgaBook.exe";
  729. ShellExecute(NULL, _T("open"), str, NULL, NULL, SW_SHOWNORMAL);
  730. return;
  731. }
  732. m_showpichwd = NULL;
  733. // 双击小图查看大图;
  734. ShowPic22 dlg;
  735. dlg.m_bShowImgInfo = 1;
  736. dlg.m_pParent = this;
  737. dlg.m_nCurImgPos = iItem;
  738. CStringArray* pArray = GetCurArray(m_SelectCategory);
  739. if(pArray == NULL)
  740. return;
  741. dlg.m_AryOfImgPath = pArray;
  742. dlg.DoModal();
  743. m_showpichwd = NULL;
  744. }
  745. void ChooseDesignSkin::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) // 双击图片列表!
  746. {
  747. OnDblclkList1();
  748. *pResult = 0;
  749. }
  750. /************************************************************************/
  751. /*
  752. 函数: GetData
  753. 描述: 选片模式
  754. 参数:
  755. 返回:
  756. 注意:
  757. */
  758. /************************************************************************/
  759. BOOL ChooseDesignSkin::GetData()//选片模式;
  760. {
  761. m_List2.DeleteAllItems();
  762. m_List3.DeleteAllItems();
  763. m_noarray.RemoveAll();
  764. m_no2array.RemoveAll();
  765. m_oldsparray.RemoveAll();
  766. //选设计
  767. CString filter = _T("");
  768. #ifdef CHILD_VERSION
  769. filter = "id='" + m_strOrderNumber + "';id='" + m_strOrderNumber + "';;;id='" + m_strOrderNumber + "'";
  770. #else
  771. filter = "id='" + m_strOrderNumber + "' and kind<>'2';id='" + m_strOrderNumber + "';;;id='" + m_strOrderNumber + "'";
  772. #endif //CHILD_VERSION
  773. //订单号、商品编号、商品价格、订单商品数量、商品类型、商品名称、选片选中相片名、自增id、选设计选中相片名;
  774. g_sendhead.code[0] = 50; // dindansp;
  775. g_sendhead.code[1] = 11; // dindan
  776. g_sendhead.code[2] = 4; // shangpin
  777. g_sendhead.code[3] = 8; // shangpin
  778. g_sendhead.code[4] = 182; // dindansp3
  779. g_sendhead.tabcount = 5;
  780. g_sendhead.bsql = 0;
  781. g_pMainWnd->ProcessChatMessageRequest2(filter);
  782. if (g_bSendOK == 0)
  783. return 0;
  784. CArray<CStringArray, CStringArray> sparray; //dindansp表;//订单号、商品编号、商品价格、订单商品数量、商品类型、商品名称、选片选中相片名、自增id、选设计选中相片名;
  785. DataToArray(&sparray, &g_List1array, &m_sparray, &m_List2array, &m_oldsparray);
  786. m_SelPhotoPath.RemoveAll();
  787. CString str(_T("")), kind(_T(""));
  788. int nchoosezs = 0;
  789. int list2pos = 0;
  790. int list3pos = 0;
  791. CString savepath = _T("");
  792. savepath.Format(_T("%s\\%s-2.dat"), g_mainpath, m_strOrderNumber);
  793. CString stm1 = GetModifyTime2(savepath);
  794. CTime tm1 = CTime::GetCurrentTime();
  795. tm1 -= CTimeSpan(60, 0, 0, 0);
  796. CString stm2 = tm1.Format(_T("%Y%m%d"));
  797. BOOL bLoadHistory = 0;
  798. if (PathFileExists(savepath) && stm1 > stm2)
  799. {
  800. if (AfxMessageBox(_T("提醒:请谨慎操作\r\n上次选片未正常退出, 是否还原到上次选片状态?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
  801. bLoadHistory = 1;
  802. }
  803. int i = 0;
  804. if (bLoadHistory)
  805. {
  806. //还原到上次选片状态
  807. CArray<CStringArray, CStringArray> List1array;
  808. //读取数据
  809. CFile fp;
  810. fp.Open(savepath, CFile::modeRead);
  811. DWORD nMessageLen = fp.GetLength();
  812. BYTE *szChatMessage = new BYTE[nMessageLen];
  813. fp.Read(szChatMessage, nMessageLen);
  814. fp.Close();
  815. int count = 0;
  816. memcpy(&count, szChatMessage + (nMessageLen - sizeof(int)), sizeof(int));
  817. CMemFile memfile;
  818. memfile.Attach(szChatMessage, nMessageLen);
  819. CArchive ar(&memfile, CArchive::load);
  820. List1array.SetSize(count);
  821. for ( i = 0; i < List1array.GetSize(); i++)
  822. List1array.ElementAt(i).Serialize(ar);
  823. ar.Close();
  824. memfile.Detach();
  825. delete[]szChatMessage;
  826. list2pos = 0;
  827. list3pos = 0;
  828. for (i = 0; i < List1array.GetSize(); i++)
  829. {
  830. if (0)//List1array.ElementAt (i).GetSize ()==6)
  831. {
  832. kind = "0";
  833. m_List2.InsertItem(list2pos, List1array.ElementAt(i).ElementAt(1));
  834. m_List2.SetItemText(list2pos, 1, List1array.ElementAt(i).ElementAt(2));
  835. m_List2.SetItemText(list2pos, 2, List1array.ElementAt(i).ElementAt(3));
  836. m_List2.SetItemText(list2pos, 3, List1array.ElementAt(i).ElementAt(4));
  837. m_List2.SetItemText(list2pos, 4, List1array.ElementAt(i).ElementAt(5));
  838. str = List1array.ElementAt(i).ElementAt(5);
  839. list2pos++;
  840. }
  841. else
  842. {
  843. kind = "4";
  844. m_List3.InsertItem(list3pos, List1array.ElementAt(i).ElementAt(1));
  845. m_List3.SetItemText(list3pos, 1, List1array.ElementAt(i).ElementAt(2));
  846. m_List3.SetItemText(list3pos, 2, List1array.ElementAt(i).ElementAt(3));
  847. m_List3.SetItemText(list3pos, 3, List1array.ElementAt(i).ElementAt(4));
  848. m_List3.SetItemText(list3pos, 4, List1array.ElementAt(i).ElementAt(5));
  849. m_List3.SetItemText(list3pos, 5, List1array.ElementAt(i).ElementAt(6));
  850. m_List3.SetItemText(list3pos, 6, List1array.ElementAt(i).ElementAt(9));
  851. #ifdef LKAY_VERSION
  852. m_List3.SetItemText(list3pos, 6, List1array.ElementAt (i).ElementAt (7));
  853. m_List3.SetItemText(list3pos, 7, List1array.ElementAt (i).ElementAt (8));
  854. str=List1array.ElementAt (i).ElementAt (8);
  855. #else
  856. str = List1array.ElementAt(i).ElementAt(6);
  857. #endif //#ifdef LKAY_VERSION
  858. list3pos++;
  859. }
  860. nchoosezs += GetZS(str);
  861. GetPathAddToSel(str);
  862. if (!str.IsEmpty())
  863. {
  864. #ifdef USE_SEP_VEB
  865. str = SEPS_VEB + str + SEPS_VEB;
  866. #else
  867. str = SEPS_CMA + str + SEPS_CMA;
  868. #endif //#ifdef USE_SEP_VEB
  869. }
  870. str.MakeLower();
  871. if (kind == _T("4"))
  872. m_no2array.Add(str);
  873. else
  874. m_noarray.Add(str);
  875. }
  876. }
  877. else
  878. {
  879. for ( i = 0; i < sparray.GetSize(); i++)
  880. {
  881. kind = _T("4");//sparray.ElementAt (i).ElementAt (4);
  882. if (kind == _T("4"))
  883. {
  884. m_List3.InsertItem(list3pos, sparray.ElementAt(i).ElementAt(7)); // dindansp表autoid;
  885. m_List3.SetItemText(list3pos, 1, sparray.ElementAt(i).ElementAt(1)); // 商品编号;
  886. m_List3.SetItemText(list3pos, 2, sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  887. m_List3.SetItemText(list3pos, 3, sparray.ElementAt(i).ElementAt(2)); // 商品价格;
  888. m_List3.SetItemText(list3pos, 4, sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  889. #ifdef LKAY_VERSION
  890. m_List3.SetItemText(list3pos, 5, sparray.ElementAt (i).ElementAt (9)); //
  891. m_List3.SetItemText(list3pos, 6, sparray.ElementAt (i).ElementAt (10));
  892. m_List3.SetItemText(list3pos, 7, sparray.ElementAt (i).ElementAt (8));
  893. #else
  894. m_List3.SetItemText(list3pos, 5, sparray.ElementAt(i).ElementAt(8)); // 选设计时选中的相片名;
  895. m_List3.SetItemText(list3pos, 6, sparray.ElementAt(i).ElementAt(9)); // 商品备注;
  896. #endif
  897. list3pos++;
  898. }
  899. else
  900. {
  901. m_List2.InsertItem(list2pos, sparray.ElementAt(i).ElementAt(7)); // dindansp表autoid;
  902. m_List2.SetItemText(list2pos, 1, sparray.ElementAt(i).ElementAt(1)); // 商品编号;
  903. m_List2.SetItemText(list2pos, 2, sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  904. m_List2.SetItemText(list2pos, 3, sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  905. m_List2.SetItemText(list2pos, 4, sparray.ElementAt(i).ElementAt(8)); // 选设计时选中的相片名;
  906. list2pos++;
  907. }
  908. str = sparray.ElementAt(i).ElementAt(8);
  909. str.MakeLower();
  910. nchoosezs += GetZS(str); // 获取no或no2字段中包含的相片名数量;
  911. GetPathAddToSel(str);
  912. if (!str.IsEmpty())
  913. {
  914. #ifdef USE_SEP_VEB
  915. str = SEPS_VEB + str + SEPS_VEB;
  916. #else
  917. str = SEPS_CMA + str + SEPS_CMA;
  918. #endif //#ifdef USE_SEP_VEB
  919. }
  920. if (kind == _T("4"))
  921. m_no2array.Add(str);
  922. else
  923. m_noarray.Add(str);
  924. }
  925. }
  926. if (g_List1array.GetSize())
  927. {
  928. m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  929. m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  930. m_phone1 = g_List1array.ElementAt(0).ElementAt(61);
  931. m_phone2 = g_List1array.ElementAt(0).ElementAt(62);
  932. #ifdef USE_SEP_VEB
  933. if (!m_name1.IsEmpty())
  934. m_name = m_name1 + SEPS_VEB;
  935. m_name += m_name2;
  936. m_name.TrimRight(SEPS_VEB);
  937. #else
  938. if (!m_name1.IsEmpty())
  939. m_name = m_name1 + SEPS_CMA;
  940. m_name += m_name2;
  941. m_name.TrimRight(SEPS_CMA);
  942. #endif //#ifdef USE_SEP_VEB
  943. m_waiter3 = g_user.name;
  944. m_taoxizs = g_List1array.ElementAt(0).ElementAt(9);
  945. m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  946. m_takezs = g_List1array.ElementAt(0).ElementAt(23);
  947. m_choosezs = g_List1array.ElementAt(0).ElementAt(24);
  948. m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  949. m_oldmoney3 = m_money3;
  950. m_bz3 = g_List1array.ElementAt(0).ElementAt(57);
  951. m_urgent = g_List1array.ElementAt(0).ElementAt(40);
  952. m_delphotos = g_List1array.ElementAt(0).ElementAt(56);// Jeff获取选设计时,被删除的相片,选取的字段delphotos2;.读取正常,保存时未能正确保存到delphotos2字段;
  953. if ( m_delphotos.GetAt(0) != SEPC_VEB || m_delphotos.GetAt(m_delphotos.GetLength() -1) != SEPC_VEB )
  954. {
  955. m_delphotos.TrimLeft(SEPC_VEB);
  956. m_delphotos.TrimRight(SEPC_VEB);
  957. m_delphotos = SEPS_VEB + m_delphotos + SEPS_VEB;
  958. }
  959. m_status8 = g_List1array.ElementAt(0).ElementAt(55);
  960. m_time6 = g_List1array.ElementAt(0).ElementAt(48);
  961. m_time5old = m_time5;
  962. m_time6old = m_time6;
  963. m_checkstatus = g_List1array.ElementAt(0).ElementAt(55);
  964. UpdateData(false);
  965. }
  966. else
  967. {
  968. m_name1 = _T("");
  969. m_name2 = _T("");
  970. m_waiter3 = _T("");
  971. m_taoxizs = _T("");
  972. m_time5 = _T("");
  973. m_takezs = _T("");
  974. m_choosezs = _T("");
  975. m_money3 = "";
  976. m_bz3 = _T("");
  977. m_urgent = _T("");
  978. UpdateData(false);
  979. }
  980. return 1;
  981. }
  982. void ChooseDesignSkin::OnClose()
  983. {
  984. /*
  985. if (m_bModify)
  986. {
  987. ShowMsg3 dlg;
  988. dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
  989. if(dlg.DoModal() == IDOK)
  990. OnButton4();
  991. }
  992. */
  993. CDialog::OnClose();
  994. }
  995. BOOL ChooseDesignSkin::PreTranslateMessage(MSG* pMsg)
  996. {
  997. if (pMsg->message == WM_LBUTTONDOWN)
  998. {
  999. g_bNeedDrawParent = 2;
  1000. if (0)
  1001. {//list3
  1002. CPoint pt;
  1003. CRect rc, rc2;
  1004. ::GetCursorPos(&pt);
  1005. m_List3.GetWindowRect(rc2);
  1006. if (rc2.PtInRect(pt) == 0) return CDialog::PreTranslateMessage(pMsg);
  1007. SetTimer(3, 300, NULL);
  1008. }
  1009. }
  1010. else if (0)//pMsg->message==WM_LBUTTONDBLCLK)
  1011. {
  1012. {//list1
  1013. CPoint pt;
  1014. CRect rc, rc2;
  1015. ::GetCursorPos(&pt);
  1016. m_List2.GetWindowRect(rc2);
  1017. if (rc2.PtInRect(pt))
  1018. return 1;
  1019. }
  1020. {//list3
  1021. CPoint pt;
  1022. CRect rc, rc2;
  1023. ::GetCursorPos(&pt);
  1024. m_List3.GetWindowRect(rc2);
  1025. if (rc2.PtInRect(pt) == 0)return CDialog::PreTranslateMessage(pMsg);
  1026. pt.x -= rc2.left;
  1027. pt.y -= rc2.top;
  1028. int iItem = m_List3.GetItemCount() - 1;
  1029. if (iItem < 0)
  1030. {
  1031. m_List3.GetHeaderCtrl()->GetItemRect(0, rc);
  1032. int hei = rc.Height();
  1033. rc.top += hei;
  1034. rc.bottom += hei;
  1035. if (rc.PtInRect(pt))
  1036. {
  1037. m_List3.InsertItem(m_List3.GetItemCount(), "");
  1038. }
  1039. }
  1040. else
  1041. {
  1042. m_List3.GetSubItemRect(iItem, 0, LVIR_BOUNDS, rc);
  1043. int hei = rc.Height();
  1044. rc.top += hei;
  1045. rc.bottom += hei;
  1046. if (rc.PtInRect(pt))
  1047. {
  1048. if (m_List3.GetItemText(iItem, 1).IsEmpty() && m_List3.GetItemText(iItem, 2).IsEmpty())
  1049. return CDialog::PreTranslateMessage(pMsg);
  1050. m_List3.InsertItem(m_List3.GetItemCount(), "");
  1051. }
  1052. POSITION pos;
  1053. pos = m_List3.GetFirstSelectedItemPosition();
  1054. if (pos)
  1055. {
  1056. iItem = m_List3.GetNextSelectedItem(pos);
  1057. m_List3.GetSubItemRect(iItem, 4, LVIR_BOUNDS, rc);
  1058. if (rc.PtInRect(pt))return 1;
  1059. }
  1060. }
  1061. }
  1062. }
  1063. else if (pMsg->message == WM_KEYDOWN)
  1064. {
  1065. if (m_showpichwd)return 1;
  1066. switch (pMsg->wParam)
  1067. {
  1068. case VK_DELETE:
  1069. {
  1070. OnDel();
  1071. //更新绘制
  1072. DrawInterface();
  1073. // LoadPhotos();
  1074. }
  1075. return 1;
  1076. case VK_RETURN:
  1077. OnDblclkList1();
  1078. return 1;
  1079. case VK_F4:
  1080. if (m_bChooseBig == 0)
  1081. return 1;
  1082. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(62)))
  1083. {
  1084. if (m_SelectCategory == INDX_SEL)
  1085. UpdateChooseZS();
  1086. SortArray();
  1087. }
  1088. return 1;
  1089. case VK_F5:
  1090. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
  1091. {
  1092. OnBtnClick(0, 99 + 4);
  1093. }
  1094. return 1;
  1095. case VK_F1:
  1096. {
  1097. if (m_selphotownd2.GetSafeHwnd() == NULL)
  1098. {
  1099. m_selphotownd2.m_id = m_strOrderNumber;
  1100. m_selphotownd2.m_bGrowthTX = m_bGrowthTX;
  1101. m_selphotownd2.m_seltxname = m_seltxname;
  1102. m_selphotownd2.m_rc = m_rcarray.ElementAt(6);
  1103. m_selphotownd2.Create(IDD_DLGShowSelPhoto2, this);
  1104. }
  1105. m_selphotownd2.ShowWindow(1);
  1106. }
  1107. return 1;
  1108. case VK_F2: //缩略图
  1109. if (m_bChooseBig == 0)
  1110. return 1;
  1111. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(60)))
  1112. {
  1113. m_bHide = !m_bHide;
  1114. LoadPhotos();
  1115. }
  1116. return 1;
  1117. case VK_F6:
  1118. {
  1119. ReplaceDesignNo dlg;
  1120. dlg.m_id = this->m_strOrderNumber;
  1121. dlg.DoModal();
  1122. }
  1123. return 1;
  1124. case VK_ESCAPE:
  1125. {
  1126. return TRUE;
  1127. }
  1128. break;
  1129. }
  1130. }
  1131. else if(pMsg->message == WM_LBUTTONUP)
  1132. {
  1133. CDialog::PreTranslateMessage(pMsg);
  1134. return TRUE;
  1135. }
  1136. return CDialog::PreTranslateMessage(pMsg);
  1137. }
  1138. // 右键选片模式;
  1139. void ChooseDesignSkin::OnRclickList1()
  1140. {
  1141. if (m_bRunning)
  1142. return;
  1143. CMenuXP *pPopup = NULL;
  1144. POSITION pos;
  1145. pos = m_List1.GetFirstSelectedItemPosition();
  1146. if (pos == NULL)
  1147. return;
  1148. CString path = _T("");
  1149. CStringArray* pArray = NULL;
  1150. int iItem = m_List1.GetNextSelectedItem(pos);
  1151. pArray = GetCurArray(m_SelectCategory);
  1152. path = pArray->ElementAt(iItem); //path//打印出相片完整路径名;
  1153. // 右键看设计模式;
  1154. if (!m_bChooseBig)
  1155. path = path.Right(path.GetLength() - m_path.GetLength());
  1156. else
  1157. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1158. path = path.Left(path.ReverseFind('.'));
  1159. #ifdef USE_SEP_VEB
  1160. path = SEPS_VEB + path + SEPS_VEB; //
  1161. #else
  1162. path = SEPS_CMA + path + SEPS_CMA; //
  1163. #endif //#ifdef USE_SEP_VEB
  1164. // TODO: Add your control notification handler code here
  1165. // 1.创建菜单对象;
  1166. // 1.创建菜单对象;
  1167. pPopup = new CMenuXP;
  1168. pPopup->CYBUTTONMARGIN = 3; // 1.0.按钮范围0~3; 4个菜单;
  1169. pPopup->CreatePopupMenu(); // 1.1.弹出式菜单;
  1170. pPopup->SetMenuStyle(CMenuXP::STYLE_XP);// 1.2.弹出菜单样式;
  1171. // Jeff:m_List2有三列头:编号、商品名称、商品数量;
  1172. //计算菜单最大字符长度
  1173. int i = 0;
  1174. int maxleng = 1;
  1175. {
  1176. CString name, no;
  1177. int count = 0;
  1178. for ( i = 0; i < m_List2.GetItemCount(); i++)
  1179. {
  1180. // name商品名称
  1181. name = m_List2.GetItemText(i, 2);
  1182. no = m_noarray.ElementAt(i);
  1183. maxleng = max(maxleng, name.GetLength());
  1184. }
  1185. count = i;
  1186. for (; i < count + m_no2array.GetSize(); i++)
  1187. {
  1188. name = m_List3.GetItemText(i - count, 2);
  1189. maxleng = max(maxleng, name.GetLength());
  1190. }
  1191. }
  1192. maxleng += 3;
  1193. // Jeff:m_List2有三列头:编号、商品名称、商品数量;
  1194. CString scount = _T("");
  1195. CString name, no;
  1196. int count = 0;
  1197. for ( i = 0; i < m_List2.GetItemCount(); i++)
  1198. {
  1199. name = m_List2.GetItemText(i, 2);
  1200. //填充长度
  1201. FillLength(name, maxleng);
  1202. // Jeff,no里为商品名称选中的相片
  1203. no = m_noarray.ElementAt(i);
  1204. GetSelCountFromName(no, scount);
  1205. //添加菜单项
  1206. pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));// 2.使用AppendODMenu2添加子菜单项;
  1207. //绑定事件ID
  1208. if (no.Find(path) != -1)
  1209. pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
  1210. }
  1211. count = i;
  1212. for (; i < count + m_no2array.GetSize(); i++)
  1213. {
  1214. name = m_List3.GetItemText(i - count, 2);
  1215. FillLength(name, maxleng);
  1216. no = m_no2array.ElementAt(i - count);
  1217. GetSelCountFromName(no, scount);
  1218. pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));
  1219. if (no.Find(path) != -1)
  1220. pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
  1221. }
  1222. pPopup->AppendODMenu2(0, new CMenuXPText(32794, "修改要求", NULL));
  1223. //获取当前鼠标位置
  1224. CPoint pt;
  1225. ::GetCursorPos(&pt);
  1226. // 3.使用TrackPopupMenu,正常弹出菜单;
  1227. pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);
  1228. delete pPopup;
  1229. }
  1230. void ChooseDesignSkin::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult)
  1231. {
  1232. if (m_showpichwd)
  1233. return;
  1234. OnRclickList1();
  1235. *pResult = 0;
  1236. }
  1237. //
  1238. /************************************************************************/
  1239. /*
  1240. 函数: OnCommandMenu
  1241. 描述: 弹出菜单处理;
  1242. 参数:
  1243. UINT nID 事件ID
  1244. 返回:
  1245. 注意:
  1246. */
  1247. /************************************************************************/
  1248. void ChooseDesignSkin::OnCommandMenu(UINT nID)
  1249. {
  1250. //看设计事件
  1251. OnCommandMenu2(nID);
  1252. return;
  1253. }
  1254. /************************************************************************/
  1255. /*
  1256. 函数: OnCommandMenu2
  1257. 描述: 看设计,弹出菜单处理;
  1258. 参数:
  1259. UINT nID 事件ID
  1260. 返回:
  1261. 注意:
  1262. */
  1263. /************************************************************************/
  1264. void ChooseDesignSkin::OnCommandMenu2(UINT nID)
  1265. {
  1266. if (32794 == nID)// 处理菜单荐:修改要求;
  1267. {
  1268. //修改要求
  1269. POSITION pos;
  1270. pos = m_List1.GetFirstSelectedItemPosition();
  1271. if (pos == NULL)
  1272. {
  1273. return;
  1274. }
  1275. int iItem = m_List1.GetNextSelectedItem(pos);
  1276. CStringArray *pArray = GetCurArray(m_SelectCategory);
  1277. CString path = pArray->ElementAt(iItem);
  1278. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1279. path = path.Left(path.Find('.'));
  1280. UpdateData();
  1281. CClientRequirement dlg;
  1282. dlg.m_no = "当前照片:" + path;
  1283. dlg.m_bz2 = m_bz3;
  1284. dlg.m_bSave = 0;
  1285. dlg.m_nMode = 2;
  1286. if (dlg.DoModal() == IDOK)
  1287. {
  1288. m_bz3 = dlg.m_bz2;
  1289. UpdateData(false);
  1290. }
  1291. return;
  1292. }
  1293. POSITION pos;
  1294. pos = m_List1.GetFirstSelectedItemPosition();
  1295. if (pos == NULL)
  1296. {
  1297. return;
  1298. }
  1299. CString temp;
  1300. m_combo1.ResetContent();
  1301. int aa = 0;
  1302. while (pos) // 开始获取相片;
  1303. {
  1304. // if(aa && m_mode==1)break;
  1305. // if(aa && m_mode==2)break;
  1306. aa++;
  1307. int iItem = m_List1.GetNextSelectedItem(pos);
  1308. CStringArray *pArray = GetCurArray(m_SelectCategory);
  1309. // path:
  1310. CString path = pArray->ElementAt(iItem);
  1311. //AfxMessageBox(path);//Jeff box
  1312. if (m_bChooseBig)//选放大
  1313. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1314. else//选设计
  1315. path = path.Right(path.GetLength() - m_path.GetLength());
  1316. path = path.Left(path.ReverseFind('.'));
  1317. #ifdef USE_SEP_VEB
  1318. path = SEPS_VEB + path + SEPS_VEB; //
  1319. #else
  1320. path = SEPS_CMA + path + SEPS_CMA; //
  1321. #endif //#ifdef USE_SEP_VEB
  1322. int idpos = nID - IDM_MENUsp1;
  1323. BOOL bSel = 0;//选中还是取消
  1324. if (idpos < m_noarray.GetSize())
  1325. {
  1326. //MessageBox("1");
  1327. CString no = m_noarray.ElementAt(idpos); // no:为dindansp字段no;
  1328. //AfxMessageBox(no);//Jeff box
  1329. if (no.Find(path) != -1)
  1330. {
  1331. int pos = no.Find(path);
  1332. no.Delete(pos, path.GetLength() - 1);
  1333. }
  1334. else if (no.GetLength() > 4000)
  1335. {
  1336. AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP); return;
  1337. }
  1338. else
  1339. {
  1340. bSel = 1;
  1341. #ifdef USE_SEP_VEB
  1342. no.TrimRight(SEPS_VEB);
  1343. #else
  1344. no.TrimRight(SEPS_CMA);
  1345. #endif //#ifdef USE_SEP_VEB
  1346. no += path;
  1347. }
  1348. #ifdef USE_SEP_VEB
  1349. no.TrimLeft(SEPS_VEB);
  1350. no.TrimRight(SEPS_VEB);
  1351. #else
  1352. no.TrimLeft(SEPS_CMA);
  1353. no.TrimRight(SEPS_CMA);
  1354. #endif //#ifdef USE_SEP_VEB
  1355. m_List2.SetItemText(idpos, 4, no);
  1356. if (no.IsEmpty())
  1357. m_noarray.SetAt(idpos, no);
  1358. else
  1359. {
  1360. #ifdef USE_SEP_VEB
  1361. m_noarray.SetAt(idpos, SEPS_VEB + no + SEPS_VEB);
  1362. #else
  1363. m_noarray.SetAt(idpos, SEPS_CMA + no + SEPS_CMA);
  1364. #endif //#ifdef USE_SEP_VEB
  1365. }
  1366. }
  1367. else
  1368. {
  1369. idpos -= m_noarray.GetSize();
  1370. CString no = m_no2array.ElementAt(idpos);
  1371. if (no.Find(path) != -1)
  1372. {
  1373. int pos = no.Find(path);
  1374. no.Delete(pos, path.GetLength() - 1);
  1375. }
  1376. else if (no.GetLength() > 4000)
  1377. {
  1378. AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP); return;
  1379. }
  1380. else
  1381. {
  1382. bSel = 1;
  1383. #ifdef USE_SEP_VEB
  1384. no.TrimRight(SEPS_VEB);
  1385. #else
  1386. no.TrimRight(SEPS_CMA);
  1387. #endif //#ifdef USE_SEP_VEB
  1388. no += path;
  1389. }
  1390. #ifdef USE_SEP_VEB
  1391. no.TrimLeft(SEPS_VEB);
  1392. no.TrimRight(SEPS_VEB);
  1393. #else
  1394. no.TrimLeft(SEPS_CMA);
  1395. no.TrimRight(SEPS_CMA);
  1396. #endif //#ifdef USE_SEP_VEB
  1397. #ifdef LKAY_VERSION
  1398. m_List3.SetItemText (idpos, 7, no);
  1399. #else
  1400. m_List3.SetItemText(idpos, 5, no);
  1401. #endif //#ifdef LKAY_VERSION
  1402. if (no.IsEmpty())
  1403. m_no2array.SetAt(idpos, no);
  1404. else
  1405. {
  1406. #ifdef USE_SEP_VEB
  1407. m_no2array.SetAt(idpos, SEPS_VEB + no + SEPS_VEB);
  1408. #else
  1409. m_no2array.SetAt(idpos, SEPS_CMA + no + SEPS_CMA);
  1410. #endif //#ifdef USE_SEP_VEB
  1411. }
  1412. }
  1413. m_bModify = 1;
  1414. if (bSel == 0 && m_SelectCategory == INDX_SEL && IsSelPhoto(path) == 0)
  1415. {
  1416. temp.Format("%d", iItem);
  1417. m_combo1.AddString(temp);
  1418. continue;
  1419. }
  1420. else if (bSel == 1 && m_SelectCategory == INDX_NOSEL)
  1421. {
  1422. temp.Format("%d", iItem);
  1423. m_combo1.AddString(temp);
  1424. continue;
  1425. }
  1426. else if (bSel == 1 && m_SelectCategory == INDX_DEL)
  1427. {
  1428. temp.Format("%d", iItem);
  1429. m_combo1.AddString(temp);
  1430. continue;
  1431. }
  1432. /////////////////////////
  1433. CString no, dir;
  1434. no = pArray->ElementAt(iItem);
  1435. if (m_bChooseBig)//选放大
  1436. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  1437. else//选设计
  1438. no = no.Right(no.GetLength() - m_path.GetLength());
  1439. no = no.Left(no.ReverseFind('.'));
  1440. no += GetSelName(no);
  1441. m_List1.SetItemText(iItem, 0, no);
  1442. }
  1443. CArray<int, int>posarray;
  1444. for (int i = m_combo1.GetCount() - 1; i >= 0; i--)
  1445. {
  1446. m_combo1.GetLBText(i, temp);
  1447. posarray.Add(atoi(temp));
  1448. }
  1449. SortArray2(posarray);
  1450. if (posarray.GetSize())
  1451. {
  1452. if (m_SelectCategory == INDX_SEL)
  1453. {
  1454. for (int i = 0; i < posarray.GetSize(); i++)
  1455. {
  1456. m_List1.DeleteItem(posarray.ElementAt(i));
  1457. m_NoSelPhotoPath.Add(m_SelPhotoPath.ElementAt(posarray.ElementAt(i)));
  1458. m_SelPhotoPath.RemoveAt(posarray.ElementAt(i));
  1459. }
  1460. if (m_showpichwd)
  1461. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  1462. }
  1463. else if (m_SelectCategory == INDX_NOSEL)
  1464. {
  1465. for (int i = 0; i < posarray.GetSize(); i++)
  1466. {
  1467. m_List1.DeleteItem(posarray.ElementAt(i));
  1468. m_NoSelPhotoPath.RemoveAt(posarray.ElementAt(i));
  1469. }
  1470. if (m_showpichwd)
  1471. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  1472. }
  1473. else if (m_SelectCategory == INDX_DEL)
  1474. {
  1475. for (int i = 0; i < posarray.GetSize(); i++)
  1476. {
  1477. m_List1.DeleteItem(posarray.ElementAt(i));
  1478. m_AllPhotoPath.Add(m_DelPhotoPath.ElementAt(posarray.ElementAt(i)));
  1479. m_DelPhotoPath.RemoveAt(posarray.ElementAt(i));
  1480. }
  1481. if (m_showpichwd)
  1482. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  1483. }
  1484. }
  1485. CString strFile = m_strOrderNumber + _T("-2.dat");
  1486. Save(g_mainpath, strFile);
  1487. DrawInterface();
  1488. if (m_showpichwd)
  1489. ::SendMessage(m_showpichwd, WM_USER + 200, 0, 0);
  1490. }
  1491. long ChooseDesignSkin::UpdateTakeZS(WPARAM inWParam, LPARAM inLParam)
  1492. {
  1493. if (m_SelectCategory == INDX_ALL && m_List1.GetItemCount() > atoi(m_takezs))
  1494. {
  1495. UpdateData();
  1496. m_takezs.Format("%d", m_List1.GetItemCount());
  1497. UpdateData(false);
  1498. }
  1499. //绘制
  1500. DrawInterface();
  1501. return 1;
  1502. }
  1503. /************************************************************************/
  1504. /*
  1505. 函数: UpdateChooseZS
  1506. 描述: 更新选中相片
  1507. 参数:
  1508. 返回:
  1509. 注意:
  1510. */
  1511. /************************************************************************/
  1512. void ChooseDesignSkin::UpdateChooseZS()
  1513. {
  1514. int i = 0;
  1515. CString str = _T("");
  1516. CStringArray* pSelArr = NULL;
  1517. CStringArray* pAllArr = NULL;
  1518. pSelArr = GetCurArray(INDX_SEL);
  1519. pAllArr = GetCurArray(INDX_ALL);
  1520. pSelArr->RemoveAll();
  1521. if (m_sChooseFilter != _T("") && m_sChooseFilter != _T("全部"))
  1522. {
  1523. for ( i = 0; i < m_List3.GetItemCount(); i++)
  1524. {
  1525. if (m_List3.GetItemText(i, 2) != m_sChooseFilter)
  1526. continue;
  1527. str = m_no2array.ElementAt(i);
  1528. GetPathAddToSel(pSelArr, str, pAllArr);
  1529. }
  1530. return;
  1531. }
  1532. for ( i = 0; i < m_noarray.GetSize(); i++)
  1533. {
  1534. str = m_noarray.ElementAt(i);
  1535. GetPathAddToSel(pSelArr, str, pAllArr);
  1536. }
  1537. for (i = 0; i < m_no2array.GetSize(); i++)
  1538. {
  1539. str = m_no2array.ElementAt(i);
  1540. GetPathAddToSel(pSelArr, str, pAllArr);
  1541. }
  1542. }
  1543. // 保存按钮;
  1544. void ChooseDesignSkin::OnButton4()// 保存按钮;
  1545. {
  1546. UpdateData();
  1547. if (m_SelectCategory != INDX_SEL)
  1548. CalChooseZS(&m_SelPhotoPath, &m_AllPhotoPath);
  1549. CString zs = m_taoxizs;
  1550. int pos = zs.Find("\\");
  1551. if (pos != -1)
  1552. {
  1553. zs = zs.Left(pos);
  1554. }
  1555. m_choosezs.Format("%d", max(0, m_SelPhotoPath.GetSize() - atoi(zs)));
  1556. m_bSaveFail = 0;
  1557. ChoosePhotoSkin3 dlg;
  1558. dlg.m_pParent = this;
  1559. dlg.DoModal();
  1560. if (dlg.m_bSave)
  1561. m_bModify = 0;
  1562. if (dlg.m_bPushedSave == 0 && dlg.m_bSaveFail == 0)
  1563. {
  1564. CString savepath = _T("");
  1565. savepath.Format("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
  1566. ::DeleteFile(savepath); // 删除*.dat文件;
  1567. }
  1568. m_bSaveFail = dlg.m_bSaveFail;
  1569. if (dlg.m_bExit)
  1570. {
  1571. m_bModify = 0;
  1572. CDialog::OnCancel();
  1573. }
  1574. }
  1575. // 删除相片;
  1576. BOOL ChooseDesignSkin::OnDel() // 删除相片;
  1577. {
  1578. // printf("Jeff:m_mode=%d,m_mode2=%d.\n\n",m_mode,m_mode2);//Jeff Printf
  1579. if (m_SelectCategory == INDX_SEL)
  1580. {
  1581. AfxMessageBox("选中照片不能删除, 请先取消选中状态!", MB_ICONINFORMATION);
  1582. return 0;
  1583. }
  1584. else if (m_SelectCategory == INDX_DEL)
  1585. {
  1586. return 0;
  1587. }
  1588. POSITION pos;
  1589. pos = m_List1.GetFirstSelectedItemPosition();
  1590. if (pos == NULL)
  1591. return 0;
  1592. if (m_bRunning)
  1593. return 0;
  1594. CStringArray* pArray = NULL;
  1595. CString strDelPhotoName = _T("");
  1596. CString strSelPhotoPath = _T("");
  1597. int iItem = m_List1.GetNextSelectedItem(pos);
  1598. int nItemIdx = iItem;
  1599. pArray = GetCurArray(m_SelectCategory);
  1600. strSelPhotoPath = pArray->ElementAt(nItemIdx);
  1601. strDelPhotoName = strSelPhotoPath;
  1602. if(strDelPhotoName == _T("") || pArray == NULL)
  1603. return 0;
  1604. strDelPhotoName = strDelPhotoName.Right(strDelPhotoName.GetLength() - strDelPhotoName.ReverseFind('\\') - 1);
  1605. strDelPhotoName = strDelPhotoName.Left(strDelPhotoName.Find('.'));
  1606. if (IsSelPhoto(strDelPhotoName)) // Jeff 这里有问题,有些订单删除未选中的相片时,会提示box内容。状态:未处理;
  1607. {
  1608. AfxMessageBox(_T("选中的照片不能删除, 请先取消选中状态!"), MB_ICONINFORMATION);
  1609. return 0;
  1610. }
  1611. if (AfxMessageBox(_T("是否删除此照片?"), MB_YESNO | MB_ICONINFORMATION) != IDYES)
  1612. return 0;
  1613. //将要删除的相片添加到删除数组里
  1614. #if JEFF_TEST_ON
  1615. if(PathFileExists(strSelPhotoPath))
  1616. m_DelPhotoPath.Add(strSelPhotoPath);
  1617. #else
  1618. m_DelPhotoPath.Add(strSelPhotoPath);
  1619. #endif //#if JEFF_TEST_ON
  1620. // printf("Jeff:将要删除的相片=%s\n\n",name);// Jeff Printf;
  1621. for(int i = 0; i < pArray->GetSize(); i++)
  1622. {
  1623. //字符串比较相同=0
  1624. if(strSelPhotoPath.CollateNoCase(pArray->ElementAt(i)) == 0)
  1625. {
  1626. pArray->RemoveAt(i);
  1627. m_List1.DeleteItem(iItem);
  1628. break;
  1629. }
  1630. }
  1631. if(m_SelectCategory == INDX_NOSEL)
  1632. DelPhotoFromName(m_AllPhotoPath, strDelPhotoName);
  1633. m_bModify = 1;
  1634. //设置默认选项
  1635. if(iItem >= pArray->GetSize())
  1636. iItem = 0;
  1637. m_List1.SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
  1638. return 1;
  1639. }
  1640. void ChooseDesignSkin::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
  1641. {
  1642. *pResult = 0;
  1643. }
  1644. void ChooseDesignSkin::OnTimer(UINT nIDEvent)
  1645. {
  1646. if (nIDEvent == 1)
  1647. {
  1648. KillTimer(nIDEvent);
  1649. if (m_showpichwd)
  1650. ::SendMessage(m_showpichwd, WM_USER + 200, 1, 0);
  1651. TimeOutDlg dlg;
  1652. dlg.m_ticks = m_ticks;
  1653. dlg.DoModal();
  1654. SetTimer(2, m_timer * 60000, NULL);
  1655. }
  1656. else if (nIDEvent == 2) // 定时器触发超时密码对话框;
  1657. {
  1658. KillTimer(nIDEvent);
  1659. if (m_showpichwd)
  1660. ::SendMessage(m_showpichwd, WM_USER + 200, 1, 0);
  1661. TimeOutDlg dlg;
  1662. dlg.m_ticks = m_ticks;
  1663. dlg.DoModal();
  1664. SetTimer(2, m_timer * 60000, NULL);
  1665. }
  1666. else if (nIDEvent == 3)
  1667. {
  1668. KillTimer(nIDEvent);
  1669. //SetSPName3();
  1670. }
  1671. }
  1672. /************************************************************************/
  1673. /*
  1674. 函数: LoadPhotos
  1675. 描述: 加载图片
  1676. 参数:
  1677. 返回:
  1678. */
  1679. /************************************************************************/
  1680. void ChooseDesignSkin::LoadPhotos()
  1681. {
  1682. TerminateThread();
  1683. //清除资源的路径
  1684. ClearResData();
  1685. DWORD tm1(0), tm2(0);
  1686. tm1 = GetTickCount();
  1687. //获取当前查看的相片
  1688. CStringArray *pArray = GetCurArray(m_SelectCategory);
  1689. for (int i = 0; i < pArray->GetSize(); i++)
  1690. {
  1691. CString filePath = pArray->ElementAt(i);
  1692. if(filePath == _T(""))
  1693. continue;
  1694. SResData* pRes = new SResData();
  1695. pRes->nType = (int)TYPE_ICON;
  1696. //转为小写
  1697. filePath.MakeLower();
  1698. pRes->strFilePath = filePath;
  1699. m_vResData.push_back(pRes);
  1700. }
  1701. tm2 = GetTickCount();
  1702. printf("绘制图片的准备时间:%dms\n", (tm2-tm1));
  1703. //创建绘画线程LoadThumbNail3
  1704. LoadThumbImages();
  1705. }
  1706. /************************************************************************/
  1707. /*
  1708. 函数: GetNoSelPhoto
  1709. 描述: 未选中的相片
  1710. 参数:
  1711. 返回:
  1712. 注意:
  1713. */
  1714. /************************************************************************/
  1715. void ChooseDesignSkin::GetNoSelPhoto()
  1716. {
  1717. CStringArray* pNoSelArr = NULL;
  1718. CStringArray* pAllArr = NULL;
  1719. CStringArray* pSelArr = NULL;
  1720. pNoSelArr = GetCurArray(INDX_NOSEL);
  1721. pAllArr = GetCurArray(INDX_ALL);
  1722. pSelArr = GetCurArray(INDX_SEL);
  1723. if(pNoSelArr == NULL || pAllArr == NULL || pSelArr == NULL)
  1724. return;
  1725. pNoSelArr->RemoveAll();
  1726. CString str1(_T("")), str2(_T(""));
  1727. for (int i = 0; i < pAllArr->GetSize(); i++)
  1728. {
  1729. BOOL bFind = 0;
  1730. for (int j = 0; j < pSelArr->GetSize(); j++)
  1731. {
  1732. str1 = pAllArr->ElementAt(i);
  1733. str2 = pSelArr->ElementAt(j);
  1734. if (str1.CollateNoCase(str2) == 0)
  1735. {
  1736. bFind = 1;
  1737. break;
  1738. }
  1739. }
  1740. if (bFind == 0)
  1741. pNoSelArr->Add(pAllArr->ElementAt(i));
  1742. }
  1743. }
  1744. /************************************************************************/
  1745. /*
  1746. 函数: OnSelPhoto
  1747. 描述: 查看选中相片
  1748. 参数:
  1749. 返回:
  1750. 注意:
  1751. */
  1752. /************************************************************************/
  1753. void ChooseDesignSkin::OnSelPhoto()
  1754. {
  1755. ProductChooseFilter dlg;
  1756. CString name = _T("");
  1757. int i = 0;
  1758. for ( i = 0; i < m_List2.GetItemCount(); i++)
  1759. {
  1760. name = m_List2.GetItemText(i, 2);
  1761. dlg.m_array.Add(name);
  1762. }
  1763. for (i = 0; i < m_List3.GetItemCount(); i++)
  1764. {
  1765. name = m_List3.GetItemText(i, 2);
  1766. dlg.m_array.Add(name);
  1767. }
  1768. if(dlg.DoModal() == IDCANCEL)
  1769. {
  1770. m_SelectCategory = INDX_ALL;
  1771. return;
  1772. }
  1773. m_sChooseFilter = dlg.m_sChooseFilter;
  1774. UpdateChooseZS();
  1775. }
  1776. /************************************************************************/
  1777. /*
  1778. 函数: GetCurArray
  1779. 描述: 获取要查看的数据
  1780. 参数:
  1781. const int nIndx 选中数据索引
  1782. SFolderInfo* m_pForder 文件夹
  1783. 返回:
  1784. 注意:
  1785. */
  1786. /************************************************************************/
  1787. CStringArray* ChooseDesignSkin::GetCurArray(const int nIndx)
  1788. {
  1789. CStringArray* pArray = NULL;
  1790. switch (nIndx)
  1791. {
  1792. case INDX_ALL: //全部
  1793. pArray = &m_AllPhotoPath;
  1794. break;
  1795. case INDX_SEL: //选中
  1796. pArray = &m_SelPhotoPath;
  1797. break;
  1798. case INDX_NOSEL: //未选
  1799. pArray = &m_NoSelPhotoPath;
  1800. break;
  1801. case INDX_DEL: //删除
  1802. pArray = &m_DelPhotoPath;
  1803. break;
  1804. case INDX_INTOALBUM: //入册
  1805. pArray = &m_IntoAlbumPath;
  1806. break;
  1807. case INDX_ENTRYPHASSE: //入底
  1808. pArray = &m_EntryPhasepath;
  1809. break;
  1810. }
  1811. return pArray;
  1812. }
  1813. /************************************************************************/
  1814. /*
  1815. 函数: SortArray
  1816. 描述: 按F4乱序或排序
  1817. 参数:
  1818. 返回:
  1819. */
  1820. /************************************************************************/
  1821. void ChooseDesignSkin::SortArray()
  1822. {
  1823. int i = 0;
  1824. int j = 0;
  1825. m_bSort = !m_bSort;
  1826. CStringArray *pArray[6] = { &m_AllPhotoPath, &m_SelPhotoPath, &m_NoSelPhotoPath, &m_DelPhotoPath, &m_IntoAlbumPath, &m_EntryPhasepath };
  1827. if (m_bSort == 0)
  1828. {
  1829. for ( i = 0; i < 6; i++)
  1830. {
  1831. if (pArray[i]->GetSize())
  1832. {
  1833. int size = pArray[i]->GetSize() - 1;
  1834. CString sTemp;
  1835. int nPos;
  1836. for (int ii = 0; ii < size; ii++)
  1837. {
  1838. nPos = rand() % (size - ii);
  1839. sTemp = pArray[i]->ElementAt(size - ii);
  1840. pArray[i]->SetAt(size - ii, pArray[i]->ElementAt(nPos));
  1841. pArray[i]->SetAt(nPos, sTemp);
  1842. }
  1843. }
  1844. }
  1845. }
  1846. else
  1847. { // 使用CCombobox的Sort来排序;
  1848. for ( i = 0; i < 6; i++)
  1849. {
  1850. m_combo1.ResetContent();
  1851. CString Temp;
  1852. for ( j = 0; j < pArray[i]->GetSize(); j++)
  1853. {
  1854. m_combo1.AddString(pArray[i]->ElementAt(j));
  1855. }
  1856. for (j = 0; j < pArray[i]->GetSize(); j++)
  1857. {
  1858. m_combo1.GetLBText(j, Temp);
  1859. pArray[i]->SetAt(j, Temp);
  1860. }
  1861. }
  1862. }
  1863. //终止线程
  1864. TerminateThread();
  1865. //清除资源的路径
  1866. ClearResData();
  1867. //获取当前查看的相片
  1868. CStringArray *pArr = GetCurArray(m_SelectCategory);
  1869. if(pArr == NULL)
  1870. return;
  1871. for ( i = 0; i < pArr->GetSize(); i++)
  1872. {
  1873. SResData* pRes = new SResData();
  1874. pRes->nType = (int)TYPE_ICON;
  1875. CString filePath = pArr->ElementAt(i);
  1876. //转为小写
  1877. filePath.MakeLower();
  1878. pRes->strFilePath = filePath;
  1879. m_vResData.push_back(pRes);
  1880. }
  1881. //创建绘画线程LoadThumbNail3
  1882. LoadThumbImages();
  1883. }
  1884. /*-------------------------------------------------------
  1885. 函数名: DrawInterface
  1886. 描述: 绘制界面
  1887. 参数:
  1888. 返回值:
  1889. -------------------------------------------------------*/
  1890. void ChooseDesignSkin::DrawInterface()
  1891. {
  1892. CRect rc(0, 0, 0, 0), rt(0, 0, 0, 0);
  1893. ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
  1894. ScreenToClient(rc);
  1895. int nH = rc.bottom - rc.top;
  1896. rc.right -= (rc.left + 100);
  1897. rc.left = 5;
  1898. rc.top += 10;
  1899. rc.right += 220;
  1900. rc.bottom = rc.top + nH - 10;
  1901. rt.CopyRect(&rc);
  1902. CDC *pDC = GetDC();
  1903. Graphics graph(pDC->GetSafeHdc());
  1904. Rect destinationRect(rc.left, rc.top, rc.Width(), rc.Height());
  1905. RectF layoutRect(rc.left, rc.top, rc.Width(), rc.Height());
  1906. rc.left /= g_fscalex;
  1907. rc.right /= g_fscalex;
  1908. rc.top /= g_fscaley;
  1909. rc.bottom /= g_fscaley;
  1910. // graph.SetSmoothingMode(SmoothingModeHighQuality);
  1911. graph.DrawImage(m_pBk, destinationRect, rc.left, rc.top, rc.Width(), rc.Height(), UnitPixel);
  1912. StringFormat format;
  1913. format.SetAlignment(StringAlignmentNear);
  1914. SolidBrush *Brush = new SolidBrush(Color(255, 255, 255, 255));
  1915. //显示张数
  1916. CString str = _T("");
  1917. str.Format(_T("张数:%d"), m_List1.GetItemCount());
  1918. int leng = GetLengthEx(str);
  1919. BSTR bstr = str.AllocSysString();
  1920. Gdiplus::Font* pFont = new Gdiplus::Font(L"黑体", 11);
  1921. graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
  1922. graph.DrawString(
  1923. bstr,
  1924. leng,
  1925. pFont,
  1926. layoutRect,
  1927. &format,
  1928. Brush);
  1929. SysFreeString(bstr);
  1930. delete Brush;
  1931. delete pFont;
  1932. ReleaseDC(pDC);
  1933. }
  1934. CString ChooseDesignSkin::GetZSInfo(int iItem)
  1935. {
  1936. if (m_SelectCategory != INDX_SEL)
  1937. CalChooseZS(GetCurArray(INDX_SEL), GetCurArray(INDX_ALL));
  1938. CString str = _T("");
  1939. CString scount = m_List1.GetItemText(iItem, 0);
  1940. int ncount = 0;
  1941. int npos = scount.Find(_T("\r\n"));
  1942. while (npos != -1)
  1943. {
  1944. ncount++;
  1945. scount = scount.Right(scount.GetLength() - npos - 2);
  1946. npos = scount.Find(_T("\r\n"));
  1947. }
  1948. CString zs = m_taoxizs;
  1949. int pos = zs.Find("\\");
  1950. if (pos != -1)
  1951. zs = zs.Left(pos);
  1952. str.Format(_T("X:%d"), ncount);
  1953. return str;
  1954. }
  1955. /************************************************************************/
  1956. /*
  1957. 函数: GetPathAddToSel
  1958. 描述: 获取路径添加到选中相片
  1959. 参数:
  1960. strName:dindansp表中no或no2字段值;相片名间使用逗号分隔;
  1961. 返回: 1成功,0失败
  1962. */
  1963. /************************************************************************/
  1964. int ChooseDesignSkin::GetPathAddToSel(const CString& strName)
  1965. {
  1966. if(strName == _T(""))
  1967. return 0;
  1968. CStringArray* pSelArr = NULL;
  1969. CStringArray* pAllArr = NULL;
  1970. pSelArr = GetCurArray(INDX_SEL);
  1971. pAllArr = GetCurArray(INDX_ALL);
  1972. GetPathAddToSel(pSelArr, strName, pAllArr);
  1973. return 1;
  1974. }
  1975. /************************************************************************/
  1976. /*
  1977. 函数: GetPathAddToSel
  1978. 描述: 获取路径添加到选中相片
  1979. 参数:
  1980. CStringArray* pSelArr
  1981. const CString& str
  1982. 返回: 1成功,0失败
  1983. */
  1984. /************************************************************************/
  1985. int ChooseDesignSkin::GetPathAddToSel(CStringArray* pSelArr, const CString& strName, CStringArray* pAllArr)
  1986. {
  1987. return ChoosePhotoBase::GetPathAddToSel(pSelArr, strName, pAllArr);
  1988. }
  1989. /************************************************************************/
  1990. /*
  1991. 函数: GetAlbumPhoto
  1992. 描述: 查看入册相片
  1993. 参数:
  1994. 返回:
  1995. */
  1996. /************************************************************************/
  1997. void ChooseDesignSkin::GetAlbumPhoto()
  1998. {
  1999. if (m_SelectCategory == INDX_INTOALBUM)
  2000. return;
  2001. m_SelectCategory = INDX_INTOALBUM;
  2002. CStringArray* pArr = NULL;
  2003. pArr = GetCurArray(m_SelectCategory);
  2004. pArr->RemoveAll();
  2005. CString photosName = _T("");
  2006. int i = 0;
  2007. for (i= 0; i < m_List3.GetItemCount(); i++)
  2008. {
  2009. if (m_List3.GetItemText(i, 2) != _T("入册"))
  2010. continue;
  2011. photosName = m_no2array.ElementAt(i);
  2012. break;
  2013. }
  2014. CStringArray* pAllArry = NULL;
  2015. pAllArry = GetCurArray(INDX_ALL);
  2016. //将入册的相片名
  2017. #ifdef USE_SEP_VEB
  2018. photosName = SEPS_VEB + photosName + SEPS_VEB;
  2019. #else
  2020. photosName = SEPS_CMA + photosName + SEPS_CMA;
  2021. #endif //#ifdef USE_SEP_VEB
  2022. for (i = pAllArry->GetSize() - 1; i >= 0; i--)
  2023. {
  2024. CString strName = _T("");
  2025. strName = pAllArry->ElementAt(i);
  2026. strName = strName.Right(strName.GetLength() - strName.ReverseFind('\\') - 1);
  2027. strName = strName.Left(strName.Find('.'));
  2028. #ifdef USE_SEP_VEB
  2029. strName = SEPS_VEB + strName + SEPS_VEB;
  2030. #else
  2031. strName = SEPS_CMA + strName + SEPS_CMA;
  2032. #endif //#ifdef USE_SEP_VEB
  2033. if (photosName.Find(strName) != -1)
  2034. {
  2035. strName = pAllArry->ElementAt(i);
  2036. pArr->Add(strName);
  2037. }
  2038. }
  2039. }
  2040. /************************************************************************/
  2041. /*
  2042. 函数: GetDiskPhoto
  2043. 描述: 查看入底相片
  2044. 参数:
  2045. 返回:
  2046. */
  2047. /************************************************************************/
  2048. void ChooseDesignSkin::GetDiskPhoto()
  2049. {
  2050. if (m_SelectCategory == INDX_ENTRYPHASSE)
  2051. return;
  2052. m_SelectCategory = INDX_ENTRYPHASSE;
  2053. CStringArray* pArr = NULL;
  2054. pArr = GetCurArray(m_SelectCategory);
  2055. int i = 0;
  2056. pArr->RemoveAll();
  2057. CString photosName = _T("");
  2058. for ( i = 0; i < m_List3.GetItemCount(); i++)
  2059. {
  2060. if (m_List3.GetItemText(i, 2) != _T("入底"))
  2061. continue;
  2062. photosName = m_no2array.ElementAt(i);
  2063. break;
  2064. }
  2065. CStringArray* pAllArry = NULL;
  2066. pAllArry = GetCurArray(INDX_ALL);
  2067. #ifdef USE_SEP_VEB
  2068. photosName = SEPS_VEB + photosName + SEPS_VEB;
  2069. #else
  2070. photosName = SEPS_CMA + photosName + SEPS_CMA;
  2071. #endif //#ifdef USE_SEP_VEB
  2072. for (i = pAllArry->GetSize() - 1; i >= 0; i--)
  2073. {
  2074. CString strName = _T("");
  2075. strName = pAllArry->ElementAt(i);
  2076. strName = strName.Right(strName.GetLength() - strName.ReverseFind('\\') - 1);
  2077. strName = strName.Left(strName.Find('.'));
  2078. #ifdef USE_SEP_VEB
  2079. strName = SEPS_VEB + strName + SEPS_VEB;
  2080. #else
  2081. strName = SEPS_CMA + strName + SEPS_CMA;
  2082. #endif //#ifdef USE_SEP_VEB
  2083. if (photosName.Find(strName) != -1)
  2084. {
  2085. strName = pAllArry->ElementAt(i);
  2086. pArr->Add(strName);
  2087. }
  2088. }
  2089. }
  2090. /************************************************************************/
  2091. /*
  2092. 函数名: ReLoad
  2093. 描述: 重新加载数据
  2094. 参数:
  2095. 返回值:
  2096. */
  2097. /************************************************************************/
  2098. BOOL ChooseDesignSkin::ReLoad()
  2099. {
  2100. return GetData();
  2101. }
  2102. /************************************************************************/
  2103. /*
  2104. 函数: ReLoadPhoto
  2105. 描述: 重新加载相片
  2106. 参数:
  2107. 返回:
  2108. */
  2109. /************************************************************************/
  2110. void ChooseDesignSkin::ReLoadPhoto()
  2111. {
  2112. if (!((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
  2113. {
  2114. m_path = g_path3 + _T("\\");
  2115. m_path += m_strOrderNumber;
  2116. m_path += _T("\\");
  2117. GetPhotos();
  2118. m_bChooseBig = 0;
  2119. }
  2120. else
  2121. {
  2122. m_bChooseBig = 1;
  2123. //选择此次拍摄名称DLG(如:拍摄景点)
  2124. GetTXName(&m_strOrderNumber, 1, m_bGrowthTX, m_seltxname);
  2125. m_AllPhotoPath.RemoveAll();
  2126. if (IsThereACacheImg()) //
  2127. m_bFromLocal = 1;
  2128. if (m_AllPhotoPath.GetSize() == 0)
  2129. {
  2130. if (IsPhoto2Exist())
  2131. {
  2132. SelBrunDevice dlg;
  2133. dlg.m_mode = 0;
  2134. if (dlg.DoModal() == IDOK)
  2135. m_nChoosePhotoType = dlg.m_sel;
  2136. else
  2137. m_nChoosePhotoType = 0;
  2138. //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
  2139. }
  2140. else
  2141. AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
  2142. {
  2143. CString path, path2;
  2144. m_path = g_path1 + _T("\\");
  2145. m_path += m_strOrderNumber;
  2146. m_path += _T("\\");
  2147. if (m_seltxname != "" && m_seltxname != _T("全部"))
  2148. {
  2149. m_path += m_seltxname;
  2150. m_path += _T("\\");
  2151. }
  2152. if (m_nChoosePhotoType == 1) // 选片:修片
  2153. {
  2154. m_path = g_path2 + _T("\\");
  2155. m_path += m_strOrderNumber;
  2156. m_path += _T("\\");
  2157. }
  2158. CString filename = _T("");
  2159. ffsco o;
  2160. o.dirs(1);
  2161. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  2162. ffsco::typeT coo;
  2163. ffsco::typeT::iterator it;
  2164. coo = o.co_file();
  2165. for (it = coo.begin(); coo.end() != it; it++)
  2166. {
  2167. path = (*it).c_str();
  2168. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  2169. {
  2170. path.MakeLower();
  2171. filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  2172. if (filename.Find(".") != -1)
  2173. filename = filename.Left(filename.Find("."));
  2174. if (!myisdigit(filename))continue;
  2175. if (m_nChoosePhotoType == 1)
  2176. {
  2177. #if JEFF_TEST_ON
  2178. if (PathFileExists(path))
  2179. m_AllPhotoPath.Add(path);
  2180. #else
  2181. m_AllPhotoPath.Add(path);
  2182. #endif //#if JEFF_TEST_ON
  2183. }
  2184. else
  2185. {
  2186. path2 = path;
  2187. if (m_nChoosePhotoType == 0)
  2188. path2.Replace("客户原片", "修好的片");
  2189. if (m_bGrowthTX == 0)
  2190. {
  2191. int pos = path2.Find(m_strOrderNumber);
  2192. pos += m_strOrderNumber.GetLength();
  2193. int pos2 = path2.ReverseFind('\\');
  2194. path2 = path2.Left(pos) + path2.Right(path2.GetLength() - pos2);
  2195. }
  2196. if (m_nChoosePhotoType == 0 && ::PathFileExists(path2))
  2197. {
  2198. m_AllPhotoPath.Add(path2);
  2199. }
  2200. else
  2201. {
  2202. path2.Replace(".raw", _T(".jpg"));
  2203. if (PathFileExists(path2))
  2204. {
  2205. m_AllPhotoPath.Add(path2);
  2206. continue;
  2207. }
  2208. path2.Replace(".nef", _T(".jpg"));
  2209. if (PathFileExists(path2))
  2210. {
  2211. m_AllPhotoPath.Add(path2);
  2212. continue;
  2213. }
  2214. path2.Replace(".cr2", _T(".jpg"));
  2215. if (PathFileExists(path2))
  2216. {
  2217. m_AllPhotoPath.Add(path2);
  2218. continue;
  2219. }
  2220. else
  2221. {
  2222. if (path.Right(3) != "jpg")
  2223. continue;
  2224. #if JEFF_TEST_ON
  2225. if (PathFileExists(path))
  2226. m_AllPhotoPath.Add(path);
  2227. #else
  2228. m_AllPhotoPath.Add(path);
  2229. #endif //#if JEFF_TEST_ON
  2230. }
  2231. }
  2232. }
  2233. }
  2234. }
  2235. }
  2236. // if(0)
  2237. {//多种修好的效果
  2238. CString path, path2;
  2239. path2 = g_path2 + _T("\\");
  2240. path2 += m_strOrderNumber;
  2241. path2 += _T("\\");
  2242. ffsco o;
  2243. o.dirs(0);
  2244. o.find(LPCSTR(path2), LPCSTR("*.jpg"));
  2245. ffsco::typeT coo;
  2246. ffsco::typeT::iterator it;
  2247. coo = o.co_file();
  2248. for (it = coo.begin(); coo.end() != it; it++)
  2249. {
  2250. path = (*it).c_str();
  2251. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  2252. {
  2253. path.MakeLower();
  2254. path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  2255. if (path2.Find(_T("-")) != -1)
  2256. {
  2257. #if JEFF_TEST_ON
  2258. if (PathFileExists(path))
  2259. m_AllPhotoPath.Add(path);
  2260. #else
  2261. m_AllPhotoPath.Add(path);
  2262. #endif //#if JEFF_TEST_ON
  2263. }
  2264. }
  2265. }
  2266. }
  2267. }
  2268. if (m_AllPhotoPath.GetSize() && atoi(g_cominfoarray.ElementAt(0).ElementAt(61)))
  2269. {
  2270. int size = m_AllPhotoPath.GetSize() - 1;
  2271. CString sTemp;
  2272. int nPos;
  2273. for (int i = 0; i < size; i++)
  2274. {
  2275. nPos = rand() % (size - i);
  2276. sTemp = m_AllPhotoPath.ElementAt(size - i);
  2277. m_AllPhotoPath.SetAt(size - i, m_AllPhotoPath.ElementAt(nPos));
  2278. m_AllPhotoPath.SetAt(nPos, sTemp);
  2279. }
  2280. }
  2281. }
  2282. m_SelectCategory = INDX_ALL;
  2283. LoadPhotos();
  2284. }
  2285. /************************************************************************/
  2286. /*
  2287. 函数: DrawImageWork
  2288. 描述: 绘制工作
  2289. 参数:
  2290. 返回:
  2291. */
  2292. /************************************************************************/
  2293. void ChooseDesignSkin::DrawImageWork()
  2294. {
  2295. CListCtrl* ListCtrl = &m_List1;
  2296. CImageList* pImgList = &m_ImageListThumb;
  2297. try
  2298. {
  2299. // reset our image list
  2300. for (int i = 0; i < pImgList->GetImageCount(); i++)
  2301. pImgList->Remove(i);
  2302. // remove all items from list view
  2303. ListCtrl->DeleteAllItems();
  2304. pImgList->SetImageCount(m_vResData.size());
  2305. // Set redraw to FALSE to avoid flickering during adding new items
  2306. ListCtrl->SetRedraw(FALSE);
  2307. //添加列表项名
  2308. AddListItemName(ListCtrl);
  2309. //设置重绘并刷新
  2310. ListCtrl->SetRedraw(TRUE);
  2311. ListCtrl->Invalidate();
  2312. //绘制图标
  2313. DrawImage(ListCtrl, pImgList);
  2314. m_bRunning = false;
  2315. m_bTerminate = false;
  2316. PostMessage(WM_USER + 200, 0, 0);
  2317. return;
  2318. }
  2319. catch (...)
  2320. {
  2321. ListCtrl->Invalidate();
  2322. m_bRunning = false;
  2323. m_bTerminate = false;
  2324. PostMessage(WM_USER + 200, 0, 0);
  2325. }
  2326. }
  2327. /************************************************************************/
  2328. /*
  2329. 函数: AddListItemName
  2330. 描述: 添加列表项名
  2331. 参数:
  2332. 返回: 1成功,0失败
  2333. */
  2334. /************************************************************************/
  2335. int ChooseDesignSkin::AddListItemName(CListCtrl* pListCtrl)
  2336. {
  2337. if(pListCtrl == NULL)
  2338. return 0;
  2339. int nIndex = 0;
  2340. CString str(_T("")), spath(_T(""));
  2341. //添加文件名
  2342. vector<SResData*>::iterator iter;
  2343. for(iter = m_vResData.begin(); iter != m_vResData.end() && m_bTerminate != true; iter++, nIndex++)
  2344. {
  2345. SResData* pRes = (*iter);
  2346. if(pRes == NULL)
  2347. continue;
  2348. str = pRes->strFilePath;
  2349. if (str.Left(str.ReverseFind('\\') + 1) != m_path)
  2350. {
  2351. spath = str.Left(str.ReverseFind('\\') + 1);
  2352. spath = spath.Right(spath.GetLength() - m_path.GetLength());
  2353. }
  2354. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  2355. //添加名字
  2356. if (str.Find("delgabook") != -1)
  2357. {
  2358. str.TrimRight(_T("\\"));
  2359. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  2360. str.Replace("delgabook", "Flash");
  2361. pListCtrl->InsertItem(nIndex, str, nIndex);
  2362. }
  2363. else
  2364. {
  2365. str = spath + str.Left(str.GetLength() - 4);
  2366. CString temp = GetSelName(str);
  2367. pListCtrl->InsertItem(nIndex, str + temp, nIndex);
  2368. }
  2369. }
  2370. return 1;
  2371. }
  2372. /************************************************************************/
  2373. /*
  2374. 函数: DrawImage
  2375. 描述: 绘制
  2376. 参数:
  2377. 返回:
  2378. */
  2379. /************************************************************************/
  2380. void ChooseDesignSkin::DrawImage(CListCtrl* pListCtrl, CImageList* pImgList)
  2381. {
  2382. if(pListCtrl == NULL)
  2383. return;
  2384. int nIndex = 0;
  2385. Image* pHideImg = NULL; //相片图标
  2386. CString str(_T("")), spath(_T(""));
  2387. vector<SResData*>::iterator iter;
  2388. for (iter = m_vResData.begin(); iter != m_vResData.end() && m_bTerminate != true; iter++, nIndex++)
  2389. {
  2390. // Load Image File
  2391. Image *image = NULL;
  2392. Bitmap *pBmp = NULL;
  2393. SResData* pRes = (*iter);
  2394. if(pRes == NULL)
  2395. continue;
  2396. BOOL bNullimg = FALSE;
  2397. //加载相片图标res\未标题-1.jpg
  2398. switch(pRes->nType)
  2399. {
  2400. case TYPE_ICON: //相片图标
  2401. {
  2402. if(m_bHide && pHideImg == NULL)
  2403. pHideImg = m_pHideImg;
  2404. //是否要重新加载资源
  2405. if(pHideImg == NULL)
  2406. {
  2407. ReLoadImageFromRes(&image, pRes->strFilePath, bNullimg);
  2408. if(image == NULL)
  2409. continue;
  2410. }
  2411. else
  2412. image = pHideImg;
  2413. }
  2414. break;
  2415. }
  2416. //创建bitmap使用颜色填充区域
  2417. SolidBrush whitebrush(Color(255, 255, 255, 255));
  2418. pBmp = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB);
  2419. Graphics graph2(pBmp);
  2420. graph2.Clear(Color(255, 192, 192, 192));
  2421. graph2.FillRectangle(&whitebrush, 1, 1, THUMBNAIL_WIDTH - 2, THUMBNAIL_HEIGHT - 2);
  2422. // 缩放图片符合画布大小
  2423. Rect desRect(0, 0, 0, 0);
  2424. ZoomImage(image, desRect);
  2425. // 绘制图标res\未标题-1.jpg
  2426. Graphics graph(pBmp);
  2427. graph.DrawImage(image, desRect, 0, 0, image->GetWidth(), image->GetHeight(), UnitPixel);
  2428. // 将图片替换bitmap添加到图标列表
  2429. CBitmap bitmap;
  2430. HBITMAP hbmp;
  2431. pBmp->GetHBITMAP(Color(255, 255, 255, 255), &hbmp);
  2432. bitmap.Attach(hbmp);
  2433. pImgList->Replace(nIndex, &bitmap, NULL);
  2434. if(pBmp)
  2435. delete pBmp;
  2436. // Redraw only a current item for removing flickering and fast speed.
  2437. pListCtrl->RedrawItems(nIndex, nIndex);
  2438. // Release used DC and Object
  2439. if(image && pRes->nType == TYPE_ICON && pHideImg == NULL)
  2440. delete image;
  2441. }
  2442. pListCtrl->Invalidate();
  2443. }