ChoosePhotoSkin2.cpp 109 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387
  1. // ChoosePhotoSkin2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ChoosePhotoSkin2.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. // ChoosePhotoSkin2 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. // ChoosePhotoSkin2 dialog IDC_EDITzs
  43. ChoosePhotoSkin2::ChoosePhotoSkin2(CWnd* pParent /*=NULL*/) : ChoosePhotoBase(ChoosePhotoSkin2::IDD, pParent)
  44. {
  45. m_time4 = g_date;
  46. g_pMainWnd->GetSkin();
  47. m_strStatusOfChoosePhoto = _T("未选");
  48. m_pCurrSelFolder = NULL;
  49. m_OpenFolder = NULL;
  50. m_pFolderImg = NULL;
  51. m_Runingmode = 0;
  52. m_bHide = atoi(g_cominfoarray.ElementAt(0).ElementAt(59));
  53. }
  54. ChoosePhotoSkin2::ChoosePhotoSkin2(DWORD id, CWnd* pParent) : ChoosePhotoBase(id, pParent)
  55. {
  56. m_time4 = g_date;
  57. g_pMainWnd->GetSkin();
  58. m_strStatusOfChoosePhoto = _T("未选");
  59. m_pCurrSelFolder = NULL;
  60. m_OpenFolder = NULL;
  61. m_pFolderImg = NULL;
  62. m_Runingmode = 0;
  63. m_bHide = atoi(g_cominfoarray.ElementAt(0).ElementAt(59));
  64. }
  65. void ChoosePhotoSkin2::DoDataExchange(CDataExchange* pDX)
  66. {
  67. CDialog::DoDataExchange(pDX);
  68. //{{AFX_DATA_MAP(ChoosePhotoSkin2)
  69. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  70. DDX_Control(pDX, IDC_LIST3, m_List3);
  71. DDX_Control(pDX, IDC_LIST2, m_List2);
  72. DDX_Control(pDX, IDC_LIST1, m_List1);
  73. DDX_Text(pDX, IDC_EDITname1, m_name1);
  74. DDX_Text(pDX, IDC_EDITname2, m_name2);
  75. DDX_Text(pDX, IDC_EDITtime4, m_time4);
  76. DDX_Text(pDX, IDC_EDITwaiter3, m_waiter3);
  77. DDX_Text(pDX, IDC_EDITzs, m_takezs);
  78. DDX_Text(pDX, IDC_EDITzs2, m_taoxizs);
  79. DDX_Text(pDX, IDC_EDITzs3, m_choosezs);
  80. DDX_Text(pDX, IDC_EDITmoney3, m_money3);
  81. DDX_Text(pDX, IDC_EDITid, m_strOrderNumber);
  82. DDX_Text(pDX, IDC_EDITbz3, m_bz3);
  83. //}}AFX_DATA_MAP}
  84. }
  85. BEGIN_MESSAGE_MAP(ChoosePhotoSkin2, CDialog)
  86. //{{AFX_MSG_MAP(ChoosePhotoSkin2)
  87. ON_WM_PAINT()
  88. ON_WM_DESTROY()
  89. ON_WM_ERASEBKGND()
  90. ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
  91. ON_WM_CLOSE()
  92. ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnRclickList1)
  93. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  94. ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
  95. ON_WM_TIMER()
  96. //}}AFX_MSG_MAP
  97. ON_MESSAGE(WM_USER + 1101, OnBtnClick)
  98. ON_COMMAND_RANGE(IDM_MENUsp1 - 1, IDM_MENUsp1 + 200, OnCommandMenu)
  99. ON_COMMAND(IDM_NEWFOLDER, OnNewFolder)
  100. ON_COMMAND(IDM_DELFOLDER, OnDelFolder)
  101. ON_COMMAND(IDM_OPENFOLDER, OnOpenFolder)
  102. ON_COMMAND(IDM_RETURNMAINDIR, OnReturnMainDir)
  103. ON_MESSAGE(WM_USER + 200, UpdateTakeZS)
  104. END_MESSAGE_MAP()
  105. /////////////////////////////////////////////////////////////////////////////
  106. // ChoosePhotoSkin2 message handlers
  107. BOOL ChoosePhotoSkin2::OnInitDialog() //初始化选片*看设计
  108. {
  109. ChoosePhotoBase::OnInitDialog();
  110. //加载相片和文件夹icon;
  111. LoadImageFromRes(&m_pHideImg, MAKEINTRESOURCE(IDR_JPG5), _T("JPG"));
  112. if(m_pHideImg == NULL)
  113. {
  114. MessageBox(_T("加载图标失败"));
  115. return FALSE;
  116. }
  117. LoadImageFromRes(&m_pFolderImg, MAKEINTRESOURCE(IDR_JPG14), _T("JPG"));
  118. if(m_pFolderImg == NULL)
  119. {
  120. MessageBox(_T("加载图标失败"));
  121. return FALSE;
  122. }
  123. // 1.加载lia皮肤信息;
  124. g_bInSkin = 1;
  125. m_ticks = ::GetTickCount();
  126. if (g_cursorhand == NULL)
  127. g_cursorhand = AfxGetApp()->LoadCursor(IDC_CURSORHAND);
  128. BYTE *pData = NULL;
  129. BYTE *pDataBegin;
  130. //printf("Jeff:loadLia路径:%s\n\n",g_mainpath+"\\skin\\"+m_liapath);//Jeff Printf;
  131. if (!LoadLia(g_mainpath + _T("\\skin\\") + m_liapath, &pData, &pDataBegin, &m_pBk, m_hWnd))
  132. {
  133. EndDialog(0);
  134. return false;
  135. }
  136. //初始化按钮和位置
  137. //printf("Jeff:g_resdata2.nPicCount=%d\n\n",g_resdata2.nPicCount); // Jeff Printf,这个nPicCount好像一直是15;
  138. for (int i = 0; i < g_resdata2.nPicCount; i++)
  139. {
  140. g_resdata2.rect[i].left *= g_fscalex;
  141. g_resdata2.rect[i].right *= g_fscalex;
  142. g_resdata2.rect[i].top *= g_fscaley;
  143. g_resdata2.rect[i].bottom *= g_fscaley;
  144. if (i == 8)
  145. g_resdata2.rect[i] = g_resdata2.rect[2];
  146. else if (i == 9)
  147. g_resdata2.rect[i] = g_resdata2.rect[3];
  148. else if (i == 10)
  149. g_resdata2.rect[i] = g_resdata2.rect[1];
  150. if (g_resdata2.nPicBmpCount[i])
  151. {
  152. MyBmpButton2 *pic = new MyBmpButton2;
  153. m_picarray.Add((DWORD)pic);
  154. CRect rc = g_resdata2.rect[i];
  155. CString str;
  156. str.Format(_T("%d"), i + 1);
  157. pic->Create(str, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, rc, this, i + 100);
  158. pic->m_bmpcount = g_resdata2.nPicBmpCount[i];
  159. pic->ReadBmp(&pData, NULL, this);
  160. #ifdef SZWNS_VERSION//深圳维纳斯
  161. if(i==3 && m_mode2==0)
  162. {
  163. Image *img=NULL;
  164. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG6), _T("JPG"));
  165. delete pic->m_bmp;
  166. pic->m_bmp=img->Clone();
  167. delete img;
  168. img=NULL;
  169. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG7), _T("JPG"));
  170. delete pic->m_bmpfocus;
  171. pic->m_bmpfocus=img->Clone();
  172. delete img;
  173. img=NULL;
  174. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG8), _T("JPG"));
  175. delete pic->m_bmpfocused;
  176. pic->m_bmpfocused=img->Clone();
  177. delete img;
  178. }
  179. #endif//SZWNS_VERSION
  180. }
  181. else
  182. m_picarray.Add(NULL);
  183. m_rcarray.Add(g_resdata2.rect[i]);
  184. }
  185. delete[]pDataBegin;
  186. //初始化按钮位置;
  187. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
  188. {
  189. ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
  190. CRect rc, rc2;
  191. ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
  192. ((MyBmpButton2*)m_picarray.ElementAt(1))->GetWindowRect(rc2);
  193. int dtx = rc.right - rc2.right;
  194. ScreenToClient(rc2);
  195. rc2.left += dtx;
  196. rc2.right += dtx;
  197. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  198. ((MyBmpButton2*)m_picarray.ElementAt(0))->GetWindowRect(rc2);
  199. ScreenToClient(rc2);
  200. rc2.left += dtx;
  201. rc2.right += dtx;
  202. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  203. }
  204. if (1)//m_mode2==0)
  205. {
  206. ((MyBmpButton2*)m_picarray.ElementAt(7))->ShowWindow(SW_HIDE);
  207. ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_HIDE);
  208. ((MyBmpButton2*)m_picarray.ElementAt(9))->ShowWindow(SW_HIDE);
  209. ((MyBmpButton2*)m_picarray.ElementAt(10))->ShowWindow(SW_HIDE);
  210. ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
  211. }
  212. else
  213. {
  214. ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
  215. ((MyBmpButton2*)m_picarray.ElementAt(0))->ShowWindow(SW_HIDE);
  216. ((MyBmpButton2*)m_picarray.ElementAt(1))->ShowWindow(SW_HIDE);
  217. ((MyBmpButton2*)m_picarray.ElementAt(2))->ShowWindow(SW_HIDE);
  218. ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
  219. ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
  220. if (IsHasRights2new(37) == 0)
  221. {
  222. ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_HIDE);
  223. ((MyBmpButton2*)m_picarray.ElementAt(9))->ShowWindow(SW_HIDE);
  224. }
  225. }
  226. {
  227. CRect rc, rc2;
  228. ((MyBmpButton2*)m_picarray.ElementAt(5))->GetWindowRect(rc);
  229. ((MyBmpButton2*)m_picarray.ElementAt(4))->GetWindowRect(rc2);
  230. int dtx = rc.right - rc2.right;
  231. rc2 = rc;
  232. // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
  233. {
  234. float scale = 0.9;
  235. dtx *= scale;
  236. int wid = rc2.Width()*scale;
  237. int hei = rc2.Height()*scale;
  238. int dty = rc2.Height() - hei;
  239. dty /= 2;
  240. rc2.left = rc2.right - wid;
  241. rc2.top += dty;
  242. rc2.bottom = rc2.top + hei;
  243. }
  244. ScreenToClient(rc2);
  245. ((MyBmpButton2*)m_picarray.ElementAt(5))->MoveWindow(rc2);
  246. rc2.left -= dtx;
  247. rc2.right -= dtx;
  248. ((MyBmpButton2*)m_picarray.ElementAt(4))->MoveWindow(rc2);
  249. rc2.left -= dtx;
  250. rc2.right -= dtx;
  251. ((MyBmpButton2*)m_picarray.ElementAt(14))->MoveWindow(rc2);
  252. rc2.left -= dtx;
  253. rc2.right -= dtx;
  254. ((MyBmpButton2*)m_picarray.ElementAt(2))->MoveWindow(rc2);
  255. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)) == 0)
  256. {
  257. rc2.left -= dtx;
  258. rc2.right -= dtx;
  259. ((MyBmpButton2*)m_picarray.ElementAt(3))->MoveWindow(rc2);
  260. }
  261. rc2.left -= dtx;
  262. rc2.right -= dtx;
  263. ((MyBmpButton2*)m_picarray.ElementAt(12))->MoveWindow(rc2);
  264. rc2.left -= dtx;
  265. rc2.right -= dtx;
  266. ((MyBmpButton2*)m_picarray.ElementAt(13))->MoveWindow(rc2);
  267. rc2.left -= dtx;
  268. rc2.right -= dtx;
  269. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  270. rc2.left -= dtx;
  271. rc2.right -= dtx;
  272. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  273. }
  274. #ifndef MNLS_VERSION//mnls
  275. ((MyBmpButton2*)m_picarray.ElementAt(7))->ShowWindow(SW_HIDE);
  276. ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
  277. Graphics graph(m_pBk);
  278. Image *img = NULL;
  279. ::LoadImageFromBuf(&img, g_mainpath + _T("\\图片\\标题-选片.jpg"));
  280. if (img)
  281. {
  282. if (img->GetWidth() == 2000)
  283. {
  284. graph.SetSmoothingMode(SmoothingModeHighQuality);
  285. graph.DrawImage(img, 0, 0);
  286. }
  287. delete img;
  288. }
  289. #endif//MNLS_VERSION
  290. //初始化列表位置;
  291. CRect listrc = m_rcarray.ElementAt(6);
  292. {
  293. CRect rc;
  294. GetClientRect(rc);
  295. rc.top = listrc.top;
  296. m_List1.MoveWindow(rc);
  297. }
  298. //创建图标列表控件;
  299. m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
  300. m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
  301. m_List2.InitStyle();
  302. m_List2.InsertColumn(0, _T("编号"), LVCFMT_LEFT, 45);
  303. m_List2.InsertColumn(1, _T("商品名称"), LVCFMT_LEFT, 150);
  304. m_List2.InsertColumn(2, _T("数量"), LVCFMT_LEFT, 45);
  305. m_List3.InitStyle();
  306. m_List3.InsertColumn(0, _T("autoid"), LVCFMT_LEFT, 0);
  307. m_List3.InsertColumn(1, _T("编号"), LVCFMT_LEFT, 45);
  308. m_List3.InsertColumn(2, _T("商品名称"), LVCFMT_LEFT, 150);
  309. m_List3.InsertColumn(3, _T("价格"), LVCFMT_LEFT, 45);
  310. m_List3.InsertColumn(4, _T("数量"), LVCFMT_LEFT, 45);
  311. #ifdef LKAY_VERSION
  312. m_List3.InsertColumn(5,_T("P数"),LVCFMT_LEFT,55);
  313. m_List3.InsertColumn(6,_T("张数"),LVCFMT_LEFT,55);
  314. m_List3.InsertColumn(7,_T("照片编号"),LVCFMT_LEFT,365);
  315. #else
  316. m_List3.InsertColumn(5, _T("照片编号"), LVCFMT_LEFT, 365);
  317. // 2015.11.13 保存列表添加多一列商品备注选项;
  318. m_List3.InsertColumn(6, _T("备注"), LVCFMT_LEFT, 300);
  319. #endif//LKAY_VERSION
  320. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  321. // 以上均为界面布局;
  322. // 下面的代码才是数据处理;
  323. CString path, str;
  324. {
  325. #if USE_SHARE_FLORD
  326. LoadSelectPhotos();
  327. #else
  328. //选择此次拍摄名称DLG(如:拍摄景点)
  329. GetTXName(&m_strOrderNumber, 1, m_bGrowthTX, m_seltxname);
  330. // HC:缓存,checkHC检查在本机是否存在缓存的相片;
  331. if (IsThereACacheImg()) // (一般返回0)这一步是查看C:\WINDOWS\System32\有没有lyfz的文件夹,以及该文件夹下是否有订单号文件夹和相片;
  332. m_bFromLocal = 1;
  333. //printf("Jeff:m_AllPhotoPath.GetSize()=%d\n\n",m_AllPhotoPath.GetSize());// Jeff Printf;
  334. if (m_AllPhotoPath.GetSize() == 0) // m_AllPhotoPath:查看全部相片.
  335. {
  336. if (IsPhoto2Exist())//如果订单文件夹存在;
  337. {
  338. SelBrunDevice dlg;
  339. dlg.m_mode = 0;
  340. if (dlg.DoModal() == IDOK) // m_nChoosePhotoType =0:修片; =1原片 =2:原片+修片
  341. m_nChoosePhotoType = dlg.m_sel;
  342. else
  343. m_nChoosePhotoType = 1;
  344. }
  345. else AfxMessageBox(_T("温馨提示:\r\n未找到初修片,将使用原片选片"), MB_ICONINFORMATION);
  346. CString path2 = _T("");
  347. m_path = g_path1 + _T("\\");
  348. m_path += m_strOrderNumber;
  349. m_path += _T("\\");
  350. if(!IsShareFolderExist(m_path))
  351. AfxMessageBox(_T("温馨提示:\r\n未找到") + m_path, MB_ICONINFORMATION);
  352. if (m_seltxname != "" && m_seltxname != _T("全部"))
  353. {
  354. m_path += m_seltxname;
  355. m_path += _T("\\");
  356. }
  357. if (m_nChoosePhotoType == 1) // 选片:选择修片文件夹;
  358. {
  359. m_path = g_path2 + _T("\\");
  360. m_path += m_strOrderNumber;
  361. m_path += _T("\\");
  362. if(!IsShareFolderExist(m_path))
  363. AfxMessageBox(_T("温馨提示:\r\n未找到") + m_path, MB_ICONINFORMATION);
  364. #if JEFF_TEST_ON // 成长套系选择修好的片时需要; [3/25/2015 lyfz]
  365. if (m_seltxname != "" && m_seltxname != _T("全部"))
  366. {
  367. m_path += m_seltxname;
  368. m_path += _T("\\");
  369. }
  370. #endif//JEFF_TEST_ON
  371. }
  372. //获取所有相片
  373. GetAllPhotoPath(m_path, m_AllPhotoPath);
  374. if (m_nChoosePhotoType != 2) // Jeff:如果不是只查看原片 ,只有初修片里才有多种效果;
  375. //if (m_nChoosePhotoType != 0) // Jeff:如果不是只查看原片;
  376. {//多种修好的效果
  377. CString path2;
  378. path2 = g_path2 + _T("\\");
  379. path2 += m_strOrderNumber;
  380. path2 += _T("\\"); //printf("Jeff:****paht2=%s\n\n",path2);//Jeff Printf;path2="修好的片"
  381. ffsco o;
  382. o.dirs(0);
  383. o.find(LPCSTR(path2), LPCSTR("*.jpg"));
  384. ffsco::typeT coo;
  385. ffsco::typeT::iterator it;
  386. coo = o.co_file();
  387. for (it = coo.begin(); coo.end() != it; it++)
  388. {
  389. path = (*it).c_str();
  390. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  391. {
  392. path.MakeLower();
  393. path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  394. if (path2.Find(_T("-")) != -1)
  395. {
  396. #if JEFF_TEST_ON
  397. if(PathFileExists(path))
  398. m_AllPhotoPath.Add(path);
  399. #else
  400. m_AllPhotoPath.Add(path);
  401. #endif//JEFF_TEST_ON
  402. }
  403. }
  404. }
  405. }
  406. }
  407. #endif//USE_SHARE_FLORD
  408. if (m_AllPhotoPath.GetSize() && atoi(g_cominfoarray.ElementAt(0).ElementAt(61)))
  409. {
  410. int size = m_AllPhotoPath.GetSize() - 1;
  411. CString sTemp;
  412. int nPos;
  413. for (int i = 0; i < size; i++)
  414. {
  415. nPos = rand() % (size - i);
  416. sTemp = m_AllPhotoPath.ElementAt(size - i);
  417. m_AllPhotoPath.SetAt(size - i, m_AllPhotoPath.ElementAt(nPos));
  418. m_AllPhotoPath.SetAt(nPos, sTemp);
  419. }
  420. }
  421. }
  422. // 开始选片;读取数据;
  423. GetData();
  424. //是否已选过;
  425. if (m_checkstatus == "OK")
  426. {
  427. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(85)) && IsHasRights2new(20) == 0)
  428. {
  429. Login2 dlg;
  430. if (dlg.DoModal() != IDOK)
  431. {
  432. MyBmpButton2 *btn = ((MyBmpButton2*)m_picarray.ElementAt(4));
  433. btn->m_bmpdisable = btn->m_bmp->Clone();
  434. Graphics graph(btn->m_bmpdisable);
  435. CPoint pt1, pt2, pt3;
  436. pt1.x = 0;
  437. pt1.y = 0;
  438. pt2.x = btn->m_bmp->GetWidth();
  439. pt2.y = 0;
  440. pt3.x = 0;
  441. pt3.y = btn->m_bmp->GetHeight();
  442. //目标位置
  443. Point destinationPoints[] = {
  444. Point(pt1.x, pt1.y), // destination for upper-left point of original
  445. Point(pt2.x, pt2.y), // destination for upper-right point of original
  446. Point(pt3.x, pt3.y) }; // destination for lower-left point of original
  447. //颜色
  448. ColorMatrix colorMatrix = \
  449. {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  450. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  451. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  452. 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
  453. 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
  454. ImageAttributes imageAtt;
  455. imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
  456. graph.DrawImage(btn->m_bmp,
  457. destinationPoints,
  458. 3,
  459. 0,
  460. 0,
  461. btn->m_bmp->GetWidth(),
  462. btn->m_bmp->GetHeight(),
  463. UnitPixel,
  464. &imageAtt);
  465. btn->EnableWindow(0);
  466. m_bCanSave = 0;
  467. // CDialog::OnCancel ();
  468. // return 1;
  469. }
  470. else if (IsHasRightsnew2(20, dlg.m_rights) == 0)
  471. {
  472. MyBmpButton2 *btn = ((MyBmpButton2*)m_picarray.ElementAt(4));
  473. btn->m_bmpdisable = btn->m_bmp->Clone();
  474. Graphics graph(btn->m_bmpdisable);
  475. CPoint pt1, pt2, pt3;
  476. pt1.x = 0;
  477. pt1.y = 0;
  478. pt2.x = btn->m_bmp->GetWidth();
  479. pt2.y = 0;
  480. pt3.x = 0;
  481. pt3.y = btn->m_bmp->GetHeight();
  482. Point destinationPoints[] = {
  483. Point(pt1.x, pt1.y), // destination for upper-left point of original
  484. Point(pt2.x, pt2.y), // destination for upper-right point of original
  485. Point(pt3.x, pt3.y) }; // destination for lower-left point of original
  486. ColorMatrix colorMatrix = \
  487. {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  488. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  489. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  490. 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
  491. 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
  492. ImageAttributes imageAtt;
  493. imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
  494. graph.DrawImage(btn->m_bmp,
  495. destinationPoints,
  496. 3,
  497. 0,
  498. 0,
  499. btn->m_bmp->GetWidth(),
  500. btn->m_bmp->GetHeight(),
  501. UnitPixel,
  502. &imageAtt);
  503. btn->EnableWindow(0); m_bCanSave = 0;
  504. // CDialog::OnCancel ();
  505. // return 1;
  506. }
  507. }
  508. }
  509. // 记录要删除的相片;
  510. RecordDeletedPhotos(&m_delphotos, m_DelPhotoPath);
  511. // 加载文件夹;
  512. LoadFolder();
  513. //在界面上显示图片;
  514. LoadPhotos();
  515. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(95)) || g_cominfoarray.ElementAt(0).ElementAt(95) == _T(""))
  516. {
  517. int timer1 = atoi(g_cominfoarray.ElementAt(0).ElementAt(96));
  518. m_timer = atoi(g_cominfoarray.ElementAt(0).ElementAt(97));
  519. if (timer1 == 0)
  520. timer1 = 60;
  521. if (m_timer == 0)
  522. m_timer = 20;
  523. SetTimer(1, timer1 * 60000, NULL);
  524. }
  525. return false;
  526. }
  527. void ChoosePhotoSkin2::OnPaint()
  528. {
  529. try
  530. {
  531. CPaintDC dc(this); // device context for painting
  532. // TODO: Add your message handler code here
  533. if (m_pBk == NULL)
  534. {
  535. return;
  536. }
  537. CRect rc;
  538. GetClientRect(rc);
  539. Graphics graph(dc.GetSafeHdc());
  540. Rect destinationRect(0, 0, rc.Width(), rc.Height());
  541. int width = m_pBk->GetWidth();
  542. int height = m_pBk->GetHeight();
  543. graph.SetSmoothingMode(SmoothingModeHighQuality);
  544. graph.DrawImage(m_pBk, destinationRect, 0, 0, width, height, UnitPixel);
  545. // Do not call CDialog::OnPaint() for painting messages
  546. }
  547. catch (...)
  548. {
  549. }
  550. }
  551. void ChoosePhotoSkin2::OnDestroy()
  552. {
  553. try
  554. {
  555. TerminateThread();
  556. if (m_pBk)delete m_pBk;
  557. MyBmpButton2 *pic = NULL;
  558. for (int i = 0; i < m_picarray.GetSize(); i++)
  559. {
  560. pic = (MyBmpButton2*)m_picarray.ElementAt(i);
  561. if (pic)
  562. {
  563. pic->DestroyWindow();
  564. delete pic;
  565. }
  566. }
  567. m_picarray.RemoveAll();
  568. if (m_selphotownd.GetSafeHwnd())
  569. {
  570. m_selphotownd.DestroyWindow();
  571. }
  572. if (m_selphotownd2.GetSafeHwnd())
  573. {
  574. m_selphotownd2.DestroyWindow();
  575. }
  576. //清除资源的路径
  577. ClearResData();
  578. ClearFolder();
  579. if(m_pHideImg)
  580. delete m_pHideImg;
  581. if(m_pFolderImg)
  582. delete m_pFolderImg;
  583. CDialog::OnDestroy();
  584. }
  585. catch (...)
  586. {
  587. }
  588. }
  589. #ifdef VC60
  590. void ChoosePhotoSkin2::OnBtnClick(WPARAM wParam, LPARAM lParam)
  591. {
  592. // WM_USER + 1101
  593. // F5按键,显示删除相片
  594. int id = lParam;
  595. id -= 99;
  596. switch (id)
  597. {
  598. case 1: // 查看全部相片按钮事件;
  599. case 2: // 查看选中的相片按钮事件;
  600. case 4: // F5查看删除的相片;
  601. {
  602. if (m_SelectCategory == id - 1 && m_SelectCategory != 1)
  603. return;
  604. m_SelectCategory = id - 1;
  605. if(INDX_SEL == m_SelectCategory)
  606. OnSelPhoto();
  607. LoadPhotos();
  608. }
  609. break;
  610. case 3://查看未选按钮事件;
  611. {
  612. m_SelectCategory = INDX_NOSEL;
  613. m_sChooseFilter = _T("");
  614. UpdateChooseZS();
  615. GetNoSelPhoto();
  616. LoadPhotos();
  617. }
  618. break;
  619. case 13: // 查看入册相片按钮事件;
  620. GetAlbumPhoto();
  621. LoadPhotos();
  622. break;
  623. case 14: // 查看入底相片按钮事件;
  624. GetDiskPhoto();
  625. LoadPhotos();
  626. break;
  627. case 15: // 效果图按钮事件;
  628. {
  629. #ifdef __DLL_RENDERINGS__
  630. if ( !lyfzLibrary::LoadRenderingsLibarary())
  631. AfxMessageBox(_T("加载效果图模块失败,请确认模块存在!"));
  632. if ( lyfzLibrary::g_PtrLoadRenderings == NULL)
  633. AfxMessageBox(_T("加载效果图接口失败,请确认模块完整!"));
  634. // 计算出CStringArray的大小;
  635. CMemFile MemFile;
  636. CArchive ar(&MemFile,CArchive::store);
  637. if(m_OpenFolder)
  638. this->GetCurArray(0, m_OpenFolder)->Serialize(ar);
  639. else
  640. this->GetCurArray(m_SelectCategory)->Serialize(ar);
  641. ar.Close();
  642. DWORD dwReturnSize = MemFile.GetLength();
  643. BYTE *pData = MemFile.Detach();
  644. HGLOBAL hMemery = GlobalAlloc(GMEM_MOVEABLE, dwReturnSize);
  645. BYTE *pMem = (BYTE*)GlobalLock(hMemery);
  646. memcpy(pMem,pData,dwReturnSize);
  647. if ( pData )
  648. {
  649. delete pData;
  650. }
  651. if ( !lyfzLibrary::g_PtrLoadRenderings(g_path7, hMemery, dwReturnSize) )
  652. {// 返回false,由调用者释放;
  653. GlobalUnlock(hMemery);
  654. GlobalFree(hMemery);
  655. }
  656. lyfzLibrary::FreeRenderingsLibarary();
  657. #else
  658. ShowEffectDlg dlg;
  659. if(m_OpenFolder)
  660. dlg.m_pPhotopatharray = this->GetCurArray(0, m_OpenFolder);
  661. else
  662. dlg.m_pPhotopatharray = this->GetCurArray(m_SelectCategory);
  663. dlg.DoModal();
  664. #endif
  665. }
  666. break;
  667. case 5: // 保存按钮事件;
  668. OnButton4();
  669. break;
  670. case 6: // 关闭按钮事件 ;
  671. if (m_bModify && m_bCanSave)
  672. {
  673. ShowMsg3 dlg;
  674. dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
  675. // if (AfxMessageBox(_T("提醒, 选片修改未保存, 是否保存后再退出?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
  676. if(dlg.DoModal() == IDOK)
  677. {
  678. OnButton4();
  679. if (m_bSaveFail)
  680. {
  681. AfxMessageBox(_T("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!"));
  682. CDialog::OnCancel();
  683. return;
  684. }
  685. return;
  686. }
  687. else
  688. {
  689. CString savepath = _T("");
  690. savepath.Format("%s\\%s.dat", g_mainpath, m_strOrderNumber);
  691. ::DeleteFile(savepath); // 删除*.dat文件;
  692. }
  693. }
  694. CDialog::OnCancel();
  695. break;
  696. case 11:
  697. if (m_selphotownd.GetSafeHwnd() == NULL)
  698. {
  699. m_selphotownd.m_id = m_strOrderNumber;
  700. m_selphotownd.m_rc = m_rcarray.ElementAt(6);
  701. m_selphotownd.Create(IDD_DLGShowSelPhoto, this);
  702. }
  703. m_selphotownd.ShowWindow(1);
  704. break;
  705. }
  706. }
  707. #else
  708. LRESULT ChoosePhotoSkin2::OnBtnClick(WPARAM wParam, LPARAM lParam)
  709. {
  710. // WM_USER + 1101
  711. // F5按键,显示删除相片
  712. int id = lParam;
  713. id -= 99;
  714. switch (id)
  715. {
  716. case 1: // 查看全部相片按钮事件;
  717. case 2: // 查看选中的相片按钮事件;
  718. case 4: // F5查看删除的相片;
  719. {
  720. if (m_SelectCategory == id - 1 && m_SelectCategory != 1)
  721. return 0;
  722. m_SelectCategory = id - 1;
  723. if(INDX_SEL == m_SelectCategory)
  724. OnSelPhoto();
  725. LoadPhotos();
  726. }
  727. break;
  728. case 3://查看未选按钮事件;
  729. {
  730. m_SelectCategory = INDX_NOSEL;
  731. m_sChooseFilter = _T("");
  732. UpdateChooseZS();
  733. GetNoSelPhoto();
  734. LoadPhotos();
  735. }
  736. break;
  737. case 13: // 查看入册相片按钮事件;
  738. GetAlbumPhoto();
  739. LoadPhotos();
  740. break;
  741. case 14: // 查看入底相片按钮事件;
  742. GetDiskPhoto();
  743. LoadPhotos();
  744. break;
  745. case 15: // 效果图按钮事件;
  746. {
  747. #ifdef __DLL_RENDERINGS__
  748. if ( !lyfzLibrary::LoadRenderingsLibarary())
  749. AfxMessageBox(_T("加载效果图模块失败,请确认模块存在!"));
  750. if ( lyfzLibrary::g_PtrLoadRenderings == NULL)
  751. AfxMessageBox(_T("加载效果图接口失败,请确认模块完整!"));
  752. // 计算出CStringArray的大小;
  753. CMemFile MemFile;
  754. CArchive ar(&MemFile,CArchive::store);
  755. if(m_OpenFolder)
  756. this->GetCurArray(0, m_OpenFolder)->Serialize(ar);
  757. else
  758. this->GetCurArray(m_SelectCategory)->Serialize(ar);
  759. ar.Close();
  760. DWORD dwReturnSize = MemFile.GetLength();
  761. BYTE *pData = MemFile.Detach();
  762. HGLOBAL hMemery = GlobalAlloc(GMEM_MOVEABLE, dwReturnSize);
  763. BYTE *pMem = (BYTE*)GlobalLock(hMemery);
  764. memcpy(pMem,pData,dwReturnSize);
  765. if ( pData )
  766. {
  767. delete pData;
  768. }
  769. if ( !lyfzLibrary::g_PtrLoadRenderings(g_path7, hMemery, dwReturnSize) )
  770. {// 返回false,由调用者释放;
  771. GlobalUnlock(hMemery);
  772. GlobalFree(hMemery);
  773. }
  774. lyfzLibrary::FreeRenderingsLibarary();
  775. #else
  776. ShowEffectDlg dlg;
  777. if(m_OpenFolder)
  778. dlg.m_pPhotopatharray = this->GetCurArray(0, m_OpenFolder);
  779. else
  780. dlg.m_pPhotopatharray = this->GetCurArray(m_SelectCategory);
  781. dlg.DoModal();
  782. #endif
  783. }
  784. break;
  785. case 5: // 保存按钮事件;
  786. OnButton4();
  787. break;
  788. case 6: // 关闭按钮事件 ;
  789. if (m_bModify && m_bCanSave)
  790. {
  791. ShowMsg3 dlg;
  792. dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
  793. // if (AfxMessageBox(_T("提醒, 选片修改未保存, 是否保存后再退出?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
  794. if(dlg.DoModal() == IDOK)
  795. {
  796. OnButton4();
  797. if (m_bSaveFail)
  798. {
  799. AfxMessageBox(_T("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!"));
  800. CDialog::OnCancel();
  801. return 0;
  802. }
  803. return 0;
  804. }
  805. else
  806. {
  807. CString savepath = _T("");
  808. savepath.Format("%s\\%s.dat", g_mainpath, m_strOrderNumber);
  809. ::DeleteFile(savepath); // 删除*.dat文件;
  810. }
  811. }
  812. CDialog::OnCancel();
  813. break;
  814. case 11:
  815. if (m_selphotownd.GetSafeHwnd() == NULL)
  816. {
  817. m_selphotownd.m_id = m_strOrderNumber;
  818. m_selphotownd.m_rc = m_rcarray.ElementAt(6);
  819. m_selphotownd.Create(IDD_DLGShowSelPhoto, this);
  820. }
  821. m_selphotownd.ShowWindow(1);
  822. break;
  823. }
  824. return 0;
  825. }
  826. #endif
  827. BOOL ChoosePhotoSkin2::OnEraseBkgnd(CDC* pDC)
  828. {
  829. return 1;
  830. }
  831. BEGIN_EVENTSINK_MAP(ChoosePhotoSkin2, CDialog)
  832. ON_EVENT(ChoosePhotoSkin2, 100, 150 /* FSCommand */, OnFSCommandShockwaveflash1, VTS_BSTR VTS_BSTR)
  833. END_EVENTSINK_MAP()
  834. void ChoosePhotoSkin2::OnFSCommandShockwaveflash1(LPCTSTR command, LPCTSTR args)
  835. {
  836. }
  837. //------------------------------------------------------------------
  838. // 函数:OnDblclkList1
  839. // 描述:处理双击和回车时的图片显示效果;与函数名本身的表达意义不一致,导致歧义!
  840. // 参数:
  841. // 返回:
  842. //------------------------------------------------------------------
  843. void ChoosePhotoSkin2::OnDblclkList1()
  844. {
  845. // 1.从双击中的列表项中获取相片名;
  846. POSITION pos;
  847. pos = m_List1.GetFirstSelectedItemPosition();
  848. if (pos == NULL)
  849. return;
  850. int iItem = m_List1.GetNextSelectedItem(pos);
  851. #if JEFF_TEST_OFF
  852. // 双击列表根本就不做不到多选多击,双击只会选中一个,故GetNextSelectedItem(pos)后,pos=NULL
  853. // 但是这个函数的作用并不是跟函数名一致,有其他地方用到。
  854. #else // 这一块代码是用于处理回车键;
  855. int nFolderNum = m_vFolder.size();
  856. if(m_OpenFolder == NULL)
  857. {
  858. //双击文件夹;
  859. if(iItem < nFolderNum)
  860. {
  861. m_pCurrSelFolder = FindForderFromIndx(iItem);
  862. if(m_pCurrSelFolder)
  863. {
  864. //打开文件夹;
  865. m_OpenFolder = m_pCurrSelFolder;
  866. if(m_SelectCategory == INDX_INTOALBUM)
  867. GetAlbumPhoto();
  868. else if(m_SelectCategory == INDX_ENTRYPHASSE)
  869. GetDiskPhoto();
  870. else if(m_SelectCategory == INDX_SEL)
  871. UpdateChooseZS();
  872. else if(m_SelectCategory == INDX_NOSEL)
  873. {
  874. m_sChooseFilter = _T("");
  875. UpdateChooseZS();
  876. GetNoSelPhoto();
  877. }
  878. LoadPhotos();
  879. }
  880. return;
  881. }
  882. else
  883. {
  884. iItem = iItem - nFolderNum;
  885. }
  886. }
  887. CArray<int, int>posarray;
  888. posarray.Add(iItem);
  889. // 获取剩下的图片位置;
  890. while (pos)
  891. {
  892. int iItem = m_List1.GetNextSelectedItem(pos);
  893. posarray.Add(iItem);
  894. if (posarray.GetSize() > 3)
  895. break;
  896. }
  897. if (posarray.GetSize() >= 2)
  898. {
  899. CStringArray* pPtahArray = NULL;
  900. if(m_OpenFolder)
  901. {
  902. nFolderNum = 0;
  903. pPtahArray = GetCurArray(0, m_OpenFolder);
  904. }
  905. else
  906. pPtahArray = GetCurArray(m_SelectCategory);
  907. CComparePhoto dlg;
  908. dlg.m_path1 = pPtahArray->ElementAt(posarray.ElementAt(0) - nFolderNum);
  909. dlg.m_path2 = pPtahArray->ElementAt(posarray.ElementAt(1) - nFolderNum);
  910. if (posarray.GetSize() > 2)
  911. dlg.m_path3 = pPtahArray->ElementAt(posarray.ElementAt(2) - nFolderNum);
  912. if (posarray.GetSize() > 3)
  913. dlg.m_path4 = pPtahArray->ElementAt(posarray.ElementAt(3) - nFolderNum);
  914. dlg.DoModal();
  915. return;
  916. }
  917. #endif //JEFF_TEST_OFF
  918. m_showpichwd = NULL;
  919. // 双击小图查看大图;
  920. ShowPic22 dlg;
  921. dlg.m_pParent = this;
  922. dlg.m_nCurImgPos = iItem;
  923. CStringArray* pArray = NULL;
  924. if(m_OpenFolder)
  925. pArray = GetCurArray(m_SelectCategory, m_OpenFolder);
  926. else
  927. pArray = GetCurArray(m_SelectCategory);
  928. if(pArray == NULL)
  929. return;
  930. // 判断是否使用M中图选片(100为设定使用m图);
  931. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(100)))
  932. {
  933. CStringArray saCurrentImagePath; // 当前列表相片;
  934. CStringArray arraymsize; // 对应的"m"相片路径;
  935. saCurrentImagePath.Copy(*pArray);
  936. for (int i = 0; i < saCurrentImagePath.GetSize(); i++)
  937. {
  938. CString str = saCurrentImagePath.ElementAt(i);
  939. CString spath = str.Left(str.ReverseFind('\\') + 1);
  940. spath += "m";
  941. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  942. if (::PathFileExists(spath))
  943. arraymsize.Add(spath);
  944. else
  945. arraymsize.Add(str);
  946. }
  947. dlg.m_pAryImgPath = &arraymsize;
  948. dlg.m_pAryOriginalImgPath = &saCurrentImagePath;
  949. dlg.DoModal();
  950. }
  951. else
  952. {
  953. dlg.m_pAryImgPath = pArray;
  954. dlg.DoModal();
  955. }
  956. m_showpichwd = NULL;
  957. }
  958. void ChoosePhotoSkin2::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) // 双击图片列表!
  959. {
  960. OnDblclkList1();
  961. *pResult = 0;
  962. }
  963. /************************************************************************/
  964. /*
  965. 函数: GetData
  966. 描述: 选片模式
  967. 参数:
  968. 返回:
  969. 注意:
  970. */
  971. /************************************************************************/
  972. BOOL ChoosePhotoSkin2::GetData()//选片模式;
  973. {
  974. m_List2.DeleteAllItems();
  975. m_List3.DeleteAllItems();
  976. m_noarray.RemoveAll();
  977. m_no2array.RemoveAll();
  978. m_oldsparray.RemoveAll();
  979. CString filter = _T("");
  980. //选片
  981. #ifdef CHILD_VERSION
  982. filter = "id='" + m_strOrderNumber + "';id='" + m_strOrderNumber + "';;id='" + m_strOrderNumber + "'";
  983. if (m_seltxname != "" && m_seltxname != "全部")
  984. filter = "id='" + m_strOrderNumber + "' and growthtxname='" + m_seltxname + "';id='" + m_strOrderNumber + "';;id='" + m_strOrderNumber + "'";
  985. #else
  986. filter = "id='" + m_strOrderNumber + "' and kind<>'2';id='" + m_strOrderNumber + "';;id='" + m_strOrderNumber + "'";
  987. #endif //CHILD_VERSION
  988. //订单号、商品编号、商品价格、订单商品数量、商品类型、商品名称、选片选中相片名、自增id、选设计选中相片名;
  989. g_sendhead.code[0] = 50; // dindansp;
  990. g_sendhead.code[1] = 11; // dindan
  991. g_sendhead.code[2] = 4; // shangpin
  992. g_sendhead.code[3] = 182; // dindansp3
  993. g_sendhead.tabcount = 4;
  994. g_sendhead.bsql = 0;
  995. g_pMainWnd->ProcessChatMessageRequest2(filter);
  996. if (g_bSendOK == 0)
  997. return 0;
  998. CArray<CStringArray, CStringArray> sparray; //dindansp表;//订单号、商品编号、商品价格、订单商品数量、商品类型、商品名称、选片选中相片名、自增id、选设计选中相片名;
  999. DataToArray(&sparray, &g_List1array, &m_sparray, &m_oldsparray);
  1000. m_SelPhotoPath.RemoveAll();
  1001. CString str(_T("")), kind(_T(""));
  1002. int nchoosezs = 0;
  1003. int list2pos = 0;
  1004. int list3pos = 0;
  1005. CString savepath;
  1006. savepath.Format(_T("%s\\%s.dat"), g_mainpath, m_strOrderNumber);
  1007. CString stm1 = GetModifyTime2(savepath);
  1008. CTime tm1 = CTime::GetCurrentTime();
  1009. tm1 -= CTimeSpan(2, 0, 0, 0);
  1010. CString stm2 = tm1.Format(_T("%Y%m%d"));
  1011. BOOL bLoadHistory = 0;
  1012. if (PathFileExists(savepath) && stm1 > stm2)
  1013. {
  1014. if (AfxMessageBox(_T("提醒:请谨慎操作\r\n上次选片未正常退出, 是否还原到上次选片状态?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
  1015. bLoadHistory = 1;
  1016. }
  1017. int i = 0;
  1018. if (bLoadHistory)
  1019. {
  1020. //还原到上次选片状态
  1021. CArray<CStringArray, CStringArray> List1array;
  1022. //读取数据
  1023. CFile fp;
  1024. fp.Open(savepath, CFile::modeRead);
  1025. DWORD nMessageLen = fp.GetLength();
  1026. BYTE *szChatMessage = new BYTE[nMessageLen];
  1027. fp.Read(szChatMessage, nMessageLen);
  1028. fp.Close();
  1029. int count = 0;
  1030. memcpy(&count, szChatMessage + (nMessageLen - sizeof(int)), sizeof(int));
  1031. CMemFile memfile;
  1032. memfile.Attach(szChatMessage, nMessageLen);
  1033. CArchive ar(&memfile, CArchive::load);
  1034. List1array.SetSize(count);
  1035. for ( i = 0; i < List1array.GetSize(); i++)
  1036. List1array.ElementAt(i).Serialize(ar);
  1037. ar.Close();
  1038. memfile.Detach();
  1039. delete[]szChatMessage;
  1040. list2pos = 0;
  1041. list3pos = 0;
  1042. for (i = 0; i < List1array.GetSize(); i++)
  1043. {
  1044. if (0)//List1array.ElementAt (i).GetSize ()==6)
  1045. {
  1046. kind = "0";
  1047. m_List2.InsertItem(list2pos, List1array.ElementAt(i).ElementAt(1));
  1048. m_List2.SetItemText(list2pos, 1, List1array.ElementAt(i).ElementAt(2));
  1049. m_List2.SetItemText(list2pos, 2, List1array.ElementAt(i).ElementAt(3));
  1050. m_List2.SetItemText(list2pos, 3, List1array.ElementAt(i).ElementAt(4));
  1051. m_List2.SetItemText(list2pos, 4, List1array.ElementAt(i).ElementAt(5));
  1052. str = List1array.ElementAt(i).ElementAt(5);
  1053. list2pos++;
  1054. }
  1055. else
  1056. {
  1057. kind = "4";
  1058. m_List3.InsertItem(list3pos, List1array.ElementAt(i).ElementAt(1));
  1059. m_List3.SetItemText(list3pos, 1, List1array.ElementAt(i).ElementAt(2));
  1060. m_List3.SetItemText(list3pos, 2, List1array.ElementAt(i).ElementAt(3));
  1061. m_List3.SetItemText(list3pos, 3, List1array.ElementAt(i).ElementAt(4));
  1062. m_List3.SetItemText(list3pos, 4, List1array.ElementAt(i).ElementAt(5));
  1063. m_List3.SetItemText(list3pos, 5, List1array.ElementAt(i).ElementAt(6));
  1064. m_List3.SetItemText(list3pos, 6, List1array.ElementAt(i).ElementAt(9));
  1065. #ifdef LKAY_VERSION
  1066. m_List3.SetItemText(list3pos, 6, List1array.ElementAt (i).ElementAt (7));
  1067. m_List3.SetItemText(list3pos, 7, List1array.ElementAt (i).ElementAt (8));
  1068. str=List1array.ElementAt (i).ElementAt (8);
  1069. #else
  1070. str = List1array.ElementAt(i).ElementAt(6);
  1071. #endif //#ifdef LKAY_VERSION
  1072. list3pos++;
  1073. }
  1074. nchoosezs += GetZS(str);
  1075. GetPathAddToSel(str);
  1076. if (!str.IsEmpty())
  1077. {
  1078. #ifdef USE_SEP_VEB
  1079. str = SEPS_VEB + str + SEPS_VEB;
  1080. #else
  1081. str = SEPS_CMA + str + SEPS_CMA;
  1082. #endif //#ifdef USE_SEP_VEB
  1083. }
  1084. str.MakeLower();
  1085. if (kind == _T("4"))
  1086. m_no2array.Add(str);
  1087. else
  1088. m_noarray.Add(str);
  1089. }
  1090. }
  1091. else
  1092. {
  1093. for ( i = 0; i < sparray.GetSize(); i++)
  1094. {
  1095. kind = _T("4");//sparray.ElementAt (i).ElementAt (4);
  1096. if (kind == _T("4"))
  1097. {
  1098. m_List3.InsertItem(list3pos, sparray.ElementAt(i).ElementAt(7)); // dindansp表autoid;
  1099. m_List3.SetItemText(list3pos, 1, sparray.ElementAt(i).ElementAt(1)); // 商品编号;
  1100. m_List3.SetItemText(list3pos, 2, sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  1101. m_List3.SetItemText(list3pos, 3, sparray.ElementAt(i).ElementAt(2)); // 商品价格;
  1102. m_List3.SetItemText(list3pos, 4, sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  1103. #ifdef LKAY_VERSION
  1104. m_List3.SetItemText(list3pos, 5, sparray.ElementAt (i).ElementAt (9)); //
  1105. m_List3.SetItemText(list3pos, 6, sparray.ElementAt (i).ElementAt (10));
  1106. m_List3.SetItemText(list3pos, 7, sparray.ElementAt (i).ElementAt (6));
  1107. #else
  1108. m_List3.SetItemText(list3pos, 5, sparray.ElementAt(i).ElementAt(6)); // 选片时选中的相片名;
  1109. m_List3.SetItemText(list3pos, 6, sparray.ElementAt(i).ElementAt(9)); // 商品备注;
  1110. #endif
  1111. list3pos++;
  1112. }
  1113. else
  1114. {
  1115. OutputDebugString(_T("\n 选片 #######################m_List2####################### \n"));
  1116. m_List2.InsertItem(list2pos, sparray.ElementAt(i).ElementAt(7)); // dindansp表autoid;
  1117. m_List2.SetItemText(list2pos, 1, sparray.ElementAt(i).ElementAt(1)); // 商品编号;
  1118. m_List2.SetItemText(list2pos, 2, sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  1119. m_List2.SetItemText(list2pos, 3, sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  1120. m_List2.SetItemText(list2pos, 4, sparray.ElementAt(i).ElementAt(6)); // 选片时选中的相片名;
  1121. list2pos++;
  1122. }
  1123. str = sparray.ElementAt(i).ElementAt(6);
  1124. str.MakeLower();
  1125. nchoosezs += GetZS(str); // 获取no或no2字段中包含的相片名数量;
  1126. GetPathAddToSel(str);
  1127. if (!str.IsEmpty())
  1128. {
  1129. #ifdef USE_SEP_VEB
  1130. str = SEPS_VEB + str + SEPS_VEB;
  1131. #else
  1132. str = SEPS_CMA + str + SEPS_CMA;
  1133. #endif //#ifdef USE_SEP_VEB
  1134. }
  1135. if (kind == _T("4"))
  1136. m_no2array.Add(str);
  1137. else
  1138. m_noarray.Add(str);
  1139. }
  1140. // 入册;
  1141. CheckForAlbum();
  1142. // 入底;
  1143. CheckForDisk();
  1144. }
  1145. // g_List1array -> dindan表;
  1146. if (g_List1array.GetSize())
  1147. {
  1148. m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  1149. m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  1150. m_phone1 = g_List1array.ElementAt(0).ElementAt(61);
  1151. m_phone2 = g_List1array.ElementAt(0).ElementAt(62);
  1152. if (!m_name1.IsEmpty())
  1153. {
  1154. #ifdef USE_SEP_VEB
  1155. m_name = m_name1 + SEPS_VEB;
  1156. #else
  1157. m_name = m_name1 + SEPS_CMA;
  1158. #endif //#ifdef USE_SEP_VEB
  1159. }
  1160. m_name += m_name2;
  1161. #ifdef USE_SEP_VEB
  1162. m_name.TrimRight(SEPS_VEB);
  1163. #else
  1164. m_name.TrimRight(SEPS_CMA);
  1165. #endif //#ifdef USE_SEP_VEB
  1166. m_waiter3 = g_user.name;
  1167. m_taoxizs = g_List1array.ElementAt(0).ElementAt(9);
  1168. m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  1169. m_takezs = g_List1array.ElementAt(0).ElementAt(23);
  1170. m_choosezs = g_List1array.ElementAt(0).ElementAt(24);
  1171. m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  1172. m_oldmoney3 = m_money3;
  1173. m_bz3 = g_List1array.ElementAt(0).ElementAt(39);
  1174. m_bz4 = g_List1array.ElementAt(0).ElementAt(75);
  1175. m_delphotos = g_List1array.ElementAt(0).ElementAt(53); // Jeff开始选片时,获取dindan表的字段delphotos.读取正常;
  1176. if ( !m_delphotos.IsEmpty() )
  1177. {
  1178. m_delphotos.TrimLeft(SEPC_VEB);
  1179. m_delphotos.TrimRight(SEPC_VEB);
  1180. m_delphotos = SEPS_VEB + m_delphotos + SEPS_VEB;
  1181. }
  1182. m_time6 = g_List1array.ElementAt(0).ElementAt(48);
  1183. m_time5old = m_time5;
  1184. m_time6old = m_time6;
  1185. taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  1186. m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  1187. m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  1188. m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  1189. m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  1190. ren = g_List1array.ElementAt(0).ElementAt(14);
  1191. m_size = g_List1array.ElementAt(0).ElementAt(60);
  1192. m_checkstatus = g_List1array.ElementAt(0).ElementAt(32);
  1193. UpdateData(false);
  1194. }
  1195. else
  1196. {
  1197. m_name1 = _T("");
  1198. m_name2 = _T("");
  1199. m_waiter3 = _T("");
  1200. m_taoxizs = _T("");
  1201. m_time5 = _T("");
  1202. m_takezs = _T("");
  1203. m_choosezs = _T("");
  1204. m_money3 = "";
  1205. m_bz3 = _T("");
  1206. m_bz4 = _T("");
  1207. UpdateData(false);
  1208. }
  1209. return 1;
  1210. }
  1211. void ChoosePhotoSkin2::OnClose()
  1212. {
  1213. /*
  1214. if (m_bModify)
  1215. {
  1216. ShowMsg3 dlg;
  1217. dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
  1218. if(dlg.DoModal() == IDOK)
  1219. OnButton4();
  1220. }
  1221. */
  1222. CDialog::OnClose();
  1223. }
  1224. BOOL ChoosePhotoSkin2::PreTranslateMessage(MSG* pMsg)
  1225. {
  1226. if (pMsg->message == WM_LBUTTONDOWN)
  1227. {
  1228. g_bNeedDrawParent = 2;
  1229. if (0)
  1230. {//list3
  1231. CPoint pt;
  1232. CRect rc, rc2;
  1233. ::GetCursorPos(&pt);
  1234. m_List3.GetWindowRect(rc2);
  1235. if (rc2.PtInRect(pt) == 0) return CDialog::PreTranslateMessage(pMsg);
  1236. SetTimer(3, 300, NULL);
  1237. }
  1238. }
  1239. else if (0)//pMsg->message==WM_LBUTTONDBLCLK)
  1240. {
  1241. {//list1
  1242. CPoint pt;
  1243. CRect rc, rc2;
  1244. ::GetCursorPos(&pt);
  1245. m_List2.GetWindowRect(rc2);
  1246. if (rc2.PtInRect(pt))
  1247. return 1;
  1248. }
  1249. {//list3
  1250. CPoint pt;
  1251. CRect rc, rc2;
  1252. ::GetCursorPos(&pt);
  1253. m_List3.GetWindowRect(rc2);
  1254. if (rc2.PtInRect(pt) == 0)return CDialog::PreTranslateMessage(pMsg);
  1255. pt.x -= rc2.left;
  1256. pt.y -= rc2.top;
  1257. int iItem = m_List3.GetItemCount() - 1;
  1258. if (iItem < 0)
  1259. {
  1260. m_List3.GetHeaderCtrl()->GetItemRect(0, rc);
  1261. int hei = rc.Height();
  1262. rc.top += hei;
  1263. rc.bottom += hei;
  1264. if (rc.PtInRect(pt))
  1265. {
  1266. m_List3.InsertItem(m_List3.GetItemCount(), "");
  1267. }
  1268. }
  1269. else
  1270. {
  1271. m_List3.GetSubItemRect(iItem, 0, LVIR_BOUNDS, rc);
  1272. int hei = rc.Height();
  1273. rc.top += hei;
  1274. rc.bottom += hei;
  1275. if (rc.PtInRect(pt))
  1276. {
  1277. if (m_List3.GetItemText(iItem, 1).IsEmpty() && m_List3.GetItemText(iItem, 2).IsEmpty())
  1278. return CDialog::PreTranslateMessage(pMsg);
  1279. m_List3.InsertItem(m_List3.GetItemCount(), "");
  1280. }
  1281. POSITION pos;
  1282. pos = m_List3.GetFirstSelectedItemPosition();
  1283. if (pos)
  1284. {
  1285. iItem = m_List3.GetNextSelectedItem(pos);
  1286. m_List3.GetSubItemRect(iItem, 4, LVIR_BOUNDS, rc);
  1287. if (rc.PtInRect(pt))return 1;
  1288. }
  1289. }
  1290. }
  1291. }
  1292. else if (pMsg->message == WM_KEYDOWN)
  1293. {
  1294. if (m_showpichwd)return 1;
  1295. switch (pMsg->wParam)
  1296. {
  1297. case VK_DELETE:
  1298. {
  1299. OnDel();
  1300. //更新绘制;
  1301. DrawInterface();
  1302. // LoadPhotos();
  1303. }
  1304. return 1;
  1305. case VK_RETURN:
  1306. OnDblclkList1();
  1307. return 1;
  1308. case VK_F4:
  1309. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(62)))
  1310. {
  1311. if (m_SelectCategory == INDX_SEL)
  1312. UpdateChooseZS();
  1313. SortArray();
  1314. }
  1315. return 1;
  1316. case VK_F5:
  1317. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
  1318. {
  1319. OnBtnClick(0, 99 + 4);
  1320. }
  1321. /* if(m_mode2==0)return 1;
  1322. {
  1323. ReplaceDesignNo dlg;
  1324. dlg.m_id=this->m_id ;
  1325. dlg.DoModal ();
  1326. }*/
  1327. return 1;
  1328. case VK_F1:
  1329. {
  1330. if (m_selphotownd2.GetSafeHwnd() == NULL)
  1331. {
  1332. m_selphotownd2.m_id = m_strOrderNumber;
  1333. m_selphotownd2.m_bGrowthTX = m_bGrowthTX;
  1334. m_selphotownd2.m_seltxname = m_seltxname;
  1335. m_selphotownd2.m_rc = m_rcarray.ElementAt(6);
  1336. m_selphotownd2.Create(IDD_DLGShowSelPhoto2, this);
  1337. }
  1338. m_selphotownd2.ShowWindow(1);
  1339. }
  1340. return 1;
  1341. case VK_F2: //缩略图
  1342. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(60)))
  1343. {
  1344. m_bHide = !m_bHide;
  1345. LoadPhotos();
  1346. }
  1347. return 1;
  1348. case VK_BACK: //返回上层
  1349. {
  1350. m_pCurrSelFolder = m_OpenFolder = NULL;
  1351. if (m_SelectCategory == INDX_SEL)
  1352. UpdateChooseZS();
  1353. else if(m_SelectCategory == INDX_NOSEL)
  1354. {
  1355. m_sChooseFilter = _T("");
  1356. UpdateChooseZS();
  1357. GetNoSelPhoto();
  1358. }
  1359. LoadPhotos();
  1360. }
  1361. return 1;
  1362. case VK_ESCAPE:
  1363. {
  1364. return TRUE;
  1365. }
  1366. break;
  1367. }
  1368. }
  1369. else if(pMsg->message == WM_LBUTTONUP)
  1370. {
  1371. CDialog::PreTranslateMessage(pMsg);
  1372. if(m_OpenFolder == NULL && m_vFolder.size() && m_SelectCategory != INDX_DEL)
  1373. {
  1374. printf("\t拖动相片\n");
  1375. //选片模式;
  1376. POSITION pos;
  1377. pos = m_List1.GetFirstSelectedItemPosition();
  1378. if (pos == NULL)
  1379. return FALSE;
  1380. int iItem = m_List1.GetDragSelIndex();
  1381. if(iItem == -1)
  1382. return FALSE;
  1383. CStringArray *pArray = GetCurArray(m_SelectCategory);
  1384. m_pCurrSelFolder = FindForderFromIndx(iItem);
  1385. if(m_pCurrSelFolder && pArray)
  1386. {
  1387. //获取选中的相片;
  1388. vector<CString> vMoveFile;
  1389. CDWordArray* pDWArr = m_List1.GetDragIndexes();
  1390. if(pDWArr)
  1391. {
  1392. for ( int i = pDWArr->GetSize() - 1; i > -1; i-- )
  1393. {
  1394. if( (*pDWArr)[i] < m_vFolder.size() )
  1395. continue;
  1396. vMoveFile.push_back(pArray->ElementAt((*pDWArr)[i] - m_vFolder.size()));
  1397. pArray->RemoveAt((*pDWArr)[i] - m_vFolder.size());
  1398. }
  1399. }
  1400. if(vMoveFile.size() > 0)
  1401. {
  1402. //移动选中的相片;
  1403. if(MoveFileMainToSub(vMoveFile, m_pCurrSelFolder))
  1404. {
  1405. if ( m_SelectCategory != INDX_ALL && m_SelectCategory != INDX_DEL )
  1406. {// 从全部里移除被移动到文件夹的相片;
  1407. pArray = GetCurArray(INDX_ALL, NULL);
  1408. vector<CString>::iterator iter = vMoveFile.begin();
  1409. for ( ; iter != vMoveFile.end(); iter++ )
  1410. {
  1411. for ( int n = 0; n < pArray->GetSize(); n++ )
  1412. {
  1413. if ( iter->CompareNoCase(pArray->ElementAt(n)) == 0 )
  1414. {
  1415. pArray->RemoveAt(n);
  1416. break;
  1417. }
  1418. }
  1419. }
  1420. }
  1421. }
  1422. }
  1423. LoadPhotos();
  1424. }
  1425. }
  1426. return TRUE;
  1427. }
  1428. return CDialog::PreTranslateMessage(pMsg);
  1429. }
  1430. void ChoosePhotoSkin2::OnRclickList1() // 右键List列表;
  1431. {
  1432. if (m_bRunning)
  1433. return;
  1434. CMenuXP *pPopup = NULL;
  1435. POSITION pos;
  1436. pos = m_List1.GetFirstSelectedItemPosition();
  1437. if (pos == NULL)
  1438. {
  1439. // 新建/返回文件夹菜单;
  1440. if(m_OpenFolder)
  1441. ShowFolderMenu(IDM_RETURNMAINDIR, _T("返回上层"));
  1442. else
  1443. ShowFolderMenu(IDM_NEWFOLDER, _T("新建文件夹"));
  1444. return;
  1445. }
  1446. int iItem = m_List1.GetNextSelectedItem(pos);
  1447. printf(_T("\t选中第%d个项\n"),iItem);
  1448. CString path = _T("");
  1449. CStringArray* pArray = NULL;
  1450. // 选片才对文件夹处理;
  1451. if(m_OpenFolder == NULL)
  1452. {
  1453. int nsize = m_vFolder.size();
  1454. if(iItem < nsize)
  1455. {
  1456. // 获取选中的文件夹图标;
  1457. m_pCurrSelFolder = FindForderFromIndx(iItem);
  1458. if(m_pCurrSelFolder)
  1459. {
  1460. // 显示删除文件夹菜单;
  1461. vector<SMenuBtnData> vdata;
  1462. vdata.push_back(SMenuBtnData(IDM_OPENFOLDER, _T("打开文件夹")));
  1463. vdata.push_back(SMenuBtnData(IDM_DELFOLDER, _T("删除文件夹")));
  1464. ShowFolderMenu(vdata);
  1465. return;
  1466. }
  1467. }
  1468. else
  1469. iItem = iItem - nsize;
  1470. pArray = GetCurArray(m_SelectCategory);
  1471. }
  1472. else
  1473. pArray = GetCurArray(INDX_ALL, m_OpenFolder);
  1474. path = pArray->ElementAt(iItem); //path//打印出相片完整路径名;
  1475. printf("[%d]对应文件路径:\n \t%s\n", iItem + m_vFolder.size(), path);
  1476. // 右键看设计模式;
  1477. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1478. path = path.Left(path.ReverseFind('.'));
  1479. #ifdef USE_SEP_VEB
  1480. path = SEPS_VEB + path + SEPS_VEB; //
  1481. #else
  1482. path = SEPS_CMA + path + SEPS_CMA; //
  1483. #endif //#ifdef USE_SEP_VEB
  1484. // TODO: Add your control notification handler code here
  1485. // 1.创建菜单对象;
  1486. pPopup = new CMenuXP;
  1487. pPopup->CYBUTTONMARGIN = 3; // 1.0.按钮范围0~3; 4个菜单;
  1488. pPopup->CreatePopupMenu(); // 1.1.弹出式菜单;
  1489. pPopup->SetMenuStyle(CMenuXP::STYLE_XP);// 1.2.弹出菜单样式;
  1490. // Jeff:m_List2有三列头:编号、商品名称、商品数量;
  1491. // 计算菜单最大字符长度;
  1492. int i = 0;
  1493. int maxleng = 1;
  1494. CString name, no;
  1495. int count = 0;
  1496. for ( i = 0; i < m_List2.GetItemCount(); i++)
  1497. {
  1498. // name商品名称;
  1499. name = m_List2.GetItemText(i, 2);
  1500. //no = m_noarray.ElementAt(i);
  1501. maxleng = max(maxleng, name.GetLength());
  1502. }
  1503. count = i;
  1504. for (; i < count + m_no2array.GetSize(); i++)
  1505. {
  1506. name = m_List3.GetItemText(i - count, 2);
  1507. maxleng = max(maxleng, name.GetLength());
  1508. }
  1509. maxleng += 3;
  1510. // m_List2有三列头:编号、商品名称、商品数量;
  1511. CString scount = _T("");
  1512. name = no = _T("");
  1513. count = 0;
  1514. for ( i = 0; i < m_List2.GetItemCount(); i++)
  1515. {
  1516. printf("ChoosePhotoSkin2::m_List2有记录\n");
  1517. // name商品名称;
  1518. name = m_List2.GetItemText(i, 2);
  1519. //填充长度;
  1520. FillLength(name, maxleng);
  1521. // Jeff,no里为商品名称选中的相片;
  1522. no = m_noarray.ElementAt(i);
  1523. GetSelCountFromName(no, scount);
  1524. //添加菜单项;
  1525. pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));// 2.使用AppendODMenu2添加子菜单项;
  1526. //绑定事件ID
  1527. if (no.Find(path) != -1)
  1528. {
  1529. pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
  1530. }
  1531. }
  1532. count = i;
  1533. for (; i < count + m_no2array.GetSize(); i++)
  1534. {
  1535. name = m_List3.GetItemText(i - count, 2);
  1536. FillLength(name, maxleng);
  1537. no = m_no2array.ElementAt(i - count);
  1538. GetSelCountFromName(no, scount);
  1539. pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));
  1540. if (no.Find(path) != -1)
  1541. {// 未选中;
  1542. printf("\t商品:[%s],\n\t当前相片[%s]\n\t 关联相片:[%s]\n",name, path, no);
  1543. pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
  1544. }
  1545. else
  1546. {// 选中;
  1547. // 当单击中菜单时,与当前状态相反;
  1548. }
  1549. }
  1550. pPopup->AppendODMenu2(0, new CMenuXPText(32794, _T("修改要求"), NULL));
  1551. //获取当前鼠标位置;
  1552. CPoint pt;
  1553. ::GetCursorPos(&pt);
  1554. // 3.使用TrackPopupMenu,正常弹出菜单;
  1555. pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);
  1556. delete pPopup;
  1557. }
  1558. void ChoosePhotoSkin2::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult)
  1559. {
  1560. if (m_showpichwd)
  1561. return;
  1562. OnRclickList1();
  1563. *pResult = 0;
  1564. }
  1565. /************************************************************************/
  1566. /*
  1567. 函数: ShowFolderMenu
  1568. 描述: 显示文件夹菜单;
  1569. 参数:
  1570. 返回: 1成功, 0失败
  1571. 注意:
  1572. */
  1573. /************************************************************************/
  1574. int ChoosePhotoSkin2::ShowFolderMenu(const int nID, const LPCTSTR pName)
  1575. {
  1576. if(pName == NULL)
  1577. {
  1578. MessageBox(_T("弹出菜单失败"));
  1579. return 0;
  1580. }
  1581. CMenuXP *pPopup = new CMenuXP;
  1582. pPopup->CYBUTTONMARGIN = 3; // 1.0.按钮范围0~3; 4个菜单;
  1583. pPopup->CreatePopupMenu(); // 1.1.弹出式菜单;
  1584. pPopup->SetMenuStyle(CMenuXP::STYLE_XP); // 1.2.弹出菜单样式;
  1585. pPopup->AppendODMenu2(0, new CMenuXPText(nID, pName, NULL));
  1586. //获取当前鼠标位置;
  1587. CPoint pt;
  1588. ::GetCursorPos(&pt);
  1589. // 3.使用TrackPopupMenu,正常弹出菜单;
  1590. pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);
  1591. delete pPopup;
  1592. return 1;
  1593. }
  1594. /************************************************************************/
  1595. /*
  1596. 函数: ShowFolderMenu
  1597. 描述: 显示文件夹菜单;
  1598. 参数:
  1599. 返回: 1成功, 0失败
  1600. 注意:
  1601. */
  1602. /************************************************************************/
  1603. int ChoosePhotoSkin2::ShowFolderMenu(vector<SMenuBtnData>& vdata)
  1604. {
  1605. if(vdata.size() == 0)
  1606. {
  1607. MessageBox(_T("弹出菜单失败"));
  1608. return 0;
  1609. }
  1610. CMenuXP *pPopup = new CMenuXP;
  1611. pPopup->CYBUTTONMARGIN = 3; // 1.0.按钮范围0~3; 4个菜单;
  1612. pPopup->CreatePopupMenu(); // 1.1.弹出式菜单;
  1613. pPopup->SetMenuStyle(CMenuXP::STYLE_XP); // 1.2.弹出菜单样式;
  1614. vector<SMenuBtnData>::iterator iter = vdata.begin();
  1615. for(;iter != vdata.end();)
  1616. {
  1617. pPopup->AppendODMenu2(0, new CMenuXPText(iter->nID, iter->strBtnName, NULL));
  1618. ++iter;
  1619. }
  1620. //获取当前鼠标位置
  1621. CPoint pt;
  1622. ::GetCursorPos(&pt);
  1623. // 3.使用TrackPopupMenu,正常弹出菜单;
  1624. pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);
  1625. delete pPopup;
  1626. return 1;
  1627. }
  1628. //
  1629. /************************************************************************/
  1630. /*
  1631. 函数: OnCommandMenu
  1632. 描述: 弹出菜单处理;
  1633. 参数:
  1634. UINT nID 事件ID
  1635. 返回:
  1636. 注意:
  1637. */
  1638. /************************************************************************/
  1639. void ChoosePhotoSkin2::OnCommandMenu(UINT nID)
  1640. {
  1641. printf("\n\nChoosePhotoSkin2::OnCommandMenu#############################################:\n");
  1642. if (32794 == nID)
  1643. {
  1644. //修改要求;
  1645. POSITION pos;
  1646. pos = m_List1.GetFirstSelectedItemPosition();
  1647. if (pos == NULL)
  1648. {
  1649. return;
  1650. }
  1651. int iItem = m_List1.GetNextSelectedItem(pos);
  1652. if(m_OpenFolder == NULL)
  1653. iItem = iItem - m_vFolder.size();
  1654. CStringArray *pArray = GetCurArray(m_SelectCategory);
  1655. CString path = pArray->ElementAt(iItem);
  1656. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1657. path = path.Left(path.Find('.'));
  1658. if (m_bz4.GetLength() > 4080)
  1659. {
  1660. AfxMessageBox(_T("备注太长,可在保存界面选中备注内容,按Delete键清除"));
  1661. return;
  1662. }
  1663. UpdateData();
  1664. CClientRequirement dlg;
  1665. dlg.m_no = _T("当前照片:") + path;
  1666. CString header, left, right, cur;
  1667. header = path + ":";
  1668. int pos2 = m_bz4.Find(header);
  1669. if (pos2 != -1)
  1670. {
  1671. left = m_bz4.Left(pos2);
  1672. m_bz4 = m_bz4.Right(m_bz4.GetLength() - pos2);
  1673. pos2 = m_bz4.Find(" ");
  1674. if (pos2 != -1)
  1675. {
  1676. cur = m_bz4.Left(pos2);
  1677. int pos3 = cur.Find(":");
  1678. if (pos3 != -1)
  1679. cur = cur.Right(cur.GetLength() - pos3 - 1);
  1680. right = m_bz4.Right(m_bz4.GetLength() - pos2 - 2);
  1681. }
  1682. }
  1683. else
  1684. left = m_bz4;
  1685. dlg.m_bz2 = cur;
  1686. dlg.m_bSave = 0;
  1687. dlg.m_nMode = 2;
  1688. if (dlg.DoModal() == IDOK)
  1689. {
  1690. // m_bz3=dlg.m_bz2 ;
  1691. dlg.m_bz2.TrimLeft();
  1692. dlg.m_bz2.TrimRight();
  1693. if (dlg.m_bz2 != "")
  1694. cur = header + dlg.m_bz2 + " ";
  1695. else
  1696. cur = _T("");
  1697. m_bz4 = left + cur + right;
  1698. UpdateData(false);
  1699. }
  1700. else
  1701. {
  1702. if (cur != "")
  1703. m_bz4 = left + header + cur + " " + right;
  1704. else
  1705. m_bz4 = left + right;
  1706. }
  1707. return;
  1708. }
  1709. //////////////////////////////////////////////////////////////////////////
  1710. // 产品菜单项;
  1711. POSITION pos;
  1712. pos = m_List1.GetFirstSelectedItemPosition();
  1713. if (pos == NULL)
  1714. {
  1715. return;
  1716. }
  1717. CString temp;
  1718. m_combo1.ResetContent();
  1719. int aa = 0;
  1720. while (pos)
  1721. {
  1722. aa++;
  1723. CStringArray* pArray = NULL;
  1724. CString path = _T("");
  1725. int iItem = m_List1.GetNextSelectedItem(pos);
  1726. if(m_OpenFolder)
  1727. pArray = GetCurArray(m_SelectCategory, m_OpenFolder);
  1728. else
  1729. {
  1730. if(iItem >= m_vFolder.size())
  1731. iItem = iItem - m_vFolder.size();
  1732. else
  1733. return;
  1734. pArray = GetCurArray(m_SelectCategory);
  1735. }
  1736. if(pArray == NULL)
  1737. break;
  1738. path = pArray->ElementAt(iItem);
  1739. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1740. path = path.Left(path.ReverseFind('.'));
  1741. #ifdef USE_SEP_VEB
  1742. path = SEPS_VEB + path + SEPS_VEB;
  1743. #else
  1744. path = SEPS_CMA + path + SEPS_CMA;
  1745. #endif //#ifdef USE_SEP_VEB
  1746. int idpos = nID - IDM_MENUsp1;
  1747. BOOL bSel = 0; //选中还是取消;
  1748. if (idpos < m_noarray.GetSize())
  1749. {
  1750. CString no = m_noarray.ElementAt(idpos);
  1751. if (no.Find(path) != -1)
  1752. {
  1753. int pos = no.Find(path);
  1754. no.Delete(pos, path.GetLength() - 1);
  1755. }
  1756. else if (no.GetLength() > 4000)
  1757. {
  1758. AfxMessageBox(_T("编号太长,选择失败!"), MB_ICONSTOP);
  1759. return;
  1760. }
  1761. else
  1762. {
  1763. bSel = 1;
  1764. #ifdef USE_SEP_VEB
  1765. no.TrimRight(SEPS_VEB);
  1766. #else
  1767. no.TrimRight(SEPS_CMA);
  1768. #endif //#ifdef USE_SEP_VEB
  1769. no += path;
  1770. }
  1771. #ifdef USE_SEP_VEB
  1772. no.TrimLeft(SEPS_VEB);
  1773. no.TrimRight(SEPS_VEB);
  1774. #else
  1775. no.TrimLeft(SEPS_CMA);
  1776. no.TrimRight(SEPS_CMA);
  1777. #endif //#ifdef USE_SEP_VEB
  1778. m_List2.SetItemText(idpos, 4, no);
  1779. printf("%s | %s ", path, bSel ? "选中" : "取消选中");
  1780. if (no.IsEmpty())
  1781. m_noarray.SetAt(idpos, no);
  1782. else
  1783. {
  1784. #ifdef USE_SEP_VEB
  1785. m_noarray.SetAt(idpos, SEPS_VEB + no + SEPS_VEB);
  1786. #else
  1787. m_noarray.SetAt(idpos, SEPS_CMA + no + SEPS_CMA);
  1788. #endif //#ifdef USE_SEP_VEB
  1789. }
  1790. printf("%s %d:%s\n\n", m_List3.GetItemText(idpos, 2), idpos, m_noarray.ElementAt(idpos));
  1791. }
  1792. else
  1793. {
  1794. idpos -= m_noarray.GetSize();
  1795. CString no = m_no2array.ElementAt(idpos);
  1796. if (no.Find(path) != -1)
  1797. {
  1798. int pos = no.Find(path);
  1799. no.Delete(pos, path.GetLength() - 1);
  1800. }
  1801. else if (no.GetLength() > 4000)
  1802. {
  1803. AfxMessageBox(_T("编号太长,选择失败!"), MB_ICONSTOP); return;
  1804. }
  1805. else
  1806. {
  1807. bSel = 1;
  1808. #ifdef USE_SEP_VEB
  1809. no.TrimRight(SEPS_VEB);
  1810. #else
  1811. no.TrimRight(SEPS_CMA);
  1812. #endif //#ifdef USE_SEP_VEB
  1813. no += path;
  1814. }
  1815. #ifdef USE_SEP_VEB
  1816. no.TrimLeft(SEPS_VEB);
  1817. no.TrimRight(SEPS_VEB);
  1818. #else
  1819. no.TrimLeft(SEPS_CMA);
  1820. no.TrimRight(SEPS_CMA);
  1821. #endif //#ifdef USE_SEP_VEB
  1822. #ifdef LKAY_VERSION
  1823. m_List3.SetItemText (idpos, 7, no);
  1824. #else
  1825. m_List3.SetItemText(idpos, 5, no);
  1826. #endif //#ifdef LKAY_VERSION
  1827. printf("%s | %s ", path, bSel ? "选中" : "取消选中");
  1828. if (no.IsEmpty())
  1829. m_no2array.SetAt(idpos, no);
  1830. else
  1831. {
  1832. #ifdef USE_SEP_VEB
  1833. m_no2array.SetAt(idpos, SEPS_VEB + no + SEPS_VEB);
  1834. #else
  1835. m_no2array.SetAt(idpos, SEPS_CMA + no + SEPS_CMA);
  1836. #endif //#ifdef USE_SEP_VEB
  1837. }
  1838. printf("%s %d:%s\n\n", m_List3.GetItemText(idpos, 2), idpos, m_no2array.ElementAt(idpos));
  1839. }
  1840. m_bModify = 1;
  1841. if (bSel == 0 && m_SelectCategory == INDX_SEL && IsSelPhoto(path) == 0)
  1842. {// 取消选中;已选界面;
  1843. temp.Format("%d", iItem);
  1844. m_combo1.AddString(temp);
  1845. continue;
  1846. }
  1847. else if (bSel == 1 && m_SelectCategory == INDX_NOSEL)
  1848. {// 选中;未选界面;
  1849. temp.Format("%d", iItem);
  1850. m_combo1.AddString(temp);
  1851. continue;
  1852. }
  1853. else if (bSel == 1 && m_SelectCategory == INDX_DEL)
  1854. {// 选中;删除界面;
  1855. temp.Format("%d", iItem);
  1856. m_combo1.AddString(temp);
  1857. continue;
  1858. }
  1859. else if (bSel == 0 && m_SelectCategory == INDX_INTOALBUM && IsSelAlbumPhoto(path) == 0)
  1860. {// 取消选中;入册界面;
  1861. temp.Format("%d", iItem);
  1862. m_combo1.AddString(temp);
  1863. continue;
  1864. }
  1865. else if (bSel == 0 && m_SelectCategory == INDX_ENTRYPHASSE && IsSelDiskPhoto(path) == 0)
  1866. {// 取消选中;入底界面;
  1867. temp.Format("%d", iItem);
  1868. m_combo1.AddString(temp);
  1869. continue;
  1870. }
  1871. /////////////////////////
  1872. CString no;
  1873. no = pArray->ElementAt(iItem);
  1874. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  1875. no = no.Left(no.ReverseFind('.'));
  1876. no += GetSelName(no);
  1877. if(!m_OpenFolder)
  1878. iItem = iItem + m_vFolder.size();
  1879. m_List1.SetItemText(iItem, 0, no);
  1880. printf("选中项:%d\n", iItem);
  1881. }
  1882. // 从m_combo1尾部开始导出;
  1883. CArray<int, int>posarray;
  1884. for (int i = m_combo1.GetCount() - 1; i >= 0; i--)
  1885. {
  1886. m_combo1.GetLBText(i, temp);
  1887. posarray.Add(atoi(temp));
  1888. }
  1889. SortArray2(posarray);
  1890. if (posarray.GetSize())
  1891. {
  1892. CStringArray* pArray = NULL;
  1893. int folderNum = 0;
  1894. if(m_OpenFolder)
  1895. {
  1896. pArray = GetCurArray(m_SelectCategory, m_OpenFolder);
  1897. }
  1898. else
  1899. {
  1900. folderNum = m_vFolder.size();
  1901. pArray = GetCurArray(m_SelectCategory);
  1902. }
  1903. if (m_SelectCategory == INDX_SEL)
  1904. {// 当前界面:已选;
  1905. CStringArray* pNolSelArray = NULL;
  1906. if(m_OpenFolder)
  1907. pNolSelArray = GetCurArray(INDX_NOSEL, m_OpenFolder);
  1908. else
  1909. pNolSelArray = GetCurArray(INDX_NOSEL);
  1910. for (int i = 0; i < posarray.GetSize(); i++)
  1911. {
  1912. // 从已选中移除取消选中的项;
  1913. if ( m_List1.GetItemCount() <= posarray.ElementAt(i) + folderNum)
  1914. printf("\t当前界面m_List1.GetItemCount个数少于选中个数,严重错误[越界]\n");
  1915. printf("\t当前要删除的Item索引=%d\n", posarray.ElementAt(i) + folderNum);
  1916. m_List1.DeleteItem(posarray.ElementAt(i) + folderNum);
  1917. // 将取消选中的项添加到未选中;
  1918. pNolSelArray->Add(pArray->ElementAt(posarray.ElementAt(i) - folderNum));
  1919. // 移除取消选中的项;
  1920. if ( pArray->GetSize() <= posarray.ElementAt(i) - folderNum)
  1921. printf("\t当前界面pArray.GetSize个数少于选中个数,严重错误[越界]\n");
  1922. pArray->RemoveAt(posarray.ElementAt(i) - folderNum); // 多选的状态下,如果不是从尾部开始RemoveAt可能会产生错误;
  1923. }
  1924. if (m_showpichwd)
  1925. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  1926. }
  1927. else if (m_SelectCategory == INDX_NOSEL)
  1928. {// 当前界面:未选;
  1929. for (int i = 0; i < posarray.GetSize(); i++)
  1930. {
  1931. // 从已选中移除取消选中的项;
  1932. if ( m_List1.GetItemCount() <= posarray.ElementAt(i) + folderNum)
  1933. printf("\t当前界面m_List1.GetItemCount个数少于选中个数,严重错误[越界]\n");
  1934. printf("\t当前要删除的Item索引=%d\n", posarray.ElementAt(i) + folderNum);
  1935. m_List1.DeleteItem(posarray.ElementAt(i) + folderNum);
  1936. if ( pArray->GetSize() <= posarray.ElementAt(i) - folderNum)
  1937. printf("\t当前界面pArray.GetSize个数少于选中个数,严重错误[越界]\n");
  1938. pArray->RemoveAt(posarray.ElementAt(i) - folderNum);
  1939. }
  1940. if (m_showpichwd)
  1941. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  1942. }
  1943. else if (m_SelectCategory == INDX_DEL)
  1944. {// 当前界面:删除;
  1945. CString strDelNo = _T("");
  1946. CStringArray* pAllArray = NULL;
  1947. if(m_OpenFolder)
  1948. pAllArray = GetCurArray(INDX_ALL, m_OpenFolder);
  1949. else
  1950. pAllArray = GetCurArray(INDX_ALL);
  1951. for (int i = 0; i < posarray.GetSize(); i++)
  1952. {
  1953. if ( m_List1.GetItemCount() <= posarray.ElementAt(i) + folderNum)
  1954. printf("\t当前界面m_List1.GetItemCount个数少于选中个数,严重错误[越界]\n");
  1955. printf("\t当前要删除的Item索引=%d\n", posarray.ElementAt(i) + folderNum);
  1956. // 获取要被删除的相片编号;
  1957. strDelNo = SEPS_VEB + m_List1.GetItemText(posarray.ElementAt(i) + folderNum,0) + SEPS_VEB;
  1958. if ( m_delphotos.Find(strDelNo) != -1 )
  1959. {
  1960. int nDelPos = m_delphotos.Find(strDelNo);
  1961. m_delphotos.Delete(nDelPos, strDelNo.GetLength() - 1);
  1962. printf("\t当前删除的相片编号:[%s] \n\t剩余删除列表:%s\n", strDelNo, m_delphotos);
  1963. }
  1964. else
  1965. {
  1966. printf("错误:要删除的相片编号[%s]未在删除列表中[%s]\n", strDelNo, m_delphotos);
  1967. }
  1968. m_List1.DeleteItem(posarray.ElementAt(i) + folderNum);
  1969. pAllArray->Add(pArray->ElementAt(posarray.ElementAt(i)));
  1970. if ( pArray->GetSize() <= posarray.ElementAt(i) - folderNum)
  1971. printf("\t当前界面pArray.GetSize个数少于选中个数,严重错误[越界]\n");
  1972. pArray->RemoveAt(posarray.ElementAt(i));
  1973. }
  1974. if (m_showpichwd)
  1975. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  1976. }
  1977. else if (m_SelectCategory == INDX_INTOALBUM)
  1978. {// 当前界面:入册;
  1979. for (int i = 0; i < posarray.GetSize(); i++)
  1980. {
  1981. if ( m_List1.GetItemCount() <= posarray.ElementAt(i) + folderNum)
  1982. printf("\t当前界面m_List1.GetItemCount个数少于选中个数,严重错误[越界]\n");
  1983. printf("\t当前要删除的Item索引=%d\n", posarray.ElementAt(i) + folderNum);
  1984. m_List1.DeleteItem(posarray.ElementAt(i) + folderNum);
  1985. if ( pArray->GetSize() <= posarray.ElementAt(i) - folderNum)
  1986. printf("\t当前界面pArray.GetSize个数少于选中个数,严重错误[越界]\n");
  1987. pArray->RemoveAt(posarray.ElementAt(i) - folderNum);
  1988. }
  1989. if (m_showpichwd)
  1990. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  1991. }
  1992. else if (m_SelectCategory == INDX_ENTRYPHASSE)
  1993. {// 当前界面:入底;
  1994. for (int i = 0; i < posarray.GetSize(); i++)
  1995. {
  1996. if ( m_List1.GetItemCount() <= posarray.ElementAt(i) + folderNum)
  1997. printf("\t当前界面m_List1.GetItemCount个数少于选中个数,严重错误[越界]\n");
  1998. printf("\t当前要删除的Item索引=%d\n", posarray.ElementAt(i) + folderNum);
  1999. m_List1.DeleteItem(posarray.ElementAt(i) + folderNum);
  2000. if ( pArray->GetSize() <= posarray.ElementAt(i) - folderNum)
  2001. printf("\t当前界面pArray.GetSize个数少于选中个数,严重错误[越界]\n");
  2002. pArray->RemoveAt(posarray.ElementAt(i) - folderNum);
  2003. }
  2004. if (m_showpichwd)
  2005. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  2006. }
  2007. }
  2008. CString strFile = m_strOrderNumber + _T(".dat");
  2009. Save(g_mainpath, strFile);
  2010. DrawInterface();
  2011. if (m_showpichwd)
  2012. ::SendMessage(m_showpichwd, WM_USER + 200, 0, 0);
  2013. }
  2014. VOID ChoosePhotoSkin2::OnNewFolder()
  2015. {
  2016. //新建文件夹
  2017. CNewFolderDlg dlg;
  2018. dlg.m_pVFolder = &m_vFolder;
  2019. if(dlg.DoModal() != IDOK)
  2020. return ;
  2021. m_bModify = 1;
  2022. AddFolder(dlg.m_strFolderName);
  2023. LoadPhotos();
  2024. return ;
  2025. }
  2026. VOID ChoosePhotoSkin2::OnDelFolder()
  2027. {
  2028. if(AfxMessageBox(_T("是否删除选中的文件夹!"), MB_YESNO | MB_ICONINFORMATION) == IDNO)
  2029. return ;
  2030. //删除文件夹
  2031. if(m_pCurrSelFolder)
  2032. {
  2033. //相片由子移到主
  2034. MoveFileSubToMain(m_pCurrSelFolder);
  2035. DelFolderFromName(m_pCurrSelFolder->strName);
  2036. m_pCurrSelFolder = NULL;
  2037. LoadPhotos();
  2038. }
  2039. return;
  2040. }
  2041. VOID ChoosePhotoSkin2::OnOpenFolder()
  2042. {
  2043. printf("IDM_OPENFOLDER\n");
  2044. //打开文件夹
  2045. m_OpenFolder = m_pCurrSelFolder;
  2046. if(m_SelectCategory == INDX_INTOALBUM)
  2047. GetAlbumPhoto();
  2048. else if(m_SelectCategory == INDX_ENTRYPHASSE)
  2049. GetDiskPhoto();
  2050. LoadPhotos();
  2051. }
  2052. VOID ChoosePhotoSkin2::OnReturnMainDir()
  2053. {
  2054. //返回上层
  2055. m_pCurrSelFolder = m_OpenFolder = NULL;
  2056. if (m_SelectCategory == INDX_SEL)
  2057. UpdateChooseZS();
  2058. else if(m_SelectCategory == INDX_NOSEL)
  2059. {
  2060. m_sChooseFilter = _T("");
  2061. UpdateChooseZS();
  2062. GetNoSelPhoto();
  2063. }
  2064. LoadPhotos();
  2065. }
  2066. long ChoosePhotoSkin2::UpdateTakeZS(WPARAM inWParam, LPARAM inLParam)
  2067. {
  2068. if (m_SelectCategory == INDX_ALL && m_List1.GetItemCount() > atoi(m_takezs))
  2069. {
  2070. UpdateData();
  2071. m_takezs.Format("%d", m_List1.GetItemCount());
  2072. UpdateData(false);
  2073. }
  2074. //绘制
  2075. DrawInterface();
  2076. return 1;
  2077. }
  2078. /************************************************************************/
  2079. /*
  2080. 函数: UpdateChooseZS
  2081. 描述: 更新选中相片
  2082. 参数:
  2083. 返回:
  2084. 注意:
  2085. */
  2086. /************************************************************************/
  2087. void ChoosePhotoSkin2::UpdateChooseZS()
  2088. {
  2089. int i = 0;
  2090. CString str = _T("");
  2091. CStringArray* pSelArr = NULL;
  2092. CStringArray* pAllArr = NULL;
  2093. if(m_OpenFolder)
  2094. pSelArr = GetCurArray(INDX_SEL, m_OpenFolder);
  2095. else
  2096. pSelArr = GetCurArray(INDX_SEL);
  2097. if(m_OpenFolder)
  2098. pAllArr = GetCurArray(INDX_ALL, m_OpenFolder);
  2099. else
  2100. pAllArr = GetCurArray(INDX_ALL);
  2101. pSelArr->RemoveAll();
  2102. if (m_sChooseFilter != _T("") && m_sChooseFilter != _T("全部"))
  2103. {
  2104. #if 0
  2105. for ( i = 0; i < m_List3.GetItemCount(); i++)
  2106. {
  2107. if (m_List3.GetItemText(i, 2) != m_sChooseFilter)
  2108. continue;
  2109. str = m_no2array.ElementAt(i);
  2110. GetPathAddToSel(pSelArr, str, pAllArr);
  2111. }
  2112. #else
  2113. if ( m_List3.GetItemText(m_nSelGoodsIndex, 2) == m_sChooseFilter )
  2114. {
  2115. str = m_no2array.ElementAt(m_nSelGoodsIndex);
  2116. GetPathAddToSel(pSelArr, str, pAllArr);
  2117. }
  2118. #endif
  2119. return;
  2120. }
  2121. for ( i = 0; i < m_noarray.GetSize(); i++)
  2122. {
  2123. str = m_noarray.ElementAt(i);
  2124. GetPathAddToSel(pSelArr, str, pAllArr);
  2125. }
  2126. for (i = 0; i < m_no2array.GetSize(); i++)
  2127. {
  2128. str = m_no2array.ElementAt(i);
  2129. GetPathAddToSel(pSelArr, str, pAllArr);
  2130. }
  2131. }
  2132. // 保存按钮;
  2133. void ChoosePhotoSkin2::OnButton4()// 保存按钮;
  2134. {
  2135. UpdateData();
  2136. if (m_SelectCategory != INDX_SEL)
  2137. CalChooseZS(&m_SelPhotoPath, &m_AllPhotoPath);
  2138. CString zs = m_taoxizs;
  2139. int pos = zs.Find("\\");
  2140. if (pos != -1)
  2141. zs = zs.Left(pos);
  2142. CStringArray* parr = NULL;
  2143. CStringArray* pAllArr = NULL;
  2144. int nSelCount = 0;
  2145. vector<SFolderInfo*>::iterator iter = m_vFolder.begin();
  2146. while(iter != m_vFolder.end())
  2147. {
  2148. SFolderInfo* p = (*iter);
  2149. if(p != NULL)
  2150. {
  2151. pAllArr = GetCurArray(INDX_ALL, p);
  2152. parr = GetCurArray(INDX_SEL, p);
  2153. CalChooseZS(parr, pAllArr);
  2154. nSelCount += parr->GetSize();
  2155. }
  2156. ++iter;
  2157. }
  2158. nSelCount += m_SelPhotoPath.GetSize();
  2159. m_choosezs.Format("%d", max(0, nSelCount - atoi(zs)));
  2160. m_bSaveFail = 0;
  2161. ChoosePhotoSkin3 dlg;
  2162. dlg.m_strStatusOfChoosePhoto = m_strStatusOfChoosePhoto; // Jeff 传选片状态;
  2163. dlg.m_pParent = this;
  2164. dlg.DoModal();
  2165. if (dlg.m_bSave)
  2166. m_bModify = 0;
  2167. if (dlg.m_bPushedSave == 0 && dlg.m_bSaveFail == 0)
  2168. {
  2169. CString savepath = _T("");
  2170. savepath.Format("%s\\%s.dat", g_mainpath, m_strOrderNumber);
  2171. ::DeleteFile(savepath); // 删除*.dat文件;
  2172. }
  2173. m_bSaveFail = dlg.m_bSaveFail;
  2174. if (dlg.m_bExit)
  2175. {
  2176. m_bModify = 0;
  2177. CDialog::OnCancel();
  2178. }
  2179. }
  2180. // 删除相片;
  2181. BOOL ChoosePhotoSkin2::OnDel() // 删除相片;
  2182. {
  2183. // printf("Jeff:m_mode=%d,m_mode2=%d.\n\n",m_mode,m_mode2);//Jeff Printf
  2184. if (m_SelectCategory == INDX_SEL)
  2185. {// 当前界面:选中界面;
  2186. AfxMessageBox(_T("选中照片不能删除, 请先取消选中状态!"), MB_ICONINFORMATION);
  2187. return 0;
  2188. }
  2189. else if (m_SelectCategory == INDX_DEL)
  2190. {// 当前界面:删除;
  2191. return 0;
  2192. }
  2193. POSITION pos;
  2194. pos = m_List1.GetFirstSelectedItemPosition();
  2195. if (pos == NULL)
  2196. return 0;
  2197. if (m_bRunning)
  2198. return 0;
  2199. CStringArray* pArray = NULL;
  2200. CString strDelPhotoName = _T("");
  2201. CString strSelPhotoPath = _T("");
  2202. int nFolderNum = m_vFolder.size();
  2203. int iItem = m_List1.GetNextSelectedItem(pos);
  2204. int nItemIdx = iItem;
  2205. //选片模式;
  2206. if(m_OpenFolder == NULL)
  2207. {
  2208. pArray = GetCurArray(m_SelectCategory);
  2209. if(nItemIdx < m_vFolder.size())
  2210. {
  2211. //删除选取文件夹;
  2212. if(AfxMessageBox(_T("是否删除选中的文件夹!"), MB_YESNO | MB_ICONINFORMATION) == IDNO)
  2213. return 0;
  2214. m_pCurrSelFolder = FindForderFromIndx(iItem);
  2215. if(m_pCurrSelFolder)
  2216. {
  2217. m_bModify = 1;
  2218. //相片由子移到主;
  2219. MoveFileSubToMain(m_pCurrSelFolder);
  2220. DelFolderFromName(m_pCurrSelFolder->strName);
  2221. m_pCurrSelFolder = NULL;
  2222. LoadPhotos();
  2223. }
  2224. return 0;
  2225. }
  2226. else
  2227. nItemIdx = nItemIdx - m_vFolder.size();
  2228. }
  2229. else
  2230. pArray = GetCurArray(INDX_ALL, m_OpenFolder);
  2231. strSelPhotoPath = pArray->ElementAt(nItemIdx);
  2232. strDelPhotoName = strSelPhotoPath;
  2233. if(strDelPhotoName == _T("") || pArray == NULL)
  2234. return 0;
  2235. strDelPhotoName = strDelPhotoName.Right(strDelPhotoName.GetLength() - strDelPhotoName.ReverseFind('\\') - 1);
  2236. strDelPhotoName = strDelPhotoName.Left(strDelPhotoName.Find('.'));
  2237. if (IsSelPhoto(SEPS_VEB + strDelPhotoName + SEPS_VEB))
  2238. {
  2239. AfxMessageBox(_T("选中的照片不能删除, 请先取消选中状态!"), MB_ICONINFORMATION);
  2240. return 0;
  2241. }
  2242. if (AfxMessageBox(_T("是否删除此照片?"), MB_YESNO | MB_ICONINFORMATION) != IDYES)
  2243. return 0;
  2244. printf("\t要删除的相片编号:%s\n", strDelPhotoName);
  2245. // 将要删除的相片添加到删除数组里;
  2246. #if JEFF_TEST_ON
  2247. if(PathFileExists(strSelPhotoPath))
  2248. m_DelPhotoPath.Add(strSelPhotoPath);
  2249. #else
  2250. m_DelPhotoPath.Add(strSelPhotoPath);
  2251. #endif //#if JEFF_TEST_ON
  2252. if ( m_delphotos.Find(SEPS_VEB + strDelPhotoName + SEPS_VEB) != -1)
  2253. {
  2254. printf("\t错误,相片编号:%s 已在删除列表中\n", strDelPhotoName);
  2255. }
  2256. else
  2257. {// 将要删除的相片编号添加进去;
  2258. m_delphotos.TrimRight(SEPS_VEB);
  2259. m_delphotos += SEPS_VEB + strDelPhotoName + SEPS_VEB;
  2260. }
  2261. for(int i = 0; i < pArray->GetSize(); i++)
  2262. {
  2263. //字符串比较相同=0;
  2264. if(strSelPhotoPath.CollateNoCase(pArray->ElementAt(i)) == 0)
  2265. {
  2266. pArray->RemoveAt(i);
  2267. m_List1.DeleteItem(iItem);
  2268. break;
  2269. }
  2270. }
  2271. if(m_SelectCategory == INDX_NOSEL)
  2272. DelPhotoFromName(m_AllPhotoPath, strDelPhotoName);
  2273. m_bModify = 1;
  2274. //设置默认选项;
  2275. if(iItem >= pArray->GetSize())
  2276. iItem = 0;
  2277. m_List1.SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
  2278. return 1;
  2279. }
  2280. void ChoosePhotoSkin2::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
  2281. {
  2282. *pResult = 0;
  2283. }
  2284. void ChoosePhotoSkin2::OnTimer(UINT nIDEvent)
  2285. {
  2286. if (nIDEvent == 1)
  2287. {
  2288. KillTimer(nIDEvent);
  2289. if (m_showpichwd)
  2290. ::SendMessage(m_showpichwd, WM_USER + 200, 1, 0);
  2291. TimeOutDlg dlg;
  2292. dlg.m_ticks = m_ticks;
  2293. dlg.DoModal();
  2294. SetTimer(2, m_timer * 60000, NULL);
  2295. }
  2296. else if (nIDEvent == 2) // 定时器触发超时密码对话框;
  2297. {
  2298. KillTimer(nIDEvent);
  2299. if (m_showpichwd)
  2300. ::SendMessage(m_showpichwd, WM_USER + 200, 1, 0);
  2301. TimeOutDlg dlg;
  2302. dlg.m_ticks = m_ticks;
  2303. dlg.DoModal();
  2304. SetTimer(2, m_timer * 60000, NULL);
  2305. }
  2306. else if (nIDEvent == 3)
  2307. {
  2308. KillTimer(nIDEvent);
  2309. //SetSPName3();
  2310. }
  2311. }
  2312. /************************************************************************/
  2313. /*
  2314. 函数: LoadPhotos
  2315. 描述: 加载图片
  2316. 参数:
  2317. 返回:
  2318. */
  2319. /************************************************************************/
  2320. void ChoosePhotoSkin2::LoadPhotos()
  2321. {
  2322. TerminateThread();
  2323. //清除资源的路径;
  2324. ClearResData();
  2325. DWORD tm1(0), tm2(0);
  2326. tm1 = GetTickCount();
  2327. //选片;
  2328. CStringArray *pArray = NULL;
  2329. if(!m_OpenFolder)
  2330. {//在主目录;
  2331. //添加文件夹名;
  2332. vector<SFolderInfo*>::iterator iter = m_vFolder.begin();
  2333. for(;iter != m_vFolder.end();)
  2334. {
  2335. SFolderInfo* p = (*iter);
  2336. if(p != NULL)
  2337. {
  2338. SResData* pRes = new SResData();
  2339. pRes->nType = (int)TYPE_FOLDER;
  2340. //转为小写;
  2341. p->strName.MakeLower();
  2342. pRes->strName = p->strName;
  2343. m_vResData.push_back(pRes);
  2344. }
  2345. ++iter;
  2346. }
  2347. pArray = GetCurArray(m_SelectCategory);
  2348. }
  2349. else
  2350. pArray = GetCurArray(m_SelectCategory, m_OpenFolder);
  2351. if(pArray == NULL)
  2352. return;
  2353. for (int i = 0; i < pArray->GetSize(); i++)
  2354. {
  2355. CString filePath = pArray->ElementAt(i);
  2356. if(filePath == _T(""))
  2357. continue;
  2358. SResData* pRes = new SResData();
  2359. pRes->nType = (int)TYPE_ICON;
  2360. //转为小写;
  2361. filePath.MakeLower();
  2362. pRes->strFilePath = filePath;
  2363. m_vResData.push_back(pRes);
  2364. }
  2365. tm2 = GetTickCount();
  2366. printf(_T("绘制图片的准备时间:%dms\n"), (tm2-tm1));
  2367. //创建绘画线程LoadThumbNail3;
  2368. LoadThumbImages();
  2369. }
  2370. /************************************************************************/
  2371. /*
  2372. 函数: GetNoSelPhoto
  2373. 描述: 未选中的相片
  2374. 参数:
  2375. 返回:
  2376. 注意:
  2377. */
  2378. /************************************************************************/
  2379. void ChoosePhotoSkin2::GetNoSelPhoto()
  2380. {
  2381. CStringArray* pNoSelArr = NULL;
  2382. CStringArray* pAllArr = NULL;
  2383. CStringArray* pSelArr = NULL;
  2384. if(m_OpenFolder)
  2385. {
  2386. pNoSelArr = GetCurArray(INDX_NOSEL, m_OpenFolder);
  2387. pAllArr = GetCurArray(INDX_ALL, m_OpenFolder);
  2388. pSelArr = GetCurArray(INDX_SEL, m_OpenFolder);
  2389. }
  2390. else
  2391. {
  2392. pNoSelArr = GetCurArray(INDX_NOSEL);
  2393. pAllArr = GetCurArray(INDX_ALL);
  2394. pSelArr = GetCurArray(INDX_SEL);
  2395. }
  2396. if(pNoSelArr == NULL || pAllArr == NULL || pSelArr == NULL)
  2397. return;
  2398. pNoSelArr->RemoveAll();
  2399. CString str1(_T("")), str2(_T(""));
  2400. for (int i = 0; i < pAllArr->GetSize(); i++)
  2401. {
  2402. BOOL bFind = 0;
  2403. for (int j = 0; j < pSelArr->GetSize(); j++)
  2404. {
  2405. str1 = pAllArr->ElementAt(i);
  2406. str2 = pSelArr->ElementAt(j);
  2407. if (str1.CollateNoCase(str2) == 0)
  2408. {
  2409. bFind = 1;
  2410. break;
  2411. }
  2412. }
  2413. if (bFind == 0)
  2414. pNoSelArr->Add(pAllArr->ElementAt(i));
  2415. }
  2416. }
  2417. /************************************************************************/
  2418. /*
  2419. 函数: OnSelPhoto
  2420. 描述: 查看选中相片
  2421. 参数:
  2422. 返回:
  2423. 注意:
  2424. */
  2425. /************************************************************************/
  2426. void ChoosePhotoSkin2::OnSelPhoto()
  2427. {
  2428. ProductChooseFilter dlg;
  2429. CString name = _T("");
  2430. int i = 0;
  2431. for ( i = 0; i < m_List2.GetItemCount(); i++)
  2432. {
  2433. name = m_List2.GetItemText(i, 2);
  2434. dlg.m_array.Add(name);
  2435. }
  2436. for (i = 0; i < m_List3.GetItemCount(); i++)
  2437. {
  2438. name = m_List3.GetItemText(i, 2);
  2439. dlg.m_array.Add(name);
  2440. }
  2441. if(dlg.DoModal() == IDCANCEL)
  2442. {
  2443. m_SelectCategory = INDX_ALL;
  2444. return;
  2445. }
  2446. m_nSelGoodsIndex = dlg.m_nSelIndex-1;
  2447. m_sChooseFilter = dlg.m_sChooseFilter;
  2448. UpdateChooseZS();
  2449. }
  2450. /************************************************************************/
  2451. /*
  2452. 函数: GetCurArray
  2453. 描述: 获取要查看的数据
  2454. 参数:
  2455. const int nIndx 选中数据索引
  2456. SFolderInfo* m_pForder 文件夹
  2457. 返回:
  2458. 注意:
  2459. */
  2460. /************************************************************************/
  2461. CStringArray* ChoosePhotoSkin2::GetCurArray(const int nIndx, SFolderInfo* m_pForder/* = NULL*/)
  2462. {
  2463. CStringArray* pArray = NULL;
  2464. if(m_pForder)
  2465. {
  2466. switch (nIndx)
  2467. {
  2468. case INDX_ALL: //全部;
  2469. pArray = &m_pForder->AllPhotoPath;
  2470. break;
  2471. case INDX_SEL: //选中;
  2472. pArray = &m_pForder->SelPhotoPath;
  2473. break;
  2474. case INDX_NOSEL: //未选;
  2475. pArray = &m_pForder->NoSelPhotoPath;
  2476. break;
  2477. case INDX_DEL: //删除;
  2478. pArray = &m_pForder->DelPhotoPath;
  2479. break;
  2480. case INDX_INTOALBUM: //入册;
  2481. pArray = &m_pForder->IntoAlbumPath;
  2482. break;
  2483. case INDX_ENTRYPHASSE: //入底;
  2484. pArray = &m_pForder->EntryPhasepath;
  2485. break;
  2486. }
  2487. return pArray;
  2488. }
  2489. switch (nIndx)
  2490. {
  2491. case INDX_ALL: //全部;
  2492. pArray = &m_AllPhotoPath;
  2493. break;
  2494. case INDX_SEL: //选中;
  2495. pArray = &m_SelPhotoPath;
  2496. break;
  2497. case INDX_NOSEL: //未选;
  2498. pArray = &m_NoSelPhotoPath;
  2499. break;
  2500. case INDX_DEL: //删除;
  2501. pArray = &m_DelPhotoPath;
  2502. break;
  2503. case INDX_INTOALBUM: //入册;
  2504. pArray = &m_IntoAlbumPath;
  2505. break;
  2506. case INDX_ENTRYPHASSE: //入底;
  2507. pArray = &m_EntryPhasepath;
  2508. break;
  2509. }
  2510. return pArray;
  2511. }
  2512. // path如:"|004|"
  2513. BOOL ChoosePhotoSkin2::IsSelAlbumPhoto(CString path)
  2514. {
  2515. CString photosno;
  2516. for (int i = 0; i < m_List3.GetItemCount(); i++)
  2517. {
  2518. if (m_List3.GetItemText(i, 2) != _T("入册"))
  2519. continue;
  2520. photosno = m_no2array.ElementAt(i);
  2521. break;
  2522. }
  2523. if (photosno.Find(path) != -1)
  2524. {
  2525. return 1;
  2526. }
  2527. return 0;
  2528. }
  2529. // path 如:"|004|"
  2530. BOOL ChoosePhotoSkin2::IsSelDiskPhoto(CString path)
  2531. {
  2532. CString photosno;
  2533. for (int i = 0; i < m_List3.GetItemCount(); i++)
  2534. {
  2535. if (m_List3.GetItemText(i, 2) != _T("入底"))
  2536. continue;
  2537. photosno = m_no2array.ElementAt(i);
  2538. break;
  2539. }
  2540. if (photosno.Find(path) != -1)
  2541. {
  2542. return 1;
  2543. }
  2544. return 0;
  2545. }
  2546. /************************************************************************/
  2547. /*
  2548. 函数: SortArray
  2549. 描述: 按F4乱序或排序
  2550. 参数:
  2551. 返回:
  2552. */
  2553. /************************************************************************/
  2554. void ChoosePhotoSkin2::SortArray()
  2555. {
  2556. int i = 0;
  2557. int j = 0;
  2558. m_bSort = !m_bSort;
  2559. CStringArray *pArray[6] = { &m_AllPhotoPath, &m_SelPhotoPath, &m_NoSelPhotoPath, &m_DelPhotoPath, &m_IntoAlbumPath, &m_EntryPhasepath };
  2560. if (m_bSort == 0)
  2561. {
  2562. for ( i = 0; i < 6; i++)
  2563. {
  2564. if (pArray[i]->GetSize())
  2565. {
  2566. int size = pArray[i]->GetSize() - 1;
  2567. CString sTemp;
  2568. int nPos;
  2569. for (int ii = 0; ii < size; ii++)
  2570. {
  2571. nPos = rand() % (size - ii);
  2572. sTemp = pArray[i]->ElementAt(size - ii);
  2573. pArray[i]->SetAt(size - ii, pArray[i]->ElementAt(nPos));
  2574. pArray[i]->SetAt(nPos, sTemp);
  2575. }
  2576. }
  2577. }
  2578. }
  2579. else
  2580. { // 使用CCombobox的Sort来排序;
  2581. for ( i = 0; i < 6; i++)
  2582. {
  2583. m_combo1.ResetContent();
  2584. CString Temp;
  2585. for ( j = 0; j < pArray[i]->GetSize(); j++)
  2586. {
  2587. m_combo1.AddString(pArray[i]->ElementAt(j));
  2588. }
  2589. for (j = 0; j < pArray[i]->GetSize(); j++)
  2590. {
  2591. m_combo1.GetLBText(j, Temp);
  2592. pArray[i]->SetAt(j, Temp);
  2593. }
  2594. }
  2595. }
  2596. //终止线程;
  2597. TerminateThread();
  2598. //清除资源的路径;
  2599. ClearResData();
  2600. CStringArray *pArr = NULL;
  2601. //选片;
  2602. if(!m_OpenFolder)
  2603. {//在主目录;
  2604. //添加文件夹名;
  2605. vector<SFolderInfo*>::iterator iter = m_vFolder.begin();
  2606. for(;iter != m_vFolder.end();)
  2607. {
  2608. SFolderInfo* p = (*iter);
  2609. if(p != NULL)
  2610. {
  2611. SResData* pRes = new SResData();
  2612. pRes->nType = (int)TYPE_FOLDER;
  2613. //转为小写;
  2614. p->strName.MakeLower();
  2615. pRes->strName = p->strName;
  2616. m_vResData.push_back(pRes);
  2617. }
  2618. ++iter;
  2619. }
  2620. pArr = GetCurArray(m_SelectCategory);
  2621. }
  2622. else
  2623. pArr = GetCurArray(INDX_ALL, m_OpenFolder);
  2624. if(pArr == NULL)
  2625. return;
  2626. for ( i = 0; i < pArr->GetSize(); i++)
  2627. {
  2628. SResData* pRes = new SResData();
  2629. pRes->nType = (int)TYPE_ICON;
  2630. CString filePath = pArr->ElementAt(i);
  2631. //转为小写;
  2632. filePath.MakeLower();
  2633. pRes->strFilePath = filePath;
  2634. m_vResData.push_back(pRes);
  2635. }
  2636. //创建绘画线程LoadThumbNail3;
  2637. LoadThumbImages();
  2638. }
  2639. /************************************************************************/
  2640. /*
  2641. 函数: CheckForDisk
  2642. 描述: 检查入底
  2643. 参数:
  2644. 返回:
  2645. */
  2646. /************************************************************************/
  2647. void ChoosePhotoSkin2::CheckForDisk()
  2648. {
  2649. int i = 0;
  2650. for ( i = 0; i < m_List2.GetItemCount(); i++)
  2651. {
  2652. if (_T("入底") == m_List2.GetItemText(i, 2))
  2653. return;
  2654. }
  2655. for (i = 0; i < m_List3.GetItemCount(); i++)
  2656. {
  2657. if (_T("入底") == m_List3.GetItemText(i, 2))
  2658. return;
  2659. }
  2660. i = m_List3.GetItemCount();
  2661. m_List3.InsertItem(i, _T(""));
  2662. m_List3.SetItemText(i, 2, _T("入底"));
  2663. m_no2array.Add(_T(""));
  2664. }
  2665. /************************************************************************/
  2666. /*
  2667. 函数: CheckForAlbum
  2668. 描述: 检查入册
  2669. 参数:
  2670. 返回:
  2671. */
  2672. /************************************************************************/
  2673. void ChoosePhotoSkin2::CheckForAlbum()
  2674. {
  2675. int i = 0;
  2676. for (i = 0; i < m_List2.GetItemCount(); i++)
  2677. {
  2678. if (_T("入册") == m_List2.GetItemText(i, 2))
  2679. return;
  2680. }
  2681. for (i = 0; i < m_List3.GetItemCount(); i++)
  2682. {
  2683. if (_T("入册") == m_List3.GetItemText(i, 2))
  2684. return;
  2685. }
  2686. i = m_List3.GetItemCount();
  2687. m_List3.InsertItem(i, _T(""));
  2688. m_List3.SetItemText(i, 2, _T("入册"));
  2689. m_no2array.Add(_T(""));
  2690. }
  2691. /*-------------------------------------------------------
  2692. 函数名: DrawInterface
  2693. 描述: 绘制界面
  2694. 参数:
  2695. 返回值:
  2696. -------------------------------------------------------*/
  2697. void ChoosePhotoSkin2::DrawInterface()
  2698. {
  2699. CRect rc(0, 0, 0, 0), rt(0, 0, 0, 0);
  2700. ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
  2701. ScreenToClient(rc);
  2702. int nH = rc.bottom - rc.top;
  2703. rc.right -= (rc.left + 100);
  2704. rc.left = 5;
  2705. rc.top += 10;
  2706. rc.right += 220;
  2707. rc.bottom = rc.top + nH - 10;
  2708. rt.CopyRect(&rc);
  2709. CDC *pDC = GetDC();
  2710. Graphics graph(pDC->GetSafeHdc());
  2711. Rect destinationRect(rc.left, rc.top, rc.Width(), rc.Height());
  2712. RectF layoutRect(rc.left, rc.top, rc.Width(), rc.Height());
  2713. rc.left /= g_fscalex;
  2714. rc.right /= g_fscalex;
  2715. rc.top /= g_fscaley;
  2716. rc.bottom /= g_fscaley;
  2717. // graph.SetSmoothingMode(SmoothingModeHighQuality);
  2718. graph.DrawImage(m_pBk, destinationRect, rc.left, rc.top, rc.Width(), rc.Height(), UnitPixel);
  2719. StringFormat format;
  2720. format.SetAlignment(StringAlignmentNear);
  2721. SolidBrush *Brush = new SolidBrush(Color(255, 255, 255, 255));
  2722. //显示张数
  2723. CString str = _T("");
  2724. if(m_OpenFolder == NULL && m_List1.GetItemCount() >= m_vFolder.size())
  2725. str.Format(_T("张数:%d"), m_List1.GetItemCount() - m_vFolder.size());
  2726. else
  2727. str.Format(_T("张数:%d"), m_List1.GetItemCount());
  2728. //显示文件夹名
  2729. str += _T(" 主目录");
  2730. if(m_OpenFolder)
  2731. str += _T(">") + m_OpenFolder->strName;
  2732. int leng = GetLengthEx(str);
  2733. BSTR bstr = str.AllocSysString();
  2734. Gdiplus::Font* pFont = new Gdiplus::Font(L"黑体", 11);
  2735. graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
  2736. graph.DrawString(
  2737. bstr,
  2738. leng,
  2739. pFont,
  2740. layoutRect,
  2741. &format,
  2742. Brush);
  2743. SysFreeString(bstr);
  2744. delete Brush;
  2745. delete pFont;
  2746. ReleaseDC(pDC);
  2747. }
  2748. CString ChoosePhotoSkin2::GetZSInfo(int iItem)
  2749. {
  2750. if (m_SelectCategory != INDX_SEL)
  2751. CalChooseZS(GetCurArray(INDX_SEL), GetCurArray(INDX_ALL));
  2752. CString str = _T("");
  2753. CString scount = m_List1.GetItemText(iItem, 0);
  2754. int ncount = 0;
  2755. int npos = scount.Find(_T("\r\n"));
  2756. while (npos != -1)
  2757. {
  2758. ncount++;
  2759. scount = scount.Right(scount.GetLength() - npos - 2);
  2760. npos = scount.Find(_T("\r\n"));
  2761. }
  2762. CString zs = m_taoxizs;
  2763. int pos = zs.Find("\\");
  2764. if (pos != -1)
  2765. zs = zs.Left(pos);
  2766. CStringArray* pSelPhotoPath = GetCurArray(INDX_SEL);
  2767. CStringArray* pAllPhotoPath = GetCurArray(INDX_ALL);
  2768. int nNoSelCount = GetNoSelPhotoCount(pAllPhotoPath, pSelPhotoPath);
  2769. int nSelCount = pSelPhotoPath->GetSize();
  2770. str.Format(_T("选中次数:%d 已选/应选:%d/%d\r\n加选:%d+ 未选/剩余:%d/%d"), ncount, nSelCount, atoi(zs), max(0, nSelCount - atoi(zs)), max(0, atoi(zs) - nSelCount), nNoSelCount);
  2771. return str;
  2772. }
  2773. /************************************************************************/
  2774. /*
  2775. 函数: GetPathAddToSel
  2776. 描述: 获取路径添加到选中相片
  2777. 参数:
  2778. strName:dindansp表中no或no2字段值;相片名间使用逗号分隔;
  2779. 返回: 1成功,0失败
  2780. */
  2781. /************************************************************************/
  2782. int ChoosePhotoSkin2::GetPathAddToSel(const CString& strName)
  2783. {
  2784. if(strName == _T(""))
  2785. return 0;
  2786. CStringArray* pSelArr = NULL;
  2787. CStringArray* pAllArr = NULL;
  2788. if(m_OpenFolder != NULL)
  2789. {
  2790. pSelArr = GetCurArray(INDX_SEL, m_OpenFolder);
  2791. pAllArr = GetCurArray(INDX_ALL, m_OpenFolder);
  2792. }
  2793. else
  2794. {
  2795. pSelArr = GetCurArray(INDX_SEL);
  2796. pAllArr = GetCurArray(INDX_ALL);
  2797. }
  2798. GetPathAddToSel(pSelArr, strName, pAllArr);
  2799. return 1;
  2800. }
  2801. /************************************************************************/
  2802. /*
  2803. 函数: GetPathAddToSel
  2804. 描述: 获取路径添加到选中相片
  2805. 参数:
  2806. CStringArray* pSelArr
  2807. const CString& str
  2808. 返回: 1成功,0失败
  2809. */
  2810. /************************************************************************/
  2811. int ChoosePhotoSkin2::GetPathAddToSel(CStringArray* pSelArr, const CString& strName, CStringArray* pAllArr)
  2812. {
  2813. return ChoosePhotoBase::GetPathAddToSel(pSelArr, strName, pAllArr);
  2814. }
  2815. /************************************************************************/
  2816. /*
  2817. 函数: GetAlbumPhoto
  2818. 描述: 查看入册相片
  2819. 参数:
  2820. 返回:
  2821. */
  2822. /************************************************************************/
  2823. void ChoosePhotoSkin2::GetAlbumPhoto()
  2824. {
  2825. if (m_SelectCategory == INDX_INTOALBUM && !m_OpenFolder)
  2826. return;
  2827. m_SelectCategory = INDX_INTOALBUM;
  2828. CStringArray* pArr = NULL;
  2829. if(m_OpenFolder)
  2830. pArr = GetCurArray(m_SelectCategory, m_OpenFolder);
  2831. else
  2832. pArr = GetCurArray(m_SelectCategory);
  2833. pArr->RemoveAll();
  2834. CString photosName = _T("");
  2835. int i = 0;
  2836. for (i= 0; i < m_List3.GetItemCount(); i++)
  2837. {
  2838. if (m_List3.GetItemText(i, 2) != _T("入册"))
  2839. continue;
  2840. photosName = m_no2array.ElementAt(i);
  2841. break;
  2842. }
  2843. CStringArray* pAllArry = NULL;
  2844. if(m_OpenFolder != NULL)
  2845. pAllArry = GetCurArray(INDX_ALL, m_OpenFolder);
  2846. else
  2847. pAllArry = GetCurArray(INDX_ALL);
  2848. //将入册的相片名
  2849. #ifdef USE_SEP_VEB
  2850. photosName = SEPS_VEB + photosName + SEPS_VEB;
  2851. #else
  2852. photosName = SEPS_CMA + photosName + SEPS_CMA;
  2853. #endif //#ifdef USE_SEP_VEB
  2854. for (i = pAllArry->GetSize() - 1; i >= 0; i--)
  2855. {
  2856. CString strName = _T("");
  2857. strName = pAllArry->ElementAt(i);
  2858. strName = strName.Right(strName.GetLength() - strName.ReverseFind('\\') - 1);
  2859. strName = strName.Left(strName.ReverseFind('.'));
  2860. #ifdef USE_SEP_VEB
  2861. strName = SEPS_VEB + strName + SEPS_VEB;
  2862. #else
  2863. strName = SEPS_CMA + strName + SEPS_CMA;
  2864. #endif //#ifdef USE_SEP_VEB
  2865. if (photosName.Find(strName) != -1)
  2866. {
  2867. strName = pAllArry->ElementAt(i);
  2868. pArr->Add(strName);
  2869. }
  2870. }
  2871. }
  2872. /************************************************************************/
  2873. /*
  2874. 函数: GetDiskPhoto
  2875. 描述: 查看入底相片
  2876. 参数:
  2877. 返回:
  2878. */
  2879. /************************************************************************/
  2880. void ChoosePhotoSkin2::GetDiskPhoto()
  2881. {
  2882. if (m_SelectCategory == INDX_ENTRYPHASSE && !m_OpenFolder)
  2883. return;
  2884. m_SelectCategory = INDX_ENTRYPHASSE;
  2885. CStringArray* pArr = NULL;
  2886. if(m_OpenFolder)
  2887. pArr = GetCurArray(m_SelectCategory, m_OpenFolder);
  2888. else
  2889. pArr = GetCurArray(m_SelectCategory);
  2890. int i = 0;
  2891. pArr->RemoveAll();
  2892. CString photosName = _T("");
  2893. for ( i = 0; i < m_List3.GetItemCount(); i++)
  2894. {
  2895. if (m_List3.GetItemText(i, 2) != _T("入底"))
  2896. continue;
  2897. photosName = m_no2array.ElementAt(i);
  2898. break;
  2899. }
  2900. CStringArray* pAllArry = NULL;
  2901. if(m_OpenFolder != NULL)
  2902. pAllArry = GetCurArray(INDX_ALL, m_OpenFolder);
  2903. else
  2904. pAllArry = GetCurArray(INDX_ALL);
  2905. #ifdef USE_SEP_VEB
  2906. photosName = SEPS_VEB + photosName + SEPS_VEB;
  2907. #else
  2908. photosName = SEPS_CMA + photosName + SEPS_CMA;
  2909. #endif //#ifdef USE_SEP_VEB
  2910. for (i = pAllArry->GetSize() - 1; i >= 0; i--)
  2911. {
  2912. CString strName = _T("");
  2913. strName = pAllArry->ElementAt(i);
  2914. strName = strName.Right(strName.GetLength() - strName.ReverseFind('\\') - 1);
  2915. strName = strName.Left(strName.ReverseFind('.'));
  2916. #ifdef USE_SEP_VEB
  2917. strName = SEPS_VEB + strName + SEPS_VEB;
  2918. #else
  2919. strName = SEPS_CMA + strName + SEPS_CMA;
  2920. #endif //#ifdef USE_SEP_VEB
  2921. if (photosName.Find(strName) != -1)
  2922. {
  2923. strName = pAllArry->ElementAt(i);
  2924. pArr->Add(strName);
  2925. }
  2926. }
  2927. }
  2928. /************************************************************************/
  2929. /*
  2930. 函数名: ReLoad
  2931. 描述: 重新加载数据
  2932. 参数:
  2933. 返回值:
  2934. */
  2935. /************************************************************************/
  2936. BOOL ChoosePhotoSkin2::ReLoad()
  2937. {
  2938. return GetData();
  2939. }
  2940. /************************************************************************/
  2941. /*
  2942. 函数: DrawImageWork
  2943. 描述: 绘制工作
  2944. 参数:
  2945. 返回:
  2946. */
  2947. /************************************************************************/
  2948. void ChoosePhotoSkin2::DrawImageWork()
  2949. {
  2950. CListCtrl* ListCtrl = &m_List1;
  2951. CImageList* pImgList = &m_ImageListThumb;
  2952. try
  2953. {
  2954. // reset our image list
  2955. for (int i = 0; i < pImgList->GetImageCount(); i++)
  2956. pImgList->Remove(i);
  2957. // remove all items from list view
  2958. ListCtrl->DeleteAllItems();
  2959. pImgList->SetImageCount(m_vResData.size());
  2960. // Set redraw to FALSE to avoid flickering during adding new items
  2961. ListCtrl->SetRedraw(FALSE);
  2962. //添加列表项名;
  2963. AddListItemName(ListCtrl);
  2964. //设置重绘并刷新;
  2965. ListCtrl->SetRedraw(TRUE);
  2966. ListCtrl->Invalidate();
  2967. //绘制图标;
  2968. DrawImage(ListCtrl, pImgList);
  2969. m_bRunning = false;
  2970. m_bTerminate = false;
  2971. PostMessage(WM_USER + 200, 0, 0);
  2972. return;
  2973. }
  2974. catch (...)
  2975. {
  2976. ListCtrl->Invalidate();
  2977. m_bRunning = false;
  2978. m_bTerminate = false;
  2979. PostMessage(WM_USER + 200, 0, 0);
  2980. }
  2981. }
  2982. /************************************************************************/
  2983. /*
  2984. 函数: AddListItemName
  2985. 描述: 添加列表项名
  2986. 参数:
  2987. 返回: 1成功,0失败
  2988. */
  2989. /************************************************************************/
  2990. int ChoosePhotoSkin2::AddListItemName(CListCtrl* pListCtrl)
  2991. {
  2992. if(pListCtrl == NULL)
  2993. return 0;
  2994. int nIndex = 0;
  2995. CString str(_T("")), spath(_T(""));
  2996. //添加文件名;
  2997. vector<SResData*>::iterator iter;
  2998. for(iter = m_vResData.begin(); iter != m_vResData.end() && m_bTerminate != true; iter++, nIndex++)
  2999. {
  3000. SResData* pRes = (*iter);
  3001. if(pRes == NULL)
  3002. continue;
  3003. switch(pRes->nType)
  3004. {
  3005. case TYPE_ICON: //相片图标;
  3006. {
  3007. str = pRes->strFilePath;
  3008. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  3009. str = str.Left(str.ReverseFind('.'));
  3010. //获取商品名如:004\r\n入册\r\n入底;
  3011. str += GetSelName(str);
  3012. }
  3013. break;
  3014. case TYPE_FOLDER: //文件夹;
  3015. str = pRes->strName;
  3016. break;
  3017. }
  3018. pListCtrl->InsertItem(nIndex, str, nIndex);
  3019. }
  3020. return 1;
  3021. }
  3022. /************************************************************************/
  3023. /*
  3024. 函数: DrawImage
  3025. 描述: 绘制
  3026. 参数:
  3027. 返回:
  3028. */
  3029. /************************************************************************/
  3030. void ChoosePhotoSkin2::DrawImage(CListCtrl* pListCtrl, CImageList* pImgList)
  3031. {
  3032. if(pListCtrl == NULL)
  3033. return;
  3034. int nIndex = 0;
  3035. Image* pHideImg = NULL; //相片图标;
  3036. Image* pFolderImg = NULL; //文件夹;
  3037. CString str(_T("")), spath(_T(""));
  3038. vector<SResData*>::iterator iter;
  3039. for (iter = m_vResData.begin(); iter != m_vResData.end() && m_bTerminate != true; iter++, nIndex++)
  3040. {
  3041. // Load Image File
  3042. Image *image = NULL;
  3043. Bitmap *pBmp = NULL;
  3044. SResData* pRes = (*iter);
  3045. if(pRes == NULL)
  3046. continue;
  3047. BOOL bNullimg = FALSE;
  3048. //加载相片图标res\未标题-1.jpg;
  3049. switch(pRes->nType)
  3050. {
  3051. case TYPE_ICON: //相片图标;
  3052. {
  3053. if(m_bHide && pHideImg == NULL)
  3054. pHideImg = m_pHideImg;
  3055. //是否要重新加载资源;
  3056. if(pHideImg == NULL)
  3057. {
  3058. ReLoadImageFromRes(&image, pRes->strFilePath, bNullimg);
  3059. if(image == NULL)
  3060. continue;
  3061. }
  3062. else
  3063. image = pHideImg;
  3064. }
  3065. break;
  3066. case TYPE_FOLDER: //文件夹;
  3067. {
  3068. if(pFolderImg == NULL)
  3069. pFolderImg = m_pFolderImg;
  3070. if(pFolderImg)
  3071. image = pFolderImg;
  3072. }
  3073. break;
  3074. }
  3075. //创建bitmap使用颜色填充区域;
  3076. SolidBrush whitebrush(Color(255, 255, 255, 255));
  3077. pBmp = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB);
  3078. Graphics graph2(pBmp);
  3079. graph2.Clear(Color(255, 192, 192, 192));
  3080. graph2.FillRectangle(&whitebrush, 1, 1, THUMBNAIL_WIDTH - 2, THUMBNAIL_HEIGHT - 2);
  3081. // 缩放图片符合画布大小;
  3082. Rect desRect(0, 0, 0, 0);
  3083. ZoomImage(image, desRect);
  3084. // 绘制图标res\未标题-1.jpg;
  3085. Graphics graph(pBmp);
  3086. graph.DrawImage(image, desRect, 0, 0, image->GetWidth(), image->GetHeight(), UnitPixel);
  3087. // 将图片替换bitmap添加到图标列表;
  3088. CBitmap bitmap;
  3089. HBITMAP hbmp;
  3090. pBmp->GetHBITMAP(Color(255, 255, 255, 255), &hbmp);
  3091. bitmap.Attach(hbmp);
  3092. pImgList->Replace(nIndex, &bitmap, NULL);
  3093. if(pBmp)
  3094. delete pBmp;
  3095. // Redraw only a current item for removing flickering and fast speed.
  3096. pListCtrl->RedrawItems(nIndex, nIndex);
  3097. // Release used DC and Object
  3098. if(image && pRes->nType == TYPE_ICON && pHideImg == NULL)
  3099. delete image;
  3100. }
  3101. pListCtrl->Invalidate();
  3102. }
  3103. /************************************************************************/
  3104. /*
  3105. 函数: FindForderFromIndx
  3106. 描述: 通过索引查找文件夹
  3107. 参数:
  3108. const int nIdx
  3109. 返回: SFolderInfo*
  3110. */
  3111. /************************************************************************/
  3112. SFolderInfo* ChoosePhotoSkin2::FindForderFromIndx(const int nIdx)
  3113. {
  3114. if(nIdx < 0 || nIdx >= m_vFolder.size())
  3115. return NULL;
  3116. return m_vFolder[nIdx];
  3117. }
  3118. /************************************************************************/
  3119. /*
  3120. 函数: MoveFileMainToSub
  3121. 描述: 移动文件主目录到子目录
  3122. 参数:
  3123. vector<CString>& vMoveFile, //选择的文件
  3124. SFolderInfo* pCurrSelForder, //当前选择的文件夹
  3125. const int nCurrSelIndx //当前选择的数据索引
  3126. 返回: 1成功, 0失败
  3127. */
  3128. /************************************************************************/
  3129. int ChoosePhotoSkin2::MoveFileMainToSub(vector<CString>& vMoveFile, SFolderInfo* pCurrSelForder, const int nCurrSelIndx)
  3130. {
  3131. if(pCurrSelForder == NULL || nCurrSelIndx < 0 || vMoveFile.size() == 0)
  3132. return 0;
  3133. CStringArray* pArr = GetCurArray(nCurrSelIndx, pCurrSelForder);
  3134. if(pArr == NULL)
  3135. return 0;
  3136. // 将主目录里手选的文件添加到子目录里;
  3137. int nSize = vMoveFile.size();
  3138. vector<CString>::iterator iter = vMoveFile.begin();
  3139. for(;iter != vMoveFile.end();)
  3140. {
  3141. if((*iter) != _T(""))
  3142. pArr->Add((*iter));
  3143. ++iter;
  3144. }
  3145. return 1;
  3146. }
  3147. /************************************************************************/
  3148. /*
  3149. 函数: MoveFileSubToMain
  3150. 描述: 移动文件子目录到主目录
  3151. 参数:
  3152. SFolderInfo* pCurrForder
  3153. 返回: 1成功, 0失败
  3154. */
  3155. /************************************************************************/
  3156. int ChoosePhotoSkin2::MoveFileSubToMain(SFolderInfo* pCurrForder, const int nCurrSelIndx)
  3157. {
  3158. if(pCurrForder == NULL)
  3159. return 0;
  3160. CStringArray* pArr = GetCurArray(nCurrSelIndx, pCurrForder);
  3161. if(pArr == NULL)
  3162. return 0;
  3163. //将文件夹里的相片添加到主目录里;
  3164. CStringArray* pAllPhotoArr = GetCurArray(nCurrSelIndx);
  3165. int nSize = pArr->GetSize();
  3166. for(int i = 0; i<nSize; i++)
  3167. {
  3168. CString strName = pArr->ElementAt(i);
  3169. if(strName != _T(""))
  3170. pAllPhotoArr->Add(strName);
  3171. }
  3172. return 1;
  3173. }
  3174. /************************************************************************/
  3175. /*
  3176. 函数: DelFolderFromName
  3177. 描述: 通过文件名删除文件夹
  3178. 参数:
  3179. const CString& strName 文件夹名
  3180. 返回: 1成功, 0失败
  3181. */
  3182. /************************************************************************/
  3183. int ChoosePhotoSkin2::DelFolderFromName(const CString& strName)
  3184. {
  3185. if(strName == _T(""))
  3186. return 0;
  3187. vector<SFolderInfo*>::iterator iter = m_vFolder.begin();
  3188. for(;iter != m_vFolder.end();)
  3189. {
  3190. SFolderInfo* p = (*iter);
  3191. if(p != NULL && p->strName == strName)
  3192. {
  3193. delete p;
  3194. m_vFolder.erase(iter);
  3195. return 1;
  3196. }
  3197. ++iter;
  3198. }
  3199. return 0;
  3200. }
  3201. /************************************************************************/
  3202. /*
  3203. 函数: AddFolder
  3204. 描述: 添加文件夹
  3205. 参数:
  3206. const CString& strName 文件名
  3207. 返回:SFolderInfo* 返回新建文件夹指针
  3208. */
  3209. /************************************************************************/
  3210. SFolderInfo* ChoosePhotoSkin2::AddFolder(const CString& strName)
  3211. {
  3212. if(strName == _T(""))
  3213. return NULL;
  3214. SFolderInfo* pForlder = new SFolderInfo();
  3215. pForlder->strName = strName;
  3216. m_vFolder.push_back(pForlder);
  3217. return pForlder;
  3218. }
  3219. /************************************************************************/
  3220. /*
  3221. 函数: GetFolderData
  3222. 描述: 获取文件夹数据
  3223. 参数:
  3224. CArray<CStringArray, CStringArray>& arr 返回文件夹信息
  3225. 返回: 1成功,0失败
  3226. */
  3227. /************************************************************************/
  3228. int ChoosePhotoSkin2::GetFolderData(CArray<CStringArray, CStringArray>& folderarr)
  3229. {
  3230. CString filter = _T("LoadFolder@OrderID='") + m_strOrderNumber + _T("'");
  3231. g_sendhead.code[0] = 235;
  3232. g_sendhead.tabcount = 1;
  3233. g_sendhead.bsql = 0;
  3234. g_pMainWnd->ProcessChatMessageRequest2(filter);
  3235. if (g_bSendOK == 0)
  3236. return 0;
  3237. DataToArray(&folderarr);
  3238. return 1;
  3239. }
  3240. //
  3241. /************************************************************************/
  3242. /*
  3243. 函数: GetFolderDelPhotos
  3244. 描述: 获取文件夹里删除的相片名
  3245. 参数:
  3246. CString& strDel 返回文件夹里删除的相片如:(;文件夹1>文件1;文件夹1>文件2;文件夹2>文件1;)
  3247. 返回:
  3248. */
  3249. /************************************************************************/
  3250. void ChoosePhotoSkin2::GetFolderDelPhotos(CString& strDelPhotos)
  3251. {
  3252. vector<SFolderInfo*>::iterator iter = m_vFolder.begin();
  3253. while(iter != m_vFolder.end())
  3254. {
  3255. //读取所有文件夹里要删除的相片
  3256. SFolderInfo* p = (*iter);
  3257. if(p != NULL)
  3258. GetDelPhotos(p->strName, &p->DelPhotoPath, FALSE, strDelPhotos);
  3259. ++iter;
  3260. }
  3261. //添加头和尾字符;zz;
  3262. if (!strDelPhotos.IsEmpty())
  3263. {
  3264. strDelPhotos.TrimLeft(_T(";"));
  3265. strDelPhotos.TrimRight(_T(";"));
  3266. strDelPhotos = _T(";") + strDelPhotos;
  3267. strDelPhotos += _T(";");
  3268. }
  3269. }
  3270. /************************************************************************/
  3271. /*
  3272. 函数: GetDelPhotos
  3273. 描述: 获取删除的所有相片名
  3274. 参数:
  3275. const CString& strFolderName 文件夹名
  3276. CStringArray* pDelPhotoArr, 删除的相片全路径集合
  3277. const BOOL bAddEnd 是否添加结尾字符
  3278. CString& strDelPhotos 返回相片名集合
  3279. 返回:
  3280. */
  3281. /************************************************************************/
  3282. void ChoosePhotoSkin2::GetDelPhotos(const CString& strFolderName, CStringArray* pDelPhotoArr, const BOOL bAddEnd, CString& strDelPhotos)
  3283. {
  3284. for (int i = 0; i < pDelPhotoArr->GetSize(); i++)
  3285. {
  3286. if (strDelPhotos.GetLength() > 4096)
  3287. break;
  3288. CString no = pDelPhotoArr->ElementAt(i); //在选片时被删除的相片名的全路径集合;
  3289. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  3290. no = no.Left(no.ReverseFind('.'));
  3291. strDelPhotos += strFolderName + _T(">");
  3292. strDelPhotos += no;
  3293. strDelPhotos += _T(";");
  3294. }
  3295. // strDelPhotos:解析为只有相片名,以分号为分隔符的字符串;
  3296. if (!strDelPhotos.IsEmpty() && bAddEnd)
  3297. {
  3298. strDelPhotos.TrimLeft(_T(";"));
  3299. strDelPhotos.TrimRight(_T(";"));
  3300. strDelPhotos = _T(";") + strDelPhotos;
  3301. strDelPhotos += _T(";");
  3302. }
  3303. }
  3304. /************************************************************************/
  3305. /*
  3306. 函数: GetDelPhotos
  3307. 描述: 获取删除的所有相片名
  3308. 参数:
  3309. CStringArray* pDelPhotoArr, 删除的相片全路径集合
  3310. CString& strDelPhotos 返回相片名集合
  3311. 返回:
  3312. */
  3313. /************************************************************************/
  3314. void ChoosePhotoSkin2::GetDelPhotos(CStringArray* pDelPhotoArr, CString& strDelPhotos)
  3315. {
  3316. for (int i = 0; i < pDelPhotoArr->GetSize(); i++)
  3317. {
  3318. if (strDelPhotos.GetLength() > 4096)
  3319. break;
  3320. CString no = pDelPhotoArr->ElementAt(i); //在选片时被删除的相片名的全路径集合;
  3321. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  3322. no = no.Left(no.ReverseFind('.'));
  3323. strDelPhotos += no;
  3324. strDelPhotos += _T(";");
  3325. }
  3326. // strDelPhotos:解析为只有相片名,以分号为分隔符的字符串;
  3327. if (!strDelPhotos.IsEmpty())
  3328. {
  3329. strDelPhotos.TrimLeft(_T(";"));
  3330. strDelPhotos.TrimRight(_T(";"));
  3331. strDelPhotos = _T(";") + strDelPhotos;
  3332. strDelPhotos += _T(";");
  3333. }
  3334. }
  3335. /************************************************************************/
  3336. /*
  3337. 函数: LoadFolder
  3338. 描述: 加载文件夹
  3339. 参数:
  3340. 返回:
  3341. */
  3342. /************************************************************************/
  3343. void ChoosePhotoSkin2::LoadFolder()
  3344. {
  3345. CArray<CStringArray, CStringArray> folderarr;
  3346. GetFolderData(folderarr);
  3347. if(folderarr.GetSize() == 0)
  3348. return;
  3349. // 订单号;
  3350. CString strOrderID = folderarr.ElementAt(0).ElementAt(0);
  3351. // 文件夹名,以分号分隔;
  3352. CString strFolderNames = folderarr.ElementAt(0).ElementAt(1);
  3353. // 文件夹内的相片;
  3354. CString strPhotos = folderarr.ElementAt(0).ElementAt(2);
  3355. // 从文件夹内被删除的相片;
  3356. CString strDelPhotos = folderarr.ElementAt(0).ElementAt(3);
  3357. //清除文件夹;
  3358. ClearFolder();
  3359. //从文件夹名集里获取文件夹名并且创建文件夹;
  3360. GetFolderFromFolders(folderarr.ElementAt(0).ElementAt(1));
  3361. vector<SFolderInfo*>::iterator iter = m_vFolder.begin();
  3362. while(iter != m_vFolder.end())
  3363. {
  3364. SFolderInfo* p = (*iter);
  3365. if(p != NULL)
  3366. {
  3367. CStringArray arr;
  3368. //通过文件夹名读取所有文件;
  3369. GetNamesFromFoler(p->strName, folderarr.ElementAt(0).ElementAt(2), arr);
  3370. int i = 0;
  3371. for(i=0; i<arr.GetSize(); i++)
  3372. {
  3373. for(int j=0; j<m_AllPhotoPath.GetSize();)
  3374. {
  3375. CString strPhoto = m_AllPhotoPath.ElementAt(j);;
  3376. strPhoto = strPhoto.Right(strPhoto.GetLength() - strPhoto.ReverseFind('\\') - 1);
  3377. strPhoto = strPhoto.Left(strPhoto.ReverseFind('.'));
  3378. if(arr.ElementAt(i) == strPhoto)
  3379. {
  3380. p->AllPhotoPath.Add(m_AllPhotoPath.ElementAt(j));
  3381. m_AllPhotoPath.RemoveAt(j);
  3382. }
  3383. else
  3384. ++j;
  3385. }
  3386. }
  3387. arr.RemoveAll();
  3388. //通过文件夹名读取要删除的文件;
  3389. GetNamesFromFoler(p->strName, folderarr.ElementAt(0).ElementAt(3), arr);
  3390. for(i=0; i<arr.GetSize(); i++)
  3391. {
  3392. for(int j=0; j<m_AllPhotoPath.GetSize();)
  3393. {
  3394. CString strPhoto = m_AllPhotoPath.ElementAt(j);;
  3395. strPhoto = strPhoto.Right(strPhoto.GetLength() - strPhoto.ReverseFind('\\') - 1);
  3396. strPhoto = strPhoto.Left(strPhoto.ReverseFind('.'));
  3397. if(arr.ElementAt(i) == strPhoto)
  3398. {
  3399. p->DelPhotoPath.Add(m_AllPhotoPath.ElementAt(j));
  3400. m_AllPhotoPath.RemoveAt(j);
  3401. }
  3402. else
  3403. ++j;
  3404. }
  3405. }
  3406. }
  3407. ++iter;
  3408. }
  3409. }
  3410. /************************************************************************/
  3411. /*
  3412. 函数: GetNamesFromFolder
  3413. 描述: 从文件名集里获取文件夹名
  3414. 参数:
  3415. const CString& strFolders, 文件夹名集字符
  3416. 返回:
  3417. */
  3418. /************************************************************************/
  3419. void ChoosePhotoSkin2::GetFolderFromFolders(const CString& strFolders)
  3420. {
  3421. CString strNames = strFolders;
  3422. strNames.TrimLeft(_T(";"));
  3423. int nPos = 0;
  3424. while(1)
  3425. {
  3426. //添加文件夹
  3427. nPos = strNames.Find(_T(";"));
  3428. if(nPos == -1)
  3429. break;
  3430. CString strName = strNames.Left(nPos);
  3431. AddFolder(strName);
  3432. if(strNames.GetLength() <= (nPos + 1))
  3433. break;
  3434. strNames = strNames.Right(strNames.GetLength() - (nPos + 1));
  3435. }
  3436. }
  3437. /************************************************************************/
  3438. /*
  3439. 函数: GetNamesFromFoler
  3440. 描述: 通过文件夹名读取文件
  3441. 参数:
  3442. const CString& strFolder, 文件夹
  3443. const CString& strPhotos, 相片集字符 (;文件夹1>文件1;文件夹1>文件2;文件夹2>文件1;)
  3444. CStringArray& arr 返回相片集
  3445. 返回:
  3446. */
  3447. /************************************************************************/
  3448. void ChoosePhotoSkin2::GetNamesFromFoler(const CString& strFolder, const CString& strPhotos, CStringArray& arr)
  3449. {
  3450. CString strNames = strPhotos;
  3451. strNames.TrimLeft(_T(";"));
  3452. int nPos = 0;
  3453. while(1)
  3454. {
  3455. //文件夹1>文件1;
  3456. nPos = strNames.Find(_T(";"));
  3457. if(nPos == -1)
  3458. break;
  3459. CString strName = strNames.Left(nPos);
  3460. //文件夹1>文件
  3461. int n = strName.Find(_T(">"));
  3462. if(n == -1)
  3463. {
  3464. if(strNames.GetLength() <= (nPos + 1))
  3465. break;
  3466. strNames = strNames.Right(strNames.GetLength() - (nPos + 1));
  3467. continue;
  3468. }
  3469. CString strFolderName = strName.Left(n);
  3470. if(strFolder != strFolderName)
  3471. {
  3472. if(strNames.GetLength() <= (nPos + 1))
  3473. break;
  3474. strNames = strNames.Right(strNames.GetLength() - (nPos + 1));
  3475. continue;
  3476. }
  3477. CString strFile = strName.Right(strName.GetLength() - (n + 1));
  3478. arr.Add(strFile);
  3479. if(strNames.GetLength() <= (nPos + 1))
  3480. break;
  3481. strNames = strNames.Right(strNames.GetLength() - (nPos + 1));
  3482. }
  3483. }
  3484. /************************************************************************/
  3485. /*
  3486. 函数: GetAllFolderNames
  3487. 描述: 获取所有文件夹名
  3488. 参数:
  3489. CString& strNames 返回相片集字符 (;文件夹1>文件1;文件夹1>文件2;文件夹2>文件1;)
  3490. 返回:
  3491. */
  3492. /************************************************************************/
  3493. void ChoosePhotoSkin2::GetAllFolderNames(CString& strNames)
  3494. {
  3495. if(m_vFolder.size() == 0)
  3496. return;
  3497. vector<SFolderInfo*>::iterator iter = m_vFolder.begin();
  3498. while(iter != m_vFolder.end())
  3499. {
  3500. SFolderInfo* p = (*iter);
  3501. if(p != NULL)
  3502. {
  3503. strNames += p->strName;
  3504. strNames += _T(";");
  3505. }
  3506. ++iter;
  3507. }
  3508. if(!strNames.IsEmpty())
  3509. {
  3510. strNames.TrimLeft(_T(";"));
  3511. strNames.TrimRight(_T(";"));
  3512. strNames = _T(";") + strNames;
  3513. strNames += _T(";");
  3514. }
  3515. }
  3516. /************************************************************************/
  3517. /*
  3518. 函数: GetAllFileFromFolder
  3519. 描述: 通过文件夹获取所有文件
  3520. 参数:
  3521. const int nType, 需要获取的文件集类型
  3522. CString& strFileNames 返回相片集字符 (;文件夹1>文件1;文件夹1>文件2;文件夹2>文件1;)
  3523. 返回:
  3524. */
  3525. /************************************************************************/
  3526. void ChoosePhotoSkin2::GetAllFileFromFolder(const int nType, CString& strFileNames)
  3527. {
  3528. if(m_vFolder.size() == 0)
  3529. return;
  3530. vector<SFolderInfo*>::iterator iter = m_vFolder.begin();
  3531. while(iter != m_vFolder.end())
  3532. {
  3533. SFolderInfo* p = (*iter);
  3534. if(p != NULL)
  3535. {
  3536. CStringArray* parr = GetCurArray(nType, p);
  3537. if(parr == NULL)
  3538. continue;
  3539. CString strPhoto = _T("");
  3540. for(int i=0; i<parr->GetSize(); i++)
  3541. {
  3542. //文件夹1>文件1;
  3543. strPhoto = parr->ElementAt(i);
  3544. strPhoto = strPhoto.Right(strPhoto.GetLength() - strPhoto.ReverseFind('\\') - 1);
  3545. strPhoto = strPhoto.Left(strPhoto.ReverseFind('.'));
  3546. strFileNames += p->strName;
  3547. strFileNames += _T(">");
  3548. strFileNames += strPhoto;
  3549. strFileNames += _T(";");
  3550. }
  3551. }
  3552. ++iter;
  3553. }
  3554. if(!strFileNames.IsEmpty())
  3555. {
  3556. strFileNames.TrimLeft(_T(";"));
  3557. strFileNames.TrimRight(_T(";"));
  3558. strFileNames = _T(";") + strFileNames;
  3559. strFileNames += _T(";");
  3560. }
  3561. }
  3562. /************************************************************************/
  3563. /*
  3564. 函数: ClearFolder
  3565. 描述: 清除所有文件夹
  3566. 参数:
  3567. 返回:
  3568. */
  3569. /************************************************************************/
  3570. void ChoosePhotoSkin2::ClearFolder()
  3571. {
  3572. m_OpenFolder = NULL;
  3573. m_pCurrSelFolder = NULL;
  3574. std::vector<SFolderInfo*>::iterator iter = m_vFolder.begin();
  3575. for(;iter != m_vFolder.end();)
  3576. {
  3577. SFolderInfo* p = (*iter);
  3578. if(p != NULL)
  3579. delete p;
  3580. ++iter;
  3581. }
  3582. m_vFolder.clear();
  3583. }
  3584. #if USE_SHARE_FLORD
  3585. /************************************************************************/
  3586. /*
  3587. 函数:LoadDesignPhotos
  3588. 描述:加载选设计所需相片;
  3589. 参数:
  3590. 返回:
  3591. 调用约定:
  3592. 注意:需要兼容异地选设计逻辑过程;
  3593. 1.若开启异地选片,则读取本地数据库,加载共享目录信息;
  3594. 2.
  3595. */
  3596. /************************************************************************/
  3597. void ChoosePhotoSkin2::LoadDesignPhotos()
  3598. {
  3599. }
  3600. /************************************************************************/
  3601. /*
  3602. 函数:LoadSelectPhotos
  3603. 描述:加载选片所需相片;
  3604. 参数:
  3605. 返回:
  3606. 调用约定:
  3607. 注意:
  3608. 1.需要兼容异地选片逻辑过程;
  3609. 2.不支持分店选片或汇总选片;
  3610. 选片逻辑:
  3611. 1.若有缓存相片在本机,选择是否使用本机缓存,是则结束余下逻辑过程;
  3612. 2.若是儿童成长套系,弹出选择套系项;
  3613. 3.判断初修共享目录是否有订单相片存在,无则使用原片选片;
  3614. 4.若初修共享目录有相片,则弹出选择:使用初修片 | 使用原片 | 使用初修+原片 进行选片,并获取所需相片路径(若原片和初修同时存在,只选择初修片相片);
  3615. 5.获取dindan表的delphotos记录,从4中获取的相片路径中剔除delphotos的相片路径;
  3616. */
  3617. /************************************************************************/
  3618. void ChoosePhotoSkin2::LoadSelectPhotos()
  3619. {
  3620. // 1.是否有本机缓存;
  3621. if(IsThereACacheImg())
  3622. m_bFromLocal = 1;
  3623. else
  3624. {
  3625. // 2.1.先查找原始初修共享目录是否有相片;
  3626. GetTXName(&m_strOrderNumber, 1, m_bGrowthTX, m_seltxname);
  3627. //////////////////////////////////////////////////////////////////////////
  3628. // 2.2.查找原始初修共享目录是否有相片;
  3629. int nPhotoType = 0;
  3630. BOOL bExistsEarlyPhotos = FALSE;
  3631. TCHAR szShare[MAX_PATH] = {0};
  3632. TCHAR szOrdePath[MAX_PATH] = {0};
  3633. CStringArray strAryOfExistsEarlyDirectory; // 存在初修订单的文件夹路径;
  3634. CStringArray strAryOfExistsOriginalDirectory; // 存在原片订单的文件夹路径;
  3635. // 获取本地初修共享目录;
  3636. CString domainname = "";
  3637. int i = 0;
  3638. #ifdef ENTERPRISE_VERSION
  3639. for(i = 0; i < g_brancharray.GetSize(); i++)
  3640. {
  3641. if (g_branchname == g_brancharray.ElementAt(i).ElementAt(0))
  3642. {
  3643. domainname = g_brancharray.ElementAt(i).ElementAt(2);
  3644. break;
  3645. }
  3646. }
  3647. if (g_branchname != "")
  3648. sprintf(szShare, _T("\\\\%s\\%s\\%s"), g_serverbak, _T("修好的片(管理软件)$"), domainname);
  3649. else
  3650. sprintf(szShare, _T("\\\\%s\\%s"), g_serverbak, _T("修好的片(管理软件)$"));
  3651. #else
  3652. sprintf(szShare, _T("\\\\%s\\%s"), g_serverbak, _T("修好的片(管理软件)$"));
  3653. #endif //#ifdef ENTERPRISE_VERSION
  3654. // 若是成长套系,初修片有子目录; 若是婚纱版,初修没有景点子目录;
  3655. if ( m_bGrowthTX && ( !m_seltxname.IsEmpty() && m_seltxname != _T("全部")) )
  3656. sprintf(szOrdePath, _T("%s\\%s\\%s"), szShare, m_strOrderNumber, m_seltxname);
  3657. else
  3658. sprintf(szOrdePath, _T("%s\\%s"), szShare, m_strOrderNumber);
  3659. if ( PathFileExists(szOrdePath) )
  3660. {
  3661. // 存在初修片;
  3662. strAryOfExistsEarlyDirectory.Add(CString(szOrdePath));
  3663. }
  3664. // 2.3.查找其他共享目录下的初修订单目录;
  3665. int nSize = g_aryOfSharePathInfo.GetSize();
  3666. for (i = 0; i < nSize; i++)
  3667. {
  3668. if ( 2 == atoi(g_aryOfSharePathInfo.ElementAt(i).ElementAt(5)) )
  3669. {
  3670. if ( g_aryOfSharePathInfo.ElementAt(i).ElementAt(1).Compare(g_branchname.IsEmpty() ? g_domain : g_branchname ) != 0 )
  3671. {
  3672. continue;
  3673. }
  3674. // 逐一加载其他共享目录;
  3675. // 如果是成长套系且套系名不为空或全部;
  3676. #ifdef ENTERPRISE_VERSION
  3677. if (g_branchname != "")
  3678. sprintf(szShare, _T("%s\\%s"), g_aryOfSharePathInfo.ElementAt(i).ElementAt(2), domainname);
  3679. else
  3680. sprintf(szShare,_T("%s"),g_aryOfSharePathInfo.ElementAt(i).ElementAt(2));
  3681. #else
  3682. sprintf(szShare,_T("%s"),g_aryOfSharePathInfo.ElementAt(i).ElementAt(2));
  3683. #endif //#ifdef ENTERPRISE_VERSION
  3684. // 若是成长套系,初修片有子目录; 若是婚纱版,初修没了景点了目录;
  3685. if ( m_bGrowthTX && ( !m_seltxname.IsEmpty() && m_seltxname != _T("全部")) )
  3686. {
  3687. sprintf(szOrdePath, _T("%s\\%s\\%s"), szShare, m_strOrderNumber, m_seltxname);
  3688. }
  3689. else
  3690. {
  3691. sprintf(szOrdePath, _T("%s\\%s"), szShare, m_strOrderNumber);
  3692. }
  3693. if ( PathFileExists(szOrdePath) )
  3694. {
  3695. strAryOfExistsEarlyDirectory.Add(CString(szOrdePath));
  3696. }
  3697. }
  3698. }
  3699. // 查找所有初修订单目录的相片;
  3700. //CNetShareInfo::GetInstance()->LoadSpecifiedDirectories(strAryOfExistsEarlyDirectory,m_AllPhotoPath);
  3701. for ( i = 0; i < strAryOfExistsEarlyDirectory.GetSize(); i++ )
  3702. {
  3703. LoadSpecifiedDirectoryPhotos(strAryOfExistsEarlyDirectory.ElementAt(i), m_AllPhotoPath, TRUE, NULL, NULL);
  3704. }
  3705. // 如果初修片目录有相片,提供选片模式 选择:0=初修; 1=原片;2=原片+初修;
  3706. if ( m_AllPhotoPath.GetSize() )
  3707. {
  3708. bExistsEarlyPhotos = TRUE;
  3709. }
  3710. //////////////////////////////////////////////////////////////////////////
  3711. // 初修片存在,选择选片相片混合模式;
  3712. if (bExistsEarlyPhotos)
  3713. {
  3714. SelBrunDevice dlg;
  3715. dlg.m_mode = 1;
  3716. if ( dlg.DoModal() == IDOK ) // m_nChoosePhotoType=; =0:修片; =1:原片 =2:原片+修片
  3717. m_nChoosePhotoType = dlg.m_sel;
  3718. else
  3719. m_nChoosePhotoType = 0;
  3720. }
  3721. else
  3722. {
  3723. m_nChoosePhotoType = 1;
  3724. strAryOfExistsEarlyDirectory.RemoveAll();
  3725. AfxMessageBox(_T("温馨提示:\r\n未找到初修片,将使用原片选片"), MB_ICONINFORMATION);
  3726. }
  3727. //////////////////////////////////////////////////////////////////////////
  3728. // 使用到原片的选片模式;
  3729. if ( m_nChoosePhotoType != 0)
  3730. {
  3731. //////////////////////////////////////////////////////////////////////////
  3732. // 3.1.加载原始原片共享目录;
  3733. #ifdef ENTERPRISE_VERSION
  3734. if (g_branchname != "")
  3735. sprintf(szShare, _T("\\\\%s\\%s\\%s"), g_serverbak, _T("客户原片(管理软件)$"), domainname);
  3736. else
  3737. sprintf(szShare, _T("\\\\%s\\%s"), g_serverbak, _T("客户原片(管理软件)$"));
  3738. #else
  3739. sprintf(szShare, _T("\\\\%s\\%s"), g_serverbak, _T("客户原片(管理软件)$"));
  3740. #endif //#ifdef ENTERPRISE_VERSION
  3741. if ( m_bGrowthTX && ( !m_seltxname.IsEmpty() && m_seltxname != _T("全部")) )
  3742. {// 儿童成长套系;
  3743. sprintf(szOrdePath, _T("%s\\%s\\%s"), szShare, m_strOrderNumber, m_seltxname);
  3744. }
  3745. else
  3746. {
  3747. sprintf(szOrdePath, _T("%s\\%s"), szShare, m_strOrderNumber);
  3748. }
  3749. if ( PathFileExists(szOrdePath) )
  3750. {
  3751. // 存在原片;
  3752. strAryOfExistsOriginalDirectory.Add(CString(szOrdePath));
  3753. }
  3754. // 3.2.查找其他共享目录;
  3755. int nSize = g_aryOfSharePathInfo.GetSize();
  3756. for ( int i = 0; i < nSize; i++)
  3757. {
  3758. if ( 1 == atoi(g_aryOfSharePathInfo.ElementAt(i).ElementAt(5)) )
  3759. {
  3760. // 逐一加载其他共享目录;
  3761. if ( g_aryOfSharePathInfo.ElementAt(i).ElementAt(1).Compare(g_branchname.IsEmpty() ? g_domain : g_branchname ) != 0 )
  3762. {
  3763. continue;
  3764. }
  3765. #ifdef ENTERPRISE_VERSION
  3766. if (g_branchname != "")
  3767. sprintf(szShare,"%s\\%s",g_aryOfSharePathInfo.ElementAt(i).ElementAt(2), domainname);
  3768. else
  3769. sprintf(szShare,"%s",g_aryOfSharePathInfo.ElementAt(i).ElementAt(2));
  3770. #else
  3771. sprintf(szShare,"%s",g_aryOfSharePathInfo.ElementAt(i).ElementAt(2));
  3772. #endif //#ifdef ENTERPRISE_VERSION
  3773. if ( m_bGrowthTX && ( !m_seltxname.IsEmpty() && m_seltxname != _T("全部")) )
  3774. {// 儿童成长套系;
  3775. sprintf(szOrdePath, _T("%s\\%s\\%s"), szShare, m_strOrderNumber, m_seltxname);
  3776. }
  3777. else
  3778. {
  3779. sprintf(szOrdePath, _T("%s\\%s"), szShare, m_strOrderNumber);
  3780. }
  3781. if ( PathFileExists(szOrdePath) )
  3782. {
  3783. strAryOfExistsOriginalDirectory.Add(CString(szOrdePath));
  3784. }
  3785. }
  3786. }
  3787. }
  3788. // 完成对选片所需的共享目录筛选,然后筛选目录的相片路径;
  3789. LoadNecessaryImage(strAryOfExistsEarlyDirectory, strAryOfExistsOriginalDirectory, m_nChoosePhotoType);
  3790. }
  3791. // next.获取dindan表中的字段delphotos的相片编号,然后从m_AllPhotoPath中剔除delphotos的相片路径;
  3792. // 暂由旧代码代替执行;
  3793. }
  3794. /************************************************************************/
  3795. /* 函数:LoadNecessaryImage[4/17/2016 IT];
  3796. /* 描述:加载最终选片所需要的相片路径;
  3797. /* 参数:;
  3798. /* [IN] strAryOfEarlyImage:订单初修片共享目录;
  3799. /* [IN] strAryOfOriginalImage:订单原片共享目录;
  3800. /* [IN] nSelectType:选片要用的相片类型:0 == 只用初修; 1 == 只用原片; 2 == 初修 + 原片,其中初修为主,原片为辅;
  3801. /* 返回:void;
  3802. /* 注意:初修片文件夹里没有任务子目录,如套系,景点这些子目录;
  3803. /* 示例:;
  3804. /*
  3805. /* 修改:;
  3806. /* 日期:;
  3807. /* 内容:;
  3808. /************************************************************************/
  3809. void ChoosePhotoSkin2::LoadNecessaryImage(IN CStringArray &strAryOfEarlyImage, IN CStringArray &strAryOfOriginalImage, IN const int &nSelectType)
  3810. {
  3811. if ( m_bGrowthTX )
  3812. {
  3813. // 只有成长套系才有选择套系名;
  3814. if ( m_seltxname == _T("全部") )
  3815. m_seltxname.Empty();
  3816. }
  3817. else
  3818. {
  3819. // 非成长套系的,不会弹出对话框;
  3820. m_seltxname.Empty();
  3821. }
  3822. int nSize = 0;
  3823. CString strTemp;
  3824. if ( nSelectType == 0) // 初修片;
  3825. {
  3826. // 初修已载过,不需要重新添加;
  3827. //CNetShareInfo::GetInstance()->LoadSpecifiedDirectories(strAryOfEarlyImage,m_AllPhotoPath);
  3828. }
  3829. else if ( nSelectType == 1 ) // 原片;
  3830. {
  3831. m_AllPhotoPath.RemoveAll();
  3832. nSize = strAryOfOriginalImage.GetSize();
  3833. for ( int i = 0; i < nSize; i++)
  3834. {
  3835. LoadSpecifiedDirectoryPhotos(strAryOfOriginalImage.ElementAt(i), m_AllPhotoPath, FALSE, NULL);
  3836. }
  3837. }
  3838. else // 初修+原片;
  3839. {
  3840. nSize = strAryOfOriginalImage.GetSize();
  3841. for ( int i = 0; i < nSize; i++)
  3842. {
  3843. LoadSpecifiedDirectoryPhotos(strAryOfOriginalImage.ElementAt(i), m_AllPhotoPath, FALSE, NULL);
  3844. }
  3845. }
  3846. }
  3847. /************************************************************************/
  3848. /*
  3849. 函数:LoadSpecifiedDirectoryPhotos
  3850. 描述:加载指定路径的相片;
  3851. 参数:
  3852. IN: lpSpecifiedDirectory 相片路径;
  3853. OUT: strArray 存储相片路径的数组;
  3854. IN: bEffect
  3855. IN: pEarlyDirectory
  3856. IN: pEarlyImages
  3857. 返回:
  3858. 调用约定:由LoadNecessaryImage调用;
  3859. 注意:
  3860. */
  3861. /************************************************************************/
  3862. void ChoosePhotoSkin2::LoadSpecifiedDirectoryPhotos(
  3863. IN LPCTSTR lpSpecifiedDirectory,
  3864. OUT CStringArray &strArray,
  3865. IN BOOL bEffect,
  3866. IN CStringArray *pEarlyDirectory,
  3867. IN CStringArray *pEarlyImages)
  3868. {
  3869. if ( lpSpecifiedDirectory == NULL || strcmp(lpSpecifiedDirectory,_T("")) == 0 || !PathFileExists(lpSpecifiedDirectory) )
  3870. return;
  3871. using namespace helper_coffs;
  3872. ffsco o;
  3873. o.dirs(1);
  3874. o.find(lpSpecifiedDirectory, LPCSTR("*.*"));
  3875. ffsco::typeT cfs;
  3876. ffsco::typeT::iterator it;
  3877. cfs = o.co_file();
  3878. int nIndex = 0;
  3879. CString strName;
  3880. CString strTemp;
  3881. for ( it = cfs.begin(); cfs.end() != it; it++)
  3882. {
  3883. // 去除目录级文件;
  3884. // 去除ok文件;
  3885. // 去除modifytime文件;
  3886. // 去除s+m缩略图;
  3887. strName = it->c_str();
  3888. strName.MakeLower();
  3889. if ( strName.Find('.') == -1)
  3890. continue;
  3891. else
  3892. {
  3893. CString str = strName.Mid( strName.ReverseFind('\\') + 1 );
  3894. if ( str.Find('.') == -1)
  3895. continue;
  3896. }
  3897. if ( strName.GetAt( strName.ReverseFind('\\') + 1 ) == 's' )continue;
  3898. if ( strName.GetAt( strName.ReverseFind('\\') + 1 ) == 'm' )continue;
  3899. // 剔除nef,cr2,raw之类的原始相片格式;
  3900. //if ( strName.Find(_T(".jpg")) == -1 )continue;
  3901. if ( strName.Right(4).CompareNoCase(_T(".jpg")) != 0 )
  3902. {
  3903. if ( strName.Right(5).CompareNoCase(_T(".jpeg")) != 0 )
  3904. continue;
  3905. }
  3906. // 再判断是否为数字编号;
  3907. strTemp = strName.Mid( strName.ReverseFind('\\') + 1);
  3908. strTemp = strTemp.Left( strTemp.ReverseFind('.'));
  3909. if ( !g_bOriginal )
  3910. {// 系统数字命名;
  3911. if ( !myisdigit(strTemp) )
  3912. {
  3913. if ( bEffect )
  3914. {// 初修效果图;
  3915. if ( strTemp.Find('-') != -1)
  3916. {
  3917. strTemp = strTemp.Left( strTemp.Find('-') );
  3918. strTemp.TrimRight(_T(" ")); // 去除空格;
  3919. if ( myisdigit(strTemp) )
  3920. strArray.Add(strName);
  3921. }
  3922. }
  3923. continue;
  3924. }
  3925. }
  3926. // 判断strTemp是否在strArray中存在同名的相片;
  3927. BOOL bIsonym = FALSE;
  3928. CString strNumber;
  3929. for ( int n = 0; n < strArray.GetSize(); n++ )
  3930. {
  3931. strNumber = strArray.ElementAt(n);
  3932. strNumber = strNumber.Mid(strNumber.ReverseFind('\\') + 1);
  3933. strNumber = strNumber.Left(strNumber.ReverseFind('.'));
  3934. if ( strNumber.CompareNoCase(strTemp) == 0 )
  3935. {
  3936. bIsonym = TRUE;
  3937. break;
  3938. }
  3939. }
  3940. if ( !bIsonym )
  3941. nIndex = strArray.Add(strName);// 同时记录索引值,有初修使用初修替换;
  3942. }
  3943. }
  3944. #endif //#if USE_SHARE_FLORD