12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192 |
- // ChoosePhotoSkin2.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ChoosePhotoSkin2.h"
- #include "YLGL.h"
- #include "./helper/ffsco.h"
- #include ".\MenuBarXP\MenuXP.h"
- #include "ChoosePhotoSkin3.h"
- #include "ShowPic22.h"
- #include "ClientRequirement.h"
- #include "MyLock.h"
- #include "Time5.h"
- #include "ComparePhoto.h"
- #include "ReplaceDesignNo.h"
- #include "Login2.h"
- #include "ImportPhoto.h"
- #include "TimeOutDlg.h"
- #include "ShowEffect.h"
- #include "SelBrunDevice.h"
- #include "ProductChooseFilter.h"
- #define THUMBNAIL_WIDTH 100
- #define THUMBNAIL_HEIGHT 90
- extern HCURSOR g_cursorhand;
- //mode
- //0 全部
- //1 选中
- //2 未选
- //3 删除
- //4 入册
- //5 入底
- /////////////////////////////////////////////////////////////////////////////
- //extern void WriteClientLog(CString str); // Jeff写客户端日志;
- // ChoosePhotoSkin2 dialog IDC_EDITzs
- ChoosePhotoSkin2::ChoosePhotoSkin2(CWnd* pParent /*=NULL*/)
- : CDialog(ChoosePhotoSkin2::IDD, pParent)
- {
- //{{AFX_DATA_INIT(ChoosePhotoSkin2)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- m_pBk=NULL;
- m_pParent=NULL;
- m_name1 = _T("");
- m_name2 = _T("");
- m_time4 = g_date;
- m_waiter3 = _T("");
- m_takezs = _T("");
- m_taoxizs = _T("");
- m_choosezs = _T("");
- m_strOrderNumber = _T("");
- m_money3 = _T("");
- m_bz3 = _T("");
- //}}AFX_DATA_INIT
- m_bTerminate=false;
- m_bRunning=false;
- m_hThread = NULL;
- m_bSave=0;
- m_bModify=0;
- m_mode=0;
- m_showpichwd=NULL;
- m_mode2=0;
- g_pMainWnd->GetSkin();
- m_bSort=0;
- m_bHide=atoi(g_cominfoarray.ElementAt(0).ElementAt(59));
- m_pArray=NULL;
- m_bShowTimeOut=1;
- m_bCanSave=1;
- m_bGrowthTX=0;
- m_nChoosePhotoType=0;
- m_bChooseBig=0;
- m_bFromLocal=0;
- }
- ChoosePhotoSkin2::ChoosePhotoSkin2(DWORD id, CWnd* pParent)
- : CDialog(id, pParent)
- {
- //{{AFX_DATA_INIT(ChoosePhotoSkin2)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- m_pBk=NULL;
- m_pParent=NULL;
- }
- void ChoosePhotoSkin2::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(ChoosePhotoSkin2)
- DDX_Control(pDX, IDC_COMBO1, m_combo1);
- DDX_Control(pDX, IDC_EDITzs3, m_editnum4);
- DDX_Control(pDX, IDC_EDITzs2, m_editnum3);
- DDX_Control(pDX, IDC_EDITzs, m_editnum2);
- DDX_Control(pDX, IDC_EDITmoney3, m_editnum1);
- DDX_Control(pDX, IDC_LIST3, m_List3);
- DDX_Control(pDX, IDC_LIST2, m_List2);
- DDX_Control(pDX, IDC_LIST1, m_List1);
- DDX_Text(pDX, IDC_EDITname1, m_name1);
- DDX_Text(pDX, IDC_EDITname2, m_name2);
- DDX_Text(pDX, IDC_EDITtime4, m_time4);
- DDX_Text(pDX, IDC_EDITwaiter3, m_waiter3);
- DDX_Text(pDX, IDC_EDITzs, m_takezs);
- DDX_Text(pDX, IDC_EDITzs2, m_taoxizs);
- DDX_Text(pDX, IDC_EDITzs3, m_choosezs);
- DDX_Text(pDX, IDC_EDITmoney3, m_money3);
- DDX_Text(pDX, IDC_EDITid, m_strOrderNumber);
- DDX_Text(pDX, IDC_EDITbz3, m_bz3);
- //}}AFX_DATA_MAP}
- }
- BEGIN_MESSAGE_MAP(ChoosePhotoSkin2, CDialog)
- //{{AFX_MSG_MAP(ChoosePhotoSkin2)
- ON_WM_PAINT()
- ON_WM_DESTROY()
- ON_WM_ERASEBKGND()
- ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
- ON_WM_CLOSE()
- ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnRclickList1)
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
- ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
- ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
- ON_WM_TIMER()
- ON_BN_CLICKED(IDC_BUTTON7, OnSpBox)
- ON_BN_CLICKED(IDC_BUTTON8, OnButton8)
- ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
- ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
- //}}AFX_MSG_MAP
- ON_MESSAGE(WM_USER+1101,OnBtnClick)
- ON_COMMAND_RANGE(IDM_MENUsp1-1, IDM_MENUsp1+200, OnCommandMenu)
- ON_MESSAGE(WM_USER+200, UpdateTakeZS)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // ChoosePhotoSkin2 message handlers
- extern void SizeToContent(HWND hwnd, Image *img);
- #ifdef VC60
- void ChoosePhotoSkin2::OnBtnClick (WPARAM wParam, LPARAM lParam) // F5按键,显示删除相片
- {
- int id=lParam;
- id-=99;
- switch(id)
- {
- case 1:
- case 2:
- case 4:
- if(m_mode==id-1 && m_mode!=1)return;
- m_mode=id-1;
- LoadPhotos();
- break;
- case 3://查看未选
- if(m_mode==id-1)return;
- m_sChooseFilter="";
- UpdateChooseZS();
- GetNoSelPhoto();
- m_mode=id-1;
- LoadPhotos();
- break;
- case 13:
- GetAlbumPhoto();
- break;
- case 14:
- GetDiskPhoto();
- break;
- case 15:
- {
- ShowEffectDlg dlg;
- dlg.m_pPhotopatharray=this->GetCurArray ();
- dlg.DoModal();
- }
- break;
- case 5:
- OnButton4();
- break;
- case 9:
- {
- if(((MyBmpButton2*)m_picarray.ElementAt (8))->GetPushDown ())
- ((MyBmpButton2*)m_picarray.ElementAt (8))->SetPushDown (0);
- else
- ((MyBmpButton2*)m_picarray.ElementAt (8))->SetPushDown (1);
- ReLoadPhoto();
- /* if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return ;
- CString sql;
- sql="update dindansp set [no2]='' where [id]='"+m_strOrderNumber+"'";
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if(g_bSendOK==0)return;
- CString path=m_path;
- path.TrimRight ('\\');
- DeleteDirectory(path);
- GetPhotos();
- LoadPhotos();*/
- }
- break;
- case 10:
- {
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- AfxMessageBox("请先选中您要删除的照片!", MB_ICONINFORMATION);
- return;
- }
- if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
- while (pos)
- {
- int iItem=m_List1.GetNextSelectedItem(pos);
- CString title=m_List1.GetItemText (iItem, 0);
- int pos=title.Find ("\r\n");
- if(pos!=-1)title=title.Left (pos);
- if(m_mode2==1)//看设计
- {
- if(title.Find ("Flash")!=-1)
- {
- title.Replace ("Flash", "delgabook");
- CString str=m_path+title;
- DeleteDirectory(str);
- GetPhotos();
- LoadPhotos();
- return;
- }
- }
- ::DeleteFile (m_path+title+".jpg");
- ::DeleteFile (m_path+"s"+title+".jpg");
- ////////////////
- CStringArray *pArray=GetCurArray();
- CString path=pArray->ElementAt (iItem);
- path=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
- path=path.Left (path.ReverseFind ('.'));
- if(CheckName(path))
- {
- path=","+path+",";
- for(int i=0; i<m_List2.GetItemCount (); i++)
- {
- CString no=m_noarray.ElementAt (i);
- if(no.Find (path)!=-1)
- {
- path.TrimRight(",");
- no.Delete (no.Find (path), path.GetLength ());
- no.TrimLeft (",");no.TrimRight(",");
- m_List2.SetItemText (i, 4, no);
- no=","+no+",";
- m_noarray.SetAt (i, no);
- }
- }
- }
- }
- GetPhotos();
- LoadPhotos();
- }
- break;
- case 6:
- // AfxMessageBox("退出");
- if(m_bModify && m_bCanSave)
- {
- if(AfxMessageBox("提醒, 选片修改未保存, 是否保存后再退出?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
- {
- OnButton4();
- if(m_bSaveFail)
- {
- AfxMessageBox("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!");
- CDialog::OnCancel ();return;
- }
- return;
- }
- else
- {
- CString savepath;
- savepath.Format ("%s\\%s.dat", g_mainpath, m_strOrderNumber);
- if(m_mode2)savepath.Format ("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
- ::DeleteFile (savepath);
- }
- }
- CDialog::OnCancel ();
- break;
- case 11:
- if(m_selphotownd.GetSafeHwnd ()==NULL)
- {
- m_selphotownd.m_id=m_strOrderNumber;
- m_selphotownd.m_rc=m_rcarray.ElementAt (6);
- m_selphotownd.Create (IDD_DLGShowSelPhoto, this);
- }
- m_selphotownd.ShowWindow (1);
- break;
- case 12:
- if(m_mode2)
- {
- ReplaceDesignNo dlg;
- dlg.m_id=this->m_strOrderNumber ;
- dlg.DoModal ();
- }
- /* if(m_selphotownd2.GetSafeHwnd ()==NULL)
- {
- m_selphotownd2.m_id=m_id;
- m_selphotownd2.m_rc=m_rcarray.ElementAt (6);
- m_selphotownd2.Create (IDD_DLGShowSelPhoto2, this);
- }
- m_selphotownd2.ShowWindow (1);*/
- break;
- }
- }
- #else
- LRESULT ChoosePhotoSkin2::OnBtnClick (WPARAM wParam, LPARAM lParam) // F5按键,显示删除相片
- {
- int id=lParam;
- id-=99;
- switch(id)
- {
- case 1:
- case 2:
- case 4:
- if(m_mode==id-1 && m_mode!=1)return 0;
- m_mode=id-1;
- LoadPhotos();
- break;
- case 3://查看未选
- if(m_mode==id-1)return 0;
- m_sChooseFilter="";
- UpdateChooseZS();
- GetNoSelPhoto();
- m_mode=id-1;
- LoadPhotos();
- break;
- case 13:
- GetAlbumPhoto();
- break;
- case 14:
- GetDiskPhoto();
- break;
- case 15:
- {
- ShowEffectDlg dlg;
- dlg.m_pPhotopatharray=this->GetCurArray ();
- dlg.DoModal();
- }
- break;
- case 5:
- OnButton4();
- break;
- case 9:
- {
- if(((MyBmpButton2*)m_picarray.ElementAt (8))->GetPushDown ())
- ((MyBmpButton2*)m_picarray.ElementAt (8))->SetPushDown (0);
- else
- ((MyBmpButton2*)m_picarray.ElementAt (8))->SetPushDown (1);
- ReLoadPhoto();
- /* if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return ;
- CString sql;
- sql="update dindansp set [no2]='' where [id]='"+m_strOrderNumber+"'";
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if(g_bSendOK==0)return;
- CString path=m_path;
- path.TrimRight ('\\');
- DeleteDirectory(path);
- GetPhotos();
- LoadPhotos();*/
- }
- break;
- case 10:
- {
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- AfxMessageBox("请先选中您要删除的照片!", MB_ICONINFORMATION);
- return 0;
- }
- if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return 0;
- while (pos)
- {
- int iItem=m_List1.GetNextSelectedItem(pos);
- CString title=m_List1.GetItemText (iItem, 0);
- int pos=title.Find ("\r\n");
- if(pos!=-1)title=title.Left (pos);
- if(m_mode2==1)//看设计
- {
- if(title.Find ("Flash")!=-1)
- {
- title.Replace ("Flash", "delgabook");
- CString str=m_path+title;
- DeleteDirectory(str);
- GetPhotos();
- LoadPhotos();
- return 0;
- }
- }
- ::DeleteFile (m_path+title+".jpg");
- ::DeleteFile (m_path+"s"+title+".jpg");
- ////////////////
- CStringArray *pArray=GetCurArray();
- CString path=pArray->ElementAt (iItem);
- path=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
- path=path.Left (path.ReverseFind ('.'));
- if(CheckName(path))
- {
- path=","+path+",";
- for(int i=0; i<m_List2.GetItemCount (); i++)
- {
- CString no=m_noarray.ElementAt (i);
- if(no.Find (path)!=-1)
- {
- path.TrimRight(",");
- no.Delete (no.Find (path), path.GetLength ());
- no.TrimLeft (",");no.TrimRight(",");
- m_List2.SetItemText (i, 4, no);
- no=","+no+",";
- m_noarray.SetAt (i, no);
- }
- }
- }
- }
- GetPhotos();
- LoadPhotos();
- }
- break;
- case 6:
- // AfxMessageBox("退出");
- if(m_bModify && m_bCanSave)
- {
- if(AfxMessageBox("提醒, 选片修改未保存, 是否保存后再退出?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
- {
- OnButton4();
- if(m_bSaveFail)
- {
- AfxMessageBox("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!");
- CDialog::OnCancel ();return 0;
- }
- return 0;
- }
- else
- {
- CString savepath;
- savepath.Format ("%s\\%s.dat", g_mainpath, m_strOrderNumber);
- if(m_mode2)savepath.Format ("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
- ::DeleteFile (savepath);
- }
- }
- CDialog::OnCancel ();
- break;
- case 11:
- if(m_selphotownd.GetSafeHwnd ()==NULL)
- {
- m_selphotownd.m_id=m_strOrderNumber;
- m_selphotownd.m_rc=m_rcarray.ElementAt (6);
- m_selphotownd.Create (IDD_DLGShowSelPhoto, this);
- }
- m_selphotownd.ShowWindow (1);
- break;
- case 12:
- if(m_mode2)
- {
- ReplaceDesignNo dlg;
- dlg.m_id=this->m_strOrderNumber ;
- dlg.DoModal ();
- }
- /* if(m_selphotownd2.GetSafeHwnd ()==NULL)
- {
- m_selphotownd2.m_id=m_id;
- m_selphotownd2.m_rc=m_rcarray.ElementAt (6);
- m_selphotownd2.Create (IDD_DLGShowSelPhoto2, this);
- }
- m_selphotownd2.ShowWindow (1);*/
- break;
- }
- }
- #endif
- BOOL ChoosePhotoSkin2::OnInitDialog() //初始化选片*看设计
- {
- //AfxMessageBox("Jeff");
- CDialog::OnInitDialog();
- #if 1
- g_bInSkin=1;
- m_ticks=::GetTickCount ();
- // TODO: Add extra initialization here
- if(g_cursorhand==NULL)
- g_cursorhand=AfxGetApp()->LoadCursor(IDC_CURSORHAND);
- BYTE *pData=NULL;
- BYTE *pDataBegin;
- //printf("Jeff:loadLia路径:%s\n\n",g_mainpath+"\\skin\\"+m_liapath);//Jeff Printf;
- if(!LoadLia(g_mainpath+"\\skin\\"+m_liapath, &pData, &pDataBegin, &m_pBk, m_hWnd))
- {
- EndDialog(0);
- return false;
- }
- //printf("Jeff:g_resdata2.nPicCount=%d\n\n",g_resdata2.nPicCount); // Jeff Printf,这个nPicCount好像一直是15;
- for(int i=0; i<g_resdata2.nPicCount; i++)
- {
- g_resdata2.rect[i].left *=g_fscalex;
- g_resdata2.rect[i].right *=g_fscalex;
- g_resdata2.rect[i].top *=g_fscaley;
- g_resdata2.rect[i].bottom *=g_fscaley;
- if(i==8)
- g_resdata2.rect[i]=g_resdata2.rect[2];
- else if(i==9)
- g_resdata2.rect[i]=g_resdata2.rect[3];
- else if(i==10)
- g_resdata2.rect[i]=g_resdata2.rect[1];
- if(g_resdata2.nPicBmpCount[i])
- {
- MyBmpButton2 *pic=new MyBmpButton2;
- m_picarray.Add((DWORD)pic);
- CRect rc=g_resdata2.rect[i];
- CString str;
- str.Format (_T("%d"), i+1);
- pic->Create(str, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW , rc, this, i+100);
- pic->m_bmpcount =g_resdata2.nPicBmpCount [i];
- pic->ReadBmp (&pData, NULL, this);
- #ifdef SZWNS_VERSION
- if(i==3 && m_mode2==0)
- {
- Image *img=NULL;
- LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG6), _T("JPG") );
- delete pic->m_bmp;
- pic->m_bmp=img->Clone();
- delete img;
- img=NULL;
- LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG7), _T("JPG") );
- delete pic->m_bmpfocus;
- pic->m_bmpfocus=img->Clone();
- delete img;
- img=NULL;
- LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG8), _T("JPG") );
- delete pic->m_bmpfocused;
- pic->m_bmpfocused=img->Clone();
- delete img;
- }
- #endif
- }
- else
- m_picarray.Add (NULL);
- m_rcarray.Add(g_resdata2.rect[i]);
- }
- delete []pDataBegin;
- if(m_mode2)//看设计
- {
- m_bHide=0;
- // printf("Jeff:g_cominfoarray.ElementAt(0).ElementAt(86)=%s\n\n",g_cominfoarray.ElementAt(0).ElementAt(86)); // Jeff Printf;
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
- {
- ((MyBmpButton2*)m_picarray.ElementAt (3))->ShowWindow (SW_HIDE);
- CRect rc,rc2;
- ((MyBmpButton2*)m_picarray.ElementAt (3))->GetWindowRect(rc);
- ((MyBmpButton2*)m_picarray.ElementAt (1))->GetWindowRect(rc2);
- int dtx=rc.right -rc2.right ;
- ScreenToClient(rc2);
- rc2.left +=dtx;
- rc2.right +=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (1))->MoveWindow(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt (0))->GetWindowRect(rc2);
- ScreenToClient(rc2);
- rc2.left +=dtx;
- rc2.right +=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (0))->MoveWindow(rc2);
- }
- CRect rc,rc2;
- ((MyBmpButton2*)m_picarray.ElementAt (5))->GetWindowRect(rc);
- ((MyBmpButton2*)m_picarray.ElementAt (4))->GetWindowRect(rc2);
- int dtx=rc.right -rc2.right ;
- rc2=rc;
- // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
- {
- float scale=0.9;
- dtx*=scale;
- int wid=rc2.Width ()*scale;
- int hei=rc2.Height ()*scale;
- int dty=rc2.Height ()-hei;
- dty/=2;
- rc2.left =rc2.right -wid;
- rc2.top +=dty;
- rc2.bottom =rc2.top +hei;
- }
- ScreenToClient(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt (5))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (4))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (14))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (2))->MoveWindow(rc2);
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
- {
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (3))->MoveWindow(rc2);
- }
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (1))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (0))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (8))->MoveWindow(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt (11))->ShowWindow (SW_HIDE);
- }
- else
- {
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
- {
- ((MyBmpButton2*)m_picarray.ElementAt (3))->ShowWindow (SW_HIDE);
- CRect rc,rc2;
- ((MyBmpButton2*)m_picarray.ElementAt (3))->GetWindowRect(rc);
- ((MyBmpButton2*)m_picarray.ElementAt (1))->GetWindowRect(rc2);
- int dtx=rc.right -rc2.right ;
- ScreenToClient(rc2);
- rc2.left +=dtx;
- rc2.right +=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (1))->MoveWindow(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt (0))->GetWindowRect(rc2);
- ScreenToClient(rc2);
- rc2.left +=dtx;
- rc2.right +=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (0))->MoveWindow(rc2);
- }
- }
- if(1)//m_mode2==0)
- {
- ((MyBmpButton2*)m_picarray.ElementAt (7))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (8))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (9))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (10))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (11))->ShowWindow (SW_HIDE);
- }
- else
- {
- ((MyBmpButton2*)m_picarray.ElementAt (7))->EnableWindow (0);
- ((MyBmpButton2*)m_picarray.ElementAt (0))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (1))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (2))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (3))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (11))->ShowWindow (SW_HIDE);
- if(IsHasRights2new(37)==0)
- {
- ((MyBmpButton2*)m_picarray.ElementAt (8))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (9))->ShowWindow (SW_HIDE);
- }
- }
- if(m_mode2)
- {
- ((MyBmpButton2*)m_picarray.ElementAt (8))->ShowWindow (SW_SHOW);
- // ((MyBmpButton2*)m_picarray.ElementAt (8))->SetPushDown (1);
- ((MyBmpButton2*)m_picarray.ElementAt (12))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (13))->ShowWindow (SW_HIDE);
- }
- else//移按钮位置
- {
- CRect rc,rc2;
- ((MyBmpButton2*)m_picarray.ElementAt (5))->GetWindowRect(rc);
- ((MyBmpButton2*)m_picarray.ElementAt (4))->GetWindowRect(rc2);
- int dtx=rc.right -rc2.right ;
- rc2=rc;
- // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
- {
- float scale=0.9;
- dtx*=scale;
- int wid=rc2.Width ()*scale;
- int hei=rc2.Height ()*scale;
- int dty=rc2.Height ()-hei;
- dty/=2;
- rc2.left =rc2.right -wid;
- rc2.top +=dty;
- rc2.bottom =rc2.top +hei;
- }
- ScreenToClient(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt (5))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (4))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (14))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (2))->MoveWindow(rc2);
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
- {
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (3))->MoveWindow(rc2);
- }
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (12))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (13))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (1))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (0))->MoveWindow(rc2);
- }
- #ifndef MNLS_VERSION
- ((MyBmpButton2*)m_picarray.ElementAt (7))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (7))->EnableWindow (0);
- Graphics graph(m_pBk);
- Image *img=NULL;
- if(m_mode2==0)
- ::LoadImageFromBuf (&img, g_mainpath+"\\图片\\标题-选片.jpg");
- else
- ::LoadImageFromBuf (&img, g_mainpath+"\\图片\\标题-看设计.jpg");
- if(img)
- {
- if(img->GetWidth()==2000)
- {
- graph.SetSmoothingMode(SmoothingModeHighQuality);
- graph.DrawImage(img, 0,0);
- }
- delete img;
- }
- #endif
- CRect listrc=m_rcarray.ElementAt (6);
- CRect rc;
- GetClientRect(rc);
- rc.top=listrc.top;
- m_List1.MoveWindow (rc);
- CString path,str;
- if(m_mode2)
- {
- m_path=g_path3+"\\";
- m_path+=m_strOrderNumber;
- m_path +="\\";
- // printf("Jeff:m_path=%s\n\n",m_path); // Jeff Printf;
- }
- if(m_mode2)//看设计
- {
- GetPhotos();
- }
- else // 开始选片
- {
- //AfxMessageBox("789");
- IsGrowthTx growthtxdlg;
- growthtxdlg.m_mode=1;
- growthtxdlg.m_strOrderNumber=m_strOrderNumber;
- growthtxdlg.DoModal ();
- m_bGrowthTX=growthtxdlg.m_bGrowthTx;
- m_seltxname=growthtxdlg.m_seltxname;
- /*if(!growthtxdlg.m_seltxname.IsEmpty ())
- {
- if(growthtxdlg.m_seltxname!="全部")
- {
- path+=growthtxdlg.m_seltxname;
- path+="\\";
- }
- }*/
- // HC:缓存,checkHC检查在本机是否存在缓存的相片;
- if( CheckHC() ) // (一般返回0)这一步是查看C:\WINDOWS\System32\有没有lyfz的文件夹,以及该文件夹下是否有订单号文件夹和相片;
- {
- //AfxMessageBox("789");
- m_bFromLocal=1;
- char path[MAX_PATH];
- ::GetSystemDirectory (path, MAX_PATH);
- CString sysdir=path;
- sysdir+="\\lyfz";
- ::CreateDirectory (sysdir, NULL);
- sysdir+="\\";
- sysdir+=m_strOrderNumber;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(sysdir), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin();coo.end() != it;it ++)
- {
- str=(*it).c_str();
- // printf("Jeff:str=%s\n\n",str);// Jeff Printf
- if(str.GetAt (str.ReverseFind ('\\')+1)!='s' && str.GetAt (str.ReverseFind ('\\')+1)!='m')
- {
- m_patharray1.Add (str);
- }
- }
- }
- //printf("Jeff:m_patharray1.GetSize()=%d\n\n",m_patharray1.GetSize());// Jeff Printf;
- if(m_patharray1.GetSize() == 0) // m_patharray1:查看全部相片.
- {
- if(IsPhoto2Exist())//如果订单文件夹存在;
- {
- SelBrunDevice dlg;
- dlg.m_mode=1;
- if(dlg.DoModal()==IDOK) // m_nChoosePhotoType=0:原片+修片; =1:修片; =2:原片
- m_nChoosePhotoType=dlg.m_sel;
- else
- m_nChoosePhotoType=0;
- }
- else AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
-
- CString path2;
- m_path=g_path1+"\\";
- m_path+=m_strOrderNumber;
- m_path +="\\";
- if(m_seltxname != "" && m_seltxname != "全部")
- {
- m_path+=m_seltxname;
- m_path +="\\";
- //printf("Jeff:m_path1=%s\n\n",m_path);// Jeff Printf;
- }
- if(m_nChoosePhotoType==1) // 选片:选择修片文件夹;
- {
- m_path=g_path2+"\\";
- m_path+=m_strOrderNumber;
- m_path +="\\";
- //printf("Jeff:m_path2=%s\n\n",m_path);// Jeff Printf;
- }
- // 查找m_path下所有文件o.find(...);
- CString filename;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(m_path), LPCSTR("*.*"));
- //printf("Jeff:文件夹=%d, m_path=%s\n\n",m_nChoosePhotoType,m_path);//Jeff Printf;
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it ++) // 遍历文件夹;
- {
- path=(*it).c_str();
- //printf("Jeff:path=%s\n\n",path);//Jeff Printf;
- if(path.GetAt(path.ReverseFind ('\\')+1) != 's' && path.GetAt(path.ReverseFind ('\\')+1) != 'm')
- {
- path.MakeLower ();
- filename=path.Right(path.GetLength()-path.ReverseFind ('\\')-1);
- if(filename.Find(".")!=-1)
- filename=filename.Left(filename.Find("."));
- if(!myisdigit(filename))continue;
- if(m_nChoosePhotoType==1) // m_patharray1只添加修片文件夹;
- {
- m_patharray1.Add(path);
- //printf("Jeff:修片:m_patharray1.Add(%s)=%s\n\n",path);//Jeff Printf;
- }
- else // m_nChoosePhotoType=0,2
- {
- path2 = path;
- if(m_nChoosePhotoType==0) // 原片+修片;
- {
- path2.Replace("客户原片", "修好的片");
- //printf("Jeff:原片+修片 path2=%s\n\n",path2); // Jeff Printf;
- }
- if(m_bGrowthTX==0)
- {
- int pos = path2.Find(m_strOrderNumber);
- pos += m_strOrderNumber.GetLength();
- int pos2 = path2.ReverseFind('\\');
- path2 = path2.Left(pos)+path2.Right(path2.GetLength()-pos2);
- }
- if(m_nChoosePhotoType==0 && ::PathFileExists(path2)) // 原片+修片;
- {
- m_patharray1.Add(path2);
- //printf("Jeff:原片+修片:m_patharray1.Add(%s)=%s\n\n",path2);//Jeff Printf;
- }
- else //if( m_nChoosePhotoType == 2 ) // 只有原片;
- {
- path2.Replace(".raw", ".jpg");
- if(::PathFileExists (path2))
- {
- m_patharray1.Add(path2);continue;
- }
- path2.Replace (".nef", ".jpg");
- if(::PathFileExists(path2))
- {
- m_patharray1.Add(path2);continue;
- }
- path2.Replace (".cr2", ".jpg");
- if(::PathFileExists(path2))
- {
- m_patharray1.Add(path2);continue;
- }
- else
- {
- if(path.Right(3)!="jpg")continue;
- m_patharray1.Add (path);
- }
- }
- }
- }
- }
- if( m_nChoosePhotoType != 2) // Jeff:如果不是只查看原片;
- {//多种修好的效果
- CString path2;
- path2=g_path2+"\\";
- path2+=m_strOrderNumber;
- path2 +="\\"; //printf("Jeff:****paht2=%s\n\n",path2);//Jeff Printf;path2="修好的片"
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(path2), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it;it ++)
- {
- path=(*it).c_str();
- if(path.GetAt (path.ReverseFind ('\\')+1)!='s' && path.GetAt (path.ReverseFind ('\\')+1)!='m')
- {
- path.MakeLower ();
- path2=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
- if(path2.Find ("-")!=-1)
- {
- m_patharray1.Add (path);
- }
- }
- }
- }
- /////////////////
- if(0)//atoi(g_cominfoarray.ElementAt(0).ElementAt(109))==0)
- {
- char path[MAX_PATH];
- ::GetSystemDirectory (path, MAX_PATH);
- CString sysdir=path;
- sysdir+="\\lyfz";
- ::CreateDirectory (sysdir, NULL);
- sysdir+="\\";
- sysdir+=m_strOrderNumber;
- ::CreateDirectory (sysdir, NULL);
- sysdir+="\\";
- ImportPhoto dlg;
- dlg.m_bCopyToLocal=1;
- dlg.m_mode =1;
- dlg.m_pArray=&m_patharray1;
- dlg.m_savepath =sysdir;
- dlg.DoModal ();
- CStringArray temparray;
- CString filename;
- for(int i=0; i<m_patharray1.GetSize(); i++)
- {
- filename=m_patharray1.ElementAt(i);
- filename=filename.Right (filename.GetLength ()-filename.ReverseFind ('\\')-1);
- temparray.Add(sysdir+filename);
- }
- m_patharray1.RemoveAll();
- m_patharray1.Copy(temparray);
- }
- }
- if(m_patharray1.GetSize () && atoi(g_cominfoarray.ElementAt(0).ElementAt(61)))
- {
- int size=m_patharray1.GetSize ()-1;
- CString sTemp;
- int nPos;
- for(int i=0;i<size;i++)
- {
- nPos=rand()%(size-i);
- sTemp=m_patharray1.ElementAt (size-i);
- m_patharray1.SetAt (size-i, m_patharray1.ElementAt (nPos));
- m_patharray1.SetAt (nPos, sTemp);
- }
- }
- }
- m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
- m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
- m_List2.InitStyle();
- m_List2.InsertColumn(0,_T("编号"),LVCFMT_LEFT,45);
- m_List2.InsertColumn(1,_T("商品名称"),LVCFMT_LEFT,150);
- m_List2.InsertColumn(2,_T("数量"),LVCFMT_LEFT,45);
- m_List3.InitStyle();
- m_List3.InsertColumn(0,_T("autoid"),LVCFMT_LEFT,0);
- m_List3.InsertColumn(1,_T("编号"),LVCFMT_LEFT,45);
- m_List3.InsertColumn(2,_T("商品名称"),LVCFMT_LEFT,150);
- m_List3.InsertColumn(3,_T("价格"),LVCFMT_LEFT,45);
- m_List3.InsertColumn(4,_T("数量"),LVCFMT_LEFT,45);
- #ifdef LKAY_VERSION
- m_List3.InsertColumn(5,_T("P数"),LVCFMT_LEFT,55);
- m_List3.InsertColumn(6,_T("张数"),LVCFMT_LEFT,55);
- m_List3.InsertColumn(7,_T("照片编号"),LVCFMT_LEFT,365);
- #else
- m_List3.InsertColumn(5,_T("照片编号"),LVCFMT_LEFT,365);
- #endif
- #else
- if( FALSE==InitializeUI() ) return FALSE;
- #endif
- if(m_mode2==0)
- {
- GetData();
- if(m_checkstatus=="OK")
- {
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(85)) && IsHasRights2new(20)==0 )
- {
- Login2 dlg;
- if(dlg.DoModal ()!=IDOK)
- {
- MyBmpButton2 *btn=((MyBmpButton2*)m_picarray.ElementAt (4));
- btn->m_bmpdisable=btn->m_bmp->Clone();
- Graphics graph(btn->m_bmpdisable);
- CPoint pt1,pt2,pt3;
- pt1.x=0;
- pt1.y=0;
- pt2.x=btn->m_bmp->GetWidth();
- pt2.y=0;
- pt3.x=0;
- pt3.y=btn->m_bmp->GetHeight();
- Point destinationPoints[] = {
- Point(pt1.x, pt1.y), // destination for upper-left point of original
- Point(pt2.x, pt2.y), // destination for upper-right point of original
- Point(pt3.x, pt3.y)}; // destination for lower-left point of original
- ColorMatrix colorMatrix = \
- {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
- ImageAttributes imageAtt;
- imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault,ColorAdjustTypeBitmap);
- graph.DrawImage(btn->m_bmp,
- destinationPoints,
- 3,
- 0,
- 0,
- btn->m_bmp->GetWidth(),
- btn->m_bmp->GetHeight(),
- UnitPixel,
- &imageAtt);
- btn->EnableWindow (0);
- m_bCanSave=0;
- // CDialog::OnCancel ();
- // return 1;
- }
- else if(IsHasRightsnew2(20, dlg.m_rights)==0)
- {
- MyBmpButton2 *btn=((MyBmpButton2*)m_picarray.ElementAt (4));
- btn->m_bmpdisable=btn->m_bmp->Clone();
- Graphics graph(btn->m_bmpdisable);
- CPoint pt1,pt2,pt3;
- pt1.x=0;
- pt1.y=0;
- pt2.x=btn->m_bmp->GetWidth();
- pt2.y=0;
- pt3.x=0;
- pt3.y=btn->m_bmp->GetHeight();
- Point destinationPoints[] = {
- Point(pt1.x, pt1.y), // destination for upper-left point of original
- Point(pt2.x, pt2.y), // destination for upper-right point of original
- Point(pt3.x, pt3.y)}; // destination for lower-left point of original
- ColorMatrix colorMatrix = \
- {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
- ImageAttributes imageAtt;
- imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault,ColorAdjustTypeBitmap);
- graph.DrawImage(btn->m_bmp,
- destinationPoints,
- 3,
- 0,
- 0,
- btn->m_bmp->GetWidth(),
- btn->m_bmp->GetHeight(),
- UnitPixel,
- &imageAtt);
- btn->EnableWindow (0);m_bCanSave=0;
- // CDialog::OnCancel ();
- // return 1;
- }
- }
- }
- if(!m_delphotos.IsEmpty ())
- {
- m_delphotos.TrimLeft (";");
- m_delphotos.TrimRight (";");
- m_delphotos=";"+m_delphotos;
- m_delphotos+=";";
- for(int i=m_patharray1.GetSize ()-1; i>=0; i--)
- {
- CString no;
- no=m_patharray1.ElementAt (i);
- no=no.Right (no.GetLength ()-no.ReverseFind ('\\')-1);
- no=no.Left (no.Find ('.'));
- no=";"+no;
- no+=";";
- if(m_delphotos.Find(no)!=-1)
- {
- no=m_patharray1.ElementAt (i);
- m_patharray1.RemoveAt (i);
- m_patharray4.Add (no);
- }
- }
- }
- if(m_pArray)
- {
- for(int i=0; i<m_pArray->GetSize (); i+=2)
- {
- int j = 0;
- for( j=0; j<m_List2.GetItemCount (); j++)
- {
- if(m_pArray->ElementAt (i)==m_List2.GetItemText (j, 0))
- {
- CString name=m_pArray->ElementAt (i+1);
- int pos=name.Find ("$");
- if(pos!=0)continue;
- name.Delete (0,1);
- pos=name.Find (".");
- while(pos!=-1)
- {
- if(CheckOK(name.Left (pos)))
- {
- CString str=m_noarray.ElementAt (j);
- CString temp=name.Left (pos);
- temp=","+temp+",";
- if(str.Find (temp)==-1)
- {
- str+=name.Left (pos);
- str.TrimLeft (","); str=","+str+",";
- m_noarray.SetAt (j, str);
- str.TrimLeft (",");
- str.TrimRight (",");
- m_List2.SetItemText (j, 4, str);
- }
- }
- name=name.Right (name.GetLength ()-pos-1);
- pos=name.Find (".");
- }
- if(CheckOK(name))
- {
- CString str=m_noarray.ElementAt (j);
- CString temp=name;
- temp=","+temp+",";
- if(str.Find (temp)==-1)
- {
- str+=name;
- str.TrimLeft (","); str=","+str+",";
- m_noarray.SetAt (j, str);
- str.TrimLeft (",");
- str.TrimRight (",");
- m_List2.SetItemText (j, 4, str);
- }
- }
- }
- }
- for( j=0; j<m_List3.GetItemCount (); j++)
- {
- if(m_pArray->ElementAt (i)==m_List3.GetItemText (j, 0))
- {
- CString name=m_pArray->ElementAt (i+1);
- int pos=name.Find ("$");
- if(pos!=0)continue;
- name.Delete (0,1);
- pos=name.Find (".");
- while(pos!=-1)
- {
- if(CheckOK(name.Left (pos)))
- {
- CString str=m_no2array.ElementAt (j);
- CString temp=name.Left (pos);
- temp=","+temp+",";
- if(str.Find (temp)==-1)
- {
- str+=name.Left (pos);
- str.TrimLeft (","); str=","+str+",";
- m_no2array.SetAt (j, str);
- str.TrimLeft (",");
- str.TrimRight (",");
- #ifdef LKAY_VERSION
- m_List3.SetItemText (j, 7, str);
- #else
- m_List3.SetItemText (j, 5, str);
- #endif
- }
- }
- name=name.Right (name.GetLength ()-pos-1);
- pos=name.Find (".");
- }
- if(CheckOK(name))
- {
- CString str=m_no2array.ElementAt (j);
- CString temp=name;
- temp=","+temp+",";
- if(str.Find (temp)==-1)
- {
- str+=name;
- str.TrimLeft (","); str=","+str+",";
- m_no2array.SetAt (j, str);
- str.TrimLeft (",");
- str.TrimRight (",");
- #ifdef LKAY_VERSION
- m_List3.SetItemText (j, 7, str);
- #else
- m_List3.SetItemText (j, 5, str);
- #endif
- }
- }
- }
- }
- }
- }
- }
- else
- {
- GetData2();
- if(m_checkstatus!="未看")
- {
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(85)) && IsHasRights2new(20)==0 )
- {
- Login2 dlg;
- if(dlg.DoModal ()!=IDOK)
- {
- MyBmpButton2 *btn=((MyBmpButton2*)m_picarray.ElementAt (4));
- btn->m_bmpdisable=btn->m_bmp->Clone();
- Graphics graph(btn->m_bmpdisable);
- CPoint pt1,pt2,pt3;
- pt1.x=0;
- pt1.y=0;
- pt2.x=btn->m_bmp->GetWidth();
- pt2.y=0;
- pt3.x=0;
- pt3.y=btn->m_bmp->GetHeight();
- Point destinationPoints[] = {
- Point(pt1.x, pt1.y), // destination for upper-left point of original
- Point(pt2.x, pt2.y), // destination for upper-right point of original
- Point(pt3.x, pt3.y)}; // destination for lower-left point of original
- ColorMatrix colorMatrix = \
- {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
- ImageAttributes imageAtt;
- imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault,ColorAdjustTypeBitmap);
- graph.DrawImage(btn->m_bmp,
- destinationPoints,
- 3,
- 0,
- 0,
- btn->m_bmp->GetWidth(),
- btn->m_bmp->GetHeight(),
- UnitPixel,
- &imageAtt);
- btn->EnableWindow (0);
- m_bCanSave=0;
- // CDialog::OnCancel ();
- // return 1;
- }
- else if(IsHasRightsnew2(20, dlg.m_rights)==0)
- {
- MyBmpButton2 *btn=((MyBmpButton2*)m_picarray.ElementAt (4));
- btn->m_bmpdisable=btn->m_bmp->Clone();
- Graphics graph(btn->m_bmpdisable);
- CPoint pt1,pt2,pt3;
- pt1.x=0;
- pt1.y=0;
- pt2.x=btn->m_bmp->GetWidth();
- pt2.y=0;
- pt3.x=0;
- pt3.y=btn->m_bmp->GetHeight();
- Point destinationPoints[] = {
- Point(pt1.x, pt1.y), // destination for upper-left point of original
- Point(pt2.x, pt2.y), // destination for upper-right point of original
- Point(pt3.x, pt3.y)}; // destination for lower-left point of original
- ColorMatrix colorMatrix = \
- {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
- ImageAttributes imageAtt;
- imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault,ColorAdjustTypeBitmap);
- graph.DrawImage(btn->m_bmp,
- destinationPoints,
- 3,
- 0,
- 0,
- btn->m_bmp->GetWidth(),
- btn->m_bmp->GetHeight(),
- UnitPixel,
- &imageAtt);
- btn->EnableWindow (0);m_bCanSave=0;
- // CDialog::OnCancel ();
- // return 1;
- }
- }
- }
- if(!m_delphotos.IsEmpty()) // add by Jeff:在加载时,先将已删除的相片从欲查看的相片中删除;
- {
- m_delphotos.TrimLeft (";");
- m_delphotos.TrimRight (";");
- m_delphotos=";"+m_delphotos;
- m_delphotos+=";";
- for(int i=m_patharray1.GetSize ()-1; i>=0; i--)
- {
- CString no;
- no=m_patharray1.ElementAt (i);
- no=no.Right (no.GetLength ()-no.ReverseFind ('\\')-1);
- no=no.Left (no.Find ('.'));
- no=";"+no;
- no+=";";
- if(m_delphotos.Find (no)!=-1)
- {
- no=m_patharray1.ElementAt (i);
- m_patharray1.RemoveAt(i);
- m_patharray4.Add (no);
- }
- }
- }
- }
- LoadPhotos();//在界面上显示图片;
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(95)) || g_cominfoarray.ElementAt(0).ElementAt(95)=="" )
- {
- int timer1=atoi(g_cominfoarray.ElementAt(0).ElementAt(96));
- m_timer=atoi(g_cominfoarray.ElementAt(0).ElementAt(97));
- if(timer1==0)timer1=60;
- if(m_timer==0)m_timer=20;
- SetTimer(1, timer1*60000, NULL);
- }
- return false; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- BOOL ChoosePhotoSkin2::InitializeUI()
- {
- g_bInSkin=1;
- m_ticks=::GetTickCount ();
- // TODO: Add extra initialization here
- if(g_cursorhand==NULL)
- g_cursorhand=AfxGetApp()->LoadCursor(IDC_CURSORHAND);
- BYTE *pData=NULL;
- BYTE *pDataBegin;
- //printf("Jeff:loadLia路径:%s\n\n",g_mainpath+"\\skin\\"+m_liapath);//Jeff Printf;
- if(!LoadLia(g_mainpath+"\\skin\\"+m_liapath, &pData, &pDataBegin, &m_pBk, m_hWnd))
- {
- EndDialog(0);
- return false;
- }
- //printf("Jeff:g_resdata2.nPicCount=%d\n\n",g_resdata2.nPicCount); // Jeff Printf,这个nPicCount好像一直是15;
- for(int i=0; i<g_resdata2.nPicCount; i++)
- {
- g_resdata2.rect[i].left *=g_fscalex;
- g_resdata2.rect[i].right *=g_fscalex;
- g_resdata2.rect[i].top *=g_fscaley;
- g_resdata2.rect[i].bottom *=g_fscaley;
- if(i==8)
- g_resdata2.rect[i]=g_resdata2.rect[2];
- else if(i==9)
- g_resdata2.rect[i]=g_resdata2.rect[3];
- else if(i==10)
- g_resdata2.rect[i]=g_resdata2.rect[1];
- if(g_resdata2.nPicBmpCount[i])
- {
- MyBmpButton2 *pic=new MyBmpButton2;
- m_picarray.Add((DWORD)pic);
- CRect rc=g_resdata2.rect[i];
- CString str;
- str.Format (_T("%d"), i+1);
- pic->Create(str, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW , rc, this, i+100);
- pic->m_bmpcount =g_resdata2.nPicBmpCount [i];
- pic->ReadBmp (&pData, NULL, this);
- #ifdef SZWNS_VERSION
- if(i==3 && m_mode2==0)
- {
- Image *img=NULL;
- LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG6), _T("JPG") );
- delete pic->m_bmp;
- pic->m_bmp=img->Clone();
- delete img;
- img=NULL;
- LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG7), _T("JPG") );
- delete pic->m_bmpfocus;
- pic->m_bmpfocus=img->Clone();
- delete img;
- img=NULL;
- LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG8), _T("JPG") );
- delete pic->m_bmpfocused;
- pic->m_bmpfocused=img->Clone();
- delete img;
- }
- #endif
- }
- else
- m_picarray.Add (NULL);
- m_rcarray.Add(g_resdata2.rect[i]);
- }
- delete []pDataBegin;
- if(m_mode2)//看设计
- {
- m_bHide=0;
- // printf("Jeff:g_cominfoarray.ElementAt(0).ElementAt(86)=%s\n\n",g_cominfoarray.ElementAt(0).ElementAt(86)); // Jeff Printf;
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
- {
- ((MyBmpButton2*)m_picarray.ElementAt (3))->ShowWindow (SW_HIDE);
- CRect rc,rc2;
- ((MyBmpButton2*)m_picarray.ElementAt (3))->GetWindowRect(rc);
- ((MyBmpButton2*)m_picarray.ElementAt (1))->GetWindowRect(rc2);
- int dtx=rc.right -rc2.right ;
- ScreenToClient(rc2);
- rc2.left +=dtx;
- rc2.right +=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (1))->MoveWindow(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt (0))->GetWindowRect(rc2);
- ScreenToClient(rc2);
- rc2.left +=dtx;
- rc2.right +=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (0))->MoveWindow(rc2);
- }
- CRect rc,rc2;
- ((MyBmpButton2*)m_picarray.ElementAt (5))->GetWindowRect(rc);
- ((MyBmpButton2*)m_picarray.ElementAt (4))->GetWindowRect(rc2);
- int dtx=rc.right -rc2.right ;
- rc2=rc;
- // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
- {
- float scale=0.9;
- dtx*=scale;
- int wid=rc2.Width ()*scale;
- int hei=rc2.Height ()*scale;
- int dty=rc2.Height ()-hei;
- dty/=2;
- rc2.left =rc2.right -wid;
- rc2.top +=dty;
- rc2.bottom =rc2.top +hei;
- }
- ScreenToClient(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt (5))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (4))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (14))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (2))->MoveWindow(rc2);
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
- {
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (3))->MoveWindow(rc2);
- }
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (1))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (0))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (8))->MoveWindow(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt (11))->ShowWindow (SW_HIDE);
- }
- else
- {
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
- {
- ((MyBmpButton2*)m_picarray.ElementAt (3))->ShowWindow (SW_HIDE);
- CRect rc,rc2;
- ((MyBmpButton2*)m_picarray.ElementAt (3))->GetWindowRect(rc);
- ((MyBmpButton2*)m_picarray.ElementAt (1))->GetWindowRect(rc2);
- int dtx=rc.right -rc2.right ;
- ScreenToClient(rc2);
- rc2.left +=dtx;
- rc2.right +=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (1))->MoveWindow(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt (0))->GetWindowRect(rc2);
- ScreenToClient(rc2);
- rc2.left +=dtx;
- rc2.right +=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (0))->MoveWindow(rc2);
- }
- }
- if(1)//m_mode2==0)
- {
- ((MyBmpButton2*)m_picarray.ElementAt (7))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (8))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (9))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (10))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (11))->ShowWindow (SW_HIDE);
- }
- else
- {
- ((MyBmpButton2*)m_picarray.ElementAt (7))->EnableWindow (0);
- ((MyBmpButton2*)m_picarray.ElementAt (0))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (1))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (2))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (3))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (11))->ShowWindow (SW_HIDE);
- if(IsHasRights2new(37)==0)
- {
- ((MyBmpButton2*)m_picarray.ElementAt (8))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (9))->ShowWindow (SW_HIDE);
- }
- }
- if(m_mode2)
- {
- ((MyBmpButton2*)m_picarray.ElementAt (8))->ShowWindow (SW_SHOW);
- // ((MyBmpButton2*)m_picarray.ElementAt (8))->SetPushDown (1);
- ((MyBmpButton2*)m_picarray.ElementAt (12))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (13))->ShowWindow (SW_HIDE);
- }
- else//移按钮位置
- {
- CRect rc,rc2;
- ((MyBmpButton2*)m_picarray.ElementAt (5))->GetWindowRect(rc);
- ((MyBmpButton2*)m_picarray.ElementAt (4))->GetWindowRect(rc2);
- int dtx=rc.right -rc2.right ;
- rc2=rc;
- // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
- {
- float scale=0.9;
- dtx*=scale;
- int wid=rc2.Width ()*scale;
- int hei=rc2.Height ()*scale;
- int dty=rc2.Height ()-hei;
- dty/=2;
- rc2.left =rc2.right -wid;
- rc2.top +=dty;
- rc2.bottom =rc2.top +hei;
- }
- ScreenToClient(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt (5))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (4))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (14))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (2))->MoveWindow(rc2);
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
- {
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (3))->MoveWindow(rc2);
- }
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (12))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (13))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (1))->MoveWindow(rc2);
- rc2.left -=dtx;
- rc2.right -=dtx;
- ((MyBmpButton2*)m_picarray.ElementAt (0))->MoveWindow(rc2);
- }
- #ifndef MNLS_VERSION
- ((MyBmpButton2*)m_picarray.ElementAt (7))->ShowWindow (SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt (7))->EnableWindow (0);
- Graphics graph(m_pBk);
- Image *img=NULL;
- if(m_mode2==0)
- ::LoadImageFromBuf (&img, g_mainpath+"\\图片\\标题-选片.jpg");
- else
- ::LoadImageFromBuf (&img, g_mainpath+"\\图片\\标题-看设计.jpg");
- if(img)
- {
- if(img->GetWidth()==2000)
- {
- graph.SetSmoothingMode(SmoothingModeHighQuality);
- graph.DrawImage(img, 0,0);
- }
- delete img;
- }
- #endif
- CRect listrc=m_rcarray.ElementAt (6);
- CRect rc;
- GetClientRect(rc);
- rc.top=listrc.top;
- m_List1.MoveWindow (rc);
- CString path,str;
- if(m_mode2)
- {
- m_path=g_path3+"\\";
- m_path+=m_strOrderNumber;
- m_path +="\\";
- // printf("Jeff:m_path=%s\n\n",m_path); // Jeff Printf;
- }
- if(m_mode2)//看设计
- {
- GetPhotos();
- }
- else
- {
- //AfxMessageBox("789");
- IsGrowthTx growthtxdlg;
- growthtxdlg.m_mode=1;
- growthtxdlg.m_strOrderNumber=m_strOrderNumber;
- growthtxdlg.DoModal ();
- m_bGrowthTX=growthtxdlg.m_bGrowthTx;
- m_seltxname=growthtxdlg.m_seltxname;
- /*if(!growthtxdlg.m_seltxname.IsEmpty ())
- {
- if(growthtxdlg.m_seltxname!="全部")
- {
- path+=growthtxdlg.m_seltxname;
- path+="\\";
- }
- }*/
- if(CheckHC())
- {
- m_bFromLocal=1;
- char path[MAX_PATH];
- ::GetSystemDirectory (path, MAX_PATH);
- CString sysdir=path;
- sysdir+="\\lyfz";
- ::CreateDirectory (sysdir, NULL);
- sysdir+="\\";
- sysdir+=m_strOrderNumber;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(sysdir), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin();coo.end() != it;it ++)
- {
- str=(*it).c_str();
- // printf("Jeff:str=%s\n\n",str);// Jeff Printf
- if(str.GetAt (str.ReverseFind ('\\')+1)!='s' && str.GetAt (str.ReverseFind ('\\')+1)!='m')
- {
- m_patharray1.Add (str);
- }
- }
- }
- if(m_patharray1.GetSize ()==0)
- {
- if(IsPhoto2Exist())
- {
- SelBrunDevice dlg;
- dlg.m_mode=1;
- if(dlg.DoModal ()==IDOK)
- m_nChoosePhotoType=dlg.m_sel;
- else
- m_nChoosePhotoType=0;
- //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
- }
- else
- AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
- {
- CString path2;
- m_path=g_path1+"\\";
- m_path+=m_strOrderNumber;
- m_path +="\\";
- if(m_seltxname!="" && m_seltxname!="全部")
- {
- m_path+=m_seltxname; m_path +="\\";
- }
- if(m_nChoosePhotoType==1)
- {
- m_path=g_path2+"\\";
- m_path+=m_strOrderNumber;
- m_path +="\\";
- }
- CString filename;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(m_path), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it ++)
- {
- path=(*it).c_str();
- if(path.GetAt (path.ReverseFind ('\\')+1)!='s' && path.GetAt (path.ReverseFind ('\\')+1)!='m')
- {
- path.MakeLower ();
- filename=path.Right(path.GetLength()-path.ReverseFind ('\\')-1);
- if(filename.Find(".")!=-1)
- filename=filename.Left(filename.Find("."));
- if(!myisdigit(filename))continue;
- if(m_nChoosePhotoType==1)
- {
- m_patharray1.Add (path);
- }
- else
- {
- path2=path;
- if(m_nChoosePhotoType==0)
- path2.Replace ("客户原片", "修好的片");
- if(m_bGrowthTX==0)
- {
- int pos=path2.Find (m_strOrderNumber);
- pos+=m_strOrderNumber.GetLength ();
- int pos2=path2.ReverseFind ('\\');
- path2=path2.Left (pos)+path2.Right (path2.GetLength ()-pos2);
- }
- if(m_nChoosePhotoType==0 && ::PathFileExists (path2))
- {
- m_patharray1.Add (path2);
- }
- else
- {
- path2.Replace (".raw", ".jpg");
- if(::PathFileExists (path2))
- {
- m_patharray1.Add (path2);continue;
- }
- path2.Replace (".nef", ".jpg");
- if(::PathFileExists (path2))
- {
- m_patharray1.Add (path2);continue;
- }
- path2.Replace (".cr2", ".jpg");
- if(::PathFileExists (path2))
- {
- m_patharray1.Add (path2);continue;
- }
- else
- {
- if(path.Right(3)!="jpg")continue;
- m_patharray1.Add (path);
- }
- }
- }
- }
- }
- }
- // if(0)
- {//多种修好的效果
- CString path2;
- path2=g_path2+"\\";
- path2+=m_strOrderNumber;
- path2 +="\\";
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(path2), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin();
- coo.end() != it;
- it ++)
- {
- path=(*it).c_str();
- if(path.GetAt (path.ReverseFind ('\\')+1)!='s' && path.GetAt (path.ReverseFind ('\\')+1)!='m')
- {
- path.MakeLower ();
- path2=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
- if(path2.Find ("-")!=-1)
- {
- m_patharray1.Add (path);
- }
- }
- }
- }
- /////////////////
- if(0)//atoi(g_cominfoarray.ElementAt(0).ElementAt(109))==0)
- {
- char path[MAX_PATH];
- ::GetSystemDirectory (path, MAX_PATH);
- CString sysdir=path;
- sysdir+="\\lyfz";
- ::CreateDirectory (sysdir, NULL);
- sysdir+="\\";
- sysdir+=m_strOrderNumber;
- ::CreateDirectory (sysdir, NULL);
- sysdir+="\\";
- ImportPhoto dlg;
- dlg.m_bCopyToLocal=1;
- dlg.m_mode =1;
- dlg.m_pArray=&m_patharray1;
- dlg.m_savepath =sysdir;
- dlg.DoModal ();
- CStringArray temparray;
- CString filename;
- for(int i=0; i<m_patharray1.GetSize(); i++)
- {
- filename=m_patharray1.ElementAt(i);
- filename=filename.Right (filename.GetLength ()-filename.ReverseFind ('\\')-1);
- temparray.Add(sysdir+filename);
- }
- m_patharray1.RemoveAll();
- m_patharray1.Copy(temparray);
- }
- }
- if(m_patharray1.GetSize () && atoi(g_cominfoarray.ElementAt(0).ElementAt(61)))
- {
- int size=m_patharray1.GetSize ()-1;
- CString sTemp;
- int nPos;
- for(int i=0;i<size;i++)
- {
- nPos=rand()%(size-i);
- sTemp=m_patharray1.ElementAt (size-i);
- m_patharray1.SetAt (size-i, m_patharray1.ElementAt (nPos));
- m_patharray1.SetAt (nPos, sTemp);
- }
- }
- }
- m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
- m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
- m_List2.InitStyle();
- m_List2.InsertColumn(0,_T("编号"),LVCFMT_LEFT,45);
- m_List2.InsertColumn(1,_T("商品名称"),LVCFMT_LEFT,150);
- m_List2.InsertColumn(2,_T("数量"),LVCFMT_LEFT,45);
- m_List3.InitStyle();
- m_List3.InsertColumn(0,_T("autoid"),LVCFMT_LEFT,0);
- m_List3.InsertColumn(1,_T("编号"),LVCFMT_LEFT,45);
- m_List3.InsertColumn(2,_T("商品名称"),LVCFMT_LEFT,150);
- m_List3.InsertColumn(3,_T("价格"),LVCFMT_LEFT,45);
- m_List3.InsertColumn(4,_T("数量"),LVCFMT_LEFT,45);
- #ifdef LKAY_VERSION
- m_List3.InsertColumn(5,_T("P数"),LVCFMT_LEFT,55);
- m_List3.InsertColumn(6,_T("张数"),LVCFMT_LEFT,55);
- m_List3.InsertColumn(7,_T("照片编号"),LVCFMT_LEFT,365);
- #else
- m_List3.InsertColumn(5,_T("照片编号"),LVCFMT_LEFT,365);
- #endif
- }
- void ChoosePhotoSkin2::OnPaint()
- {
- try
- {
- CPaintDC dc(this); // device context for painting
- // TODO: Add your message handler code here
- if(m_pBk==NULL)
- {
- return ;
- }
- CRect rc;
- GetClientRect(rc);
- Graphics graph(dc.GetSafeHdc ());
- Rect destinationRect(0,0,rc.Width (), rc.Height ());
- int width=m_pBk->GetWidth() ;
- int height=m_pBk->GetHeight() ;
- graph.SetSmoothingMode(SmoothingModeHighQuality);
- graph.DrawImage(m_pBk, destinationRect, 0,0,width,height,UnitPixel);
- // Do not call CDialog::OnPaint() for painting messages
- }
- catch(...)
- {
- }
- }
- void ChoosePhotoSkin2::OnPaint2(CWnd *pWnd)
- {
- try
- {
- CPaintDC dc(pWnd); // device context for painting
- // TODO: Add your message handler code here
- CRect rc;
- GetClientRect(rc);
- if(m_pBk==NULL)
- {
- return ;
- }
- int width=m_pBk->GetWidth() ;
- int height=m_pBk->GetHeight() ;
- Graphics graph(dc.GetSafeHdc ());
- Rect destinationRect(0,0,rc.Width (), rc.Height ());
- graph.SetSmoothingMode(SmoothingModeHighQuality);
- graph.DrawImage(m_pBk, destinationRect, 0,0,width,height,UnitPixel);
- }
- catch(...)
- {
- }
- }
- void ChoosePhotoSkin2::OnDestroy()
- {
- try
- {
- TerminateThread();
- if(m_pBk)delete m_pBk;
- MyBmpButton2 *pic=NULL;
- for(int i=0; i<m_picarray.GetSize(); i++)
- {
- pic=(MyBmpButton2*)m_picarray.ElementAt(i);
- if(pic)
- {
- pic->DestroyWindow();
- delete pic;
- }
- }
- m_picarray.RemoveAll();
- if(m_selphotownd.GetSafeHwnd ())
- {
- m_selphotownd.DestroyWindow ();
- }
- if(m_selphotownd2.GetSafeHwnd ())
- {
- m_selphotownd2.DestroyWindow ();
- }
- /* char path[MAX_PATH];
- ::GetSystemDirectory (path, MAX_PATH);
- CString sysdir=path;
- sysdir+="\\lyfz";
- ::DeleteDirectory (sysdir);*/
- CDialog::OnDestroy();
- }
- catch(...)
- {
- }
- }
- BOOL ChoosePhotoSkin2::OnEraseBkgnd(CDC* pDC)
- {
- // TODO: Add your message handler code here and/or call default
- return 1;
- }
- void ChoosePhotoSkin2::SetLiaPath(CString path)
- {
- m_liapath=path;
- }
- BEGIN_EVENTSINK_MAP(ChoosePhotoSkin2, CDialog)
- //{{AFX_EVENTSINK_MAP(ChoosePhotoSkin2)
- ON_EVENT(ChoosePhotoSkin2, 100, 150 /* FSCommand */, OnFSCommandShockwaveflash1, VTS_BSTR VTS_BSTR)
- //}}AFX_EVENTSINK_MAP
- END_EVENTSINK_MAP()
- void ChoosePhotoSkin2::OnFSCommandShockwaveflash1(LPCTSTR command, LPCTSTR args)
- {
- // TODO: Add your control notification handler code here
- }
- unsigned __stdcall LoadThumbNail3(LPVOID lpParam)
- {
- ChoosePhotoSkin2 *pDlg=(ChoosePhotoSkin2*)lpParam;
- CListCtrl *ListCtrl=&pDlg->m_List1;
- try
- {
- CImageList* pImgList=&pDlg->m_ImageListThumb;
- // reset our image list
- for(int i=0; i<pImgList->GetImageCount(); i++)
- pImgList->Remove(i);
- // remove all items from list view
- ListCtrl->DeleteAllItems();
- pImgList->SetImageCount(pDlg->m_vFileName.size());
- // TCHAR path[MAX_PATH];
- vector<CString>::iterator iter;
- // Set redraw to FALSE to avoid flickering during adding new items
- ListCtrl->SetRedraw(FALSE);
- int nIndex=0;
- CString str,spath;
- if(pDlg->m_mode2==0) // 选片;
- {
- for(iter=pDlg->m_vFileName.begin(); iter!=pDlg->m_vFileName.end() && pDlg->m_bTerminate!=true; iter++, nIndex++)
- {
- str=*iter;
- str=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
- str=str.Left (str.Find ('.'));
- str+=pDlg->GetSelName(str);
- ListCtrl->InsertItem(nIndex, str, nIndex);
- }
- }
- else // 看设计;
- {
- for(iter=pDlg->m_vFileName.begin(); iter!=pDlg->m_vFileName.end() && pDlg->m_bTerminate!=true; iter++, nIndex++)
- {
- str=*iter;
- spath.Empty ();
- if(str.Left (str.ReverseFind ('\\')+1)!=pDlg->m_path)
- {
- spath=str.Left (str.ReverseFind ('\\')+1);
- spath= spath.Right (spath.GetLength ()-pDlg->m_path.GetLength ());
- }
- str=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
- if(str.Find("delgabook")!=-1)
- {
- str.TrimRight ("\\");
- str=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
- str.Replace ("delgabook", "Flash");
- ListCtrl->InsertItem(nIndex, str, nIndex);
- }
- else
- {
- str=spath+str.Left (str.GetLength ()-4);
- CString temp=pDlg->GetSelName(str);
- ListCtrl->InsertItem(nIndex, str+temp, nIndex);
- }
- }
- }
- ListCtrl->SetRedraw(TRUE);
- ListCtrl->Invalidate();
- const float fRatio=(float)THUMBNAIL_HEIGHT/THUMBNAIL_WIDTH;
- int XDest, YDest, nDestWidth, nDestHeight;
- nIndex=0;
- SolidBrush whitebrush(Color(255,255,255,255));
- Image *pHideImg=NULL;
- Bitmap *pNULLBmp=new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB );
- Graphics graph2(pNULLBmp);
- graph2.Clear(Color(255,0,0,0));
- for(iter=pDlg->m_vFileName.begin(); iter!=pDlg->m_vFileName.end() && pDlg->m_bTerminate!=true; iter++, nIndex++)
- {
- // Load Image File
- Image *image=NULL;
- Bitmap *pBmp=NULL;
- str=*iter;
- spath=str.Left (str.ReverseFind ('\\')+1);
- spath+="s";
- spath+=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
- // if(pDlg->m_mode2==0 && pDlg->m_bHide && pHideImg==NULL)
- if( pDlg->m_bHide && pHideImg==NULL)
- {
- LoadImageFromRes(&pHideImg, MAKEINTRESOURCE(IDR_JPG5), _T("JPG") );
- }
- BOOL bNullimg=0;
- if(pHideImg==NULL)
- {
- // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(109))==0 && pDlg->m_mode2==0)
- if(0)//pDlg->m_bFromLocal && pDlg->m_mode2==0)
- {
- spath=spath.Right (spath.GetLength ()-spath.ReverseFind ('\\'));
- CString stemp;
- stemp=g_path2+"\\";
- stemp+=pDlg->m_strOrderNumber;
- stemp +="\\";
- stemp+=spath;
- if(::CheckFileExist (stemp))
- spath=stemp;
- else
- {
- stemp=g_path1+"\\";
- stemp+=pDlg->m_strOrderNumber;
- stemp +="\\";
- stemp+=spath;
- spath=stemp;
- }
- }
- if(::CheckFileExist (spath))
- {
- ::LoadImageFromBuf (&image, spath);
- }
- else if(::CheckFileExist (str))
- ::LoadImageFromBuf (&image, str);
- else
- {
- bNullimg=1;
- image=pNULLBmp;
- }
- if(image==NULL)continue;
- if(image->GetWidth()==0)
- continue;
- int orientation=GetOrientation(image);
- if(orientation==8)
- image->RotateFlip( Rotate270FlipNone );
- else if(orientation==6)
- image->RotateFlip( Rotate90FlipNone );
- }
- else
- image=pHideImg;
- // Calculate Rect to fit to canvas
- const float fImgRatio=(float)image->GetHeight()/image->GetWidth();
- if(fImgRatio > fRatio)
- {
- nDestWidth=THUMBNAIL_HEIGHT/fImgRatio;
- XDest=(THUMBNAIL_WIDTH-nDestWidth)/2;
- YDest=0;
- nDestHeight=THUMBNAIL_HEIGHT;
- }
- else
- {
- XDest=0;
- nDestWidth=THUMBNAIL_WIDTH;
- nDestHeight=THUMBNAIL_WIDTH*fImgRatio;
- YDest=(THUMBNAIL_HEIGHT-nDestHeight)/2;
- }
- pBmp=new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB );
- Graphics graph2(pBmp);
- graph2.Clear(Color(255,192,192,192));
- graph2.FillRectangle (&whitebrush,1, 1, THUMBNAIL_WIDTH-2, THUMBNAIL_HEIGHT-2);
- Graphics graph(pBmp);
- Rect desRect(XDest, YDest, nDestWidth, nDestHeight);
- // Draw Image
- graph.DrawImage(image, desRect, 0,0,image->GetWidth(),image->GetHeight(),UnitPixel);
- if(pHideImg==NULL && bNullimg==0)
- delete image;
- // Attach to Bitmap and Replace image in CImageList
- CBitmap bitmap;
- HBITMAP hbmp;
- pBmp->GetHBITMAP(Color(255,255,255,255), &hbmp);
- bitmap.Attach(hbmp);
- pImgList->Replace(nIndex, &bitmap, NULL);
- delete pBmp;
- // Redraw only a current item for removing flickering and fast speed.
- ListCtrl->RedrawItems(nIndex, nIndex);
- // Release used DC and Object
- }
- delete pNULLBmp;
- if(pHideImg)delete pHideImg;
- ListCtrl->Invalidate();
- pDlg->m_bRunning=false;
- pDlg->m_bTerminate=false;
- pDlg->PostMessage(WM_USER+200, 0, 0);
- _endthreadex( 0 );
- return 0;
- }
- catch(...)
- {
- ListCtrl->Invalidate();
- pDlg->m_bRunning=false;
- pDlg->m_bTerminate=false;
- pDlg->PostMessage(WM_USER+200, 0, 0);
- _endthreadex( 0 );
- }
- }
- void ChoosePhotoSkin2::LoadThumbImages()
- {
- TerminateThread();
- m_hThread = (HANDLE)_beginthreadex(NULL,0, LoadThumbNail3,(LPVOID)this,0/* CREATE_SUSPENDED*/,&m_dwThreadID);
- m_bRunning=true;
- }
- BOOL ChoosePhotoSkin2::TerminateThread()
- {
- if ( !m_bRunning )
- return TRUE;
- m_bTerminate=true;
- for( ; ; )
- {
- if ( ::WaitForSingleObject(m_hThread, 0) == WAIT_OBJECT_0 )
- break;
- MSG msg;
- while (::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
- {
- if (!AfxGetApp()->PumpMessage())
- break;
- }
- }
- ::CloseHandle(m_hThread);
- return TRUE;
- }
- void ChoosePhotoSkin2::OnDblclkList1()
- {
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- return;
- }
- CArray<int,int>posarray;
- int iItem=m_List1.GetNextSelectedItem(pos);
- posarray.Add (iItem);
- while (pos)
- {
- int iItem=m_List1.GetNextSelectedItem(pos);
- posarray.Add (iItem);
- if(posarray.GetSize ()>3)break;
- }
- if(posarray.GetSize ()>=2)
- {
- CStringArray *m_pPtahArray=GetCurArray();
- CComparePhoto dlg;
- dlg.m_path1=m_pPtahArray->ElementAt (posarray.ElementAt(0));
- dlg.m_path2=m_pPtahArray->ElementAt (posarray.ElementAt(1));
- if(posarray.GetSize ()>2)
- dlg.m_path3=m_pPtahArray->ElementAt (posarray.ElementAt(2));
- if(posarray.GetSize ()>3)
- dlg.m_path4=m_pPtahArray->ElementAt (posarray.ElementAt(3));
- dlg.DoModal();
- return;
- }
- if(m_mode2==1)//看设计
- {
- CString title=m_List1.GetItemText (iItem, 0);
- if(title.Find ("Flash")!=-1)
- {
- title.Replace ("Flash", "delgabook");
- CString str=m_path+title+"\\delgaBook.exe";
- ShellExecute(NULL, _T("open"), str, NULL, NULL, SW_SHOWNORMAL);
- return;
- }
- }
- m_showpichwd=NULL;
- ShowPic22 dlg;
- if(m_mode2==1)
- dlg.m_bShowName=1;
- dlg.m_pParent =this;
- dlg.m_pos=iItem;
- if(m_mode2==0 && atoi(g_cominfoarray.ElementAt(0).ElementAt(100)))
- {
- CStringArray array;
- CStringArray arraymsize;
- CStringArray *pArray=GetCurArray();
- array.Copy(*pArray);
- for(int i=0; i<array.GetSize(); i++)
- {
- CString str=array.ElementAt(i);
- CString spath=str.Left (str.ReverseFind ('\\')+1);
- spath+="m";
- spath+=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
- if(::PathFileExists(spath))
- arraymsize.Add(spath);
- else
- arraymsize.Add(str);
- }
- dlg.m_pPathArray=&arraymsize;
- dlg.m_pPathArrayBigsize=&array;
- dlg.DoModal ();
- }
- else
- {
- dlg.m_pPathArray=GetCurArray();
- dlg.DoModal ();
- }
- m_showpichwd=NULL;
- }
- void ChoosePhotoSkin2::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- OnDblclkList1();
- *pResult = 0;
- }
- CString GetModifyTime2(CString path)
- {
- HANDLE hFile;
- WIN32_FIND_DATA wfd;
- SYSTEMTIME systime;
- FILETIME localtime;
- CString stime; //输出时间
- memset(&wfd, 0, sizeof(wfd));
- if((hFile=FindFirstFile(path, &wfd))==INVALID_HANDLE_VALUE)
- return "";
- //ok,转换时间
- FileTimeToLocalFileTime(&wfd.ftLastWriteTime,&localtime);
- FileTimeToSystemTime(&localtime,&systime);
- stime.Format("%4d%02d%02d",
- systime.wYear,systime.wMonth,systime.wDay);
- return stime;
- }
- BOOL ChoosePhotoSkin2::GetData()//选片模式;
- {
- m_List2.DeleteAllItems ();
- m_List3.DeleteAllItems ();
- m_noarray.RemoveAll ();
- m_no2array.RemoveAll ();
- #ifdef CHILD_VERSION
- CString filter="id='"+m_strOrderNumber+"';id='"+m_strOrderNumber+"';;id='"+m_strOrderNumber+"'";
- if(m_seltxname!="" && m_seltxname!="全部")
- {
- filter="id='"+m_strOrderNumber+"' and growthtxname='"+m_seltxname+"';id='"+m_strOrderNumber+"';;id='"+m_strOrderNumber+"'";
- }
- #else
- CString filter="id='"+m_strOrderNumber+"' and kind<>'2';id='"+m_strOrderNumber+"';;id='"+m_strOrderNumber+"'";
- #endif
- g_sendhead.code[0]=50;
- g_sendhead.code[1]=11;
- g_sendhead.code[2]=4;
- g_sendhead.code[3]=182;
- g_sendhead.tabcount=4;
- g_sendhead.bsql=0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return 0;
- CArray<CStringArray, CStringArray>sparray;
- DataToArray(&sparray, &g_List1array, &m_sparray, &oldsparray);
- m_patharray2.RemoveAll ();
- CString str,kind;
- int nchoosezs=0;
- int list2pos=0;
- int list3pos=0;
- CString savepath;
- savepath.Format ("%s\\%s.dat", g_mainpath, m_strOrderNumber);
- CString stm1=GetModifyTime2(savepath);
- CTime tm1=CTime::GetCurrentTime ();
- tm1-=CTimeSpan(2, 0, 0, 0);
- CString stm2=tm1.Format ("%Y%m%d");
- BOOL bLoadHistory=0;
- if(::CheckFileExist (savepath) && stm1>stm2)
- {
- if(AfxMessageBox("提醒:请谨慎操作\r\n上次选片未正常退出, 是否还原到上次选片状态?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
- bLoadHistory=1;
- }
- if(bLoadHistory)
- {
- CArray<CStringArray, CStringArray>List1array;
- CFile fp;
- fp.Open (savepath, CFile::modeRead);
- DWORD nMessageLen=fp.GetLength ();
- BYTE *szChatMessage = new BYTE[nMessageLen];
- fp.Read (szChatMessage, nMessageLen);
- fp.Close ();
- int count;
- memcpy(&count, szChatMessage+(nMessageLen-sizeof(int)), sizeof(int));
- CMemFile memfile;
- memfile.Attach (szChatMessage, nMessageLen);
- CArchive ar(&memfile, CArchive::load);
- List1array.SetSize(count);
- int i = 0;
- for( i=0; i<List1array.GetSize (); i++)
- {
- List1array.ElementAt (i).Serialize (ar);
- }
- ar.Close();
- memfile.Detach ();
- delete []szChatMessage;
- list2pos=0;
- list3pos=0;
- for( i=0; i<List1array.GetSize (); i++)
- {
- if(0)//List1array.ElementAt (i).GetSize ()==6)
- {
- kind="0";
- m_List2.InsertItem(list2pos, List1array.ElementAt (i).ElementAt (1));
- m_List2.SetItemText(list2pos, 1, List1array.ElementAt (i).ElementAt (2));
- m_List2.SetItemText(list2pos, 2, List1array.ElementAt (i).ElementAt (3));
- m_List2.SetItemText(list2pos, 3, List1array.ElementAt (i).ElementAt (4));
- m_List2.SetItemText(list2pos, 4, List1array.ElementAt (i).ElementAt (5));
- str=List1array.ElementAt (i).ElementAt (5);
- list2pos++;
- }
- else
- {
- kind="4";
- m_List3.InsertItem(list3pos, List1array.ElementAt (i).ElementAt (1));
- m_List3.SetItemText(list3pos, 1, List1array.ElementAt (i).ElementAt (2));
- m_List3.SetItemText(list3pos, 2, List1array.ElementAt (i).ElementAt (3));
- m_List3.SetItemText(list3pos, 3, List1array.ElementAt (i).ElementAt (4));
- m_List3.SetItemText(list3pos, 4, List1array.ElementAt (i).ElementAt (5));
- m_List3.SetItemText(list3pos, 5, List1array.ElementAt (i).ElementAt (6));
- #ifdef LKAY_VERSION
- m_List3.SetItemText(list3pos, 6, List1array.ElementAt (i).ElementAt (7));
- m_List3.SetItemText(list3pos, 7, List1array.ElementAt (i).ElementAt (8));
- str=List1array.ElementAt (i).ElementAt (8);
- #else
- str=List1array.ElementAt (i).ElementAt (6);
- #endif
- list3pos++;
- }
- nchoosezs+=GetZS(str);
- GetPath(str);
- if(!str.IsEmpty ())
- str=","+str+",";
- str.MakeLower ();
- if(kind=="4")
- m_no2array.Add (str);
- else
- m_noarray.Add (str);
- }
- }
- else
- {
- for(int i=0; i<sparray.GetSize (); i++)
- {
- kind="4";//sparray.ElementAt (i).ElementAt (4);
- if(kind=="4")
- {
- m_List3.InsertItem(list3pos, sparray.ElementAt (i).ElementAt (7));
- m_List3.SetItemText(list3pos, 1, sparray.ElementAt (i).ElementAt (1));
- m_List3.SetItemText(list3pos, 2, sparray.ElementAt (i).ElementAt (5));
- m_List3.SetItemText(list3pos, 3, sparray.ElementAt (i).ElementAt (2));
- m_List3.SetItemText(list3pos, 4, sparray.ElementAt (i).ElementAt (3));
- #ifdef LKAY_VERSION
- m_List3.SetItemText(list3pos, 5, sparray.ElementAt (i).ElementAt (9));
- m_List3.SetItemText(list3pos, 6, sparray.ElementAt (i).ElementAt (10));
- m_List3.SetItemText(list3pos, 7, sparray.ElementAt (i).ElementAt (6));
- #else
- m_List3.SetItemText(list3pos, 5, sparray.ElementAt (i).ElementAt (6));
- #endif
- list3pos++;
- }
- else
- {
- m_List2.InsertItem(list2pos, sparray.ElementAt (i).ElementAt (7));
- m_List2.SetItemText(list2pos, 1, sparray.ElementAt (i).ElementAt (1));
- m_List2.SetItemText(list2pos, 2, sparray.ElementAt (i).ElementAt (5));
- m_List2.SetItemText(list2pos, 3, sparray.ElementAt (i).ElementAt (3));
- m_List2.SetItemText(list2pos, 4, sparray.ElementAt (i).ElementAt (6));
- list2pos++;
- }
- str=sparray.ElementAt (i).ElementAt (6);
- str.MakeLower ();
- nchoosezs+=GetZS(str);
- GetPath(str);
- if(!str.IsEmpty ())
- str=","+str+",";
- if(kind=="4")
- m_no2array.Add (str);
- else
- m_noarray.Add (str);
- }
- CheckForAlbum();
- CheckForDisk();
- }
- if(g_List1array.GetSize())
- {
- m_name1 = g_List1array.ElementAt (0).ElementAt (4);
- m_name2 = g_List1array.ElementAt (0).ElementAt (5);
- m_phone1 = g_List1array.ElementAt (0).ElementAt (61);
- m_phone2 = g_List1array.ElementAt (0).ElementAt (62);
- if(!m_name1.IsEmpty ())
- m_name=m_name1+",";
- m_name+=m_name2;
- m_name.TrimRight (",");
- m_waiter3 = g_user.name ;
- m_taoxizs = g_List1array.ElementAt (0).ElementAt (9);
- m_time5 = g_List1array.ElementAt (0).ElementAt (22);
- m_takezs = g_List1array.ElementAt (0).ElementAt (23);
- m_choosezs = g_List1array.ElementAt (0).ElementAt (24);
- m_money3 = g_List1array.ElementAt (0).ElementAt (3);
- m_oldmoney3=m_money3;
- m_bz3 = g_List1array.ElementAt (0).ElementAt (39);
- m_bz4 = g_List1array.ElementAt (0).ElementAt (75);
- m_urgent = g_List1array.ElementAt (0).ElementAt (40);
- m_delphotos = g_List1array.ElementAt (0).ElementAt (53); // Jeff开始选片时,获取dindan表的字段delphotos.读取正常。
- m_time6 = g_List1array.ElementAt (0).ElementAt (48);
- m_time5old=m_time5;
- m_time6old=m_time6;
- taoxiname = g_List1array.ElementAt (0).ElementAt (7);
- m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
- m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
- m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
- m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
- ren = g_List1array.ElementAt (0).ElementAt (14);
- m_size= g_List1array.ElementAt (0).ElementAt (60);
- m_checkstatus= g_List1array.ElementAt (0).ElementAt (32);
- UpdateData(false);
- }
- else
- {
- m_name1 = "";
- m_name2 = "";
- m_waiter3 = "";
- m_taoxizs = "";
- m_time5 = "";
- m_takezs = "";
- m_choosezs = "";
- m_money3 = "";
- m_bz3 = "";
- m_bz4 = "";
- m_urgent = "";
- UpdateData(false);
- }
- return 1;
- }
- void ChoosePhotoSkin2::OnOK()
- {
- // TODO: Add extra validation here
- }
- void ChoosePhotoSkin2::OnCancel()
- {
- // TODO: Add extra cleanup here
- }
- void ChoosePhotoSkin2::OnClose()
- {
- // TODO: Add your message handler code here and/or call default
- if(m_bModify)
- {
- if(AfxMessageBox("提醒, 选片修改未保存, 是否保存后再退出?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
- {
- OnButton4();
- }
- }
- CDialog::OnCancel();
- }
- BOOL ChoosePhotoSkin2::PreTranslateMessage(MSG* pMsg)
- {
- // TODO: Add your specialized code here and/or call the base class
- if(pMsg->message==WM_LBUTTONDOWN)
- {
- g_bNeedDrawParent=2;
- if(0)
- {//list3
- CPoint pt;
- CRect rc,rc2;
- ::GetCursorPos (&pt);
- m_List3.GetWindowRect (rc2);
- if(rc2.PtInRect (pt)==0) return CDialog::PreTranslateMessage(pMsg);
- SetTimer(3, 300, NULL);
- }
- }
- /* else if(pMsg->message==WM_PAINT && pMsg->hwnd ==this->m_hWnd )
- {
- SetTimer(1, 100, NULL);
- }
- else if(pMsg->message==WM_TIMER&& pMsg->hwnd ==this->m_hWnd)
- {
- KillTimer(1);
- DrawLogin();
- }*/
- else if(0)//pMsg->message==WM_LBUTTONDBLCLK)
- {
- {//list1
- CPoint pt;
- CRect rc,rc2;
- ::GetCursorPos (&pt);
- m_List2.GetWindowRect (rc2);
- if(rc2.PtInRect (pt))
- return 1;
- }
- {//list3
- CPoint pt;
- CRect rc,rc2;
- ::GetCursorPos (&pt);
- m_List3.GetWindowRect (rc2);
- if(rc2.PtInRect (pt)==0)return CDialog::PreTranslateMessage(pMsg);
- pt.x-=rc2.left ;
- pt.y-=rc2.top ;
- int iItem=m_List3.GetItemCount ()-1;
- if(iItem<0)
- {
- m_List3.GetHeaderCtrl()->GetItemRect (0, rc);
- int hei=rc.Height ();
- rc.top +=hei;
- rc.bottom +=hei;
- if(rc.PtInRect (pt))
- {
- m_List3.InsertItem(m_List3.GetItemCount (), "");
- }
- }
- else
- {
- m_List3.GetSubItemRect( iItem, 0, LVIR_BOUNDS, rc);
- int hei=rc.Height ();
- rc.top +=hei;
- rc.bottom +=hei;
- if(rc.PtInRect (pt))
- {
- if(m_List3.GetItemText (iItem, 1).IsEmpty ()&&m_List3.GetItemText (iItem, 2).IsEmpty ())
- return CDialog::PreTranslateMessage(pMsg);
- m_List3.InsertItem(m_List3.GetItemCount (), "");
- }
- POSITION pos;
- pos=m_List3.GetFirstSelectedItemPosition();
- if(pos)
- {
- iItem=m_List3.GetNextSelectedItem(pos);
- m_List3.GetSubItemRect( iItem, 4, LVIR_BOUNDS, rc);
- if(rc.PtInRect (pt))return 1;
- }
- }
- }
- }
- else if(pMsg->message==WM_KEYDOWN)
- {
- if(m_showpichwd)return 1;
- switch (pMsg->wParam)
- {
- case VK_DELETE:
- OnDel();
- return 1;
- case VK_RETURN:
- OnDblclkList1();
- return 1;
- case VK_F4:
- if(m_mode2 && m_bChooseBig==0)return 1;
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(62)))
- {
- if(m_mode==1)UpdateChooseZS();
- SortArray();
- }
- return 1;
- case VK_F5:
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
- {
- OnBtnClick(0, 99+4);
- }
- /* if(m_mode2==0)return 1;
- {
- ReplaceDesignNo dlg;
- dlg.m_id=this->m_id ;
- dlg.DoModal ();
- }*/
- return 1;
- case VK_F1:
- {
- if(m_selphotownd2.GetSafeHwnd ()==NULL)
- {
- m_selphotownd2.m_id=m_strOrderNumber;
- m_selphotownd2.m_rc=m_rcarray.ElementAt (6);
- m_selphotownd2.Create (IDD_DLGShowSelPhoto2, this);
- }
- m_selphotownd2.ShowWindow (1);
- }
- return 1;
- case VK_F2:
- if(m_mode2 && m_bChooseBig==0)return 1;
- if(0)
- {
- return 1;
- CStringArray array;
- for(int i=0; i<m_List2.GetItemCount (); i++)
- {
- if(m_List2.GetItemText (i, 4).IsEmpty ()==0)
- {
- array.Add ( m_List2.GetItemText (i, 0) );
- array.Add ( m_List2.GetItemText (i, 4) );
- }
- }
- if(array.GetSize ()==0)return 1;
- ChoosePhotoSkin2 dlg;
- dlg.SetLiaPath ("3.lia");
- dlg.m_strOrderNumber=m_strOrderNumber;
- dlg.m_pArray=&array;
- dlg.m_path=g_path2+"\\";
- dlg.m_path+=dlg.m_strOrderNumber;
- dlg.m_path +="\\";
- dlg.DoModal ();
- return 1;
- }
- if(atoi(g_cominfoarray.ElementAt(0).ElementAt(60)))
- {
- m_bHide=!m_bHide;
- LoadPhotos();
- }
- return 1;
- case VK_F6:
- {
- if(m_mode2)
- {
- ReplaceDesignNo dlg;
- dlg.m_id=this->m_strOrderNumber ;
- dlg.DoModal ();
- }
- }
- return 1;
- }
- }
- return CDialog::PreTranslateMessage(pMsg);
- }
- void ChoosePhotoSkin2::OnRclickList1()// 右键选片模式;
- {
- // 1.Jeff:看设计模式;
- if(m_mode2)
- {
- OnRclickList2();
- return;
- }
- // 2.Jeff:开始选片模式;
- if(m_bRunning)return;
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- return;
- }
- int iItem=m_List1.GetNextSelectedItem(pos);
- CString scount;
- // .获取当前查看的相片;
- CStringArray *pArray=GetCurArray();
- CString path=pArray->ElementAt (iItem);
- path=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
- path=path.Left (path.ReverseFind ('.'));
- if(m_mode2)// Jeff:第1步时就退出了,这里判断有意义????? 这一段代码永远不会执行;
- {
- if(!CheckName(path))
- {
- CMenuXP *pPopup;
- pPopup = new CMenuXP;
- pPopup->CYBUTTONMARGIN=3;
- pPopup->CreatePopupMenu();
- pPopup->SetMenuStyle(CMenuXP::STYLE_XP);
- pPopup->AppendODMenu2(0, new CMenuXPText(32794, "修改要求", NULL));
- CPoint pt;
- ::GetCursorPos (&pt);
- pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);
- delete pPopup;
- return;
- }
- }
- path=","+path+",";
- // TODO: Add your control notification handler code here
- CMenuXP *pPopup;
- pPopup = new CMenuXP;
- pPopup->CYBUTTONMARGIN=3;
- pPopup->CreatePopupMenu();
- pPopup->SetMenuStyle(CMenuXP::STYLE_XP);
- int i = 0;
- int maxleng=1;
- {
- CString name,no;
- int count=0;
-
- for( i=0; i<m_List2.GetItemCount (); i++)
- {
- name=m_List2.GetItemText (i, 2);
- // Jeff,no里为商品名称选中的相片
- no=m_noarray.ElementAt(i);
- maxleng=max(maxleng, name.GetLength ());
- }
- count=i;
- for(; i<count+m_no2array.GetSize (); i++)
- {
- name=m_List3.GetItemText (i-count, 2);
- maxleng=max(maxleng, name.GetLength ());
- }
- }
- maxleng+=3;
- CString name,no;
- int count=0;
- for( i=0; i<m_List2.GetItemCount (); i++)
- {
- name=m_List2.GetItemText (i, 2);
- ::FillLength (name, maxleng);
- // Jeff,no里为商品名称选中的相片
- no=m_noarray.ElementAt (i);
- GetSelCountFromName(no,scount);
- pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1+i, name+scount, NULL));
- if(no.Find (path)!=-1)
- pPopup->CheckMenuItem(IDM_MENUsp1+i, MF_BYCOMMAND | MF_CHECKED);
- }
- count=i;
- for(; i<count+m_no2array.GetSize(); i++)
- {
- name=m_List3.GetItemText (i-count, 2);
- ::FillLength (name, maxleng);
- no=m_no2array.ElementAt (i-count);
- GetSelCountFromName(no,scount);
- pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1+i, name+scount, NULL));
- if(no.Find (path)!=-1)
- pPopup->CheckMenuItem(IDM_MENUsp1+i, MF_BYCOMMAND | MF_CHECKED);
- }
- pPopup->AppendODMenu2(0, new CMenuXPText(32794, "修改要求", NULL));
- CPoint pt;
- ::GetCursorPos (&pt);
- pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);
- delete pPopup;
- }
- void ChoosePhotoSkin2::OnRclickList2()// 右键看设计模式;
- {
- if(m_bRunning)return;
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- return;
- }
- int iItem=m_List1.GetNextSelectedItem(pos);
- CString scount;
- CStringArray *pArray=GetCurArray(); //获取当前查看的内容;
- CString path=pArray->ElementAt(iItem); //path//打印出相片完整路径名;
- if(m_bChooseBig)//选放大
- path=path.Right(path.GetLength()-path.ReverseFind('\\')-1);
- else//选设计
- path=path.Right(path.GetLength()-m_path.GetLength());
- path=path.Left(path.ReverseFind('.'));
- path=","+path+","; //
- // TODO: Add your control notification handler code here
- // 1.创建菜单对象;
- CMenuXP *pPopup;
- pPopup = new CMenuXP;
- pPopup->CYBUTTONMARGIN=3; // 1.0.按钮范围0~3; 4个菜单;
- pPopup->CreatePopupMenu(); // 1.1.弹出式菜单;
- pPopup->SetMenuStyle(CMenuXP::STYLE_XP);// 1.2.弹出菜单样式;
- // Jeff:m_List2有三列头:编号、商品名称、商品数量;
- int i = 0;
- int maxleng=1;
- {
- CString name,no;
- int count=0;
-
- for( i=0; i<m_List2.GetItemCount (); i++)
- {
- // name商品名称
- name=m_List2.GetItemText(i, 2);
- no=m_noarray.ElementAt(i);
- maxleng=max(maxleng, name.GetLength ());
- }
- count=i;
- for(; i<count+m_no2array.GetSize(); i++)
- {
- name=m_List3.GetItemText(i-count, 2);
- maxleng=max(maxleng, name.GetLength ());
- }
- }
- maxleng+=3;
- // Jeff:m_List2有三列头:编号、商品名称、商品数量;
- CString name,no;
- int count=0;
- for( i=0; i<m_List2.GetItemCount(); i++)
- {
- name=m_List2.GetItemText(i, 2);
- ::FillLength(name, maxleng);// Jeff:有这样的API函数么???怎么查也查不到
- no=m_noarray.ElementAt(i);
- GetSelCountFromName(no,scount);
- pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1+i, name+scount, NULL));// 2.使用AppendODMenu2添加子菜单项;
- if(no.Find (path)!=-1)
- pPopup->CheckMenuItem(IDM_MENUsp1+i, MF_BYCOMMAND | MF_CHECKED);
- }
- count=i;
- for(; i<count+m_no2array.GetSize(); i++)
- {
- name=m_List3.GetItemText(i-count, 2);
- ::FillLength(name, maxleng);
- no=m_no2array.ElementAt(i-count);
- GetSelCountFromName(no,scount);
- pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1+i, name+scount, NULL));
- if(no.Find (path)!=-1)
- pPopup->CheckMenuItem(IDM_MENUsp1+i, MF_BYCOMMAND | MF_CHECKED);
- }
- pPopup->AppendODMenu2(0, new CMenuXPText(32794, "修改要求", NULL));
- CPoint pt;
- ::GetCursorPos (&pt);
- pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);// 3.使用TrackPopupMenu,正常弹出菜单;
- delete pPopup;
- }
- void ChoosePhotoSkin2::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult)
- {
- if( m_showpichwd)return;
- OnRclickList1();
- *pResult = 0;
- }
- void SortArray2(CArray<int,int>&datearray)
- {
- int strtemp;
- int last = datearray.GetSize () - 1;
- bool sorted = true;
- do {
- sorted = true;
- for (int i = 0; i < last; i++)
- {
- if (datearray[i] < datearray[i + 1])
- {
- strtemp = datearray[i];
- datearray[i] = datearray[i + 1];
- datearray[i + 1] = strtemp;
- sorted = false;
- }
- }
- last--;
- } while (!sorted);
- }
- void ChoosePhotoSkin2::OnCommandMenu(UINT nID)//弹出菜单处理;
- {
- if(m_mode2)//看设计;
- {
- OnCommandMenu2(nID);
- return;
- }
- if(32794==nID)
- {
- if(m_mode2)//Jeff不会执行的代码;
- {
- OnButton4();
- }
- else
- {
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- return;
- }
- int iItem=m_List1.GetNextSelectedItem(pos);
- CStringArray *pArray=GetCurArray();
- CString path=pArray->ElementAt (iItem);
- path=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
- path=path.Left (path.Find ('.'));
- if(m_bz4.GetLength()>4080)
- {
- AfxMessageBox("备注太长,可在保存界面选中备注内容,按Delete键清除");
- return;
- }
- UpdateData();
- CClientRequirement dlg;
- dlg.m_no="当前照片:"+path;
- // dlg.m_bz2=m_bz3;
- CString header,left,right,cur;
- header=path+":";
- int pos2=m_bz4.Find(header);
- if(pos2!=-1)
- {
- left=m_bz4.Left(pos2);
- m_bz4=m_bz4.Right(m_bz4.GetLength()-pos2);
- pos2=m_bz4.Find(" ");
- if(pos2!=-1)
- {
- cur=m_bz4.Left(pos2);
- int pos3=cur.Find(":");
- if(pos3!=-1)
- cur=cur.Right(cur.GetLength()-pos3-1);
- right=m_bz4.Right(m_bz4.GetLength()-pos2-2);
- }
- }
- else
- left=m_bz4;
- dlg.m_bz2=cur;
- dlg.m_bSave =0;
- dlg.m_nMode =2;
- if(dlg.DoModal ()==IDOK)
- {
- // m_bz3=dlg.m_bz2 ;
- dlg.m_bz2.TrimLeft();
- dlg.m_bz2.TrimRight();
- if(dlg.m_bz2!="")
- cur=header+dlg.m_bz2+" " ;
- else
- cur="";
- m_bz4=left+cur+right;
- UpdateData(false);
- }
- else
- {
- if(cur!="")
- m_bz4=left+header+cur+" "+right;
- else
- m_bz4=left+right;
- }
- }
- return;
- }
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- return;
- }
- CString temp;
- m_combo1.ResetContent ();
- int aa=0;
- while(pos)
- {
- // if(aa && m_mode==1)break;//m_mode=1查看选中
- // if(aa && m_mode==2)break;
- aa++;
- int iItem=m_List1.GetNextSelectedItem(pos);
- CStringArray *pArray=GetCurArray();
- CString path=pArray->ElementAt (iItem);
- path=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
- path=path.Left (path.ReverseFind ('.'));
- path=","+path+",";
- int idpos=nID-IDM_MENUsp1;
- BOOL bSel=0;//选中还是取消
- if(idpos<m_noarray.GetSize ())
- {
- CString no=m_noarray.ElementAt (idpos);
- if(no.Find (path)!=-1)
- {
- int pos=no.Find (path);
- no.Delete (pos, path.GetLength ()-1);
- }
- else if(no.GetLength()>4000)
- {
- AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP);return;
- }
- else
- {
- bSel=1;
- no.TrimRight (",");
- no+=path;
- }
- no.TrimLeft (",");
- no.TrimRight (",");
- m_List2.SetItemText (idpos, 4, no);
- if(no.IsEmpty ())
- m_noarray.SetAt (idpos, no);
- else
- m_noarray.SetAt (idpos, ","+no+",");
- }
- else
- {
- idpos-=m_noarray.GetSize ();
- CString no=m_no2array.ElementAt (idpos);
- if(no.Find (path)!=-1)
- {
- int pos=no.Find (path);
- no.Delete (pos, path.GetLength ()-1);
- }
- else if(no.GetLength()>4000)
- {
- AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP);return;
- }
- else
- {
- bSel=1;
- no.TrimRight (",");
- no+=path;
- }
- no.TrimLeft (",");
- no.TrimRight (",");
- #ifdef LKAY_VERSION
- m_List3.SetItemText (idpos, 7, no);
- #else
- m_List3.SetItemText (idpos, 5, no);
- #endif
- if(no.IsEmpty ())
- m_no2array.SetAt (idpos, no);
- else
- m_no2array.SetAt (idpos, ","+no+",");
- }
- m_bModify=1;
- if(bSel==0 && m_mode==1 && IsSelPhoto(path)==0)
- {
- temp.Format("%d", iItem);
- m_combo1.AddString (temp);
- continue;
- }
- else if(bSel==1 && m_mode==2)
- {
- temp.Format("%d", iItem);
- m_combo1.AddString (temp);
- continue;
- }
- else if(bSel==1 && m_mode==3)
- {
- temp.Format("%d", iItem);
- m_combo1.AddString (temp);
- continue;
- }
- else if(bSel==0 && m_mode==4 && IsSelAlbumPhoto(path)==0)
- {
- temp.Format("%d", iItem);
- m_combo1.AddString (temp);
- continue;
- }
- else if(bSel==0 && m_mode==5 && IsSelDiskPhoto(path)==0)
- {
- temp.Format("%d", iItem);
- m_combo1.AddString (temp);
- continue;
- }
- /////////////////////////
- CString no,dir;
- no=pArray->ElementAt (iItem);
- if(m_mode2)
- {
- if(no.Left (no.ReverseFind ('\\')+1)!=m_path)
- {
- dir=no.Left (no.ReverseFind ('\\')+1);
- dir= dir.Right (dir.GetLength ()-m_path.GetLength ());
- }
- }
- no=no.Right (no.GetLength ()-no.ReverseFind ('\\')-1);
- no=no.Left (no.ReverseFind ('.'));
- no+=GetSelName(no);
- m_List1.SetItemText (iItem, 0, dir+no);
- }
- CArray<int,int>posarray;
- for(int i=m_combo1.GetCount ()-1; i>=0; i--)
- {
- m_combo1.GetLBText (i, temp);
- posarray.Add(atoi(temp));
- }
- SortArray2(posarray);
- if(posarray.GetSize ())
- {
- if(m_mode==1)
- {
- for(int i=0; i<posarray.GetSize(); i++)
- {
- m_List1.DeleteItem(posarray.ElementAt(i));
- m_patharray3.Add(m_patharray2.ElementAt (posarray.ElementAt(i)));
- m_patharray2.RemoveAt(posarray.ElementAt(i));
- }
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_CLOSE, 0, 0);
- }
- else if(m_mode==2)
- {
- for(int i=0; i<posarray.GetSize(); i++)
- {
- m_List1.DeleteItem (posarray.ElementAt(i));
- m_patharray3.RemoveAt (posarray.ElementAt(i));
- }
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_CLOSE, 0, 0);
- }
- else if(m_mode==3)
- {
- for(int i=0; i<posarray.GetSize(); i++)
- {
- m_List1.DeleteItem (posarray.ElementAt(i));
- m_patharray1.Add (m_patharray4.ElementAt (posarray.ElementAt(i)));
- m_patharray4.RemoveAt (posarray.ElementAt(i));
- }
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_CLOSE, 0, 0);
- }
- else if(m_mode==4)
- {
- for(int i=0; i<posarray.GetSize(); i++)
- {
- m_List1.DeleteItem (posarray.ElementAt(i));
- m_patharray5.RemoveAt (posarray.ElementAt(i));
- }
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_CLOSE, 0, 0);
- }
- else if(m_mode==5)
- {
- for(int i=0; i<posarray.GetSize(); i++)
- {
- m_List1.DeleteItem (posarray.ElementAt(i));
- m_patharray6.RemoveAt (posarray.ElementAt(i));
- }
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_CLOSE, 0, 0);
- }
- }
- if(m_mode2==0)
- {
- Save();
- DrawLogin();
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_USER+200, 0, 0);
- }
- }
- void ChoosePhotoSkin2::OnCommandMenu2(UINT nID)//看设计,弹出菜单处理;
- {
- if(32794==nID)// 处理菜单荐:修改要求;
- {
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- return;
- }
- int iItem=m_List1.GetNextSelectedItem(pos);
- CStringArray *pArray=GetCurArray();
- CString path=pArray->ElementAt (iItem);
- path=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
- path=path.Left (path.Find ('.'));
- UpdateData();
- CClientRequirement dlg;
- dlg.m_no="当前照片:"+path;
- dlg.m_bz2=m_bz3;
- dlg.m_bSave =0;
- dlg.m_nMode =2;
- if(dlg.DoModal ()==IDOK)
- {
- m_bz3=dlg.m_bz2 ;
- UpdateData(false);
- }
- return;
- }
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- return;
- }
- CString temp;
- m_combo1.ResetContent();
- int aa=0;
- while(pos) // 开始获取相片;
- {
- // if(aa && m_mode==1)break;
- // if(aa && m_mode==2)break;
- aa++;
- int iItem=m_List1.GetNextSelectedItem(pos);
- CStringArray *pArray=GetCurArray();
- // path:
- CString path=pArray->ElementAt(iItem);
- //AfxMessageBox(path);//Jeff box
- if(m_bChooseBig)//选放大
- path=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
- else//选设计
- path=path.Right (path.GetLength ()-m_path.GetLength ());
- path=path.Left (path.ReverseFind ('.'));
- path=","+path+",";
- int idpos=nID-IDM_MENUsp1;
- BOOL bSel=0;//选中还是取消
- if(idpos<m_noarray.GetSize ())
- {
- //MessageBox("1");
- CString no=m_noarray.ElementAt (idpos); // no:为dindansp字段no;
- //AfxMessageBox(no);//Jeff box
- if(no.Find (path)!=-1)
- {
- int pos=no.Find (path);
- no.Delete (pos, path.GetLength ()-1);
- }
- else if(no.GetLength()>4000)
- {
- AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP);return;
- }
- else
- {
- bSel=1;
- no.TrimRight (",");
- no+=path;
- }
- no.TrimLeft (",");
- no.TrimRight (",");
- m_List2.SetItemText (idpos, 4, no);
- if(no.IsEmpty ())
- m_noarray.SetAt (idpos, no);
- else
- m_noarray.SetAt (idpos, ","+no+",");
- }
- else
- {
- idpos-=m_noarray.GetSize ();
- CString no=m_no2array.ElementAt (idpos);
- if(no.Find (path)!=-1)
- {
- int pos=no.Find (path);
- no.Delete (pos, path.GetLength ()-1);
- }
- else if(no.GetLength()>4000)
- {
- AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP);return;
- }
- else
- {
- bSel=1;
- no.TrimRight (",");
- no+=path;
- }
- no.TrimLeft (",");
- no.TrimRight (",");
- #ifdef LKAY_VERSION
- m_List3.SetItemText (idpos, 7, no);
- #else
- m_List3.SetItemText (idpos, 5, no);
- #endif
- if(no.IsEmpty ())
- m_no2array.SetAt (idpos, no);
- else
- m_no2array.SetAt (idpos, ","+no+",");
- }
- m_bModify=1;
- if(bSel==0 && m_mode==1 && IsSelPhoto(path)==0)
- {
- temp.Format("%d", iItem);
- m_combo1.AddString (temp);
- continue;
- }
- else if(bSel==1 && m_mode==2)
- {
- temp.Format("%d", iItem);
- m_combo1.AddString (temp);
- continue;
- }
- else if(bSel==1 && m_mode==3)
- {
- temp.Format("%d", iItem);
- m_combo1.AddString (temp);
- continue;
- }
- /////////////////////////
- CString no,dir;
- no=pArray->ElementAt (iItem);
- if(m_bChooseBig)//选放大
- no=no.Right (no.GetLength ()-no.ReverseFind ('\\')-1);
- else//选设计
- no=no.Right (no.GetLength ()-m_path.GetLength ());
- no=no.Left (no.ReverseFind ('.'));
- no+=GetSelName(no);
- m_List1.SetItemText (iItem, 0, no);
- }
- CArray<int,int>posarray;
- for(int i=m_combo1.GetCount ()-1; i>=0; i--)
- {
- m_combo1.GetLBText (i, temp);
- posarray.Add(atoi(temp));
- }
- SortArray2(posarray);
- if(posarray.GetSize ())
- {
- if(m_mode==1)
- {
- for(int i=0; i<posarray.GetSize(); i++)
- {
- m_List1.DeleteItem (posarray.ElementAt(i));
- m_patharray3.Add (m_patharray2.ElementAt (posarray.ElementAt(i)));
- m_patharray2.RemoveAt (posarray.ElementAt(i));
- }
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_CLOSE, 0, 0);
- }
- else if(m_mode==2)
- {
- for(int i=0; i<posarray.GetSize(); i++)
- {
- m_List1.DeleteItem (posarray.ElementAt(i));
- m_patharray3.RemoveAt (posarray.ElementAt(i));
- }
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_CLOSE, 0, 0);
- }
- else if(m_mode==3)
- {
- for(int i=0; i<posarray.GetSize(); i++)
- {
- m_List1.DeleteItem (posarray.ElementAt(i));
- m_patharray1.Add (m_patharray4.ElementAt (posarray.ElementAt(i)));
- m_patharray4.RemoveAt (posarray.ElementAt(i));
- }
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_CLOSE, 0, 0);
- }
- }
- Save();DrawLogin();
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_USER+200, 0, 0);
- }
- int ChoosePhotoSkin2::GetZS(CString str)
- {
- str.TrimLeft (",");
- str.TrimRight (",");
- if(str.IsEmpty ())return 0;
- int pos=str.Find (',');
- int count=1;
- while(pos!=-1)
- {
- str.Delete (pos);
- pos=str.Find (',');
- count++;
- }
- return count;
- }
- long ChoosePhotoSkin2::UpdateTakeZS(WPARAM inWParam, LPARAM inLParam)
- {
- if(m_mode==0 && m_List1.GetItemCount ()>atoi(m_takezs))
- {
- UpdateData();
- m_takezs.Format ("%d", m_List1.GetItemCount () );
- UpdateData(false);
- }
- DrawLogin();
- return 1;
- }
- void ChoosePhotoSkin2::OnButton1() // null
- {
- // TODO: Add your control notification handler code here
- }
- void ChoosePhotoSkin2::UpdateChooseZS()
- {
- m_patharray2.RemoveAll ();
- CString str;
- int i = 0;
- if(m_sChooseFilter!="" && m_sChooseFilter!="全部")
- {
- for( i=0; i<m_List3.GetItemCount (); i++)
- {
- if(m_List3.GetItemText (i, 2)!=m_sChooseFilter)continue;
- str=m_no2array.ElementAt (i);
- GetPath(str);
- }
- return;
- }
- for( i=0; i<m_noarray.GetSize (); i++)
- {
- str=m_noarray.ElementAt (i);
- GetPath(str);
- }
- for( i=0; i<m_no2array.GetSize (); i++)
- {
- str=m_no2array.ElementAt (i);
- GetPath(str);
- }
- }
- void ChoosePhotoSkin2::OnButton2() //null
- {
- // TODO: Add your control notification handler code here
- }
- void ChoosePhotoSkin2::OnButton3() //null
- {
- // TODO: Add your control notification handler code here
- }
- // 保存按钮;
- void ChoosePhotoSkin2::OnButton4() // 保存按钮;
- {
- // AfxMessageBox("保存按钮");
- // TODO: Add your control notification handler code here
- if(m_mode2==0) //选片时的保存;
- {
- UpdateData();
- if(m_mode!=1)
- {
- CalChooseZS();
- }
- CString zs = m_taoxizs;
- int pos=zs.Find ("\\");
- if(pos!=-1)
- {
- zs=zs.Left (pos);
- }
- m_choosezs.Format ("%d", max(0,m_patharray2.GetSize()-atoi(zs)) );
- m_bSaveFail=0;
- ChoosePhotoSkin3 dlg;
- dlg.m_pParent =this;
- dlg.DoModal ();
- if(dlg.m_bSave )
- m_bModify=0;
- if(dlg.m_bPushedSave==0 && dlg.m_bSaveFail==0)
- {
- CString savepath;
- savepath.Format ("%s\\%s.dat", g_mainpath, m_strOrderNumber);
- if(m_mode2)savepath.Format ("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
- ::DeleteFile (savepath);
- }
- m_bSaveFail=dlg.m_bSaveFail;
- if(dlg.m_bExit)
- {
- m_bModify=0;
- CDialog::OnCancel ();
- }
- }
- else if(m_mode2==1) // 看设计时的保存,delphotos2的保存需要重新定向;
- {
- UpdateData();
- if(m_mode!=1)
- {
- CalChooseZS();
- }
- CString zs = m_taoxizs;
- int pos=zs.Find ("\\");
- if(pos!=-1)
- {
- zs=zs.Left (pos);
- }
- m_choosezs.Format ("%d", max(0,m_patharray2.GetSize()-atoi(zs)) );
- m_bSaveFail=0;
- ChoosePhotoSkin3 dlg;
- dlg.m_pParent =this;
- dlg.DoModal ();
- if(dlg.m_bSave )
- m_bModify=0;
- if(dlg.m_bPushedSave==0 && dlg.m_bSaveFail==0)
- {
- CString savepath;
- savepath.Format ("%s\\%s.dat", g_mainpath, m_strOrderNumber);
- if(m_mode2)savepath.Format ("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
- ::DeleteFile (savepath);
- }
- m_bSaveFail=dlg.m_bSaveFail;
- if(dlg.m_bExit)
- {
- m_bModify=0;
- CDialog::OnCancel ();
- }
- }
- }
- // 删除相片;
- BOOL ChoosePhotoSkin2::OnDel() // 删除相片;
- {
- // printf("Jeff:m_mode=%d,m_mode2=%d.\n\n",m_mode,m_mode2);//Jeff Printf
- if(m_mode==1)
- {
- AfxMessageBox("选中照片不能删除, 请先取消选中状态!", MB_ICONINFORMATION);
- return 0;
- }
- else if(m_mode==3)
- {
- return 0;
- }
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- return 0;
- }
- if(m_bRunning)
- return 0;
- int iItem=m_List1.GetNextSelectedItem(pos);
- CString no;//=m_List1.GetItemText (iItem, 0);
- CStringArray *pArray=GetCurArray(); // Jeff:按钮选择返回(查看全部、查看选中、查看未选……)
- no=pArray->ElementAt(iItem);
- //printf("Jeff:pos=%d,iItem=%d,no=%s \n\n",pos,iItem,no);// Jeff Printf;
- no=no.Right (no.GetLength ()-no.ReverseFind ('\\')-1);
- no=no.Left (no.Find ('.'));
- if(IsSelPhoto(no)) // Jeff 这里有问题,有些订单删除未选中的相片时,会提示box内容。状态:未处理;
- {
- AfxMessageBox("选中的照片不能删除, 请先取消选中状态!", MB_ICONINFORMATION);
- return 0;
- }
- if(AfxMessageBox("是否删除此照片?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)
- return 0;
- m_List1.DeleteItem(iItem);
- CString name=pArray->ElementAt(iItem);
- m_patharray4.Add(name);
- // printf("Jeff:将要删除的相片=%s\n\n",name);// Jeff Printf;
- for(int i=0; i<pArray->GetSize(); i++)
- {
- if(name.CollateNoCase(pArray->ElementAt(i))==0)
- {
- pArray->RemoveAt (i);
- if(m_mode==2)
- {
- DelNo(no);
- // MessageBox(no);
- // m_patharray1.RemoveAt (i);
- }
- break;
- }
- }
- if(iItem>=pArray->GetSize ())
- iItem=0;
- m_List1.SetItemState (iItem, LVIS_SELECTED, LVIS_SELECTED);
- DrawLogin();
- return 1;
- }
- extern int GetOrientation(Image *image);
- void ChoosePhotoSkin2::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- *pResult = 0;
- }
- void ChoosePhotoSkin2::OnTimer(UINT nIDEvent)
- {
- // TODO: Add your message handler code here and/or call default
- if(nIDEvent==1)
- {
- KillTimer(nIDEvent);
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_USER+200, 1, 0);
- TimeOutDlg dlg;
- dlg.m_ticks =m_ticks;
- dlg.DoModal ();
- SetTimer(2, m_timer*60000, NULL);
- }
- else if(nIDEvent==2)
- {
- KillTimer(nIDEvent);
- if( m_showpichwd)
- ::SendMessage (m_showpichwd, WM_USER+200, 1, 0);
- TimeOutDlg dlg;
- dlg.m_ticks =m_ticks;
- dlg.DoModal ();
- SetTimer(2, m_timer*60000, NULL);
- }
- else if(nIDEvent==3)
- {
- KillTimer(nIDEvent);
- SetSPName3();
- }
- }
- float ChoosePhotoSkin2::GetSPPriceFromId(CString id)
- {
- for(int i=0; i<m_sparray.GetSize (); i++)
- {
- if(id==m_sparray.ElementAt (i).ElementAt (0))
- return atof(m_sparray.ElementAt (i).ElementAt (4));
- }
- return 0;
- }
- CString ChoosePhotoSkin2::GetSPNameFromId(CString id)
- {
- int i =0;
- for( i=0; i<m_sparray.GetSize (); i++)
- {
- if(id==m_sparray.ElementAt (i).ElementAt (0))
- return m_sparray.ElementAt (i).ElementAt (1);
- }
- id.TrimLeft ("0");
- for( i=0; i<m_sparray.GetSize (); i++)
- {
- if(id==m_sparray.ElementAt (i).ElementAt (0))
- return m_sparray.ElementAt (i).ElementAt (1);
- }
- return "";
- }
- void ChoosePhotoSkin2::SetSPName3()
- {
- }
- void ChoosePhotoSkin2::OnSpBox() //null
- {
- }
- void ChoosePhotoSkin2::OnButton8() //null
- {
- // TODO: Add your control notification handler code here
- /* POSITION pos;
- pos=m_List3.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION);
- return;
- }
- int iItem=m_List3.GetNextSelectedItem(pos);
- m_List3.DeleteItem (iItem);
- SetSPName3();*/
- }
- void ChoosePhotoSkin2::OnButton5() //null
- {
- // TODO: Add your control notification handler code here
- }
- void ChoosePhotoSkin2::OnButton6() //null
- {
- // TODO: Add your control notification handler code here
- }
- CString GetPathFromNo(CString dir, CString no, CStringArray *pArray)
- {
- CString sRet;
- dir.TrimRight('\\');
- dir+="\\";
- CStringArray dirarray;
- CString temp;
- if(pArray->GetSize ()==0)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(dir), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_dir();
- for (it = coo.begin();coo.end() != it;it ++)
- {
- temp=(*it).c_str();
- if(::FindArray (&dirarray, temp)==-1 && temp!=dir)
- {
- dirarray.Add (temp);
- }
- }
- }
- else
- dirarray.Copy (*pArray);
- for(int i=0; i<dirarray.GetSize(); i++)
- {
- temp=dirarray.ElementAt(i);
- sRet.Format("%s%s.jpg", temp, no);
- if(::PathFileExists (sRet))return sRet;
- }
- return dir+no+".jpg";
- }
- CString GetPathFromNo2(CString dir, CString no, CStringArray *pArray)
- {
- CString path;
- for(int i=0; i<pArray->GetSize(); i++)
- {
- path=pArray->ElementAt(i);
- path=path.Right(path.GetLength()-path.ReverseFind('\\')-1);
- if(path.Find(".")!=-1)
- path=path.Left(path.Find("."));
- if(no==path)return pArray->ElementAt(i);
- }
- return "";
- }
- void ChoosePhotoSkin2::GetPath(CString str)
- {// if(atoi(g_cominfoarray.ElementAt(0).ElementAt(109))==0 && m_mode2==0)
- if(m_bFromLocal && m_mode2==0)
- {
- str.TrimLeft (",");
- str.TrimRight (",");
- if(str.IsEmpty ())return;
- int pos=str.Find (',');
- CString path,path2;
- char spath[MAX_PATH];
- ::GetSystemDirectory (spath, MAX_PATH);
- CString sysdir=spath;
- sysdir+="\\lyfz";
- sysdir+="\\";
- sysdir+=m_strOrderNumber;
- sysdir+="\\";
- while(pos!=-1)
- {
- path=sysdir+str.Left (pos)+".jpg";
- if(::FindArray(&m_patharray2, path)==-1)
- {
- m_patharray2.Add (path);
- // MessageBox(path);
- }
- str=str.Right (str.GetLength ()-pos-1);
- pos=str.Find (',');
- }
- path=sysdir+str+".jpg";
- if(::FindArray(&m_patharray2, path)==-1)
- {
- m_patharray2.Add (path);//MessageBox(path);
- }
- }
- else if(m_mode2 && m_bChooseBig==0)//看设计
- {
- str.TrimLeft (",");
- str.TrimRight (",");
- if(str.IsEmpty ())return;
- int pos=str.Find (',');
- CString path,path2;
- while(pos!=-1)
- {
- path=m_path+str.Left (pos)+".jpg";
- if(::FindArray(&m_patharray2, path)==-1)
- {
- m_patharray2.Add (path);
- }
- str=str.Right (str.GetLength ()-pos-1);
- pos=str.Find (',');
- }
- path=m_path+str+".jpg";
- if(::FindArray(&m_patharray2, path)==-1)
- {
- m_patharray2.Add (path);
- }
- }
- else
- {
- if(m_DirArrayBuf.GetSize ()==0)
- {
- CString dir=m_path;
- dir.TrimRight('\\');
- dir+="\\";
- CString temp;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(dir), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_dir();
- for (it = coo.begin();coo.end() != it;it ++)
- {
- temp=(*it).c_str();
- if(::FindArray (&m_DirArrayBuf, temp)==-1 && temp!=dir)
- {
- m_DirArrayBuf.Add (temp);
- }
- }
- }
- str.TrimLeft (",");
- str.TrimRight (",");
- if(str.IsEmpty ())return;
- int pos=str.Find (',');
- CString path,path2;
- while(pos!=-1)
- {
- path=GetPathFromNo2(m_path, str.Left (pos), &m_patharray1);
- path2=path;
- if(m_nChoosePhotoType==0)
- {
- path2.Replace ("客户原片", "修好的片");
- int pos1=path2.Find (m_strOrderNumber);
- pos1+=m_strOrderNumber.GetLength ();
- int pos2=path2.ReverseFind ('\\');
- path2=path2.Left (pos1)+path2.Right (path2.GetLength ()-pos2);
- if(::PathFileExists (path2))
- path=path2;
- }
- if(::FindArray(&m_patharray2, path)==-1)
- {
- m_patharray2.Add (path);
- }
- str=str.Right (str.GetLength ()-pos-1);
- pos=str.Find (',');
- }
- path=GetPathFromNo2(m_path, str, &m_patharray1);//+".jpg";
- path2=path;
- if(m_nChoosePhotoType==0)
- {
- path2.Replace ("客户原片", "修好的片");
- int pos1=path2.Find (m_strOrderNumber);
- pos1+=m_strOrderNumber.GetLength ();
- int pos2=path2.ReverseFind ('\\');
- path2=path2.Left (pos1)+path2.Right (path2.GetLength ()-pos2);
- if(::PathFileExists (path2))
- path=path2;
- }
- if(::FindArray(&m_patharray2, path)==-1)
- m_patharray2.Add (path);
- }
- }
- void ChoosePhotoSkin2::LoadPhotos()//加载图片;
- {
- if(m_mode==1)
- {
- ProductChooseFilter dlg;
- CString name;
- int i = 0;
- for( i=0; i<m_List2.GetItemCount (); i++)
- {
- name=m_List2.GetItemText (i, 2);
- dlg.m_array.Add(name);
- }
- for(i=0; i<m_List3.GetItemCount (); i++)
- {
- name=m_List3.GetItemText (i, 2);
- dlg.m_array.Add(name);
- }
- dlg.DoModal();
- m_sChooseFilter=dlg.m_sChooseFilter;
- UpdateChooseZS();
- }
- TerminateThread();
- CStringArray *pArray=GetCurArray();
- /* CString ss;
- ss.Format("%d", pArray->GetSize());
- MessageBox(ss);*/
- m_vFileName.clear();
- for(int i=0; i<pArray->GetSize (); i++)
- {
- CString filePath=pArray->ElementAt (i);
- filePath.MakeLower();
- m_vFileName.push_back(filePath);
- }
- LoadThumbImages();
- }
- void ChoosePhotoSkin2::GetNoSelPhoto()
- {
- m_patharray3.RemoveAll();
- CString str1, str2;
- for(int i=0; i<m_patharray1.GetSize(); i++)
- {
- BOOL bFind=0;
- for(int j=0; j<m_patharray2.GetSize(); j++)
- {
- str1=m_patharray1.ElementAt(i);
- str2=m_patharray2.ElementAt(j);
- // MessageBox(str1);
- // MessageBox(str2);
- if(str1.CollateNoCase(str2)==0)
- {
- bFind=1;
- break;
- }
- }
- if(bFind==0)m_patharray3.Add (m_patharray1.ElementAt (i));
- }
- }
- int ChoosePhotoSkin2::GetNoSelPhotoCount()
- {
- int nRet=0;
- CString str1, str2;
- for(int i=0; i<m_patharray1.GetSize (); i++)
- {
- BOOL bFind=0;
- for(int j=0; j<m_patharray2.GetSize (); j++)
- {
- str1=m_patharray1.ElementAt (i);
- str2=m_patharray2.ElementAt (j);
- if(str1.CollateNoCase (str2)==0)
- {
- bFind=1;
- break;
- }
- }
- if(bFind==0)nRet++;
- }
- return nRet;
- }
- CStringArray* ChoosePhotoSkin2::GetCurArray()
- {
- CStringArray *pArray;
- switch(m_mode)
- {
- case 0:
- pArray=&m_patharray1;//全部
- break;
- case 1:
- pArray=&m_patharray2;//选中
- break;
- case 2:
- pArray=&m_patharray3;//未选
- break;
- case 3:
- pArray=&m_patharray4;//删除
- break;
- case 4:
- pArray=&m_patharray5;//入册
- break;
- case 5:
- pArray=&m_patharray6;//入底
- break;
- }
- return pArray;
- }
- BOOL ChoosePhotoSkin2::IsSelPhoto(CString path)
- {
- //path.MakeLower ();
- int i = 0;
- for( i=0; i<m_no2array.GetSize (); i++)
- {
- //m_no2array.ElementAt (i).MakeLower ();
- if(m_no2array.ElementAt (i).Find (path)!=-1)
- return 1;
- }
- for( i=0; i<m_noarray.GetSize (); i++)
- {
- //m_noarray.ElementAt (i).MakeLower ();
- if(m_noarray.ElementAt (i).Find (path)!=-1)
- return 1;
- }
- return 0;
- }
- BOOL ChoosePhotoSkin2::IsSelAlbumPhoto(CString path)
- {
- CString photosno;
- for(int i=0; i<m_List3.GetItemCount (); i++)
- {
- if(m_List3.GetItemText (i, 2)!="入册")continue;
- photosno=m_no2array.ElementAt (i);break;
- }
- photosno=","+photosno+",";
- if(photosno.Find (path)!=-1)
- {
- return 1;
- }
- return 0;
- }
- BOOL ChoosePhotoSkin2::IsSelDiskPhoto(CString path)
- {
- CString photosno;
- for(int i=0; i<m_List3.GetItemCount (); i++)
- {
- if(m_List3.GetItemText (i, 2)!="入底")continue;
- photosno=m_no2array.ElementAt (i);break;
- }
- photosno=","+photosno+",";
- if(photosno.Find (path)!=-1)
- {
- return 1;
- }
- return 0;
- }
- CString ChoosePhotoSkin2::GetSelName(CString name)//获取选中相片;
- {
- int i = 0;
- CString ret;
- name=","+name+",";
- for( i=0; i<m_List2.GetItemCount (); i++)
- {
- if(m_noarray.ElementAt (i).Find (name)!=-1)
- {
- ret+=m_List2.GetItemText (i, 2);
- ret+="\r\n";
- }
- }
- for( i=0; i<m_List3.GetItemCount (); i++)
- {
- if(m_no2array.ElementAt (i).Find (name)!=-1)
- {
- ret+=m_List3.GetItemText (i, 2);
- ret+="\r\n";
- }
- }
- if(!ret.IsEmpty ())
- {
- ret="\r\n"+ret;
- ret.TrimRight ("\r\n");
- }
- return ret;
- }
- // Jeff获取选设计的数据;
- BOOL ChoosePhotoSkin2::GetData2()//选设计模式;
- {
- m_List2.DeleteAllItems ();
- m_List3.DeleteAllItems ();
- m_noarray.RemoveAll ();
- m_no2array.RemoveAll ();
- #ifdef CHILD_VERSION
- CString filter="id='"+m_strOrderNumber+"';id='"+m_strOrderNumber+"';;;id='"+m_strOrderNumber+"'";
- #else
- CString filter="id='"+m_strOrderNumber+"' and kind<>'2';id='"+m_strOrderNumber+"';;;id='"+m_strOrderNumber+"'";
- #endif
- g_sendhead.code[0]=50; // dindansp;
- g_sendhead.code[1]=11; // dindan.
- g_sendhead.code[2]=4;
- g_sendhead.code[3]=8;
- g_sendhead.code[4]=182;
- g_sendhead.tabcount=5;
- g_sendhead.bsql=0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return 0;
- CArray<CStringArray, CStringArray>sparray;
- DataToArray(&sparray, &g_List1array, &m_sparray, &m_List2array, &oldsparray);
- m_patharray2.RemoveAll ();
- CString str,kind;
- int nchoosezs=0;
- int list2pos=0;
- int list3pos=0;
- CString savepath;
- savepath.Format ("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
- CString stm1=GetModifyTime2(savepath);
- CTime tm1=CTime::GetCurrentTime ();
- tm1-=CTimeSpan(60, 0, 0, 0);
- CString stm2=tm1.Format ("%Y%m%d");
- BOOL bLoadHistory=0;
- if(::CheckFileExist (savepath) && stm1>stm2)
- {
- if(AfxMessageBox("提醒:请谨慎操作\r\n上次选片未正常退出, 是否还原到上次选片状态?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
- bLoadHistory=1;
- }
- if(bLoadHistory)
- {
- CArray<CStringArray, CStringArray>List1array;
- CFile fp;
- fp.Open (savepath, CFile::modeRead);
- DWORD nMessageLen=fp.GetLength ();
- BYTE *szChatMessage = new BYTE[nMessageLen];
- fp.Read (szChatMessage, nMessageLen);
- fp.Close ();
- int count;
- memcpy(&count, szChatMessage+(nMessageLen-sizeof(int)), sizeof(int));
- CMemFile memfile;
- memfile.Attach (szChatMessage, nMessageLen);
- CArchive ar(&memfile, CArchive::load);
- List1array.SetSize(count);
- int i = 0;
- for( i=0; i<List1array.GetSize (); i++)
- {
- List1array.ElementAt (i).Serialize (ar);
- }
- ar.Close();
- memfile.Detach ();
- delete []szChatMessage;
- list2pos=0;
- list3pos=0;
- for( i=0; i<List1array.GetSize (); i++)
- {
- if(0)//List1array.ElementAt (i).GetSize ()==6)
- {
- kind="0";
- m_List2.InsertItem(list2pos, List1array.ElementAt(i).ElementAt(1));
- m_List2.SetItemText(list2pos, 1, List1array.ElementAt(i).ElementAt(2));
- m_List2.SetItemText(list2pos, 2, List1array.ElementAt(i).ElementAt(3));
- m_List2.SetItemText(list2pos, 3, List1array.ElementAt(i).ElementAt(4));
- m_List2.SetItemText(list2pos, 4, List1array.ElementAt(i).ElementAt(5));
- str=List1array.ElementAt (i).ElementAt (5);
- list2pos++;
- }
- else
- {
- kind="4";
- m_List3.InsertItem(list3pos, List1array.ElementAt (i).ElementAt (1));
- m_List3.SetItemText(list3pos, 1, List1array.ElementAt (i).ElementAt (2));
- m_List3.SetItemText(list3pos, 2, List1array.ElementAt (i).ElementAt (3));
- m_List3.SetItemText(list3pos, 3, List1array.ElementAt (i).ElementAt (4));
- m_List3.SetItemText(list3pos, 4, List1array.ElementAt (i).ElementAt (5));
- m_List3.SetItemText(list3pos, 5, List1array.ElementAt (i).ElementAt (6));
- #ifdef LKAY_VERSION
- m_List3.SetItemText(list3pos, 6, List1array.ElementAt (i).ElementAt (7));
- m_List3.SetItemText(list3pos, 7, List1array.ElementAt (i).ElementAt (8));
- str=List1array.ElementAt (i).ElementAt (8);
- #else
- str=List1array.ElementAt (i).ElementAt (6);
- #endif
- list3pos++;
- }
- nchoosezs+=GetZS(str);
- GetPath(str);
- if(!str.IsEmpty ())
- str=","+str+",";
- str.MakeLower ();
- if(kind=="4")
- m_no2array.Add (str);
- else
- m_noarray.Add (str);
- }
- }
- else
- {
- for(int i=0; i<sparray.GetSize (); i++)
- {
- kind="4";//sparray.ElementAt (i).ElementAt (4);
- if(kind=="4")
- {
- m_List3.InsertItem(list3pos, sparray.ElementAt (i).ElementAt (7));
- m_List3.SetItemText(list3pos, 1, sparray.ElementAt (i).ElementAt (1));
- m_List3.SetItemText(list3pos, 2, sparray.ElementAt (i).ElementAt (5));
- m_List3.SetItemText(list3pos, 3, sparray.ElementAt (i).ElementAt (2));
- m_List3.SetItemText(list3pos, 4, sparray.ElementAt (i).ElementAt (3));
- #ifdef LKAY_VERSION
- m_List3.SetItemText(list3pos, 5, sparray.ElementAt (i).ElementAt (9));
- m_List3.SetItemText(list3pos, 6, sparray.ElementAt (i).ElementAt (10));
- m_List3.SetItemText(list3pos, 7, sparray.ElementAt (i).ElementAt (8));
- #else
- m_List3.SetItemText(list3pos, 5, sparray.ElementAt (i).ElementAt (8)); // 8 dindansp:no2
- #endif
- list3pos++;
- }
- else
- {
- m_List2.InsertItem(list2pos, sparray.ElementAt (i).ElementAt (7));
- m_List2.SetItemText(list2pos, 1, sparray.ElementAt (i).ElementAt (1));
- m_List2.SetItemText(list2pos, 2, sparray.ElementAt (i).ElementAt (5));
- m_List2.SetItemText(list2pos, 3, sparray.ElementAt (i).ElementAt (3));
- m_List2.SetItemText(list2pos, 4, sparray.ElementAt (i).ElementAt (8)); // 8 dindansp:no2
- list2pos++;
- }
- str=sparray.ElementAt (i).ElementAt (8); // 8 dindansp:no2
- str.MakeLower ();
- nchoosezs+=GetZS(str);
- GetPath(str);
- if(!str.IsEmpty ())
- str=","+str+",";
- if(kind=="4")
- m_no2array.Add (str);
- else
- m_noarray.Add (str);
- }
- }
- if(g_List1array.GetSize())
- {
- m_name1 = g_List1array.ElementAt (0).ElementAt (4);
- m_name2 = g_List1array.ElementAt (0).ElementAt (5);
- m_phone1 = g_List1array.ElementAt (0).ElementAt (61);
- m_phone2 = g_List1array.ElementAt (0).ElementAt (62);
- if(!m_name1.IsEmpty ())
- m_name=m_name1+",";
- m_name+=m_name2;
- m_name.TrimRight (",");
- m_waiter3 = g_user.name ;
- m_taoxizs = g_List1array.ElementAt (0).ElementAt (9);
- m_time5 = g_List1array.ElementAt (0).ElementAt (22);
- m_takezs = g_List1array.ElementAt (0).ElementAt (23);
- m_choosezs = g_List1array.ElementAt (0).ElementAt (24);
- m_money3 = g_List1array.ElementAt (0).ElementAt (3);
- m_oldmoney3=m_money3;
- m_bz3 = g_List1array.ElementAt (0).ElementAt (57);
- m_urgent = g_List1array.ElementAt (0).ElementAt (40);
- m_delphotos = g_List1array.ElementAt (0).ElementAt (56);// Jeff获取选设计时,被删除的相片,选取的字段delphotos2;.读取正常,保存时未能正确保存到delphotos2字段;
- //printf("Jeff:看设计:delphotos2=%s\n\n",m_delphotos);//Jeff Printf
- m_status8 = g_List1array.ElementAt (0).ElementAt (55);
- m_time6 = g_List1array.ElementAt (0).ElementAt (48);
- m_time5old=m_time5;
- m_time6old=m_time6;
- m_checkstatus= g_List1array.ElementAt (0).ElementAt (55);
- UpdateData(false);
- }
- else
- {
- m_name1 = "";
- m_name2 = "";
- m_waiter3 = "";
- m_taoxizs = "";
- m_time5 = "";
- m_takezs = "";
- m_choosezs = "";
- m_money3 = "";
- m_bz3 = "";
- m_urgent = "";
- UpdateData(false);
- }
- return 1;
- }
- void ChoosePhotoSkin2::SortArray()
- {
- // if(m_mode2)return;
- m_bSort=!m_bSort;
- CStringArray *pArray[6]={&m_patharray1,&m_patharray2,&m_patharray3,&m_patharray4,&m_patharray5,&m_patharray6};
- if(m_bSort==0)
- {
- for(int i=0; i<6; i++)
- {
- if(pArray[i]->GetSize ())
- {
- int size=pArray[i]->GetSize ()-1;
- CString sTemp;
- int nPos;
- for(int ii=0;ii<size;ii++)
- {
- nPos=rand()%(size-ii);
- sTemp=pArray[i]->ElementAt (size-ii);
- pArray[i]->SetAt (size-ii, pArray[i]->ElementAt (nPos));
- pArray[i]->SetAt (nPos, sTemp);
- }
- }
- }
- }
- else
- {
- for(int i=0; i<6; i++)
- {
- m_combo1.ResetContent ();
- CString Temp;
- int j = 0;
- for( j=0; j<pArray[i]->GetSize (); j++)
- {
- m_combo1.AddString (pArray[i]->ElementAt (j));
- }
- for( j=0; j<pArray[i]->GetSize (); j++)
- {
- m_combo1.GetLBText (j, Temp);
- pArray[i]->SetAt (j, Temp);
- }
- }
- }
- {
- TerminateThread();
- CStringArray *pArray=GetCurArray();
- m_vFileName.clear();
- for(int i=0; i<pArray->GetSize (); i++)
- {
- CString filePath=pArray->ElementAt (i);
- filePath.MakeLower();
- m_vFileName.push_back(filePath);
- }
- LoadThumbImages();
- }
- }
- void ChoosePhotoSkin2::CheckForDisk() // 检查入底;
- {
- int i = 0;
- for( i=0; i<m_List2.GetItemCount (); i++)
- {
- if("入底"==m_List2.GetItemText (i, 2))return;
- }
- for( i=0; i<m_List3.GetItemCount (); i++)
- {
- if("入底"==m_List3.GetItemText (i, 2))return;
- }
- i=m_List3.GetItemCount ();
- m_List3.InsertItem(i, "");
- m_List3.SetItemText(i, 2, "入底");
- m_no2array.Add ("");
- }
- void ChoosePhotoSkin2::CheckForAlbum() // 检查入册;
- {
- int i = 0;
- for( i=0; i<m_List2.GetItemCount (); i++)
- {
- if("入册"==m_List2.GetItemText (i, 2))return;
- }
- for( i=0; i<m_List3.GetItemCount (); i++)
- {
- if("入册"==m_List3.GetItemText (i, 2))return;
- }
- i=m_List3.GetItemCount ();
- m_List3.InsertItem(i, "");
- m_List3.SetItemText(i, 2, "入册");
- m_no2array.Add ("");
- }
- void ChoosePhotoSkin2::GetPhotos()//得看设计
- {
- m_patharray1.RemoveAll ();
- m_path.MakeLower();
- CStringArray dirarray;
- CString str;
- if(1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(m_path), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_dir();
- for (it = coo.begin();coo.end() != it;it ++)
- {
- str=(*it).c_str();
- str.TrimRight ("\\");
- CString dirname=str.Right (str.GetLength ()-str.ReverseFind ('\\')-1);
- if(dirname.Find("DelgaBook")!=-1)
- {
- if(FindArray(&m_patharray1, str)==-1)
- {
- m_patharray1.Add(str);
- }
- }
- if(FindArray(&dirarray, str)==-1)
- {
- dirarray.Add(str);
- }
- }
- }
- if(1)
- {
- for(int i=0; i<dirarray.GetSize (); i++)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it;it ++)
- {
- str=(*it).c_str();
- if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
- if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
- str.MakeLower ();
- m_patharray1.Add (str);
- }
- }
- }
- CStringArray *pArray[1]={&m_patharray1};
- for(int i=0; i<1; i++)
- {
- m_combo1.ResetContent ();
- CString Temp;
- int j = 0;
- for( j=0; j<pArray[i]->GetSize (); j++)
- {
- m_combo1.AddString (pArray[i]->ElementAt (j));
- }
- for( j=0; j<pArray[i]->GetSize (); j++)
- {
- m_combo1.GetLBText (j, Temp);
- pArray[i]->SetAt (j, Temp);
- }
- }
- }
- void ChoosePhotoSkin2::Save()
- {
- CString sql;
- CArray<CStringArray, CStringArray>sparray;
- sparray.SetSize(m_List2.GetItemCount ()+m_no2array.GetSize ());
- int i = 0;
- for( i=0; i<m_List2.GetItemCount (); i++)
- {
- sparray.ElementAt (i).Add ( m_strOrderNumber );
- sparray.ElementAt (i).Add ( m_List2.GetItemText (i, 0) );
- sparray.ElementAt (i).Add ( m_List2.GetItemText (i, 1) );
- sparray.ElementAt (i).Add ( m_List2.GetItemText (i, 2) );
- sparray.ElementAt (i).Add ( m_List2.GetItemText (i, 3) );
- sparray.ElementAt (i).Add ( m_List2.GetItemText (i, 4) );
- }
- for( int j=0; j<m_no2array.GetSize (); j++)
- {
- sparray.ElementAt (i).Add ( m_strOrderNumber );
- sparray.ElementAt (i).Add ( m_List3.GetItemText (j, 0) );
- sparray.ElementAt (i).Add ( m_List3.GetItemText (j, 1) );
- sparray.ElementAt (i).Add ( m_List3.GetItemText (j, 2) );
- sparray.ElementAt (i).Add ( m_List3.GetItemText (j, 3) );
- sparray.ElementAt (i).Add ( m_List3.GetItemText (j, 4) );
- sparray.ElementAt (i).Add ( m_List3.GetItemText (j, 5) );
- #ifdef LKAY_VERSION
- sparray.ElementAt (i).Add ( m_List3.GetItemText (j, 6) );
- sparray.ElementAt (i).Add ( m_List3.GetItemText (j, 7) );
- #endif
- sparray.ElementAt (i).Add ( "4" );
- i++;
- }
- if(sparray.GetSize ()==0)
- {
- sparray.SetSize(1);
- sparray.ElementAt (0).Add (m_strOrderNumber);
- }
- CMemFile memfile;
- CArchive ar(&memfile, CArchive::store);
- for(int ii=0; ii<sparray.GetSize (); ii++)
- {
- sparray.ElementAt (ii).Serialize (ar);
- }
- ar.Close();
- int length=memfile.GetLength ();
- BYTE *pData = memfile.Detach();
- int size=sparray.GetSize ();
- BYTE *pData2=new BYTE[length+sizeof(int)];
- memcpy(pData2, pData, length);
- memcpy(pData2+length, &size, sizeof(int));
- delete []pData;
- length+=sizeof(int);
- CString savepath;
- savepath.Format ("%s\\%s.dat", g_mainpath, m_strOrderNumber);
- if(m_mode2)savepath.Format ("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
- if(1)
- {
- CFile fp;
- fp.Open (savepath, CFile::modeCreate|CFile::modeWrite);
- fp.Write (pData2, length);
- fp.Close ();
- }
- delete []pData2;
- }
- void ChoosePhotoSkin2::DrawLogin()
- {
- CRect rc;
- ((MyBmpButton2*)m_picarray.ElementAt (3))->GetWindowRect (rc);
- ScreenToClient(rc);
- rc.right -=rc.left ;
- rc.left =5;
- rc.right +=5;
- rc.top +=20;
- rc.right -=15;
- CDC *pDC=GetDC();
- Graphics graph(pDC->GetSafeHdc());
- Rect destinationRect(rc.left,rc.top,rc.Width (), rc.Height ());
- RectF layoutRect(rc.left , rc.top, rc.Width (), rc.Height ());
- rc.left /=g_fscalex;
- rc.right /=g_fscalex;
- rc.top /=g_fscaley;
- rc.bottom /=g_fscaley;
- // graph.SetSmoothingMode(SmoothingModeHighQuality);
- graph.DrawImage(m_pBk, destinationRect, rc.left , rc.top ,rc.Width (), rc.Height (),UnitPixel);
- StringFormat format;
- format.SetAlignment(StringAlignmentNear );
- SolidBrush *Brush=new SolidBrush(Color(255,255,255,255));
- CString str;
- str.Format ("张数:%d", m_List1.GetItemCount ());
- int leng=GetLengthEx(str);
- BSTR bstr= str.AllocSysString();
- Gdiplus::Font *g_TimerFont=new Gdiplus::Font(L"黑体", 13);
- graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
- graph.DrawString(
- bstr,
- leng,
- g_TimerFont,
- layoutRect,
- &format,
- Brush);
- delete Brush;
- delete g_TimerFont;
- SysFreeString(bstr);
- ReleaseDC(pDC);
- }
- BOOL ChoosePhotoSkin2::CheckOK(CString name)
- {
- if(name.GetLength ()>4)return 0;
- for(int i=0; i<name.GetLength (); i++)
- {
- if(name.GetAt (i)<'0'||name.GetAt (i)>'9')return 0;
- }
- return 1;
- }
- BOOL ChoosePhotoSkin2::CheckName(CString name)
- {//$001.002.003
- int pos=name.Find ("$");
- if(pos!=0)return 0;
- name.Delete (0,1);
- pos=name.Find (".");
- while(pos!=-1)
- {
- if(CheckOK(name.Left (pos))==0)return 0;
- name=name.Right (name.GetLength ()-pos-1);
- pos=name.Find (".");
- }
- return CheckOK(name);
- }
- void ChoosePhotoSkin2::DelNo(CString no)
- {
- CString no2;
- for(int i=0; i<m_patharray1.GetSize(); i++)
- {
- no2=m_patharray1.ElementAt (i);
- no2=no2.Right (no2.GetLength ()-no2.ReverseFind ('\\')-1);
- no2=no2.Left (no2.Find ('.'));
- if(no==no2)
- {
- m_patharray1.RemoveAt(i);
- return;
- }
- }
- }
- CString ChoosePhotoSkin2::GetZSInfo(int iItem)
- {
- if(m_mode!=1)
- CalChooseZS();
- CString str;
- // str.Format("%d/%d %d+", m_patharray2.GetSize(), atoi(m_taoxizs), max(0,m_patharray2.GetSize()-atoi(m_taoxizs)));
- CString scount=m_List1.GetItemText (iItem, 0);
- int ncount=0;
- int npos=scount.Find ("\r\n");
- while(npos!=-1)
- {
- ncount++;
- scount=scount.Right (scount.GetLength ()-npos-2);
- npos=scount.Find ("\r\n");
- }
- /* if(m_mode2)
- str.Format("X:%d", ncount);
- else
- str.Format("X:%d %d/%d %d+ S:%d/%d", ncount, m_patharray2.GetSize(), atoi(m_taoxizs), max(0,m_patharray2.GetSize()-atoi(m_taoxizs)), GetNoSelPhotoCount(), max(0, atoi(m_taoxizs)-m_patharray2.GetSize()));
- */
- CString zs = m_taoxizs;
- int pos=zs.Find ("\\");
- if(pos!=-1)
- {
- zs=zs.Left (pos);
- }
- if(m_mode2)
- str.Format("X:%d", ncount);
- else
- str.Format("选中次数:%d 已选/应选:%d/%d\r\n加选:%d+ 未选/剩余:%d/%d", ncount, m_patharray2.GetSize(), atoi(zs), max(0,m_patharray2.GetSize()-atoi(zs)), max(0, atoi(zs)-m_patharray2.GetSize()), GetNoSelPhotoCount());
- return str;
- }
- // GetSelCountFromName
- // 描述:返回相片数量;
- // 参数:
- // [IN]name:
- // dindansp表字段no里的内容;(example:001,002,003(陈天,入册),004)
- // [OUT]scount
- //
- //
- void ChoosePhotoSkin2::GetSelCountFromName(CString name, CString &scount)
- {
- name.TrimLeft(",");
- name.TrimRight(",");
- if(name.GetLength()==0)
- {
- scount="0";
- return;
- }
- // Jeff:处理有问题,若相片名为:003(陈天,入册),这就会多计数一次;
- // 需要完成的一个处理;
- int ncount=0;
- int npos=name.Find(",");
- while(npos!=-1)
- {
- ncount++;
- name=name.Right(name.GetLength()-npos-1);
- npos=name.Find(",");
- }
- ncount++;
- scount.Format("%d", ncount);
- }
- void ChoosePhotoSkin2::CalChooseZS()
- {
- m_patharray2.RemoveAll ();
- CString str;
- int i = 0;
- for( i=0; i<m_noarray.GetSize (); i++)
- {
- str=m_noarray.ElementAt (i);
- GetPath(str);
- }
- for( i=0; i<m_no2array.GetSize (); i++)
- {
- str=m_no2array.ElementAt (i);
- GetPath(str);
- }
- }
- //入册
- //
- void ChoosePhotoSkin2::GetAlbumPhoto()//查看入册相片;
- {
- if(m_mode==4)return;
- m_mode=4;
- m_patharray5.RemoveAll ();
- CString photosno;
- int i = 0;
- for( i=0; i<m_List3.GetItemCount (); i++)
- {
- if(m_List3.GetItemText (i, 2)!="入册")continue;
- photosno=m_no2array.ElementAt (i);break;
- }
- photosno=","+photosno+",";
- for(i=m_patharray1.GetSize ()-1; i>=0; i--)
- {
- CString no;
- no=m_patharray1.ElementAt (i);
- no=no.Right (no.GetLength ()-no.ReverseFind ('\\')-1);
- no=no.Left (no.Find ('.'));
- no=","+no;
- no+=",";
- if(photosno.Find (no)!=-1)
- {
- no=m_patharray1.ElementAt (i);
- m_patharray5.Add (no);
- }
- }
- LoadPhotos();
- }
- void ChoosePhotoSkin2::GetDiskPhoto()//查看入底相片;
- {
- if(m_mode==5)return;
- m_mode=5;
- m_patharray6.RemoveAll ();
- CString photosno;
- int i = 0;
- for( i=0; i<m_List3.GetItemCount (); i++)
- {
- if(m_List3.GetItemText (i, 2)!="入底")continue;
- photosno=m_no2array.ElementAt (i);break;
- }
- photosno=","+photosno+",";
- for(i=m_patharray1.GetSize ()-1; i>=0; i--)
- {
- CString no;
- no=m_patharray1.ElementAt (i);
- no=no.Right (no.GetLength ()-no.ReverseFind ('\\')-1);
- no=no.Left (no.Find ('.'));
- no=","+no;
- no+=",";
- if(photosno.Find (no)!=-1)
- {
- no=m_patharray1.ElementAt (i);
- m_patharray6.Add (no);
- }
- }
- LoadPhotos();
- }
- BOOL ChoosePhotoSkin2::ReLoad()
- {
- if(m_mode2==0)
- return GetData();
- else
- return GetData2();
- }
- BOOL ChoosePhotoSkin2::IsPhoto2Exist()
- {
- CString path2;
- CString path=g_path2+"\\";
- path+=m_strOrderNumber;
- path +="\\";
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(path), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- coo = o.co_file();
- return coo.size();
- }
- void ChoosePhotoSkin2::ReLoadPhoto()
- {
- if(!((MyBmpButton2*)m_picarray.ElementAt (8))->GetPushDown ())
- {
- m_path=g_path3+"\\";
- m_path+=m_strOrderNumber;
- m_path +="\\";
- GetPhotos();
- m_bChooseBig=0;
- }
- else
- {
- m_bChooseBig=1;
- IsGrowthTx growthtxdlg;
- growthtxdlg.m_mode=1;
- growthtxdlg.m_strOrderNumber=m_strOrderNumber;
- growthtxdlg.DoModal ();
- m_bGrowthTX=growthtxdlg.m_bGrowthTx;
- m_seltxname=growthtxdlg.m_seltxname;
- m_patharray1.RemoveAll();
- if(CheckHC()) //
- {
- CString str;
- m_bFromLocal=1;
- char path[MAX_PATH];
- ::GetSystemDirectory (path, MAX_PATH);
- CString sysdir=path;
- sysdir+="\\lyfz";
- ::CreateDirectory (sysdir, NULL);
- sysdir+="\\";
- sysdir+=m_strOrderNumber;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(sysdir), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin();coo.end() != it;it ++)
- {
- str=(*it).c_str();
- if(str.GetAt (str.ReverseFind ('\\')+1)!='s' && str.GetAt (str.ReverseFind ('\\')+1)!='m')
- {
- m_patharray1.Add (str);
- }
- }
- }
- if(m_patharray1.GetSize ()==0)
- {
- if(IsPhoto2Exist())
- {
- SelBrunDevice dlg;
- dlg.m_mode=1;
- if(dlg.DoModal ()==IDOK)
- m_nChoosePhotoType=dlg.m_sel;
- else
- m_nChoosePhotoType=0;
- //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
- }
- else AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
- {
- CString path,path2;
- m_path=g_path1+"\\";
- m_path+=m_strOrderNumber;
- m_path +="\\";
- if(m_seltxname!="" && m_seltxname!="全部")
- {
- m_path+=m_seltxname;
- m_path +="\\";
- }
- if(m_nChoosePhotoType==1) // 选片:修片
- {
- m_path=g_path2+"\\";
- m_path+=m_strOrderNumber;
- m_path +="\\";
- }
- CString filename;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(m_path), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin();coo.end() != it;it ++)
- {
- path=(*it).c_str();
- if(path.GetAt (path.ReverseFind ('\\')+1)!='s' && path.GetAt (path.ReverseFind ('\\')+1)!='m')
- {
- path.MakeLower ();
- filename=path.Right(path.GetLength()-path.ReverseFind ('\\')-1);
- if(filename.Find(".")!=-1)
- filename=filename.Left(filename.Find("."));
- if(!myisdigit(filename))continue;
- if(m_nChoosePhotoType==1)
- {
- m_patharray1.Add (path);
- }
- else
- {
- path2=path;
- if(m_nChoosePhotoType==0)
- path2.Replace ("客户原片", "修好的片");
- if(m_bGrowthTX==0)
- {
- int pos=path2.Find (m_strOrderNumber);
- pos+=m_strOrderNumber.GetLength ();
- int pos2=path2.ReverseFind ('\\');
- path2=path2.Left (pos)+path2.Right (path2.GetLength ()-pos2);
- }
- if(m_nChoosePhotoType==0 && ::PathFileExists (path2))
- {
- m_patharray1.Add (path2);
- }
- else
- {
- path2.Replace (".raw", ".jpg");
- if(::PathFileExists (path2))
- {
- m_patharray1.Add (path2);continue;
- }
- path2.Replace (".nef", ".jpg");
- if(::PathFileExists (path2))
- {
- m_patharray1.Add (path2);continue;
- }
- path2.Replace (".cr2", ".jpg");
- if(::PathFileExists (path2))
- {
- m_patharray1.Add (path2);continue;
- }
- else
- {
- if(path.Right(3)!="jpg")continue;
- m_patharray1.Add (path);
- }
- }
- }
- }
- }
- }
- // if(0)
- {//多种修好的效果
- CString path,path2;
- path2=g_path2+"\\";
- path2+=m_strOrderNumber;
- path2 +="\\";
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(path2), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it ++)
- {
- path=(*it).c_str();
- if(path.GetAt (path.ReverseFind ('\\')+1)!='s' && path.GetAt (path.ReverseFind ('\\')+1)!='m')
- {
- path.MakeLower();
- path2=path.Right (path.GetLength ()-path.ReverseFind ('\\')-1);
- if(path2.Find ("-")!=-1)
- {
- m_patharray1.Add (path);
- }
- }
- }
- }
- /////////////////
- if(0)//atoi(g_cominfoarray.ElementAt(0).ElementAt(109))==0)
- {
- char path[MAX_PATH];
- ::GetSystemDirectory (path, MAX_PATH);
- CString sysdir=path;
- sysdir+="\\lyfz";
- ::CreateDirectory (sysdir, NULL);
- sysdir+="\\";
- sysdir+=m_strOrderNumber;
- ::CreateDirectory (sysdir, NULL);
- sysdir+="\\";
- ImportPhoto dlg;
- dlg.m_bCopyToLocal=1;
- dlg.m_mode =1;
- dlg.m_pArray=&m_patharray1;
- dlg.m_savepath =sysdir;
- dlg.DoModal ();
- CStringArray temparray;
- CString filename;
- for(int i=0; i<m_patharray1.GetSize(); i++)
- {
- filename=m_patharray1.ElementAt(i);
- filename=filename.Right (filename.GetLength ()-filename.ReverseFind ('\\')-1);
- temparray.Add(sysdir+filename);
- }
- m_patharray1.RemoveAll();
- m_patharray1.Copy(temparray);
- }
- }
- if(m_patharray1.GetSize () && atoi(g_cominfoarray.ElementAt(0).ElementAt(61)))
- {
- int size=m_patharray1.GetSize ()-1;
- CString sTemp;
- int nPos;
- for(int i=0;i<size;i++)
- {
- nPos=rand()%(size-i);
- sTemp=m_patharray1.ElementAt (size-i);
- m_patharray1.SetAt (size-i, m_patharray1.ElementAt (nPos));
- m_patharray1.SetAt (nPos, sTemp);
- }
- }
- }
- m_mode=0;
- LoadPhotos();
- }
- BOOL ChoosePhotoSkin2::CheckHC()//检查本机上是否有缓存的相片;
- {
- char path[MAX_PATH];
- ::GetSystemDirectory (path, MAX_PATH); //printf("Jeff:CheckHC::path=%s\n\n",path);//Jeff Printf
- CString sysdir=path;
- sysdir+="\\lyfz";
- ::CreateDirectory (sysdir, NULL); //printf("Jeff:CheckHC::sysdir1=%s\n\n",sysdir);//Jeff Printf
- sysdir+="\\";
- sysdir+=m_strOrderNumber; //printf("Jeff:CheckHC::sysdir2=%s\n\n",sysdir);//Jeff Printf
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(sysdir), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- coo = o.co_file();
- if( coo.size())
- {
- if(AfxMessageBox("提醒, 此客人有本机缓存片,是否使用缓存片?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
- return 1;
- }
- return 0;
- }
|