ChooseDesignSkin.cpp 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793
  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. #ifdef __DLL_RENDERINGS__
  512. if ( !lyfzLibrary::LoadRenderingsLibarary())
  513. AfxMessageBox(_T("加载效果图模块失败,请确认模块存在!"));
  514. if ( lyfzLibrary::g_PtrLoadRenderings == NULL)
  515. AfxMessageBox(_T("加载效果图接口失败,请确认模块完整!"));
  516. // 计算出CStringArray的大小;
  517. CMemFile MemFile;
  518. CArchive ar(&MemFile,CArchive::store);
  519. this->GetCurArray(m_SelectCategory)->Serialize(ar);
  520. ar.Close();
  521. DWORD dwReturnSize = MemFile.GetLength();
  522. BYTE *pData = MemFile.Detach();
  523. HGLOBAL hMemery = GlobalAlloc(GMEM_MOVEABLE, dwReturnSize);
  524. BYTE *pMem = (BYTE*)GlobalLock(hMemery);
  525. memcpy(pMem,pData,dwReturnSize);
  526. if ( pData )
  527. {
  528. delete pData;
  529. }
  530. if ( !lyfzLibrary::g_PtrLoadRenderings(g_path7, hMemery, dwReturnSize) )
  531. {// 返回false,由调用者释放;
  532. GlobalUnlock(hMemery);
  533. GlobalFree(hMemery);
  534. }
  535. lyfzLibrary::FreeRenderingsLibarary();
  536. #else
  537. ShowEffectDlg dlg;
  538. dlg.m_pPhotopatharray = this->GetCurArray(m_SelectCategory);
  539. dlg.DoModal();
  540. #endif
  541. }
  542. break;
  543. case 5: // 保存按钮事件;
  544. OnButton4();
  545. break;
  546. case 9: //看设计->放大按钮
  547. {
  548. if (((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
  549. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(0);
  550. else
  551. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(1);
  552. ReLoadPhoto();
  553. }
  554. break;
  555. case 6: // 关闭按钮事件 ;
  556. if (m_bModify && m_bCanSave)
  557. {
  558. ShowMsg3 dlg;
  559. dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
  560. // if (AfxMessageBox(_T("提醒, 选片修改未保存, 是否保存后再退出?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
  561. if(dlg.DoModal() == IDOK)
  562. {
  563. OnButton4();
  564. if (m_bSaveFail)
  565. {
  566. AfxMessageBox(_T("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!"));
  567. CDialog::OnCancel();
  568. return;
  569. }
  570. return;
  571. }
  572. else
  573. {
  574. CString savepath = _T("");
  575. savepath.Format(_T("%s\\%s-2.dat"), g_mainpath, m_strOrderNumber);
  576. ::DeleteFile(savepath); // 删除*.dat文件;
  577. }
  578. }
  579. CDialog::OnCancel();
  580. break;
  581. case 11:
  582. if (m_selphotownd.GetSafeHwnd() == NULL)
  583. {
  584. m_selphotownd.m_id = m_strOrderNumber;
  585. m_selphotownd.m_rc = m_rcarray.ElementAt(6);
  586. m_selphotownd.Create(IDD_DLGShowSelPhoto, this);
  587. }
  588. m_selphotownd.ShowWindow(1);
  589. break;
  590. case 12:
  591. ReplaceDesignNo dlg;
  592. dlg.m_id = this->m_strOrderNumber;
  593. dlg.DoModal();
  594. break;
  595. }
  596. }
  597. #else
  598. LRESULT ChooseDesignSkin::OnBtnClick(WPARAM wParam, LPARAM lParam)
  599. {
  600. // WM_USER + 1101
  601. // F5按键,显示删除相片
  602. int id = lParam;
  603. id -= 99;
  604. switch (id)
  605. {
  606. case 1: // 查看全部相片按钮事件;
  607. case 2: // 查看选中的相片按钮事件;
  608. case 4: // F5查看删除的相片;
  609. {
  610. if (m_SelectCategory == id - 1 && m_SelectCategory != 1)
  611. return 0;
  612. m_SelectCategory = id - 1;
  613. if(INDX_SEL == m_SelectCategory)
  614. OnSelPhoto();
  615. LoadPhotos();
  616. }
  617. break;
  618. case 3://查看未选按钮事件;
  619. {
  620. m_SelectCategory = INDX_NOSEL;
  621. m_sChooseFilter = _T("");
  622. UpdateChooseZS();
  623. GetNoSelPhoto();
  624. LoadPhotos();
  625. }
  626. break;
  627. case 13: // 查看入册相片按钮事件;
  628. GetAlbumPhoto();
  629. LoadPhotos();
  630. break;
  631. case 14: // 查看入底相片按钮事件;
  632. GetDiskPhoto();
  633. LoadPhotos();
  634. break;
  635. case 15: // 效果图按钮事件;
  636. {
  637. #ifdef __DLL_RENDERINGS__
  638. if ( !lyfzLibrary::LoadRenderingsLibarary())
  639. AfxMessageBox(_T("加载效果图模块失败,请确认模块存在!"));
  640. if ( lyfzLibrary::g_PtrLoadRenderings == NULL)
  641. AfxMessageBox(_T("加载效果图接口失败,请确认模块完整!"));
  642. // 计算出CStringArray的大小;
  643. CMemFile MemFile;
  644. CArchive ar(&MemFile,CArchive::store);
  645. this->GetCurArray(m_SelectCategory)->Serialize(ar);
  646. ar.Close();
  647. DWORD dwReturnSize = MemFile.GetLength();
  648. BYTE *pData = MemFile.Detach();
  649. HGLOBAL hMemery = GlobalAlloc(GMEM_MOVEABLE, dwReturnSize);
  650. BYTE *pMem = (BYTE*)GlobalLock(hMemery);
  651. memcpy(pMem,pData,dwReturnSize);
  652. if ( pData )
  653. {
  654. delete pData;
  655. }
  656. if ( !lyfzLibrary::g_PtrLoadRenderings(g_path7, hMemery, dwReturnSize) )
  657. {// 返回false,由调用者释放;
  658. GlobalUnlock(hMemery);
  659. GlobalFree(hMemery);
  660. }
  661. lyfzLibrary::FreeRenderingsLibarary();
  662. #else
  663. ShowEffectDlg dlg;
  664. dlg.m_pPhotopatharray = this->GetCurArray(m_SelectCategory);
  665. dlg.DoModal();
  666. #endif
  667. }
  668. break;
  669. case 5: // 保存按钮事件;
  670. OnButton4();
  671. break;
  672. case 9: //看设计->放大按钮
  673. {
  674. if (((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
  675. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(0);
  676. else
  677. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(1);
  678. ReLoadPhoto();
  679. }
  680. break;
  681. case 6: // 关闭按钮事件 ;
  682. if (m_bModify && m_bCanSave)
  683. {
  684. ShowMsg3 dlg;
  685. dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
  686. // if (AfxMessageBox(_T("提醒, 选片修改未保存, 是否保存后再退出?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
  687. if(dlg.DoModal() == IDOK)
  688. {
  689. OnButton4();
  690. if (m_bSaveFail)
  691. {
  692. AfxMessageBox(_T("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!"));
  693. CDialog::OnCancel();
  694. return 0;
  695. }
  696. return 0;
  697. }
  698. else
  699. {
  700. CString savepath = _T("");
  701. savepath.Format(_T("%s\\%s-2.dat"), g_mainpath, m_strOrderNumber);
  702. ::DeleteFile(savepath); // 删除*.dat文件;
  703. }
  704. }
  705. CDialog::OnCancel();
  706. break;
  707. case 11:
  708. if (m_selphotownd.GetSafeHwnd() == NULL)
  709. {
  710. m_selphotownd.m_id = m_strOrderNumber;
  711. m_selphotownd.m_rc = m_rcarray.ElementAt(6);
  712. m_selphotownd.Create(IDD_DLGShowSelPhoto, this);
  713. }
  714. m_selphotownd.ShowWindow(1);
  715. break;
  716. case 12:
  717. ReplaceDesignNo dlg;
  718. dlg.m_id = this->m_strOrderNumber;
  719. dlg.DoModal();
  720. break;
  721. }
  722. return 0;
  723. }
  724. #endif
  725. BOOL ChooseDesignSkin::OnEraseBkgnd(CDC* pDC)
  726. {
  727. return 1;
  728. }
  729. BEGIN_EVENTSINK_MAP(ChooseDesignSkin, CDialog)
  730. ON_EVENT(ChooseDesignSkin, 100, 150 /* FSCommand */, OnFSCommandShockwaveflash1, VTS_BSTR VTS_BSTR)
  731. END_EVENTSINK_MAP()
  732. void ChooseDesignSkin::OnFSCommandShockwaveflash1(LPCTSTR command, LPCTSTR args)
  733. {
  734. }
  735. //------------------------------------------------------------------
  736. // 函数:OnDblclkList1
  737. // 描述:处理双击和回车时的图片显示效果;与函数名本身的表达意义不一致,导致歧义!
  738. // 参数:
  739. // 返回:
  740. //------------------------------------------------------------------
  741. void ChooseDesignSkin::OnDblclkList1()
  742. {
  743. // 1.从双击中的列表项中获取相片名;
  744. POSITION pos;
  745. pos = m_List1.GetFirstSelectedItemPosition();
  746. if (pos == NULL)
  747. return;
  748. int iItem = m_List1.GetNextSelectedItem(pos);
  749. #if JEFF_TEST_OFF
  750. // 双击列表根本就不做不到多选多击,双击只会选中一个,故GetNextSelectedItem(pos)后,pos=NULL
  751. // 但是这个函数的作用并不是跟函数名一致,有其他地方用到。
  752. #else // 这一块代码是用于处理回车键;
  753. CArray<int, int>posarray;
  754. posarray.Add(iItem);
  755. // 获取剩下的图片位置;
  756. while (pos)
  757. {
  758. int iItem = m_List1.GetNextSelectedItem(pos);
  759. posarray.Add(iItem);
  760. if (posarray.GetSize() > 3)
  761. break;
  762. }
  763. if (posarray.GetSize() >= 2)
  764. {
  765. CStringArray* pPtahArray = NULL;
  766. pPtahArray = GetCurArray(m_SelectCategory);
  767. CComparePhoto dlg;
  768. dlg.m_path1 = pPtahArray->ElementAt(posarray.ElementAt(0));
  769. dlg.m_path2 = pPtahArray->ElementAt(posarray.ElementAt(1));
  770. if (posarray.GetSize() > 2)
  771. dlg.m_path3 = pPtahArray->ElementAt(posarray.ElementAt(2));
  772. if (posarray.GetSize() > 3)
  773. dlg.m_path4 = pPtahArray->ElementAt(posarray.ElementAt(3));
  774. dlg.DoModal();
  775. return;
  776. }
  777. #endif //JEFF_TEST_OFF
  778. CString title = m_List1.GetItemText(iItem, 0);
  779. if (title.Find("Flash") != -1)
  780. {
  781. title.Replace("Flash", "delgabook");
  782. CString str = m_path + title + "\\delgaBook.exe";
  783. ShellExecute(NULL, _T("open"), str, NULL, NULL, SW_SHOWNORMAL);
  784. return;
  785. }
  786. m_showpichwd = NULL;
  787. // 双击小图查看大图;
  788. ShowPic22 dlg;
  789. dlg.m_bShowImgInfo = 1;
  790. dlg.m_pParent = this;
  791. dlg.m_nCurImgPos = iItem;
  792. CStringArray* pArray = GetCurArray(m_SelectCategory);
  793. if(pArray == NULL)
  794. return;
  795. dlg.m_pAryImgPath = pArray;
  796. dlg.DoModal();
  797. m_showpichwd = NULL;
  798. }
  799. void ChooseDesignSkin::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) // 双击图片列表!
  800. {
  801. OnDblclkList1();
  802. *pResult = 0;
  803. }
  804. /************************************************************************/
  805. /*
  806. 函数: GetData
  807. 描述: 选片模式
  808. 参数:
  809. 返回:
  810. 注意:
  811. */
  812. /************************************************************************/
  813. BOOL ChooseDesignSkin::GetData()//选片模式;
  814. {
  815. m_List2.DeleteAllItems();
  816. m_List3.DeleteAllItems();
  817. m_noarray.RemoveAll();
  818. m_no2array.RemoveAll();
  819. m_oldsparray.RemoveAll();
  820. //选设计
  821. CString filter = _T("");
  822. #ifdef CHILD_VERSION
  823. filter = "id='" + m_strOrderNumber + "';id='" + m_strOrderNumber + "';;;id='" + m_strOrderNumber + "'";
  824. #else
  825. filter = "id='" + m_strOrderNumber + "' and kind<>'2';id='" + m_strOrderNumber + "';;;id='" + m_strOrderNumber + "'";
  826. #endif //CHILD_VERSION
  827. //订单号、商品编号、商品价格、订单商品数量、商品类型、商品名称、选片选中相片名、自增id、选设计选中相片名;
  828. g_sendhead.code[0] = 50; // dindansp;
  829. g_sendhead.code[1] = 11; // dindan
  830. g_sendhead.code[2] = 4; // shangpin
  831. g_sendhead.code[3] = 8; // shangpin
  832. g_sendhead.code[4] = 182; // dindansp3
  833. g_sendhead.tabcount = 5;
  834. g_sendhead.bsql = 0;
  835. g_pMainWnd->ProcessChatMessageRequest2(filter);
  836. if (g_bSendOK == 0)
  837. return 0;
  838. CArray<CStringArray, CStringArray> sparray; //dindansp表;//订单号、商品编号、商品价格、订单商品数量、商品类型、商品名称、选片选中相片名、自增id、选设计选中相片名;
  839. DataToArray(&sparray, &g_List1array, &m_sparray, &m_List2array, &m_oldsparray);
  840. m_SelPhotoPath.RemoveAll();
  841. CString str(_T("")), kind(_T(""));
  842. int nchoosezs = 0;
  843. int list2pos = 0;
  844. int list3pos = 0;
  845. CString savepath = _T("");
  846. savepath.Format(_T("%s\\%s-2.dat"), g_mainpath, m_strOrderNumber);
  847. CString stm1 = GetModifyTime2(savepath);
  848. CTime tm1 = CTime::GetCurrentTime();
  849. tm1 -= CTimeSpan(60, 0, 0, 0);
  850. CString stm2 = tm1.Format(_T("%Y%m%d"));
  851. BOOL bLoadHistory = 0;
  852. if (PathFileExists(savepath) && stm1 > stm2)
  853. {
  854. if (AfxMessageBox(_T("提醒:请谨慎操作\r\n上次选片未正常退出, 是否还原到上次选片状态?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
  855. bLoadHistory = 1;
  856. }
  857. int i = 0;
  858. if (bLoadHistory)
  859. {
  860. //还原到上次选片状态
  861. CArray<CStringArray, CStringArray> List1array;
  862. //读取数据
  863. CFile fp;
  864. fp.Open(savepath, CFile::modeRead);
  865. DWORD nMessageLen = fp.GetLength();
  866. BYTE *szChatMessage = new BYTE[nMessageLen];
  867. fp.Read(szChatMessage, nMessageLen);
  868. fp.Close();
  869. int count = 0;
  870. memcpy(&count, szChatMessage + (nMessageLen - sizeof(int)), sizeof(int));
  871. CMemFile memfile;
  872. memfile.Attach(szChatMessage, nMessageLen);
  873. CArchive ar(&memfile, CArchive::load);
  874. List1array.SetSize(count);
  875. for ( i = 0; i < List1array.GetSize(); i++)
  876. List1array.ElementAt(i).Serialize(ar);
  877. ar.Close();
  878. memfile.Detach();
  879. delete[]szChatMessage;
  880. list2pos = 0;
  881. list3pos = 0;
  882. for (i = 0; i < List1array.GetSize(); i++)
  883. {
  884. if (0)//List1array.ElementAt (i).GetSize ()==6)
  885. {
  886. kind = "0";
  887. m_List2.InsertItem(list2pos, List1array.ElementAt(i).ElementAt(1));
  888. m_List2.SetItemText(list2pos, 1, List1array.ElementAt(i).ElementAt(2));
  889. m_List2.SetItemText(list2pos, 2, List1array.ElementAt(i).ElementAt(3));
  890. m_List2.SetItemText(list2pos, 3, List1array.ElementAt(i).ElementAt(4));
  891. m_List2.SetItemText(list2pos, 4, List1array.ElementAt(i).ElementAt(5));
  892. str = List1array.ElementAt(i).ElementAt(5);
  893. list2pos++;
  894. }
  895. else
  896. {
  897. kind = "4";
  898. m_List3.InsertItem(list3pos, List1array.ElementAt(i).ElementAt(1));
  899. m_List3.SetItemText(list3pos, 1, List1array.ElementAt(i).ElementAt(2));
  900. m_List3.SetItemText(list3pos, 2, List1array.ElementAt(i).ElementAt(3));
  901. m_List3.SetItemText(list3pos, 3, List1array.ElementAt(i).ElementAt(4));
  902. m_List3.SetItemText(list3pos, 4, List1array.ElementAt(i).ElementAt(5));
  903. m_List3.SetItemText(list3pos, 5, List1array.ElementAt(i).ElementAt(6));
  904. m_List3.SetItemText(list3pos, 6, List1array.ElementAt(i).ElementAt(9));
  905. #ifdef LKAY_VERSION
  906. m_List3.SetItemText(list3pos, 6, List1array.ElementAt (i).ElementAt (7));
  907. m_List3.SetItemText(list3pos, 7, List1array.ElementAt (i).ElementAt (8));
  908. str=List1array.ElementAt (i).ElementAt (8);
  909. #else
  910. str = List1array.ElementAt(i).ElementAt(6);
  911. #endif //#ifdef LKAY_VERSION
  912. list3pos++;
  913. }
  914. nchoosezs += GetZS(str);
  915. GetPathAddToSel(str);
  916. if (!str.IsEmpty())
  917. {
  918. #ifdef USE_SEP_VEB
  919. str = SEPS_VEB + str + SEPS_VEB;
  920. #else
  921. str = SEPS_CMA + str + SEPS_CMA;
  922. #endif //#ifdef USE_SEP_VEB
  923. }
  924. str.MakeLower();
  925. if (kind == _T("4"))
  926. m_no2array.Add(str);
  927. else
  928. m_noarray.Add(str);
  929. }
  930. }
  931. else
  932. {
  933. for ( i = 0; i < sparray.GetSize(); i++)
  934. {
  935. kind = _T("4");//sparray.ElementAt (i).ElementAt (4);
  936. if (kind == _T("4"))
  937. {
  938. m_List3.InsertItem(list3pos, sparray.ElementAt(i).ElementAt(7)); // dindansp表autoid;
  939. m_List3.SetItemText(list3pos, 1, sparray.ElementAt(i).ElementAt(1)); // 商品编号;
  940. m_List3.SetItemText(list3pos, 2, sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  941. m_List3.SetItemText(list3pos, 3, sparray.ElementAt(i).ElementAt(2)); // 商品价格;
  942. m_List3.SetItemText(list3pos, 4, sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  943. #ifdef LKAY_VERSION
  944. m_List3.SetItemText(list3pos, 5, sparray.ElementAt (i).ElementAt (9)); //
  945. m_List3.SetItemText(list3pos, 6, sparray.ElementAt (i).ElementAt (10));
  946. m_List3.SetItemText(list3pos, 7, sparray.ElementAt (i).ElementAt (8));
  947. #else
  948. m_List3.SetItemText(list3pos, 5, sparray.ElementAt(i).ElementAt(8)); // 选设计时选中的相片名;
  949. m_List3.SetItemText(list3pos, 6, sparray.ElementAt(i).ElementAt(9)); // 商品备注;
  950. #endif
  951. list3pos++;
  952. }
  953. else
  954. {
  955. m_List2.InsertItem(list2pos, sparray.ElementAt(i).ElementAt(7)); // dindansp表autoid;
  956. m_List2.SetItemText(list2pos, 1, sparray.ElementAt(i).ElementAt(1)); // 商品编号;
  957. m_List2.SetItemText(list2pos, 2, sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  958. m_List2.SetItemText(list2pos, 3, sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  959. m_List2.SetItemText(list2pos, 4, sparray.ElementAt(i).ElementAt(8)); // 选设计时选中的相片名;
  960. list2pos++;
  961. }
  962. str = sparray.ElementAt(i).ElementAt(8);
  963. str.MakeLower();
  964. nchoosezs += GetZS(str); // 获取no或no2字段中包含的相片名数量;
  965. GetPathAddToSel(str);
  966. if (!str.IsEmpty())
  967. {
  968. #ifdef USE_SEP_VEB
  969. str = SEPS_VEB + str + SEPS_VEB;
  970. #else
  971. str = SEPS_CMA + str + SEPS_CMA;
  972. #endif //#ifdef USE_SEP_VEB
  973. }
  974. if (kind == _T("4"))
  975. m_no2array.Add(str);
  976. else
  977. m_noarray.Add(str);
  978. }
  979. }
  980. if (g_List1array.GetSize())
  981. {
  982. m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  983. m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  984. m_phone1 = g_List1array.ElementAt(0).ElementAt(61);
  985. m_phone2 = g_List1array.ElementAt(0).ElementAt(62);
  986. #ifdef USE_SEP_VEB
  987. if (!m_name1.IsEmpty())
  988. m_name = m_name1 + SEPS_VEB;
  989. m_name += m_name2;
  990. m_name.TrimRight(SEPS_VEB);
  991. #else
  992. if (!m_name1.IsEmpty())
  993. m_name = m_name1 + SEPS_CMA;
  994. m_name += m_name2;
  995. m_name.TrimRight(SEPS_CMA);
  996. #endif //#ifdef USE_SEP_VEB
  997. m_waiter3 = g_user.name;
  998. m_taoxizs = g_List1array.ElementAt(0).ElementAt(9);
  999. m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  1000. m_takezs = g_List1array.ElementAt(0).ElementAt(23);
  1001. m_choosezs = g_List1array.ElementAt(0).ElementAt(24);
  1002. m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  1003. m_oldmoney3 = m_money3;
  1004. m_bz3 = g_List1array.ElementAt(0).ElementAt(57);
  1005. m_urgent = g_List1array.ElementAt(0).ElementAt(40);
  1006. m_delphotos = g_List1array.ElementAt(0).ElementAt(56);// Jeff获取选设计时,被删除的相片,选取的字段delphotos2;.读取正常,保存时未能正确保存到delphotos2字段;
  1007. if ( m_delphotos.GetAt(0) != SEPC_VEB || m_delphotos.GetAt(m_delphotos.GetLength() -1) != SEPC_VEB )
  1008. {
  1009. m_delphotos.TrimLeft(SEPC_VEB);
  1010. m_delphotos.TrimRight(SEPC_VEB);
  1011. m_delphotos = SEPS_VEB + m_delphotos + SEPS_VEB;
  1012. }
  1013. m_status8 = g_List1array.ElementAt(0).ElementAt(55);
  1014. m_time6 = g_List1array.ElementAt(0).ElementAt(48);
  1015. m_time5old = m_time5;
  1016. m_time6old = m_time6;
  1017. m_checkstatus = g_List1array.ElementAt(0).ElementAt(55);
  1018. UpdateData(false);
  1019. }
  1020. else
  1021. {
  1022. m_name1 = _T("");
  1023. m_name2 = _T("");
  1024. m_waiter3 = _T("");
  1025. m_taoxizs = _T("");
  1026. m_time5 = _T("");
  1027. m_takezs = _T("");
  1028. m_choosezs = _T("");
  1029. m_money3 = "";
  1030. m_bz3 = _T("");
  1031. m_urgent = _T("");
  1032. UpdateData(false);
  1033. }
  1034. return 1;
  1035. }
  1036. void ChooseDesignSkin::OnClose()
  1037. {
  1038. /*
  1039. if (m_bModify)
  1040. {
  1041. ShowMsg3 dlg;
  1042. dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
  1043. if(dlg.DoModal() == IDOK)
  1044. OnButton4();
  1045. }
  1046. */
  1047. CDialog::OnClose();
  1048. }
  1049. BOOL ChooseDesignSkin::PreTranslateMessage(MSG* pMsg)
  1050. {
  1051. if (pMsg->message == WM_LBUTTONDOWN)
  1052. {
  1053. g_bNeedDrawParent = 2;
  1054. if (0)
  1055. {//list3
  1056. CPoint pt;
  1057. CRect rc, rc2;
  1058. ::GetCursorPos(&pt);
  1059. m_List3.GetWindowRect(rc2);
  1060. if (rc2.PtInRect(pt) == 0) return CDialog::PreTranslateMessage(pMsg);
  1061. SetTimer(3, 300, NULL);
  1062. }
  1063. }
  1064. else if (0)//pMsg->message==WM_LBUTTONDBLCLK)
  1065. {
  1066. {//list1
  1067. CPoint pt;
  1068. CRect rc, rc2;
  1069. ::GetCursorPos(&pt);
  1070. m_List2.GetWindowRect(rc2);
  1071. if (rc2.PtInRect(pt))
  1072. return 1;
  1073. }
  1074. {//list3
  1075. CPoint pt;
  1076. CRect rc, rc2;
  1077. ::GetCursorPos(&pt);
  1078. m_List3.GetWindowRect(rc2);
  1079. if (rc2.PtInRect(pt) == 0)return CDialog::PreTranslateMessage(pMsg);
  1080. pt.x -= rc2.left;
  1081. pt.y -= rc2.top;
  1082. int iItem = m_List3.GetItemCount() - 1;
  1083. if (iItem < 0)
  1084. {
  1085. m_List3.GetHeaderCtrl()->GetItemRect(0, rc);
  1086. int hei = rc.Height();
  1087. rc.top += hei;
  1088. rc.bottom += hei;
  1089. if (rc.PtInRect(pt))
  1090. {
  1091. m_List3.InsertItem(m_List3.GetItemCount(), "");
  1092. }
  1093. }
  1094. else
  1095. {
  1096. m_List3.GetSubItemRect(iItem, 0, LVIR_BOUNDS, rc);
  1097. int hei = rc.Height();
  1098. rc.top += hei;
  1099. rc.bottom += hei;
  1100. if (rc.PtInRect(pt))
  1101. {
  1102. if (m_List3.GetItemText(iItem, 1).IsEmpty() && m_List3.GetItemText(iItem, 2).IsEmpty())
  1103. return CDialog::PreTranslateMessage(pMsg);
  1104. m_List3.InsertItem(m_List3.GetItemCount(), "");
  1105. }
  1106. POSITION pos;
  1107. pos = m_List3.GetFirstSelectedItemPosition();
  1108. if (pos)
  1109. {
  1110. iItem = m_List3.GetNextSelectedItem(pos);
  1111. m_List3.GetSubItemRect(iItem, 4, LVIR_BOUNDS, rc);
  1112. if (rc.PtInRect(pt))return 1;
  1113. }
  1114. }
  1115. }
  1116. }
  1117. else if (pMsg->message == WM_KEYDOWN)
  1118. {
  1119. if (m_showpichwd)return 1;
  1120. switch (pMsg->wParam)
  1121. {
  1122. case VK_DELETE:
  1123. {
  1124. OnDel();
  1125. //更新绘制
  1126. DrawInterface();
  1127. // LoadPhotos();
  1128. }
  1129. return 1;
  1130. case VK_RETURN:
  1131. OnDblclkList1();
  1132. return 1;
  1133. case VK_F4:
  1134. if (m_bChooseBig == 0)
  1135. return 1;
  1136. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(62)))
  1137. {
  1138. if (m_SelectCategory == INDX_SEL)
  1139. UpdateChooseZS();
  1140. SortArray();
  1141. }
  1142. return 1;
  1143. case VK_F5:
  1144. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
  1145. {
  1146. OnBtnClick(0, 99 + 4);
  1147. }
  1148. return 1;
  1149. case VK_F1:
  1150. {
  1151. if (m_selphotownd2.GetSafeHwnd() == NULL)
  1152. {
  1153. m_selphotownd2.m_id = m_strOrderNumber;
  1154. m_selphotownd2.m_bGrowthTX = m_bGrowthTX;
  1155. m_selphotownd2.m_seltxname = m_seltxname;
  1156. m_selphotownd2.m_rc = m_rcarray.ElementAt(6);
  1157. m_selphotownd2.Create(IDD_DLGShowSelPhoto2, this);
  1158. }
  1159. m_selphotownd2.ShowWindow(1);
  1160. }
  1161. return 1;
  1162. case VK_F2: //缩略图
  1163. if (m_bChooseBig == 0)
  1164. return 1;
  1165. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(60)))
  1166. {
  1167. m_bHide = !m_bHide;
  1168. LoadPhotos();
  1169. }
  1170. return 1;
  1171. case VK_F6:
  1172. {
  1173. ReplaceDesignNo dlg;
  1174. dlg.m_id = this->m_strOrderNumber;
  1175. dlg.DoModal();
  1176. }
  1177. return 1;
  1178. case VK_ESCAPE:
  1179. {
  1180. return TRUE;
  1181. }
  1182. break;
  1183. }
  1184. }
  1185. else if(pMsg->message == WM_LBUTTONUP)
  1186. {
  1187. CDialog::PreTranslateMessage(pMsg);
  1188. return TRUE;
  1189. }
  1190. return CDialog::PreTranslateMessage(pMsg);
  1191. }
  1192. // 右键选片模式;
  1193. void ChooseDesignSkin::OnRclickList1()
  1194. {
  1195. if (m_bRunning)
  1196. return;
  1197. CMenuXP *pPopup = NULL;
  1198. POSITION pos;
  1199. pos = m_List1.GetFirstSelectedItemPosition();
  1200. if (pos == NULL)
  1201. return;
  1202. CString path = _T("");
  1203. CStringArray* pArray = NULL;
  1204. int iItem = m_List1.GetNextSelectedItem(pos);
  1205. pArray = GetCurArray(m_SelectCategory);
  1206. path = pArray->ElementAt(iItem); //path//打印出相片完整路径名;
  1207. // 右键看设计模式;
  1208. if (!m_bChooseBig)
  1209. path = path.Right(path.GetLength() - m_path.GetLength());
  1210. else
  1211. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1212. path = path.Left(path.ReverseFind('.'));
  1213. #ifdef USE_SEP_VEB
  1214. path = SEPS_VEB + path + SEPS_VEB; //
  1215. #else
  1216. path = SEPS_CMA + path + SEPS_CMA; //
  1217. #endif //#ifdef USE_SEP_VEB
  1218. // TODO: Add your control notification handler code here
  1219. // 1.创建菜单对象;
  1220. // 1.创建菜单对象;
  1221. pPopup = new CMenuXP;
  1222. pPopup->CYBUTTONMARGIN = 3; // 1.0.按钮范围0~3; 4个菜单;
  1223. pPopup->CreatePopupMenu(); // 1.1.弹出式菜单;
  1224. pPopup->SetMenuStyle(CMenuXP::STYLE_XP);// 1.2.弹出菜单样式;
  1225. // Jeff:m_List2有三列头:编号、商品名称、商品数量;
  1226. //计算菜单最大字符长度
  1227. int i = 0;
  1228. int maxleng = 1;
  1229. {
  1230. CString name, no;
  1231. int count = 0;
  1232. for ( i = 0; i < m_List2.GetItemCount(); i++)
  1233. {
  1234. // name商品名称
  1235. name = m_List2.GetItemText(i, 2);
  1236. no = m_noarray.ElementAt(i);
  1237. maxleng = max(maxleng, name.GetLength());
  1238. }
  1239. count = i;
  1240. for (; i < count + m_no2array.GetSize(); i++)
  1241. {
  1242. name = m_List3.GetItemText(i - count, 2);
  1243. maxleng = max(maxleng, name.GetLength());
  1244. }
  1245. }
  1246. maxleng += 3;
  1247. // Jeff:m_List2有三列头:编号、商品名称、商品数量;
  1248. CString scount = _T("");
  1249. CString name, no;
  1250. int count = 0;
  1251. for ( i = 0; i < m_List2.GetItemCount(); i++)
  1252. {
  1253. name = m_List2.GetItemText(i, 2);
  1254. //填充长度
  1255. FillLength(name, maxleng);
  1256. // Jeff,no里为商品名称选中的相片
  1257. no = m_noarray.ElementAt(i);
  1258. GetSelCountFromName(no, scount);
  1259. //添加菜单项
  1260. pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));// 2.使用AppendODMenu2添加子菜单项;
  1261. //绑定事件ID
  1262. if (no.Find(path) != -1)
  1263. pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
  1264. }
  1265. count = i;
  1266. for (; i < count + m_no2array.GetSize(); i++)
  1267. {
  1268. name = m_List3.GetItemText(i - count, 2);
  1269. FillLength(name, maxleng);
  1270. no = m_no2array.ElementAt(i - count);
  1271. GetSelCountFromName(no, scount);
  1272. pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));
  1273. if (no.Find(path) != -1)
  1274. pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
  1275. }
  1276. pPopup->AppendODMenu2(0, new CMenuXPText(32794, "修改要求", NULL));
  1277. //获取当前鼠标位置
  1278. CPoint pt;
  1279. ::GetCursorPos(&pt);
  1280. // 3.使用TrackPopupMenu,正常弹出菜单;
  1281. pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);
  1282. delete pPopup;
  1283. }
  1284. void ChooseDesignSkin::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult)
  1285. {
  1286. if (m_showpichwd)
  1287. return;
  1288. OnRclickList1();
  1289. *pResult = 0;
  1290. }
  1291. //
  1292. /************************************************************************/
  1293. /*
  1294. 函数: OnCommandMenu
  1295. 描述: 弹出菜单处理;
  1296. 参数:
  1297. UINT nID 事件ID
  1298. 返回:
  1299. 注意:
  1300. */
  1301. /************************************************************************/
  1302. void ChooseDesignSkin::OnCommandMenu(UINT nID)
  1303. {
  1304. //看设计事件
  1305. OnCommandMenu2(nID);
  1306. return;
  1307. }
  1308. /************************************************************************/
  1309. /*
  1310. 函数: OnCommandMenu2
  1311. 描述: 看设计,弹出菜单处理;
  1312. 参数:
  1313. UINT nID 事件ID
  1314. 返回:
  1315. 注意:
  1316. */
  1317. /************************************************************************/
  1318. void ChooseDesignSkin::OnCommandMenu2(UINT nID)
  1319. {
  1320. if (32794 == nID)// 处理菜单荐:修改要求;
  1321. {
  1322. //修改要求
  1323. POSITION pos;
  1324. pos = m_List1.GetFirstSelectedItemPosition();
  1325. if (pos == NULL)
  1326. {
  1327. return;
  1328. }
  1329. int iItem = m_List1.GetNextSelectedItem(pos);
  1330. CStringArray *pArray = GetCurArray(m_SelectCategory);
  1331. CString path = pArray->ElementAt(iItem);
  1332. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1333. path = path.Left(path.Find('.'));
  1334. UpdateData();
  1335. CClientRequirement dlg;
  1336. dlg.m_no = "当前照片:" + path;
  1337. dlg.m_bz2 = m_bz3;
  1338. dlg.m_bSave = 0;
  1339. dlg.m_nMode = 2;
  1340. if (dlg.DoModal() == IDOK)
  1341. {
  1342. m_bz3 = dlg.m_bz2;
  1343. UpdateData(false);
  1344. }
  1345. return;
  1346. }
  1347. POSITION pos;
  1348. pos = m_List1.GetFirstSelectedItemPosition();
  1349. if (pos == NULL)
  1350. {
  1351. return;
  1352. }
  1353. CString temp;
  1354. m_combo1.ResetContent();
  1355. int aa = 0;
  1356. while (pos) // 开始获取相片;
  1357. {
  1358. // if(aa && m_mode==1)break;
  1359. // if(aa && m_mode==2)break;
  1360. aa++;
  1361. int iItem = m_List1.GetNextSelectedItem(pos);
  1362. CStringArray *pArray = GetCurArray(m_SelectCategory);
  1363. // path:
  1364. CString path = pArray->ElementAt(iItem);
  1365. //AfxMessageBox(path);//Jeff box
  1366. if (m_bChooseBig)//选放大
  1367. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1368. else//选设计
  1369. path = path.Right(path.GetLength() - m_path.GetLength());
  1370. path = path.Left(path.ReverseFind('.'));
  1371. #ifdef USE_SEP_VEB
  1372. path = SEPS_VEB + path + SEPS_VEB; //
  1373. #else
  1374. path = SEPS_CMA + path + SEPS_CMA; //
  1375. #endif //#ifdef USE_SEP_VEB
  1376. int idpos = nID - IDM_MENUsp1;
  1377. BOOL bSel = 0;//选中还是取消
  1378. if (idpos < m_noarray.GetSize())
  1379. {
  1380. //MessageBox("1");
  1381. CString no = m_noarray.ElementAt(idpos); // no:为dindansp字段no;
  1382. //AfxMessageBox(no);//Jeff box
  1383. if (no.Find(path) != -1)
  1384. {
  1385. int pos = no.Find(path);
  1386. no.Delete(pos, path.GetLength() - 1);
  1387. }
  1388. else if (no.GetLength() > 4000)
  1389. {
  1390. AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP); return;
  1391. }
  1392. else
  1393. {
  1394. bSel = 1;
  1395. #ifdef USE_SEP_VEB
  1396. no.TrimRight(SEPS_VEB);
  1397. #else
  1398. no.TrimRight(SEPS_CMA);
  1399. #endif //#ifdef USE_SEP_VEB
  1400. no += path;
  1401. }
  1402. #ifdef USE_SEP_VEB
  1403. no.TrimLeft(SEPS_VEB);
  1404. no.TrimRight(SEPS_VEB);
  1405. #else
  1406. no.TrimLeft(SEPS_CMA);
  1407. no.TrimRight(SEPS_CMA);
  1408. #endif //#ifdef USE_SEP_VEB
  1409. m_List2.SetItemText(idpos, 4, no);
  1410. if (no.IsEmpty())
  1411. m_noarray.SetAt(idpos, no);
  1412. else
  1413. {
  1414. #ifdef USE_SEP_VEB
  1415. m_noarray.SetAt(idpos, SEPS_VEB + no + SEPS_VEB);
  1416. #else
  1417. m_noarray.SetAt(idpos, SEPS_CMA + no + SEPS_CMA);
  1418. #endif //#ifdef USE_SEP_VEB
  1419. }
  1420. }
  1421. else
  1422. {
  1423. idpos -= m_noarray.GetSize();
  1424. CString no = m_no2array.ElementAt(idpos);
  1425. if (no.Find(path) != -1)
  1426. {
  1427. int pos = no.Find(path);
  1428. no.Delete(pos, path.GetLength() - 1);
  1429. }
  1430. else if (no.GetLength() > 4000)
  1431. {
  1432. AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP); return;
  1433. }
  1434. else
  1435. {
  1436. bSel = 1;
  1437. #ifdef USE_SEP_VEB
  1438. no.TrimRight(SEPS_VEB);
  1439. #else
  1440. no.TrimRight(SEPS_CMA);
  1441. #endif //#ifdef USE_SEP_VEB
  1442. no += path;
  1443. }
  1444. #ifdef USE_SEP_VEB
  1445. no.TrimLeft(SEPS_VEB);
  1446. no.TrimRight(SEPS_VEB);
  1447. #else
  1448. no.TrimLeft(SEPS_CMA);
  1449. no.TrimRight(SEPS_CMA);
  1450. #endif //#ifdef USE_SEP_VEB
  1451. #ifdef LKAY_VERSION
  1452. m_List3.SetItemText (idpos, 7, no);
  1453. #else
  1454. m_List3.SetItemText(idpos, 5, no);
  1455. #endif //#ifdef LKAY_VERSION
  1456. if (no.IsEmpty())
  1457. m_no2array.SetAt(idpos, no);
  1458. else
  1459. {
  1460. #ifdef USE_SEP_VEB
  1461. m_no2array.SetAt(idpos, SEPS_VEB + no + SEPS_VEB);
  1462. #else
  1463. m_no2array.SetAt(idpos, SEPS_CMA + no + SEPS_CMA);
  1464. #endif //#ifdef USE_SEP_VEB
  1465. }
  1466. }
  1467. m_bModify = 1;
  1468. if (bSel == 0 && m_SelectCategory == INDX_SEL && IsSelPhoto(path) == 0)
  1469. {
  1470. temp.Format("%d", iItem);
  1471. m_combo1.AddString(temp);
  1472. continue;
  1473. }
  1474. else if (bSel == 1 && m_SelectCategory == INDX_NOSEL)
  1475. {
  1476. temp.Format("%d", iItem);
  1477. m_combo1.AddString(temp);
  1478. continue;
  1479. }
  1480. else if (bSel == 1 && m_SelectCategory == INDX_DEL)
  1481. {
  1482. temp.Format("%d", iItem);
  1483. m_combo1.AddString(temp);
  1484. continue;
  1485. }
  1486. /////////////////////////
  1487. CString no, dir;
  1488. no = pArray->ElementAt(iItem);
  1489. if (m_bChooseBig)//选放大
  1490. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  1491. else//选设计
  1492. no = no.Right(no.GetLength() - m_path.GetLength());
  1493. no = no.Left(no.ReverseFind('.'));
  1494. no += GetSelName(no);
  1495. m_List1.SetItemText(iItem, 0, no);
  1496. }
  1497. CArray<int, int>posarray;
  1498. for (int i = m_combo1.GetCount() - 1; i >= 0; i--)
  1499. {
  1500. m_combo1.GetLBText(i, temp);
  1501. posarray.Add(atoi(temp));
  1502. }
  1503. SortArray2(posarray);
  1504. if (posarray.GetSize())
  1505. {
  1506. if (m_SelectCategory == INDX_SEL)
  1507. {
  1508. for (int i = 0; i < posarray.GetSize(); i++)
  1509. {
  1510. m_List1.DeleteItem(posarray.ElementAt(i));
  1511. m_NoSelPhotoPath.Add(m_SelPhotoPath.ElementAt(posarray.ElementAt(i)));
  1512. m_SelPhotoPath.RemoveAt(posarray.ElementAt(i));
  1513. }
  1514. if (m_showpichwd)
  1515. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  1516. }
  1517. else if (m_SelectCategory == INDX_NOSEL)
  1518. {
  1519. for (int i = 0; i < posarray.GetSize(); i++)
  1520. {
  1521. m_List1.DeleteItem(posarray.ElementAt(i));
  1522. m_NoSelPhotoPath.RemoveAt(posarray.ElementAt(i));
  1523. }
  1524. if (m_showpichwd)
  1525. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  1526. }
  1527. else if (m_SelectCategory == INDX_DEL)
  1528. {
  1529. for (int i = 0; i < posarray.GetSize(); i++)
  1530. {
  1531. m_List1.DeleteItem(posarray.ElementAt(i));
  1532. m_AllPhotoPath.Add(m_DelPhotoPath.ElementAt(posarray.ElementAt(i)));
  1533. m_DelPhotoPath.RemoveAt(posarray.ElementAt(i));
  1534. }
  1535. if (m_showpichwd)
  1536. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  1537. }
  1538. }
  1539. CString strFile = m_strOrderNumber + _T("-2.dat");
  1540. Save(g_mainpath, strFile);
  1541. DrawInterface();
  1542. if (m_showpichwd)
  1543. ::SendMessage(m_showpichwd, WM_USER + 200, 0, 0);
  1544. }
  1545. long ChooseDesignSkin::UpdateTakeZS(WPARAM inWParam, LPARAM inLParam)
  1546. {
  1547. if (m_SelectCategory == INDX_ALL && m_List1.GetItemCount() > atoi(m_takezs))
  1548. {
  1549. UpdateData();
  1550. m_takezs.Format("%d", m_List1.GetItemCount());
  1551. UpdateData(false);
  1552. }
  1553. //绘制
  1554. DrawInterface();
  1555. return 1;
  1556. }
  1557. /************************************************************************/
  1558. /*
  1559. 函数: UpdateChooseZS
  1560. 描述: 更新选中相片
  1561. 参数:
  1562. 返回:
  1563. 注意:
  1564. */
  1565. /************************************************************************/
  1566. void ChooseDesignSkin::UpdateChooseZS()
  1567. {
  1568. int i = 0;
  1569. CString str = _T("");
  1570. CStringArray* pSelArr = NULL;
  1571. CStringArray* pAllArr = NULL;
  1572. pSelArr = GetCurArray(INDX_SEL);
  1573. pAllArr = GetCurArray(INDX_ALL);
  1574. pSelArr->RemoveAll();
  1575. if (m_sChooseFilter != _T("") && m_sChooseFilter != _T("全部"))
  1576. {
  1577. for ( i = 0; i < m_List3.GetItemCount(); i++)
  1578. {
  1579. if (m_List3.GetItemText(i, 2) != m_sChooseFilter)
  1580. continue;
  1581. str = m_no2array.ElementAt(i);
  1582. GetPathAddToSel(pSelArr, str, pAllArr);
  1583. }
  1584. return;
  1585. }
  1586. for ( i = 0; i < m_noarray.GetSize(); i++)
  1587. {
  1588. str = m_noarray.ElementAt(i);
  1589. GetPathAddToSel(pSelArr, str, pAllArr);
  1590. }
  1591. for (i = 0; i < m_no2array.GetSize(); i++)
  1592. {
  1593. str = m_no2array.ElementAt(i);
  1594. GetPathAddToSel(pSelArr, str, pAllArr);
  1595. }
  1596. }
  1597. // 保存按钮;
  1598. void ChooseDesignSkin::OnButton4()// 保存按钮;
  1599. {
  1600. UpdateData();
  1601. if (m_SelectCategory != INDX_SEL)
  1602. CalChooseZS(&m_SelPhotoPath, &m_AllPhotoPath);
  1603. CString zs = m_taoxizs;
  1604. int pos = zs.Find("\\");
  1605. if (pos != -1)
  1606. {
  1607. zs = zs.Left(pos);
  1608. }
  1609. m_choosezs.Format("%d", max(0, m_SelPhotoPath.GetSize() - atoi(zs)));
  1610. m_bSaveFail = 0;
  1611. ChoosePhotoSkin3 dlg;
  1612. dlg.m_pParent = this;
  1613. dlg.DoModal();
  1614. if (dlg.m_bSave)
  1615. m_bModify = 0;
  1616. if (dlg.m_bPushedSave == 0 && dlg.m_bSaveFail == 0)
  1617. {
  1618. CString savepath = _T("");
  1619. savepath.Format("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
  1620. ::DeleteFile(savepath); // 删除*.dat文件;
  1621. }
  1622. m_bSaveFail = dlg.m_bSaveFail;
  1623. if (dlg.m_bExit)
  1624. {
  1625. m_bModify = 0;
  1626. CDialog::OnCancel();
  1627. }
  1628. }
  1629. // 删除相片;
  1630. BOOL ChooseDesignSkin::OnDel() // 删除相片;
  1631. {
  1632. // printf("Jeff:m_mode=%d,m_mode2=%d.\n\n",m_mode,m_mode2);//Jeff Printf
  1633. if (m_SelectCategory == INDX_SEL)
  1634. {
  1635. AfxMessageBox("选中照片不能删除, 请先取消选中状态!", MB_ICONINFORMATION);
  1636. return 0;
  1637. }
  1638. else if (m_SelectCategory == INDX_DEL)
  1639. {
  1640. return 0;
  1641. }
  1642. POSITION pos;
  1643. pos = m_List1.GetFirstSelectedItemPosition();
  1644. if (pos == NULL)
  1645. return 0;
  1646. if (m_bRunning)
  1647. return 0;
  1648. CStringArray* pArray = NULL;
  1649. CString strDelPhotoName = _T("");
  1650. CString strSelPhotoPath = _T("");
  1651. int iItem = m_List1.GetNextSelectedItem(pos);
  1652. int nItemIdx = iItem;
  1653. pArray = GetCurArray(m_SelectCategory);
  1654. strSelPhotoPath = pArray->ElementAt(nItemIdx);
  1655. strDelPhotoName = strSelPhotoPath;
  1656. if(strDelPhotoName == _T("") || pArray == NULL)
  1657. return 0;
  1658. strDelPhotoName = strDelPhotoName.Right(strDelPhotoName.GetLength() - strDelPhotoName.ReverseFind('\\') - 1);
  1659. strDelPhotoName = strDelPhotoName.Left(strDelPhotoName.Find('.'));
  1660. if (IsSelPhoto(strDelPhotoName)) // Jeff 这里有问题,有些订单删除未选中的相片时,会提示box内容。状态:未处理;
  1661. {
  1662. AfxMessageBox(_T("选中的照片不能删除, 请先取消选中状态!"), MB_ICONINFORMATION);
  1663. return 0;
  1664. }
  1665. if (AfxMessageBox(_T("是否删除此照片?"), MB_YESNO | MB_ICONINFORMATION) != IDYES)
  1666. return 0;
  1667. //将要删除的相片添加到删除数组里
  1668. #if JEFF_TEST_ON
  1669. if(PathFileExists(strSelPhotoPath))
  1670. m_DelPhotoPath.Add(strSelPhotoPath);
  1671. #else
  1672. m_DelPhotoPath.Add(strSelPhotoPath);
  1673. #endif //#if JEFF_TEST_ON
  1674. // printf("Jeff:将要删除的相片=%s\n\n",name);// Jeff Printf;
  1675. for(int i = 0; i < pArray->GetSize(); i++)
  1676. {
  1677. //字符串比较相同=0
  1678. if(strSelPhotoPath.CollateNoCase(pArray->ElementAt(i)) == 0)
  1679. {
  1680. pArray->RemoveAt(i);
  1681. m_List1.DeleteItem(iItem);
  1682. break;
  1683. }
  1684. }
  1685. if(m_SelectCategory == INDX_NOSEL)
  1686. DelPhotoFromName(m_AllPhotoPath, strDelPhotoName);
  1687. m_bModify = 1;
  1688. //设置默认选项
  1689. if(iItem >= pArray->GetSize())
  1690. iItem = 0;
  1691. m_List1.SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
  1692. return 1;
  1693. }
  1694. void ChooseDesignSkin::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
  1695. {
  1696. *pResult = 0;
  1697. }
  1698. void ChooseDesignSkin::OnTimer(UINT nIDEvent)
  1699. {
  1700. if (nIDEvent == 1)
  1701. {
  1702. KillTimer(nIDEvent);
  1703. if (m_showpichwd)
  1704. ::SendMessage(m_showpichwd, WM_USER + 200, 1, 0);
  1705. TimeOutDlg dlg;
  1706. dlg.m_ticks = m_ticks;
  1707. dlg.DoModal();
  1708. SetTimer(2, m_timer * 60000, NULL);
  1709. }
  1710. else if (nIDEvent == 2) // 定时器触发超时密码对话框;
  1711. {
  1712. KillTimer(nIDEvent);
  1713. if (m_showpichwd)
  1714. ::SendMessage(m_showpichwd, WM_USER + 200, 1, 0);
  1715. TimeOutDlg dlg;
  1716. dlg.m_ticks = m_ticks;
  1717. dlg.DoModal();
  1718. SetTimer(2, m_timer * 60000, NULL);
  1719. }
  1720. else if (nIDEvent == 3)
  1721. {
  1722. KillTimer(nIDEvent);
  1723. //SetSPName3();
  1724. }
  1725. }
  1726. /************************************************************************/
  1727. /*
  1728. 函数: LoadPhotos
  1729. 描述: 加载图片
  1730. 参数:
  1731. 返回:
  1732. */
  1733. /************************************************************************/
  1734. void ChooseDesignSkin::LoadPhotos()
  1735. {
  1736. TerminateThread();
  1737. //清除资源的路径
  1738. ClearResData();
  1739. DWORD tm1(0), tm2(0);
  1740. tm1 = GetTickCount();
  1741. //获取当前查看的相片
  1742. CStringArray *pArray = GetCurArray(m_SelectCategory);
  1743. for (int i = 0; i < pArray->GetSize(); i++)
  1744. {
  1745. CString filePath = pArray->ElementAt(i);
  1746. if(filePath == _T(""))
  1747. continue;
  1748. SResData* pRes = new SResData();
  1749. pRes->nType = (int)TYPE_ICON;
  1750. //转为小写
  1751. filePath.MakeLower();
  1752. pRes->strFilePath = filePath;
  1753. m_vResData.push_back(pRes);
  1754. }
  1755. tm2 = GetTickCount();
  1756. printf("绘制图片的准备时间:%dms\n", (tm2-tm1));
  1757. //创建绘画线程LoadThumbNail3
  1758. LoadThumbImages();
  1759. }
  1760. /************************************************************************/
  1761. /*
  1762. 函数: GetNoSelPhoto
  1763. 描述: 未选中的相片
  1764. 参数:
  1765. 返回:
  1766. 注意:
  1767. */
  1768. /************************************************************************/
  1769. void ChooseDesignSkin::GetNoSelPhoto()
  1770. {
  1771. CStringArray* pNoSelArr = NULL;
  1772. CStringArray* pAllArr = NULL;
  1773. CStringArray* pSelArr = NULL;
  1774. pNoSelArr = GetCurArray(INDX_NOSEL);
  1775. pAllArr = GetCurArray(INDX_ALL);
  1776. pSelArr = GetCurArray(INDX_SEL);
  1777. if(pNoSelArr == NULL || pAllArr == NULL || pSelArr == NULL)
  1778. return;
  1779. pNoSelArr->RemoveAll();
  1780. CString str1(_T("")), str2(_T(""));
  1781. for (int i = 0; i < pAllArr->GetSize(); i++)
  1782. {
  1783. BOOL bFind = 0;
  1784. for (int j = 0; j < pSelArr->GetSize(); j++)
  1785. {
  1786. str1 = pAllArr->ElementAt(i);
  1787. str2 = pSelArr->ElementAt(j);
  1788. if (str1.CollateNoCase(str2) == 0)
  1789. {
  1790. bFind = 1;
  1791. break;
  1792. }
  1793. }
  1794. if (bFind == 0)
  1795. pNoSelArr->Add(pAllArr->ElementAt(i));
  1796. }
  1797. }
  1798. /************************************************************************/
  1799. /*
  1800. 函数: OnSelPhoto
  1801. 描述: 查看选中相片
  1802. 参数:
  1803. 返回:
  1804. 注意:
  1805. */
  1806. /************************************************************************/
  1807. void ChooseDesignSkin::OnSelPhoto()
  1808. {
  1809. ProductChooseFilter dlg;
  1810. CString name = _T("");
  1811. int i = 0;
  1812. for ( i = 0; i < m_List2.GetItemCount(); i++)
  1813. {
  1814. name = m_List2.GetItemText(i, 2);
  1815. dlg.m_array.Add(name);
  1816. }
  1817. for (i = 0; i < m_List3.GetItemCount(); i++)
  1818. {
  1819. name = m_List3.GetItemText(i, 2);
  1820. dlg.m_array.Add(name);
  1821. }
  1822. if(dlg.DoModal() == IDCANCEL)
  1823. {
  1824. m_SelectCategory = INDX_ALL;
  1825. return;
  1826. }
  1827. m_sChooseFilter = dlg.m_sChooseFilter;
  1828. UpdateChooseZS();
  1829. }
  1830. /************************************************************************/
  1831. /*
  1832. 函数: GetCurArray
  1833. 描述: 获取要查看的数据
  1834. 参数:
  1835. const int nIndx 选中数据索引
  1836. SFolderInfo* m_pForder 文件夹
  1837. 返回:
  1838. 注意:
  1839. */
  1840. /************************************************************************/
  1841. CStringArray* ChooseDesignSkin::GetCurArray(const int nIndx)
  1842. {
  1843. CStringArray* pArray = NULL;
  1844. switch (nIndx)
  1845. {
  1846. case INDX_ALL: //全部
  1847. pArray = &m_AllPhotoPath;
  1848. break;
  1849. case INDX_SEL: //选中
  1850. pArray = &m_SelPhotoPath;
  1851. break;
  1852. case INDX_NOSEL: //未选
  1853. pArray = &m_NoSelPhotoPath;
  1854. break;
  1855. case INDX_DEL: //删除
  1856. pArray = &m_DelPhotoPath;
  1857. break;
  1858. case INDX_INTOALBUM: //入册
  1859. pArray = &m_IntoAlbumPath;
  1860. break;
  1861. case INDX_ENTRYPHASSE: //入底
  1862. pArray = &m_EntryPhasepath;
  1863. break;
  1864. }
  1865. return pArray;
  1866. }
  1867. /************************************************************************/
  1868. /*
  1869. 函数: SortArray
  1870. 描述: 按F4乱序或排序
  1871. 参数:
  1872. 返回:
  1873. */
  1874. /************************************************************************/
  1875. void ChooseDesignSkin::SortArray()
  1876. {
  1877. int i = 0;
  1878. int j = 0;
  1879. m_bSort = !m_bSort;
  1880. CStringArray *pArray[6] = { &m_AllPhotoPath, &m_SelPhotoPath, &m_NoSelPhotoPath, &m_DelPhotoPath, &m_IntoAlbumPath, &m_EntryPhasepath };
  1881. if (m_bSort == 0)
  1882. {
  1883. for ( i = 0; i < 6; i++)
  1884. {
  1885. if (pArray[i]->GetSize())
  1886. {
  1887. int size = pArray[i]->GetSize() - 1;
  1888. CString sTemp;
  1889. int nPos;
  1890. for (int ii = 0; ii < size; ii++)
  1891. {
  1892. nPos = rand() % (size - ii);
  1893. sTemp = pArray[i]->ElementAt(size - ii);
  1894. pArray[i]->SetAt(size - ii, pArray[i]->ElementAt(nPos));
  1895. pArray[i]->SetAt(nPos, sTemp);
  1896. }
  1897. }
  1898. }
  1899. }
  1900. else
  1901. { // 使用CCombobox的Sort来排序;
  1902. for ( i = 0; i < 6; i++)
  1903. {
  1904. m_combo1.ResetContent();
  1905. CString Temp;
  1906. for ( j = 0; j < pArray[i]->GetSize(); j++)
  1907. {
  1908. m_combo1.AddString(pArray[i]->ElementAt(j));
  1909. }
  1910. for (j = 0; j < pArray[i]->GetSize(); j++)
  1911. {
  1912. m_combo1.GetLBText(j, Temp);
  1913. pArray[i]->SetAt(j, Temp);
  1914. }
  1915. }
  1916. }
  1917. //终止线程
  1918. TerminateThread();
  1919. //清除资源的路径
  1920. ClearResData();
  1921. //获取当前查看的相片
  1922. CStringArray *pArr = GetCurArray(m_SelectCategory);
  1923. if(pArr == NULL)
  1924. return;
  1925. for ( i = 0; i < pArr->GetSize(); i++)
  1926. {
  1927. SResData* pRes = new SResData();
  1928. pRes->nType = (int)TYPE_ICON;
  1929. CString filePath = pArr->ElementAt(i);
  1930. //转为小写
  1931. filePath.MakeLower();
  1932. pRes->strFilePath = filePath;
  1933. m_vResData.push_back(pRes);
  1934. }
  1935. //创建绘画线程LoadThumbNail3
  1936. LoadThumbImages();
  1937. }
  1938. /*-------------------------------------------------------
  1939. 函数名: DrawInterface
  1940. 描述: 绘制界面
  1941. 参数:
  1942. 返回值:
  1943. -------------------------------------------------------*/
  1944. void ChooseDesignSkin::DrawInterface()
  1945. {
  1946. CRect rc(0, 0, 0, 0), rt(0, 0, 0, 0);
  1947. ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
  1948. ScreenToClient(rc);
  1949. int nH = rc.bottom - rc.top;
  1950. rc.right -= (rc.left + 100);
  1951. rc.left = 5;
  1952. rc.top += 10;
  1953. rc.right += 220;
  1954. rc.bottom = rc.top + nH - 10;
  1955. rt.CopyRect(&rc);
  1956. CDC *pDC = GetDC();
  1957. Graphics graph(pDC->GetSafeHdc());
  1958. Rect destinationRect(rc.left, rc.top, rc.Width(), rc.Height());
  1959. RectF layoutRect(rc.left, rc.top, rc.Width(), rc.Height());
  1960. rc.left /= g_fscalex;
  1961. rc.right /= g_fscalex;
  1962. rc.top /= g_fscaley;
  1963. rc.bottom /= g_fscaley;
  1964. // graph.SetSmoothingMode(SmoothingModeHighQuality);
  1965. graph.DrawImage(m_pBk, destinationRect, rc.left, rc.top, rc.Width(), rc.Height(), UnitPixel);
  1966. StringFormat format;
  1967. format.SetAlignment(StringAlignmentNear);
  1968. SolidBrush *Brush = new SolidBrush(Color(255, 255, 255, 255));
  1969. //显示张数
  1970. CString str = _T("");
  1971. str.Format(_T("张数:%d"), m_List1.GetItemCount());
  1972. int leng = GetLengthEx(str);
  1973. BSTR bstr = str.AllocSysString();
  1974. Gdiplus::Font* pFont = new Gdiplus::Font(L"黑体", 11);
  1975. graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
  1976. graph.DrawString(
  1977. bstr,
  1978. leng,
  1979. pFont,
  1980. layoutRect,
  1981. &format,
  1982. Brush);
  1983. SysFreeString(bstr);
  1984. delete Brush;
  1985. delete pFont;
  1986. ReleaseDC(pDC);
  1987. }
  1988. CString ChooseDesignSkin::GetZSInfo(int iItem)
  1989. {
  1990. if (m_SelectCategory != INDX_SEL)
  1991. CalChooseZS(GetCurArray(INDX_SEL), GetCurArray(INDX_ALL));
  1992. CString str = _T("");
  1993. CString scount = m_List1.GetItemText(iItem, 0);
  1994. int ncount = 0;
  1995. int npos = scount.Find(_T("\r\n"));
  1996. while (npos != -1)
  1997. {
  1998. ncount++;
  1999. scount = scount.Right(scount.GetLength() - npos - 2);
  2000. npos = scount.Find(_T("\r\n"));
  2001. }
  2002. CString zs = m_taoxizs;
  2003. int pos = zs.Find("\\");
  2004. if (pos != -1)
  2005. zs = zs.Left(pos);
  2006. str.Format(_T("X:%d"), ncount);
  2007. return str;
  2008. }
  2009. /************************************************************************/
  2010. /*
  2011. 函数: GetPathAddToSel
  2012. 描述: 获取路径添加到选中相片
  2013. 参数:
  2014. strName:dindansp表中no或no2字段值;相片名间使用逗号分隔;
  2015. 返回: 1成功,0失败
  2016. */
  2017. /************************************************************************/
  2018. int ChooseDesignSkin::GetPathAddToSel(const CString& strName)
  2019. {
  2020. if(strName == _T(""))
  2021. return 0;
  2022. CStringArray* pSelArr = NULL;
  2023. CStringArray* pAllArr = NULL;
  2024. pSelArr = GetCurArray(INDX_SEL);
  2025. pAllArr = GetCurArray(INDX_ALL);
  2026. GetPathAddToSel(pSelArr, strName, pAllArr);
  2027. return 1;
  2028. }
  2029. /************************************************************************/
  2030. /*
  2031. 函数: GetPathAddToSel
  2032. 描述: 获取路径添加到选中相片
  2033. 参数:
  2034. CStringArray* pSelArr
  2035. const CString& str
  2036. 返回: 1成功,0失败
  2037. */
  2038. /************************************************************************/
  2039. int ChooseDesignSkin::GetPathAddToSel(CStringArray* pSelArr, const CString& strName, CStringArray* pAllArr)
  2040. {
  2041. return ChoosePhotoBase::GetPathAddToSel(pSelArr, strName, pAllArr);
  2042. }
  2043. /************************************************************************/
  2044. /*
  2045. 函数: GetAlbumPhoto
  2046. 描述: 查看入册相片
  2047. 参数:
  2048. 返回:
  2049. */
  2050. /************************************************************************/
  2051. void ChooseDesignSkin::GetAlbumPhoto()
  2052. {
  2053. if (m_SelectCategory == INDX_INTOALBUM)
  2054. return;
  2055. m_SelectCategory = INDX_INTOALBUM;
  2056. CStringArray* pArr = NULL;
  2057. pArr = GetCurArray(m_SelectCategory);
  2058. pArr->RemoveAll();
  2059. CString photosName = _T("");
  2060. int i = 0;
  2061. for (i= 0; i < m_List3.GetItemCount(); i++)
  2062. {
  2063. if (m_List3.GetItemText(i, 2) != _T("入册"))
  2064. continue;
  2065. photosName = m_no2array.ElementAt(i);
  2066. break;
  2067. }
  2068. CStringArray* pAllArry = NULL;
  2069. pAllArry = GetCurArray(INDX_ALL);
  2070. //将入册的相片名
  2071. #ifdef USE_SEP_VEB
  2072. photosName = SEPS_VEB + photosName + SEPS_VEB;
  2073. #else
  2074. photosName = SEPS_CMA + photosName + SEPS_CMA;
  2075. #endif //#ifdef USE_SEP_VEB
  2076. for (i = pAllArry->GetSize() - 1; i >= 0; i--)
  2077. {
  2078. CString strName = _T("");
  2079. strName = pAllArry->ElementAt(i);
  2080. strName = strName.Right(strName.GetLength() - strName.ReverseFind('\\') - 1);
  2081. strName = strName.Left(strName.Find('.'));
  2082. #ifdef USE_SEP_VEB
  2083. strName = SEPS_VEB + strName + SEPS_VEB;
  2084. #else
  2085. strName = SEPS_CMA + strName + SEPS_CMA;
  2086. #endif //#ifdef USE_SEP_VEB
  2087. if (photosName.Find(strName) != -1)
  2088. {
  2089. strName = pAllArry->ElementAt(i);
  2090. pArr->Add(strName);
  2091. }
  2092. }
  2093. }
  2094. /************************************************************************/
  2095. /*
  2096. 函数: GetDiskPhoto
  2097. 描述: 查看入底相片
  2098. 参数:
  2099. 返回:
  2100. */
  2101. /************************************************************************/
  2102. void ChooseDesignSkin::GetDiskPhoto()
  2103. {
  2104. if (m_SelectCategory == INDX_ENTRYPHASSE)
  2105. return;
  2106. m_SelectCategory = INDX_ENTRYPHASSE;
  2107. CStringArray* pArr = NULL;
  2108. pArr = GetCurArray(m_SelectCategory);
  2109. int i = 0;
  2110. pArr->RemoveAll();
  2111. CString photosName = _T("");
  2112. for ( i = 0; i < m_List3.GetItemCount(); i++)
  2113. {
  2114. if (m_List3.GetItemText(i, 2) != _T("入底"))
  2115. continue;
  2116. photosName = m_no2array.ElementAt(i);
  2117. break;
  2118. }
  2119. CStringArray* pAllArry = NULL;
  2120. pAllArry = GetCurArray(INDX_ALL);
  2121. #ifdef USE_SEP_VEB
  2122. photosName = SEPS_VEB + photosName + SEPS_VEB;
  2123. #else
  2124. photosName = SEPS_CMA + photosName + SEPS_CMA;
  2125. #endif //#ifdef USE_SEP_VEB
  2126. for (i = pAllArry->GetSize() - 1; i >= 0; i--)
  2127. {
  2128. CString strName = _T("");
  2129. strName = pAllArry->ElementAt(i);
  2130. strName = strName.Right(strName.GetLength() - strName.ReverseFind('\\') - 1);
  2131. strName = strName.Left(strName.Find('.'));
  2132. #ifdef USE_SEP_VEB
  2133. strName = SEPS_VEB + strName + SEPS_VEB;
  2134. #else
  2135. strName = SEPS_CMA + strName + SEPS_CMA;
  2136. #endif //#ifdef USE_SEP_VEB
  2137. if (photosName.Find(strName) != -1)
  2138. {
  2139. strName = pAllArry->ElementAt(i);
  2140. pArr->Add(strName);
  2141. }
  2142. }
  2143. }
  2144. /************************************************************************/
  2145. /*
  2146. 函数名: ReLoad
  2147. 描述: 重新加载数据
  2148. 参数:
  2149. 返回值:
  2150. */
  2151. /************************************************************************/
  2152. BOOL ChooseDesignSkin::ReLoad()
  2153. {
  2154. return GetData();
  2155. }
  2156. /************************************************************************/
  2157. /*
  2158. 函数: ReLoadPhoto
  2159. 描述: 重新加载相片
  2160. 参数:
  2161. 返回:
  2162. */
  2163. /************************************************************************/
  2164. void ChooseDesignSkin::ReLoadPhoto()
  2165. {
  2166. if (!((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
  2167. {
  2168. m_path = g_path3 + _T("\\");
  2169. m_path += m_strOrderNumber;
  2170. m_path += _T("\\");
  2171. GetPhotos();
  2172. m_bChooseBig = 0;
  2173. }
  2174. else
  2175. {
  2176. m_bChooseBig = 1;
  2177. //选择此次拍摄名称DLG(如:拍摄景点)
  2178. GetTXName(&m_strOrderNumber, 1, m_bGrowthTX, m_seltxname);
  2179. m_AllPhotoPath.RemoveAll();
  2180. if (IsThereACacheImg()) //
  2181. m_bFromLocal = 1;
  2182. if (m_AllPhotoPath.GetSize() == 0)
  2183. {
  2184. if (IsPhoto2Exist())
  2185. {
  2186. SelBrunDevice dlg;
  2187. dlg.m_mode = 0;
  2188. if (dlg.DoModal() == IDOK)
  2189. m_nChoosePhotoType = dlg.m_sel;
  2190. else
  2191. m_nChoosePhotoType = 0;
  2192. //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
  2193. }
  2194. else
  2195. AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
  2196. {
  2197. CString path, path2;
  2198. m_path = g_path1 + _T("\\");
  2199. m_path += m_strOrderNumber;
  2200. m_path += _T("\\");
  2201. if (m_seltxname != "" && m_seltxname != _T("全部"))
  2202. {
  2203. m_path += m_seltxname;
  2204. m_path += _T("\\");
  2205. }
  2206. if (m_nChoosePhotoType == 1) // 选片:修片
  2207. {
  2208. m_path = g_path2 + _T("\\");
  2209. m_path += m_strOrderNumber;
  2210. m_path += _T("\\");
  2211. }
  2212. CString filename = _T("");
  2213. ffsco o;
  2214. o.dirs(1);
  2215. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  2216. ffsco::typeT coo;
  2217. ffsco::typeT::iterator it;
  2218. coo = o.co_file();
  2219. for (it = coo.begin(); coo.end() != it; it++)
  2220. {
  2221. path = (*it).c_str();
  2222. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  2223. {
  2224. path.MakeLower();
  2225. filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  2226. if (filename.Find(".") != -1)
  2227. filename = filename.Left(filename.Find("."));
  2228. if (!myisdigit(filename))continue;
  2229. if (m_nChoosePhotoType == 1)
  2230. {
  2231. #if JEFF_TEST_ON
  2232. if (PathFileExists(path))
  2233. m_AllPhotoPath.Add(path);
  2234. #else
  2235. m_AllPhotoPath.Add(path);
  2236. #endif //#if JEFF_TEST_ON
  2237. }
  2238. else
  2239. {
  2240. path2 = path;
  2241. if (m_nChoosePhotoType == 0)
  2242. path2.Replace("客户原片", "修好的片");
  2243. if (m_bGrowthTX == 0)
  2244. {
  2245. int pos = path2.Find(m_strOrderNumber);
  2246. pos += m_strOrderNumber.GetLength();
  2247. int pos2 = path2.ReverseFind('\\');
  2248. path2 = path2.Left(pos) + path2.Right(path2.GetLength() - pos2);
  2249. }
  2250. if (m_nChoosePhotoType == 0 && ::PathFileExists(path2))
  2251. {
  2252. m_AllPhotoPath.Add(path2);
  2253. }
  2254. else
  2255. {
  2256. path2.Replace(".raw", _T(".jpg"));
  2257. if (PathFileExists(path2))
  2258. {
  2259. m_AllPhotoPath.Add(path2);
  2260. continue;
  2261. }
  2262. path2.Replace(".nef", _T(".jpg"));
  2263. if (PathFileExists(path2))
  2264. {
  2265. m_AllPhotoPath.Add(path2);
  2266. continue;
  2267. }
  2268. path2.Replace(".cr2", _T(".jpg"));
  2269. if (PathFileExists(path2))
  2270. {
  2271. m_AllPhotoPath.Add(path2);
  2272. continue;
  2273. }
  2274. else
  2275. {
  2276. if (path.Right(3) != "jpg")
  2277. continue;
  2278. #if JEFF_TEST_ON
  2279. if (PathFileExists(path))
  2280. m_AllPhotoPath.Add(path);
  2281. #else
  2282. m_AllPhotoPath.Add(path);
  2283. #endif //#if JEFF_TEST_ON
  2284. }
  2285. }
  2286. }
  2287. }
  2288. }
  2289. }
  2290. // if(0)
  2291. {//多种修好的效果
  2292. CString path, path2;
  2293. path2 = g_path2 + _T("\\");
  2294. path2 += m_strOrderNumber;
  2295. path2 += _T("\\");
  2296. ffsco o;
  2297. o.dirs(0);
  2298. o.find(LPCSTR(path2), LPCSTR("*.jpg"));
  2299. ffsco::typeT coo;
  2300. ffsco::typeT::iterator it;
  2301. coo = o.co_file();
  2302. for (it = coo.begin(); coo.end() != it; it++)
  2303. {
  2304. path = (*it).c_str();
  2305. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  2306. {
  2307. path.MakeLower();
  2308. path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  2309. if (path2.Find(_T("-")) != -1)
  2310. {
  2311. #if JEFF_TEST_ON
  2312. if (PathFileExists(path))
  2313. m_AllPhotoPath.Add(path);
  2314. #else
  2315. m_AllPhotoPath.Add(path);
  2316. #endif //#if JEFF_TEST_ON
  2317. }
  2318. }
  2319. }
  2320. }
  2321. }
  2322. if (m_AllPhotoPath.GetSize() && atoi(g_cominfoarray.ElementAt(0).ElementAt(61)))
  2323. {
  2324. int size = m_AllPhotoPath.GetSize() - 1;
  2325. CString sTemp;
  2326. int nPos;
  2327. for (int i = 0; i < size; i++)
  2328. {
  2329. nPos = rand() % (size - i);
  2330. sTemp = m_AllPhotoPath.ElementAt(size - i);
  2331. m_AllPhotoPath.SetAt(size - i, m_AllPhotoPath.ElementAt(nPos));
  2332. m_AllPhotoPath.SetAt(nPos, sTemp);
  2333. }
  2334. }
  2335. }
  2336. m_SelectCategory = INDX_ALL;
  2337. LoadPhotos();
  2338. }
  2339. /************************************************************************/
  2340. /*
  2341. 函数: DrawImageWork
  2342. 描述: 绘制工作
  2343. 参数:
  2344. 返回:
  2345. */
  2346. /************************************************************************/
  2347. void ChooseDesignSkin::DrawImageWork()
  2348. {
  2349. CListCtrl* ListCtrl = &m_List1;
  2350. CImageList* pImgList = &m_ImageListThumb;
  2351. try
  2352. {
  2353. // reset our image list
  2354. for (int i = 0; i < pImgList->GetImageCount(); i++)
  2355. pImgList->Remove(i);
  2356. // remove all items from list view
  2357. ListCtrl->DeleteAllItems();
  2358. pImgList->SetImageCount(m_vResData.size());
  2359. // Set redraw to FALSE to avoid flickering during adding new items
  2360. ListCtrl->SetRedraw(FALSE);
  2361. //添加列表项名
  2362. AddListItemName(ListCtrl);
  2363. //设置重绘并刷新
  2364. ListCtrl->SetRedraw(TRUE);
  2365. ListCtrl->Invalidate();
  2366. //绘制图标
  2367. DrawImage(ListCtrl, pImgList);
  2368. m_bRunning = false;
  2369. m_bTerminate = false;
  2370. PostMessage(WM_USER + 200, 0, 0);
  2371. return;
  2372. }
  2373. catch (...)
  2374. {
  2375. ListCtrl->Invalidate();
  2376. m_bRunning = false;
  2377. m_bTerminate = false;
  2378. PostMessage(WM_USER + 200, 0, 0);
  2379. }
  2380. }
  2381. /************************************************************************/
  2382. /*
  2383. 函数: AddListItemName
  2384. 描述: 添加列表项名
  2385. 参数:
  2386. 返回: 1成功,0失败
  2387. */
  2388. /************************************************************************/
  2389. int ChooseDesignSkin::AddListItemName(CListCtrl* pListCtrl)
  2390. {
  2391. if(pListCtrl == NULL)
  2392. return 0;
  2393. int nIndex = 0;
  2394. CString str(_T("")), spath(_T(""));
  2395. //添加文件名
  2396. vector<SResData*>::iterator iter;
  2397. for(iter = m_vResData.begin(); iter != m_vResData.end() && m_bTerminate != true; iter++, nIndex++)
  2398. {
  2399. SResData* pRes = (*iter);
  2400. if(pRes == NULL)
  2401. continue;
  2402. str = pRes->strFilePath;
  2403. if (str.Left(str.ReverseFind('\\') + 1) != m_path)
  2404. {
  2405. spath = str.Left(str.ReverseFind('\\') + 1);
  2406. spath = spath.Right(spath.GetLength() - m_path.GetLength());
  2407. }
  2408. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  2409. //添加名字
  2410. if (str.Find("delgabook") != -1)
  2411. {
  2412. str.TrimRight(_T("\\"));
  2413. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  2414. str.Replace("delgabook", "Flash");
  2415. pListCtrl->InsertItem(nIndex, str, nIndex);
  2416. }
  2417. else
  2418. {
  2419. str = spath + str.Left(str.GetLength() - 4);
  2420. CString temp = GetSelName(str);
  2421. pListCtrl->InsertItem(nIndex, str + temp, nIndex);
  2422. }
  2423. str.Empty();
  2424. spath.Empty();
  2425. }
  2426. return 1;
  2427. }
  2428. /************************************************************************/
  2429. /*
  2430. 函数: DrawImage
  2431. 描述: 绘制
  2432. 参数:
  2433. 返回:
  2434. */
  2435. /************************************************************************/
  2436. void ChooseDesignSkin::DrawImage(CListCtrl* pListCtrl, CImageList* pImgList)
  2437. {
  2438. if(pListCtrl == NULL)
  2439. return;
  2440. int nIndex = 0;
  2441. Image* pHideImg = NULL; //相片图标
  2442. CString str(_T("")), spath(_T(""));
  2443. vector<SResData*>::iterator iter;
  2444. for (iter = m_vResData.begin(); iter != m_vResData.end() && m_bTerminate != true; iter++, nIndex++)
  2445. {
  2446. // Load Image File
  2447. Image *image = NULL;
  2448. Bitmap *pBmp = NULL;
  2449. SResData* pRes = (*iter);
  2450. if(pRes == NULL)
  2451. continue;
  2452. BOOL bNullimg = FALSE;
  2453. //加载相片图标res\未标题-1.jpg
  2454. switch(pRes->nType)
  2455. {
  2456. case TYPE_ICON: //相片图标
  2457. {
  2458. if(m_bHide && pHideImg == NULL)
  2459. pHideImg = m_pHideImg;
  2460. //是否要重新加载资源
  2461. if(pHideImg == NULL)
  2462. {
  2463. ReLoadImageFromRes(&image, pRes->strFilePath, bNullimg);
  2464. if(image == NULL)
  2465. continue;
  2466. }
  2467. else
  2468. image = pHideImg;
  2469. }
  2470. break;
  2471. }
  2472. //创建bitmap使用颜色填充区域
  2473. SolidBrush whitebrush(Color(255, 255, 255, 255));
  2474. pBmp = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB);
  2475. Graphics graph2(pBmp);
  2476. graph2.Clear(Color(255, 192, 192, 192));
  2477. graph2.FillRectangle(&whitebrush, 1, 1, THUMBNAIL_WIDTH - 2, THUMBNAIL_HEIGHT - 2);
  2478. // 缩放图片符合画布大小
  2479. Rect desRect(0, 0, 0, 0);
  2480. ZoomImage(image, desRect);
  2481. // 绘制图标res\未标题-1.jpg
  2482. Graphics graph(pBmp);
  2483. graph.DrawImage(image, desRect, 0, 0, image->GetWidth(), image->GetHeight(), UnitPixel);
  2484. // 将图片替换bitmap添加到图标列表
  2485. CBitmap bitmap;
  2486. HBITMAP hbmp;
  2487. pBmp->GetHBITMAP(Color(255, 255, 255, 255), &hbmp);
  2488. bitmap.Attach(hbmp);
  2489. pImgList->Replace(nIndex, &bitmap, NULL);
  2490. if(pBmp)
  2491. delete pBmp;
  2492. // Redraw only a current item for removing flickering and fast speed.
  2493. pListCtrl->RedrawItems(nIndex, nIndex);
  2494. // Release used DC and Object
  2495. if(image && pRes->nType == TYPE_ICON && pHideImg == NULL)
  2496. delete image;
  2497. }
  2498. pListCtrl->Invalidate();
  2499. }